@hotmeshio/long-tail 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/roles.d.ts +4 -0
- package/build/api/roles.js +7 -1
- package/build/lib/db/schemas/019_role_priority.sql +28 -0
- package/build/routes/roles.js +1 -1
- package/build/scripts/ortho-populate.d.ts +7 -1
- package/build/scripts/ortho-populate.js +21 -6
- package/build/services/escalation/facet-sql.d.ts +1 -0
- package/build/services/escalation/facet-sql.js +7 -6
- package/build/services/escalation/queries.js +27 -5
- package/build/services/escalation/sql.d.ts +19 -2
- package/build/services/escalation/sql.js +32 -9
- package/build/services/escalation/types.d.ts +7 -1
- package/build/services/role/index.js +2 -0
- package/build/services/role/sql.d.ts +4 -4
- package/build/services/role/sql.js +12 -6
- package/build/services/role/types.d.ts +14 -0
- package/build/system/mcp-servers/admin/schemas.d.ts +6 -0
- package/build/system/mcp-servers/admin/schemas.js +3 -0
- package/build/system/mcp-servers/admin/users.js +4 -1
- package/build/system/seed/tool-manifests-admin.d.ts +152 -0
- package/build/system/seed/tool-manifests-admin.js +1 -1
- package/dashboard/dist/assets/{AdminDashboard-C9eE1VEp.js → AdminDashboard-Bgomc_jH.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-C9eE1VEp.js.map → AdminDashboard-Bgomc_jH.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-Ba8QfXM2.js → AgentConfigPage-C6gDgz21.js} +6 -6
- package/dashboard/dist/assets/{AgentConfigPage-Ba8QfXM2.js.map → AgentConfigPage-C6gDgz21.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-DVmec0CP.js → AgentDetailPage-0rrH5FmV.js} +4 -4
- package/dashboard/dist/assets/{AgentDetailPage-DVmec0CP.js.map → AgentDetailPage-0rrH5FmV.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-DNiCYMh3.js → AgentsPage-DkIU2zed.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-DNiCYMh3.js.map → AgentsPage-DkIU2zed.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-gDIF8ocC.js → AvailableEscalationsPage-C9DAtNGp.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-gDIF8ocC.js.map → AvailableEscalationsPage-C9DAtNGp.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-3wBcBavT.js → BotPicker-MnI3OyE7.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-3wBcBavT.js.map → BotPicker-MnI3OyE7.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-WoPkND2y.js → CapabilitiesPage-Cv_AD_5i.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-WoPkND2y.js.map → CapabilitiesPage-Cv_AD_5i.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-Cx99mqNN.js → CollapsibleSection-Ne-Q3QFM.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-Cx99mqNN.js.map → CollapsibleSection-Ne-Q3QFM.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-DbNaoPbF.js → CredentialsPage-B3Mfwl22.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-DbNaoPbF.js.map → CredentialsPage-B3Mfwl22.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-DLW4_Zg4.js → CronLabel-CtjUBRPo.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-DLW4_Zg4.js.map → CronLabel-CtjUBRPo.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-BRUFjkiu.js → CustomDurationPicker-Cp1fgzPX.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-BRUFjkiu.js.map → CustomDurationPicker-Cp1fgzPX.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-DEX0BBqt.js → DropZone-CZDmNBn-.js} +2 -2
- package/dashboard/dist/assets/{DropZone-DEX0BBqt.js.map → DropZone-CZDmNBn-.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-BtmDQaym.js → ElapsedCell-Gr5UlUbn.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-BtmDQaym.js.map → ElapsedCell-Gr5UlUbn.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-Bm4yBEGN.js → EscalationSchemaPage-C5tuV6SJ.js} +2 -2
- package/dashboard/dist/assets/{EscalationSchemaPage-Bm4yBEGN.js.map → EscalationSchemaPage-C5tuV6SJ.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-B3xZwTQA.js → EscalationsOverview-BIZVnSBF.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-B3xZwTQA.js.map → EscalationsOverview-BIZVnSBF.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-Bh9FKXLI.js → EventTable-90aUfsNr.js} +2 -2
- package/dashboard/dist/assets/{EventTable-Bh9FKXLI.js.map → EventTable-90aUfsNr.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-ov_ANlaE.js → GraphInvokePage-Io5ZucT8.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-ov_ANlaE.js.map → GraphInvokePage-Io5ZucT8.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-D0DV6izb.js → HomePage-Cu0vUzTF.js} +2 -2
- package/dashboard/dist/assets/{HomePage-D0DV6izb.js.map → HomePage-Cu0vUzTF.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-FpcvqNkN.js → ListToolbar-CdmIvEIF.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-FpcvqNkN.js.map → ListToolbar-CdmIvEIF.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-DcuRiAff.js → McpOverview-C-Ypezuv.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-DcuRiAff.js.map → McpOverview-C-Ypezuv.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-BcYl67KP.js → McpQueryDetailPage-DdontKcj.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-BcYl67KP.js.map → McpQueryDetailPage-DdontKcj.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-C3GDzqZM.js → McpQueryPage-D-1TaOGG.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-C3GDzqZM.js.map → McpQueryPage-D-1TaOGG.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-SzOyhDBW.js → McpRunDetailPage-B1sCxKLD.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-SzOyhDBW.js.map → McpRunDetailPage-B1sCxKLD.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-BwgB6mRV.js → McpRunsPage-eWJ7cDa3.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-BwgB6mRV.js.map → McpRunsPage-eWJ7cDa3.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-CwKdoyRM.js → NamespacePill-DlqBTvFR.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-CwKdoyRM.js.map → NamespacePill-DlqBTvFR.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-C5phWL0O.js +2 -0
- package/dashboard/dist/assets/OperationsPage-C5phWL0O.js.map +1 -0
- package/dashboard/dist/assets/{OperatorDashboard-DSXh-yYw.js → OperatorDashboard-YP6kP-f_.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-DSXh-yYw.js.map → OperatorDashboard-YP6kP-f_.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-BhaWTWcM.js → PageHeader-CFta2VaS.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-BhaWTWcM.js.map → PageHeader-CFta2VaS.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-yex5WmHB.js → PageHeaderWithStats-CcVAji-7.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-yex5WmHB.js.map → PageHeaderWithStats-CcVAji-7.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-iIB1rwEt.js → ProcessDetailPage-C_BXQvBs.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-iIB1rwEt.js.map → ProcessDetailPage-C_BXQvBs.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-BrqWR2zr.js → ProcessesListPage-BNhFwTLl.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-BrqWR2zr.js.map → ProcessesListPage-BNhFwTLl.js.map} +1 -1
- package/dashboard/dist/assets/RoleDetailPage-8GLNjj9I.js +11 -0
- package/dashboard/dist/assets/RoleDetailPage-8GLNjj9I.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-Cl71eDUA.js → RolePill-CXEyPMqb.js} +2 -2
- package/dashboard/dist/assets/{RolePill-Cl71eDUA.js.map → RolePill-CXEyPMqb.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-Bzp9FhAl.js → RolesPage-B59tE2lZ.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-Bzp9FhAl.js.map → RolesPage-B59tE2lZ.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-DXbHRxQs.js → RunAsSelector-CokM3Ifp.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-DXbHRxQs.js.map → RunAsSelector-CokM3Ifp.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-D8XuMSWD.js → StickyPagination-_H2j2CAH.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-D8XuMSWD.js.map → StickyPagination-_H2j2CAH.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-D5v95pmz.js → StreamMessageDetail-sSfHDYIa.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-D5v95pmz.js.map → StreamMessageDetail-sSfHDYIa.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-CUEf2R5R.js → SwimlaneTimeline-LZWtfBK3.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-CUEf2R5R.js.map → SwimlaneTimeline-LZWtfBK3.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-B_WQiuer.js → TagInput-CQg-TrV9.js} +2 -2
- package/dashboard/dist/assets/{TagInput-B_WQiuer.js.map → TagInput-CQg-TrV9.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-BJvKNwEe.js → TaskDetailPage-CHBV2V6R.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-BJvKNwEe.js.map → TaskDetailPage-CHBV2V6R.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-Lgn2obNU.js → TaskQueuePill-DyvtL8X4.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-Lgn2obNU.js.map → TaskQueuePill-DyvtL8X4.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-CM7BWh_h.js → TasksListPage-B71FxvrY.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-CM7BWh_h.js.map → TasksListPage-B71FxvrY.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-D1K7xKq5.js → TimeAgo-JgT0U_sd.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-D1K7xKq5.js.map → TimeAgo-JgT0U_sd.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-7G0echgP.js → TimestampCell-gEreK8Nn.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-7G0echgP.js.map → TimestampCell-gEreK8Nn.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-uVqcbHPE.js → ToolPill-miuRcj1Q.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-uVqcbHPE.js.map → ToolPill-miuRcj1Q.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-LxuJvURK.js → ToolTestPanel-ChfHw9Aq.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-LxuJvURK.js.map → ToolTestPanel-ChfHw9Aq.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-JvAX6rrR.js → TopicDetailPage-DigI0HGt.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-JvAX6rrR.js.map → TopicDetailPage-DigI0HGt.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-tFT2AcTz.js → TopicsPage-BHjlFpPN.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-tFT2AcTz.js.map → TopicsPage-BHjlFpPN.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-Djz0nmaZ.js → UserName-uncbaKYf.js} +2 -2
- package/dashboard/dist/assets/{UserName-Djz0nmaZ.js.map → UserName-uncbaKYf.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-f53hilbI.js → WorkflowExecutionPage-DwzLKTkt.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-f53hilbI.js.map → WorkflowExecutionPage-DwzLKTkt.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-IDjTRfQ8.js → WorkflowPill-BegV-iRF.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-IDjTRfQ8.js.map → WorkflowPill-BegV-iRF.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-DM9Xe665.js → WorkflowsDashboard-rpnGhGnl.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-DM9Xe665.js.map → WorkflowsDashboard-rpnGhGnl.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-CUGSrx9N.js → WorkflowsOverview-ihhW8DiS.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-CUGSrx9N.js.map → WorkflowsOverview-ihhW8DiS.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-B1_yqxAw.js → YamlWorkflowDetailPage-C61-8y-E.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-B1_yqxAw.js.map → YamlWorkflowDetailPage-C61-8y-E.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-NtGvqiu7.js → YamlWorkflowsPage-CMpgsLEo.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-NtGvqiu7.js.map → YamlWorkflowsPage-CMpgsLEo.js.map} +1 -1
- package/dashboard/dist/assets/{agents-tML6AjDj.js → agents-27sErp5R.js} +2 -2
- package/dashboard/dist/assets/{agents-tML6AjDj.js.map → agents-27sErp5R.js.map} +1 -1
- package/dashboard/dist/assets/{bots-Cb0WTwhY.js → bots-CPHuAvjW.js} +2 -2
- package/dashboard/dist/assets/{bots-Cb0WTwhY.js.map → bots-CPHuAvjW.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-BGZogsi_.js → capabilities-BBTPqF-V.js} +2 -2
- package/dashboard/dist/assets/{capabilities-BGZogsi_.js.map → capabilities-BBTPqF-V.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-B7VJTlZD.js → controlplane-C9j2mwX8.js} +2 -2
- package/dashboard/dist/assets/{controlplane-B7VJTlZD.js.map → controlplane-C9j2mwX8.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-Bl-SQV_u.js → escalation-CyJ_wz-f.js} +2 -2
- package/dashboard/dist/assets/{escalation-Bl-SQV_u.js.map → escalation-CyJ_wz-f.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-BlJOswRx.js → escalation-columns-DU4Jyxxo.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-BlJOswRx.js.map → escalation-columns-DU4Jyxxo.js.map} +1 -1
- package/dashboard/dist/assets/{index-e97M6GoI.js → index-BBQggGcf.js} +2 -2
- package/dashboard/dist/assets/{index-e97M6GoI.js.map → index-BBQggGcf.js.map} +1 -1
- package/dashboard/dist/assets/{index-D0-8byNu.js → index-BHS-ubrT.js} +2 -2
- package/dashboard/dist/assets/{index-D0-8byNu.js.map → index-BHS-ubrT.js.map} +1 -1
- package/dashboard/dist/assets/{index-DcbEIXit.js → index-BVHXREYZ.js} +2 -2
- package/dashboard/dist/assets/{index-DcbEIXit.js.map → index-BVHXREYZ.js.map} +1 -1
- package/dashboard/dist/assets/{index-Il_g7kw5.js → index-BiLZJ43R.js} +2 -2
- package/dashboard/dist/assets/{index-Il_g7kw5.js.map → index-BiLZJ43R.js.map} +1 -1
- package/dashboard/dist/assets/{index-Dgw1KKpq.js → index-BoZydcaW.js} +4 -4
- package/dashboard/dist/assets/{index-Dgw1KKpq.js.map → index-BoZydcaW.js.map} +1 -1
- package/dashboard/dist/assets/{index-CBv3UxF2.js → index-CCHGKErT.js} +2 -2
- package/dashboard/dist/assets/{index-CBv3UxF2.js.map → index-CCHGKErT.js.map} +1 -1
- package/dashboard/dist/assets/{index-0o71lRuY.js → index-CNprOGuS.js} +2 -2
- package/dashboard/dist/assets/{index-0o71lRuY.js.map → index-CNprOGuS.js.map} +1 -1
- package/dashboard/dist/assets/{index-Wny0bRgq.css → index-CZ6-l8_0.css} +1 -1
- package/dashboard/dist/assets/{index-3A_5CL81.js → index-CgeFUhUr.js} +2 -2
- package/dashboard/dist/assets/{index-3A_5CL81.js.map → index-CgeFUhUr.js.map} +1 -1
- package/dashboard/dist/assets/{index-TiKh2Ctj.js → index-ChniBGqD.js} +2 -2
- package/dashboard/dist/assets/{index-TiKh2Ctj.js.map → index-ChniBGqD.js.map} +1 -1
- package/dashboard/dist/assets/{index--WeZDfeN.js → index-CjXzZ19T.js} +2 -2
- package/dashboard/dist/assets/{index--WeZDfeN.js.map → index-CjXzZ19T.js.map} +1 -1
- package/dashboard/dist/assets/{index-DfDfJivY.js → index-D9pi0fs6.js} +2 -2
- package/dashboard/dist/assets/{index-DfDfJivY.js.map → index-D9pi0fs6.js.map} +1 -1
- package/dashboard/dist/assets/{index-SCrD3l-K.js → index-DoivEaUZ.js} +2 -2
- package/dashboard/dist/assets/{index-SCrD3l-K.js.map → index-DoivEaUZ.js.map} +1 -1
- package/dashboard/dist/assets/{index-BorpZbZA.js → index-Dzqt3g-K.js} +2 -2
- package/dashboard/dist/assets/{index-BorpZbZA.js.map → index-Dzqt3g-K.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-CDzw4E6q.js → knowledge-BErJA3Je.js} +2 -2
- package/dashboard/dist/assets/{knowledge-CDzw4E6q.js.map → knowledge-BErJA3Je.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-D_-NQtnG.js → mcp-Cx9L42EN.js} +2 -2
- package/dashboard/dist/assets/{mcp-D_-NQtnG.js.map → mcp-Cx9L42EN.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-BqZXdf9A.js → mcp-query-Cf6kcBoW.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-BqZXdf9A.js.map → mcp-query-Cf6kcBoW.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-CNLhgj8b.js → pipelines-CFctrv71.js} +2 -2
- package/dashboard/dist/assets/{pipelines-CNLhgj8b.js.map → pipelines-CFctrv71.js.map} +1 -1
- package/dashboard/dist/assets/{roles-CFD2eYap.js → roles-CCXZtqDr.js} +2 -2
- package/dashboard/dist/assets/roles-CCXZtqDr.js.map +1 -0
- package/dashboard/dist/assets/{tasks-DcSvF636.js → tasks-BPNj8ZWL.js} +2 -2
- package/dashboard/dist/assets/{tasks-DcSvF636.js.map → tasks-BPNj8ZWL.js.map} +1 -1
- package/dashboard/dist/assets/{topics-DI8TFSZv.js → topics-CR4UBuSV.js} +2 -2
- package/dashboard/dist/assets/{topics-DI8TFSZv.js.map → topics-CR4UBuSV.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-DcIgMDh3.js → useEventHooks-BgdnN8Rj.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-DcIgMDh3.js.map → useEventHooks-BgdnN8Rj.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-C88ZxGoX.js → useNamespace-BDsKfT0f.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-C88ZxGoX.js.map → useNamespace-BDsKfT0f.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-D2-yVjJ7.js → useYamlActivityEvents-CWZwHIlR.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-D2-yVjJ7.js.map → useYamlActivityEvents-CWZwHIlR.js.map} +1 -1
- package/dashboard/dist/assets/{users-C0WV36X8.js → users-BqmKVXR1.js} +2 -2
- package/dashboard/dist/assets/{users-C0WV36X8.js.map → users-BqmKVXR1.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-CEWCGPeJ.js → vendor-icons-BaQqUm-e.js} +2 -2
- package/dashboard/dist/assets/{vendor-icons-CEWCGPeJ.js.map → vendor-icons-BaQqUm-e.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-CkPv7xk-.js → workflows-Dps45zjk.js} +2 -2
- package/dashboard/dist/assets/{workflows-CkPv7xk-.js.map → workflows-Dps45zjk.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-BjrMQLTK.js → yaml-workflows-DhlTkbvY.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-BjrMQLTK.js.map → yaml-workflows-DhlTkbvY.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/api/http/escalations.md +3 -3
- package/docs/api/http/roles.md +6 -0
- package/docs/api/mcp/admin.md +2 -0
- package/docs/api/sdk/escalations.md +2 -2
- package/docs/api/sdk/roles.md +7 -1
- package/docs/dashboard.md +5 -4
- package/docs/data.md +2 -0
- package/docs/operations.md +16 -3
- package/package.json +1 -1
- package/dashboard/dist/assets/OperationsPage-BCr21p8I.js +0 -2
- package/dashboard/dist/assets/OperationsPage-BCr21p8I.js.map +0 -1
- package/dashboard/dist/assets/RoleDetailPage-DS37tJhq.js +0 -11
- package/dashboard/dist/assets/RoleDetailPage-DS37tJhq.js.map +0 -1
- package/dashboard/dist/assets/roles-CFD2eYap.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as k,u as R,b as O,j as e,a as d}from"./vendor-query-B2UbickB.js";import{P as F}from"./PageHeader-BhaWTWcM.js";import{d as b}from"./index-Dgw1KKpq.js";import{M}from"./Modal-CSrxpXeM.js";import{R as g,C}from"./constants-BHkpVaqx.js";import{at as E,am as T,ad as W,a9 as j,p as I,a6 as D}from"./vendor-icons-CEWCGPeJ.js";import"./vendor-react-CXumBFUA.js";function $(){return R({queryKey:["maintenance"],queryFn:()=>b("/config/maintenance")})}function _(){const t=O();return k({mutationFn:r=>b("/config/maintenance",{method:"PUT",body:JSON.stringify(r)}),onSuccess:()=>{t.invalidateQueries({queryKey:["maintenance"]})}})}function q(){return k({mutationFn:t=>b("/dba/prune",{method:"POST",body:JSON.stringify(t)})})}function v({checked:t,onToggle:r,label:a,hint:s,safety:i,value:l,onChange:c}){const n=i==="safe"?W:i==="moderate"?E:T,o=i==="safe"?"text-status-success":i==="moderate"?"text-status-warning":"text-status-error",m=i==="safe"?"Safe":i==="moderate"?"Careful":"Permanent";return e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer w-80 shrink-0",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:x=>r(x.target.checked),className:"w-4 h-4 rounded border-border accent-accent shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-text-primary",children:a}),e.jsxs("span",{className:`flex items-center gap-0.5 text-[9px] ${o}`,children:[e.jsx(n,{className:"w-3 h-3",strokeWidth:1.5}),m]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:s})]})]}),e.jsx("select",{value:l,onChange:x=>c(x.target.value),disabled:!t,className:`select text-xs w-36 transition-opacity ${t?"":"opacity-40 cursor-not-allowed"}`,children:g.map(x=>e.jsx("option",{value:x.value,children:x.label},x.value))})]})}function L(){return e.jsxs("div",{className:"flex items-start gap-2 mt-2 px-3 py-2 rounded bg-surface-sunken",children:[e.jsx(j,{className:"w-3.5 h-3.5 text-text-tertiary shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[10px] text-text-tertiary leading-relaxed",children:"Stripping preserves workflow results and timeline data needed for the execution detail view. Transient jobs are internal bookkeeping that accumulates over time."})]})}const f={pruneJobs:!0,expire:"30 days",engineStreams:!0,engineStreamsExpire:"1 day",workerStreams:!0,workerStreamsExpire:"90 days",stripAttributes:!1,pruneTransient:!1};function N(t){return t.pruneJobs||t.engineStreams||t.workerStreams||t.stripAttributes||t.pruneTransient}function P({fields:t,onChange:r}){const a=(s,i)=>r({...t,[s]:i});return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Stream Messages"}),e.jsx("p",{className:"text-[10px] text-text-tertiary mb-4",children:"Processed routing messages. Already consumed — safe to remove after a short retention window."}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(v,{checked:t.engineStreams,onToggle:s=>a("engineStreams",s),label:"Engine messages",hint:"Internal orchestration signals",safety:"safe",value:t.engineStreamsExpire,onChange:s=>a("engineStreamsExpire",s)}),e.jsx(v,{checked:t.workerStreams,onToggle:s=>a("workerStreams",s),label:"Worker messages",hint:"Activity dispatch and response payloads",safety:"safe",value:t.workerStreamsExpire,onChange:s=>a("workerStreamsExpire",s)})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Completed Workflows"}),e.jsx("p",{className:"text-[10px] text-text-tertiary mb-4",children:"Choose how to handle completed workflow records. Reducing strips step-level detail but keeps the workflow and its results. Deleting removes the record entirely."}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"workflow-cleanup",checked:!t.stripAttributes&&!t.pruneJobs,onChange:()=>r({...t,stripAttributes:!1,pruneJobs:!1}),className:"w-4 h-4 mt-0.5 accent-accent shrink-0"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-text-primary",children:"Keep as-is"}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:"No changes to completed workflow records."})]})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer w-80 shrink-0",children:[e.jsx("input",{type:"radio",name:"workflow-cleanup",checked:t.stripAttributes&&!t.pruneJobs,onChange:()=>r({...t,stripAttributes:!0,pruneJobs:!1}),className:"w-4 h-4 mt-0.5 accent-accent shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-text-primary",children:"Reduce completed workflows"}),e.jsxs("span",{className:"flex items-center gap-0.5 text-[9px] text-status-warning",children:[e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5}),"Careful"]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:"Strips step-level execution detail (activity inputs/outputs, internal state). Workflow results and timeline are preserved."})]})]}),e.jsx("select",{value:t.expire,onChange:s=>a("expire",s.target.value),disabled:!t.stripAttributes||t.pruneJobs,className:`select text-xs w-36 transition-opacity mt-0.5 ${!t.stripAttributes||t.pruneJobs?"opacity-40 cursor-not-allowed":""}`,children:g.map(s=>e.jsx("option",{value:s.value,children:s.label},s.value))})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer w-80 shrink-0",children:[e.jsx("input",{type:"radio",name:"workflow-cleanup",checked:t.pruneJobs,onChange:()=>r({...t,pruneJobs:!0,stripAttributes:!1}),className:"w-4 h-4 mt-0.5 accent-accent shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-text-primary",children:"Delete completed workflows"}),e.jsxs("span",{className:"flex items-center gap-0.5 text-[9px] text-status-error",children:[e.jsx(T,{className:"w-3 h-3",strokeWidth:1.5}),"Permanent"]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:"Permanently removes workflow records. Results, timeline, and all execution data are deleted and cannot be recovered."})]})]}),e.jsx("select",{value:t.expire,onChange:s=>a("expire",s.target.value),disabled:!t.pruneJobs,className:`select text-xs w-36 transition-opacity mt-0.5 ${t.pruneJobs?"":"opacity-40 cursor-not-allowed"}`,children:g.map(s=>e.jsx("option",{value:s.value,children:s.label},s.value))})]})]}),e.jsx(L,{})]})]})}function p({label:t,value:r}){return e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-light text-text-primary",children:r.toLocaleString()}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:t})]})}function U(){const t=q(),[r,a]=d.useState(f),[s,i]=d.useState(null),[l,c]=d.useState(!1),n=()=>{i(null),t.mutate({expire:r.expire,jobs:r.pruneJobs,engineStreams:r.engineStreams,engineStreamsExpire:r.engineStreamsExpire,workerStreams:r.workerStreams,workerStreamsExpire:r.workerStreamsExpire,attributes:r.stripAttributes,pruneTransient:r.pruneTransient},{onSuccess:o=>{i(o),c(!1)}})};return e.jsxs("div",{className:"space-y-8",children:[e.jsx(P,{fields:r,onChange:a}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-surface-border",children:[e.jsx("p",{className:"text-[10px] text-text-tertiary",children:N(r)?"This action permanently deletes data and cannot be undone.":"Select at least one operation to enable pruning."}),e.jsx("button",{onClick:()=>c(!0),disabled:!N(r)||t.isPending,className:"bg-status-error text-white px-4 py-1.5 rounded-md text-xs hover:opacity-90 transition-opacity disabled:opacity-40 shrink-0",children:t.isPending?"Pruning...":"Prune Now"})]}),s&&e.jsxs("div",{className:"bg-surface-sunken rounded-md px-4 py-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Results"}),e.jsxs("div",{className:"flex flex-wrap gap-6",children:[s.jobs!=null&&s.jobs>0&&e.jsx(p,{label:"Jobs deleted",value:s.jobs}),s.engineStreams!=null&&s.engineStreams>0&&e.jsx(p,{label:"Engine streams",value:s.engineStreams}),s.workerStreams!=null&&s.workerStreams>0&&e.jsx(p,{label:"Worker streams",value:s.workerStreams}),s.streams!=null&&s.engineStreams==null&&s.streams>0&&e.jsx(p,{label:"Streams",value:s.streams}),s.attributes!=null&&s.attributes>0&&e.jsx(p,{label:"Artifacts stripped",value:s.attributes}),s.transient!=null&&s.transient>0&&e.jsx(p,{label:"Transient deleted",value:s.transient}),s.marked!=null&&s.marked>0&&e.jsx(p,{label:"Marked pruned",value:s.marked}),Object.values(s).every(o=>!o||o===0)&&e.jsx("p",{className:"text-xs text-text-tertiary",children:"Nothing to prune within the selected retention windows."})]})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsx(M,{open:l,onClose:()=>c(!1),title:"Confirm Prune",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-text-secondary",children:"This will permanently delete data. This action cannot be undone."}),e.jsxs("ul",{className:"text-xs text-text-secondary space-y-1 list-disc list-inside",children:[r.pruneJobs&&e.jsxs("li",{children:["Delete jobs older than ",r.expire]}),r.engineStreams&&e.jsxs("li",{children:["Delete engine streams older than ",r.engineStreamsExpire]}),r.workerStreams&&e.jsxs("li",{children:["Delete worker streams older than ",r.workerStreamsExpire]}),r.stripAttributes&&e.jsx("li",{children:"Strip execution artifacts from completed jobs"}),r.pruneTransient&&e.jsx("li",{children:"Delete transient (entity-less) jobs"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:()=>c(!1),className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:n,className:"bg-status-error text-white px-3 py-1.5 rounded-md text-xs hover:opacity-90 transition-opacity",disabled:t.isPending,children:t.isPending?"Pruning...":"Confirm Prune"})]})]})})]})}function w(t){var c;if(!((c=t==null?void 0:t.rules)!=null&&c.length))return f;const r=t.rules,a=r.find(n=>n.target==="streams"&&n.action==="delete"),s=r.find(n=>n.target==="jobs"&&n.action==="delete"&&n.hasEntity===!1),i=r.find(n=>n.target==="jobs"&&n.action==="prune"&&n.hasEntity===!0),l=r.find(n=>n.target==="jobs"&&n.action==="delete"&&n.pruned===!0);return{pruneJobs:!!l,expire:(l==null?void 0:l.olderThan)??"180 days",engineStreams:!!a,engineStreamsExpire:(a==null?void 0:a.olderThan)??"1 day",workerStreams:!!a,workerStreamsExpire:(a==null?void 0:a.olderThan)??"90 days",stripAttributes:!!i,pruneTransient:!!s}}function H(t){const r=[];return t.engineStreams&&r.push({target:"streams",action:"delete",olderThan:t.engineStreamsExpire}),t.workerStreams&&t.workerStreamsExpire!==t.engineStreamsExpire&&r.push({target:"streams",action:"delete",olderThan:t.workerStreamsExpire}),t.pruneTransient&&r.push({target:"jobs",action:"delete",olderThan:t.expire,hasEntity:!1}),t.stripAttributes&&r.push({target:"jobs",action:"prune",olderThan:t.expire,hasEntity:!0}),t.pruneJobs&&r.push({target:"jobs",action:"delete",olderThan:t.expire,pruned:!0}),r}function S(t){var r;return((r=C.find(a=>a.value===t))==null?void 0:r.label)??""}function K(){const{data:t,isLoading:r}=$(),a=_(),[s,i]=d.useState(""),[l,c]=d.useState(f),[n,o]=d.useState(""),m=d.useCallback(()=>{t!=null&&t.config&&(i(t.config.schedule),c(w(t.config)),o(JSON.stringify({schedule:t.config.schedule,fields:w(t.config)})))},[t]);d.useEffect(()=>{m()},[m]);const x=JSON.stringify({schedule:s,fields:l}),y=n!==""&&x!==n,h=(t==null?void 0:t.active)??!1,J=()=>{const u=H(l);a.mutate({schedule:s,rules:u},{onSuccess:()=>{o(JSON.stringify({schedule:s,fields:l}))}})},A=()=>{m()};return r?e.jsx("div",{className:"animate-pulse h-40 bg-surface-sunken rounded"}):e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_auto] gap-10",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4",children:"Schedule"}),e.jsxs("div",{className:"flex items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] text-text-tertiary mb-1",children:"Cron Expression"}),e.jsx("input",{type:"text",value:s,onChange:u=>i(u.target.value),placeholder:"0 2 * * *",className:"input text-xs font-mono w-48"})]}),e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-1.5 h-8",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${h?"bg-status-success":"bg-text-tertiary"}`}),e.jsx("span",{className:`text-xs ${h?"text-status-success":"text-text-tertiary"}`,children:h?"Active":"Inactive"})]})}),S(s)&&e.jsx("p",{className:"text-xs text-text-tertiary h-8 flex items-center",children:S(s)})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:C.map(u=>e.jsx("button",{type:"button",onClick:()=>i(u.value),className:`px-2.5 py-1 text-[10px] rounded-full transition-colors ${s===u.value?"bg-accent/10 text-accent font-medium":"bg-surface-sunken text-text-tertiary hover:text-text-secondary"}`,children:u.label},u.value))})]}),e.jsxs("div",{className:"lg:w-72",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4",children:"How It Works"}),e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded bg-surface-sunken",children:[e.jsx(j,{className:"w-3.5 h-3.5 text-text-tertiary shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[10px] text-text-tertiary leading-relaxed",children:"Rules execute sequentially on each cron cycle. Engine streams can be pruned aggressively since they only contain internal routing data. Worker streams should be retained longer to preserve execution playback and input enrichment."})]})]})]}),e.jsx(P,{fields:l,onChange:c}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y&&e.jsx("button",{onClick:A,className:"text-[10px] text-text-tertiary hover:text-text-primary transition-colors",children:"Revert changes"}),a.error&&e.jsx("p",{className:"text-xs text-status-error",children:a.error.message})]}),e.jsx("button",{onClick:J,disabled:!y||!s.trim()||a.isPending,className:"btn-primary text-xs disabled:opacity-40 shrink-0",children:a.isPending?"Saving...":"Save Schedule"})]})]})}function Q({mode:t,onChange:r}){const a=(s,i,l)=>e.jsxs("button",{onClick:()=>r(s),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors ${t===s?"bg-accent/10 text-accent font-medium":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[i,l]});return e.jsxs("div",{className:"flex gap-1 p-0.5 bg-surface-sunken rounded-lg w-fit",children:[a("prune",e.jsx(I,{className:"w-3.5 h-3.5"}),"Prune Now"),a("schedule",e.jsx(D,{className:"w-3.5 h-3.5"}),"Schedule")]})}function ee(){const[t,r]=d.useState("schedule");return e.jsxs("div",{children:[e.jsx(F,{title:"DB Maintenance",docsHash:"#docs:dashboard.md:db-maintenance",actions:e.jsx(Q,{mode:t,onChange:r})}),e.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 mb-8 rounded-md bg-accent/5 border border-accent/10",children:[e.jsx(j,{className:"w-4 h-4 text-accent shrink-0 mt-0.5"}),e.jsx("p",{className:"text-xs text-text-secondary leading-relaxed",children:"Workflow data grows as jobs complete. Operations are ordered safest-first: stream messages are always safe to prune, workflow reduction preserves results, and deletion is permanent."})]}),t==="prune"?e.jsx(U,{}):e.jsx(K,{})]})}export{ee as MaintenancePage};
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{c as k,u as R,b as O,j as e,a as d}from"./vendor-query-B2UbickB.js";import{P as F}from"./PageHeader-CFta2VaS.js";import{d as b}from"./index-BoZydcaW.js";import{M}from"./Modal-CSrxpXeM.js";import{R as g,C}from"./constants-BHkpVaqx.js";import{at as E,am as T,ad as W,a9 as j,p as I,a6 as D}from"./vendor-icons-BaQqUm-e.js";import"./vendor-react-CXumBFUA.js";function $(){return R({queryKey:["maintenance"],queryFn:()=>b("/config/maintenance")})}function _(){const t=O();return k({mutationFn:r=>b("/config/maintenance",{method:"PUT",body:JSON.stringify(r)}),onSuccess:()=>{t.invalidateQueries({queryKey:["maintenance"]})}})}function q(){return k({mutationFn:t=>b("/dba/prune",{method:"POST",body:JSON.stringify(t)})})}function v({checked:t,onToggle:r,label:a,hint:s,safety:i,value:l,onChange:c}){const n=i==="safe"?W:i==="moderate"?E:T,o=i==="safe"?"text-status-success":i==="moderate"?"text-status-warning":"text-status-error",m=i==="safe"?"Safe":i==="moderate"?"Careful":"Permanent";return e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer w-80 shrink-0",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:x=>r(x.target.checked),className:"w-4 h-4 rounded border-border accent-accent shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-text-primary",children:a}),e.jsxs("span",{className:`flex items-center gap-0.5 text-[9px] ${o}`,children:[e.jsx(n,{className:"w-3 h-3",strokeWidth:1.5}),m]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:s})]})]}),e.jsx("select",{value:l,onChange:x=>c(x.target.value),disabled:!t,className:`select text-xs w-36 transition-opacity ${t?"":"opacity-40 cursor-not-allowed"}`,children:g.map(x=>e.jsx("option",{value:x.value,children:x.label},x.value))})]})}function L(){return e.jsxs("div",{className:"flex items-start gap-2 mt-2 px-3 py-2 rounded bg-surface-sunken",children:[e.jsx(j,{className:"w-3.5 h-3.5 text-text-tertiary shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[10px] text-text-tertiary leading-relaxed",children:"Stripping preserves workflow results and timeline data needed for the execution detail view. Transient jobs are internal bookkeeping that accumulates over time."})]})}const f={pruneJobs:!0,expire:"30 days",engineStreams:!0,engineStreamsExpire:"1 day",workerStreams:!0,workerStreamsExpire:"90 days",stripAttributes:!1,pruneTransient:!1};function N(t){return t.pruneJobs||t.engineStreams||t.workerStreams||t.stripAttributes||t.pruneTransient}function P({fields:t,onChange:r}){const a=(s,i)=>r({...t,[s]:i});return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Stream Messages"}),e.jsx("p",{className:"text-[10px] text-text-tertiary mb-4",children:"Processed routing messages. Already consumed — safe to remove after a short retention window."}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(v,{checked:t.engineStreams,onToggle:s=>a("engineStreams",s),label:"Engine messages",hint:"Internal orchestration signals",safety:"safe",value:t.engineStreamsExpire,onChange:s=>a("engineStreamsExpire",s)}),e.jsx(v,{checked:t.workerStreams,onToggle:s=>a("workerStreams",s),label:"Worker messages",hint:"Activity dispatch and response payloads",safety:"safe",value:t.workerStreamsExpire,onChange:s=>a("workerStreamsExpire",s)})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Completed Workflows"}),e.jsx("p",{className:"text-[10px] text-text-tertiary mb-4",children:"Choose how to handle completed workflow records. Reducing strips step-level detail but keeps the workflow and its results. Deleting removes the record entirely."}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"workflow-cleanup",checked:!t.stripAttributes&&!t.pruneJobs,onChange:()=>r({...t,stripAttributes:!1,pruneJobs:!1}),className:"w-4 h-4 mt-0.5 accent-accent shrink-0"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-text-primary",children:"Keep as-is"}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:"No changes to completed workflow records."})]})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer w-80 shrink-0",children:[e.jsx("input",{type:"radio",name:"workflow-cleanup",checked:t.stripAttributes&&!t.pruneJobs,onChange:()=>r({...t,stripAttributes:!0,pruneJobs:!1}),className:"w-4 h-4 mt-0.5 accent-accent shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-text-primary",children:"Reduce completed workflows"}),e.jsxs("span",{className:"flex items-center gap-0.5 text-[9px] text-status-warning",children:[e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5}),"Careful"]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:"Strips step-level execution detail (activity inputs/outputs, internal state). Workflow results and timeline are preserved."})]})]}),e.jsx("select",{value:t.expire,onChange:s=>a("expire",s.target.value),disabled:!t.stripAttributes||t.pruneJobs,className:`select text-xs w-36 transition-opacity mt-0.5 ${!t.stripAttributes||t.pruneJobs?"opacity-40 cursor-not-allowed":""}`,children:g.map(s=>e.jsx("option",{value:s.value,children:s.label},s.value))})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer w-80 shrink-0",children:[e.jsx("input",{type:"radio",name:"workflow-cleanup",checked:t.pruneJobs,onChange:()=>r({...t,pruneJobs:!0,stripAttributes:!1}),className:"w-4 h-4 mt-0.5 accent-accent shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-text-primary",children:"Delete completed workflows"}),e.jsxs("span",{className:"flex items-center gap-0.5 text-[9px] text-status-error",children:[e.jsx(T,{className:"w-3 h-3",strokeWidth:1.5}),"Permanent"]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:"Permanently removes workflow records. Results, timeline, and all execution data are deleted and cannot be recovered."})]})]}),e.jsx("select",{value:t.expire,onChange:s=>a("expire",s.target.value),disabled:!t.pruneJobs,className:`select text-xs w-36 transition-opacity mt-0.5 ${t.pruneJobs?"":"opacity-40 cursor-not-allowed"}`,children:g.map(s=>e.jsx("option",{value:s.value,children:s.label},s.value))})]})]}),e.jsx(L,{})]})]})}function p({label:t,value:r}){return e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-light text-text-primary",children:r.toLocaleString()}),e.jsx("p",{className:"text-[10px] text-text-tertiary",children:t})]})}function U(){const t=q(),[r,a]=d.useState(f),[s,i]=d.useState(null),[l,c]=d.useState(!1),n=()=>{i(null),t.mutate({expire:r.expire,jobs:r.pruneJobs,engineStreams:r.engineStreams,engineStreamsExpire:r.engineStreamsExpire,workerStreams:r.workerStreams,workerStreamsExpire:r.workerStreamsExpire,attributes:r.stripAttributes,pruneTransient:r.pruneTransient},{onSuccess:o=>{i(o),c(!1)}})};return e.jsxs("div",{className:"space-y-8",children:[e.jsx(P,{fields:r,onChange:a}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-surface-border",children:[e.jsx("p",{className:"text-[10px] text-text-tertiary",children:N(r)?"This action permanently deletes data and cannot be undone.":"Select at least one operation to enable pruning."}),e.jsx("button",{onClick:()=>c(!0),disabled:!N(r)||t.isPending,className:"bg-status-error text-white px-4 py-1.5 rounded-md text-xs hover:opacity-90 transition-opacity disabled:opacity-40 shrink-0",children:t.isPending?"Pruning...":"Prune Now"})]}),s&&e.jsxs("div",{className:"bg-surface-sunken rounded-md px-4 py-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Results"}),e.jsxs("div",{className:"flex flex-wrap gap-6",children:[s.jobs!=null&&s.jobs>0&&e.jsx(p,{label:"Jobs deleted",value:s.jobs}),s.engineStreams!=null&&s.engineStreams>0&&e.jsx(p,{label:"Engine streams",value:s.engineStreams}),s.workerStreams!=null&&s.workerStreams>0&&e.jsx(p,{label:"Worker streams",value:s.workerStreams}),s.streams!=null&&s.engineStreams==null&&s.streams>0&&e.jsx(p,{label:"Streams",value:s.streams}),s.attributes!=null&&s.attributes>0&&e.jsx(p,{label:"Artifacts stripped",value:s.attributes}),s.transient!=null&&s.transient>0&&e.jsx(p,{label:"Transient deleted",value:s.transient}),s.marked!=null&&s.marked>0&&e.jsx(p,{label:"Marked pruned",value:s.marked}),Object.values(s).every(o=>!o||o===0)&&e.jsx("p",{className:"text-xs text-text-tertiary",children:"Nothing to prune within the selected retention windows."})]})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsx(M,{open:l,onClose:()=>c(!1),title:"Confirm Prune",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-text-secondary",children:"This will permanently delete data. This action cannot be undone."}),e.jsxs("ul",{className:"text-xs text-text-secondary space-y-1 list-disc list-inside",children:[r.pruneJobs&&e.jsxs("li",{children:["Delete jobs older than ",r.expire]}),r.engineStreams&&e.jsxs("li",{children:["Delete engine streams older than ",r.engineStreamsExpire]}),r.workerStreams&&e.jsxs("li",{children:["Delete worker streams older than ",r.workerStreamsExpire]}),r.stripAttributes&&e.jsx("li",{children:"Strip execution artifacts from completed jobs"}),r.pruneTransient&&e.jsx("li",{children:"Delete transient (entity-less) jobs"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:()=>c(!1),className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:n,className:"bg-status-error text-white px-3 py-1.5 rounded-md text-xs hover:opacity-90 transition-opacity",disabled:t.isPending,children:t.isPending?"Pruning...":"Confirm Prune"})]})]})})]})}function w(t){var c;if(!((c=t==null?void 0:t.rules)!=null&&c.length))return f;const r=t.rules,a=r.find(n=>n.target==="streams"&&n.action==="delete"),s=r.find(n=>n.target==="jobs"&&n.action==="delete"&&n.hasEntity===!1),i=r.find(n=>n.target==="jobs"&&n.action==="prune"&&n.hasEntity===!0),l=r.find(n=>n.target==="jobs"&&n.action==="delete"&&n.pruned===!0);return{pruneJobs:!!l,expire:(l==null?void 0:l.olderThan)??"180 days",engineStreams:!!a,engineStreamsExpire:(a==null?void 0:a.olderThan)??"1 day",workerStreams:!!a,workerStreamsExpire:(a==null?void 0:a.olderThan)??"90 days",stripAttributes:!!i,pruneTransient:!!s}}function H(t){const r=[];return t.engineStreams&&r.push({target:"streams",action:"delete",olderThan:t.engineStreamsExpire}),t.workerStreams&&t.workerStreamsExpire!==t.engineStreamsExpire&&r.push({target:"streams",action:"delete",olderThan:t.workerStreamsExpire}),t.pruneTransient&&r.push({target:"jobs",action:"delete",olderThan:t.expire,hasEntity:!1}),t.stripAttributes&&r.push({target:"jobs",action:"prune",olderThan:t.expire,hasEntity:!0}),t.pruneJobs&&r.push({target:"jobs",action:"delete",olderThan:t.expire,pruned:!0}),r}function S(t){var r;return((r=C.find(a=>a.value===t))==null?void 0:r.label)??""}function K(){const{data:t,isLoading:r}=$(),a=_(),[s,i]=d.useState(""),[l,c]=d.useState(f),[n,o]=d.useState(""),m=d.useCallback(()=>{t!=null&&t.config&&(i(t.config.schedule),c(w(t.config)),o(JSON.stringify({schedule:t.config.schedule,fields:w(t.config)})))},[t]);d.useEffect(()=>{m()},[m]);const x=JSON.stringify({schedule:s,fields:l}),y=n!==""&&x!==n,h=(t==null?void 0:t.active)??!1,J=()=>{const u=H(l);a.mutate({schedule:s,rules:u},{onSuccess:()=>{o(JSON.stringify({schedule:s,fields:l}))}})},A=()=>{m()};return r?e.jsx("div",{className:"animate-pulse h-40 bg-surface-sunken rounded"}):e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_auto] gap-10",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4",children:"Schedule"}),e.jsxs("div",{className:"flex items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] text-text-tertiary mb-1",children:"Cron Expression"}),e.jsx("input",{type:"text",value:s,onChange:u=>i(u.target.value),placeholder:"0 2 * * *",className:"input text-xs font-mono w-48"})]}),e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-1.5 h-8",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${h?"bg-status-success":"bg-text-tertiary"}`}),e.jsx("span",{className:`text-xs ${h?"text-status-success":"text-text-tertiary"}`,children:h?"Active":"Inactive"})]})}),S(s)&&e.jsx("p",{className:"text-xs text-text-tertiary h-8 flex items-center",children:S(s)})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:C.map(u=>e.jsx("button",{type:"button",onClick:()=>i(u.value),className:`px-2.5 py-1 text-[10px] rounded-full transition-colors ${s===u.value?"bg-accent/10 text-accent font-medium":"bg-surface-sunken text-text-tertiary hover:text-text-secondary"}`,children:u.label},u.value))})]}),e.jsxs("div",{className:"lg:w-72",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4",children:"How It Works"}),e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded bg-surface-sunken",children:[e.jsx(j,{className:"w-3.5 h-3.5 text-text-tertiary shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[10px] text-text-tertiary leading-relaxed",children:"Rules execute sequentially on each cron cycle. Engine streams can be pruned aggressively since they only contain internal routing data. Worker streams should be retained longer to preserve execution playback and input enrichment."})]})]})]}),e.jsx(P,{fields:l,onChange:c}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y&&e.jsx("button",{onClick:A,className:"text-[10px] text-text-tertiary hover:text-text-primary transition-colors",children:"Revert changes"}),a.error&&e.jsx("p",{className:"text-xs text-status-error",children:a.error.message})]}),e.jsx("button",{onClick:J,disabled:!y||!s.trim()||a.isPending,className:"btn-primary text-xs disabled:opacity-40 shrink-0",children:a.isPending?"Saving...":"Save Schedule"})]})]})}function Q({mode:t,onChange:r}){const a=(s,i,l)=>e.jsxs("button",{onClick:()=>r(s),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors ${t===s?"bg-accent/10 text-accent font-medium":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[i,l]});return e.jsxs("div",{className:"flex gap-1 p-0.5 bg-surface-sunken rounded-lg w-fit",children:[a("prune",e.jsx(I,{className:"w-3.5 h-3.5"}),"Prune Now"),a("schedule",e.jsx(D,{className:"w-3.5 h-3.5"}),"Schedule")]})}function ee(){const[t,r]=d.useState("schedule");return e.jsxs("div",{children:[e.jsx(F,{title:"DB Maintenance",docsHash:"#docs:dashboard.md:db-maintenance",actions:e.jsx(Q,{mode:t,onChange:r})}),e.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 mb-8 rounded-md bg-accent/5 border border-accent/10",children:[e.jsx(j,{className:"w-4 h-4 text-accent shrink-0 mt-0.5"}),e.jsx("p",{className:"text-xs text-text-secondary leading-relaxed",children:"Workflow data grows as jobs complete. Operations are ordered safest-first: stream messages are always safe to prune, workflow reduction preserves results, and deletion is permanent."})]}),t==="prune"?e.jsx(U,{}):e.jsx(K,{})]})}export{ee as MaintenancePage};
|
|
2
|
+
//# sourceMappingURL=index-CgeFUhUr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-3A_5CL81.js","sources":["../../src/api/maintenance.ts","../../src/pages/admin/maintenance/controls.tsx","../../src/pages/admin/maintenance/PruneSection.tsx","../../src/pages/admin/maintenance/ScheduleSection.tsx","../../src/pages/admin/maintenance/MaintenancePage.tsx"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MaintenanceRule {\n target: 'streams' | 'jobs';\n action: 'delete' | 'prune';\n olderThan: string;\n hasEntity?: boolean;\n pruned?: boolean;\n}\n\nexport interface MaintenanceConfig {\n schedule: string;\n rules: MaintenanceRule[];\n}\n\nexport interface PruneOptions {\n expire?: string;\n jobs?: boolean;\n streams?: boolean;\n engineStreams?: boolean;\n engineStreamsExpire?: string;\n workerStreams?: boolean;\n workerStreamsExpire?: string;\n attributes?: boolean;\n entities?: string[];\n pruneTransient?: boolean;\n keepHmark?: boolean;\n}\n\nexport interface PruneResult {\n jobs?: number;\n streams?: number;\n engineStreams?: number;\n workerStreams?: number;\n attributes?: number;\n transient?: number;\n marked?: number;\n}\n\n// ── Maintenance config ────────────────────────────────────────────────────────\n\nexport function useMaintenanceConfig() {\n return useQuery<{ config: MaintenanceConfig; active: boolean }>({\n queryKey: ['maintenance'],\n queryFn: () => apiFetch('/config/maintenance'),\n });\n}\n\nexport function useUpdateMaintenanceConfig() {\n const queryClient = useQueryClient();\n return useMutation<\n { config: MaintenanceConfig; restarted: boolean },\n Error,\n MaintenanceConfig\n >({\n mutationFn: (config) =>\n apiFetch('/config/maintenance', {\n method: 'PUT',\n body: JSON.stringify(config),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['maintenance'] });\n },\n });\n}\n\n// ── DBA operations ────────────────────────────────────────────────────────────\n\nexport function usePrune() {\n return useMutation<PruneResult, Error, PruneOptions>({\n mutationFn: (options) =>\n apiFetch('/dba/prune', {\n method: 'POST',\n body: JSON.stringify(options),\n }),\n });\n}\n\nexport function useDeploy() {\n return useMutation<{ ok: boolean }, Error, void>({\n mutationFn: () =>\n apiFetch('/dba/deploy', { method: 'POST' }),\n });\n}\n","import { Info, ShieldCheck, ShieldAlert, ShieldOff } from 'lucide-react';\nimport { RETENTION_PERIOD_OPTIONS } from '../../../lib/constants';\n\n// ── Retention row (checkbox + label + select) ───────────────────────────────\n\nexport function RetentionRow({ checked, onToggle, label, hint, safety, value, onChange }: {\n checked: boolean;\n onToggle: (v: boolean) => void;\n label: string;\n hint: string;\n safety: 'safe' | 'moderate' | 'destructive';\n value: string;\n onChange: (v: string) => void;\n}) {\n const SafetyIcon = safety === 'safe' ? ShieldCheck : safety === 'moderate' ? ShieldAlert : ShieldOff;\n const safetyColor = safety === 'safe' ? 'text-status-success' : safety === 'moderate' ? 'text-status-warning' : 'text-status-error';\n const safetyLabel = safety === 'safe' ? 'Safe' : safety === 'moderate' ? 'Careful' : 'Permanent';\n\n return (\n <div className=\"flex items-center gap-4\">\n <label className=\"flex items-center gap-2.5 cursor-pointer w-80 shrink-0\">\n <input\n type=\"checkbox\"\n checked={checked}\n onChange={(e) => onToggle(e.target.checked)}\n className=\"w-4 h-4 rounded border-border accent-accent shrink-0\"\n />\n <div className=\"flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs text-text-primary\">{label}</span>\n <span className={`flex items-center gap-0.5 text-[9px] ${safetyColor}`}>\n <SafetyIcon className=\"w-3 h-3\" strokeWidth={1.5} />\n {safetyLabel}\n </span>\n </div>\n <p className=\"text-[10px] text-text-tertiary\">{hint}</p>\n </div>\n </label>\n <select\n value={value}\n onChange={(e) => onChange(e.target.value)}\n disabled={!checked}\n className={`select text-xs w-36 transition-opacity ${!checked ? 'opacity-40 cursor-not-allowed' : ''}`}\n >\n {RETENTION_PERIOD_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>{opt.label}</option>\n ))}\n </select>\n </div>\n );\n}\n\n// ── Cleanup checkbox ────────────────────────────────────────────────────────\n\nexport function CleanupCheck({ checked, onChange, label, description, safety }: {\n checked: boolean;\n onChange: (v: boolean) => void;\n label: string;\n description: string;\n safety: 'safe' | 'moderate' | 'destructive';\n}) {\n const SafetyIcon = safety === 'safe' ? ShieldCheck : safety === 'moderate' ? ShieldAlert : ShieldOff;\n const safetyColor = safety === 'safe' ? 'text-status-success' : safety === 'moderate' ? 'text-status-warning' : 'text-status-error';\n const safetyLabel = safety === 'safe' ? 'Safe' : safety === 'moderate' ? 'Careful' : 'Permanent';\n\n return (\n <label className=\"flex items-start gap-2.5 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={checked}\n onChange={(e) => onChange(e.target.checked)}\n className=\"w-4 h-4 mt-0.5 rounded border-border accent-accent shrink-0\"\n />\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs text-text-primary\">{label}</span>\n <span className={`flex items-center gap-0.5 text-[9px] ${safetyColor}`}>\n <SafetyIcon className=\"w-3 h-3\" strokeWidth={1.5} />\n {safetyLabel}\n </span>\n </div>\n <p className=\"text-[10px] text-text-tertiary\">{description}</p>\n </div>\n </label>\n );\n}\n\n// ── Cleanup callout ─────────────────────────────────────────────────────────\n\nexport function CleanupCallout() {\n return (\n <div className=\"flex items-start gap-2 mt-2 px-3 py-2 rounded bg-surface-sunken\">\n <Info className=\"w-3.5 h-3.5 text-text-tertiary shrink-0 mt-0.5\" />\n <p className=\"text-[10px] text-text-tertiary leading-relaxed\">\n Stripping preserves workflow results and timeline data needed for the execution detail view.\n Transient jobs are internal bookkeeping that accumulates over time.\n </p>\n </div>\n );\n}\n\n// ── Prune fields state shape (shared between both panels) ───────────────────\n\nexport interface PruneFields {\n pruneJobs: boolean;\n expire: string;\n engineStreams: boolean;\n engineStreamsExpire: string;\n workerStreams: boolean;\n workerStreamsExpire: string;\n stripAttributes: boolean;\n pruneTransient: boolean;\n}\n\nexport const DEFAULT_PRUNE_FIELDS: PruneFields = {\n pruneJobs: true,\n expire: '30 days',\n engineStreams: true,\n engineStreamsExpire: '1 day',\n workerStreams: true,\n workerStreamsExpire: '90 days',\n stripAttributes: false,\n pruneTransient: false,\n};\n\nexport function hasSelection(f: PruneFields): boolean {\n return f.pruneJobs || f.engineStreams || f.workerStreams || f.stripAttributes || f.pruneTransient;\n}\n\n// ── Prune fields editor (reused by both Prune Now and Schedule) ─────────────\n\nexport function PruneFieldsEditor({ fields, onChange }: {\n fields: PruneFields;\n onChange: (f: PruneFields) => void;\n}) {\n const set = <K extends keyof PruneFields>(key: K, value: PruneFields[K]) =>\n onChange({ ...fields, [key]: value });\n\n return (\n <div className=\"space-y-8\">\n {/* Stream messages — always safe to prune */}\n <div>\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1\">\n Stream Messages\n </p>\n <p className=\"text-[10px] text-text-tertiary mb-4\">\n Processed routing messages. Already consumed — safe to remove after a short retention window.\n </p>\n <div className=\"space-y-3\">\n <RetentionRow\n checked={fields.engineStreams} onToggle={(v) => set('engineStreams', v)}\n label=\"Engine messages\" hint=\"Internal orchestration signals\"\n safety=\"safe\"\n value={fields.engineStreamsExpire} onChange={(v) => set('engineStreamsExpire', v)}\n />\n <RetentionRow\n checked={fields.workerStreams} onToggle={(v) => set('workerStreams', v)}\n label=\"Worker messages\" hint=\"Activity dispatch and response payloads\"\n safety=\"safe\"\n value={fields.workerStreamsExpire} onChange={(v) => set('workerStreamsExpire', v)}\n />\n </div>\n </div>\n\n {/* Workflow data — mutually exclusive: reduce OR delete */}\n <div>\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1\">\n Completed Workflows\n </p>\n <p className=\"text-[10px] text-text-tertiary mb-4\">\n Choose how to handle completed workflow records. Reducing strips step-level detail\n but keeps the workflow and its results. Deleting removes the record entirely.\n </p>\n <div className=\"space-y-3\">\n <label className=\"flex items-start gap-2.5 cursor-pointer\">\n <input\n type=\"radio\"\n name=\"workflow-cleanup\"\n checked={!fields.stripAttributes && !fields.pruneJobs}\n onChange={() => onChange({ ...fields, stripAttributes: false, pruneJobs: false })}\n className=\"w-4 h-4 mt-0.5 accent-accent shrink-0\"\n />\n <div>\n <span className=\"text-xs text-text-primary\">Keep as-is</span>\n <p className=\"text-[10px] text-text-tertiary\">No changes to completed workflow records.</p>\n </div>\n </label>\n\n <div className=\"flex items-start gap-2.5\">\n <label className=\"flex items-start gap-2.5 cursor-pointer w-80 shrink-0\">\n <input\n type=\"radio\"\n name=\"workflow-cleanup\"\n checked={fields.stripAttributes && !fields.pruneJobs}\n onChange={() => onChange({ ...fields, stripAttributes: true, pruneJobs: false })}\n className=\"w-4 h-4 mt-0.5 accent-accent shrink-0\"\n />\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs text-text-primary\">Reduce completed workflows</span>\n <span className=\"flex items-center gap-0.5 text-[9px] text-status-warning\">\n <ShieldAlert className=\"w-3 h-3\" strokeWidth={1.5} />\n Careful\n </span>\n </div>\n <p className=\"text-[10px] text-text-tertiary\">\n Strips step-level execution detail (activity inputs/outputs, internal state).\n Workflow results and timeline are preserved.\n </p>\n </div>\n </label>\n <select\n value={fields.expire}\n onChange={(e) => set('expire', e.target.value)}\n disabled={!fields.stripAttributes || fields.pruneJobs}\n className={`select text-xs w-36 transition-opacity mt-0.5 ${!fields.stripAttributes || fields.pruneJobs ? 'opacity-40 cursor-not-allowed' : ''}`}\n >\n {RETENTION_PERIOD_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>{opt.label}</option>\n ))}\n </select>\n </div>\n\n <div className=\"flex items-start gap-2.5\">\n <label className=\"flex items-start gap-2.5 cursor-pointer w-80 shrink-0\">\n <input\n type=\"radio\"\n name=\"workflow-cleanup\"\n checked={fields.pruneJobs}\n onChange={() => onChange({ ...fields, pruneJobs: true, stripAttributes: false })}\n className=\"w-4 h-4 mt-0.5 accent-accent shrink-0\"\n />\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs text-text-primary\">Delete completed workflows</span>\n <span className=\"flex items-center gap-0.5 text-[9px] text-status-error\">\n <ShieldOff className=\"w-3 h-3\" strokeWidth={1.5} />\n Permanent\n </span>\n </div>\n <p className=\"text-[10px] text-text-tertiary\">\n Permanently removes workflow records. Results, timeline, and all\n execution data are deleted and cannot be recovered.\n </p>\n </div>\n </label>\n <select\n value={fields.expire}\n onChange={(e) => set('expire', e.target.value)}\n disabled={!fields.pruneJobs}\n className={`select text-xs w-36 transition-opacity mt-0.5 ${!fields.pruneJobs ? 'opacity-40 cursor-not-allowed' : ''}`}\n >\n {RETENTION_PERIOD_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>{opt.label}</option>\n ))}\n </select>\n </div>\n </div>\n <CleanupCallout />\n </div>\n </div>\n );\n}\n","import { useState } from 'react';\nimport { usePrune, type PruneResult } from '../../../api/maintenance';\nimport { Modal } from '../../../components/common/modal/Modal';\nimport { PruneFieldsEditor, DEFAULT_PRUNE_FIELDS, hasSelection, type PruneFields } from './controls';\n\nfunction ResultCard({ label, value }: { label: string; value: number }) {\n return (\n <div>\n <p className=\"text-lg font-light text-text-primary\">{value.toLocaleString()}</p>\n <p className=\"text-[10px] text-text-tertiary\">{label}</p>\n </div>\n );\n}\n\nexport function PruneSection() {\n const prune = usePrune();\n const [fields, setFields] = useState<PruneFields>(DEFAULT_PRUNE_FIELDS);\n const [result, setResult] = useState<PruneResult | null>(null);\n const [showConfirm, setShowConfirm] = useState(false);\n\n const handlePrune = () => {\n setResult(null);\n prune.mutate(\n {\n expire: fields.expire,\n jobs: fields.pruneJobs,\n engineStreams: fields.engineStreams,\n engineStreamsExpire: fields.engineStreamsExpire,\n workerStreams: fields.workerStreams,\n workerStreamsExpire: fields.workerStreamsExpire,\n attributes: fields.stripAttributes,\n pruneTransient: fields.pruneTransient,\n },\n {\n onSuccess: (data) => {\n setResult(data);\n setShowConfirm(false);\n },\n },\n );\n };\n\n return (\n <div className=\"space-y-8\">\n <PruneFieldsEditor fields={fields} onChange={setFields} />\n\n {/* Action bar */}\n <div className=\"flex items-center justify-between pt-2 border-t border-surface-border\">\n <p className=\"text-[10px] text-text-tertiary\">\n {!hasSelection(fields)\n ? 'Select at least one operation to enable pruning.'\n : 'This action permanently deletes data and cannot be undone.'}\n </p>\n <button\n onClick={() => setShowConfirm(true)}\n disabled={!hasSelection(fields) || prune.isPending}\n className=\"bg-status-error text-white px-4 py-1.5 rounded-md text-xs hover:opacity-90 transition-opacity disabled:opacity-40 shrink-0\"\n >\n {prune.isPending ? 'Pruning...' : 'Prune Now'}\n </button>\n </div>\n\n {/* Results */}\n {result && (\n <div className=\"bg-surface-sunken rounded-md px-4 py-3\">\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-2\">\n Results\n </p>\n <div className=\"flex flex-wrap gap-6\">\n {result.jobs != null && result.jobs > 0 && <ResultCard label=\"Jobs deleted\" value={result.jobs} />}\n {result.engineStreams != null && result.engineStreams > 0 && <ResultCard label=\"Engine streams\" value={result.engineStreams} />}\n {result.workerStreams != null && result.workerStreams > 0 && <ResultCard label=\"Worker streams\" value={result.workerStreams} />}\n {result.streams != null && result.engineStreams == null && result.streams > 0 && <ResultCard label=\"Streams\" value={result.streams} />}\n {result.attributes != null && result.attributes > 0 && <ResultCard label=\"Artifacts stripped\" value={result.attributes} />}\n {result.transient != null && result.transient > 0 && <ResultCard label=\"Transient deleted\" value={result.transient} />}\n {result.marked != null && result.marked > 0 && <ResultCard label=\"Marked pruned\" value={result.marked} />}\n {Object.values(result).every((v) => !v || v === 0) && (\n <p className=\"text-xs text-text-tertiary\">Nothing to prune within the selected retention windows.</p>\n )}\n </div>\n </div>\n )}\n\n {prune.error && (\n <p className=\"text-xs text-status-error\">{(prune.error as Error).message}</p>\n )}\n\n {/* Confirm modal */}\n <Modal open={showConfirm} onClose={() => setShowConfirm(false)} title=\"Confirm Prune\">\n <div className=\"space-y-4\">\n <p className=\"text-sm text-text-secondary\">\n This will permanently delete data. This action cannot be undone.\n </p>\n <ul className=\"text-xs text-text-secondary space-y-1 list-disc list-inside\">\n {fields.pruneJobs && <li>Delete jobs older than {fields.expire}</li>}\n {fields.engineStreams && <li>Delete engine streams older than {fields.engineStreamsExpire}</li>}\n {fields.workerStreams && <li>Delete worker streams older than {fields.workerStreamsExpire}</li>}\n {fields.stripAttributes && <li>Strip execution artifacts from completed jobs</li>}\n {fields.pruneTransient && <li>Delete transient (entity-less) jobs</li>}\n </ul>\n <div className=\"flex justify-end gap-3 pt-2\">\n <button onClick={() => setShowConfirm(false)} className=\"btn-secondary text-xs\">Cancel</button>\n <button\n onClick={handlePrune}\n className=\"bg-status-error text-white px-3 py-1.5 rounded-md text-xs hover:opacity-90 transition-opacity\"\n disabled={prune.isPending}\n >\n {prune.isPending ? 'Pruning...' : 'Confirm Prune'}\n </button>\n </div>\n </div>\n </Modal>\n </div>\n );\n}\n","import { useState, useEffect, useCallback } from 'react';\nimport { Info } from 'lucide-react';\nimport {\n useMaintenanceConfig,\n useUpdateMaintenanceConfig,\n type MaintenanceConfig,\n} from '../../../api/maintenance';\nimport { CRON_PRESETS } from '../../../lib/constants';\nimport { PruneFieldsEditor, DEFAULT_PRUNE_FIELDS, type PruneFields } from './controls';\n\n// ── Helpers ─────────────────────────────────────────────────────────────────\n\n/** Convert a MaintenanceConfig (rules array) into PruneFields for the editor. */\nfunction configToFields(config: MaintenanceConfig | undefined): PruneFields {\n if (!config?.rules?.length) return DEFAULT_PRUNE_FIELDS;\n const r = config.rules;\n const streamDelete = r.find((x) => x.target === 'streams' && x.action === 'delete');\n const jobDeleteTransient = r.find((x) => x.target === 'jobs' && x.action === 'delete' && x.hasEntity === false);\n const jobPrune = r.find((x) => x.target === 'jobs' && x.action === 'prune' && x.hasEntity === true);\n const jobDeletePruned = r.find((x) => x.target === 'jobs' && x.action === 'delete' && x.pruned === true);\n return {\n pruneJobs: !!jobDeletePruned,\n expire: jobDeletePruned?.olderThan ?? '180 days',\n engineStreams: !!streamDelete,\n engineStreamsExpire: streamDelete?.olderThan ?? '1 day',\n workerStreams: !!streamDelete,\n workerStreamsExpire: streamDelete?.olderThan ?? '90 days',\n stripAttributes: !!jobPrune,\n pruneTransient: !!jobDeleteTransient,\n };\n}\n\n/** Convert PruneFields back to a MaintenanceConfig rules array. */\nfunction fieldsToRules(f: PruneFields): MaintenanceConfig['rules'] {\n const rules: MaintenanceConfig['rules'] = [];\n if (f.engineStreams) {\n rules.push({ target: 'streams', action: 'delete', olderThan: f.engineStreamsExpire });\n }\n if (f.workerStreams && f.workerStreamsExpire !== f.engineStreamsExpire) {\n rules.push({ target: 'streams', action: 'delete', olderThan: f.workerStreamsExpire });\n }\n if (f.pruneTransient) {\n rules.push({ target: 'jobs', action: 'delete', olderThan: f.expire, hasEntity: false });\n }\n if (f.stripAttributes) {\n rules.push({ target: 'jobs', action: 'prune', olderThan: f.expire, hasEntity: true });\n }\n if (f.pruneJobs) {\n rules.push({ target: 'jobs', action: 'delete', olderThan: f.expire, pruned: true });\n }\n return rules;\n}\n\nfunction describeCron(expr: string): string {\n return CRON_PRESETS.find((p) => p.value === expr)?.label ?? '';\n}\n\n// ── Main ────────────────────────────────────────────────────────────────────\n\nexport function ScheduleSection() {\n const { data, isLoading } = useMaintenanceConfig();\n const updateConfig = useUpdateMaintenanceConfig();\n\n const [schedule, setSchedule] = useState('');\n const [fields, setFields] = useState<PruneFields>(DEFAULT_PRUNE_FIELDS);\n const [savedSnapshot, setSavedSnapshot] = useState('');\n\n // Sync from server config when loaded\n const syncFromServer = useCallback(() => {\n if (!data?.config) return;\n setSchedule(data.config.schedule);\n setFields(configToFields(data.config));\n setSavedSnapshot(JSON.stringify({ schedule: data.config.schedule, fields: configToFields(data.config) }));\n }, [data]);\n\n useEffect(() => { syncFromServer(); }, [syncFromServer]);\n\n const currentSnapshot = JSON.stringify({ schedule, fields });\n const isDirty = savedSnapshot !== '' && currentSnapshot !== savedSnapshot;\n const active = data?.active ?? false;\n\n const handleSave = () => {\n const rules = fieldsToRules(fields);\n updateConfig.mutate(\n { schedule, rules },\n {\n onSuccess: () => {\n setSavedSnapshot(JSON.stringify({ schedule, fields }));\n },\n },\n );\n };\n\n const handleRevert = () => {\n syncFromServer();\n };\n\n if (isLoading) {\n return <div className=\"animate-pulse h-40 bg-surface-sunken rounded\" />;\n }\n\n return (\n <div className=\"space-y-8\">\n {/* Cron schedule + status */}\n <div className=\"grid grid-cols-1 lg:grid-cols-[1fr_auto] gap-10\">\n <div>\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4\">\n Schedule\n </p>\n <div className=\"flex items-end gap-4\">\n <div>\n <label className=\"block text-[10px] text-text-tertiary mb-1\">Cron Expression</label>\n <input\n type=\"text\"\n value={schedule}\n onChange={(e) => setSchedule(e.target.value)}\n placeholder=\"0 2 * * *\"\n className=\"input text-xs font-mono w-48\"\n />\n </div>\n <div>\n <div className=\"flex items-center gap-1.5 h-8\">\n <span className={`w-1.5 h-1.5 rounded-full ${active ? 'bg-status-success' : 'bg-text-tertiary'}`} />\n <span className={`text-xs ${active ? 'text-status-success' : 'text-text-tertiary'}`}>\n {active ? 'Active' : 'Inactive'}\n </span>\n </div>\n </div>\n {describeCron(schedule) && (\n <p className=\"text-xs text-text-tertiary h-8 flex items-center\">{describeCron(schedule)}</p>\n )}\n </div>\n\n {/* Preset pills */}\n <div className=\"flex flex-wrap gap-1.5 mt-3\">\n {CRON_PRESETS.map((preset) => (\n <button\n key={preset.value}\n type=\"button\"\n onClick={() => setSchedule(preset.value)}\n className={`px-2.5 py-1 text-[10px] rounded-full transition-colors ${\n schedule === preset.value\n ? 'bg-accent/10 text-accent font-medium'\n : 'bg-surface-sunken text-text-tertiary hover:text-text-secondary'\n }`}\n >\n {preset.label}\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"lg:w-72\">\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4\">\n How It Works\n </p>\n <div className=\"flex items-start gap-2 px-3 py-2 rounded bg-surface-sunken\">\n <Info className=\"w-3.5 h-3.5 text-text-tertiary shrink-0 mt-0.5\" />\n <p className=\"text-[10px] text-text-tertiary leading-relaxed\">\n Rules execute sequentially on each cron cycle. Engine streams can be pruned aggressively\n since they only contain internal routing data. Worker streams should be retained longer\n to preserve execution playback and input enrichment.\n </p>\n </div>\n </div>\n </div>\n\n {/* Same prune fields as Prune Now */}\n <PruneFieldsEditor fields={fields} onChange={setFields} />\n\n {/* Action bar */}\n <div className=\"flex items-center justify-between pt-2 border-t border-surface-border\">\n <div className=\"flex items-center gap-3\">\n {isDirty && (\n <button\n onClick={handleRevert}\n className=\"text-[10px] text-text-tertiary hover:text-text-primary transition-colors\"\n >\n Revert changes\n </button>\n )}\n {updateConfig.error && (\n <p className=\"text-xs text-status-error\">{(updateConfig.error as Error).message}</p>\n )}\n </div>\n <button\n onClick={handleSave}\n disabled={!isDirty || !schedule.trim() || updateConfig.isPending}\n className=\"btn-primary text-xs disabled:opacity-40 shrink-0\"\n >\n {updateConfig.isPending ? 'Saving...' : 'Save Schedule'}\n </button>\n </div>\n </div>\n );\n}\n","import { useState } from 'react';\nimport { Trash2, Clock, Info } from 'lucide-react';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { PruneSection } from './PruneSection';\nimport { ScheduleSection } from './ScheduleSection';\n\ntype Mode = 'prune' | 'schedule';\n\nfunction ModeToggle({ mode, onChange }: { mode: Mode; onChange: (m: Mode) => void }) {\n const btn = (m: Mode, icon: React.ReactNode, label: string) => (\n <button\n onClick={() => onChange(m)}\n className={`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors ${\n mode === m\n ? 'bg-accent/10 text-accent font-medium'\n : 'text-text-tertiary hover:text-text-secondary hover:bg-surface-hover'\n }`}\n >\n {icon}\n {label}\n </button>\n );\n\n return (\n <div className=\"flex gap-1 p-0.5 bg-surface-sunken rounded-lg w-fit\">\n {btn('prune', <Trash2 className=\"w-3.5 h-3.5\" />, 'Prune Now')}\n {btn('schedule', <Clock className=\"w-3.5 h-3.5\" />, 'Schedule')}\n </div>\n );\n}\n\nexport function MaintenancePage() {\n const [mode, setMode] = useState<Mode>('schedule');\n\n return (\n <div>\n <PageHeader\n title=\"DB Maintenance\"\n docsHash=\"#docs:dashboard.md:db-maintenance\"\n actions={<ModeToggle mode={mode} onChange={setMode} />}\n />\n\n <div className=\"flex items-start gap-2 px-4 py-3 mb-8 rounded-md bg-accent/5 border border-accent/10\">\n <Info className=\"w-4 h-4 text-accent shrink-0 mt-0.5\" />\n <p className=\"text-xs text-text-secondary leading-relaxed\">\n Workflow data grows as jobs complete. Operations are ordered safest-first: stream messages are\n always safe to prune, workflow reduction preserves results, and deletion is permanent.\n </p>\n </div>\n\n {mode === 'prune' ? <PruneSection /> : <ScheduleSection />}\n </div>\n );\n}\n"],"names":["useMaintenanceConfig","useQuery","apiFetch","useUpdateMaintenanceConfig","queryClient","useQueryClient","useMutation","config","usePrune","options","RetentionRow","checked","onToggle","label","hint","safety","value","onChange","SafetyIcon","ShieldCheck","ShieldAlert","ShieldOff","safetyColor","safetyLabel","jsxs","jsx","e","RETENTION_PERIOD_OPTIONS","opt","CleanupCallout","Info","DEFAULT_PRUNE_FIELDS","hasSelection","f","PruneFieldsEditor","fields","set","key","v","ResultCard","PruneSection","prune","setFields","useState","result","setResult","showConfirm","setShowConfirm","handlePrune","data","Modal","configToFields","_a","streamDelete","x","jobDeleteTransient","jobPrune","jobDeletePruned","fieldsToRules","rules","describeCron","expr","CRON_PRESETS","p","ScheduleSection","isLoading","updateConfig","schedule","setSchedule","savedSnapshot","setSavedSnapshot","syncFromServer","useCallback","useEffect","currentSnapshot","isDirty","active","handleSave","handleRevert","preset","ModeToggle","mode","btn","m","icon","Trash2","Clock","MaintenancePage","setMode","PageHeader"],"mappings":"2WA4CO,SAASA,GAAuB,CACrC,OAAOC,EAAyD,CAC9D,SAAU,CAAC,aAAa,EACxB,QAAS,IAAMC,EAAS,qBAAqB,CAAA,CAC9C,CACH,CAEO,SAASC,GAA6B,CAC3C,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAIL,CACA,WAAaC,GACXL,EAAS,sBAAuB,CAC9B,OAAQ,MACR,KAAM,KAAK,UAAUK,CAAM,CAAA,CAC5B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,aAAa,EAAG,CAC7D,CAAA,CACD,CACH,CAIO,SAASI,GAAW,CACzB,OAAOF,EAA8C,CACnD,WAAaG,GACXP,EAAS,aAAc,CACrB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAO,CAAA,CAC7B,CAAA,CACJ,CACH,CC1EO,SAASC,EAAa,CAAE,QAAAC,EAAS,SAAAC,EAAU,MAAAC,EAAO,KAAAC,EAAM,OAAAC,EAAQ,MAAAC,EAAO,SAAAC,GAQ3E,CACD,MAAMC,EAAaH,IAAW,OAASI,EAAcJ,IAAW,WAAaK,EAAcC,EACrFC,EAAcP,IAAW,OAAS,sBAAwBA,IAAW,WAAa,sBAAwB,oBAC1GQ,EAAcR,IAAW,OAAS,OAASA,IAAW,WAAa,UAAY,YAErF,OACES,EAAAA,KAAC,MAAA,CAAI,UAAU,0BACb,SAAA,CAAAA,EAAAA,KAAC,QAAA,CAAM,UAAU,yDACf,SAAA,CAAAC,EAAAA,IAAC,QAAA,CACC,KAAK,WACL,QAAAd,EACA,SAAWe,GAAMd,EAASc,EAAE,OAAO,OAAO,EAC1C,UAAU,sDAAA,CAAA,EAEZF,EAAAA,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AA,CAAa,QAAMwB,EAAA,CAAA,CAAgB,CAAA,EAC1D,CAEJ"}
|
|
1
|
+
{"version":3,"file":"index-CgeFUhUr.js","sources":["../../src/api/maintenance.ts","../../src/pages/admin/maintenance/controls.tsx","../../src/pages/admin/maintenance/PruneSection.tsx","../../src/pages/admin/maintenance/ScheduleSection.tsx","../../src/pages/admin/maintenance/MaintenancePage.tsx"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\nexport interface MaintenanceRule {\n target: 'streams' | 'jobs';\n action: 'delete' | 'prune';\n olderThan: string;\n hasEntity?: boolean;\n pruned?: boolean;\n}\n\nexport interface MaintenanceConfig {\n schedule: string;\n rules: MaintenanceRule[];\n}\n\nexport interface PruneOptions {\n expire?: string;\n jobs?: boolean;\n streams?: boolean;\n engineStreams?: boolean;\n engineStreamsExpire?: string;\n workerStreams?: boolean;\n workerStreamsExpire?: string;\n attributes?: boolean;\n entities?: string[];\n pruneTransient?: boolean;\n keepHmark?: boolean;\n}\n\nexport interface PruneResult {\n jobs?: number;\n streams?: number;\n engineStreams?: number;\n workerStreams?: number;\n attributes?: number;\n transient?: number;\n marked?: number;\n}\n\n// ── Maintenance config ────────────────────────────────────────────────────────\n\nexport function useMaintenanceConfig() {\n return useQuery<{ config: MaintenanceConfig; active: boolean }>({\n queryKey: ['maintenance'],\n queryFn: () => apiFetch('/config/maintenance'),\n });\n}\n\nexport function useUpdateMaintenanceConfig() {\n const queryClient = useQueryClient();\n return useMutation<\n { config: MaintenanceConfig; restarted: boolean },\n Error,\n MaintenanceConfig\n >({\n mutationFn: (config) =>\n apiFetch('/config/maintenance', {\n method: 'PUT',\n body: JSON.stringify(config),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['maintenance'] });\n },\n });\n}\n\n// ── DBA operations ────────────────────────────────────────────────────────────\n\nexport function usePrune() {\n return useMutation<PruneResult, Error, PruneOptions>({\n mutationFn: (options) =>\n apiFetch('/dba/prune', {\n method: 'POST',\n body: JSON.stringify(options),\n }),\n });\n}\n\nexport function useDeploy() {\n return useMutation<{ ok: boolean }, Error, void>({\n mutationFn: () =>\n apiFetch('/dba/deploy', { method: 'POST' }),\n });\n}\n","import { Info, ShieldCheck, ShieldAlert, ShieldOff } from 'lucide-react';\nimport { RETENTION_PERIOD_OPTIONS } from '../../../lib/constants';\n\n// ── Retention row (checkbox + label + select) ───────────────────────────────\n\nexport function RetentionRow({ checked, onToggle, label, hint, safety, value, onChange }: {\n checked: boolean;\n onToggle: (v: boolean) => void;\n label: string;\n hint: string;\n safety: 'safe' | 'moderate' | 'destructive';\n value: string;\n onChange: (v: string) => void;\n}) {\n const SafetyIcon = safety === 'safe' ? ShieldCheck : safety === 'moderate' ? ShieldAlert : ShieldOff;\n const safetyColor = safety === 'safe' ? 'text-status-success' : safety === 'moderate' ? 'text-status-warning' : 'text-status-error';\n const safetyLabel = safety === 'safe' ? 'Safe' : safety === 'moderate' ? 'Careful' : 'Permanent';\n\n return (\n <div className=\"flex items-center gap-4\">\n <label className=\"flex items-center gap-2.5 cursor-pointer w-80 shrink-0\">\n <input\n type=\"checkbox\"\n checked={checked}\n onChange={(e) => onToggle(e.target.checked)}\n className=\"w-4 h-4 rounded border-border accent-accent shrink-0\"\n />\n <div className=\"flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs text-text-primary\">{label}</span>\n <span className={`flex items-center gap-0.5 text-[9px] ${safetyColor}`}>\n <SafetyIcon className=\"w-3 h-3\" strokeWidth={1.5} />\n {safetyLabel}\n </span>\n </div>\n <p className=\"text-[10px] text-text-tertiary\">{hint}</p>\n </div>\n </label>\n <select\n value={value}\n onChange={(e) => onChange(e.target.value)}\n disabled={!checked}\n className={`select text-xs w-36 transition-opacity ${!checked ? 'opacity-40 cursor-not-allowed' : ''}`}\n >\n {RETENTION_PERIOD_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>{opt.label}</option>\n ))}\n </select>\n </div>\n );\n}\n\n// ── Cleanup checkbox ────────────────────────────────────────────────────────\n\nexport function CleanupCheck({ checked, onChange, label, description, safety }: {\n checked: boolean;\n onChange: (v: boolean) => void;\n label: string;\n description: string;\n safety: 'safe' | 'moderate' | 'destructive';\n}) {\n const SafetyIcon = safety === 'safe' ? ShieldCheck : safety === 'moderate' ? ShieldAlert : ShieldOff;\n const safetyColor = safety === 'safe' ? 'text-status-success' : safety === 'moderate' ? 'text-status-warning' : 'text-status-error';\n const safetyLabel = safety === 'safe' ? 'Safe' : safety === 'moderate' ? 'Careful' : 'Permanent';\n\n return (\n <label className=\"flex items-start gap-2.5 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={checked}\n onChange={(e) => onChange(e.target.checked)}\n className=\"w-4 h-4 mt-0.5 rounded border-border accent-accent shrink-0\"\n />\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs text-text-primary\">{label}</span>\n <span className={`flex items-center gap-0.5 text-[9px] ${safetyColor}`}>\n <SafetyIcon className=\"w-3 h-3\" strokeWidth={1.5} />\n {safetyLabel}\n </span>\n </div>\n <p className=\"text-[10px] text-text-tertiary\">{description}</p>\n </div>\n </label>\n );\n}\n\n// ── Cleanup callout ─────────────────────────────────────────────────────────\n\nexport function CleanupCallout() {\n return (\n <div className=\"flex items-start gap-2 mt-2 px-3 py-2 rounded bg-surface-sunken\">\n <Info className=\"w-3.5 h-3.5 text-text-tertiary shrink-0 mt-0.5\" />\n <p className=\"text-[10px] text-text-tertiary leading-relaxed\">\n Stripping preserves workflow results and timeline data needed for the execution detail view.\n Transient jobs are internal bookkeeping that accumulates over time.\n </p>\n </div>\n );\n}\n\n// ── Prune fields state shape (shared between both panels) ───────────────────\n\nexport interface PruneFields {\n pruneJobs: boolean;\n expire: string;\n engineStreams: boolean;\n engineStreamsExpire: string;\n workerStreams: boolean;\n workerStreamsExpire: string;\n stripAttributes: boolean;\n pruneTransient: boolean;\n}\n\nexport const DEFAULT_PRUNE_FIELDS: PruneFields = {\n pruneJobs: true,\n expire: '30 days',\n engineStreams: true,\n engineStreamsExpire: '1 day',\n workerStreams: true,\n workerStreamsExpire: '90 days',\n stripAttributes: false,\n pruneTransient: false,\n};\n\nexport function hasSelection(f: PruneFields): boolean {\n return f.pruneJobs || f.engineStreams || f.workerStreams || f.stripAttributes || f.pruneTransient;\n}\n\n// ── Prune fields editor (reused by both Prune Now and Schedule) ─────────────\n\nexport function PruneFieldsEditor({ fields, onChange }: {\n fields: PruneFields;\n onChange: (f: PruneFields) => void;\n}) {\n const set = <K extends keyof PruneFields>(key: K, value: PruneFields[K]) =>\n onChange({ ...fields, [key]: value });\n\n return (\n <div className=\"space-y-8\">\n {/* Stream messages — always safe to prune */}\n <div>\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1\">\n Stream Messages\n </p>\n <p className=\"text-[10px] text-text-tertiary mb-4\">\n Processed routing messages. Already consumed — safe to remove after a short retention window.\n </p>\n <div className=\"space-y-3\">\n <RetentionRow\n checked={fields.engineStreams} onToggle={(v) => set('engineStreams', v)}\n label=\"Engine messages\" hint=\"Internal orchestration signals\"\n safety=\"safe\"\n value={fields.engineStreamsExpire} onChange={(v) => set('engineStreamsExpire', v)}\n />\n <RetentionRow\n checked={fields.workerStreams} onToggle={(v) => set('workerStreams', v)}\n label=\"Worker messages\" hint=\"Activity dispatch and response payloads\"\n safety=\"safe\"\n value={fields.workerStreamsExpire} onChange={(v) => set('workerStreamsExpire', v)}\n />\n </div>\n </div>\n\n {/* Workflow data — mutually exclusive: reduce OR delete */}\n <div>\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1\">\n Completed Workflows\n </p>\n <p className=\"text-[10px] text-text-tertiary mb-4\">\n Choose how to handle completed workflow records. Reducing strips step-level detail\n but keeps the workflow and its results. Deleting removes the record entirely.\n </p>\n <div className=\"space-y-3\">\n <label className=\"flex items-start gap-2.5 cursor-pointer\">\n <input\n type=\"radio\"\n name=\"workflow-cleanup\"\n checked={!fields.stripAttributes && !fields.pruneJobs}\n onChange={() => onChange({ ...fields, stripAttributes: false, pruneJobs: false })}\n className=\"w-4 h-4 mt-0.5 accent-accent shrink-0\"\n />\n <div>\n <span className=\"text-xs text-text-primary\">Keep as-is</span>\n <p className=\"text-[10px] text-text-tertiary\">No changes to completed workflow records.</p>\n </div>\n </label>\n\n <div className=\"flex items-start gap-2.5\">\n <label className=\"flex items-start gap-2.5 cursor-pointer w-80 shrink-0\">\n <input\n type=\"radio\"\n name=\"workflow-cleanup\"\n checked={fields.stripAttributes && !fields.pruneJobs}\n onChange={() => onChange({ ...fields, stripAttributes: true, pruneJobs: false })}\n className=\"w-4 h-4 mt-0.5 accent-accent shrink-0\"\n />\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs text-text-primary\">Reduce completed workflows</span>\n <span className=\"flex items-center gap-0.5 text-[9px] text-status-warning\">\n <ShieldAlert className=\"w-3 h-3\" strokeWidth={1.5} />\n Careful\n </span>\n </div>\n <p className=\"text-[10px] text-text-tertiary\">\n Strips step-level execution detail (activity inputs/outputs, internal state).\n Workflow results and timeline are preserved.\n </p>\n </div>\n </label>\n <select\n value={fields.expire}\n onChange={(e) => set('expire', e.target.value)}\n disabled={!fields.stripAttributes || fields.pruneJobs}\n className={`select text-xs w-36 transition-opacity mt-0.5 ${!fields.stripAttributes || fields.pruneJobs ? 'opacity-40 cursor-not-allowed' : ''}`}\n >\n {RETENTION_PERIOD_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>{opt.label}</option>\n ))}\n </select>\n </div>\n\n <div className=\"flex items-start gap-2.5\">\n <label className=\"flex items-start gap-2.5 cursor-pointer w-80 shrink-0\">\n <input\n type=\"radio\"\n name=\"workflow-cleanup\"\n checked={fields.pruneJobs}\n onChange={() => onChange({ ...fields, pruneJobs: true, stripAttributes: false })}\n className=\"w-4 h-4 mt-0.5 accent-accent shrink-0\"\n />\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs text-text-primary\">Delete completed workflows</span>\n <span className=\"flex items-center gap-0.5 text-[9px] text-status-error\">\n <ShieldOff className=\"w-3 h-3\" strokeWidth={1.5} />\n Permanent\n </span>\n </div>\n <p className=\"text-[10px] text-text-tertiary\">\n Permanently removes workflow records. Results, timeline, and all\n execution data are deleted and cannot be recovered.\n </p>\n </div>\n </label>\n <select\n value={fields.expire}\n onChange={(e) => set('expire', e.target.value)}\n disabled={!fields.pruneJobs}\n className={`select text-xs w-36 transition-opacity mt-0.5 ${!fields.pruneJobs ? 'opacity-40 cursor-not-allowed' : ''}`}\n >\n {RETENTION_PERIOD_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>{opt.label}</option>\n ))}\n </select>\n </div>\n </div>\n <CleanupCallout />\n </div>\n </div>\n );\n}\n","import { useState } from 'react';\nimport { usePrune, type PruneResult } from '../../../api/maintenance';\nimport { Modal } from '../../../components/common/modal/Modal';\nimport { PruneFieldsEditor, DEFAULT_PRUNE_FIELDS, hasSelection, type PruneFields } from './controls';\n\nfunction ResultCard({ label, value }: { label: string; value: number }) {\n return (\n <div>\n <p className=\"text-lg font-light text-text-primary\">{value.toLocaleString()}</p>\n <p className=\"text-[10px] text-text-tertiary\">{label}</p>\n </div>\n );\n}\n\nexport function PruneSection() {\n const prune = usePrune();\n const [fields, setFields] = useState<PruneFields>(DEFAULT_PRUNE_FIELDS);\n const [result, setResult] = useState<PruneResult | null>(null);\n const [showConfirm, setShowConfirm] = useState(false);\n\n const handlePrune = () => {\n setResult(null);\n prune.mutate(\n {\n expire: fields.expire,\n jobs: fields.pruneJobs,\n engineStreams: fields.engineStreams,\n engineStreamsExpire: fields.engineStreamsExpire,\n workerStreams: fields.workerStreams,\n workerStreamsExpire: fields.workerStreamsExpire,\n attributes: fields.stripAttributes,\n pruneTransient: fields.pruneTransient,\n },\n {\n onSuccess: (data) => {\n setResult(data);\n setShowConfirm(false);\n },\n },\n );\n };\n\n return (\n <div className=\"space-y-8\">\n <PruneFieldsEditor fields={fields} onChange={setFields} />\n\n {/* Action bar */}\n <div className=\"flex items-center justify-between pt-2 border-t border-surface-border\">\n <p className=\"text-[10px] text-text-tertiary\">\n {!hasSelection(fields)\n ? 'Select at least one operation to enable pruning.'\n : 'This action permanently deletes data and cannot be undone.'}\n </p>\n <button\n onClick={() => setShowConfirm(true)}\n disabled={!hasSelection(fields) || prune.isPending}\n className=\"bg-status-error text-white px-4 py-1.5 rounded-md text-xs hover:opacity-90 transition-opacity disabled:opacity-40 shrink-0\"\n >\n {prune.isPending ? 'Pruning...' : 'Prune Now'}\n </button>\n </div>\n\n {/* Results */}\n {result && (\n <div className=\"bg-surface-sunken rounded-md px-4 py-3\">\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-2\">\n Results\n </p>\n <div className=\"flex flex-wrap gap-6\">\n {result.jobs != null && result.jobs > 0 && <ResultCard label=\"Jobs deleted\" value={result.jobs} />}\n {result.engineStreams != null && result.engineStreams > 0 && <ResultCard label=\"Engine streams\" value={result.engineStreams} />}\n {result.workerStreams != null && result.workerStreams > 0 && <ResultCard label=\"Worker streams\" value={result.workerStreams} />}\n {result.streams != null && result.engineStreams == null && result.streams > 0 && <ResultCard label=\"Streams\" value={result.streams} />}\n {result.attributes != null && result.attributes > 0 && <ResultCard label=\"Artifacts stripped\" value={result.attributes} />}\n {result.transient != null && result.transient > 0 && <ResultCard label=\"Transient deleted\" value={result.transient} />}\n {result.marked != null && result.marked > 0 && <ResultCard label=\"Marked pruned\" value={result.marked} />}\n {Object.values(result).every((v) => !v || v === 0) && (\n <p className=\"text-xs text-text-tertiary\">Nothing to prune within the selected retention windows.</p>\n )}\n </div>\n </div>\n )}\n\n {prune.error && (\n <p className=\"text-xs text-status-error\">{(prune.error as Error).message}</p>\n )}\n\n {/* Confirm modal */}\n <Modal open={showConfirm} onClose={() => setShowConfirm(false)} title=\"Confirm Prune\">\n <div className=\"space-y-4\">\n <p className=\"text-sm text-text-secondary\">\n This will permanently delete data. This action cannot be undone.\n </p>\n <ul className=\"text-xs text-text-secondary space-y-1 list-disc list-inside\">\n {fields.pruneJobs && <li>Delete jobs older than {fields.expire}</li>}\n {fields.engineStreams && <li>Delete engine streams older than {fields.engineStreamsExpire}</li>}\n {fields.workerStreams && <li>Delete worker streams older than {fields.workerStreamsExpire}</li>}\n {fields.stripAttributes && <li>Strip execution artifacts from completed jobs</li>}\n {fields.pruneTransient && <li>Delete transient (entity-less) jobs</li>}\n </ul>\n <div className=\"flex justify-end gap-3 pt-2\">\n <button onClick={() => setShowConfirm(false)} className=\"btn-secondary text-xs\">Cancel</button>\n <button\n onClick={handlePrune}\n className=\"bg-status-error text-white px-3 py-1.5 rounded-md text-xs hover:opacity-90 transition-opacity\"\n disabled={prune.isPending}\n >\n {prune.isPending ? 'Pruning...' : 'Confirm Prune'}\n </button>\n </div>\n </div>\n </Modal>\n </div>\n );\n}\n","import { useState, useEffect, useCallback } from 'react';\nimport { Info } from 'lucide-react';\nimport {\n useMaintenanceConfig,\n useUpdateMaintenanceConfig,\n type MaintenanceConfig,\n} from '../../../api/maintenance';\nimport { CRON_PRESETS } from '../../../lib/constants';\nimport { PruneFieldsEditor, DEFAULT_PRUNE_FIELDS, type PruneFields } from './controls';\n\n// ── Helpers ─────────────────────────────────────────────────────────────────\n\n/** Convert a MaintenanceConfig (rules array) into PruneFields for the editor. */\nfunction configToFields(config: MaintenanceConfig | undefined): PruneFields {\n if (!config?.rules?.length) return DEFAULT_PRUNE_FIELDS;\n const r = config.rules;\n const streamDelete = r.find((x) => x.target === 'streams' && x.action === 'delete');\n const jobDeleteTransient = r.find((x) => x.target === 'jobs' && x.action === 'delete' && x.hasEntity === false);\n const jobPrune = r.find((x) => x.target === 'jobs' && x.action === 'prune' && x.hasEntity === true);\n const jobDeletePruned = r.find((x) => x.target === 'jobs' && x.action === 'delete' && x.pruned === true);\n return {\n pruneJobs: !!jobDeletePruned,\n expire: jobDeletePruned?.olderThan ?? '180 days',\n engineStreams: !!streamDelete,\n engineStreamsExpire: streamDelete?.olderThan ?? '1 day',\n workerStreams: !!streamDelete,\n workerStreamsExpire: streamDelete?.olderThan ?? '90 days',\n stripAttributes: !!jobPrune,\n pruneTransient: !!jobDeleteTransient,\n };\n}\n\n/** Convert PruneFields back to a MaintenanceConfig rules array. */\nfunction fieldsToRules(f: PruneFields): MaintenanceConfig['rules'] {\n const rules: MaintenanceConfig['rules'] = [];\n if (f.engineStreams) {\n rules.push({ target: 'streams', action: 'delete', olderThan: f.engineStreamsExpire });\n }\n if (f.workerStreams && f.workerStreamsExpire !== f.engineStreamsExpire) {\n rules.push({ target: 'streams', action: 'delete', olderThan: f.workerStreamsExpire });\n }\n if (f.pruneTransient) {\n rules.push({ target: 'jobs', action: 'delete', olderThan: f.expire, hasEntity: false });\n }\n if (f.stripAttributes) {\n rules.push({ target: 'jobs', action: 'prune', olderThan: f.expire, hasEntity: true });\n }\n if (f.pruneJobs) {\n rules.push({ target: 'jobs', action: 'delete', olderThan: f.expire, pruned: true });\n }\n return rules;\n}\n\nfunction describeCron(expr: string): string {\n return CRON_PRESETS.find((p) => p.value === expr)?.label ?? '';\n}\n\n// ── Main ────────────────────────────────────────────────────────────────────\n\nexport function ScheduleSection() {\n const { data, isLoading } = useMaintenanceConfig();\n const updateConfig = useUpdateMaintenanceConfig();\n\n const [schedule, setSchedule] = useState('');\n const [fields, setFields] = useState<PruneFields>(DEFAULT_PRUNE_FIELDS);\n const [savedSnapshot, setSavedSnapshot] = useState('');\n\n // Sync from server config when loaded\n const syncFromServer = useCallback(() => {\n if (!data?.config) return;\n setSchedule(data.config.schedule);\n setFields(configToFields(data.config));\n setSavedSnapshot(JSON.stringify({ schedule: data.config.schedule, fields: configToFields(data.config) }));\n }, [data]);\n\n useEffect(() => { syncFromServer(); }, [syncFromServer]);\n\n const currentSnapshot = JSON.stringify({ schedule, fields });\n const isDirty = savedSnapshot !== '' && currentSnapshot !== savedSnapshot;\n const active = data?.active ?? false;\n\n const handleSave = () => {\n const rules = fieldsToRules(fields);\n updateConfig.mutate(\n { schedule, rules },\n {\n onSuccess: () => {\n setSavedSnapshot(JSON.stringify({ schedule, fields }));\n },\n },\n );\n };\n\n const handleRevert = () => {\n syncFromServer();\n };\n\n if (isLoading) {\n return <div className=\"animate-pulse h-40 bg-surface-sunken rounded\" />;\n }\n\n return (\n <div className=\"space-y-8\">\n {/* Cron schedule + status */}\n <div className=\"grid grid-cols-1 lg:grid-cols-[1fr_auto] gap-10\">\n <div>\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4\">\n Schedule\n </p>\n <div className=\"flex items-end gap-4\">\n <div>\n <label className=\"block text-[10px] text-text-tertiary mb-1\">Cron Expression</label>\n <input\n type=\"text\"\n value={schedule}\n onChange={(e) => setSchedule(e.target.value)}\n placeholder=\"0 2 * * *\"\n className=\"input text-xs font-mono w-48\"\n />\n </div>\n <div>\n <div className=\"flex items-center gap-1.5 h-8\">\n <span className={`w-1.5 h-1.5 rounded-full ${active ? 'bg-status-success' : 'bg-text-tertiary'}`} />\n <span className={`text-xs ${active ? 'text-status-success' : 'text-text-tertiary'}`}>\n {active ? 'Active' : 'Inactive'}\n </span>\n </div>\n </div>\n {describeCron(schedule) && (\n <p className=\"text-xs text-text-tertiary h-8 flex items-center\">{describeCron(schedule)}</p>\n )}\n </div>\n\n {/* Preset pills */}\n <div className=\"flex flex-wrap gap-1.5 mt-3\">\n {CRON_PRESETS.map((preset) => (\n <button\n key={preset.value}\n type=\"button\"\n onClick={() => setSchedule(preset.value)}\n className={`px-2.5 py-1 text-[10px] rounded-full transition-colors ${\n schedule === preset.value\n ? 'bg-accent/10 text-accent font-medium'\n : 'bg-surface-sunken text-text-tertiary hover:text-text-secondary'\n }`}\n >\n {preset.label}\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"lg:w-72\">\n <p className=\"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4\">\n How It Works\n </p>\n <div className=\"flex items-start gap-2 px-3 py-2 rounded bg-surface-sunken\">\n <Info className=\"w-3.5 h-3.5 text-text-tertiary shrink-0 mt-0.5\" />\n <p className=\"text-[10px] text-text-tertiary leading-relaxed\">\n Rules execute sequentially on each cron cycle. Engine streams can be pruned aggressively\n since they only contain internal routing data. Worker streams should be retained longer\n to preserve execution playback and input enrichment.\n </p>\n </div>\n </div>\n </div>\n\n {/* Same prune fields as Prune Now */}\n <PruneFieldsEditor fields={fields} onChange={setFields} />\n\n {/* Action bar */}\n <div className=\"flex items-center justify-between pt-2 border-t border-surface-border\">\n <div className=\"flex items-center gap-3\">\n {isDirty && (\n <button\n onClick={handleRevert}\n className=\"text-[10px] text-text-tertiary hover:text-text-primary transition-colors\"\n >\n Revert changes\n </button>\n )}\n {updateConfig.error && (\n <p className=\"text-xs text-status-error\">{(updateConfig.error as Error).message}</p>\n )}\n </div>\n <button\n onClick={handleSave}\n disabled={!isDirty || !schedule.trim() || updateConfig.isPending}\n className=\"btn-primary text-xs disabled:opacity-40 shrink-0\"\n >\n {updateConfig.isPending ? 'Saving...' : 'Save Schedule'}\n </button>\n </div>\n </div>\n );\n}\n","import { useState } from 'react';\nimport { Trash2, Clock, Info } from 'lucide-react';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { PruneSection } from './PruneSection';\nimport { ScheduleSection } from './ScheduleSection';\n\ntype Mode = 'prune' | 'schedule';\n\nfunction ModeToggle({ mode, onChange }: { mode: Mode; onChange: (m: Mode) => void }) {\n const btn = (m: Mode, icon: React.ReactNode, label: string) => (\n <button\n onClick={() => onChange(m)}\n className={`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors ${\n mode === m\n ? 'bg-accent/10 text-accent font-medium'\n : 'text-text-tertiary hover:text-text-secondary hover:bg-surface-hover'\n }`}\n >\n {icon}\n {label}\n </button>\n );\n\n return (\n <div className=\"flex gap-1 p-0.5 bg-surface-sunken rounded-lg w-fit\">\n {btn('prune', <Trash2 className=\"w-3.5 h-3.5\" />, 'Prune Now')}\n {btn('schedule', <Clock className=\"w-3.5 h-3.5\" />, 'Schedule')}\n </div>\n );\n}\n\nexport function MaintenancePage() {\n const [mode, setMode] = useState<Mode>('schedule');\n\n return (\n <div>\n <PageHeader\n title=\"DB Maintenance\"\n docsHash=\"#docs:dashboard.md:db-maintenance\"\n actions={<ModeToggle mode={mode} onChange={setMode} />}\n />\n\n <div className=\"flex items-start gap-2 px-4 py-3 mb-8 rounded-md bg-accent/5 border border-accent/10\">\n <Info className=\"w-4 h-4 text-accent shrink-0 mt-0.5\" />\n <p className=\"text-xs text-text-secondary leading-relaxed\">\n Workflow data grows as jobs complete. Operations are ordered safest-first: stream messages are\n always safe to prune, workflow reduction preserves results, and deletion is permanent.\n </p>\n </div>\n\n {mode === 'prune' ? <PruneSection /> : <ScheduleSection />}\n </div>\n );\n}\n"],"names":["useMaintenanceConfig","useQuery","apiFetch","useUpdateMaintenanceConfig","queryClient","useQueryClient","useMutation","config","usePrune","options","RetentionRow","checked","onToggle","label","hint","safety","value","onChange","SafetyIcon","ShieldCheck","ShieldAlert","ShieldOff","safetyColor","safetyLabel","jsxs","jsx","e","RETENTION_PERIOD_OPTIONS","opt","CleanupCallout","Info","DEFAULT_PRUNE_FIELDS","hasSelection","f","PruneFieldsEditor","fields","set","key","v","ResultCard","PruneSection","prune","setFields","useState","result","setResult","showConfirm","setShowConfirm","handlePrune","data","Modal","configToFields","_a","streamDelete","x","jobDeleteTransient","jobPrune","jobDeletePruned","fieldsToRules","rules","describeCron","expr","CRON_PRESETS","p","ScheduleSection","isLoading","updateConfig","schedule","setSchedule","savedSnapshot","setSavedSnapshot","syncFromServer","useCallback","useEffect","currentSnapshot","isDirty","active","handleSave","handleRevert","preset","ModeToggle","mode","btn","m","icon","Trash2","Clock","MaintenancePage","setMode","PageHeader"],"mappings":"2WA4CO,SAASA,GAAuB,CACrC,OAAOC,EAAyD,CAC9D,SAAU,CAAC,aAAa,EACxB,QAAS,IAAMC,EAAS,qBAAqB,CAAA,CAC9C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C3LA,SAASc,EAAW,CAAE,KAAAC,EAAM,SAAAhE,GAAyD,CACnF,MAAMiE,EAAM,CAACC,EAASC,EAAuBvE,IAC3CW,EAAAA,KAAC,SAAA,CACC,QAAS,IAAMP,EAASkE,CAAC,EACzB,UAAW,8EACTF,IAASE,EACL,uCACA,qEACN,GAEC,SAAA,CAAAC,EACAvE,CAAA,CAAA,CAAA,EAIL,OACEW,EAAAA,KAAC,MAAA,CAAI,UAAU,sDACZ,SAAA,CAAA0D,EAAI,QAASzD,EAAAA,IAAC4D,EAAA,CAAO,UAAU,aAAA,CAAc,EAAI,WAAW,EAC5DH,EAAI,WAAYzD,MAAC6D,GAAM,UAAU,aAAA,CAAc,EAAI,UAAU,CAAA,EAChE,CAEJ,CAEO,SAASC,IAAkB,CAChC,KAAM,CAACN,EAAMO,CAAO,EAAI7C,EAAAA,SAAe,UAAU,EAEjD,cACG,MAAA,CACC,SAAA,CAAAlB,EAAAA,IAACgE,EAAA,CACC,MAAM,iBACN,SAAS,oCACT,QAAShE,EAAAA,IAACuD,EAAA,CAAW,KAAAC,EAAY,SAAUO,CAAA,CAAS,CAAA,CAAA,EAGtDhE,EAAAA,KAAC,MAAA,CAAI,UAAU,uFACb,SAAA,CAAAC,EAAAA,IAACK,EAAA,CAAK,UAAU,qCAAA,CAAsC,EACtDL,EAAAA,IAAC,IAAA,CAAE,UAAU,8CAA8C,SAAA,uLAAA,CAG3D,CAAA,EACF,EAECwD,IAAS,QAAUxD,MAACe,EAAA,CAAA,CAAa,QAAMwB,EAAA,CAAA,CAAgB,CAAA,EAC1D,CAEJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as m,j as e}from"./vendor-query-B2UbickB.js";import{d as V,h as X,u as Y,i as Z,b as ee}from"./workflows-CkPv7xk-.js";import{C as te}from"./ConfirmDeleteModal-D9_1b4MW.js";import{R as L}from"./RolePill-Cl71eDUA.js";import{W as se}from"./WorkflowPill-IDjTRfQ8.js";import{P as re}from"./PageHeader-BhaWTWcM.js";import{ai as ne,t as O,ab as ae,aj as D,ad as $,ak as oe,P as Q,al as le,am as M,y as ie,U as F,X as z,i as B,V as H,W as T,C as ce}from"./vendor-icons-CEWCGPeJ.js";import{c as G,e as de,f as xe}from"./vendor-react-CXumBFUA.js";import{u as me}from"./roles-CFD2eYap.js";import{B as ue}from"./BotPicker-3wBcBavT.js";import{N as pe}from"./NamespacePill-CwKdoyRM.js";import"./index-Dgw1KKpq.js";import"./Modal-CSrxpXeM.js";import"./bots-Cb0WTwhY.js";function he({tier:t}){return t==="certified"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-status-success",children:[e.jsx($,{className:"w-3 h-3"}),"Certified"]}):t==="configured"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-text-secondary",children:[e.jsx(ie,{className:"w-3 h-3"}),"Configured"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-text-quaternary",children:[e.jsx(D,{className:"w-3 h-3"}),"Durable"]})}function De(){const t=G(),{data:n,isLoading:x}=V(),h=X(),[d,j]=m.useState(""),[a,u]=m.useState(null),[f,g]=m.useState(null),l=n??[],s=m.useMemo(()=>[...new Set(l.map(o=>o.task_queue).filter(Boolean))].sort(),[l]),i=m.useMemo(()=>{const o=d.toLowerCase().trim();return(a?[a]:s).map(w=>({queue:w,workflows:l.filter(b=>{var C;return b.task_queue===w&&(!o||b.workflow_type.toLowerCase().includes(o)||((C=b.description)==null?void 0:C.toLowerCase().includes(o)))})})).filter(w=>w.workflows.length>0)},[l,s,d,a]),p=m.useMemo(()=>{const o=d.toLowerCase().trim();return a?[]:l.filter(c=>{var w;return!c.task_queue&&(!o||c.workflow_type.toLowerCase().includes(o)||((w=c.description)==null?void 0:w.toLowerCase().includes(o)))})},[l,d,a]),N=o=>{o.registered?t(`/workflows/registry/${encodeURIComponent(o.workflow_type)}`):t(`/workflows/registry/new?workflow_type=${encodeURIComponent(o.workflow_type)}&task_queue=${encodeURIComponent(o.task_queue??"")}`)},_=()=>{f&&h.mutate(f,{onSuccess:()=>g(null)})};return e.jsxs("div",{children:[e.jsx(re,{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"})}),!x&&s.length>0&&e.jsx("div",{className:"sticky top-0 z-20 bg-surface pt-3 pb-3",children:e.jsxs("div",{className:"bg-[#F7F7F7] rounded-lg px-5 pt-3 pb-3 flex items-center gap-5",children:[e.jsxs("button",{onClick:()=>u(null),className:`flex flex-col items-center gap-1 transition-colors ${a===null?"text-accent":"text-text-quaternary hover:text-text-secondary"}`,children:[e.jsx(ne,{className:"w-3 h-3",strokeWidth:1.5}),e.jsx("span",{className:"text-[9px] font-medium",children:"All"})]}),s.map(o=>{const c=a===o,w=o.length>16?o.slice(0,14)+"…":o;return e.jsxs("button",{onClick:()=>u(c?null:o),className:`flex flex-col items-center gap-1 transition-colors ${c?"text-accent":"text-text-quaternary hover:text-text-secondary"}`,title:o,children:[e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5}),e.jsx("span",{className:"text-[9px] font-medium",children:w})]},o)}),e.jsx("span",{className:"flex-1"}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{className:"absolute left-0 top-1/2 -translate-y-1/2 w-3 h-3 text-text-quaternary"}),e.jsx("input",{type:"text",value:d,onChange:o=>j(o.target.value),placeholder:`Search ${l.length} workflows…`,className:"pl-5 py-1 text-sm bg-transparent border-b border-surface-border/60 text-text-primary placeholder:text-text-quaternary focus:outline-none focus:border-accent/50 transition-colors w-52"})]})]})}),x?e.jsx(fe,{}):i.length===0&&p.length===0?e.jsx("p",{className:"text-sm text-text-tertiary mt-8",children:d||a?"No workflows match your filter.":"No workflows discovered yet."}):e.jsxs("div",{className:"space-y-10",children:[i.map(({queue:o,workflows:c})=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[78px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(O,{className:"w-3 h-3 text-accent",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:o}),e.jsx("span",{className:"text-xs text-text-quaternary",children:c.length})]}),e.jsx(U,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:c.map(w=>e.jsx(J,{wf:w,onRowClick:N,onDelete:g,onNavigate:t},w.workflow_type))})]},o)),p.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[78px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(D,{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:p.length})]}),e.jsx(U,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:p.map(o=>e.jsx(J,{wf:o,onRowClick:N,onDelete:g,onNavigate:t},o.workflow_type))})]})]}),e.jsx(te,{open:!!f,onClose:()=>g(null),onConfirm:_,title:"De-certify Workflow",description:e.jsxs(e.Fragment,{children:["Remove certification from"," ",e.jsx("span",{className:"font-mono font-medium text-text-primary",children:f}),"? This removes interceptor guarantees, escalation chains, and invocation role constraints. The workflow will continue running as a standard durable workflow."]}),isPending:h.isPending,error:h.error})]})}const K="grid grid-cols-[minmax(0,1fr)_7rem_13rem_4.5rem] gap-x-6 items-start";function U(){return e.jsxs("div",{className:`${K} px-3 pb-2 pt-1`,children:[e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Workflow"}),e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Tier"}),e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Access"}),e.jsx("span",{})]})}function J({wf:t,onRowClick:n,onDelete:x,onNavigate:h}){const d=t.roles??[],j=t.invocation_roles??[];return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>n(t),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&n(t)},className:`group ${K} py-2.5 px-3 -mx-3 rounded-md cursor-pointer transition-colors`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(se,{type:t.workflow_type,size:"md",variant:t.tier==="certified"?"certified":t.tier==="configured"?"configured":"durable"}),t.description&&e.jsx("p",{className:"mt-0.5 text-[10px] text-text-tertiary group-hover:text-text-secondary leading-snug line-clamp-2 transition-colors",children:t.description})]}),e.jsx("div",{className:"pt-0.5",children:e.jsx(he,{tier:t.tier??"durable"})}),e.jsxs("div",{className:"min-w-0 space-y-1 pt-0.5",children:[d.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{title:"Escalation roles",children:e.jsx($,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),d.map(a=>e.jsx(L,{role:a},`e-${a}`))]}),j.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{title:"Invocation roles",children:e.jsx(oe,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),j.map(a=>e.jsx(L,{role:a},`i-${a}`))]}),d.length===0&&j.length===0&&e.jsx("span",{className:"text-xs text-text-quaternary",children:"—"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2.5 pt-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.invocable&&e.jsx("button",{title:"Invoke workflow",onClick:a=>{a.stopPropagation(),h(`/workflows/start?type=${encodeURIComponent(t.workflow_type)}&mode=now`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(Q,{className:"w-3.5 h-3.5"})}),t.tier==="durable"&&e.jsx("button",{title:"Configure workflow",onClick:a=>{a.stopPropagation(),h(`/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(D,{className:"w-3.5 h-3.5"})}),t.tier==="configured"&&e.jsx("button",{title:"Certify workflow",onClick:a=>{a.stopPropagation(),h(`/workflows/registry/${encodeURIComponent(t.workflow_type)}`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(le,{className:"w-3.5 h-3.5"})}),t.registered&&e.jsx("button",{title:"Remove configuration",onClick:a=>{a.stopPropagation(),x(t.workflow_type)},className:"text-text-quaternary hover:text-status-warning transition-colors",children:e.jsx(M,{className:"w-3.5 h-3.5"})})]})]})}function fe(){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(n=>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"})]},n))})]},t))})}function P({selected:t,onChange:n,single:x,placeholder:h}){const{data:d}=me(),j=(d==null?void 0:d.roles)??[],[a,u]=m.useState(!1),f=m.useRef(null);m.useEffect(()=>{const i=p=>{f.current&&!f.current.contains(p.target)&&u(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[]);const g=i=>{x?(n(t.includes(i)?[]:[i]),u(!1)):n(t.includes(i)?t.filter(p=>p!==i):[...t,i])},l=i=>{n(t.filter(p=>p!==i))},s=h??(x?"Select role...":"Add roles...");return e.jsxs("div",{ref:f,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>u(!a),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:s}),t.map(i=>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-[11px]",children:[e.jsx(F,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),i,e.jsx("span",{role:"button",onClick:p=>{p.stopPropagation(),l(i)},className:"ml-0.5 hover:text-status-error transition-colors",children:e.jsx(z,{className:"w-2.5 h-2.5"})})]},i)),e.jsx(B,{className:`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${a?"rotate-180":""}`})]}),a&&e.jsx("div",{className:"absolute z-20 mt-1 w-full bg-white border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto",children:j.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-tertiary",children:"No roles defined"}):j.map(i=>{const p=t.includes(i);return e.jsxs("button",{type:"button",onClick:()=>g(i),className:`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs transition-colors ${p?"bg-accent/[0.06] text-accent":"text-text-primary hover:bg-surface-sunken"}`,children:[e.jsx(F,{className:"w-3 h-3 shrink-0 text-accent/60"}),e.jsx("span",{className:"flex-1",children:i}),p&&e.jsx(H,{className:"w-3 h-3 shrink-0"})]},i)})})]})}function we({options:t,selected:n,onChange:x,placeholder:h}){const[d,j]=m.useState(!1),a=m.useRef(null);m.useEffect(()=>{const l=s=>{a.current&&!a.current.contains(s.target)&&j(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]);const u=l=>{x(n.includes(l)?n.filter(s=>s!==l):[...n,l])},f=l=>{x(n.filter(s=>s!==l))},g=h??"Add workflows...";return e.jsxs("div",{ref:a,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>j(!d),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:[n.length===0&&e.jsx("span",{className:"text-xs text-text-tertiary",children:g}),n.map(l=>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-[11px] font-mono",children:[e.jsx(T,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),l,e.jsx("span",{role:"button",onClick:s=>{s.stopPropagation(),f(l)},className:"ml-0.5 hover:text-status-error transition-colors",children:e.jsx(z,{className:"w-2.5 h-2.5"})})]},l)),e.jsx(B,{className:`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${d?"rotate-180":""}`})]}),d&&e.jsx("div",{className:"absolute z-20 mt-1 w-full bg-white border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto",children:t.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-tertiary",children:"No registered workflows"}):t.map(l=>{const s=n.includes(l);return e.jsxs("button",{type:"button",onClick:()=>u(l),className:`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs font-mono transition-colors ${s?"bg-accent/[0.06] text-accent":"text-text-primary hover:bg-surface-sunken"}`,children:[e.jsx(T,{className:"w-3 h-3 shrink-0 text-accent/60"}),e.jsx("span",{className:"flex-1",children:l}),s&&e.jsx(H,{className:"w-3 h-3 shrink-0"})]},l)})})]})}function q(t){return t.split(",").map(n=>n.trim()).filter(Boolean)}const W={workflow_type:"",description:"",task_queue:"",default_role:"reviewer",invocable:!1,roles:"",invocation_roles:"",consumes:"",envelope_schema:"",resolver_schema:"",cron_schedule:"",execute_as:"",certified:!1};function je(t){const n=(t.roles??[]).join(", "),x=(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:n,invocation_roles:(t.invocation_roles??[]).join(", "),consumes:x,envelope_schema:t.envelope_schema?JSON.stringify(t.envelope_schema,null,2):"",resolver_schema:t.resolver_schema?JSON.stringify(t.resolver_schema,null,2):"",cron_schedule:t.cron_schedule??"",execute_as:t.execute_as??"",certified:!!(n||x)}}function S(t){if(!t.trim())return!0;try{return JSON.parse(t),!0}catch{return!1}}function E({icon:t,color:n,children:x}){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 ${n}`,strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:x})]})}function v({label:t,hint:n,children:x}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"label",children:t}),x,n&&e.jsx("p",{className:"hint",children:n})]})}const A="input-json w-full";function R(t){return q(t)}function I(t){return t.join(", ")}const ge=new Set(["mcpQuery","mcpDeterministic","mcpQueryRouter","mcpTriage","mcpTriageRouter","mcpTriageDeterministic","insightQuery"]);function $e(){const{workflowType:t}=de(),n=!t,x=G(),[h]=xe(),{data:d,isLoading:j}=Y(),a=Z(),u=(d==null?void 0:d.find(r=>r.workflow_type===t))??null,{data:f}=ee({limit:500}),g=m.useMemo(()=>{const r=new Set((d??[]).map(y=>y.workflow_type));return[...new Set(((f==null?void 0:f.jobs)??[]).map(y=>y.entity))].filter(y=>!r.has(y)&&!ge.has(y)).sort()},[d,f]),l=m.useMemo(()=>{if(!n)return W;const r=h.get("workflow_type")??"",k=h.get("task_queue")??"";return r||k?{...W,workflow_type:r,task_queue:k}:W},[n,h]),[s,i]=m.useState(l),[p,N]=m.useState(""),[_,o]=m.useState(!1),c=m.useCallback((r,k)=>i(y=>({...y,[r]:k})),[]);m.useEffect(()=>{if(!_){if(n){i(l),o(!0);return}u&&(i(je(u)),o(!0))}},[u,n,_,l]);const w=()=>{if(!s.workflow_type.trim())return;N("");let r=null,k=null;try{s.envelope_schema.trim()&&(r=JSON.parse(s.envelope_schema))}catch{N("Invalid JSON in Envelope Schema");return}try{s.resolver_schema.trim()&&(k=JSON.parse(s.resolver_schema))}catch{N("Invalid JSON in Resolver Schema");return}a.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,roles:q(s.roles),invocation_roles:q(s.invocation_roles),consumes:q(s.consumes),envelope_schema:r,resolver_schema:k,cron_schedule:s.cron_schedule.trim()||null,execute_as:s.execute_as.trim()||null},{onSuccess:()=>x("/workflows/registry")})};if(j)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(!n&&!u)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Config not found."});const b=!!s.workflow_type.trim()&&S(s.envelope_schema)&&S(s.resolver_schema),C=n&&!s.workflow_type&&g.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:n?"New Workflow":(u==null?void 0:u.workflow_type)??""}),u&&e.jsx("div",{className:"flex items-center gap-2 mt-2",children:e.jsx(pe,{namespace:"durable"})})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[e.jsx("button",{onClick:()=>x("/workflows/registry"),className:"btn-ghost text-xs",children:"Cancel"}),e.jsx("button",{onClick:w,disabled:!b||a.isPending,className:"btn-primary text-xs",children:a.isPending?"Saving…":n?"Register":"Save"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-x-14 gap-y-10",children:[e.jsxs("div",{children:[e.jsx(E,{icon:ce,color:"text-accent",children:"Identity"}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(v,{label:"Workflow Type",hint:"Register a workflow to configure invocation and HITL escalation routing.",children:C?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:g.map(r=>e.jsx("button",{onClick:()=>c("workflow_type",r),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:r},r))}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"or"}),e.jsx("input",{type:"text",onChange:r=>c("workflow_type",r.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:r=>c("workflow_type",r.target.value),disabled:!n,placeholder:"reviewContent",className:"input font-mono w-full"}),n&&s.workflow_type&&g.length>0&&e.jsx("button",{onClick:()=>c("workflow_type",""),className:"text-[10px] text-accent hover:underline mt-1",children:"Choose from durable workflows"})]})}),e.jsx(v,{label:"Description",children:e.jsx("input",{type:"text",value:s.description,onChange:r=>c("description",r.target.value),placeholder:"Describe what this workflow does",className:"input text-xs w-full"})}),e.jsx(v,{label:"Task Queue",hint:"Durable task queue this workflow listens on.",children:e.jsx("input",{type:"text",value:s.task_queue,onChange:r=>c("task_queue",r.target.value),placeholder:"lt-review",className:"input font-mono w-full"})})]})]}),e.jsxs("div",{children:[e.jsx(E,{icon:Q,color:"text-emerald-400",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:r=>c("invocable",r.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(v,{label:"Run As",hint:"Bot identity to run under. Default runs as the invoking user.",children:e.jsx(ue,{selected:s.execute_as,onChange:r=>c("execute_as",r)})}),e.jsx(v,{label:"Invocation Roles",hint:"Only users with these roles can start this workflow. Empty = all authenticated users.",children:e.jsx(P,{selected:R(s.invocation_roles),onChange:r=>c("invocation_roles",I(r)),placeholder:"Select roles…"})}),e.jsxs(v,{label:"Envelope Schema",hint: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"}),"."]}),children:[e.jsx("textarea",{value:s.envelope_schema,onChange:r=>c("envelope_schema",r.target.value),placeholder:`{
|
|
1
|
+
import{a as m,j as e}from"./vendor-query-B2UbickB.js";import{d as V,h as X,u as Y,i as Z,b as ee}from"./workflows-Dps45zjk.js";import{C as te}from"./ConfirmDeleteModal-D9_1b4MW.js";import{R as L}from"./RolePill-CXEyPMqb.js";import{W as se}from"./WorkflowPill-BegV-iRF.js";import{P as re}from"./PageHeader-CFta2VaS.js";import{ai as ne,t as O,ab as ae,aj as D,ad as $,ak as oe,P as Q,al as le,am as M,y as ie,U as F,X as z,i as B,V as H,W as T,C as ce}from"./vendor-icons-BaQqUm-e.js";import{c as G,e as de,f as xe}from"./vendor-react-CXumBFUA.js";import{u as me}from"./roles-CCXZtqDr.js";import{B as ue}from"./BotPicker-MnI3OyE7.js";import{N as pe}from"./NamespacePill-DlqBTvFR.js";import"./index-BoZydcaW.js";import"./Modal-CSrxpXeM.js";import"./bots-CPHuAvjW.js";function he({tier:t}){return t==="certified"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-status-success",children:[e.jsx($,{className:"w-3 h-3"}),"Certified"]}):t==="configured"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-text-secondary",children:[e.jsx(ie,{className:"w-3 h-3"}),"Configured"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-text-quaternary",children:[e.jsx(D,{className:"w-3 h-3"}),"Durable"]})}function De(){const t=G(),{data:n,isLoading:x}=V(),h=X(),[d,j]=m.useState(""),[a,u]=m.useState(null),[f,g]=m.useState(null),l=n??[],s=m.useMemo(()=>[...new Set(l.map(o=>o.task_queue).filter(Boolean))].sort(),[l]),i=m.useMemo(()=>{const o=d.toLowerCase().trim();return(a?[a]:s).map(w=>({queue:w,workflows:l.filter(b=>{var C;return b.task_queue===w&&(!o||b.workflow_type.toLowerCase().includes(o)||((C=b.description)==null?void 0:C.toLowerCase().includes(o)))})})).filter(w=>w.workflows.length>0)},[l,s,d,a]),p=m.useMemo(()=>{const o=d.toLowerCase().trim();return a?[]:l.filter(c=>{var w;return!c.task_queue&&(!o||c.workflow_type.toLowerCase().includes(o)||((w=c.description)==null?void 0:w.toLowerCase().includes(o)))})},[l,d,a]),N=o=>{o.registered?t(`/workflows/registry/${encodeURIComponent(o.workflow_type)}`):t(`/workflows/registry/new?workflow_type=${encodeURIComponent(o.workflow_type)}&task_queue=${encodeURIComponent(o.task_queue??"")}`)},_=()=>{f&&h.mutate(f,{onSuccess:()=>g(null)})};return e.jsxs("div",{children:[e.jsx(re,{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"})}),!x&&s.length>0&&e.jsx("div",{className:"sticky top-0 z-20 bg-surface pt-3 pb-3",children:e.jsxs("div",{className:"bg-[#F7F7F7] rounded-lg px-5 pt-3 pb-3 flex items-center gap-5",children:[e.jsxs("button",{onClick:()=>u(null),className:`flex flex-col items-center gap-1 transition-colors ${a===null?"text-accent":"text-text-quaternary hover:text-text-secondary"}`,children:[e.jsx(ne,{className:"w-3 h-3",strokeWidth:1.5}),e.jsx("span",{className:"text-[9px] font-medium",children:"All"})]}),s.map(o=>{const c=a===o,w=o.length>16?o.slice(0,14)+"…":o;return e.jsxs("button",{onClick:()=>u(c?null:o),className:`flex flex-col items-center gap-1 transition-colors ${c?"text-accent":"text-text-quaternary hover:text-text-secondary"}`,title:o,children:[e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5}),e.jsx("span",{className:"text-[9px] font-medium",children:w})]},o)}),e.jsx("span",{className:"flex-1"}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{className:"absolute left-0 top-1/2 -translate-y-1/2 w-3 h-3 text-text-quaternary"}),e.jsx("input",{type:"text",value:d,onChange:o=>j(o.target.value),placeholder:`Search ${l.length} workflows…`,className:"pl-5 py-1 text-sm bg-transparent border-b border-surface-border/60 text-text-primary placeholder:text-text-quaternary focus:outline-none focus:border-accent/50 transition-colors w-52"})]})]})}),x?e.jsx(fe,{}):i.length===0&&p.length===0?e.jsx("p",{className:"text-sm text-text-tertiary mt-8",children:d||a?"No workflows match your filter.":"No workflows discovered yet."}):e.jsxs("div",{className:"space-y-10",children:[i.map(({queue:o,workflows:c})=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[78px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(O,{className:"w-3 h-3 text-accent",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:o}),e.jsx("span",{className:"text-xs text-text-quaternary",children:c.length})]}),e.jsx(U,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:c.map(w=>e.jsx(J,{wf:w,onRowClick:N,onDelete:g,onNavigate:t},w.workflow_type))})]},o)),p.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[78px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(D,{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:p.length})]}),e.jsx(U,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:p.map(o=>e.jsx(J,{wf:o,onRowClick:N,onDelete:g,onNavigate:t},o.workflow_type))})]})]}),e.jsx(te,{open:!!f,onClose:()=>g(null),onConfirm:_,title:"De-certify Workflow",description:e.jsxs(e.Fragment,{children:["Remove certification from"," ",e.jsx("span",{className:"font-mono font-medium text-text-primary",children:f}),"? This removes interceptor guarantees, escalation chains, and invocation role constraints. The workflow will continue running as a standard durable workflow."]}),isPending:h.isPending,error:h.error})]})}const K="grid grid-cols-[minmax(0,1fr)_7rem_13rem_4.5rem] gap-x-6 items-start";function U(){return e.jsxs("div",{className:`${K} px-3 pb-2 pt-1`,children:[e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Workflow"}),e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Tier"}),e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Access"}),e.jsx("span",{})]})}function J({wf:t,onRowClick:n,onDelete:x,onNavigate:h}){const d=t.roles??[],j=t.invocation_roles??[];return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>n(t),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&n(t)},className:`group ${K} py-2.5 px-3 -mx-3 rounded-md cursor-pointer transition-colors`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(se,{type:t.workflow_type,size:"md",variant:t.tier==="certified"?"certified":t.tier==="configured"?"configured":"durable"}),t.description&&e.jsx("p",{className:"mt-0.5 text-[10px] text-text-tertiary group-hover:text-text-secondary leading-snug line-clamp-2 transition-colors",children:t.description})]}),e.jsx("div",{className:"pt-0.5",children:e.jsx(he,{tier:t.tier??"durable"})}),e.jsxs("div",{className:"min-w-0 space-y-1 pt-0.5",children:[d.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{title:"Escalation roles",children:e.jsx($,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),d.map(a=>e.jsx(L,{role:a},`e-${a}`))]}),j.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{title:"Invocation roles",children:e.jsx(oe,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),j.map(a=>e.jsx(L,{role:a},`i-${a}`))]}),d.length===0&&j.length===0&&e.jsx("span",{className:"text-xs text-text-quaternary",children:"—"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2.5 pt-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.invocable&&e.jsx("button",{title:"Invoke workflow",onClick:a=>{a.stopPropagation(),h(`/workflows/start?type=${encodeURIComponent(t.workflow_type)}&mode=now`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(Q,{className:"w-3.5 h-3.5"})}),t.tier==="durable"&&e.jsx("button",{title:"Configure workflow",onClick:a=>{a.stopPropagation(),h(`/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(D,{className:"w-3.5 h-3.5"})}),t.tier==="configured"&&e.jsx("button",{title:"Certify workflow",onClick:a=>{a.stopPropagation(),h(`/workflows/registry/${encodeURIComponent(t.workflow_type)}`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(le,{className:"w-3.5 h-3.5"})}),t.registered&&e.jsx("button",{title:"Remove configuration",onClick:a=>{a.stopPropagation(),x(t.workflow_type)},className:"text-text-quaternary hover:text-status-warning transition-colors",children:e.jsx(M,{className:"w-3.5 h-3.5"})})]})]})}function fe(){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(n=>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"})]},n))})]},t))})}function P({selected:t,onChange:n,single:x,placeholder:h}){const{data:d}=me(),j=(d==null?void 0:d.roles)??[],[a,u]=m.useState(!1),f=m.useRef(null);m.useEffect(()=>{const i=p=>{f.current&&!f.current.contains(p.target)&&u(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[]);const g=i=>{x?(n(t.includes(i)?[]:[i]),u(!1)):n(t.includes(i)?t.filter(p=>p!==i):[...t,i])},l=i=>{n(t.filter(p=>p!==i))},s=h??(x?"Select role...":"Add roles...");return e.jsxs("div",{ref:f,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>u(!a),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:s}),t.map(i=>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-[11px]",children:[e.jsx(F,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),i,e.jsx("span",{role:"button",onClick:p=>{p.stopPropagation(),l(i)},className:"ml-0.5 hover:text-status-error transition-colors",children:e.jsx(z,{className:"w-2.5 h-2.5"})})]},i)),e.jsx(B,{className:`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${a?"rotate-180":""}`})]}),a&&e.jsx("div",{className:"absolute z-20 mt-1 w-full bg-white border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto",children:j.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-tertiary",children:"No roles defined"}):j.map(i=>{const p=t.includes(i);return e.jsxs("button",{type:"button",onClick:()=>g(i),className:`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs transition-colors ${p?"bg-accent/[0.06] text-accent":"text-text-primary hover:bg-surface-sunken"}`,children:[e.jsx(F,{className:"w-3 h-3 shrink-0 text-accent/60"}),e.jsx("span",{className:"flex-1",children:i}),p&&e.jsx(H,{className:"w-3 h-3 shrink-0"})]},i)})})]})}function we({options:t,selected:n,onChange:x,placeholder:h}){const[d,j]=m.useState(!1),a=m.useRef(null);m.useEffect(()=>{const l=s=>{a.current&&!a.current.contains(s.target)&&j(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]);const u=l=>{x(n.includes(l)?n.filter(s=>s!==l):[...n,l])},f=l=>{x(n.filter(s=>s!==l))},g=h??"Add workflows...";return e.jsxs("div",{ref:a,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>j(!d),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:[n.length===0&&e.jsx("span",{className:"text-xs text-text-tertiary",children:g}),n.map(l=>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-[11px] font-mono",children:[e.jsx(T,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),l,e.jsx("span",{role:"button",onClick:s=>{s.stopPropagation(),f(l)},className:"ml-0.5 hover:text-status-error transition-colors",children:e.jsx(z,{className:"w-2.5 h-2.5"})})]},l)),e.jsx(B,{className:`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${d?"rotate-180":""}`})]}),d&&e.jsx("div",{className:"absolute z-20 mt-1 w-full bg-white border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto",children:t.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-tertiary",children:"No registered workflows"}):t.map(l=>{const s=n.includes(l);return e.jsxs("button",{type:"button",onClick:()=>u(l),className:`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs font-mono transition-colors ${s?"bg-accent/[0.06] text-accent":"text-text-primary hover:bg-surface-sunken"}`,children:[e.jsx(T,{className:"w-3 h-3 shrink-0 text-accent/60"}),e.jsx("span",{className:"flex-1",children:l}),s&&e.jsx(H,{className:"w-3 h-3 shrink-0"})]},l)})})]})}function q(t){return t.split(",").map(n=>n.trim()).filter(Boolean)}const W={workflow_type:"",description:"",task_queue:"",default_role:"reviewer",invocable:!1,roles:"",invocation_roles:"",consumes:"",envelope_schema:"",resolver_schema:"",cron_schedule:"",execute_as:"",certified:!1};function je(t){const n=(t.roles??[]).join(", "),x=(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:n,invocation_roles:(t.invocation_roles??[]).join(", "),consumes:x,envelope_schema:t.envelope_schema?JSON.stringify(t.envelope_schema,null,2):"",resolver_schema:t.resolver_schema?JSON.stringify(t.resolver_schema,null,2):"",cron_schedule:t.cron_schedule??"",execute_as:t.execute_as??"",certified:!!(n||x)}}function S(t){if(!t.trim())return!0;try{return JSON.parse(t),!0}catch{return!1}}function E({icon:t,color:n,children:x}){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 ${n}`,strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:x})]})}function v({label:t,hint:n,children:x}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"label",children:t}),x,n&&e.jsx("p",{className:"hint",children:n})]})}const A="input-json w-full";function R(t){return q(t)}function I(t){return t.join(", ")}const ge=new Set(["mcpQuery","mcpDeterministic","mcpQueryRouter","mcpTriage","mcpTriageRouter","mcpTriageDeterministic","insightQuery"]);function $e(){const{workflowType:t}=de(),n=!t,x=G(),[h]=xe(),{data:d,isLoading:j}=Y(),a=Z(),u=(d==null?void 0:d.find(r=>r.workflow_type===t))??null,{data:f}=ee({limit:500}),g=m.useMemo(()=>{const r=new Set((d??[]).map(y=>y.workflow_type));return[...new Set(((f==null?void 0:f.jobs)??[]).map(y=>y.entity))].filter(y=>!r.has(y)&&!ge.has(y)).sort()},[d,f]),l=m.useMemo(()=>{if(!n)return W;const r=h.get("workflow_type")??"",k=h.get("task_queue")??"";return r||k?{...W,workflow_type:r,task_queue:k}:W},[n,h]),[s,i]=m.useState(l),[p,N]=m.useState(""),[_,o]=m.useState(!1),c=m.useCallback((r,k)=>i(y=>({...y,[r]:k})),[]);m.useEffect(()=>{if(!_){if(n){i(l),o(!0);return}u&&(i(je(u)),o(!0))}},[u,n,_,l]);const w=()=>{if(!s.workflow_type.trim())return;N("");let r=null,k=null;try{s.envelope_schema.trim()&&(r=JSON.parse(s.envelope_schema))}catch{N("Invalid JSON in Envelope Schema");return}try{s.resolver_schema.trim()&&(k=JSON.parse(s.resolver_schema))}catch{N("Invalid JSON in Resolver Schema");return}a.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,roles:q(s.roles),invocation_roles:q(s.invocation_roles),consumes:q(s.consumes),envelope_schema:r,resolver_schema:k,cron_schedule:s.cron_schedule.trim()||null,execute_as:s.execute_as.trim()||null},{onSuccess:()=>x("/workflows/registry")})};if(j)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(!n&&!u)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Config not found."});const b=!!s.workflow_type.trim()&&S(s.envelope_schema)&&S(s.resolver_schema),C=n&&!s.workflow_type&&g.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:n?"New Workflow":(u==null?void 0:u.workflow_type)??""}),u&&e.jsx("div",{className:"flex items-center gap-2 mt-2",children:e.jsx(pe,{namespace:"durable"})})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[e.jsx("button",{onClick:()=>x("/workflows/registry"),className:"btn-ghost text-xs",children:"Cancel"}),e.jsx("button",{onClick:w,disabled:!b||a.isPending,className:"btn-primary text-xs",children:a.isPending?"Saving…":n?"Register":"Save"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-x-14 gap-y-10",children:[e.jsxs("div",{children:[e.jsx(E,{icon:ce,color:"text-accent",children:"Identity"}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(v,{label:"Workflow Type",hint:"Register a workflow to configure invocation and HITL escalation routing.",children:C?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:g.map(r=>e.jsx("button",{onClick:()=>c("workflow_type",r),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:r},r))}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"or"}),e.jsx("input",{type:"text",onChange:r=>c("workflow_type",r.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:r=>c("workflow_type",r.target.value),disabled:!n,placeholder:"reviewContent",className:"input font-mono w-full"}),n&&s.workflow_type&&g.length>0&&e.jsx("button",{onClick:()=>c("workflow_type",""),className:"text-[10px] text-accent hover:underline mt-1",children:"Choose from durable workflows"})]})}),e.jsx(v,{label:"Description",children:e.jsx("input",{type:"text",value:s.description,onChange:r=>c("description",r.target.value),placeholder:"Describe what this workflow does",className:"input text-xs w-full"})}),e.jsx(v,{label:"Task Queue",hint:"Durable task queue this workflow listens on.",children:e.jsx("input",{type:"text",value:s.task_queue,onChange:r=>c("task_queue",r.target.value),placeholder:"lt-review",className:"input font-mono w-full"})})]})]}),e.jsxs("div",{children:[e.jsx(E,{icon:Q,color:"text-emerald-400",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:r=>c("invocable",r.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(v,{label:"Run As",hint:"Bot identity to run under. Default runs as the invoking user.",children:e.jsx(ue,{selected:s.execute_as,onChange:r=>c("execute_as",r)})}),e.jsx(v,{label:"Invocation Roles",hint:"Only users with these roles can start this workflow. Empty = all authenticated users.",children:e.jsx(P,{selected:R(s.invocation_roles),onChange:r=>c("invocation_roles",I(r)),placeholder:"Select roles…"})}),e.jsxs(v,{label:"Envelope Schema",hint: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"}),"."]}),children:[e.jsx("textarea",{value:s.envelope_schema,onChange:r=>c("envelope_schema",r.target.value),placeholder:`{
|
|
2
2
|
"data": {},
|
|
3
3
|
"metadata": {}
|
|
4
4
|
}`,className:A,rows:8,spellCheck:!1}),s.envelope_schema.trim()&&!S(s.envelope_schema)&&e.jsx("p",{className:"text-[10px] text-status-error mt-1",children:"Invalid JSON"})]})]}):e.jsxs("p",{className:"text-[11px] 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",{children:[e.jsx(E,{icon:$,color:"text-violet-400",children:"Certification"}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs(v,{label:"Resolver Schema",hint:e.jsxs(e.Fragment,{children:["Default form for resolving escalations. Use ",e.jsx("code",{className:"font-mono",children:"properties"})," with ",e.jsx("code",{className:"font-mono",children:"type"}),", ",e.jsx("code",{className:"font-mono",children:"default"}),", ",e.jsx("code",{className:"font-mono",children:"description"}),"."]}),children:[e.jsx("textarea",{value:s.resolver_schema,onChange:r=>c("resolver_schema",r.target.value),placeholder:`{
|
|
@@ -6,4 +6,4 @@ import{a as m,j as e}from"./vendor-query-B2UbickB.js";import{d as V,h as X,u as
|
|
|
6
6
|
"approved": { "type": "boolean", "default": false }
|
|
7
7
|
}
|
|
8
8
|
}`,className:A,rows:6,spellCheck:!1}),s.resolver_schema.trim()&&!S(s.resolver_schema)&&e.jsx("p",{className:"text-[10px] text-status-error mt-1",children:"Invalid JSON"})]}),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.certified,onChange:r=>c("certified",r.target.checked),className:"w-4 h-4 rounded border-border accent-accent"}),e.jsx("span",{className:"text-xs text-text-primary font-medium",children:"Certify for HITL Escalation"})]}),e.jsx("p",{className:"hint",children:"Certified workflows use the interceptor — failures escalate to human reviewers."})]}),s.certified?e.jsxs(e.Fragment,{children:[e.jsx(v,{label:"Default Escalation Role",hint:"Users assigned escalations by default.",children:e.jsx(P,{selected:R(s.default_role),onChange:r=>c("default_role",r[0]??""),single:!0,placeholder:"Select role…"})}),e.jsx(v,{label:"Escalation Roles",hint:"Users who can claim and resolve escalations.",children:e.jsx(P,{selected:R(s.roles),onChange:r=>c("roles",I(r)),placeholder:"Select roles…"})}),e.jsx(v,{label:"Consumes",hint:"Upstream workflows whose output is injected into this workflow's envelope.",children:e.jsx(we,{options:(d??[]).map(r=>r.workflow_type).filter(r=>r!==s.workflow_type),selected:R(s.consumes),onChange:r=>c("consumes",I(r)),placeholder:"Select dependencies…"})})]}):e.jsxs("p",{className:"text-[11px] text-text-tertiary py-2",children:["Enable ",e.jsx("span",{className:"font-medium text-text-secondary",children:"Certify"})," to add automatic escalation routing and role-based resolution."]}),u&&e.jsx("div",{className:"pt-4 border-t border-surface-border/50",children:e.jsxs("button",{onClick:()=>x("/workflows/registry"),className:"flex items-center gap-1.5 text-[11px] text-status-warning hover:underline",title:"Remove configuration",children:[e.jsx(M,{className:"w-3 h-3"})," Remove configuration"]})})]})]})]}),(p||a.error)&&e.jsx("p",{className:"text-xs text-status-error mt-8",children:p||a.error.message})]})}export{$e as WorkflowConfigDetailPage,De as WorkflowConfigsPage};
|
|
9
|
-
//# sourceMappingURL=index-
|
|
9
|
+
//# sourceMappingURL=index-ChniBGqD.js.map
|