@hotmeshio/long-tail 0.20.0 → 0.21.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/README.md +4 -4
- package/build/api/escalations/accumulate.d.ts +104 -0
- package/build/api/escalations/accumulate.js +541 -0
- package/build/api/escalations/index.d.ts +1 -0
- package/build/api/escalations/index.js +11 -1
- package/build/api/roles.d.ts +4 -5
- package/build/api/roles.js +53 -4
- package/build/api/scan-codes/context.d.ts +14 -1
- package/build/api/scan-codes/context.js +30 -2
- package/build/api/scan-codes/execute.js +2 -0
- package/build/api/scan-codes/identity.js +1 -0
- package/build/api/scan-codes/verbs.d.ts +21 -0
- package/build/api/scan-codes/verbs.js +122 -3
- package/build/index.d.ts +2 -1
- package/build/index.js +63 -2
- package/build/lib/db/schemas/036_role_portals.sql +12 -0
- package/build/routes/escalations/accumulate.d.ts +7 -0
- package/build/routes/escalations/accumulate.js +158 -0
- package/build/routes/escalations/index.js +5 -0
- package/build/sdk/index.d.ts +28 -0
- package/build/sdk/index.js +9 -0
- package/build/services/escalation/accumulate.d.ts +81 -0
- package/build/services/escalation/accumulate.js +154 -0
- package/build/services/escalation/index.d.ts +1 -0
- package/build/services/escalation/index.js +1 -0
- package/build/services/mcp/playwright-server/schemas.d.ts +2 -2
- package/build/services/orchestrator/condition.d.ts +40 -3
- package/build/services/orchestrator/condition.js +42 -2
- package/build/services/role/index.js +1 -0
- package/build/services/role/seed.js +6 -1
- package/build/services/role/sql.d.ts +6 -3
- package/build/services/role/sql.js +7 -2
- package/build/services/role/types.d.ts +38 -10
- package/build/services/role/types.js +10 -1
- package/build/services/scan-code/index.d.ts +1 -1
- package/build/services/scan-code/index.js +3 -1
- package/build/services/scan-code/parse.d.ts +17 -3
- package/build/services/scan-code/parse.js +37 -4
- package/build/services/scan-code/validate.js +35 -0
- package/build/shared/form-validation/display-only-widgets.d.ts +16 -0
- package/build/shared/form-validation/display-only-widgets.js +25 -0
- package/build/shared/form-validation/index.d.ts +2 -0
- package/build/shared/form-validation/index.js +2 -0
- package/build/shared/form-validation/x-lt-bind.d.ts +2 -14
- package/build/shared/form-validation/x-lt-bind.js +12 -8
- package/build/shared/form-validation/x-lt-invoke.d.ts +38 -0
- package/build/shared/form-validation/x-lt-invoke.js +103 -0
- package/build/system/mcp-servers/admin/escalations.js +44 -0
- package/build/system/mcp-servers/admin/schemas.d.ts +195 -13
- package/build/system/mcp-servers/admin/schemas.js +40 -3
- package/build/system/mcp-servers/admin/users.js +1 -0
- package/build/system/mcp-servers/docs.js +4 -0
- package/build/system/mcp-servers/human-queue-schemas.d.ts +85 -0
- package/build/system/mcp-servers/human-queue-schemas.js +19 -1
- package/build/system/mcp-servers/human-queue.d.ts +2 -0
- package/build/system/mcp-servers/human-queue.js +77 -0
- package/build/system/seed/tool-manifests-admin.d.ts +1108 -100
- package/build/system/seed/tool-manifests-admin.js +4 -1
- package/build/system/seed/tool-manifests-escalation.d.ts +174 -0
- package/build/system/seed/tool-manifests-escalation.js +56 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/escalation.d.ts +52 -0
- package/build/types/escalation.js +29 -1
- package/build/types/index.d.ts +4 -4
- package/build/types/index.js +4 -1
- package/build/types/scan-code.d.ts +55 -1
- package/build/types/scan-code.js +29 -2
- package/build/types/startup.d.ts +20 -0
- package/dashboard/dist/assets/{AdminDashboard-DplvDBti.js → AdminDashboard-Covdam48.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-DplvDBti.js.map → AdminDashboard-Covdam48.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-D8Bf6YxO.js → AgentConfigPage-CE1k6J5r.js} +6 -6
- package/dashboard/dist/assets/{AgentConfigPage-D8Bf6YxO.js.map → AgentConfigPage-CE1k6J5r.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-BN8g0Y2G.js → AgentDetailPage-CWJZIZP1.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-BN8g0Y2G.js.map → AgentDetailPage-CWJZIZP1.js.map} +1 -1
- package/dashboard/dist/assets/AgentsPage---Dg5ufF.js +2 -0
- package/dashboard/dist/assets/{AgentsPage-7JJBHku8.js.map → AgentsPage---Dg5ufF.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-CpbC8oTN.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-CpbC8oTN.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-CGCnIz8I.js → BotPicker-D3drO3-T.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-CGCnIz8I.js.map → BotPicker-D3drO3-T.js.map} +1 -1
- package/dashboard/dist/assets/BulkAssignModal-BOAWsViq.js +2 -0
- package/dashboard/dist/assets/{BulkAssignModal-NJBcoj-f.js.map → BulkAssignModal-BOAWsViq.js.map} +1 -1
- package/dashboard/dist/assets/CapabilitiesPage-RGgD3YZO.js +2 -0
- package/dashboard/dist/assets/{CapabilitiesPage-F8dpNn9B.js.map → CapabilitiesPage-RGgD3YZO.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-BZW6VpCU.js → CollapsibleSection-DNkZn87n.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-BZW6VpCU.js.map → CollapsibleSection-DNkZn87n.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-64adXLdq.js → ConfirmDeleteModal-BqzOwhPr.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-64adXLdq.js.map → ConfirmDeleteModal-BqzOwhPr.js.map} +1 -1
- package/dashboard/dist/assets/{CountdownTimer-BxDub9d2.js → CountdownTimer-BaexQMK6.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-BxDub9d2.js.map → CountdownTimer-BaexQMK6.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-CnLzopLL.js → CredentialsPage-D7abp0aS.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-CnLzopLL.js.map → CredentialsPage-D7abp0aS.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-CAD5UYDT.js → CronLabel-DZiWmTwJ.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-CAD5UYDT.js.map → CronLabel-DZiWmTwJ.js.map} +1 -1
- package/dashboard/dist/assets/DataTable-spX1dFyb.js +2 -0
- package/dashboard/dist/assets/DataTable-spX1dFyb.js.map +1 -0
- package/dashboard/dist/assets/{DropZone-XlcY8hEH.js → DropZone-f1o-GLM8.js} +2 -2
- package/dashboard/dist/assets/{DropZone-XlcY8hEH.js.map → DropZone-f1o-GLM8.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-CwO4ufd0.js → ElapsedCell-BdGO_w4v.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-CwO4ufd0.js.map → ElapsedCell-BdGO_w4v.js.map} +1 -1
- package/dashboard/dist/assets/EntityTimelinePanel-DIDcF5Yu.js +2 -0
- package/dashboard/dist/assets/{EntityTimelinePanel-CkF-oW-m.js.map → EntityTimelinePanel-DIDcF5Yu.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-h9JO_q5f.js → EscalationListSchemaPage-C28rn9XC.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-h9JO_q5f.js.map → EscalationListSchemaPage-C28rn9XC.js.map} +1 -1
- package/dashboard/dist/assets/EscalationListView-CkBnkpDJ.js +2 -0
- package/dashboard/dist/assets/EscalationListView-CkBnkpDJ.js.map +1 -0
- package/dashboard/dist/assets/{EscalationSchemaPage-mJFL5_Se.js → EscalationSchemaPage-W5r0A1kj.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-mJFL5_Se.js.map → EscalationSchemaPage-W5r0A1kj.js.map} +1 -1
- package/dashboard/dist/assets/EscalationTimeline-DKyTz6sM.js +2 -0
- package/dashboard/dist/assets/EscalationTimeline-DKyTz6sM.js.map +1 -0
- package/dashboard/dist/assets/EscalationTitleSelect-CzKfavri.js +2 -0
- package/dashboard/dist/assets/EscalationTitleSelect-CzKfavri.js.map +1 -0
- package/dashboard/dist/assets/{EscalationsOverview-DlXUFqWJ.js → EscalationsOverview-Tdu3Yx2c.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DlXUFqWJ.js.map → EscalationsOverview-Tdu3Yx2c.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-Ike2xchn.js → EventTable-DiIxOJwO.js} +2 -2
- package/dashboard/dist/assets/{EventTable-Ike2xchn.js.map → EventTable-DiIxOJwO.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-DMOR-O1c.js → FilterBar-CvMBCVIo.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-DMOR-O1c.js.map → FilterBar-CvMBCVIo.js.map} +1 -1
- package/dashboard/dist/assets/GraphInvokePage-DO-yyhi6.js +2 -0
- package/dashboard/dist/assets/{GraphInvokePage-CKtvWowP.js.map → GraphInvokePage-DO-yyhi6.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-DSS3eHR2.js +2 -0
- package/dashboard/dist/assets/{HomePage-BQ3Q791Q.js.map → HomePage-DSS3eHR2.js.map} +1 -1
- package/dashboard/dist/assets/ListToolbar-C3-Tqqub.js +2 -0
- package/dashboard/dist/assets/{ListToolbar-DdJzj472.js.map → ListToolbar-C3-Tqqub.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-BbtrduWn.js → McpOverview-DEJmsdVi.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-BbtrduWn.js.map → McpOverview-DEJmsdVi.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-C1L4T-Wt.js → McpQueryDetailPage-DYJr16l7.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-C1L4T-Wt.js.map → McpQueryDetailPage-DYJr16l7.js.map} +1 -1
- package/dashboard/dist/assets/McpQueryPage-BBcG_UuU.js +2 -0
- package/dashboard/dist/assets/{McpQueryPage-CfJy7HZ7.js.map → McpQueryPage-BBcG_UuU.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-CA9yv7he.js → McpRunDetailPage-C6xw0kBg.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-CA9yv7he.js.map → McpRunDetailPage-C6xw0kBg.js.map} +1 -1
- package/dashboard/dist/assets/McpRunsPage-CRQqrF4Q.js +2 -0
- package/dashboard/dist/assets/{McpRunsPage-D7QXjW9z.js.map → McpRunsPage-CRQqrF4Q.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-Bb3revqD.js → NamespacePill-DADRJOUl.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-Bb3revqD.js.map → NamespacePill-DADRJOUl.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-Dlfwzf-0.js +3 -0
- package/dashboard/dist/assets/OperationsPage-Dlfwzf-0.js.map +1 -0
- package/dashboard/dist/assets/OperatorDashboard-DoiDGZ9R.js +2 -0
- package/dashboard/dist/assets/{OperatorDashboard-sXNDh1Ph.js.map → OperatorDashboard-DoiDGZ9R.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-Di5Sz3an.js → PageHeader-Csq434-v.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-Di5Sz3an.js.map → PageHeader-Csq434-v.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-DutKJ-h2.js → PageHeaderWithStats-CSnk1p5A.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-DutKJ-h2.js.map → PageHeaderWithStats-CSnk1p5A.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-NeHD-Gra.js → PersonaDetailPage-BzbA4Prr.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-NeHD-Gra.js.map → PersonaDetailPage-BzbA4Prr.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-DavKXRWX.js → PersonasPage-B36yn4hU.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-DavKXRWX.js.map → PersonasPage-B36yn4hU.js.map} +1 -1
- package/dashboard/dist/assets/PortalPage-BkD4YfDf.js +2 -0
- package/dashboard/dist/assets/PortalPage-BkD4YfDf.js.map +1 -0
- package/dashboard/dist/assets/{ProcessDetailPage-DkdKJGe6.js → ProcessDetailPage-BT0eiBWY.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-DkdKJGe6.js.map → ProcessDetailPage-BT0eiBWY.js.map} +1 -1
- package/dashboard/dist/assets/ProcessesListPage-BEqeeNae.js +2 -0
- package/dashboard/dist/assets/{ProcessesListPage-CjwVKe32.js.map → ProcessesListPage-BEqeeNae.js.map} +1 -1
- package/dashboard/dist/assets/ResolverForm-BwgjIX97.js +7 -0
- package/dashboard/dist/assets/ResolverForm-BwgjIX97.js.map +1 -0
- package/dashboard/dist/assets/RoleDetailPage-BFuLNJXa.js +8 -0
- package/dashboard/dist/assets/RoleDetailPage-BFuLNJXa.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-DhnVPK4q.js → RolePill-BafrASDX.js} +2 -2
- package/dashboard/dist/assets/{RolePill-DhnVPK4q.js.map → RolePill-BafrASDX.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-OM9KM8Pg.js → RolesPage-80quJU5-.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-OM9KM8Pg.js.map → RolesPage-80quJU5-.js.map} +1 -1
- package/dashboard/dist/assets/RunAsSelector-BoePhWVD.js +2 -0
- package/dashboard/dist/assets/{RunAsSelector-fFMt1bGe.js.map → RunAsSelector-BoePhWVD.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-AujH-pPQ.js → ScanCodesPage-Cu1bKEix.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-AujH-pPQ.js.map → ScanCodesPage-Cu1bKEix.js.map} +1 -1
- package/dashboard/dist/assets/ScanSchemeDetailPage-D9AbS6UY.js +2 -0
- package/dashboard/dist/assets/ScanSchemeDetailPage-D9AbS6UY.js.map +1 -0
- package/dashboard/dist/assets/ScanStationPage-gcZGefvT.js +2 -0
- package/dashboard/dist/assets/{ScanStationPage-C1_ppDoZ.js.map → ScanStationPage-gcZGefvT.js.map} +1 -1
- package/dashboard/dist/assets/{ScopeBadge-CXUg0FHo.js → ScopeBadge-b6MIBiYD.js} +2 -2
- package/dashboard/dist/assets/{ScopeBadge-CXUg0FHo.js.map → ScopeBadge-b6MIBiYD.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-B91Pk9xh.js → StickyPagination-9ITrei_d.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-B91Pk9xh.js.map → StickyPagination-9ITrei_d.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-C7SPqaJt.js → StreamMessageDetail-BkYvEHFY.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-C7SPqaJt.js.map → StreamMessageDetail-BkYvEHFY.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-BcHR8ylf.js → SwimlaneTimeline-B1rotFix.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-BcHR8ylf.js.map → SwimlaneTimeline-B1rotFix.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-BZ8vb2oW.js → TagInput-ZrIIrEUP.js} +2 -2
- package/dashboard/dist/assets/{TagInput-BZ8vb2oW.js.map → TagInput-ZrIIrEUP.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-Bqj0I_I0.js → TaskDetailPage-zhn_U_eC.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-Bqj0I_I0.js.map → TaskDetailPage-zhn_U_eC.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-Bxir8WRl.js → TaskQueuePill-DkQ1uc6y.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-Bxir8WRl.js.map → TaskQueuePill-DkQ1uc6y.js.map} +1 -1
- package/dashboard/dist/assets/TasksListPage-CNbNeagx.js +2 -0
- package/dashboard/dist/assets/{TasksListPage-BB1f79lL.js.map → TasksListPage-CNbNeagx.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-BFnODmNe.js → TimeAgo-0YVMBwls.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-BFnODmNe.js.map → TimeAgo-0YVMBwls.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BXgLOBsr.js → TimestampCell-DB7r3np8.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BXgLOBsr.js.map → TimestampCell-DB7r3np8.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-FkgTXIhq.js → ToolPill-Baxm02L6.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-FkgTXIhq.js.map → ToolPill-Baxm02L6.js.map} +1 -1
- package/dashboard/dist/assets/ToolTestPanel-BLfA02wv.js +2 -0
- package/dashboard/dist/assets/{ToolTestPanel-Bwe3J5lj.js.map → ToolTestPanel-BLfA02wv.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-DAF07vZ9.js → TopicDetailPage-eAqPKShq.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-DAF07vZ9.js.map → TopicDetailPage-eAqPKShq.js.map} +1 -1
- package/dashboard/dist/assets/TopicsPage-BNNWD-zl.js +2 -0
- package/dashboard/dist/assets/{TopicsPage-C1gxBUap.js.map → TopicsPage-BNNWD-zl.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-BzXJUE6q.js → UserName-Pw46tO_k.js} +2 -2
- package/dashboard/dist/assets/{UserName-BzXJUE6q.js.map → UserName-Pw46tO_k.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-SkRU5cRX.js → WorkflowExecutionPage-DvA51lT3.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-SkRU5cRX.js.map → WorkflowExecutionPage-DvA51lT3.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill--AYMW7u_.js → WorkflowPill-ZepbO_ny.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill--AYMW7u_.js.map → WorkflowPill-ZepbO_ny.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowsDashboard-DFDTwnhn.js +2 -0
- package/dashboard/dist/assets/{WorkflowsDashboard-CZAqRk1N.js.map → WorkflowsDashboard-DFDTwnhn.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-BoN44VTE.js → WorkflowsOverview-5i2Tcy-p.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-BoN44VTE.js.map → WorkflowsOverview-5i2Tcy-p.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CqjhtdJf.js → YamlWorkflowDetailPage-p4VEYZS0.js} +11 -11
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CqjhtdJf.js.map → YamlWorkflowDetailPage-p4VEYZS0.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-CwnJkzyb.js → YamlWorkflowsPage-Cq-hMVxl.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-CwnJkzyb.js.map → YamlWorkflowsPage-Cq-hMVxl.js.map} +1 -1
- package/dashboard/dist/assets/{agents-gV0Ys-sY.js → agents-EyBPJMYa.js} +2 -2
- package/dashboard/dist/assets/{agents-gV0Ys-sY.js.map → agents-EyBPJMYa.js.map} +1 -1
- package/dashboard/dist/assets/{bots-B97itB3I.js → bots-DX6jjqtF.js} +2 -2
- package/dashboard/dist/assets/{bots-B97itB3I.js.map → bots-DX6jjqtF.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-CR9xZgGd.js → capabilities-ZdLv9xBQ.js} +2 -2
- package/dashboard/dist/assets/{capabilities-CR9xZgGd.js.map → capabilities-ZdLv9xBQ.js.map} +1 -1
- package/dashboard/dist/assets/{constants-BHkpVaqx.js → constants-CeBBTzf5.js} +2 -2
- package/dashboard/dist/assets/{constants-BHkpVaqx.js.map → constants-CeBBTzf5.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-YxvP1KCa.js → controlplane-CpvZaJuw.js} +2 -2
- package/dashboard/dist/assets/{controlplane-YxvP1KCa.js.map → controlplane-CpvZaJuw.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-Mvsze5eV.js +2 -0
- package/dashboard/dist/assets/escalation-columns-Mvsze5eV.js.map +1 -0
- package/dashboard/dist/assets/index-B_GT23TE.js +3 -0
- package/dashboard/dist/assets/index-B_GT23TE.js.map +1 -0
- package/dashboard/dist/assets/index-BbCjGO3M.js +2 -0
- package/dashboard/dist/assets/{index-CFbo9FU9.js.map → index-BbCjGO3M.js.map} +1 -1
- package/dashboard/dist/assets/{index-DMeaiKgf.js → index-Bhb89oHH.js} +2 -2
- package/dashboard/dist/assets/{index-DMeaiKgf.js.map → index-Bhb89oHH.js.map} +1 -1
- package/dashboard/dist/assets/index-CgUcYveM.js +67 -0
- package/dashboard/dist/assets/index-CgUcYveM.js.map +1 -0
- package/dashboard/dist/assets/index-Cn8uJsd7.js +2 -0
- package/dashboard/dist/assets/{index-BQpV-DTG.js.map → index-Cn8uJsd7.js.map} +1 -1
- package/dashboard/dist/assets/index-D-Xs4rAW.js +2 -0
- package/dashboard/dist/assets/{index-Bp9KBLT5.js.map → index-D-Xs4rAW.js.map} +1 -1
- package/dashboard/dist/assets/{index-DwOnWeu8.js → index-DGmzBY9D.js} +2 -2
- package/dashboard/dist/assets/{index-DwOnWeu8.js.map → index-DGmzBY9D.js.map} +1 -1
- package/dashboard/dist/assets/{index-CIpHj4di.js → index-DZhtP2Ok.js} +2 -2
- package/dashboard/dist/assets/{index-CIpHj4di.js.map → index-DZhtP2Ok.js.map} +1 -1
- package/dashboard/dist/assets/index-Dh8MJl3L.css +1 -0
- package/dashboard/dist/assets/index-DkrBFFSO.js +13 -0
- package/dashboard/dist/assets/{index-Cfvkl2J0.js.map → index-DkrBFFSO.js.map} +1 -1
- package/dashboard/dist/assets/{index-B9BBCqLI.js → index-Eo-l3Lqo.js} +2 -2
- package/dashboard/dist/assets/{index-B9BBCqLI.js.map → index-Eo-l3Lqo.js.map} +1 -1
- package/dashboard/dist/assets/index-PfSRKerc.js +2 -0
- package/dashboard/dist/assets/{index-CUZ6LYye.js.map → index-PfSRKerc.js.map} +1 -1
- package/dashboard/dist/assets/{index-ipqwPavs.js → index-oFKUFGQL.js} +2 -2
- package/dashboard/dist/assets/{index-ipqwPavs.js.map → index-oFKUFGQL.js.map} +1 -1
- package/dashboard/dist/assets/index-z5Hpeidu.js +2 -0
- package/dashboard/dist/assets/index-z5Hpeidu.js.map +1 -0
- package/dashboard/dist/assets/{knowledge-XX6cW4Ob.js → knowledge-CgloEkaf.js} +2 -2
- package/dashboard/dist/assets/{knowledge-XX6cW4Ob.js.map → knowledge-CgloEkaf.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-CH13hNH2.js → mcp-Bix7QYO7.js} +2 -2
- package/dashboard/dist/assets/{mcp-CH13hNH2.js.map → mcp-Bix7QYO7.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-Duydd3JA.js → mcp-query-o-sGX2ST.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-Duydd3JA.js.map → mcp-query-o-sGX2ST.js.map} +1 -1
- package/dashboard/dist/assets/metadata-display-COo3mMCr.js +2 -0
- package/dashboard/dist/assets/metadata-display-COo3mMCr.js.map +1 -0
- package/dashboard/dist/assets/{personas-mDk4lLQS.js → personas-30azkJ_s.js} +2 -2
- package/dashboard/dist/assets/{personas-mDk4lLQS.js.map → personas-30azkJ_s.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-B5GcgCeF.js → pipelines-Bfk2GFK7.js} +2 -2
- package/dashboard/dist/assets/{pipelines-B5GcgCeF.js.map → pipelines-Bfk2GFK7.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-CItmNsRp.js → tasks-CpdopewW.js} +2 -2
- package/dashboard/dist/assets/{tasks-CItmNsRp.js.map → tasks-CpdopewW.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CJYG7BX5.js → topics--bvCV9Yp.js} +2 -2
- package/dashboard/dist/assets/{topics-CJYG7BX5.js.map → topics--bvCV9Yp.js.map} +1 -1
- package/dashboard/dist/assets/useContainerWidth-DSLp1gEm.js +2 -0
- package/dashboard/dist/assets/useContainerWidth-DSLp1gEm.js.map +1 -0
- package/dashboard/dist/assets/{useDebouncedValue-BrwgXcp8.js → useDebouncedValue-Da0lPmj3.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-BrwgXcp8.js.map → useDebouncedValue-Da0lPmj3.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-CHty0HAS.js → useNamespace-DD_Esl6n.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-CHty0HAS.js.map → useNamespace-DD_Esl6n.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-CoTsia7t.js → useYamlActivityEvents-AeAhZJJk.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-CoTsia7t.js.map → useYamlActivityEvents-AeAhZJJk.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-DeBdvyKJ.js → vendor-icons-B7OcUM6b.js} +2 -2
- package/dashboard/dist/assets/{vendor-icons-DeBdvyKJ.js.map → vendor-icons-B7OcUM6b.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-CiWwx5rM.js → yaml-workflows-BHAOOGvn.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-CiWwx5rM.js.map → yaml-workflows-BHAOOGvn.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/accumulator.md +113 -0
- package/docs/api/http/escalations.md +90 -0
- package/docs/api/http/roles.md +1 -0
- package/docs/api/sdk/escalations.md +92 -0
- package/docs/api/sdk/roles.md +2 -0
- package/docs/architecture.md +1 -1
- package/docs/code-owned-configuration.md +2 -1
- package/docs/dashboard.md +10 -4
- package/docs/hitl/design.md +1 -1
- package/docs/hitl/escalation.md +37 -1
- package/docs/hitl/invoke-form.md +4 -0
- package/docs/hitl/pinned-views.md +4 -0
- package/docs/hitl/portal.md +97 -0
- package/docs/hitl/resolution.md +41 -0
- package/docs/hitl/x-lt-embed.md +1 -1
- package/docs/hitl/x-lt-invoke.md +95 -0
- package/docs/hitl/x-lt-list-schema.md +3 -1
- package/docs/hitl/x-lt-widget.md +1 -0
- package/docs/hitl-guide.md +8 -1
- package/docs/scan-codes.md +33 -9
- package/docs/sdk.md +1 -1
- package/docs/workflows.md +2 -2
- package/package.json +4 -2
- package/dashboard/dist/assets/AgentsPage-7JJBHku8.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-lz5qwSjg.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-lz5qwSjg.js.map +0 -1
- package/dashboard/dist/assets/BulkAssignModal-NJBcoj-f.js +0 -2
- package/dashboard/dist/assets/CapabilitiesPage-F8dpNn9B.js +0 -2
- package/dashboard/dist/assets/DataTable-7C7riavf.js +0 -2
- package/dashboard/dist/assets/DataTable-7C7riavf.js.map +0 -1
- package/dashboard/dist/assets/EntityTimelinePanel-CkF-oW-m.js +0 -2
- package/dashboard/dist/assets/EscalationListView-AHW2xtlr.js +0 -2
- package/dashboard/dist/assets/EscalationListView-AHW2xtlr.js.map +0 -1
- package/dashboard/dist/assets/GraphInvokePage-CKtvWowP.js +0 -2
- package/dashboard/dist/assets/HomePage-BQ3Q791Q.js +0 -2
- package/dashboard/dist/assets/ListToolbar-DdJzj472.js +0 -2
- package/dashboard/dist/assets/McpQueryPage-CfJy7HZ7.js +0 -2
- package/dashboard/dist/assets/McpRunsPage-D7QXjW9z.js +0 -2
- package/dashboard/dist/assets/OperationsPage-aLHHAP2X.js +0 -3
- package/dashboard/dist/assets/OperationsPage-aLHHAP2X.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-sXNDh1Ph.js +0 -2
- package/dashboard/dist/assets/ProcessesListPage-CjwVKe32.js +0 -2
- package/dashboard/dist/assets/ResolverForm-Bk-wDkN-.js +0 -3
- package/dashboard/dist/assets/ResolverForm-Bk-wDkN-.js.map +0 -1
- package/dashboard/dist/assets/RoleDetailPage-WQt0y5l7.js +0 -8
- package/dashboard/dist/assets/RoleDetailPage-WQt0y5l7.js.map +0 -1
- package/dashboard/dist/assets/RunAsSelector-fFMt1bGe.js +0 -2
- package/dashboard/dist/assets/ScanSchemeDetailPage-eKQpmsC_.js +0 -2
- package/dashboard/dist/assets/ScanSchemeDetailPage-eKQpmsC_.js.map +0 -1
- package/dashboard/dist/assets/ScanStationPage-C1_ppDoZ.js +0 -2
- package/dashboard/dist/assets/TasksListPage-BB1f79lL.js +0 -2
- package/dashboard/dist/assets/ToolTestPanel-Bwe3J5lj.js +0 -2
- package/dashboard/dist/assets/TopicsPage-C1gxBUap.js +0 -2
- package/dashboard/dist/assets/WorkflowsDashboard-CZAqRk1N.js +0 -2
- package/dashboard/dist/assets/escalation-columns-uq-IV2aj.js +0 -2
- package/dashboard/dist/assets/escalation-columns-uq-IV2aj.js.map +0 -1
- package/dashboard/dist/assets/index-3ezfWLkE.js +0 -6
- package/dashboard/dist/assets/index-3ezfWLkE.js.map +0 -1
- package/dashboard/dist/assets/index-BQpV-DTG.js +0 -2
- package/dashboard/dist/assets/index-Bp9KBLT5.js +0 -2
- package/dashboard/dist/assets/index-Bpvfr4OW.css +0 -1
- package/dashboard/dist/assets/index-CFbo9FU9.js +0 -2
- package/dashboard/dist/assets/index-CIwlVfvV.js +0 -67
- package/dashboard/dist/assets/index-CIwlVfvV.js.map +0 -1
- package/dashboard/dist/assets/index-CUZ6LYye.js +0 -2
- package/dashboard/dist/assets/index-Cfvkl2J0.js +0 -13
- package/dashboard/dist/assets/index-SGyrXGp8.js +0 -3
- package/dashboard/dist/assets/index-SGyrXGp8.js.map +0 -1
- package/dashboard/dist/assets/invoke-context-DrVyUEfs.js +0 -2
- package/dashboard/dist/assets/invoke-context-DrVyUEfs.js.map +0 -1
- package/dashboard/dist/assets/metadata-display--TzK0REC.js +0 -2
- package/dashboard/dist/assets/metadata-display--TzK0REC.js.map +0 -1
- package/dashboard/dist/assets/resolver-payload-m9AGKZ3a.js +0 -2
- package/dashboard/dist/assets/resolver-payload-m9AGKZ3a.js.map +0 -1
- package/docs/compilation.md +0 -152
- package/docs/compiler.md +0 -311
- package/docs/contributing.md +0 -56
- package/docs/design-principles.md +0 -245
- package/docs/schema-exchange.md +0 -173
- package/docs/self-test.md +0 -106
- package/docs/story.md +0 -184
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as i,j as e}from"./vendor-query-DvWWuNIB.js";import{P as ye}from"./PageHeaderWithStats-DutKJ-h2.js";import{F as we,b as ke}from"./FilterBar-DMOR-O1c.js";import{u as Ne}from"./useFilterParams-DBRw1Hcv.js";import{u as ve}from"./useNamespace-CHty0HAS.js";import{a as ee,u as Ce,b as $e,c as Se,d as _e}from"./controlplane-YxvP1KCa.js";import{M as Te,C as W,k as Ee,J as Re}from"./index-CIwlVfvV.js";import{a8 as K,bM as U,j as Me,bN as Z,G as J,e as te,I as Pe,Y as Ae,ar as Le,R as We,a2 as Qe,bO as Fe,u as Oe,Z as Be,ao as ze}from"./vendor-icons-DeBdvyKJ.js";import{C as I}from"./CollapsibleSection-BZW6VpCU.js";import{T as Ie}from"./TaskQueuePill-Bxir8WRl.js";import{D as Je}from"./DataTable-7C7riavf.js";import{R as De,a as Y}from"./RowActions-Bdd7z4eB.js";import{f as Ue}from"./vendor-react-_9U4mKFr.js";import"./EmptyState-DgC_6njU.js";const Ve=[{label:"15m",value:"15m"},{label:"30m",value:"30m"},{label:"1h",value:"1h"},{label:"1d",value:"1d"},{label:"7d",value:"7d"}],se={pong:"text-status-success",ping:"text-accent",throttle:"text-status-warning",job:"text-purple-400",work:"text-text-secondary",activate:"text-status-error",cron:"text-text-tertiary",user:"text-text-secondary"},He={pong:"roll call",ping:"ping",throttle:"throttle",job:"job",work:"work",activate:"activate",cron:"cron",user:"user"},qe=250;function M(t){return!!t.worker_topic}function P(t){return typeof t.throttle=="number"&&t.throttle!==0}function V(t){return t===void 0||t===0?"Normal":t===-1?"Paused":t>=864e5?`${(t/864e5).toFixed(0)}d`:t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`}function Ge(t){if(!t)return null;const s=t.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\.(\d+)$/);if(s){const[,r,n,o,u,l,m,d]=s;return new Date(`${r}-${n}-${o}T${u}:${l}:${m}.${d}Z`)}const a=new Date(t);return isNaN(a.getTime())?null:a}function Ke(t){const s=Ge(t);if(!s)return"--";const a=Date.now()-s.getTime();if(a<0||isNaN(a))return"--";const r=Math.floor(a/1e3);if(r<60)return`${r}s`;const n=Math.floor(r/60);if(n<60)return`${n}m`;const o=Math.floor(n/60);return o<24?`${o}h ${n%60}m`:`${Math.floor(o/24)}d ${o%24}h`}function ne(t){return t.replace(/^hmsh:[^:]+:x:/,"")||"(engine)"}function F(t){const s=t.match(/^([^:]+)::(.+?)-[A-Za-z0-9_]{10,}$/);return s?s[2]:t.length>20?t.slice(0,20)+"...":t}function Ze(t){const s=t.match(/^([^:]+)::/);return(s==null?void 0:s[1])||""}const re=[{key:"pong",label:"Roll Call",description:"Node health check responses"},{key:"ping",label:"Ping",description:"Health check broadcasts"},{key:"throttle",label:"Throttle",description:"Throttle commands"},{key:"job",label:"Job",description:"Job lifecycle events"},{key:"work",label:"Work",description:"Worker dispatch events"},{key:"activate",label:"Activate",description:"Worker activation"},{key:"cron",label:"Cron",description:"Cron schedule triggers"},{key:"user",label:"User",description:"User-defined messages"}];function B(t){return`${t.engine_id}-${t.worker_topic||"engine"}`}function Ye(t){const s=new Map;for(const a of t){if(!a.worker_topic)continue;const r=a.worker_topic;s.has(r)||s.set(r,[]),s.get(r).push(a)}return s}function T(t){let s=0,a=0,r=0;for(const n of t)if(n.counts)for(const[o,u]of Object.entries(n.counts))s+=u,o==="200"?a+=u:o==="500"&&(r+=u);return{total:s,success:a,errors:r}}function Xe(t){let s=0;for(const a of t)typeof a.stream_depth=="number"&&(s+=a.stream_depth);return s}function et(t){if(t.length===0)return"healthy";if(t.every(r=>r.throttle===-1))return"paused";const{errors:a}=T(t);return a>0||t.some(P)?"degraded":"healthy"}function tt({activeAppId:t,allProfiles:s,profiles:a}){const r=ee(),[n,o]=i.useState(new Set),[u,l]=i.useState(!1),[m,d]=i.useState([]);i.useEffect(()=>{o(new Set)},[t]);const k=i.useCallback(h=>{o(C=>{const f=new Set(C),$=B(h);return f.has($)?f.delete($):f.add($),f})},[]),b=i.useCallback(()=>{n.size===a.length?o(new Set):o(new Set(a.map(B)))},[a,n.size]),j=i.useMemo(()=>{const h=a.filter(N=>n.has(B(N)));if(h.length===0)return[];if(h.length===s.length)return[{label:"Entire Mesh"}];const C=h.filter(N=>!M(N)),f=h.filter(M),$=[];for(const N of C)$.push({label:`Engine ${N.engine_id}`,guid:N.engine_id,scope:"engines"});const A=new Map;for(const N of f){const R=N.worker_topic;A.has(R)||A.set(R,[]),A.get(R).push(N)}for(const[N,R]of A){const O=s.filter(L=>L.worker_topic===N);if(R.length===O.length)$.push({label:N,topic:N});else for(const L of R)$.push({label:`${N} ${L.engine_id}`,guid:L.engine_id})}return $},[a,s,n]);return{selectedIds:n,setSelectedIds:o,toggleCheckbox:k,toggleAll:b,throttleModalOpen:u,throttleTargets:m,selectedThrottleTargets:j,throttleMutation:r,handleBulkThrottle:h=>{const C=m.length>0?m:j;for(const f of C)r.mutate({appId:t,throttle:h,...f.topic?{topic:f.topic}:{},...f.guid?{guid:f.guid}:{},...f.scope?{scope:f.scope}:{}});l(!1),d([])},handleRowClick:(h,C)=>{const f=M(h)?`${h.worker_topic} ${h.engine_id}`:`Engine ${h.engine_id}`;d([{label:f,guid:h.engine_id,scope:C||(M(h)?"workers":"engines")}]),l(!0)},handleBulkThrottleOpen:()=>{d(j),l(!0)},handleResumeThrottle:(h,C)=>{const f=C||(M(h)?"workers":"engines");r.mutate({appId:t,throttle:0,guid:h.engine_id,scope:f})},handleResumeQueue:h=>{r.mutate({appId:t,throttle:0,topic:h})},handleQueueThrottle:h=>{d([{label:h,topic:h}]),l(!0)},closeThrottleModal:()=>{l(!1),d([])}}}const st=[{label:"Resume",ms:0},{label:"0.5s",ms:500},{label:"1s",ms:1e3},{label:"5s",ms:5e3},{label:"30s",ms:3e4},{label:"Pause",ms:-1}];function nt({target:t}){const s=t.label==="Entire Mesh",a=t.label==="All Engines"||t.label.startsWith("Engine "),r=s?"bg-status-error/10 text-status-error":a?"bg-status-active/10 text-status-active":"bg-accent/[0.06] text-text-secondary",n=t.scope==="engines"?"engine only":t.scope==="workers"?"worker only":t.guid?"guid":t.topic?"topic":"mesh";return e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-2xs font-medium rounded-lg ${r}`,children:[t.label,e.jsx("span",{className:"text-2xs opacity-50",children:n})]})}function rt({open:t,onClose:s,targets:a,onApply:r,isPending:n}){const[o,u]=i.useState("");return e.jsx(Te,{open:t,onClose:s,title:"Adjust Throttle",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Targets"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map((l,m)=>e.jsx(nt,{target:l},l.guid||l.topic||m))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:st.map(l=>e.jsx("button",{onClick:()=>r(l.ms),disabled:n,className:`px-3 py-1.5 text-xs rounded transition-colors ${l.ms===-1?"bg-status-error/10 text-status-error hover:bg-status-error/20":l.ms===0?"bg-status-success/10 text-status-success hover:bg-status-success/20":"bg-surface-sunken text-text-secondary hover:bg-surface-hover"} disabled:opacity-50`,children:l.label},l.label))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Custom delay (seconds)"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"number",step:"0.1",min:"0",value:o,onChange:l=>u(l.target.value),placeholder:"e.g. 2.5",className:"input text-xs py-1.5 px-3 w-28"}),e.jsx("button",{onClick:()=>{const l=parseFloat(o);isNaN(l)||l<0||r(Math.round(l*1e3))},disabled:n,className:"btn-primary text-xs py-1.5 px-4 disabled:opacity-50",children:"Apply"})]})]})]})})}function at(){const{data:t}=Ce(),s=ee(),[a,r]=i.useState(null),[n,o]=i.useState(!1),u=(t==null?void 0:t.apps)??[],l=i.useCallback(async(d,k="all")=>{if(u.length===0)return;o(!0);const b=await Promise.allSettled(u.map(v=>s.mutateAsync({appId:v.appId,throttle:d,...k!=="all"?{scope:k}:{}}))),j=b.filter(v=>v.status==="rejected").length;j>0&&console.error(`Emergency throttle: ${j}/${b.length} apps failed`),o(!1),r(null)},[u,s]),m=d=>d==="engines"?"engines":d==="workers"?"workers":"everything";return a?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-status-error",children:["Pause ",m(a.scope),"?"]}),e.jsx("button",{onClick:()=>l(a.ms,a.scope),disabled:n,className:"px-2.5 py-1 text-xs rounded-md bg-status-error text-text-inverse hover:bg-status-error/90 transition-colors disabled:opacity-50",children:n?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):"Confirm"}),e.jsx("button",{onClick:()=>r(null),disabled:n,className:"px-2.5 py-1 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>r({ms:-1,scope:"all"}),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-error/80 hover:text-status-error hover:bg-status-error/10 transition-colors disabled:opacity-50",title:"Pause all engines and workers",children:[e.jsx(U,{className:"w-3.5 h-3.5"}),"Pause All"]}),e.jsxs("button",{onClick:()=>l(0),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-success/80 hover:text-status-success hover:bg-status-success/10 transition-colors disabled:opacity-50",title:"Resume all engines and workers",children:[n?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Me,{className:"w-3.5 h-3.5"}),"Resume All"]})]})}function ot({byStream:t,onNodeFilter:s}){const[a,r]=i.useState(!1);if(i.useEffect(()=>{r(!1);const d=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(d)},[t]),t.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary py-4 text-center",children:"No activity in this period"});const n=t.filter(d=>d.stream_type==="engine"),o=t.filter(d=>d.stream_type==="worker"),u=Math.max(...t.map(d=>d.count)),l=d=>{const k=u>0?d.count/u*100:0,b=d.stream_type==="engine",j=b?"(all engines)":ne(d.stream_name),v=b?"bg-status-active/70":"bg-accent/60",y=b?"text-status-active":"text-text-tertiary";return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-2xs font-mono ${y} w-36 truncate text-right shrink-0`,title:d.stream_name,children:j}),e.jsx("div",{className:"flex-1 h-4 bg-surface-sunken rounded overflow-hidden",children:e.jsx("div",{className:`h-full ${v} rounded transition-all duration-500 ease-out`,style:{width:a?`${k}%`:"0%"}})}),e.jsx("span",{className:"text-2xs font-mono tabular-nums text-text-secondary w-12 text-right shrink-0",children:d.count.toLocaleString()})]},`${d.stream_type}-${d.stream_name}`)},m="text-2xs uppercase tracking-widest font-semibold mb-1 cursor-pointer hover:underline";return e.jsxs("div",{className:"space-y-1.5",children:[n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${m} text-status-active/70 hover:text-status-active`,onClick:()=>s==null?void 0:s("engines"),children:"Engine Stream"}),n.map(l),o.length>0&&e.jsx("div",{className:"h-2"})]}),o.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${m} text-accent/70 hover:text-accent`,onClick:()=>s==null?void 0:s("workers"),children:"Worker Streams"}),o.map(l)]})]})}function lt({queue:t,workers:s,expanded:a,onToggle:r,onWorkerClick:n,onResumeThrottle:o,onQueueThrottle:u,onResumeQueue:l,byStream:m,activeDuration:d}){const k=i.useMemo(()=>{const c=m.find(g=>g.stream_type==="worker"&&ne(g.stream_name)===t);return(c==null?void 0:c.count)??0},[m,t]),b=i.useMemo(()=>et(s),[s]),j=i.useMemo(()=>Xe(s),[s]),{errors:v}=i.useMemo(()=>T(s),[s]),y=b==="paused"?"bg-status-error":b==="degraded"?"bg-status-warning":"bg-status-success",x=i.useMemo(()=>[...s].sort((c,g)=>T([g]).total-T([c]).total),[s]),w=i.useMemo(()=>[{key:"engine_id",label:"Router",render:c=>{var h;const g=c.engine_id.replace(/^[^:]+::/,"").replace(/-[A-Za-z0-9_]{10,}$/,"")||c.engine_id,E=((h=c.engine_id.match(/^([^:]+)::/))==null?void 0:h[1])||"";return e.jsxs("div",{className:"flex items-center gap-2",title:c.engine_id,children:[e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[180px]",children:g}),E&&e.jsx("span",{className:"text-2xs text-text-tertiary/50",children:E})]})}},{key:"processed",label:"Processed",render:c=>{const g=T([c]);return e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-tertiary",children:g.total>0?g.total.toLocaleString():"--"})},className:"w-24"},{key:"throttle",label:"Throttle",render:c=>{const g=c.throttle;return g===-1?e.jsx("span",{className:"text-xs text-status-error font-medium",children:"Paused"}):g&&g>0?e.jsx("span",{className:"text-xs text-status-warning font-medium",children:V(g)}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"0"})},className:"w-24"},{key:"actions",label:"",render:c=>e.jsxs(De,{children:[P(c)&&e.jsx(Y,{icon:Z,title:"Resume (remove throttle)",onClick:()=>o(c),colorClass:"text-text-tertiary hover:text-status-success"}),e.jsx(Y,{icon:J,title:"Adjust throttle",onClick:()=>n(c)})]}),className:"w-16"}],[n,o]);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>r(t),className:"group/row relative flex items-center gap-3 w-full py-2 hover:bg-surface-hover transition-colors text-left rounded",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${y}`,title:b}),e.jsx(te,{className:`w-3.5 h-3.5 text-text-tertiary/50 transition-transform duration-200 ${a?"rotate-90":""}`,strokeWidth:2}),e.jsx(Ie,{queue:t,size:"sm"}),e.jsx("span",{className:"flex-1"}),v>0&&e.jsxs("span",{className:"text-2xs text-status-error font-medium mr-2",children:[v," errors"]}),j>0&&e.jsxs("span",{className:"flex items-center gap-1 text-2xs text-status-warning w-20",children:[e.jsx(Pe,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:j.toLocaleString()})]}),e.jsxs("span",{className:`flex items-center gap-1 text-xs w-24 ${s.some(P)?"text-status-warning":"text-text-tertiary"}`,children:[e.jsx(Ae,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:s.length}),e.jsx("span",{children:"workers"})]}),e.jsx("span",{className:"flex items-center gap-1 text-xs font-mono text-text-tertiary w-28 justify-end mr-16",children:k>0?e.jsxs(e.Fragment,{children:[e.jsx(Le,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),k.toLocaleString()," in ",d]}):e.jsx("span",{className:"text-text-tertiary/40",children:"—"})}),e.jsxs("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover/row:opacity-100 transition-opacity flex items-center gap-2",children:[s.some(P)&&e.jsx(Z,{className:"w-4 h-4 text-text-tertiary hover:text-status-success",strokeWidth:1.5,onClick:c=>{c.stopPropagation(),l(t)}}),e.jsx(J,{className:"w-4 h-4 text-text-tertiary hover:text-accent",strokeWidth:1.5,onClick:c=>{c.stopPropagation(),u(t)}})]})]}),e.jsx(W,{open:a,children:e.jsx("div",{className:"ml-6",children:e.jsx(Je,{columns:w,data:x,keyFn:B,onRowClick:n,emptyMessage:"No workers",inline:!0})})})]})}let it=0;function ct(t){const s=t.data||{},a=s.topic?String(s.topic):"",r=s.guid?String(s.guid).slice(0,8):"";switch(t.type){case"pong":return a?`Worker ${r}... on "${a}" responded`:`Engine ${r}... responded`;case"ping":return"Roll call broadcast";case"throttle":{const n=s.throttle,o=a?`queue "${a}"`:r?`node ${r}...`:"all nodes";return`${V(n)} applied to ${o}`}case"job":return`Job ${r?r+"...":""} ${s.status||"updated"}`;case"work":return`Dispatched to "${a||"worker"}" ${r?"("+r+"...)":""}`;case"activate":return`Worker "${a||"unknown"}" activated`;case"cron":return`Cron triggered ${a?'"'+a+'"':""}`;default:return a||r||t.type}}function ut(t){const s=[];let a=0;for(;a<t.length;){const r=t[a];if(r.type==="pong"){let n=a+1;for(;n<t.length&&t[n].type==="pong";)n++;const o=t.slice(a,n);if(o.length>=3)s.push({kind:"group",type:"pong",count:o.length,firstTimestamp:o[o.length-1].timestamp,lastTimestamp:o[0].timestamp,events:o});else for(const u of o)s.push({kind:"single",event:u});a=n}else s.push({kind:"single",event:r}),a++}return s}function ae({event:t}){const[s,a]=i.useState(!1);return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>a(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-2xs font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${se[t.type]||"text-text-tertiary"} bg-surface-sunken whitespace-nowrap shrink-0`,children:He[t.type]||t.type}),e.jsx("span",{className:"text-2xs text-text-secondary flex-1 min-w-0 truncate",children:ct(t)}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"pb-2",children:e.jsx(Re,{data:t.data})})})]})}function dt({group:t}){const[s,a]=i.useState(!1),r=t.events.filter(o=>{var u;return!((u=o.data)!=null&&u.topic)}).length,n=t.count-r;return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>a(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-2xs font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.lastTimestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${se.pong} bg-surface-sunken whitespace-nowrap shrink-0`,children:"roll call"}),e.jsxs("span",{className:"text-2xs text-text-secondary flex-1 min-w-0 truncate",children:[t.count," nodes responded",r>0&&n>0?` (${r} engine${r!==1?"s":""}, ${n} worker${n!==1?"s":""})`:r>0?` (${r} engine${r!==1?"s":""})`:` (${n} worker${n!==1?"s":""})`]}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"ml-4",children:t.events.map(o=>e.jsx(ae,{event:o},o.id))})})]})}function xt({channels:t,onToggle:s,customFilter:a,onCustomFilterChange:r}){return e.jsxs("div",{className:"space-y-3 pb-3 border-b border-surface-border mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Channels"}),e.jsx("p",{className:"text-2xs text-text-tertiary",children:"Unchecked channels are dropped before buffering"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1",children:re.map(n=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-0.5",children:[e.jsx("input",{type:"checkbox",checked:t.has(n.key),onChange:()=>s(n.key),className:"w-3 h-3 rounded border-border accent-accent"}),e.jsx("span",{className:"text-2xs text-text-secondary",title:n.description,children:n.label})]},n.key))}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Text Filter"}),e.jsx("input",{type:"text",value:a,onChange:n=>r(n.target.value),placeholder:"pong",className:"input text-2xs font-mono py-1 px-2 w-full"}),e.jsxs("p",{className:"text-2xs text-text-tertiary mt-1",children:["Filter by event type, e.g. ",e.jsx("span",{className:"font-mono",children:"pong"}),", ",e.jsx("span",{className:"font-mono",children:"throttle"}),", or any text in the event data."]})]})]})}function ht({bridgeActive:t}){const[s,a]=i.useState(!1),[r,n]=i.useState(!1),[o,u]=i.useState([]),[l,m]=i.useState(()=>new Set(re.map(x=>x.key))),[d,k]=i.useState(""),b=i.useRef(l);i.useEffect(()=>{b.current=l},[l]);const j=i.useRef(d);i.useEffect(()=>{j.current=d},[d]);const v=x=>{m(w=>{const c=new Set(w);return c.has(x)?c.delete(x):c.add(x),c})};Ee("lt.events.mesh.>",i.useCallback(x=>{var g;const w=((g=x.type)==null?void 0:g.replace("mesh.",""))||"unknown";if(!b.current.has(w))return;const c=j.current;c&&!`${w} ${JSON.stringify(x.data||x)}`.toLowerCase().includes(c.toLowerCase())||u(E=>[{id:++it,type:w,timestamp:x.timestamp||new Date().toISOString(),data:x.data||x},...E].slice(0,qe))},[]));const y=()=>u([]);return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] sticky top-14 self-start max-h-[calc(100vh-8rem)] flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),e.jsx(We,{className:`w-3 h-3 ${t?"text-status-success animate-pulse":"text-text-tertiary"}`}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:t?"Live":"..."}),e.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{a(x=>!x),n(!1)},className:`p-1 rounded transition-colors ${s?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"Configure channels",children:e.jsx(Qe,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>{n(x=>!x),a(!1)},className:`p-1 rounded transition-colors ${r?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"View raw JSON",children:e.jsx(Fe,{className:"w-3.5 h-3.5"})}),o.length>0&&e.jsx("button",{onClick:y,className:"p-1 rounded text-text-tertiary hover:text-text-primary transition-colors",title:"Clear events",children:e.jsx(Oe,{className:"w-3.5 h-3.5"})})]})]}),e.jsx(W,{open:s,children:e.jsx(xt,{channels:l,onToggle:v,customFilter:d,onCustomFilterChange:k})}),e.jsx(W,{open:r,children:e.jsx("div",{className:"pb-3 border-b border-surface-border mb-3",children:e.jsx("pre",{className:"text-2xs font-mono text-text-tertiary bg-surface-sunken rounded-lg p-3 max-h-[50vh] overflow-auto whitespace-pre-wrap",children:JSON.stringify(o.slice(0,50),null,2)})})}),o.length>0&&e.jsxs("p",{className:"text-2xs text-text-tertiary mb-2",children:[o.length," events"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:o.length===0?e.jsx("p",{className:"text-xs text-text-tertiary py-6 text-center",children:t?"Waiting for events...":"Subscribing..."}):ut(o).map((x,w)=>x.kind==="group"?e.jsx(dt,{group:x},`grp-${w}`):e.jsx(ae,{event:x.event},x.event.id))})]})}function mt(t){const s=[],a=[],r=[];for(const n of t)P(n)?r.push(n):n.is_scout||T([n]).total>0?s.push(n):a.push(n);return s.sort((n,o)=>n.is_scout&&!o.is_scout?-1:!n.is_scout&&o.is_scout?1:T([o]).total-T([n]).total),a.sort((n,o)=>F(n.engine_id).localeCompare(F(o.engine_id))),r.sort((n,o)=>F(n.engine_id).localeCompare(F(o.engine_id))),{active:s,idle:a,paused:r}}function D({engine:t,isFirst:s,onThrottle:a}){const r=F(t.engine_id),n=Ze(t.engine_id),o=T([t]),u=t.stream_depth??0,l=P(t);return e.jsxs("div",{className:"group/row flex items-center gap-3 py-2 hover:bg-surface-hover/50 transition-colors rounded px-1",children:[l?e.jsx(U,{className:"w-3.5 h-3.5 text-status-warning shrink-0",strokeWidth:1.5}):e.jsx(Be,{className:`w-3.5 h-3.5 shrink-0 ${o.total>0||t.is_scout?"text-status-success":"text-text-tertiary/30"}`,strokeWidth:1.5}),e.jsx("span",{className:`${s?"text-base font-medium":"text-xs"} text-text-primary truncate max-w-[180px]`,title:t.engine_id,children:r}),n&&e.jsx("span",{className:"text-2xs text-text-tertiary/50",children:n}),t.is_scout&&e.jsx("span",{className:"text-2xs text-status-warning uppercase tracking-widest",children:"scout"}),e.jsx("span",{className:"flex-1"}),l&&e.jsx("span",{className:"text-2xs text-status-warning",children:t.throttle===-1?"Paused":V(t.throttle)}),o.total>0&&e.jsx("span",{className:"text-2xs font-mono tabular-nums text-text-tertiary w-16 text-right",children:o.total.toLocaleString()}),u>0&&e.jsxs("span",{className:`text-2xs font-mono tabular-nums w-14 text-right ${u>100?"text-status-warning":"text-text-tertiary/50"}`,children:[u.toLocaleString()," q"]}),e.jsx("span",{className:"text-2xs font-mono text-text-tertiary/40 w-12 text-right",children:Ke(t.inited)}),e.jsx("span",{className:"opacity-0 group-hover/row:opacity-100 transition-opacity",children:e.jsx("button",{onClick:m=>{m.stopPropagation(),a(t)},className:"text-text-tertiary hover:text-accent transition-colors",title:l?"Resume / adjust throttle":"Pause / throttle",children:e.jsx(J,{className:"w-3.5 h-3.5",strokeWidth:1.5})})})]})}function X({label:t,engines:s,onThrottle:a}){const[r,n]=i.useState(!1);return s.length===0?null:e.jsxs("div",{className:"mt-1",children:[e.jsxs("button",{onClick:()=>n(!r),className:"flex items-center gap-1.5 text-2xs text-text-tertiary hover:text-text-secondary transition-colors py-1",children:[e.jsx(te,{className:`w-3 h-3 transition-transform duration-200 ${r?"rotate-90":""}`,strokeWidth:2}),s.length," ",t]}),e.jsx(W,{open:r,children:e.jsx("div",{className:"ml-1",children:s.map(o=>e.jsx(D,{engine:o,onThrottle:a},o.engine_id))})})]})}function pt({engines:t,onThrottle:s,isLoading:a}){const{active:r,idle:n,paused:o}=i.useMemo(()=>mt(t),[t]);return a?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering engines..."}):t.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No engines found."}):r.length===0&&n.length===0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(U,{className:"w-4 h-4 text-status-error shrink-0",strokeWidth:1.5}),e.jsxs("span",{className:"text-base text-status-error font-medium",children:["All ",t.length," engines paused"]})]}),e.jsx("p",{className:"text-2xs text-text-tertiary ml-7",children:"Messages are accumulating. Resume at least one engine to restore processing."}),e.jsx("div",{className:"ml-1 mt-2",children:o.map(u=>e.jsx(D,{engine:u,onThrottle:s},u.engine_id))})]}):e.jsxs("div",{children:[r.map((u,l)=>e.jsx(D,{engine:u,isFirst:l===0,onThrottle:s},u.engine_id)),e.jsx(X,{label:"idle",engines:n,onThrottle:s}),e.jsx(X,{label:"paused",engines:o,onThrottle:s})]})}function gt({collapsed:t,toggleSection:s,activeDuration:a,streamStats:r,isLoading:n,queueMap:o,expandedQueues:u,toggleQueue:l,allQueuesExpanded:m,toggleAllQueues:d,handleRowClick:k,handleResumeThrottle:b,handleQueueThrottle:j,handleResumeQueue:v,engines:y,bridgeActive:x}){return e.jsxs("div",{className:"grid grid-cols-1 @split:grid-cols-[1fr_340px] gap-6",children:[e.jsxs("div",{className:"flex flex-col gap-12 mt-10",children:[e.jsx(I,{title:`Message Volume (${a})`,sectionKey:"volume",isCollapsed:!!t.volume,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(ot,{byStream:(r==null?void 0:r.byStream)??[],onNodeFilter:()=>{},onQueueFilter:()=>{}})}),e.jsx(I,{title:`Engine Routers (${y.length})`,sectionKey:"engines",isCollapsed:!!t.engines,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(pt,{engines:y,onThrottle:k,isLoading:n})}),e.jsx(I,{title:"Worker Routers",sectionKey:"queues",isCollapsed:!!t.queues,onToggle:s,contentClassName:"mt-4 ml-7 flex flex-col gap-0",children:n?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering mesh nodes..."}):o.size===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:'No worker routers found. Click "Roll Call" to discover.'}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end mb-2",children:e.jsx("button",{onClick:d,className:"text-2xs text-accent hover:underline",children:m?"Collapse all":"Expand all"})}),[...o.entries()].sort(([w],[c])=>w.localeCompare(c)).map(([w,c])=>e.jsx(lt,{queue:w,workers:c,expanded:u.has(w),onToggle:l,onWorkerClick:k,onResumeThrottle:b,onQueueThrottle:j,onResumeQueue:v,byStream:(r==null?void 0:r.byStream)??[],activeDuration:a},w))]})})]}),e.jsx(ht,{bridgeActive:x})]})}function Rt(){const{namespace:t,available:s}=ve(),{filters:a,setFilter:r}=Ne({filters:{app_id:"",duration:"1h"}}),n=a.app_id||t,o=a.duration||"1h",u=$e(),l=6e4,{data:m,isLoading:d,error:k,refetch:b,isFetching:j}=Se(n,l),{data:v}=_e(n,o,void 0,l),y=i.useMemo(()=>[...(m==null?void 0:m.profiles)??[]].sort((S,_)=>{const z=S.worker_topic||S.stream||"",Q=_.worker_topic||_.stream||"";return!S.worker_topic&&_.worker_topic?-1:S.worker_topic&&!_.worker_topic?1:z.localeCompare(Q)}),[m==null?void 0:m.profiles]),x=i.useMemo(()=>y.filter(p=>!M(p)),[y]),w=i.useMemo(()=>y.filter(M),[y]),c=i.useMemo(()=>Ye(y),[y]),g=y.filter(P).length,E=i.useMemo(()=>{const p=new Set(s);return n&&p.add(n),[...p].sort().map(S=>({value:S,label:S}))},[s,n]),[h]=Ue(),C=h.get("queue"),[f,$]=i.useState(()=>C?new Set([C]):new Set),A=i.useCallback(p=>{$(S=>{const _=S.has(p),z=_?new Set:new Set([p]),Q=new URLSearchParams(window.location.search);_?Q.delete("queue"):Q.set("queue",p);const G=Q.toString();return window.history.pushState(null,"",`${window.location.pathname}${G?`?${G}`:""}`),z})},[]),N=c.size>0&&[...c.keys()].every(p=>f.has(p)),R=i.useCallback(()=>{$(N?new Set:new Set(c.keys()))},[N,c]),O="lt:controlplane:collapsed",[L,oe]=i.useState(()=>{try{const p=JSON.parse(localStorage.getItem(O)||"{}");return C&&(p.queues=!1),p}catch{return{}}}),le=i.useCallback(p=>{oe(S=>{const _={...S,[p]:!S[p]};return localStorage.setItem(O,JSON.stringify(_)),_})},[]),{throttleModalOpen:ie,throttleTargets:H,selectedThrottleTargets:ce,throttleMutation:ue,handleBulkThrottle:de,handleRowClick:xe,handleResumeThrottle:he,handleResumeQueue:me,handleQueueThrottle:pe,closeThrottleModal:ge}=tt({activeAppId:n,allProfiles:y,profiles:y}),fe=i.useMemo(()=>{const p=[{label:"Engines",value:x.length,dotClass:"bg-status-active"},{label:"Workers",value:w.length,dotClass:"bg-text-secondary"},{label:"Topics",value:c.size}];return g>0&&p.push({label:"Throttled",value:g,dotClass:"bg-status-warning"}),p},[x.length,w.length,c.size,g]),[q,be]=i.useState(!1),je=i.useCallback(()=>{u.mutate({appId:n},{onSuccess:()=>be(!0)})},[n,u]);return i.useEffect(()=>{!q&&n&&je()},[n]),e.jsxs("div",{children:[e.jsx(ye,{title:"Routers",docsHash:"#docs:dashboard.md:task-queues",stats:fe,actions:e.jsx(at,{})}),e.jsxs(we,{actions:e.jsx("div",{className:"flex items-center gap-1",children:Ve.map(p=>e.jsx("button",{onClick:()=>r("duration",p.value),className:`px-3 py-1 text-xs rounded-full transition-colors ${o===p.value?"bg-accent text-text-inverse":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:p.label},p.value))}),children:[e.jsx(ke,{label:"Application",value:a.app_id,onChange:p=>r("app_id",p),options:E}),e.jsxs("button",{onClick:()=>b(),disabled:j,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:[e.jsx(ze,{className:`w-3.5 h-3.5 ${j?"animate-spin":""}`}),"Roll Call"]})]}),k&&e.jsx("div",{className:"mb-6 px-4 py-3 rounded bg-status-error/10 border border-status-error/20",children:e.jsx("p",{className:"text-xs text-status-error font-medium",children:k.message==="Session expired"?"Session expired — please log in again.":`Failed to load mesh data: ${k.message}`})}),e.jsx(gt,{collapsed:L,toggleSection:le,activeDuration:o,streamStats:v,isLoading:d,queueMap:c,expandedQueues:f,toggleQueue:A,allQueuesExpanded:N,toggleAllQueues:R,handleRowClick:xe,handleResumeThrottle:he,handleQueueThrottle:pe,handleResumeQueue:me,engines:x,bridgeActive:q}),e.jsx(rt,{open:ie,onClose:ge,targets:H.length>0?H:ce,onApply:de,isPending:ue.isPending})]})}export{Rt as ControlPlanePage};
|
|
2
|
-
//# sourceMappingURL=index-CUZ6LYye.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{a as d,j as e}from"./vendor-query-DvWWuNIB.js";import{aB as Z,aF as A,Z as ee,a as te,aG as se,ax as re,ay as oe,at as ne}from"./index-CIwlVfvV.js";import{F as ae,b as le,a as ie}from"./FilterBar-DMOR-O1c.js";import{C as Q}from"./ConfirmDeleteModal-64adXLdq.js";import{R as L}from"./RolePill-DhnVPK4q.js";import{W as ce}from"./WorkflowPill--AYMW7u_.js";import{P as ue}from"./PageHeader-Di5Sz3an.js";import{J as de,aA as P,aD as B,aF as me,j as z,aG as xe,aH as H,a2 as pe,U as J,X as he,C as fe,aa as we,aI as T,k as ke,E as ve}from"./vendor-icons-DeBdvyKJ.js";import{u as G,e as ge,f as je}from"./vendor-react-_9U4mKFr.js";import{B as ye}from"./BotPicker-CGCnIz8I.js";import{N as Ne}from"./NamespacePill-Bb3revqD.js";import{s as be,R as _e}from"./ResolverForm-Bk-wDkN-.js";import{b as Ce,f as Se,w as U}from"./invoke-context-DrVyUEfs.js";import"./bots-B97itB3I.js";import"./EscalationListView-AHW2xtlr.js";import"./DataTable-7C7riavf.js";import"./EmptyState-DgC_6njU.js";import"./StatusBadge-DHVwxre2.js";import"./UserName-BzXJUE6q.js";import"./StickyPagination-B91Pk9xh.js";function Ie({tier:t}){return t==="certified"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-medium text-status-success",children:[e.jsx(B,{className:"w-3 h-3"}),"Certified"]}):t==="registered"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-medium text-text-secondary",children:[e.jsx(pe,{className:"w-3 h-3"}),"Registered"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-medium text-text-quaternary",children:[e.jsx(P,{className:"w-3 h-3"}),"Durable"]})}function ot(){const t=G(),{data:o,isLoading:i}=Z(),m=A(),[u,p]=d.useState(""),[r,k]=d.useState(null),[f,g]=d.useState(null),a=o??[],y=d.useMemo(()=>[...new Set(a.map(l=>l.task_queue).filter(Boolean))].sort(),[a]),c=d.useMemo(()=>{const l=u.toLowerCase().trim();return(r?[r]:y).map(h=>({queue:h,workflows:a.filter(S=>{var N;return S.task_queue===h&&(!l||S.workflow_type.toLowerCase().includes(l)||((N=S.description)==null?void 0:N.toLowerCase().includes(l)))})})).filter(h=>h.workflows.length>0)},[a,y,u,r]),x=d.useMemo(()=>{const l=u.toLowerCase().trim();return r?[]:a.filter(s=>{var h;return!s.task_queue&&(!l||s.workflow_type.toLowerCase().includes(l)||((h=s.description)==null?void 0:h.toLowerCase().includes(l)))})},[a,u,r]),C=l=>{l.registered?t(`/workflows/registry/${encodeURIComponent(l.workflow_type)}`):t(`/workflows/registry/new?workflow_type=${encodeURIComponent(l.workflow_type)}&task_queue=${encodeURIComponent(l.task_queue??"")}`)},I=()=>{f&&m.mutate(f,{onSuccess:()=>g(null)})};return e.jsxs("div",{children:[e.jsx(ue,{title:"Registered Workflows",docsHash:"#docs:dashboard.md:workflow-registry",actions:e.jsx("button",{onClick:()=>t("/workflows/registry/new"),className:"btn-primary text-xs",children:"Register Workflow"})}),!i&&y.length>0&&e.jsxs(ae,{children:[e.jsx(le,{label:"Queue",value:r??"",onChange:l=>k(l||null),options:y.map(l=>({value:l,label:l}))}),e.jsx(ie,{label:"Search",value:u,onChange:p,placeholder:`${a.length} workflows…`})]}),i?e.jsx(We,{}):c.length===0&&x.length===0?e.jsx("p",{className:"text-sm text-text-tertiary mt-8",children:u||r?"No workflows match your filter.":"No workflows discovered yet."}):e.jsxs("div",{className:"space-y-10",children:[c.map(({queue:l,workflows:s})=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(de,{className:"w-3 h-3 text-accent",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:l}),e.jsx("span",{className:"text-xs text-text-quaternary",children:s.length})]}),e.jsx($,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:s.map(h=>e.jsx(M,{wf:h,onRowClick:C,onDelete:g,onNavigate:t},h.workflow_type))})]},l)),x.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(P,{className:"w-3 h-3 text-text-quaternary",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:"No Queue"}),e.jsx("span",{className:"text-xs text-text-quaternary",children:x.length})]}),e.jsx($,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:x.map(l=>e.jsx(M,{wf:l,onRowClick:C,onDelete:g,onNavigate:t},l.workflow_type))})]})]}),e.jsx(Q,{open:!!f,onClose:()=>g(null),onConfirm:I,title:"Unregister Workflow",description:e.jsxs(e.Fragment,{children:["Delete the registration for"," ",e.jsx("span",{className:"font-mono font-medium text-text-primary",children:f}),"? This removes its invocation settings, certification, and interceptor treatment; the workflow keeps running as a plain durable workflow. To demote certified → registered instead, open the workflow and uncheck Certify — that keeps every setting."]}),isPending:m.isPending,error:m.error})]})}const K="grid grid-cols-[minmax(0,1fr)_7rem_13rem_4.5rem] gap-x-6";function $(){return e.jsxs("div",{className:`${K} px-3 pb-2 pt-1`,children:[e.jsx("span",{className:"text-2xs font-medium text-text-quaternary",children:"Workflow"}),e.jsx("span",{className:"text-2xs font-medium text-text-quaternary",children:"Tier"}),e.jsx("span",{className:"text-2xs font-medium text-text-quaternary",children:"Access"}),e.jsx("span",{})]})}function M({wf:t,onRowClick:o,onDelete:i,onNavigate:m}){const u=t.roles??[],p=t.invocation_roles??[];return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(t),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&o(t)},className:`group ${K} py-2 px-3 -mx-3 rounded-md cursor-pointer transition-colors items-center`,children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(ce,{type:t.workflow_type,size:"md",variant:t.tier==="certified"?"certified":t.tier==="registered"?"registered":"durable"}),t.description&&e.jsx("p",{className:"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors",children:t.description})]}),e.jsx("div",{children:e.jsx(Ie,{tier:t.tier??"durable"})}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden whitespace-nowrap",children:[u.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{title:"Escalation roles",children:e.jsx(B,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),u.map(r=>e.jsx(L,{role:r},`e-${r}`))]}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{title:"Invocation roles",children:e.jsx(me,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),p.map(r=>e.jsx(L,{role:r},`i-${r}`))]}),u.length===0&&p.length===0&&e.jsx("span",{className:"text-xs text-text-quaternary",children:"—"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.invocable&&e.jsx("button",{title:"Invoke workflow",onClick:r=>{r.stopPropagation(),m(`/workflows/start?type=${encodeURIComponent(t.workflow_type)}&mode=now`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(z,{className:"w-3.5 h-3.5"})}),t.tier==="durable"&&e.jsx("button",{title:"Configure workflow",onClick:r=>{r.stopPropagation(),m(`/workflows/registry/new?workflow_type=${encodeURIComponent(t.workflow_type)}&task_queue=${encodeURIComponent(t.task_queue??"")}`)},className:"text-text-quaternary hover:text-status-info transition-colors",children:e.jsx(P,{className:"w-3.5 h-3.5"})}),t.tier==="registered"&&e.jsx("button",{title:"Certify workflow",onClick:r=>{r.stopPropagation(),m(`/workflows/registry/${encodeURIComponent(t.workflow_type)}`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(xe,{className:"w-3.5 h-3.5"})}),t.registered&&e.jsx("button",{title:"Unregister workflow",onClick:r=>{r.stopPropagation(),i(t.workflow_type)},className:"text-text-quaternary hover:text-status-warning transition-colors",children:e.jsx(H,{className:"w-3.5 h-3.5"})})]})]})}function We(){return e.jsx("div",{className:"animate-pulse space-y-8 mt-4",children:[1,2].map(t=>e.jsxs("div",{children:[e.jsx("div",{className:"h-4 bg-surface-sunken rounded w-36 mb-4"}),e.jsx("div",{className:"space-y-4",children:[1,2,3].map(o=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]},o))})]},t))})}function Re({selected:t,onChange:o,single:i,placeholder:m}){const{data:u}=ee(),p=(u==null?void 0:u.roles)??[],[r,k]=d.useState(!1),f=d.useRef(null);d.useEffect(()=>{const c=x=>{f.current&&!f.current.contains(x.target)&&k(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]);const g=c=>{i?(o(t.includes(c)?[]:[c]),k(!1)):o(t.includes(c)?t.filter(x=>x!==c):[...t,c])},a=c=>{o(t.filter(x=>x!==c))},y=m??(i?"Select role...":"Add roles...");return e.jsxs("div",{ref:f,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>k(!r),className:"flex flex-wrap items-center gap-1.5 w-full min-h-[34px] px-2 py-1.5 bg-surface-sunken border border-surface-border rounded-md text-left cursor-pointer hover:border-accent/40 transition-colors focus:ring-1 focus:ring-accent focus:outline-none",children:[t.length===0&&e.jsx("span",{className:"text-xs text-text-tertiary",children:y}),t.map(c=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-accent/[0.08] text-text-secondary text-2xs",children:[e.jsx(J,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),c,e.jsx("span",{role:"button",onClick:x=>{x.stopPropagation(),a(c)},className:"ml-0.5 hover:text-status-error transition-colors",children:e.jsx(he,{className:"w-2.5 h-2.5"})})]},c)),e.jsx(fe,{className:`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${r?"rotate-180":""}`})]}),r&&e.jsx("div",{className:"absolute z-[100] mt-1 w-full bg-surface-raised border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto",children:p.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-tertiary",children:"No roles defined"}):p.map(c=>{const x=t.includes(c);return e.jsxs("button",{type:"button",onClick:()=>g(c),className:`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs transition-colors ${x?"bg-accent/[0.06] text-accent":"text-text-primary hover:bg-surface-sunken"}`,children:[e.jsx(J,{className:"w-3 h-3 shrink-0 text-accent/60"}),e.jsx("span",{className:"flex-1",children:c}),x&&e.jsx(we,{className:"w-3 h-3 shrink-0"})]},c)})})]})}function W(t){return t.split(",").map(o=>o.trim()).filter(Boolean)}const R={workflow_type:"",description:"",task_queue:"",default_role:"reviewer",invocable:!1,roles:"",invocation_roles:"",consumes:"",envelope_schema:"",input_schema:"",input_lookups:"",icon:"",resolver_schema:"",cron_schedule:"",execute_as:"",certified:!1};function qe(t){var m;const o=(t.roles??[]).join(", "),i=(t.consumes??[]).join(", ");return{workflow_type:t.workflow_type,description:t.description??"",task_queue:t.task_queue??"",default_role:t.default_role,invocable:t.invocable,roles:o,invocation_roles:(t.invocation_roles??[]).join(", "),consumes:i,envelope_schema:t.envelope_schema?JSON.stringify(t.envelope_schema,null,2):"",input_schema:t.input_schema?JSON.stringify(t.input_schema,null,2):"",input_lookups:(m=t.input_lookups)!=null&&m.length?JSON.stringify(t.input_lookups,null,2):"",icon:t.icon??"",resolver_schema:t.resolver_schema?JSON.stringify(t.resolver_schema,null,2):"",cron_schedule:t.cron_schedule??"",execute_as:t.execute_as??"",certified:t.certified}}function _(t){if(!t.trim())return!0;try{return JSON.parse(t),!0}catch{return!1}}function Fe(t){if(!t.trim())return null;try{const o=JSON.parse(t);return o&&typeof o=="object"&&!Array.isArray(o)&&o.properties?o:null}catch{return null}}function Pe({schemaText:t,lookup:o}){const i=d.useMemo(()=>Fe(t),[t]),m=d.useMemo(()=>i?be(i):"",[i]),[u,p]=d.useState(m);d.useEffect(()=>{p(m)},[m]);const r=d.useMemo(()=>({...Ce({},o),resolver:null}),[o]);return i?e.jsx("div",{className:"@container","data-testid":"input-form-preview",children:e.jsx(_e,{value:u,onChange:p,escalationContext:r})}):e.jsxs("p",{className:"text-2xs text-text-tertiary",children:["A schema with ",e.jsx("code",{className:"font-mono",children:"properties"})," previews here as the operator's form."]})}function Oe({value:t,onChange:o}){const[i,m]=d.useState(""),u=d.useMemo(()=>Se(i),[i]),p=U(t);return e.jsxs("div",{className:"space-y-2","data-testid":"workflow-icon-picker",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:i,onChange:r=>m(r.target.value),placeholder:"Filter icons…","aria-label":"Filter icons",className:"input text-2xs py-1 w-40"}),e.jsxs("span",{className:"flex items-center gap-1.5 text-2xs text-text-tertiary min-w-0",children:[p?e.jsx(p,{className:"w-3.5 h-3.5 text-accent shrink-0",strokeWidth:1.5}):e.jsx(T,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono truncate",children:t||"tier glyph"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",role:"listbox","aria-label":"Workflow icon",children:[e.jsx("button",{type:"button",role:"option","aria-selected":!t,title:"No icon (tier glyph)",onClick:()=>o(""),className:`p-1.5 rounded-md border transition-colors ${t?"border-transparent text-text-quaternary hover:bg-surface-hover hover:text-text-secondary":"border-accent bg-accent/10 text-accent"}`,children:e.jsx(T,{className:"w-4 h-4",strokeWidth:1.5})}),u.map(r=>{const k=U(r),f=t===r;return e.jsx("button",{type:"button",role:"option","aria-selected":f,title:r,onClick:()=>o(r),className:`p-1.5 rounded-md border transition-colors ${f?"border-accent bg-accent/10 text-accent":"border-transparent text-text-tertiary hover:bg-surface-hover hover:text-text-primary"}`,children:e.jsx(k,{className:"w-4 h-4",strokeWidth:1.5})},r)}),u.length===0&&e.jsx("p",{className:"text-2xs text-text-tertiary px-1 py-1.5",children:"No icon matches."})]})]})}function q({icon:t,color:o,children:i}){return e.jsxs("div",{className:"flex items-center gap-2 mb-4 pb-2 border-b border-surface-border",children:[e.jsx(t,{className:`w-4 h-4 ${o}`,strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:i})]})}function j({label:t,hint:o,children:i}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"label",children:t}),i,o&&e.jsx("p",{className:"hint",children:o})]})}const F="input-json w-full";function De(t){return W(t)}function Ee(t){return t.join(", ")}const Le=new Set(["mcpQuery","mcpDeterministic","mcpQueryRouter","mcpTriage","mcpTriageRouter","mcpTriageDeterministic","insightQuery"]);function nt(){const{workflowType:t}=ge(),o=!t,i=G(),[m]=je(),{data:u,isLoading:p}=te(),r=se(),k=A(),[f,g]=d.useState(!1),a=(u==null?void 0:u.find(n=>n.workflow_type===t))??null,y=Array.isArray(a==null?void 0:a.input_lookups)&&a.input_lookups.length>0,{data:c}=re((a==null?void 0:a.workflow_type)??"",y),x=d.useMemo(()=>c?oe(c.lookups):void 0,[c]),{data:C}=ne({limit:500}),I=d.useMemo(()=>{const n=new Set((u??[]).map(v=>v.workflow_type));return[...new Set(((C==null?void 0:C.jobs)??[]).map(v=>v.entity))].filter(v=>!n.has(v)&&!Le.has(v)).sort()},[u,C]),l=d.useMemo(()=>{if(!o)return R;const n=m.get("workflow_type")??"",b=m.get("task_queue")??"";return n||b?{...R,workflow_type:n,task_queue:b}:R},[o,m]),[s,h]=d.useState(l),[S,N]=d.useState(""),[O,D]=d.useState(!1),w=d.useCallback((n,b)=>h(v=>({...v,[n]:b})),[]);d.useEffect(()=>{if(!O){if(o){h(l),D(!0);return}a&&(h(qe(a)),D(!0))}},[a,o,O,l]);const V=()=>{if(!s.workflow_type.trim())return;N("");let n=null,b=null,v=null,E=null;try{s.envelope_schema.trim()&&(n=JSON.parse(s.envelope_schema))}catch{N("Invalid JSON in Envelope Schema");return}try{s.input_schema.trim()&&(b=JSON.parse(s.input_schema))}catch{N("Invalid JSON in Input Form");return}try{s.input_lookups.trim()&&(v=JSON.parse(s.input_lookups))}catch{N("Invalid JSON in Lookups");return}try{s.resolver_schema.trim()&&(E=JSON.parse(s.resolver_schema))}catch{N("Invalid JSON in Resolver Schema");return}r.mutate({workflow_type:s.workflow_type.trim(),description:s.description.trim()||null,task_queue:s.task_queue.trim()||null,default_role:s.default_role.trim()||"reviewer",invocable:s.invocable,certified:s.certified,roles:W(s.roles),invocation_roles:W(s.invocation_roles),consumes:W(s.consumes),envelope_schema:n,input_schema:b,input_lookups:v,icon:s.icon||null,resolver_schema:E,cron_schedule:s.cron_schedule.trim()||null,execute_as:s.execute_as.trim()||null},{onSuccess:()=>i("/workflows/registry")})};if(p)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-40 bg-surface-sunken rounded"})]});if(!o&&!a)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Config not found."});const X=!!s.workflow_type.trim()&&_(s.envelope_schema)&&_(s.input_schema)&&_(s.input_lookups)&&_(s.resolver_schema),Y=o&&!s.workflow_type&&I.length>0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-light font-mono text-text-primary",children:o?"New Workflow":(a==null?void 0:a.workflow_type)??""}),a&&e.jsx("div",{className:"flex items-center gap-2 mt-2",children:e.jsx(Ne,{namespace:"durable"})})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[a&&e.jsxs("button",{onClick:()=>g(!0),className:"flex items-center gap-1.5 text-2xs text-status-warning hover:underline mr-3",title:"Delete this registration — the workflow returns to plain durable",children:[e.jsx(H,{className:"w-3 h-3",strokeWidth:1.5})," Unregister"]}),e.jsx("button",{onClick:()=>i("/workflows/registry"),className:"btn-ghost text-xs",children:"Cancel"}),e.jsx("button",{onClick:V,disabled:!X||r.isPending,className:"btn-primary text-xs",children:r.isPending?"Saving…":o?"Register":"Save"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 @wall:grid-cols-3 gap-x-14 gap-y-10",children:[e.jsxs("div",{children:[e.jsx(q,{icon:ke,color:"text-accent",children:"Identity"}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(j,{label:"Workflow Type",hint:"Register a workflow to configure invocation and HITL escalation routing.",children:Y?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-text-secondary",children:"Select a durable workflow to register:"}),e.jsx("div",{className:"grid gap-1",children:I.map(n=>e.jsx("button",{onClick:()=>w("workflow_type",n),className:"flex items-center gap-2 px-3 py-2 text-left text-xs font-mono rounded-md border border-surface-border hover:border-accent/50 hover:bg-accent/[0.04] transition-colors",children:n},n))}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("span",{className:"text-2xs text-text-tertiary",children:"or"}),e.jsx("input",{type:"text",onChange:n=>w("workflow_type",n.target.value),placeholder:"Enter type manually",className:"input font-mono flex-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:s.workflow_type,onChange:n=>w("workflow_type",n.target.value),disabled:!o,placeholder:"reviewContent",className:"input font-mono w-full"}),o&&s.workflow_type&&I.length>0&&e.jsx("button",{onClick:()=>w("workflow_type",""),className:"text-2xs text-accent hover:underline mt-1",children:"Choose from durable workflows"})]})}),e.jsx(j,{label:"Icon",hint:"Leads the workflow's row and heading on the Invoke Tool page so operators tell tools apart at a glance. Declared in code as WORKFLOW_ICONS.*",children:e.jsx(Oe,{value:s.icon,onChange:n=>w("icon",n)})}),e.jsx(j,{label:"Description",children:e.jsx("input",{type:"text",value:s.description,onChange:n=>w("description",n.target.value),placeholder:"Describe what this workflow does",className:"input text-xs w-full"})}),e.jsx(j,{label:"Task Queue",hint:"Durable task queue this workflow listens on.",children:e.jsx("input",{type:"text",value:s.task_queue,onChange:n=>w("task_queue",n.target.value),placeholder:"lt-review",className:"input font-mono w-full"})})]})]}),e.jsxs("div",{children:[e.jsx(q,{icon:z,color:"text-accent",children:"Invocation"}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.invocable,onChange:n=>w("invocable",n.target.checked),className:"w-4 h-4 rounded border-border accent-accent"}),e.jsx("span",{className:"text-xs text-text-primary font-medium",children:"Invocable"})]}),e.jsx("p",{className:"hint",children:"Allow this workflow to be started from the dashboard or API."})]}),s.invocable?e.jsxs(e.Fragment,{children:[e.jsx(j,{label:"Run As",hint:"Bot identity to run under. Default runs as the invoking user.",children:e.jsx(ye,{selected:s.execute_as,onChange:n=>w("execute_as",n)})}),e.jsx(j,{label:"Invocation Roles",hint:"Only users with these roles can start this workflow. Empty = all authenticated users.",children:e.jsx(Re,{selected:De(s.invocation_roles),onChange:n=>w("invocation_roles",Ee(n)),placeholder:"Select roles…"})}),e.jsxs(j,{label:"Input Form",hint:e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#docs:hitl/invoke-form.md"},className:"text-accent hover:underline",children:"Authoring reference →"}),children:[e.jsx("textarea",{value:s.input_schema,onChange:n=>w("input_schema",n.target.value),placeholder:`{
|
|
2
|
-
"x-lt-layout": "two-column",
|
|
3
|
-
"required": ["serialNumber"],
|
|
4
|
-
"properties": {
|
|
5
|
-
"serialNumber": { "type": "string", "title": "Serial number", "description": "Read it off the label" }
|
|
6
|
-
}
|
|
7
|
-
}`,className:F,rows:14,spellCheck:!1,"data-testid":"input-form-editor"}),s.input_schema.trim()&&!_(s.input_schema)&&e.jsx("p",{className:"text-2xs text-status-error mt-1",children:"Invalid JSON"})]}),e.jsxs(j,{label:"Lookups",hint:e.jsxs(e.Fragment,{children:["Versioned knowledge refs read as ",e.jsx("code",{className:"font-mono",children:"lookup.<as>"}),". ",e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#docs:hitl/lookups.md"},className:"text-accent hover:underline",children:"Lookups reference →"})]}),children:[e.jsx("textarea",{value:s.input_lookups,onChange:n=>w("input_lookups",n.target.value),placeholder:`[
|
|
8
|
-
{ "domain": "fleet", "key": "serial-numbers", "version": 1, "as": "serials" }
|
|
9
|
-
]`,className:F,rows:5,spellCheck:!1,"data-testid":"input-lookups-editor"}),s.input_lookups.trim()&&!_(s.input_lookups)&&e.jsx("p",{className:"text-2xs text-status-error mt-1",children:"Invalid JSON"})]}),e.jsxs(j,{label:s.input_schema.trim()?"Envelope Metadata":"Envelope Schema",hint:s.input_schema.trim()?e.jsxs(e.Fragment,{children:["With an input form, only ",e.jsx("code",{className:"font-mono",children:"metadata"})," is read from here and stamped on every run; ",e.jsx("code",{className:"font-mono",children:"data"})," comes from the form."]}):e.jsxs(e.Fragment,{children:["Pre-fills the JSON editor when invoking. Include ",e.jsx("code",{className:"font-mono",children:"data"})," (input) and optional ",e.jsx("code",{className:"font-mono",children:"metadata"}),". Declare an input form above for a rich, validated form instead."]}),children:[e.jsx("textarea",{value:s.envelope_schema,onChange:n=>w("envelope_schema",n.target.value),placeholder:`{
|
|
10
|
-
"data": {},
|
|
11
|
-
"metadata": {}
|
|
12
|
-
}`,className:F,rows:8,spellCheck:!1}),s.envelope_schema.trim()&&!_(s.envelope_schema)&&e.jsx("p",{className:"text-2xs text-status-error mt-1",children:"Invalid JSON"})]})]}):e.jsxs("p",{className:"text-2xs text-text-tertiary py-2",children:["Enable ",e.jsx("span",{className:"font-medium text-text-secondary",children:"Invocable"})," to configure invocation roles and an input template."]})]})]}),e.jsxs("div",{className:"@wall:sticky @wall:top-0 self-start max-h-[calc(100vh-6rem)] overflow-y-auto",children:[e.jsx(q,{icon:ve,color:"text-accent",children:"Preview"}),s.invocable&&s.input_schema.trim()&&_(s.input_schema)?e.jsx(Pe,{schemaText:s.input_schema,lookup:x}):e.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed",children:s.invocable?"Declare an Input Form and it previews here as the operator's form, live as you type.":"Enable Invocable and declare an Input Form to preview the operator's form here."})]})]}),(S||r.error)&&e.jsx("p",{className:"text-xs text-status-error mt-8",children:S||r.error.message}),e.jsx(Q,{open:f,onClose:()=>g(!1),onConfirm:()=>k.mutate(a.workflow_type,{onSuccess:()=>i("/workflows/registry")}),title:"Unregister Workflow",description:e.jsxs(e.Fragment,{children:["Delete the registration for"," ",e.jsx("span",{className:"font-mono font-medium text-text-primary",children:a==null?void 0:a.workflow_type}),"? This removes its invocation settings, certification, and interceptor treatment; the workflow keeps running as a plain durable workflow. Escalation schemas versioned on roles are untouched."]}),isPending:k.isPending,error:k.error})]})}export{nt as WorkflowConfigDetailPage,ot as WorkflowConfigsPage};
|
|
13
|
-
//# sourceMappingURL=index-Cfvkl2J0.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{b as It,a as c,j as e}from"./vendor-query-DvWWuNIB.js";import{ab as ds,M as st,ac as oe,m as ce,a6 as Xe,ad as Mt,J as ye,h as us,i as xs,P as G,g as Qe,z as Nt,ae as Ke,a0 as Dt,a5 as ms,af as ps,ag as fs,ah as hs,ai as gs,aj as bs,ak as js,r as ys,s as vs,al as Ns,am as ws,V as ks,W as Cs,a as Ss,c as _s,Q as Es,an as Rs,y as As,ao as Ts}from"./index-CIwlVfvV.js";import{u as Lt,C as Pt,r as Is,B as Ms,a as Ds}from"./BulkAssignModal-NJBcoj-f.js";import{E as Ls,b as tt,v as Ps,i as Os}from"./resolver-payload-m9AGKZ3a.js";import{a as Ot,u as at,L as $e,b as Ws,e as $s}from"./vendor-react-_9U4mKFr.js";import{P as Vs}from"./PageHeader-Di5Sz3an.js";import{L as Bs}from"./ListToolbar-DdJzj472.js";import{i as Pe,b as Fs,d as qs,m as Us,c as Wt}from"./EscalationListView-AHW2xtlr.js";import{d as Js,R as $t,r as zs,s as Hs}from"./ResolverForm-Bk-wDkN-.js";import{S as Gs}from"./StatusBadge-DHVwxre2.js";import{R as Xs}from"./RolePill-DhnVPK4q.js";import{C as Ve}from"./CountdownTimer-BxDub9d2.js";import{C as te}from"./CopyableId-Bn02zYxt.js";import{U as ve}from"./UserName-BzXJUE6q.js";import{d as Qs}from"./metadata-display--TzK0REC.js";import{a4 as Ks,O as Ys,S as Zs,av as ea,a0 as ta,n as sa,ah as aa,U as na,ak as ra,b as ia,aw as Vt,ax as wt,ay as la,a as oa,Q as kt,V as Ct,az as ca,X as da}from"./vendor-icons-DeBdvyKJ.js";import"./constants-BHkpVaqx.js";import"./useDebouncedValue-BrwgXcp8.js";import"./DataTable-7C7riavf.js";import"./EmptyState-DgC_6njU.js";import"./StickyPagination-B91Pk9xh.js";function ua({escalationId:t}){var s;const a=Ot(),l=at(),n=It(),r=(s=a.state)==null?void 0:s[ds],[o,d]=c.useState(!1),[p,g]=c.useState(null),[f,u]=c.useState(!1);if(!r||r.escalationId!==t||f)return null;const b=()=>{u(!0),l(a.pathname,{replace:!0,state:null})},x=async()=>{var h,j,v;d(!0),g(null);try{switch(r.verb){case oe.CANCEL:await ce(`/escalations/${t}/cancel`,{method:"POST"});break;case oe.CLAIM:case oe.CLAIM_SHOW_DETAIL:await ce(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:((h=r.params)==null?void 0:h.durationMinutes)??30})});break;case oe.RELEASE:await ce(`/escalations/${t}/release`,{method:"POST"});break;case oe.RESOLVE:await ce(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:((j=r.params)==null?void 0:j.resolverPayload)??{}})});break;case oe.ESCALATE:await ce(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:(v=r.params)==null?void 0:v.targetRole})});break;default:throw new Error(`Unsupported confirm verb "${r.verb}"`)}n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),b()}catch(k){g(k.message)}finally{d(!1)}};return e.jsx(st,{open:!0,onClose:b,title:"Confirm scan action",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-text-secondary",children:r.prompt}),p&&e.jsx("p",{className:"text-xs text-status-error",children:p}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:b,disabled:o,className:"btn-secondary text-xs",children:"No, go back"}),e.jsx("button",{onClick:x,disabled:o,className:"btn-primary text-xs",children:o?"Working…":"Yes, continue"})]})]})})}const Le={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))"},Ye=4;function St({pct:t,place:a,label:l,title:n,emphasis:r}){const o=e.jsx("span",{className:"w-px h-1 bg-text-quaternary/70","aria-hidden":!0}),d=e.jsx("span",{className:`whitespace-nowrap leading-none tabular-nums text-[10px] ${r?"text-text-tertiary":"text-text-quaternary"}`,children:l});return e.jsx("div",{title:n,className:`absolute ${a==="above"?"bottom-0":"top-0"} flex flex-col items-center gap-0 -translate-x-1/2 cursor-help`,style:{left:`${t}%`},children:a==="above"?e.jsxs(e.Fragment,{children:[d,o]}):e.jsxs(e.Fragment,{children:[o,d]})})}function xa({esc:t,className:a=""}){const l=new Date(t.created_at).getTime(),n=t.claimed_at?new Date(t.claimed_at).getTime():null,r=t.status==="resolved",o=t.status==="cancelled"||t.status==="expired",d=r||o,p=Pe(t),g=!!n&&(p||d),f=r&&t.resolved_at?new Date(t.resolved_at).getTime():o?new Date(t.updated_at).getTime():Date.now(),u=Math.max(f-l,1),b=g&&n?Math.max(n-l,0):u,x=g&&n?Math.max(f-n,0):0,s=Math.min(100,Math.max(0,b/u*100)),h=g?Math.max(0,100-s):0,j=r?Le.resolved:o?Le.cancelled:Le.claimed,v=r?"Resolved after":o?"Cancelled after":"In progress",k=Xe(b),w=Xe(u),C=r?`Resolved in ${w} total`:o?`Cancelled after ${w}`:`Open ${w} so far`,y=`Lifecycle bar: blue = time waiting to be claimed, ${r?"green":o?"red":"orange"} = ${v.toLowerCase()} the claim.`;return e.jsxs("div",{className:a,title:y,children:[e.jsx("div",{className:"relative h-2.5 font-mono",children:g&&e.jsx(St,{pct:s,place:"above",label:k,title:`Time to claim: ${k}`})}),e.jsxs("div",{className:"flex w-full rounded-full overflow-hidden",style:{height:Ye,backgroundColor:"rgb(var(--lt-surface-sunken))"},title:y,children:[e.jsx("div",{style:{width:`${s}%`,minWidth:Ye,backgroundColor:Le.pending,opacity:.75},title:`Waiting ${k} — created → claimed`}),g&&h>0&&e.jsx("div",{style:{width:`${h}%`,minWidth:Ye,backgroundColor:j,opacity:.75},title:`${v} ${Xe(x)}`})]}),e.jsx("div",{className:"relative h-2.5 font-mono",children:e.jsx(St,{pct:100,place:"below",emphasis:!0,label:w,title:C})})]})}function ma({triage:t,payload:a}){const l=t.confidence??0,n=l>=.8?"text-status-success":l>=.5?"text-status-pending":"text-status-error",r=pa(t.originalData,a);return e.jsxs("div",{className:"space-y-5",children:[t.diagnosis&&e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:t.diagnosis}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-tertiary",children:[t.tool_calls_made!=null&&e.jsxs("span",{children:[t.tool_calls_made," tool call",t.tool_calls_made!==1?"s":""]}),t.tool_calls_made!=null&&e.jsx("span",{className:"text-text-quaternary",children:"·"}),e.jsxs("span",{className:`font-medium ${n}`,children:[Math.round(l*100),"% confidence"]})]}),t.actions_taken&&t.actions_taken.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.actions_taken.map((o,d)=>e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-2xs
|
|
2
|
-
text-text-secondary`,children:[e.jsx("svg",{className:"w-3 h-3 text-status-success shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o]},d))}),t.recommendation&&e.jsx("p",{className:"text-2xs text-text-tertiary italic",children:t.recommendation}),r.length>0&&e.jsx("div",{className:"space-y-4 pt-2",children:r.map(o=>e.jsx(fa,{diff:o},o.key))})]})}function pa(t,a){if(!t)return[];const l=[];for(const n of Object.keys(t)){if(n.startsWith("_"))continue;const r=t[n],o=a[n];o!==void 0&&JSON.stringify(r)!==JSON.stringify(o)&&l.push({key:n,label:n.replace(/[_-]/g," "),original:r,corrected:o})}return l}function fa({diff:t}){const a=_t(t.original),l=_t(t.corrected);return a!==null&&l!==null?e.jsx("div",{className:"@container",children:e.jsxs("div",{className:"grid grid-cols-1 @form-cols:grid-cols-2 gap-x-8 gap-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("p",{className:"text-sm text-text-tertiary leading-relaxed line-through decoration-text-tertiary/30",children:a})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:l})]})]})}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("pre",{className:"text-xs text-text-tertiary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.original=="object"?JSON.stringify(t.original,null,2):String(t.original)})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.corrected=="object"?JSON.stringify(t.corrected,null,2):String(t.corrected)})]})]})}function _t(t){return t==null?"null":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null}const D={HELP:"help",DETAILS:"details",TRIAGE:"triage",METADATA:"metadata",CONTEXT:"context",RECORD:"record",ERRORS:"errors"},Bt="lt:escalation:panel:view";function ha(t){try{const a=localStorage.getItem(Bt);if(a&&t.includes(a))return a}catch{}return D.HELP}function ga({metadata:t,role:a}){const l=Qs(t);return l.length===0?e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No metadata on this escalation."}):e.jsx("dl",{className:"space-y-3.5",children:l.map(([n,r])=>{const o=typeof r=="object"&&r!==null?JSON.stringify(r):String(r),d=Nt(n,r,a),p=Nt(n,r);return e.jsxs("div",{className:"group relative",children:[e.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:Js(n)}),e.jsxs("dd",{className:"mt-0.5 flex items-center gap-1",children:[e.jsx("span",{className:"text-xs text-text-primary font-mono break-all flex-1",children:o}),e.jsx($e,{to:d,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:e.jsx(ra,{className:"w-3 h-3"})}),e.jsx($e,{to:p,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:e.jsx(ia,{className:"w-3 h-3"})})]})]},n)})})}function ba({esc:t,claimed:a,isTerminal:l,isBuilder:n,traceUrl:r}){return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("dl",{className:"space-y-3.5",children:[e.jsx(G,{label:"Status",children:e.jsx(Gs,{status:t.status})}),e.jsx(G,{label:"Assigned to Role",children:e.jsx(Xs,{role:t.role,size:"md"})}),e.jsxs(G,{label:"Priority",children:["P",t.priority]}),(a||l)&&t.assigned_to&&e.jsx(G,{label:"Claimed By",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[e.jsx(na,{className:"w-3 h-3 shrink-0 text-accent/75"}),e.jsx(ve,{userId:t.assigned_to})]})}),e.jsx(G,{label:"Created",children:e.jsx(Qe,{date:t.created_at})}),(a||l)&&t.claimed_at&&e.jsx(G,{label:"Claimed",children:e.jsx(Qe,{date:t.claimed_at})}),a&&!l&&t.assigned_until&&e.jsx(G,{label:"Time Remaining",children:e.jsx(Ve,{until:t.assigned_until})}),t.resolved_at&&e.jsx(G,{label:"Completed",children:e.jsx("span",{className:"text-status-success",children:e.jsx(Qe,{date:t.resolved_at})})})]}),n&&e.jsxs(e.Fragment,{children:[e.jsx("hr",{className:"border-surface-border/60"}),e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(te,{label:"Escalation ID",value:t.id}),t.task_id&&e.jsx(te,{label:"Task ID",value:t.task_id,href:`/workflows/tasks/detail/${t.task_id}`}),t.workflow_type&&e.jsx(te,{label:"Workflow Name",value:t.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(t.workflow_type)}`}),t.workflow_id&&e.jsx(te,{label:"Workflow ID",value:t.workflow_id,href:`/workflows/executions/${t.workflow_id}`}),t.task_queue&&e.jsx(te,{label:"Task Queue",value:t.task_queue,href:`/admin/controlplane?queue=${encodeURIComponent(t.task_queue)}`}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx(te,{label:"Origin",value:t.origin_id,href:`/processes/detail/${t.origin_id}`}),t.trace_id&&e.jsx(te,{label:"Trace",value:t.trace_id,href:r?r.replace("{traceId}",t.trace_id):void 0,external:!0})]})]})]})}function ja({esc:t,schema:a,envelope:l,payload:n,resolver:r,triage:o,hasAI:d,claimed:p,claimedByMe:g,isTerminal:f,isBuilder:u,traceUrl:b,open:x,noGutter:s,formErrors:h,activePanel:j,onPanelChange:v}){const k=at(),w=Object.values(D),[C,y]=c.useState(()=>ha(w)),T=j??C,E=c.useCallback(S=>{try{localStorage.setItem(Bt,S)}catch{}y(S),v==null||v(S)},[v]);c.useEffect(()=>{j&&j!==C&&y(j)},[j]);const L=c.useMemo(()=>Fs(a,{escalation:t,metadata:t.metadata??null,envelope:l,payload:n,resolver:r})??qs({isTerminal:f,status:t.status,claimed:p,claimedByMe:g}),[a,t,l,n,r,f,p,g]),W=c.useCallback(S=>{const P=S.target.closest("a"),A=P==null?void 0:P.getAttribute("href");A!=null&&A.startsWith("/")&&(S.preventDefault(),k(A))},[k]),R=[{id:D.HELP,icon:Ks,label:"Instructions",content:e.jsx(Mt,{content:L,onClick:W})},{id:D.DETAILS,icon:Ys,label:"Details",content:e.jsx(ba,{esc:t,claimed:p,isTerminal:f,isBuilder:u,traceUrl:b})},...d&&o?[{id:D.TRIAGE,icon:Zs,label:"AI Analysis",content:e.jsx(ma,{triage:o,payload:n??{}})}]:[],{id:D.METADATA,icon:ea,label:"Metadata",content:e.jsx(ga,{metadata:t.metadata,role:t.role})},{id:D.CONTEXT,icon:ta,label:"Context",content:e.jsxs("div",{className:"space-y-5",children:[l!=null&&e.jsx(ye,{data:l,label:"Input Envelope"}),n!=null&&e.jsx(ye,{data:n,label:"Escalation Context"}),r!=null&&e.jsx(ye,{data:r,label:"Resolver Payload"}),l==null&&n==null&&r==null&&e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No context on this escalation."})]})},...u?[{id:D.RECORD,icon:sa,label:"Record",content:e.jsx(ye,{data:t,label:"Escalation Record"})}]:[],...h&&h.length>0?[{id:D.ERRORS,icon:(({className:S})=>e.jsx(aa,{className:`${S??""} text-status-error`})),label:"Errors",content:e.jsx(Ls,{errors:h,schema:a})}]:[]];return e.jsx(us,{open:x,width:384,className:"h-full",children:e.jsx("div",{className:`h-full${s?"":" pl-6"}`,children:e.jsxs("div",{className:"h-full flex flex-col bg-surface-hover",children:[e.jsx("div",{className:"shrink-0 pt-2 pb-0 flex justify-center",children:e.jsx(xa,{esc:t,className:"w-[80%]"})}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(xs,{views:R,activeId:T,onViewChange:E,stickyClassName:"h-full min-h-0"})})]})})})}function ya(t){const{mode:a,activeView:l,onActiveViewChange:n,onClaim:r,claimPending:o,claimNudge:d,workflowType:p,json:g,onResolve:f,resolvePending:u,resolveError:b,requestTriage:x,triageNotes:s,onRelease:h,releasePending:j,onCancel:v,assignedTo:k,assignedUntil:w,onSubmitAttempt:C,onValidationErrors:y,escalationContext:T,labels:E={},submitBlocked:L,submitBlockedMessage:W,actingName:R,submitNeedsBadge:S,canManage:P,onReassign:A,onUnassign:F,unassignPending:O}=t,$=Lt(),[de,ae]=c.useState("30"),[Ne,ue]=c.useState(0),[we,_]=c.useState(""),V=de==="custom",Q=c.useCallback(N=>ue(N),[]),q=!!L&&!x;if(a==="terminal")return null;const ke=()=>{const N=V?Ne:parseInt(de);!N||N<=0||r(N)},Be=()=>{if(_(""),x){const K={_lt:{needsTriage:!0}};s.trim()&&(K.notes=s.trim()),f(K);return}const N=tt(g,T);if(N.parseError){_(N.parseError);return}if(N.errors.length>0){C==null||C(),y==null||y(N.errors);return}f(N.payload)},ne=N=>`text-xs transition-colors ${N?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return e.jsxs("div",{className:"shrink-0 h-[80px] bg-surface/95 backdrop-blur-sm border-t border-surface-border -ml-10 pl-10 pr-10 pt-3 pb-5","data-testid":"escalation-action-bar",children:[a==="available"&&e.jsxs("div",{"data-testid":"claim-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[$.map(N=>e.jsx("button",{onClick:()=>{ae(N.value),ue(0)},className:ne(!V&&de===N.value),children:N.label},N.value)),e.jsx("button",{onClick:()=>ae("custom"),className:ne(V),children:"Other"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[E.cancel!==!1&&e.jsx("button",{onClick:v,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:E.cancel??"Cancel escalation"}),e.jsx("div",{className:"flex-1"}),V&&e.jsx(Pt,{onChange:Q,compact:!0,autoFocus:!0}),e.jsx("button",{onClick:ke,disabled:o||V&&Ne<=0,className:`btn-primary text-xs ${d?"animate-[field-shake_0.4s_ease-in-out]":""}`,"data-testid":"claim-button",children:o?"Claiming...":E.claim??"Claim"},d)]})]}),a==="claimed_by_other"&&e.jsxs("div",{className:"flex items-center gap-4","data-testid":"claimed-other-bar",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Claimed by ",e.jsx("span",{className:"font-medium text-text-primary",children:k?e.jsx(ve,{userId:k}):"unknown"})]}),w&&e.jsx(Ve,{until:w}),b&&e.jsx("span",{className:"text-xs text-status-error",children:b.message}),P&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:A,className:"text-xs text-text-tertiary hover:text-accent transition-colors","data-testid":"admin-reassign",children:"Reassign…"}),e.jsx("button",{onClick:F,disabled:O,className:"text-xs text-text-tertiary hover:text-status-error transition-colors disabled:opacity-50","data-testid":"admin-unassign",children:O?"Returning…":"Return to queue"})]})]}),a==="claimed_by_me"&&e.jsxs("div",{"data-testid":"action-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[e.jsx("button",{onClick:()=>n("resolve"),className:ne(l==="resolve"),children:p?"Resolve":"Acknowledge"}),e.jsx("button",{onClick:()=>n("release"),className:`text-xs transition-colors ${l==="release"?"text-status-error font-medium":"text-text-tertiary hover:text-status-error"}`,children:E.release??"Release"}),E.cancel!==!1&&e.jsx("button",{onClick:v,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:E.cancel??"Cancel"})]}),l==="resolve"&&e.jsxs("div",{className:"flex items-center gap-4",children:[S?e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-text-secondary","data-testid":"submit-badge-warning",children:[e.jsx(Vt,{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"," ",e.jsx("span",{className:"font-medium text-text-primary",children:k?e.jsx(ve,{userId:k}):"the claimant"}),"."]}):R&&e.jsxs("p",{className:"text-sm text-text-secondary","data-testid":"acting-claim-note",children:["Claimed by you ",e.jsxs("span",{className:"font-medium text-text-primary",children:["(",R,")"]})]}),!S&&R&&w&&e.jsx(Ve,{until:w}),e.jsx("div",{className:"flex-1"}),we&&e.jsx("span",{className:"text-xs text-status-error",children:we}),b&&e.jsx("span",{className:"text-xs text-status-error",children:b.message}),q&&W&&e.jsx("span",{className:"text-xs text-status-pending","data-testid":"submit-guard-message",children:W}),e.jsx("button",{onClick:Be,disabled:u||q,className:"btn-primary text-xs",children:u?p?"Submitting...":"Acknowledging...":x?"Send to Triage":E.submit??(p?"Submit":"Acknowledge")})]}),l==="release"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Release back to pool?"}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>n("resolve"),className:"btn-secondary text-xs",children:"Back"}),e.jsx("button",{onClick:h,disabled:j,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:j?"Releasing...":"Yes, Release"})]})]})]})}function Ze({children:t}){return e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:t})}function va({payload:t,isTerminal:a,resolverPayload:l,onRetryTriage:n,isRetrying:r}){const o=t.title,d=t.summary,p=t.diagnosis,g=t.tool_calls_made,f=t.result,u=l==null?void 0:l._lt,b=(u==null?void 0:u.triaged)===!0,x=u==null?void 0:u.triageWorkflowId,s=a&&b,[h,j]=c.useState(!1);return s?e.jsxs("div",{className:"rounded-md border border-status-success/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-success shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm3.36 4.65a.5.5 0 00-.72 0L7 9.29 5.36 7.65a.5.5 0 10-.72.7l2 2a.5.5 0 00.72 0l4-4a.5.5 0 000-.7z"})}),e.jsx("span",{className:"text-xs font-medium text-status-success",children:"Resolved by AI Triage"})]}),typeof g=="number"&&e.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[g," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[o&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:o}),p&&e.jsxs("div",{children:[e.jsx(Ze,{children:"Triage diagnosis"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(Ke,{content:p})})]}),e.jsx("div",{className:"flex items-center gap-3",children:x&&e.jsx($e,{to:`/workflows/executions/${x}`,className:"text-2xs text-accent hover:underline",children:"View triage execution"})})]})]}):e.jsxs("div",{className:"rounded-md border border-status-warning/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-warning shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm0 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 4zm0 7a.75.75 0 100-1.5.75.75 0 000 1.5z"})}),e.jsx("span",{className:"text-xs font-medium text-status-warning",children:"Tool Rounds Exhausted"})]}),typeof g=="number"&&e.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[g," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[o&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:o}),d&&e.jsxs("div",{children:[e.jsx(Ze,{children:"What happened"}),e.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:e.jsx(Ke,{content:d})})]}),p&&e.jsxs("div",{children:[e.jsx(Ze,{children:"What went wrong"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(Ke,{content:p})})]}),f!=null&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>j(!h),className:"flex items-center gap-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary hover:text-text-secondary transition-colors",children:[e.jsx("svg",{className:`w-3 h-3 transition-transform ${h?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:e.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),h&&e.jsx("div",{className:"mt-2",children:e.jsx(ye,{data:f,defaultMode:"tree"})})]}),n&&!a&&e.jsx("div",{className:"pt-2",children:e.jsxs("button",{onClick:n,disabled:r,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium bg-accent text-text-inverse rounded-md hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"currentColor",children:e.jsx("path",{d:"M7 1a6 6 0 100 12A6 6 0 007 1zm2.5 6.5l-3.5 2V5.5l3.5 2z"})}),r?"Sending to triage...":"Retry with AI Triage"]})})]})]})}const X={PENDING:"pending",CLAIMED:"claimed",RESOLVED:"resolved"};function Ft(t){const a=t==null?void 0:t["x-lt-viewport"];return(a==null?void 0:a.type)!=="iframe"||typeof a.src!="string"||!a.src?null:a}function Et(t,a){return a===X.CLAIMED?t.src:a===X.PENDING?t.onPending??null:t.onResolved??null}function Oe(t,a){if(!t.includes("{"))return t;try{const l=r=>{if(!r)return{};try{return JSON.parse(r)}catch{return{}}},n={...a.metadata??{},...l(a.envelope),...l(a.escalation_payload),...l(a.resolver_payload)};return t.replace(/\{([^}]+)\}/g,(r,o)=>Object.prototype.hasOwnProperty.call(n,o)?String(n[o]):`{${o}}`)}catch{return t}}function Rt(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function We({src:t,escalation:a,schema:l,stage:n=X.CLAIMED,onResolve:r,onEscalate:o,readOnly:d=!1,submitAttempted:p,fill:g}){const f=c.useRef(null),u=c.useRef("");c.useEffect(()=>{try{const x=new URL(t);u.current=x.origin}catch{u.current=""}},[t]);const b=c.useCallback(()=>{const x=f.current;if(!(x!=null&&x.contentWindow)||!u.current)return;const h={type:"lt:init",escalation:{id:a.id,type:a.type,subtype:a.subtype,description:a.description,status:a.status,priority:a.priority,role:a.role,workflow_type:a.workflow_type,envelope:Rt(a.envelope),metadata:a.metadata??null,escalation_payload:Rt(a.escalation_payload)},schema:l,stage:n};x.contentWindow.postMessage(h,u.current)},[a,l,n]);return c.useEffect(()=>{const x=s=>{if(s.origin!==u.current)return;const h=s.data;if(!(!h||typeof h!="object"||typeof h.type!="string"))switch(h.type){case"lt:ready":b();break;case"lt:submit":!d&&h.payload&&typeof h.payload=="object"&&(r==null||r(h.payload));break;case"lt:escalate":!d&&typeof h.target=="string"&&h.target&&(o==null||o(h.target));break;case"lt:resize":{const j=f.current;j&&typeof h.height=="number"&&h.height>0&&(j.style.height=`${Math.min(h.height,2e3)}px`);break}}};return window.addEventListener("message",x),()=>window.removeEventListener("message",x)},[b,r,o,d]),c.useEffect(()=>{if(!p||d)return;const x=f.current;x!=null&&x.contentWindow&&u.current&&x.contentWindow.postMessage({type:"lt:validate"},u.current)},[p,d]),g?e.jsx("div",{className:"absolute inset-0 overflow-hidden",children:e.jsx("iframe",{ref:f,src:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full h-full border-0 block",title:"HITL Viewport",onLoad:b})}):e.jsx("div",{className:"rounded-md border border-surface-border overflow-hidden bg-white",children:e.jsx("iframe",{ref:f,src:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full border-0",style:{minHeight:"600px"},title:"HITL Viewport",onLoad:b})})}function Na({json:t,onJsonChange:a,requestTriage:l,onRequestTriageChange:n,triageNotes:r,onTriageNotesChange:o,disabled:d=!1,submitAttempted:p=!1,showTriage:g=!1,escalationContext:f,onOpenHelp:u,onDisabledClick:b,disabledHint:x}){return e.jsxs(e.Fragment,{children:[g&&e.jsx("div",{className:"flex items-center justify-between mb-3",children:l?e.jsxs("button",{onClick:()=>n(!1),className:"group flex items-center gap-2 text-left","data-testid":"triage-cancel",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent/10 text-accent shrink-0",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),e.jsxs("span",{className:"text-xs text-text-secondary group-hover:text-text-primary transition-colors",children:["AI Triage active."," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Cancel"})]})]}):e.jsxs("button",{onClick:()=>n(!0),className:"group flex items-center gap-2.5 text-left my-4","data-testid":"triage-callout",children:[e.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-accent/10 text-accent shrink-0 animate-[triage-glow_6s_ease-in-out_infinite]",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.674M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),e.jsxs("span",{className:"text-sm text-text-secondary group-hover:text-text-primary transition-colors",children:["This form doesn't capture the issue?"," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Request AI Triage"})]})]})}),e.jsxs("div",{className:"relative min-h-[200px]",children:[e.jsx("div",{className:l?"pointer-events-none select-none":"",children:e.jsx($t,{value:t,onChange:a,disabled:d,submitAttempted:p,escalationContext:f,onOpenHelp:u,onDisabledClick:b,disabledHint:x})}),l&&e.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col bg-surface/90 backdrop-blur-[2px] rounded-md border border-accent/20 p-5","data-testid":"triage-overlay",children:[e.jsx("p",{className:"text-xs text-text-secondary mb-3 leading-relaxed",children:"The resolution form will not be submitted. Describe the issue so AI triage can diagnose and fix it using available tools. The corrected result will come back as a new escalation for your review."}),e.jsx("textarea",{value:r,onChange:s=>o(s.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 At(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function se(t,a){return{escalation:t,metadata:t.metadata??null,envelope:At(t.envelope),payload:At(t.escalation_payload),resolver:null,...a?{lookup:a}:{}}}function wa({isRoundsExhausted:t,payloadObj:a,isTerminal:l,resolverPayload:n,onRetryTriage:r,isRetrying:o}){return e.jsxs(e.Fragment,{children:[t&&a&&e.jsx("div",{className:"mt-8",children:e.jsx(va,{payload:a,isTerminal:l,resolverPayload:n,onRetryTriage:r,isRetrying:o})}),(a==null?void 0:a.category)==="missing_credential"&&e.jsxs("div",{className:"mt-8 bg-status-warning/10 border border-status-warning/30 rounded-md px-5 py-4 flex items-start gap-3",children:[e.jsx(wt,{size:20,className:"text-status-warning mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text-primary mb-1",children:"Missing Credential"}),e.jsxs("p",{className:"text-xs text-text-secondary mb-3",children:["This workflow requires a ",e.jsx("span",{className:"font-medium capitalize",children:String(a.provider)})," credential to continue. Register one and then resolve this escalation to retry."]}),e.jsxs($e,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(wt,{size:12}),"Go to Credentials"]})]})]})]})}function ka({esc:t,resolverPayload:a,isTerminal:l,editable:n,activeView:r,metadataFormSchema:o,effectiveSchema:d,lookup:p,json:g,onJsonChange:f,requestTriage:u,onRequestTriageChange:b,triageNotes:x,onTriageNotesChange:s,onResolve:h,onEscalate:j,onClaim:v,submitAttempted:k,isCertified:w,hasAI:C,onOpenHelp:y,onDisabledClick:T,disabledHint:E}){const L=d,W=se(t,p),R=Ft(L);if(l){const A=R&&t.status==="resolved"?Et(R,X.RESOLVED):null;if(A)return e.jsx("div",{className:"mt-3",children:e.jsx(We,{src:Oe(A,t),escalation:t,schema:L,stage:X.RESOLVED,readOnly:!0})});if(a==null)return null;const F=typeof a=="object"&&a!==null?a:{},O=d??o,$=O!=null&&O.properties?{...Us(F,O),_form_schema:O}:F;return e.jsx("div",{className:"mt-3",children:e.jsx($t,{value:JSON.stringify($,null,2),onChange:()=>{},disabled:!0,escalationContext:W,disabledHint:E})})}if(r!=="resolve"||!(t.workflow_type||d))return null;const S=!!R&&!!h&&!!j;if(S&&!n){const A=Et(R,X.PENDING);return A?e.jsx("div",{className:"mt-3",children:e.jsx(We,{src:Oe(A,t),escalation:t,schema:L,stage:X.PENDING,readOnly:!0})}):e.jsxs("button",{onClick:()=>v==null?void 0:v(),disabled:!v,className:"flex flex-col items-center justify-center min-h-[55vh] w-full gap-3 text-center group disabled:opacity-50 disabled:cursor-default",children:[e.jsx(la,{className:"w-10 h-10 text-text-tertiary group-hover:text-accent transition-colors",strokeWidth:1}),e.jsx("p",{className:"text-base font-medium text-text-primary group-hover:text-accent transition-colors",children:"Claim to launch the editor"})]})}const P=S?Oe(R.src,t):"";return e.jsx("div",{className:"mt-3",children:S?e.jsx(We,{src:P,escalation:t,schema:L,onResolve:h,onEscalate:j,submitAttempted:k}):e.jsx(Na,{json:g,onJsonChange:f,requestTriage:u,onRequestTriageChange:b,triageNotes:x,onTriageNotesChange:s,disabled:!n,submitAttempted:k,showTriage:!!w&&!!C,escalationContext:W,onOpenHelp:y,onDisabledClick:T,disabledHint:E})})}function Ca({open:t,assignedUntil:a,onClose:l,onExtend:n,isPending:r}){const o=Lt(),[d,p]=c.useState("30"),[g,f]=c.useState(0),u=d==="custom",b=u?g:parseInt(d),x=c.useCallback(s=>f(s),[]);return e.jsx(st,{open:t,onClose:l,title:"Claim Expiring",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Your claim on this escalation expires in"," ",e.jsx(Ve,{until:a}),". When it lapses, the form locks and the item returns to the queue — your edits are kept as a draft. Extend to keep working."]}),e.jsxs("select",{value:d,onChange:s=>{p(s.target.value),f(0)},className:"select w-full text-sm","aria-label":"Extension duration",children:[o.map(s=>e.jsx("option",{value:s.value,children:s.label},s.value)),e.jsx("option",{value:"custom",children:"Other..."})]}),u&&e.jsx(Pt,{onChange:x,autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:l,className:"btn-secondary text-xs",children:"Dismiss"}),e.jsx("button",{onClick:()=>n(b),className:"btn-primary text-xs",disabled:r||!b||b<=0,children:r?"Extending...":"Extend Claim"})]})]})})}const Sa=9e4;function _a(t,a=Sa){const[,l]=c.useState(0);if(c.useEffect(()=>{if(!t)return;const r=new Date(t).getTime()-Date.now();if(r<=0)return;const o=()=>l(g=>g+1),d=[],p=r-a;return p>0&&d.push(window.setTimeout(o,p)),d.push(window.setTimeout(o,r)),()=>d.forEach(g=>window.clearTimeout(g))},[t,a]),!t)return{expired:!1,expiringSoon:!1,msRemaining:0};const n=Math.max(0,new Date(t).getTime()-Date.now());return{expired:n<=0,expiringSoon:n>0&&n<=a,msRemaining:n}}const Ea="lt:escalation:draft:";function nt(t){return`${Ea}${t}`}function Ra(t){try{return localStorage.getItem(nt(t))}catch{return null}}function Aa(t,a){try{localStorage.setItem(nt(t),a)}catch{}}function et(t){try{localStorage.removeItem(nt(t))}catch{}}const Ta="x-lt-transition",Ia="x-lt-transition-message",Ma="x-lt-transition-max-wait-seconds",Da="x-lt-transition-done",La="Submitted. Preparing your next step…",Pa=30,Oa=5,Wa=300;function $a(t){const a=typeof t=="number"?t:Number(t);return!Number.isFinite(a)||a<=0?Pa:Math.min(Wa,Math.max(Oa,Math.round(a)))}function Tt(t){if(!t||!t[Ta])return null;const a=t[Ia];return{message:typeof a=="string"&&a.trim().length>0?a:La,maxWaitSeconds:$a(t[Ma])}}function Va(t){const a=t==null?void 0:t[Da];return typeof a=="string"&&a.trim().length>0?a:null}const Ba="x-lt-submit-on-claim";function Fa(t){return!!(t!=null&&t[Ba])}const qa="x-lt-submit-guard",Ua="{{count}} related items are still pending";function Ja(t){const a=t==null?void 0:t[qa];if(!a||typeof a!="object"||Array.isArray(a))return;const l=a;if(!(!l.query||typeof l.query!="object"))return l}function za(t,a){const{user:l}=Dt(),n=zs((t==null?void 0:t.query)??{},a??{},l==null?void 0:l.userId),{data:r,isSuccess:o}=ms({role:n.role,status:n.status,facets:n.facets,assigned_to:n.assigned_to,available:n.available,limit:1,enabled:!!t&&n.enabled}),d=!!t&&t.mustBeEmpty!==!1&&n.enabled,p=(r==null?void 0:r.total)??0,g=d&&o&&p===0,f=d&&!g;let u="";if(f)if(p>0){const b=(t==null?void 0:t.message)??Ua;u=Wt(b.replace(/\{\{count\}\}/g,String(p)),a??{})}else u="Checking related items…";return{blocked:f,count:p,message:u,confirmedEmpty:g}}function Ha({open:t,message:a}){return t?Ws.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[e.jsx("div",{className:"absolute inset-0 bg-text-primary/40 backdrop-blur-sm"}),e.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:[e.jsx("div",{className:"flex justify-center mb-4","aria-hidden":"true",children:e.jsx("span",{className:"inline-block w-7 h-7 rounded-full border-2 border-surface-border border-t-accent animate-spin"})}),e.jsx("div",{className:"text-sm text-text-secondary [&_p]:m-0 [&_p+p]:mt-2",children:e.jsx(Mt,{content:a})})]})]}),document.body):null}function Ga({open:t,verb:a="submit",claimantId:l,wrongBadgeName:n,onCancel:r}){return t?e.jsx(st,{open:!0,onClose:r,title:`Scan your badge to ${a}`,children:e.jsxs("div",{className:"flex flex-col items-center text-center py-6","data-testid":"station-write-challenge",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx(oa,{className:"w-7 h-7 text-text-quaternary",strokeWidth:1}),e.jsx(Vt,{className:"w-9 h-9 text-accent-muted",strokeWidth:1})]}),e.jsxs("p",{className:"text-lg text-text-secondary",children:["Scan your badge to ",a," as"," ",e.jsx("span",{className:"font-medium text-text-primary",children:l?e.jsx(ve,{userId:l}):"the claimant"}),"."]}),n&&e.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 ",a,"."]}),e.jsx("div",{className:"w-16 border-t border-surface-border my-6"}),e.jsx("button",{type:"button",onClick:r,className:"text-sm text-text-tertiary hover:text-text-secondary hover:underline",children:"Cancel"})]})}):null}const qt="lt:escalation:panel:open";function Xa(){try{const t=localStorage.getItem(qt);return t===null?!0:t==="true"}catch{return!0}}function be(t){try{localStorage.setItem(qt,String(t))}catch{}}function je(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}function jn(){const{id:t}=$s();return e.jsx(Qa,{id:t},t)}function Qa({id:t}){var gt,bt,jt,yt,vt;const{user:a,isSuperAdmin:l,hasRoleType:n}=Dt(),r=l||n("admin"),{identity:o,clear:d}=ps(),p=fs(),{data:g}=hs((a==null?void 0:a.userId)??null),f=(o==null?void 0:o.actorId)??(a==null?void 0:a.userId),u=at(),b=Ot(),x=It(),{data:s,isLoading:h,refetch:j,isFetching:v}=gs(t);bs(t);const k=c.useMemo(()=>{if(!(s!=null&&s.envelope))return!1;try{const i=JSON.parse(s.envelope);return Array.isArray(i==null?void 0:i.lookups)&&i.lookups.length>0}catch{return!1}},[s==null?void 0:s.envelope]),{data:w}=js(t,k),C=c.useMemo(()=>{var i;return(i=w==null?void 0:w.lookups)!=null&&i.length?Object.fromEntries(w.lookups.filter(m=>!m.missing).map(m=>[m.as??m.key,m.data])):null},[w]),y=ys(),T=vs(),E=Ns(),L=ws(),W=ks(),R=Cs(),[S,P]=c.useState(!1),[A,F]=c.useState(!1),{data:O}=Ss(),{data:$}=_s(),{isBuilder:de}=Es(),ae=O==null?void 0:O.find(i=>i.workflow_type===(s==null?void 0:s.workflow_type)),Ne=((gt=$==null?void 0:$.telemetry)==null?void 0:gt.traceUrl)??null,[ue,we]=c.useState("resolve"),[_,V]=c.useState("{}"),[Q,q]=c.useState(Xa),[ke,Be]=c.useState(!1),[ne,N]=c.useState(""),[K,Fe]=c.useState(!1),[Ut,xe]=c.useState([]),[Jt,zt]=c.useState(0),[Ht,me]=c.useState(void 0),[U,qe]=c.useState(null),[Gt,rt]=c.useState(!1),it=c.useRef(!1),Ce=c.useRef(null),lt=c.useRef(!1),Se=c.useRef(null),[Y,Ue]=c.useState(null),Xt=_a(s==null?void 0:s.assigned_until),[Qt,Kt]=c.useState(null);c.useEffect(()=>{if(!(!K||!s))try{const i=JSON.parse(_),m=i._form_schema;if(!m){xe([]);return}xe(Ps(m,i,se(s,C)))}catch{}},[_,K,s]);const _e=((bt=s==null?void 0:s.metadata)==null?void 0:bt.form_schema)??null,re=(s==null?void 0:s.form_schema)??(ae==null?void 0:ae.resolver_schema)??null,I=_e??re,ot=Fa(I),J=Is(I),pe=Ja(I),fe=za(pe,s?se(s,C):void 0),Ee=c.useRef(!1),Re=c.useRef(null);c.useEffect(()=>{if(Ee.current)return;const i=_e??(re!=null&&re.properties?re:null);if(i!=null&&i.properties){Ee.current=!0;const m=je(s==null?void 0:s.envelope),M=m==null?void 0:m.formDefaults,B={...(s==null?void 0:s.metadata)??{},...typeof M=="object"&&M!==null?M:{}};Re.current=Hs(i,B);const H=!((s==null?void 0:s.status)==="resolved"||(s==null?void 0:s.status)==="cancelled")&&(s!=null&&s.id)?Ra(s.id):null,De=H?je(H):null;De&&typeof De=="object"&&!Array.isArray(De)?V(JSON.stringify({...De,_form_schema:i},null,2)):V(Re.current)}else I&&(Ee.current=!0,V(JSON.stringify(I,null,2)))},[I,_e,re,s==null?void 0:s.envelope,s==null?void 0:s.metadata,s==null?void 0:s.id,s==null?void 0:s.status]),c.useEffect(()=>{if(!Ee.current||Re.current===null||!(s!=null&&s.id)||s.status!=="pending")return;const i=s.id,m=window.setTimeout(()=>{_===Re.current?et(i):Aa(i,_)},400);return()=>window.clearTimeout(m)},[_,s==null?void 0:s.id,s==null?void 0:s.status]),c.useEffect(()=>{if(!U)return;const i=window.setTimeout(async()=>{var M;try{const B=new URLSearchParams({parent_id:t,assigned_to:f??"",status:"pending",limit:"1"}),le=await ce(`/escalations?${B}`),H=(M=le==null?void 0:le.escalations)==null?void 0:M[0];if(H!=null&&H.id&&H.parent_id===t){qe(null),u(`/escalations/detail/${H.id}`);return}}catch{}qe(null),x.resetQueries({queryKey:["escalations"]}),x.resetQueries({queryKey:["escalationStats"]});const m=U.doneDest;m?m.startsWith("/")?u(m):window.location.assign(m):u(-1)},U.maxWaitSeconds*1e3);return()=>window.clearTimeout(i)},[U,t,f,u,x]),c.useEffect(()=>{var i,m;it.current||(i=b.state)!=null&&i.autoStart&&(!s||s.status!=="pending"||Pe(s)||_!=="{}"&&(it.current=!0,(m=Ce.current)==null||m.call(Ce)))},[s,_,b.state]),c.useEffect(()=>{var i;lt.current||!(pe!=null&&pe.autoResolveWhenEmpty)||!fe.confirmedEmpty||!s||s.status!=="pending"||!Pe(s)||s.assigned_to===f&&_!=="{}"&&(lt.current=!0,(i=Se.current)==null||i.call(Se))},[fe.confirmedEmpty,pe,s,_,f]),c.useEffect(()=>{if(!(!Y||!s)&&o&&o.actorId===s.assigned_to){const{run:i}=Y;Ue(null),i()}},[o,Y,s==null?void 0:s.assigned_to]);const Yt=(s==null?void 0:s.subtype)==="rounds_exhausted";if(h)return e.jsxs("div",{className:"animate-pulse space-y-8",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-32 bg-surface-sunken rounded w-full"})]});if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Escalation not found."});const Ae=Pe(s),Z=Ae&&s.assigned_to===f,Zt=Ae&&!Z,ee=s.status==="resolved"||s.status==="cancelled",Je=p&&Rs(g)&&Ae&&!ee,ct=Z||Je,dt=Je&&s.assigned_to!==(a==null?void 0:a.userId),ut=Ft(I),ze=!!ut&&ct&&!ee,Te=je(s.escalation_payload),ie=je(s.resolver_payload),Ie=je(s.envelope),es=!!((jt=Ie==null?void 0:Ie.metadata)!=null&&jt.certified),xt=As(),mt=xt!==null?xt:!!((yt=$==null?void 0:$.ai)!=null&&yt.enabled),z=typeof Te=="object"&&Te!==null&&!Array.isArray(Te)?Te:null,ts=z==null?void 0:z._triage,ss=typeof ie=="object"&&ie!==null&&!Array.isArray(ie)?ie:null,He=ee?"terminal":Z||Je?"claimed_by_me":Zt?"claimed_by_other":"available",as=He==="available"?`${typeof J.claim=="string"?J.claim:"Claim"} this escalation to edit the form`:He==="claimed_by_other"?e.jsxs(e.Fragment,{children:["Claimed by ",s.assigned_to?e.jsx(ve,{userId:s.assigned_to}):"another user"]}):s.status==="cancelled"?"This escalation is cancelled":s.status==="resolved"?"This escalation is resolved — the submitted values are shown":null,Ge=i=>{y.mutate({id:t,durationMinutes:i})},he=()=>{x.resetQueries({queryKey:["escalations"]}),x.resetQueries({queryKey:["escalationStats"]}),u(-1)},ns=()=>{const i=Va(I);return i&&Wt(i,se(s,C))||null},rs=i=>{x.resetQueries({queryKey:["escalations"]}),x.resetQueries({queryKey:["escalationStats"]}),i.startsWith("/")?u(i):window.location.assign(i)},is=async i=>{try{await T.mutateAsync({id:t,resolverPayload:i})}catch(B){if(B instanceof Ts&&Os(B.body)){Fe(!0),xe(B.body.violations),me(D.ERRORS);return}throw B}et(t);const m=Tt(I),M=ns();if(m){qe({...m,doneDest:M});return}if(M){rs(M);return}he()},Me=(i,m)=>{if(dt){d(),Ue({verb:i,run:m});return}m()},ge=async i=>{Me("submit",()=>is(i))},pt=async i=>{try{await y.mutateAsync({id:t,durationMinutes:i})}catch{return}if(fe.blocked)return;const m=tt(_,se(s,C));if(!m.parseError){if(m.errors.length>0){Fe(!0),xe(m.errors),q(!0),be(!0),me(D.ERRORS);return}await ge(m.payload)}};Ce.current=async()=>{var m;const i=(m=b.state)==null?void 0:m.durationMinutes;rt(!0),await pt(typeof i=="number"&&i>0?i:30),rt(!1)},Se.current=()=>{const i=tt(_,se(s,C));i.parseError||i.errors.length>0||ge(i.payload)};const ft=i=>{i&&Me("escalate",async()=>{await E.mutateAsync({id:t,targetRole:i}),he()})},ls=async()=>{Z||await y.mutateAsync({id:t,durationMinutes:30});const i=(z==null?void 0:z.diagnosis)||s.description||"";await T.mutateAsync({id:t,resolverPayload:{_lt:{needsTriage:!0},notes:i}}),he()},ht=()=>{Me("release",async()=>{await y.mutateAsync({id:t,durationMinutes:0}),he()})},os=()=>{P(!1),Me("cancel",async()=>{await L.mutateAsync(t),et(t),he()})},cs=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Bs,{onRefresh:()=>j(),isFetching:v,apiPath:`/escalations/${s.id}`,standalone:!0}),e.jsx("button",{onClick:()=>q(i=>(be(!i),!i)),className:"ml-2 text-accent/60 hover:text-accent transition-colors",title:Q?"Hide side panel":"Show side panel",children:Q?e.jsx(kt,{className:"w-5 h-5",strokeWidth:1.5}):e.jsx(Ct,{className:"w-5 h-5",strokeWidth:1.5})})]});return e.jsxs("div",{className:"flex-1 min-h-0 min-w-0 flex items-stretch -mt-8 -mr-page-x -mb-16",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[ze?e.jsxs("div",{className:"relative flex-1 min-h-0 -ml-page-x",children:[e.jsx("div",{className:"absolute top-3 right-3 z-50 flex items-center gap-0.5 bg-surface/90 backdrop-blur-sm rounded-lg px-1.5 py-1 shadow-sm border border-surface-border/40",children:[{onClick:ht,disabled:y.isPending,label:J.release??"Release",hoverClass:"hover:text-accent",icon:e.jsx(ca,{className:"w-4 h-4",strokeWidth:1.5})},...J.cancel===!1?[]:[{onClick:()=>P(!0),disabled:!1,label:J.cancel??"Cancel",hoverClass:"hover:text-status-error",icon:e.jsx(da,{className:"w-4 h-4",strokeWidth:1.5})}],{onClick:()=>q(i=>(be(!i),!i)),disabled:!1,label:Q?"Hide panel":"Show panel",hoverClass:"hover:text-accent",icon:Q?e.jsx(kt,{className:"w-4 h-4",strokeWidth:1.5}):e.jsx(Ct,{className:"w-4 h-4",strokeWidth:1.5})}].map(({onClick:i,disabled:m,label:M,hoverClass:B,icon:le})=>e.jsxs("div",{className:"relative group/tip",children:[e.jsx("button",{onClick:i,disabled:m,className:`text-text-tertiary ${B} transition-colors disabled:opacity-40 disabled:cursor-default p-1.5 rounded-md`,children:le}),e.jsx("span",{className:"pointer-events-none absolute top-full left-1/2 -translate-x-1/2 mt-1.5 px-2 py-0.5 rounded text-2xs bg-surface-sunken text-text-primary whitespace-nowrap opacity-0 group-hover/tip:opacity-100 transition-opacity",children:M})]},M))}),e.jsx(We,{src:Oe(ut.src,s),escalation:s,schema:I,stage:X.CLAIMED,onResolve:ge,onEscalate:ft,submitAttempted:K,fill:!0})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"shrink-0 pt-8 pr-page-x",children:e.jsx(Vs,{title:s.description||"Escalation",actions:cs})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-page-x",children:[e.jsx(wa,{isRoundsExhausted:Yt,payloadObj:z,isTerminal:ee,resolverPayload:ie,onRetryTriage:ls,isRetrying:y.isPending||T.isPending}),e.jsx(ka,{esc:s,resolverPayload:ie,isTerminal:ee,editable:ct,activeView:ue,lookup:C,metadataFormSchema:_e,effectiveSchema:I,json:_,onJsonChange:V,requestTriage:ke,onRequestTriageChange:Be,triageNotes:ne,onTriageNotesChange:N,onResolve:ge,onEscalate:ft,onClaim:()=>Ge(30),submitAttempted:K,isCertified:es,hasAI:mt,onOpenHelp:()=>{q(!0),be(!0),me(D.HELP)},onDisabledClick:()=>zt(i=>i+1),disabledHint:as}),e.jsx("div",{className:"h-10"})]})]}),!ze&&e.jsx(ya,{escalationContext:se(s,C),mode:He,activeView:ue,onActiveViewChange:we,onClaim:ot?pt:Ge,claimPending:y.isPending||ot&&T.isPending,claimNudge:Jt,workflowType:s.workflow_type,json:_,onResolve:ge,resolvePending:T.isPending||T.isSuccess,resolveError:T.error,requestTriage:ke,triageNotes:ne,onRelease:ht,releasePending:y.isPending,onCancel:()=>P(!0),assignedTo:s.assigned_to,assignedUntil:s.assigned_until,actingName:o&&Z?o.displayName:null,submitNeedsBadge:dt,onSubmitAttempt:()=>Fe(!0),onValidationErrors:i=>{xe(i),q(!0),be(!0),me(D.ERRORS)},labels:J,submitBlocked:fe.blocked,submitBlockedMessage:fe.message,canManage:r,onReassign:()=>F(!0),onUnassign:()=>R.mutate({ids:[t]}),unassignPending:R.isPending})]}),e.jsx(ja,{esc:s,schema:I,envelope:Ie,payload:z,resolver:ss,triage:ts??null,hasAI:mt,claimed:Ae,claimedByMe:Z,isTerminal:ee,isBuilder:de,traceUrl:Ne,open:Q,noGutter:ze,formErrors:Ut,activePanel:Ht,onPanelChange:me}),e.jsx(Ms,{open:A,onClose:()=>F(!1),selectedCount:1,selectedRoles:s?[s.role]:[],onSubmit:(i,m)=>W.mutate({ids:[t],targetUserId:i,durationMinutes:m,reassign:!0},{onSuccess:()=>F(!1)}),isPending:W.isPending}),e.jsx(Ds,{open:S,onClose:()=>P(!1),onConfirm:os,isPending:L.isPending,error:L.error,actionLabel:typeof J.cancel=="string"?J.cancel:void 0}),e.jsx(ua,{escalationId:t}),e.jsx(Ga,{open:!!Y,verb:(Y==null?void 0:Y.verb)??"submit",claimantId:s.assigned_to,wrongBadgeName:o&&o.actorId!==s.assigned_to?o.displayName:null,onCancel:()=>Ue(null)}),e.jsx(Ha,{open:!!U||Gt,message:(U==null?void 0:U.message)??((vt=Tt(I))==null?void 0:vt.message)??"Starting…"}),Z&&!ee&&s.assigned_until&&e.jsx(Ca,{open:Xt.expiringSoon&&s.assigned_until!==Qt,assignedUntil:s.assigned_until,onClose:()=>Kt(s.assigned_until??null),onExtend:Ge,isPending:y.isPending})]})}export{jn as EscalationDetailPage};
|
|
3
|
-
//# sourceMappingURL=index-SGyrXGp8.js.map
|