@hotmeshio/long-tail 0.21.2 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/escalations/accumulate.d.ts +10 -1
- package/build/api/escalations/accumulate.js +83 -15
- package/build/api/escalations/metadata.d.ts +5 -0
- package/build/api/escalations/metadata.js +6 -2
- package/build/api/scan-codes/choice.js +3 -2
- package/build/api/scan-codes/verbs.d.ts +6 -1
- package/build/api/scan-codes/verbs.js +13 -3
- package/build/api/workflows/invocation.d.ts +8 -4
- package/build/api/workflows/invocation.js +26 -9
- package/build/lib/cli/commands/workflows.js +9 -4
- package/build/lib/db/index.d.ts +8 -3
- package/build/lib/db/index.js +24 -2
- package/build/routes/escalations/accumulate.js +13 -6
- package/build/sdk/index.d.ts +3 -0
- package/build/services/escalation/crud.d.ts +2 -2
- package/build/services/escalation/crud.js +4 -2
- package/build/services/escalation/facet-sql.js +8 -0
- package/build/services/escalation/facets.js +4 -1
- package/build/services/escalation/sql.d.ts +4 -2
- package/build/services/escalation/sql.js +10 -2
- package/build/services/export/index.d.ts +8 -3
- package/build/services/export/index.js +15 -21
- package/build/services/pipelines/events.js +2 -1
- package/build/services/pipelines/execution-builder.js +2 -1
- package/build/services/pipelines/queries.js +2 -1
- package/build/services/scan-code/validate.js +19 -0
- package/build/services/workflow-state.d.ts +21 -0
- package/build/services/workflow-state.js +39 -0
- package/build/shared/workflow-state.d.ts +17 -0
- package/build/shared/workflow-state.js +29 -0
- package/build/system/mcp-servers/admin/escalations.js +8 -4
- package/build/system/mcp-servers/admin/schemas.d.ts +40 -2
- package/build/system/mcp-servers/admin/schemas.js +4 -0
- package/build/system/mcp-servers/admin/workflows.js +20 -31
- package/build/system/seed/tool-manifests-admin.d.ts +94 -0
- package/build/system/seed/tool-manifests-admin.js +3 -3
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/facets.d.ts +14 -0
- package/build/types/index.d.ts +1 -1
- package/build/types/scan-code.d.ts +10 -1
- package/build/types/scan-code.js +0 -11
- package/dashboard/dist/assets/{AdminDashboard-Covdam48.js → AdminDashboard-BbWve-Ax.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-Covdam48.js.map → AdminDashboard-BbWve-Ax.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-CE1k6J5r.js → AgentConfigPage-M-9eTKhP.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-CE1k6J5r.js.map → AgentConfigPage-M-9eTKhP.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-CWJZIZP1.js → AgentDetailPage-CsakSlx5.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-CWJZIZP1.js.map → AgentDetailPage-CsakSlx5.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage---Dg5ufF.js → AgentsPage-Cj_cRTT1.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage---Dg5ufF.js.map → AgentsPage-Cj_cRTT1.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-BXJmMBM1.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-BXJmMBM1.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-D3drO3-T.js → BotPicker-CGB16rYU.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-D3drO3-T.js.map → BotPicker-CGB16rYU.js.map} +1 -1
- package/dashboard/dist/assets/{BulkAssignModal-BOAWsViq.js → BulkAssignModal-MjxcU7N1.js} +2 -2
- package/dashboard/dist/assets/{BulkAssignModal-BOAWsViq.js.map → BulkAssignModal-MjxcU7N1.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-RGgD3YZO.js → CapabilitiesPage-BxadotXn.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-RGgD3YZO.js.map → CapabilitiesPage-BxadotXn.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-DNkZn87n.js → CollapsibleSection-BBNpP-6h.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-DNkZn87n.js.map → CollapsibleSection-BBNpP-6h.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-BqzOwhPr.js → ConfirmDeleteModal-D_kAbT_D.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-BqzOwhPr.js.map → ConfirmDeleteModal-D_kAbT_D.js.map} +1 -1
- package/dashboard/dist/assets/{CountdownTimer-BaexQMK6.js → CountdownTimer-CI_JOAvk.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-BaexQMK6.js.map → CountdownTimer-CI_JOAvk.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-D7abp0aS.js → CredentialsPage-C9OA1Q2J.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-D7abp0aS.js.map → CredentialsPage-C9OA1Q2J.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-DZiWmTwJ.js → CronLabel-sxLLBf2I.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-DZiWmTwJ.js.map → CronLabel-sxLLBf2I.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-f1o-GLM8.js → DropZone-B1Tdfddc.js} +2 -2
- package/dashboard/dist/assets/{DropZone-f1o-GLM8.js.map → DropZone-B1Tdfddc.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-BdGO_w4v.js → ElapsedCell-jH9m8Dgl.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-BdGO_w4v.js.map → ElapsedCell-jH9m8Dgl.js.map} +1 -1
- package/dashboard/dist/assets/{EntityTimelinePanel-DIDcF5Yu.js → EntityTimelinePanel-Dl3Nr2kk.js} +2 -2
- package/dashboard/dist/assets/{EntityTimelinePanel-DIDcF5Yu.js.map → EntityTimelinePanel-Dl3Nr2kk.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-C28rn9XC.js → EscalationListSchemaPage-DAK6It5J.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-C28rn9XC.js.map → EscalationListSchemaPage-DAK6It5J.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListView-CkBnkpDJ.js → EscalationListView-CAHbdxKR.js} +2 -2
- package/dashboard/dist/assets/{EscalationListView-CkBnkpDJ.js.map → EscalationListView-CAHbdxKR.js.map} +1 -1
- package/dashboard/dist/assets/EscalationSchemaPage-DotfAMCL.js +9 -0
- package/dashboard/dist/assets/EscalationSchemaPage-DotfAMCL.js.map +1 -0
- package/dashboard/dist/assets/EscalationTimeline-DqmFydnU.js +2 -0
- package/dashboard/dist/assets/EscalationTimeline-DqmFydnU.js.map +1 -0
- package/dashboard/dist/assets/{EscalationTitleSelect-CzKfavri.js → EscalationTitleSelect-BpRquguO.js} +2 -2
- package/dashboard/dist/assets/{EscalationTitleSelect-CzKfavri.js.map → EscalationTitleSelect-BpRquguO.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-Tdu3Yx2c.js → EscalationsOverview-DtGOqnP4.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-Tdu3Yx2c.js.map → EscalationsOverview-DtGOqnP4.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-DiIxOJwO.js → EventTable-DSHqKyX2.js} +2 -2
- package/dashboard/dist/assets/{EventTable-DiIxOJwO.js.map → EventTable-DSHqKyX2.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-CvMBCVIo.js → FilterBar-Dxd0wNSW.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-CvMBCVIo.js.map → FilterBar-Dxd0wNSW.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-DO-yyhi6.js → GraphInvokePage-ChqqGkro.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-DO-yyhi6.js.map → GraphInvokePage-ChqqGkro.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-DSS3eHR2.js → HomePage-ByKesG8w.js} +2 -2
- package/dashboard/dist/assets/{HomePage-DSS3eHR2.js.map → HomePage-ByKesG8w.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-C3-Tqqub.js → ListToolbar-Ddz_S2av.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-C3-Tqqub.js.map → ListToolbar-Ddz_S2av.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-DEJmsdVi.js → McpOverview-CVe13tEv.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-DEJmsdVi.js.map → McpOverview-CVe13tEv.js.map} +1 -1
- package/dashboard/dist/assets/McpQueryDetailPage-BQYF2Mjq.js +5 -0
- package/dashboard/dist/assets/McpQueryDetailPage-BQYF2Mjq.js.map +1 -0
- package/dashboard/dist/assets/{McpQueryPage-BBcG_UuU.js → McpQueryPage-DZi5lm7s.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-BBcG_UuU.js.map → McpQueryPage-DZi5lm7s.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-C6xw0kBg.js → McpRunDetailPage-DreARTE1.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-C6xw0kBg.js.map → McpRunDetailPage-DreARTE1.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-CRQqrF4Q.js → McpRunsPage-DmO0YVhT.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-CRQqrF4Q.js.map → McpRunsPage-DmO0YVhT.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-DADRJOUl.js → NamespacePill-DwM5pNA4.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-DADRJOUl.js.map → NamespacePill-DwM5pNA4.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-Dlfwzf-0.js → OperationsPage-DpjCO85T.js} +2 -2
- package/dashboard/dist/assets/{OperationsPage-Dlfwzf-0.js.map → OperationsPage-DpjCO85T.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-DoiDGZ9R.js → OperatorDashboard-Vv_MEBkv.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-DoiDGZ9R.js.map → OperatorDashboard-Vv_MEBkv.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-Csq434-v.js → PageHeader-CMd3f4bz.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-Csq434-v.js.map → PageHeader-CMd3f4bz.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-CSnk1p5A.js → PageHeaderWithStats-DHj8Mqox.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-CSnk1p5A.js.map → PageHeaderWithStats-DHj8Mqox.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-BzbA4Prr.js → PersonaDetailPage-CW-2uBHY.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-BzbA4Prr.js.map → PersonaDetailPage-CW-2uBHY.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-B36yn4hU.js → PersonasPage-CO6yYQdm.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-B36yn4hU.js.map → PersonasPage-CO6yYQdm.js.map} +1 -1
- package/dashboard/dist/assets/{PortalPage-BkD4YfDf.js → PortalPage-DcNqhBlg.js} +2 -2
- package/dashboard/dist/assets/{PortalPage-BkD4YfDf.js.map → PortalPage-DcNqhBlg.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-BT0eiBWY.js → ProcessDetailPage-BuipGZcC.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-BT0eiBWY.js.map → ProcessDetailPage-BuipGZcC.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-BEqeeNae.js → ProcessesListPage-D9DYntvl.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-BEqeeNae.js.map → ProcessesListPage-D9DYntvl.js.map} +1 -1
- package/dashboard/dist/assets/ResolverForm-BVG8X0sS.js +8 -0
- package/dashboard/dist/assets/ResolverForm-BVG8X0sS.js.map +1 -0
- package/dashboard/dist/assets/{RoleDetailPage-BFuLNJXa.js → RoleDetailPage-KCXDqoJz.js} +3 -3
- package/dashboard/dist/assets/{RoleDetailPage-BFuLNJXa.js.map → RoleDetailPage-KCXDqoJz.js.map} +1 -1
- package/dashboard/dist/assets/{RolePill-BafrASDX.js → RolePill-Di2CAHuD.js} +2 -2
- package/dashboard/dist/assets/{RolePill-BafrASDX.js.map → RolePill-Di2CAHuD.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-80quJU5-.js → RolesPage-0QJOBSzF.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-80quJU5-.js.map → RolesPage-0QJOBSzF.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-BoePhWVD.js → RunAsSelector-Dh4lyyRo.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-BoePhWVD.js.map → RunAsSelector-Dh4lyyRo.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-Cu1bKEix.js → ScanCodesPage-CUhCz-Yr.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-Cu1bKEix.js.map → ScanCodesPage-CUhCz-Yr.js.map} +1 -1
- package/dashboard/dist/assets/{ScanSchemeDetailPage-D9AbS6UY.js → ScanSchemeDetailPage-qzXKNqJK.js} +2 -2
- package/dashboard/dist/assets/{ScanSchemeDetailPage-D9AbS6UY.js.map → ScanSchemeDetailPage-qzXKNqJK.js.map} +1 -1
- package/dashboard/dist/assets/{ScanStationPage-gcZGefvT.js → ScanStationPage-D8e8cG3t.js} +2 -2
- package/dashboard/dist/assets/{ScanStationPage-gcZGefvT.js.map → ScanStationPage-D8e8cG3t.js.map} +1 -1
- package/dashboard/dist/assets/{ScopeBadge-b6MIBiYD.js → ScopeBadge-CSItPVOH.js} +2 -2
- package/dashboard/dist/assets/{ScopeBadge-b6MIBiYD.js.map → ScopeBadge-CSItPVOH.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-9ITrei_d.js → StickyPagination-BSUyf5ja.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-9ITrei_d.js.map → StickyPagination-BSUyf5ja.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-BkYvEHFY.js → StreamMessageDetail--tp7l2Sd.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-BkYvEHFY.js.map → StreamMessageDetail--tp7l2Sd.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-B1rotFix.js → SwimlaneTimeline-CxBZ2THh.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-B1rotFix.js.map → SwimlaneTimeline-CxBZ2THh.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-ZrIIrEUP.js → TagInput-CAgdLN_b.js} +2 -2
- package/dashboard/dist/assets/{TagInput-ZrIIrEUP.js.map → TagInput-CAgdLN_b.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-zhn_U_eC.js → TaskDetailPage-BJ1QrmPH.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-zhn_U_eC.js.map → TaskDetailPage-BJ1QrmPH.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-DkQ1uc6y.js → TaskQueuePill-h0oorVMe.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-DkQ1uc6y.js.map → TaskQueuePill-h0oorVMe.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-CNbNeagx.js → TasksListPage-5BydGWmt.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-CNbNeagx.js.map → TasksListPage-5BydGWmt.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-0YVMBwls.js → TimeAgo-CCnz84Y4.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-0YVMBwls.js.map → TimeAgo-CCnz84Y4.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-DB7r3np8.js → TimestampCell-D0ru7Lya.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-DB7r3np8.js.map → TimestampCell-D0ru7Lya.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-Baxm02L6.js → ToolPill-CQCsVdzD.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-Baxm02L6.js.map → ToolPill-CQCsVdzD.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-BLfA02wv.js → ToolTestPanel-3Kpofmen.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-BLfA02wv.js.map → ToolTestPanel-3Kpofmen.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-eAqPKShq.js → TopicDetailPage-BaBXD_AK.js} +4 -4
- package/dashboard/dist/assets/{TopicDetailPage-eAqPKShq.js.map → TopicDetailPage-BaBXD_AK.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-BNNWD-zl.js → TopicsPage-Cnm1AAjh.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-BNNWD-zl.js.map → TopicsPage-Cnm1AAjh.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-Pw46tO_k.js → UserName-CXsdPiMZ.js} +2 -2
- package/dashboard/dist/assets/{UserName-Pw46tO_k.js.map → UserName-CXsdPiMZ.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-DvA51lT3.js → WorkflowExecutionPage-zx3AUJFd.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-DvA51lT3.js.map → WorkflowExecutionPage-zx3AUJFd.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-ZepbO_ny.js → WorkflowPill-Dg7BDTyM.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-ZepbO_ny.js.map → WorkflowPill-Dg7BDTyM.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-DFDTwnhn.js → WorkflowsDashboard-DfAGK1l7.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-DFDTwnhn.js.map → WorkflowsDashboard-DfAGK1l7.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-5i2Tcy-p.js → WorkflowsOverview-QIYvoa13.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-5i2Tcy-p.js.map → WorkflowsOverview-QIYvoa13.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-p4VEYZS0.js → YamlWorkflowDetailPage-DGgO3hyB.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-p4VEYZS0.js.map → YamlWorkflowDetailPage-DGgO3hyB.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-Cq-hMVxl.js → YamlWorkflowsPage-CEsHm0B9.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-Cq-hMVxl.js.map → YamlWorkflowsPage-CEsHm0B9.js.map} +1 -1
- package/dashboard/dist/assets/{agents-EyBPJMYa.js → agents-v_HH3Rji.js} +2 -2
- package/dashboard/dist/assets/{agents-EyBPJMYa.js.map → agents-v_HH3Rji.js.map} +1 -1
- package/dashboard/dist/assets/{bots-DX6jjqtF.js → bots-bwvWYrXz.js} +2 -2
- package/dashboard/dist/assets/{bots-DX6jjqtF.js.map → bots-bwvWYrXz.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-ZdLv9xBQ.js → capabilities-D4vaw_nQ.js} +2 -2
- package/dashboard/dist/assets/{capabilities-ZdLv9xBQ.js.map → capabilities-D4vaw_nQ.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-CpvZaJuw.js → controlplane-CiiZ6LJF.js} +2 -2
- package/dashboard/dist/assets/{controlplane-CpvZaJuw.js.map → controlplane-CiiZ6LJF.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-Mvsze5eV.js → escalation-columns-Dv-MB3eC.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-Mvsze5eV.js.map → escalation-columns-Dv-MB3eC.js.map} +1 -1
- package/dashboard/dist/assets/{index-oFKUFGQL.js → index-2tzsxFat.js} +2 -2
- package/dashboard/dist/assets/{index-oFKUFGQL.js.map → index-2tzsxFat.js.map} +1 -1
- package/dashboard/dist/assets/{index-DZhtP2Ok.js → index-BLB77tc8.js} +2 -2
- package/dashboard/dist/assets/{index-DZhtP2Ok.js.map → index-BLB77tc8.js.map} +1 -1
- package/dashboard/dist/assets/{index-PfSRKerc.js → index-C3WutFpT.js} +2 -2
- package/dashboard/dist/assets/{index-PfSRKerc.js.map → index-C3WutFpT.js.map} +1 -1
- package/dashboard/dist/assets/{index-DkrBFFSO.js → index-C4Lce2ET.js} +2 -2
- package/dashboard/dist/assets/{index-DkrBFFSO.js.map → index-C4Lce2ET.js.map} +1 -1
- package/dashboard/dist/assets/index-CT-FN6CW.js +3 -0
- package/dashboard/dist/assets/index-CT-FN6CW.js.map +1 -0
- package/dashboard/dist/assets/{index-Eo-l3Lqo.js → index-C_ISDOWJ.js} +2 -2
- package/dashboard/dist/assets/{index-Eo-l3Lqo.js.map → index-C_ISDOWJ.js.map} +1 -1
- package/dashboard/dist/assets/{index-Bhb89oHH.js → index-CcuvGdvf.js} +2 -2
- package/dashboard/dist/assets/{index-Bhb89oHH.js.map → index-CcuvGdvf.js.map} +1 -1
- package/dashboard/dist/assets/{index-BbCjGO3M.js → index-CjenRVX_.js} +2 -2
- package/dashboard/dist/assets/{index-BbCjGO3M.js.map → index-CjenRVX_.js.map} +1 -1
- package/dashboard/dist/assets/{index-DGmzBY9D.js → index-CzjUgFt_.js} +2 -2
- package/dashboard/dist/assets/{index-DGmzBY9D.js.map → index-CzjUgFt_.js.map} +1 -1
- package/dashboard/dist/assets/{index-D-Xs4rAW.js → index-D2VKBMng.js} +2 -2
- package/dashboard/dist/assets/{index-D-Xs4rAW.js.map → index-D2VKBMng.js.map} +1 -1
- package/dashboard/dist/assets/{index-z5Hpeidu.js → index-D6pBLZFu.js} +2 -2
- package/dashboard/dist/assets/{index-z5Hpeidu.js.map → index-D6pBLZFu.js.map} +1 -1
- package/dashboard/dist/assets/{index-Cn8uJsd7.js → index-IJmtbuLh.js} +2 -2
- package/dashboard/dist/assets/{index-Cn8uJsd7.js.map → index-IJmtbuLh.js.map} +1 -1
- package/dashboard/dist/assets/{index-CgUcYveM.js → index-N71QQ3J5.js} +5 -5
- package/dashboard/dist/assets/index-N71QQ3J5.js.map +1 -0
- package/dashboard/dist/assets/{knowledge-CgloEkaf.js → knowledge-D1YP2NzS.js} +2 -2
- package/dashboard/dist/assets/{knowledge-CgloEkaf.js.map → knowledge-D1YP2NzS.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-Bix7QYO7.js → mcp-Bb5psC61.js} +2 -2
- package/dashboard/dist/assets/{mcp-Bix7QYO7.js.map → mcp-Bb5psC61.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-o-sGX2ST.js → mcp-query-D5jUdZwN.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-o-sGX2ST.js.map → mcp-query-D5jUdZwN.js.map} +1 -1
- package/dashboard/dist/assets/{personas-30azkJ_s.js → personas-CDndbkp4.js} +2 -2
- package/dashboard/dist/assets/{personas-30azkJ_s.js.map → personas-CDndbkp4.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-Bfk2GFK7.js → pipelines-Dq3kNhKu.js} +2 -2
- package/dashboard/dist/assets/{pipelines-Bfk2GFK7.js.map → pipelines-Dq3kNhKu.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-CpdopewW.js → tasks-BlpDsWCy.js} +2 -2
- package/dashboard/dist/assets/{tasks-CpdopewW.js.map → tasks-BlpDsWCy.js.map} +1 -1
- package/dashboard/dist/assets/{topics--bvCV9Yp.js → topics-C0YaR9fu.js} +2 -2
- package/dashboard/dist/assets/{topics--bvCV9Yp.js.map → topics-C0YaR9fu.js.map} +1 -1
- package/dashboard/dist/assets/{useDebouncedValue-Da0lPmj3.js → useDebouncedValue-B-KC5ba3.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-Da0lPmj3.js.map → useDebouncedValue-B-KC5ba3.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-DD_Esl6n.js → useNamespace-Dkr5g2Ac.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-DD_Esl6n.js.map → useNamespace-Dkr5g2Ac.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-AeAhZJJk.js → useYamlActivityEvents-BANBOshA.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-AeAhZJJk.js.map → useYamlActivityEvents-BANBOshA.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-B7OcUM6b.js → vendor-icons-CeVtUKyP.js} +2 -2
- package/dashboard/dist/assets/{vendor-icons-B7OcUM6b.js.map → vendor-icons-CeVtUKyP.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-BHAOOGvn.js → yaml-workflows-BLYoJfmB.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-BHAOOGvn.js.map → yaml-workflows-BLYoJfmB.js.map} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/docs/accumulator.md +37 -1
- package/docs/api/mcp/admin.md +3 -2
- package/docs/api/sdk/escalations.md +6 -0
- package/docs/api/sdk/exports.md +1 -1
- package/docs/api/sdk/workflows.md +23 -4
- package/docs/cli.md +1 -1
- package/docs/dashboard.md +1 -1
- package/docs/faceted-routing.md +2 -0
- package/docs/hitl/x-lt-widget.md +5 -0
- package/docs/scan-codes.md +40 -7
- package/package.json +2 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-CpbC8oTN.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-CpbC8oTN.js.map +0 -1
- package/dashboard/dist/assets/EscalationSchemaPage-W5r0A1kj.js +0 -9
- package/dashboard/dist/assets/EscalationSchemaPage-W5r0A1kj.js.map +0 -1
- package/dashboard/dist/assets/EscalationTimeline-DKyTz6sM.js +0 -2
- package/dashboard/dist/assets/EscalationTimeline-DKyTz6sM.js.map +0 -1
- package/dashboard/dist/assets/McpQueryDetailPage-DYJr16l7.js +0 -5
- package/dashboard/dist/assets/McpQueryDetailPage-DYJr16l7.js.map +0 -1
- package/dashboard/dist/assets/ResolverForm-BwgjIX97.js +0 -7
- package/dashboard/dist/assets/ResolverForm-BwgjIX97.js.map +0 -1
- package/dashboard/dist/assets/index-B_GT23TE.js +0 -3
- package/dashboard/dist/assets/index-B_GT23TE.js.map +0 -1
- package/dashboard/dist/assets/index-CgUcYveM.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u,j as e}from"./vendor-query-DvWWuNIB.js";import{$ as C,au as I,av as M,af as A,aw as R,ax as T}from"./index-CgUcYveM.js";import{P as $}from"./PageHeader-Csq434-v.js";import"./FilterBar-CvMBCVIo.js";import{W as F}from"./WorkflowPill-ZepbO_ny.js";import{W as S,u as q,a as B,L as Q}from"./ResolverForm-BwgjIX97.js";import{c as k}from"./EscalationListView-CkBnkpDJ.js";import{N as z}from"./NamespacePill-DADRJOUl.js";import{K as O,aw as U,ax as _,f as L,j as H,ay as D,az as K,an as V}from"./vendor-icons-B7OcUM6b.js";import{B as Y}from"./BotPicker-D3drO3-T.js";import{f as G}from"./vendor-react-_9U4mKFr.js";import"./StatusBadge-DHVwxre2.js";import"./constants-CeBBTzf5.js";import"./DataTable-spX1dFyb.js";import"./EmptyState-DgC_6njU.js";import"./useContainerWidth-DSLp1gEm.js";import"./UserName-Pw46tO_k.js";import"./StickyPagination-9ITrei_d.js";import"./bots-DX6jjqtF.js";function J(t){const[a,n]=u.useState(()=>{try{return window.matchMedia(t).matches}catch{return!1}});return u.useEffect(()=>{let i;try{i=window.matchMedia(t)}catch{return}n(i.matches);const r=l=>n(l.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[t]),a}const X="No Queue";function W(t){return[...new Set(t.map(a=>a.task_queue).filter(Boolean))].sort()}function E(t,a,n){const i=a.toLowerCase().trim(),r=o=>{var m;return!i||o.workflow_type.toLowerCase().includes(i)||((m=o.description)==null?void 0:m.toLowerCase().includes(i))},p=(n?[n]:W(t)).map(o=>({queue:o,workflows:t.filter(m=>m.task_queue===o&&r(m))})).filter(o=>o.workflows.length>0);if(!n){const o=t.filter(m=>!m.task_queue&&r(m));o.length>0&&p.push({queue:"",workflows:o})}return p}function Z(t){var a,n;return((n=(a=E(t,"",null)[0])==null?void 0:a.workflows[0])==null?void 0:n.workflow_type)??null}function ee({configs:t,selectedType:a,onSelect:n,tierMap:i,activeTypes:r,search:l,activeQueue:p,compact:o=!1}){const m=u.useMemo(()=>E(t,l,p),[t,l,p]);return m.length===0?e.jsx("p",{className:"text-sm text-text-tertiary py-8 text-center",children:"No workflows match your filter."}):e.jsx("div",{className:o?"space-y-6":"space-y-10",children:m.map(({queue:f,workflows:d})=>e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-2 py-2 mb-1 border-b border-surface-border ${o?"":"sticky top-[60px] z-10 bg-surface mb-2"}`,children:[f?e.jsx(O,{className:"w-3 h-3 text-accent shrink-0",strokeWidth:1.5}):e.jsx(U,{className:"w-3 h-3 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2 truncate",title:f||void 0,children:f?k(f):X}),e.jsx("span",{className:"text-xs text-text-quaternary",children:d.length})]}),e.jsx("div",{className:o?"":"divide-y divide-surface-border/30",children:d.map(c=>e.jsx(te,{config:c,isSelected:a===c.workflow_type,tier:i.get(c.workflow_type)??"durable",cronActive:(r==null?void 0:r.has(c.workflow_type))??!1,onSelect:n,compact:o},c.workflow_type))})]},f||"__none__"))})}function te({config:t,isSelected:a,tier:n,cronActive:i,onSelect:r,compact:l}){const p=n==="certified"?"certified":n==="registered"?"registered":"durable";return l?e.jsxs("button",{onClick:()=>r(t),"aria-current":a?"true":void 0,title:t.workflow_type,className:`group w-full text-left flex items-center gap-2.5 pl-3 pr-2 py-2 border-l-2 transition-colors ${a?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(S,{icon:t.icon,tier:n,className:`w-5 h-5 shrink-0 ${a?"text-accent":"text-accent/65"}`}),e.jsx("span",{className:"text-sm truncate",children:k(t.workflow_type)}),i&&e.jsx("span",{title:"Cron schedule active",className:"ml-auto shrink-0",children:e.jsx(_,{className:"w-3 h-3 text-status-success/70"})})]}):e.jsxs("button",{onClick:()=>r(t),className:"group relative w-full text-left py-2 px-3 -mx-3 rounded-md hover:bg-surface-hover/30 transition-colors duration-150",children:[a&&e.jsx("span",{className:"absolute left-0 top-1 bottom-1 w-0.5 bg-accent rounded-full"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{type:t.workflow_type,size:"md",variant:p}),t.description&&e.jsx("p",{className:"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors",children:t.description}),e.jsxs("span",{className:"ml-auto flex items-center gap-2 shrink-0",children:[t.execute_as&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-2xs bg-accent/10 text-accent rounded",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t.execute_as]}),i&&e.jsx("span",{title:"Cron schedule active",children:e.jsx(_,{className:"w-3 h-3 text-status-success/70 shrink-0"})}),e.jsx(z,{namespace:"durable"}),e.jsx("span",{title:"Configure & invoke",children:e.jsx(H,{className:`w-3 h-3 transition-opacity ${a?"text-accent opacity-100":"text-accent opacity-0 group-hover:opacity-100"}`,strokeWidth:1.5})})]})]})]})}function se({config:t,overrideBot:a,onOverrideChange:n,showOverride:i}){const{user:r}=C(),l=a||t.execute_as;return e.jsxs("div",{className:"bg-surface-sunken rounded-lg px-4 py-3 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-2xs text-text-tertiary uppercase tracking-wider font-medium",children:"Running as"}),l&&!a&&e.jsx("span",{className:"text-2xs text-text-tertiary",children:"configured default"}),a&&e.jsx("span",{className:"text-2xs text-accent",children:"admin override"})]}),e.jsx("div",{className:"field flex items-center gap-1.5",children:l?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-3.5 h-3.5 text-accent/70 shrink-0"}),e.jsx("span",{className:"text-xs text-text-primary font-mono",children:l})]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"w-3.5 h-3.5 text-text-tertiary shrink-0"}),e.jsx("span",{className:"text-xs text-text-primary",children:(r==null?void 0:r.displayName)||(r==null?void 0:r.username)||"you"})]})})]}),i&&n&&e.jsxs("div",{children:[e.jsx("label",{className:"text-2xs text-text-tertiary uppercase tracking-wider font-medium mb-1 block",children:"Override identity"}),e.jsx(Y,{selected:a??"",onChange:n,placeholder:t.execute_as?`Default: ${t.execute_as}`:"Invoking user (default)"})]})]})}function ae({selected:t}){const{isSuperAdmin:a,hasRoleType:n}=C(),i=a||n("admin"),[r,l]=u.useState(""),[p,o]=u.useState(t.certified);u.useEffect(()=>{l(""),o(t.certified)},[t.workflow_type,t.certified]);const m=u.useMemo(()=>{var N;const x=(N=t.envelope_schema)==null?void 0:N.metadata;return x&&typeof x=="object"?x:{}},[t.envelope_schema]),f=Array.isArray(t.input_lookups)&&t.input_lookups.length>0,{data:d}=I(t.workflow_type,f),c=u.useMemo(()=>d?M(d.lookups):void 0,[d]),w=(d==null?void 0:d.lookups.filter(x=>x.missing))??[],j=q(t,{certified:p,overrideBot:r}),y=e.jsxs(e.Fragment,{children:[t.description&&e.jsx(A,{content:t.description,className:"text-xs text-text-secondary leading-relaxed"}),e.jsx(se,{config:t,overrideBot:r,onOverrideChange:l,showOverride:i}),t.certified&&e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:x=>o(x.target.checked),className:"rounded border-surface-border text-accent focus:ring-accent/30"}),e.jsx(K,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Enable task tracking and escalation routing"})]})]});return e.jsxs("div",{className:"max-w-form","data-testid":"invoke-form",children:[e.jsxs("header",{className:"sticky top-0 z-10 bg-surface -mt-8 pt-8 flex items-baseline gap-3 min-w-0 pb-3 mb-5 border-b border-surface-border/60",children:[e.jsx(S,{icon:t.icon,tier:t.tier,className:"w-7 h-7 self-center shrink-0 text-accent"}),e.jsx("h2",{className:"heading-2 truncate",title:t.workflow_type,children:k(t.workflow_type)}),e.jsx("span",{className:"text-2xs font-mono text-text-quaternary shrink-0",children:t.workflow_type}),e.jsx("span",{className:"text-2xs uppercase tracking-widest text-text-tertiary shrink-0",children:t.tier}),t.task_queue&&e.jsx("span",{className:"text-2xs font-mono text-text-quaternary truncate",children:t.task_queue})]}),w.length>0&&e.jsxs("p",{className:"flex items-center gap-1.5 text-2xs text-status-warning mb-4","data-testid":"lookup-missing",children:[e.jsx(V,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),w.map(x=>`${x.domain}/${x.key} v${x.version}`).join(", ")," ",w.length===1?"is":"are"," not available; the fields that read ",w.length===1?"it":"them"," fall back to plain inputs."]}),t.input_schema?e.jsx(B,{selected:t,schema:t.input_schema,metadata:m,lookup:c,submission:j,lead:y}):e.jsx(Q,{selected:t,metadata:m,submission:j,lead:y})]})}const b="type",re=!1;function ne(){const[t,a]=G(),{data:n,isLoading:i}=R(),{data:r}=T(),l=J("(max-width: 1279px)"),p=t.get(b)??"",[o,m]=u.useState(""),[f,d]=u.useState(null),c=n??[],w=u.useMemo(()=>{const s=new Map;for(const h of c)s.set(h.workflow_type,h.tier);return s},[c]),j=c.find(s=>s.workflow_type===p),y=new Set((r??[]).filter(s=>s.active).map(s=>s.workflow_type)),x=u.useCallback((s,h={})=>{a(P=>{const g=new URLSearchParams(P);return s?g.set(b,s):g.delete(b),g},{replace:h.replace??!1})},[a]);if(u.useEffect(()=>{if(t.get(b)||c.length===0)return;const s=Z(c);s&&x(s,{replace:!0})},[c,t,x]),i)return e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]});const N=W(c),v=j?e.jsx(ae,{selected:j}):e.jsx("p",{className:"text-xs text-text-tertiary",children:"Choose a tool to begin."});return e.jsxs("div",{children:[e.jsx($,{title:"Invoke Tool",docsHash:"#docs:dashboard.md:invoke-tool"}),c.length===0?e.jsxs("div",{className:"py-16 text-center",children:[e.jsx("p",{className:"text-sm text-text-primary mb-1",children:"No tools to invoke"}),e.jsx("p",{className:"text-xs text-text-tertiary",children:"Mark workflows as invocable in the registry, or start the server with examples enabled."})]}):l?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block mb-6 max-w-2xl",children:[e.jsx("span",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Tool"}),e.jsxs("select",{value:p,onChange:s=>x(s.target.value||null),className:"select text-xs font-mono w-full",children:[e.jsx("option",{value:"",children:"Choose a tool…"}),N.map(s=>e.jsx("optgroup",{label:k(s),children:c.filter(h=>(h.task_queue||"")===s).map(h=>e.jsx("option",{value:h.workflow_type,children:k(h.workflow_type)},h.workflow_type))},s)),c.filter(s=>!s.task_queue).map(s=>e.jsx("option",{value:s.workflow_type,children:k(s.workflow_type)},s.workflow_type))]})]}),e.jsx("div",{className:"pt-8",children:v})]}):e.jsxs("div",{className:"flex gap-10 items-start",children:[e.jsxs("aside",{className:"w-1/4 min-w-[15rem] shrink-0 sticky top-0 self-start -mt-8 pt-8 max-h-[calc(100vh-5rem)] overflow-y-auto pr-1 space-y-4","data-testid":"invoke-list",children:[re,e.jsx(ee,{configs:c,selectedType:p,onSelect:s=>x(s.workflow_type),tierMap:w,activeTypes:y,search:o,activeQueue:f,compact:!0})]}),e.jsx("section",{className:"flex-1 min-w-0",children:v})]})]})}function _e(){return e.jsx(ne,{})}export{_e as DurableInvokePage,ne as StartWorkflowPage};
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{a as u,j as e}from"./vendor-query-DvWWuNIB.js";import{$ as C,au as I,av as M,af as A,aw as R,ax as T}from"./index-N71QQ3J5.js";import{P as $}from"./PageHeader-CMd3f4bz.js";import"./FilterBar-Dxd0wNSW.js";import{W as F}from"./WorkflowPill-Dg7BDTyM.js";import{W as S,u as q,a as B,L as Q}from"./ResolverForm-BVG8X0sS.js";import{c as k}from"./EscalationListView-CAHbdxKR.js";import{N as z}from"./NamespacePill-DwM5pNA4.js";import{K as O,aw as U,ax as _,f as L,j as H,ay as D,az as K,an as V}from"./vendor-icons-CeVtUKyP.js";import{B as Y}from"./BotPicker-CGB16rYU.js";import{f as G}from"./vendor-react-_9U4mKFr.js";import"./StatusBadge-DHVwxre2.js";import"./constants-CeBBTzf5.js";import"./DataTable-spX1dFyb.js";import"./EmptyState-DgC_6njU.js";import"./useContainerWidth-DSLp1gEm.js";import"./UserName-CXsdPiMZ.js";import"./StickyPagination-BSUyf5ja.js";import"./bots-bwvWYrXz.js";function J(t){const[a,n]=u.useState(()=>{try{return window.matchMedia(t).matches}catch{return!1}});return u.useEffect(()=>{let i;try{i=window.matchMedia(t)}catch{return}n(i.matches);const r=l=>n(l.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[t]),a}const X="No Queue";function W(t){return[...new Set(t.map(a=>a.task_queue).filter(Boolean))].sort()}function E(t,a,n){const i=a.toLowerCase().trim(),r=o=>{var m;return!i||o.workflow_type.toLowerCase().includes(i)||((m=o.description)==null?void 0:m.toLowerCase().includes(i))},p=(n?[n]:W(t)).map(o=>({queue:o,workflows:t.filter(m=>m.task_queue===o&&r(m))})).filter(o=>o.workflows.length>0);if(!n){const o=t.filter(m=>!m.task_queue&&r(m));o.length>0&&p.push({queue:"",workflows:o})}return p}function Z(t){var a,n;return((n=(a=E(t,"",null)[0])==null?void 0:a.workflows[0])==null?void 0:n.workflow_type)??null}function ee({configs:t,selectedType:a,onSelect:n,tierMap:i,activeTypes:r,search:l,activeQueue:p,compact:o=!1}){const m=u.useMemo(()=>E(t,l,p),[t,l,p]);return m.length===0?e.jsx("p",{className:"text-sm text-text-tertiary py-8 text-center",children:"No workflows match your filter."}):e.jsx("div",{className:o?"space-y-6":"space-y-10",children:m.map(({queue:f,workflows:d})=>e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-2 py-2 mb-1 border-b border-surface-border ${o?"":"sticky top-[60px] z-10 bg-surface mb-2"}`,children:[f?e.jsx(O,{className:"w-3 h-3 text-accent shrink-0",strokeWidth:1.5}):e.jsx(U,{className:"w-3 h-3 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2 truncate",title:f||void 0,children:f?k(f):X}),e.jsx("span",{className:"text-xs text-text-quaternary",children:d.length})]}),e.jsx("div",{className:o?"":"divide-y divide-surface-border/30",children:d.map(c=>e.jsx(te,{config:c,isSelected:a===c.workflow_type,tier:i.get(c.workflow_type)??"durable",cronActive:(r==null?void 0:r.has(c.workflow_type))??!1,onSelect:n,compact:o},c.workflow_type))})]},f||"__none__"))})}function te({config:t,isSelected:a,tier:n,cronActive:i,onSelect:r,compact:l}){const p=n==="certified"?"certified":n==="registered"?"registered":"durable";return l?e.jsxs("button",{onClick:()=>r(t),"aria-current":a?"true":void 0,title:t.workflow_type,className:`group w-full text-left flex items-center gap-2.5 pl-3 pr-2 py-2 border-l-2 transition-colors ${a?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(S,{icon:t.icon,tier:n,className:`w-5 h-5 shrink-0 ${a?"text-accent":"text-accent/65"}`}),e.jsx("span",{className:"text-sm truncate",children:k(t.workflow_type)}),i&&e.jsx("span",{title:"Cron schedule active",className:"ml-auto shrink-0",children:e.jsx(_,{className:"w-3 h-3 text-status-success/70"})})]}):e.jsxs("button",{onClick:()=>r(t),className:"group relative w-full text-left py-2 px-3 -mx-3 rounded-md hover:bg-surface-hover/30 transition-colors duration-150",children:[a&&e.jsx("span",{className:"absolute left-0 top-1 bottom-1 w-0.5 bg-accent rounded-full"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{type:t.workflow_type,size:"md",variant:p}),t.description&&e.jsx("p",{className:"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors",children:t.description}),e.jsxs("span",{className:"ml-auto flex items-center gap-2 shrink-0",children:[t.execute_as&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-2xs bg-accent/10 text-accent rounded",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t.execute_as]}),i&&e.jsx("span",{title:"Cron schedule active",children:e.jsx(_,{className:"w-3 h-3 text-status-success/70 shrink-0"})}),e.jsx(z,{namespace:"durable"}),e.jsx("span",{title:"Configure & invoke",children:e.jsx(H,{className:`w-3 h-3 transition-opacity ${a?"text-accent opacity-100":"text-accent opacity-0 group-hover:opacity-100"}`,strokeWidth:1.5})})]})]})]})}function se({config:t,overrideBot:a,onOverrideChange:n,showOverride:i}){const{user:r}=C(),l=a||t.execute_as;return e.jsxs("div",{className:"bg-surface-sunken rounded-lg px-4 py-3 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-2xs text-text-tertiary uppercase tracking-wider font-medium",children:"Running as"}),l&&!a&&e.jsx("span",{className:"text-2xs text-text-tertiary",children:"configured default"}),a&&e.jsx("span",{className:"text-2xs text-accent",children:"admin override"})]}),e.jsx("div",{className:"field flex items-center gap-1.5",children:l?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-3.5 h-3.5 text-accent/70 shrink-0"}),e.jsx("span",{className:"text-xs text-text-primary font-mono",children:l})]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"w-3.5 h-3.5 text-text-tertiary shrink-0"}),e.jsx("span",{className:"text-xs text-text-primary",children:(r==null?void 0:r.displayName)||(r==null?void 0:r.username)||"you"})]})})]}),i&&n&&e.jsxs("div",{children:[e.jsx("label",{className:"text-2xs text-text-tertiary uppercase tracking-wider font-medium mb-1 block",children:"Override identity"}),e.jsx(Y,{selected:a??"",onChange:n,placeholder:t.execute_as?`Default: ${t.execute_as}`:"Invoking user (default)"})]})]})}function ae({selected:t}){const{isSuperAdmin:a,hasRoleType:n}=C(),i=a||n("admin"),[r,l]=u.useState(""),[p,o]=u.useState(t.certified);u.useEffect(()=>{l(""),o(t.certified)},[t.workflow_type,t.certified]);const m=u.useMemo(()=>{var N;const x=(N=t.envelope_schema)==null?void 0:N.metadata;return x&&typeof x=="object"?x:{}},[t.envelope_schema]),f=Array.isArray(t.input_lookups)&&t.input_lookups.length>0,{data:d}=I(t.workflow_type,f),c=u.useMemo(()=>d?M(d.lookups):void 0,[d]),w=(d==null?void 0:d.lookups.filter(x=>x.missing))??[],j=q(t,{certified:p,overrideBot:r}),y=e.jsxs(e.Fragment,{children:[t.description&&e.jsx(A,{content:t.description,className:"text-xs text-text-secondary leading-relaxed"}),e.jsx(se,{config:t,overrideBot:r,onOverrideChange:l,showOverride:i}),t.certified&&e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:x=>o(x.target.checked),className:"rounded border-surface-border text-accent focus:ring-accent/30"}),e.jsx(K,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Enable task tracking and escalation routing"})]})]});return e.jsxs("div",{className:"max-w-form","data-testid":"invoke-form",children:[e.jsxs("header",{className:"sticky top-0 z-10 bg-surface -mt-8 pt-8 flex items-baseline gap-3 min-w-0 pb-3 mb-5 border-b border-surface-border/60",children:[e.jsx(S,{icon:t.icon,tier:t.tier,className:"w-7 h-7 self-center shrink-0 text-accent"}),e.jsx("h2",{className:"heading-2 truncate",title:t.workflow_type,children:k(t.workflow_type)}),e.jsx("span",{className:"text-2xs font-mono text-text-quaternary shrink-0",children:t.workflow_type}),e.jsx("span",{className:"text-2xs uppercase tracking-widest text-text-tertiary shrink-0",children:t.tier}),t.task_queue&&e.jsx("span",{className:"text-2xs font-mono text-text-quaternary truncate",children:t.task_queue})]}),w.length>0&&e.jsxs("p",{className:"flex items-center gap-1.5 text-2xs text-status-warning mb-4","data-testid":"lookup-missing",children:[e.jsx(V,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),w.map(x=>`${x.domain}/${x.key} v${x.version}`).join(", ")," ",w.length===1?"is":"are"," not available; the fields that read ",w.length===1?"it":"them"," fall back to plain inputs."]}),t.input_schema?e.jsx(B,{selected:t,schema:t.input_schema,metadata:m,lookup:c,submission:j,lead:y}):e.jsx(Q,{selected:t,metadata:m,submission:j,lead:y})]})}const b="type",re=!1;function ne(){const[t,a]=G(),{data:n,isLoading:i}=R(),{data:r}=T(),l=J("(max-width: 1279px)"),p=t.get(b)??"",[o,m]=u.useState(""),[f,d]=u.useState(null),c=n??[],w=u.useMemo(()=>{const s=new Map;for(const h of c)s.set(h.workflow_type,h.tier);return s},[c]),j=c.find(s=>s.workflow_type===p),y=new Set((r??[]).filter(s=>s.active).map(s=>s.workflow_type)),x=u.useCallback((s,h={})=>{a(P=>{const g=new URLSearchParams(P);return s?g.set(b,s):g.delete(b),g},{replace:h.replace??!1})},[a]);if(u.useEffect(()=>{if(t.get(b)||c.length===0)return;const s=Z(c);s&&x(s,{replace:!0})},[c,t,x]),i)return e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]});const N=W(c),v=j?e.jsx(ae,{selected:j}):e.jsx("p",{className:"text-xs text-text-tertiary",children:"Choose a tool to begin."});return e.jsxs("div",{children:[e.jsx($,{title:"Invoke Tool",docsHash:"#docs:dashboard.md:invoke-tool"}),c.length===0?e.jsxs("div",{className:"py-16 text-center",children:[e.jsx("p",{className:"text-sm text-text-primary mb-1",children:"No tools to invoke"}),e.jsx("p",{className:"text-xs text-text-tertiary",children:"Mark workflows as invocable in the registry, or start the server with examples enabled."})]}):l?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block mb-6 max-w-2xl",children:[e.jsx("span",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Tool"}),e.jsxs("select",{value:p,onChange:s=>x(s.target.value||null),className:"select text-xs font-mono w-full",children:[e.jsx("option",{value:"",children:"Choose a tool…"}),N.map(s=>e.jsx("optgroup",{label:k(s),children:c.filter(h=>(h.task_queue||"")===s).map(h=>e.jsx("option",{value:h.workflow_type,children:k(h.workflow_type)},h.workflow_type))},s)),c.filter(s=>!s.task_queue).map(s=>e.jsx("option",{value:s.workflow_type,children:k(s.workflow_type)},s.workflow_type))]})]}),e.jsx("div",{className:"pt-8",children:v})]}):e.jsxs("div",{className:"flex gap-10 items-start",children:[e.jsxs("aside",{className:"w-1/4 min-w-[15rem] shrink-0 sticky top-0 self-start -mt-8 pt-8 max-h-[calc(100vh-5rem)] overflow-y-auto pr-1 space-y-4","data-testid":"invoke-list",children:[re,e.jsx(ee,{configs:c,selectedType:p,onSelect:s=>x(s.workflow_type),tierMap:w,activeTypes:y,search:o,activeQueue:f,compact:!0})]}),e.jsx("section",{className:"flex-1 min-w-0",children:v})]})]})}function _e(){return e.jsx(ne,{})}export{_e as DurableInvokePage,ne as StartWorkflowPage};
|
|
2
|
+
//# sourceMappingURL=index-D6pBLZFu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-z5Hpeidu.js","sources":["../../src/hooks/useMediaQuery.ts","../../src/pages/workflows/start/WorkflowSelector.tsx","../../src/pages/workflows/start/IdentitySummary.tsx","../../src/pages/workflows/start/StartNowPanel.tsx","../../src/pages/workflows/start/StartWorkflowPage.tsx","../../src/pages/workflows/start/DurableInvokePage.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * Tracks a viewport media query. Unlike container measurement, the viewport\n * is stable while shell panels open and close, so layout decisions made on\n * it never feed back into themselves. Returns false in environments without\n * matchMedia (jsdom), which callers treat as \"wide\".\n */\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState<boolean>(() => {\n try {\n return window.matchMedia(query).matches;\n } catch {\n return false;\n }\n });\n\n useEffect(() => {\n let mql: MediaQueryList;\n try {\n mql = window.matchMedia(query);\n } catch {\n return;\n }\n setMatches(mql.matches);\n const onChange = (e: MediaQueryListEvent) => setMatches(e.matches);\n mql.addEventListener('change', onChange);\n return () => mql.removeEventListener('change', onChange);\n }, [query]);\n\n return matches;\n}\n","import { useMemo } from 'react';\nimport { Bot, Clock, Play, Server, Wrench } from 'lucide-react';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\nimport { WorkflowIcon } from '../../../components/common/display/WorkflowIcon';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { NamespacePill } from '../../../components/common/display/NamespacePill';\nimport type { LTWorkflowConfig, WorkflowTier } from '../../../api/types';\n\nconst NO_QUEUE_LABEL = 'No Queue';\n\n/** The queue set a filter offers — shared with the grouping below. */\nexport function workflowQueues(configs: LTWorkflowConfig[]): string[] {\n return [...new Set(configs.map((c) => c.task_queue).filter(Boolean))].sort() as string[];\n}\n\n/** One section per task queue; unqueued workflows trail under their own heading when no queue filter is active. */\nexport function groupWorkflows(\n configs: LTWorkflowConfig[],\n search: string,\n activeQueue: string | null,\n): { queue: string; workflows: LTWorkflowConfig[] }[] {\n const q = search.toLowerCase().trim();\n const matches = (c: LTWorkflowConfig) =>\n !q || c.workflow_type.toLowerCase().includes(q) || c.description?.toLowerCase().includes(q);\n\n const targetQueues = activeQueue ? [activeQueue] : workflowQueues(configs);\n const sections = targetQueues\n .map((queue) => ({ queue, workflows: configs.filter((c) => c.task_queue === queue && matches(c)) }))\n .filter((g) => g.workflows.length > 0);\n\n if (!activeQueue) {\n const noQueue = configs.filter((c) => !c.task_queue && matches(c));\n if (noQueue.length > 0) sections.push({ queue: '', workflows: noQueue });\n }\n return sections;\n}\n\n/** The first row of the unfiltered list — what the page preselects. */\nexport function firstWorkflowType(configs: LTWorkflowConfig[]): string | null {\n return groupWorkflows(configs, '', null)[0]?.workflows[0]?.workflow_type ?? null;\n}\n\nexport function WorkflowSelector({\n configs,\n selectedType,\n onSelect,\n tierMap,\n activeTypes,\n search,\n activeQueue,\n compact = false,\n}: {\n configs: LTWorkflowConfig[];\n selectedType: string;\n onSelect: (config: LTWorkflowConfig) => void;\n tierMap: Map<string, WorkflowTier>;\n activeTypes?: Set<string>;\n search: string;\n activeQueue: string | null;\n /** The narrow list column beside the form: name and tier only, headings in flow. */\n compact?: boolean;\n}) {\n const grouped = useMemo(() => groupWorkflows(configs, search, activeQueue), [configs, search, activeQueue]);\n\n if (grouped.length === 0) {\n return <p className=\"text-sm text-text-tertiary py-8 text-center\">No workflows match your filter.</p>;\n }\n\n return (\n <div className={compact ? 'space-y-6' : 'space-y-10'}>\n {grouped.map(({ queue, workflows }) => (\n <div key={queue || '__none__'}>\n <div className={`flex items-center gap-2 py-2 mb-1 border-b border-surface-border ${compact ? '' : 'sticky top-[60px] z-10 bg-surface mb-2'}`}>\n {queue ? (\n <Server className=\"w-3 h-3 text-accent shrink-0\" strokeWidth={1.5} />\n ) : (\n <Wrench className=\"w-3 h-3 text-text-quaternary shrink-0\" strokeWidth={1.5} />\n )}\n <h2 className=\"section-h2 truncate\" title={queue || undefined}>{queue ? identifierToTitle(queue) : NO_QUEUE_LABEL}</h2>\n <span className=\"text-xs text-text-quaternary\">{workflows.length}</span>\n </div>\n <div className={compact ? '' : 'divide-y divide-surface-border/30'}>\n {workflows.map((config) => (\n <WorkflowRow\n key={config.workflow_type}\n config={config}\n isSelected={selectedType === config.workflow_type}\n tier={tierMap.get(config.workflow_type) ?? 'durable'}\n cronActive={activeTypes?.has(config.workflow_type) ?? false}\n onSelect={onSelect}\n compact={compact}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction WorkflowRow({\n config,\n isSelected,\n tier,\n cronActive,\n onSelect,\n compact,\n}: {\n config: LTWorkflowConfig;\n isSelected: boolean;\n tier: WorkflowTier;\n cronActive: boolean;\n onSelect: (config: LTWorkflowConfig) => void;\n compact: boolean;\n}) {\n const variant = tier === 'certified' ? 'certified' : tier === 'registered' ? 'registered' : 'durable';\n\n if (compact) {\n return (\n <button\n onClick={() => onSelect(config)}\n aria-current={isSelected ? 'true' : undefined}\n title={config.workflow_type}\n className={`group w-full text-left flex items-center gap-2.5 pl-3 pr-2 py-2 border-l-2 transition-colors ${\n isSelected ? 'border-accent bg-accent/10 text-accent' : 'border-transparent text-text-primary hover:bg-surface-hover'\n }`}\n >\n <WorkflowIcon icon={config.icon} tier={tier} className={`w-5 h-5 shrink-0 ${isSelected ? 'text-accent' : 'text-accent/65'}`} />\n <span className=\"text-sm truncate\">{identifierToTitle(config.workflow_type)}</span>\n {cronActive && (\n <span title=\"Cron schedule active\" className=\"ml-auto shrink-0\">\n <Clock className=\"w-3 h-3 text-status-success/70\" />\n </span>\n )}\n </button>\n );\n }\n\n return (\n <button\n onClick={() => onSelect(config)}\n className=\"group relative w-full text-left py-2 px-3 -mx-3 rounded-md hover:bg-surface-hover/30 transition-colors duration-150\"\n >\n {isSelected && (\n <span className=\"absolute left-0 top-1 bottom-1 w-0.5 bg-accent rounded-full\" />\n )}\n <div className=\"flex items-center gap-3\">\n <WorkflowPill type={config.workflow_type} size=\"md\" variant={variant} />\n {config.description && (\n <p className=\"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors\">\n {config.description}\n </p>\n )}\n <span className=\"ml-auto flex items-center gap-2 shrink-0\">\n {config.execute_as && (\n <span className=\"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-2xs bg-accent/10 text-accent rounded\">\n <Bot className=\"w-2.5 h-2.5\" />\n {config.execute_as}\n </span>\n )}\n {cronActive && (\n <span title=\"Cron schedule active\">\n <Clock className=\"w-3 h-3 text-status-success/70 shrink-0\" />\n </span>\n )}\n <NamespacePill namespace=\"durable\" />\n <span title=\"Configure & invoke\">\n <Play\n className={`w-3 h-3 transition-opacity ${\n isSelected ? 'text-accent opacity-100' : 'text-accent opacity-0 group-hover:opacity-100'\n }`}\n strokeWidth={1.5}\n />\n </span>\n </span>\n </div>\n </button>\n );\n}\n","import { Bot, UserCircle } from 'lucide-react';\nimport { BotPicker } from '../../../components/common/form/BotPicker';\nimport { useAuth } from '../../../hooks/useAuth';\nimport type { LTWorkflowConfig } from '../../../api/types';\n\nexport function IdentitySummary({\n config,\n overrideBot,\n onOverrideChange,\n showOverride,\n}: {\n config: LTWorkflowConfig;\n overrideBot?: string;\n onOverrideChange?: (botExternalId: string) => void;\n showOverride?: boolean;\n}) {\n const { user } = useAuth();\n const effectiveBot = overrideBot || config.execute_as;\n\n return (\n <div className=\"bg-surface-sunken rounded-lg px-4 py-3 space-y-3\">\n <div>\n <div className=\"flex items-center justify-between mb-1\">\n <span className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium\">Running as</span>\n {effectiveBot && !overrideBot && (\n <span className=\"text-2xs text-text-tertiary\">configured default</span>\n )}\n {overrideBot && (\n <span className=\"text-2xs text-accent\">admin override</span>\n )}\n </div>\n {/* Read-only identity, styled as a field so it reads consistently with\n the Override control below and pops off the sunken band. */}\n <div className=\"field flex items-center gap-1.5\">\n {effectiveBot ? (\n <>\n <Bot className=\"w-3.5 h-3.5 text-accent/70 shrink-0\" />\n <span className=\"text-xs text-text-primary font-mono\">{effectiveBot}</span>\n </>\n ) : (\n <>\n <UserCircle className=\"w-3.5 h-3.5 text-text-tertiary shrink-0\" />\n <span className=\"text-xs text-text-primary\">\n {user?.displayName || user?.username || 'you'}\n </span>\n </>\n )}\n </div>\n </div>\n {showOverride && onOverrideChange && (\n <div>\n <label className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium mb-1 block\">Override identity</label>\n <BotPicker\n selected={overrideBot ?? ''}\n onChange={onOverrideChange}\n placeholder={config.execute_as ? `Default: ${config.execute_as}` : 'Invoking user (default)'}\n />\n </div>\n )}\n </div>\n );\n}\n","import { useEffect, useMemo, useState } from 'react';\nimport { AlertTriangle, ShieldCheck } from 'lucide-react';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { foldWorkflowLookups, useWorkflowLookups } from '../../../api/workflows';\nimport type { InvocableWorkflow } from '../../../api/types';\nimport { WorkflowIcon } from '../../../components/common/display/WorkflowIcon';\nimport { MarkdownRenderer } from '../../../components/common/display/MarkdownRenderer';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { IdentitySummary } from './IdentitySummary';\nimport { LegacyInvokeForm } from './LegacyInvokeForm';\nimport { RichInvokeForm } from './RichInvokeForm';\nimport { useInvokeSubmit } from './use-invoke-submit';\n\n/**\n * The form column. The workflow's name is the column's heading and stays\n * put; Start stays put at the bottom; description, identity, options, and\n* the fields scroll between them. A declared input_schema renders the\n * x-lt-* form, with pinned input_lookups resolved into its lookup domain;\n * otherwise the envelope template form.\n */\nexport function StartNowPanel({ selected }: { selected: InvocableWorkflow }) {\n const { isSuperAdmin, hasRoleType } = useAuth();\n const isAdmin = isSuperAdmin || hasRoleType('admin');\n const [overrideBot, setOverrideBot] = useState('');\n // Per-run interceptor opt-out, offered when the registration is certified.\n const [certified, setCertified] = useState(selected.certified);\n\n useEffect(() => {\n setOverrideBot('');\n setCertified(selected.certified);\n }, [selected.workflow_type, selected.certified]);\n\n const metadata = useMemo(() => {\n const md = selected.envelope_schema?.metadata;\n return md && typeof md === 'object' ? (md as Record<string, unknown>) : {};\n }, [selected.envelope_schema]);\n\n const hasLookups = Array.isArray(selected.input_lookups) && selected.input_lookups.length > 0;\n const { data: lookupData } = useWorkflowLookups(selected.workflow_type, hasLookups);\n const lookup = useMemo(() => (lookupData ? foldWorkflowLookups(lookupData.lookups) : undefined), [lookupData]);\n const missingLookups = lookupData?.lookups.filter((l) => l.missing) ?? [];\n\n const submission = useInvokeSubmit(selected, { certified, overrideBot });\n\n const lead = (\n <>\n {selected.description && (\n <MarkdownRenderer content={selected.description} className=\"text-xs text-text-secondary leading-relaxed\" />\n )}\n <IdentitySummary\n config={selected}\n overrideBot={overrideBot}\n onOverrideChange={setOverrideBot}\n showOverride={isAdmin}\n />\n {selected.certified && (\n <label className=\"flex items-center gap-2 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={certified}\n onChange={(e) => setCertified(e.target.checked)}\n className=\"rounded border-surface-border text-accent focus:ring-accent/30\"\n />\n <ShieldCheck className=\"w-3.5 h-3.5 text-text-tertiary\" />\n <span className=\"text-xs text-text-secondary\">Enable task tracking and escalation routing</span>\n </label>\n )}\n </>\n );\n\n return (\n <div className=\"max-w-form\" data-testid=\"invoke-form\">\n {/* Sticks to the top of the shell scroll; the pulled-up padding covers the page gutter above it. */}\n <header className=\"sticky top-0 z-10 bg-surface -mt-8 pt-8 flex items-baseline gap-3 min-w-0 pb-3 mb-5 border-b border-surface-border/60\">\n <WorkflowIcon icon={selected.icon} tier={selected.tier} className=\"w-7 h-7 self-center shrink-0 text-accent\" />\n <h2 className=\"heading-2 truncate\" title={selected.workflow_type}>\n {identifierToTitle(selected.workflow_type)}\n </h2>\n <span className=\"text-2xs font-mono text-text-quaternary shrink-0\">{selected.workflow_type}</span>\n <span className=\"text-2xs uppercase tracking-widest text-text-tertiary shrink-0\">{selected.tier}</span>\n {selected.task_queue && (\n <span className=\"text-2xs font-mono text-text-quaternary truncate\">{selected.task_queue}</span>\n )}\n </header>\n\n {missingLookups.length > 0 && (\n <p className=\"flex items-center gap-1.5 text-2xs text-status-warning mb-4\" data-testid=\"lookup-missing\">\n <AlertTriangle className=\"w-3 h-3 shrink-0\" strokeWidth={1.5} />\n {missingLookups.map((l) => `${l.domain}/${l.key} v${l.version}`).join(', ')} {missingLookups.length === 1 ? 'is' : 'are'} not available; the fields that read {missingLookups.length === 1 ? 'it' : 'them'} fall back to plain inputs.\n </p>\n )}\n\n {selected.input_schema ? (\n <RichInvokeForm selected={selected} schema={selected.input_schema} metadata={metadata} lookup={lookup} submission={submission} lead={lead} />\n ) : (\n <LegacyInvokeForm selected={selected} metadata={metadata} submission={submission} lead={lead} />\n )}\n </div>\n );\n}\n","import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport { useInvocableWorkflows, useCronStatus } from '../../../api/workflows';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { FilterSelect, FilterInput } from '../../../components/common/data/FilterBar';\nimport { useMediaQuery } from '../../../hooks/useMediaQuery';\nimport type { InvocableWorkflow, WorkflowTier } from '../../../api/types';\nimport { WorkflowSelector, workflowQueues, firstWorkflowType } from './WorkflowSelector';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { StartNowPanel } from './StartNowPanel';\n\nconst TYPE_PARAM = 'type';\n// A few dozen workflows read fine grouped by queue; the filters wait for scale to demand them.\nconst LIST_FILTERS_VISIBLE = false;\n\n/**\n * Invoke — the list of workflows the caller may run beside the form for the\n * one chosen. The list is grouped by queue and takes a quarter of the row;\n * the form takes the rest. Selection lives in `?type=`, and the first row\n * is preselected so the page opens on a form, never on an empty column.\n */\nexport function StartWorkflowPage() {\n const [searchParams, setSearchParams] = useSearchParams();\n const { data: invocable, isLoading } = useInvocableWorkflows();\n const { data: cronEntries } = useCronStatus();\n // Below xl the list and the form cannot share the row: the list folds\n // into a select and the form takes the full width.\n const compact = useMediaQuery('(max-width: 1279px)');\n\n const selectedType = searchParams.get(TYPE_PARAM) ?? '';\n const [search, setSearch] = useState('');\n const [activeQueue, setActiveQueue] = useState<string | null>(null);\n\n const workflows: InvocableWorkflow[] = invocable ?? [];\n const tierMap = useMemo(() => {\n const map = new Map<string, WorkflowTier>();\n for (const w of workflows) map.set(w.workflow_type, w.tier);\n return map;\n }, [workflows]);\n const selected = workflows.find((c) => c.workflow_type === selectedType);\n const activeTypes = new Set((cronEntries ?? []).filter((e) => e.active).map((e) => e.workflow_type));\n\n // A user's choice is a history entry; the opening preselect only rewrites the landing URL.\n const setType = useCallback(\n (value: string | null, opts: { replace?: boolean } = {}) => {\n setSearchParams(\n (prev) => {\n const next = new URLSearchParams(prev);\n if (value) next.set(TYPE_PARAM, value);\n else next.delete(TYPE_PARAM);\n return next;\n },\n { replace: opts.replace ?? false },\n );\n },\n [setSearchParams],\n );\n\n useEffect(() => {\n if (searchParams.get(TYPE_PARAM) || workflows.length === 0) return;\n const first = firstWorkflowType(workflows);\n if (first) setType(first, { replace: true });\n }, [workflows, searchParams, setType]);\n\n if (isLoading) {\n return (\n <div className=\"animate-pulse space-y-4\">\n <div className=\"h-8 bg-surface-sunken rounded w-48\" />\n <div className=\"h-40 bg-surface-sunken rounded\" />\n </div>\n );\n }\n\n const queues = workflowQueues(workflows);\n const form = selected\n ? <StartNowPanel selected={selected} />\n : <p className=\"text-xs text-text-tertiary\">Choose a tool to begin.</p>;\n\n return (\n <div>\n <PageHeader title=\"Invoke Tool\" docsHash=\"#docs:dashboard.md:invoke-tool\" />\n\n {workflows.length === 0 ? (\n <div className=\"py-16 text-center\">\n <p className=\"text-sm text-text-primary mb-1\">No tools to invoke</p>\n <p className=\"text-xs text-text-tertiary\">Mark workflows as invocable in the registry, or start the server with examples enabled.</p>\n </div>\n ) : compact ? (\n <>\n <label className=\"block mb-6 max-w-2xl\">\n <span className=\"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1\">Tool</span>\n <select\n value={selectedType}\n onChange={(e) => setType(e.target.value || null)}\n className=\"select text-xs font-mono w-full\"\n >\n <option value=\"\">Choose a tool…</option>\n {queues.map((q) => (\n <optgroup key={q} label={identifierToTitle(q)}>\n {workflows\n .filter((c) => (c.task_queue || '') === q)\n .map((c) => (\n <option key={c.workflow_type} value={c.workflow_type}>{identifierToTitle(c.workflow_type)}</option>\n ))}\n </optgroup>\n ))}\n {workflows\n .filter((c) => !c.task_queue)\n .map((c) => (\n <option key={c.workflow_type} value={c.workflow_type}>{identifierToTitle(c.workflow_type)}</option>\n ))}\n </select>\n </label>\n {/* The form heading pulls itself up over the page gutter when stuck; give it that room here so it never covers the picker. */}\n <div className=\"pt-8\">{form}</div>\n </>\n ) : (\n <div className=\"flex gap-10 items-start\">\n {/* The page scrolls as a whole; the list column and the form's title and Start stick while the title of the page rides away. */}\n <aside className=\"w-1/4 min-w-[15rem] shrink-0 sticky top-0 self-start -mt-8 pt-8 max-h-[calc(100vh-5rem)] overflow-y-auto pr-1 space-y-4\" data-testid=\"invoke-list\">\n {LIST_FILTERS_VISIBLE && <div className=\"flex flex-col gap-3\">\n {queues.length > 1 && (\n <FilterSelect\n label=\"Queue\"\n value={activeQueue ?? ''}\n onChange={(v) => setActiveQueue(v || null)}\n options={queues.map((q) => ({ value: q, label: q }))}\n />\n )}\n <FilterInput\n label=\"Search\"\n value={search}\n onChange={setSearch}\n placeholder={`${workflows.length} workflows…`}\n />\n </div>}\n <WorkflowSelector\n configs={workflows}\n selectedType={selectedType}\n onSelect={(c) => setType(c.workflow_type)}\n tierMap={tierMap}\n activeTypes={activeTypes}\n search={search}\n activeQueue={activeQueue}\n compact\n />\n </aside>\n <section className=\"flex-1 min-w-0\">{form}</section>\n </div>\n )}\n </div>\n );\n}\n","import { StartWorkflowPage } from './StartWorkflowPage';\n\nexport function DurableInvokePage() {\n return <StartWorkflowPage />;\n}\n"],"names":["useMediaQuery","query","matches","setMatches","useState","useEffect","mql","onChange","e","NO_QUEUE_LABEL","workflowQueues","configs","c","groupWorkflows","search","activeQueue","q","_a","sections","queue","g","noQueue","firstWorkflowType","_b","WorkflowSelector","selectedType","onSelect","tierMap","activeTypes","compact","grouped","useMemo","jsx","workflows","jsxs","Server","Wrench","identifierToTitle","config","WorkflowRow","isSelected","tier","cronActive","variant","WorkflowIcon","Clock","WorkflowPill","Bot","NamespacePill","Play","IdentitySummary","overrideBot","onOverrideChange","showOverride","user","useAuth","effectiveBot","Fragment","UserCircle","BotPicker","StartNowPanel","selected","isSuperAdmin","hasRoleType","isAdmin","setOverrideBot","certified","setCertified","metadata","md","hasLookups","lookupData","useWorkflowLookups","lookup","foldWorkflowLookups","missingLookups","l","submission","useInvokeSubmit","lead","MarkdownRenderer","ShieldCheck","AlertTriangle","RichInvokeForm","LegacyInvokeForm","TYPE_PARAM","LIST_FILTERS_VISIBLE","StartWorkflowPage","searchParams","setSearchParams","useSearchParams","invocable","isLoading","useInvocableWorkflows","cronEntries","useCronStatus","setSearch","setActiveQueue","map","w","setType","useCallback","value","opts","prev","next","first","queues","form","PageHeader","DurableInvokePage"],"mappings":"u3BA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C,QAAAe,EACA,YAAAC,EACA,OAAAd,EACA,YAAAC,EACA,QAAO,EAAA,CAAA,CACT,EACF,EACAiB,EAAAA,IAAC,UAAA,CAAQ,UAAU,iBAAkB,SAAA4E,CAAA,CAAK,CAAA,CAAA,CAC5C,CAAA,EAEJ,CAEJ,CCtJO,SAASE,IAAoB,CAClC,aAAQvB,GAAA,EAAkB,CAC5B"}
|
|
1
|
+
{"version":3,"file":"index-D6pBLZFu.js","sources":["../../src/hooks/useMediaQuery.ts","../../src/pages/workflows/start/WorkflowSelector.tsx","../../src/pages/workflows/start/IdentitySummary.tsx","../../src/pages/workflows/start/StartNowPanel.tsx","../../src/pages/workflows/start/StartWorkflowPage.tsx","../../src/pages/workflows/start/DurableInvokePage.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * Tracks a viewport media query. Unlike container measurement, the viewport\n * is stable while shell panels open and close, so layout decisions made on\n * it never feed back into themselves. Returns false in environments without\n * matchMedia (jsdom), which callers treat as \"wide\".\n */\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState<boolean>(() => {\n try {\n return window.matchMedia(query).matches;\n } catch {\n return false;\n }\n });\n\n useEffect(() => {\n let mql: MediaQueryList;\n try {\n mql = window.matchMedia(query);\n } catch {\n return;\n }\n setMatches(mql.matches);\n const onChange = (e: MediaQueryListEvent) => setMatches(e.matches);\n mql.addEventListener('change', onChange);\n return () => mql.removeEventListener('change', onChange);\n }, [query]);\n\n return matches;\n}\n","import { useMemo } from 'react';\nimport { Bot, Clock, Play, Server, Wrench } from 'lucide-react';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\nimport { WorkflowIcon } from '../../../components/common/display/WorkflowIcon';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { NamespacePill } from '../../../components/common/display/NamespacePill';\nimport type { LTWorkflowConfig, WorkflowTier } from '../../../api/types';\n\nconst NO_QUEUE_LABEL = 'No Queue';\n\n/** The queue set a filter offers — shared with the grouping below. */\nexport function workflowQueues(configs: LTWorkflowConfig[]): string[] {\n return [...new Set(configs.map((c) => c.task_queue).filter(Boolean))].sort() as string[];\n}\n\n/** One section per task queue; unqueued workflows trail under their own heading when no queue filter is active. */\nexport function groupWorkflows(\n configs: LTWorkflowConfig[],\n search: string,\n activeQueue: string | null,\n): { queue: string; workflows: LTWorkflowConfig[] }[] {\n const q = search.toLowerCase().trim();\n const matches = (c: LTWorkflowConfig) =>\n !q || c.workflow_type.toLowerCase().includes(q) || c.description?.toLowerCase().includes(q);\n\n const targetQueues = activeQueue ? [activeQueue] : workflowQueues(configs);\n const sections = targetQueues\n .map((queue) => ({ queue, workflows: configs.filter((c) => c.task_queue === queue && matches(c)) }))\n .filter((g) => g.workflows.length > 0);\n\n if (!activeQueue) {\n const noQueue = configs.filter((c) => !c.task_queue && matches(c));\n if (noQueue.length > 0) sections.push({ queue: '', workflows: noQueue });\n }\n return sections;\n}\n\n/** The first row of the unfiltered list — what the page preselects. */\nexport function firstWorkflowType(configs: LTWorkflowConfig[]): string | null {\n return groupWorkflows(configs, '', null)[0]?.workflows[0]?.workflow_type ?? null;\n}\n\nexport function WorkflowSelector({\n configs,\n selectedType,\n onSelect,\n tierMap,\n activeTypes,\n search,\n activeQueue,\n compact = false,\n}: {\n configs: LTWorkflowConfig[];\n selectedType: string;\n onSelect: (config: LTWorkflowConfig) => void;\n tierMap: Map<string, WorkflowTier>;\n activeTypes?: Set<string>;\n search: string;\n activeQueue: string | null;\n /** The narrow list column beside the form: name and tier only, headings in flow. */\n compact?: boolean;\n}) {\n const grouped = useMemo(() => groupWorkflows(configs, search, activeQueue), [configs, search, activeQueue]);\n\n if (grouped.length === 0) {\n return <p className=\"text-sm text-text-tertiary py-8 text-center\">No workflows match your filter.</p>;\n }\n\n return (\n <div className={compact ? 'space-y-6' : 'space-y-10'}>\n {grouped.map(({ queue, workflows }) => (\n <div key={queue || '__none__'}>\n <div className={`flex items-center gap-2 py-2 mb-1 border-b border-surface-border ${compact ? '' : 'sticky top-[60px] z-10 bg-surface mb-2'}`}>\n {queue ? (\n <Server className=\"w-3 h-3 text-accent shrink-0\" strokeWidth={1.5} />\n ) : (\n <Wrench className=\"w-3 h-3 text-text-quaternary shrink-0\" strokeWidth={1.5} />\n )}\n <h2 className=\"section-h2 truncate\" title={queue || undefined}>{queue ? identifierToTitle(queue) : NO_QUEUE_LABEL}</h2>\n <span className=\"text-xs text-text-quaternary\">{workflows.length}</span>\n </div>\n <div className={compact ? '' : 'divide-y divide-surface-border/30'}>\n {workflows.map((config) => (\n <WorkflowRow\n key={config.workflow_type}\n config={config}\n isSelected={selectedType === config.workflow_type}\n tier={tierMap.get(config.workflow_type) ?? 'durable'}\n cronActive={activeTypes?.has(config.workflow_type) ?? false}\n onSelect={onSelect}\n compact={compact}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction WorkflowRow({\n config,\n isSelected,\n tier,\n cronActive,\n onSelect,\n compact,\n}: {\n config: LTWorkflowConfig;\n isSelected: boolean;\n tier: WorkflowTier;\n cronActive: boolean;\n onSelect: (config: LTWorkflowConfig) => void;\n compact: boolean;\n}) {\n const variant = tier === 'certified' ? 'certified' : tier === 'registered' ? 'registered' : 'durable';\n\n if (compact) {\n return (\n <button\n onClick={() => onSelect(config)}\n aria-current={isSelected ? 'true' : undefined}\n title={config.workflow_type}\n className={`group w-full text-left flex items-center gap-2.5 pl-3 pr-2 py-2 border-l-2 transition-colors ${\n isSelected ? 'border-accent bg-accent/10 text-accent' : 'border-transparent text-text-primary hover:bg-surface-hover'\n }`}\n >\n <WorkflowIcon icon={config.icon} tier={tier} className={`w-5 h-5 shrink-0 ${isSelected ? 'text-accent' : 'text-accent/65'}`} />\n <span className=\"text-sm truncate\">{identifierToTitle(config.workflow_type)}</span>\n {cronActive && (\n <span title=\"Cron schedule active\" className=\"ml-auto shrink-0\">\n <Clock className=\"w-3 h-3 text-status-success/70\" />\n </span>\n )}\n </button>\n );\n }\n\n return (\n <button\n onClick={() => onSelect(config)}\n className=\"group relative w-full text-left py-2 px-3 -mx-3 rounded-md hover:bg-surface-hover/30 transition-colors duration-150\"\n >\n {isSelected && (\n <span className=\"absolute left-0 top-1 bottom-1 w-0.5 bg-accent rounded-full\" />\n )}\n <div className=\"flex items-center gap-3\">\n <WorkflowPill type={config.workflow_type} size=\"md\" variant={variant} />\n {config.description && (\n <p className=\"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors\">\n {config.description}\n </p>\n )}\n <span className=\"ml-auto flex items-center gap-2 shrink-0\">\n {config.execute_as && (\n <span className=\"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-2xs bg-accent/10 text-accent rounded\">\n <Bot className=\"w-2.5 h-2.5\" />\n {config.execute_as}\n </span>\n )}\n {cronActive && (\n <span title=\"Cron schedule active\">\n <Clock className=\"w-3 h-3 text-status-success/70 shrink-0\" />\n </span>\n )}\n <NamespacePill namespace=\"durable\" />\n <span title=\"Configure & invoke\">\n <Play\n className={`w-3 h-3 transition-opacity ${\n isSelected ? 'text-accent opacity-100' : 'text-accent opacity-0 group-hover:opacity-100'\n }`}\n strokeWidth={1.5}\n />\n </span>\n </span>\n </div>\n </button>\n );\n}\n","import { Bot, UserCircle } from 'lucide-react';\nimport { BotPicker } from '../../../components/common/form/BotPicker';\nimport { useAuth } from '../../../hooks/useAuth';\nimport type { LTWorkflowConfig } from '../../../api/types';\n\nexport function IdentitySummary({\n config,\n overrideBot,\n onOverrideChange,\n showOverride,\n}: {\n config: LTWorkflowConfig;\n overrideBot?: string;\n onOverrideChange?: (botExternalId: string) => void;\n showOverride?: boolean;\n}) {\n const { user } = useAuth();\n const effectiveBot = overrideBot || config.execute_as;\n\n return (\n <div className=\"bg-surface-sunken rounded-lg px-4 py-3 space-y-3\">\n <div>\n <div className=\"flex items-center justify-between mb-1\">\n <span className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium\">Running as</span>\n {effectiveBot && !overrideBot && (\n <span className=\"text-2xs text-text-tertiary\">configured default</span>\n )}\n {overrideBot && (\n <span className=\"text-2xs text-accent\">admin override</span>\n )}\n </div>\n {/* Read-only identity, styled as a field so it reads consistently with\n the Override control below and pops off the sunken band. */}\n <div className=\"field flex items-center gap-1.5\">\n {effectiveBot ? (\n <>\n <Bot className=\"w-3.5 h-3.5 text-accent/70 shrink-0\" />\n <span className=\"text-xs text-text-primary font-mono\">{effectiveBot}</span>\n </>\n ) : (\n <>\n <UserCircle className=\"w-3.5 h-3.5 text-text-tertiary shrink-0\" />\n <span className=\"text-xs text-text-primary\">\n {user?.displayName || user?.username || 'you'}\n </span>\n </>\n )}\n </div>\n </div>\n {showOverride && onOverrideChange && (\n <div>\n <label className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium mb-1 block\">Override identity</label>\n <BotPicker\n selected={overrideBot ?? ''}\n onChange={onOverrideChange}\n placeholder={config.execute_as ? `Default: ${config.execute_as}` : 'Invoking user (default)'}\n />\n </div>\n )}\n </div>\n );\n}\n","import { useEffect, useMemo, useState } from 'react';\nimport { AlertTriangle, ShieldCheck } from 'lucide-react';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { foldWorkflowLookups, useWorkflowLookups } from '../../../api/workflows';\nimport type { InvocableWorkflow } from '../../../api/types';\nimport { WorkflowIcon } from '../../../components/common/display/WorkflowIcon';\nimport { MarkdownRenderer } from '../../../components/common/display/MarkdownRenderer';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { IdentitySummary } from './IdentitySummary';\nimport { LegacyInvokeForm } from './LegacyInvokeForm';\nimport { RichInvokeForm } from './RichInvokeForm';\nimport { useInvokeSubmit } from './use-invoke-submit';\n\n/**\n * The form column. The workflow's name is the column's heading and stays\n * put; Start stays put at the bottom; description, identity, options, and\n* the fields scroll between them. A declared input_schema renders the\n * x-lt-* form, with pinned input_lookups resolved into its lookup domain;\n * otherwise the envelope template form.\n */\nexport function StartNowPanel({ selected }: { selected: InvocableWorkflow }) {\n const { isSuperAdmin, hasRoleType } = useAuth();\n const isAdmin = isSuperAdmin || hasRoleType('admin');\n const [overrideBot, setOverrideBot] = useState('');\n // Per-run interceptor opt-out, offered when the registration is certified.\n const [certified, setCertified] = useState(selected.certified);\n\n useEffect(() => {\n setOverrideBot('');\n setCertified(selected.certified);\n }, [selected.workflow_type, selected.certified]);\n\n const metadata = useMemo(() => {\n const md = selected.envelope_schema?.metadata;\n return md && typeof md === 'object' ? (md as Record<string, unknown>) : {};\n }, [selected.envelope_schema]);\n\n const hasLookups = Array.isArray(selected.input_lookups) && selected.input_lookups.length > 0;\n const { data: lookupData } = useWorkflowLookups(selected.workflow_type, hasLookups);\n const lookup = useMemo(() => (lookupData ? foldWorkflowLookups(lookupData.lookups) : undefined), [lookupData]);\n const missingLookups = lookupData?.lookups.filter((l) => l.missing) ?? [];\n\n const submission = useInvokeSubmit(selected, { certified, overrideBot });\n\n const lead = (\n <>\n {selected.description && (\n <MarkdownRenderer content={selected.description} className=\"text-xs text-text-secondary leading-relaxed\" />\n )}\n <IdentitySummary\n config={selected}\n overrideBot={overrideBot}\n onOverrideChange={setOverrideBot}\n showOverride={isAdmin}\n />\n {selected.certified && (\n <label className=\"flex items-center gap-2 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={certified}\n onChange={(e) => setCertified(e.target.checked)}\n className=\"rounded border-surface-border text-accent focus:ring-accent/30\"\n />\n <ShieldCheck className=\"w-3.5 h-3.5 text-text-tertiary\" />\n <span className=\"text-xs text-text-secondary\">Enable task tracking and escalation routing</span>\n </label>\n )}\n </>\n );\n\n return (\n <div className=\"max-w-form\" data-testid=\"invoke-form\">\n {/* Sticks to the top of the shell scroll; the pulled-up padding covers the page gutter above it. */}\n <header className=\"sticky top-0 z-10 bg-surface -mt-8 pt-8 flex items-baseline gap-3 min-w-0 pb-3 mb-5 border-b border-surface-border/60\">\n <WorkflowIcon icon={selected.icon} tier={selected.tier} className=\"w-7 h-7 self-center shrink-0 text-accent\" />\n <h2 className=\"heading-2 truncate\" title={selected.workflow_type}>\n {identifierToTitle(selected.workflow_type)}\n </h2>\n <span className=\"text-2xs font-mono text-text-quaternary shrink-0\">{selected.workflow_type}</span>\n <span className=\"text-2xs uppercase tracking-widest text-text-tertiary shrink-0\">{selected.tier}</span>\n {selected.task_queue && (\n <span className=\"text-2xs font-mono text-text-quaternary truncate\">{selected.task_queue}</span>\n )}\n </header>\n\n {missingLookups.length > 0 && (\n <p className=\"flex items-center gap-1.5 text-2xs text-status-warning mb-4\" data-testid=\"lookup-missing\">\n <AlertTriangle className=\"w-3 h-3 shrink-0\" strokeWidth={1.5} />\n {missingLookups.map((l) => `${l.domain}/${l.key} v${l.version}`).join(', ')} {missingLookups.length === 1 ? 'is' : 'are'} not available; the fields that read {missingLookups.length === 1 ? 'it' : 'them'} fall back to plain inputs.\n </p>\n )}\n\n {selected.input_schema ? (\n <RichInvokeForm selected={selected} schema={selected.input_schema} metadata={metadata} lookup={lookup} submission={submission} lead={lead} />\n ) : (\n <LegacyInvokeForm selected={selected} metadata={metadata} submission={submission} lead={lead} />\n )}\n </div>\n );\n}\n","import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport { useInvocableWorkflows, useCronStatus } from '../../../api/workflows';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { FilterSelect, FilterInput } from '../../../components/common/data/FilterBar';\nimport { useMediaQuery } from '../../../hooks/useMediaQuery';\nimport type { InvocableWorkflow, WorkflowTier } from '../../../api/types';\nimport { WorkflowSelector, workflowQueues, firstWorkflowType } from './WorkflowSelector';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { StartNowPanel } from './StartNowPanel';\n\nconst TYPE_PARAM = 'type';\n// A few dozen workflows read fine grouped by queue; the filters wait for scale to demand them.\nconst LIST_FILTERS_VISIBLE = false;\n\n/**\n * Invoke — the list of workflows the caller may run beside the form for the\n * one chosen. The list is grouped by queue and takes a quarter of the row;\n * the form takes the rest. Selection lives in `?type=`, and the first row\n * is preselected so the page opens on a form, never on an empty column.\n */\nexport function StartWorkflowPage() {\n const [searchParams, setSearchParams] = useSearchParams();\n const { data: invocable, isLoading } = useInvocableWorkflows();\n const { data: cronEntries } = useCronStatus();\n // Below xl the list and the form cannot share the row: the list folds\n // into a select and the form takes the full width.\n const compact = useMediaQuery('(max-width: 1279px)');\n\n const selectedType = searchParams.get(TYPE_PARAM) ?? '';\n const [search, setSearch] = useState('');\n const [activeQueue, setActiveQueue] = useState<string | null>(null);\n\n const workflows: InvocableWorkflow[] = invocable ?? [];\n const tierMap = useMemo(() => {\n const map = new Map<string, WorkflowTier>();\n for (const w of workflows) map.set(w.workflow_type, w.tier);\n return map;\n }, [workflows]);\n const selected = workflows.find((c) => c.workflow_type === selectedType);\n const activeTypes = new Set((cronEntries ?? []).filter((e) => e.active).map((e) => e.workflow_type));\n\n // A user's choice is a history entry; the opening preselect only rewrites the landing URL.\n const setType = useCallback(\n (value: string | null, opts: { replace?: boolean } = {}) => {\n setSearchParams(\n (prev) => {\n const next = new URLSearchParams(prev);\n if (value) next.set(TYPE_PARAM, value);\n else next.delete(TYPE_PARAM);\n return next;\n },\n { replace: opts.replace ?? false },\n );\n },\n [setSearchParams],\n );\n\n useEffect(() => {\n if (searchParams.get(TYPE_PARAM) || workflows.length === 0) return;\n const first = firstWorkflowType(workflows);\n if (first) setType(first, { replace: true });\n }, [workflows, searchParams, setType]);\n\n if (isLoading) {\n return (\n <div className=\"animate-pulse space-y-4\">\n <div className=\"h-8 bg-surface-sunken rounded w-48\" />\n <div className=\"h-40 bg-surface-sunken rounded\" />\n </div>\n );\n }\n\n const queues = workflowQueues(workflows);\n const form = selected\n ? <StartNowPanel selected={selected} />\n : <p className=\"text-xs text-text-tertiary\">Choose a tool to begin.</p>;\n\n return (\n <div>\n <PageHeader title=\"Invoke Tool\" docsHash=\"#docs:dashboard.md:invoke-tool\" />\n\n {workflows.length === 0 ? (\n <div className=\"py-16 text-center\">\n <p className=\"text-sm text-text-primary mb-1\">No tools to invoke</p>\n <p className=\"text-xs text-text-tertiary\">Mark workflows as invocable in the registry, or start the server with examples enabled.</p>\n </div>\n ) : compact ? (\n <>\n <label className=\"block mb-6 max-w-2xl\">\n <span className=\"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1\">Tool</span>\n <select\n value={selectedType}\n onChange={(e) => setType(e.target.value || null)}\n className=\"select text-xs font-mono w-full\"\n >\n <option value=\"\">Choose a tool…</option>\n {queues.map((q) => (\n <optgroup key={q} label={identifierToTitle(q)}>\n {workflows\n .filter((c) => (c.task_queue || '') === q)\n .map((c) => (\n <option key={c.workflow_type} value={c.workflow_type}>{identifierToTitle(c.workflow_type)}</option>\n ))}\n </optgroup>\n ))}\n {workflows\n .filter((c) => !c.task_queue)\n .map((c) => (\n <option key={c.workflow_type} value={c.workflow_type}>{identifierToTitle(c.workflow_type)}</option>\n ))}\n </select>\n </label>\n {/* The form heading pulls itself up over the page gutter when stuck; give it that room here so it never covers the picker. */}\n <div className=\"pt-8\">{form}</div>\n </>\n ) : (\n <div className=\"flex gap-10 items-start\">\n {/* The page scrolls as a whole; the list column and the form's title and Start stick while the title of the page rides away. */}\n <aside className=\"w-1/4 min-w-[15rem] shrink-0 sticky top-0 self-start -mt-8 pt-8 max-h-[calc(100vh-5rem)] overflow-y-auto pr-1 space-y-4\" data-testid=\"invoke-list\">\n {LIST_FILTERS_VISIBLE && <div className=\"flex flex-col gap-3\">\n {queues.length > 1 && (\n <FilterSelect\n label=\"Queue\"\n value={activeQueue ?? ''}\n onChange={(v) => setActiveQueue(v || null)}\n options={queues.map((q) => ({ value: q, label: q }))}\n />\n )}\n <FilterInput\n label=\"Search\"\n value={search}\n onChange={setSearch}\n placeholder={`${workflows.length} workflows…`}\n />\n </div>}\n <WorkflowSelector\n configs={workflows}\n selectedType={selectedType}\n onSelect={(c) => setType(c.workflow_type)}\n tierMap={tierMap}\n activeTypes={activeTypes}\n search={search}\n activeQueue={activeQueue}\n compact\n />\n </aside>\n <section className=\"flex-1 min-w-0\">{form}</section>\n </div>\n )}\n </div>\n );\n}\n","import { StartWorkflowPage } from './StartWorkflowPage';\n\nexport function DurableInvokePage() {\n return <StartWorkflowPage />;\n}\n"],"names":["useMediaQuery","query","matches","setMatches","useState","useEffect","mql","onChange","e","NO_QUEUE_LABEL","workflowQueues","configs","c","groupWorkflows","search","activeQueue","q","_a","sections","queue","g","noQueue","firstWorkflowType","_b","WorkflowSelector","selectedType","onSelect","tierMap","activeTypes","compact","grouped","useMemo","jsx","workflows","jsxs","Server","Wrench","identifierToTitle","config","WorkflowRow","isSelected","tier","cronActive","variant","WorkflowIcon","Clock","WorkflowPill","Bot","NamespacePill","Play","IdentitySummary","overrideBot","onOverrideChange","showOverride","user","useAuth","effectiveBot","Fragment","UserCircle","BotPicker","StartNowPanel","selected","isSuperAdmin","hasRoleType","isAdmin","setOverrideBot","certified","setCertified","metadata","md","hasLookups","lookupData","useWorkflowLookups","lookup","foldWorkflowLookups","missingLookups","l","submission","useInvokeSubmit","lead","MarkdownRenderer","ShieldCheck","AlertTriangle","RichInvokeForm","LegacyInvokeForm","TYPE_PARAM","LIST_FILTERS_VISIBLE","StartWorkflowPage","searchParams","setSearchParams","useSearchParams","invocable","isLoading","useInvocableWorkflows","cronEntries","useCronStatus","setSearch","setActiveQueue","map","w","setType","useCallback","value","opts","prev","next","first","queues","form","PageHeader","DurableInvokePage"],"mappings":"u3BAQO,SAASA,EAAcC,EAAwB,CACpD,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAkB,IAAM,CACpD,GAAI,CACF,OAAO,OAAO,WAAWH,CAAK,EAAE,OAClC,MAAQ,CACN,MAAO,EACT,CACF,CAAC,EAEDI,OAAAA,EAAAA,UAAU,IAAM,CACd,IAAIC,EACJ,GAAI,CACFA,EAAM,OAAO,WAAWL,CAAK,CAC/B,MAAQ,CACN,MACF,CACAE,EAAWG,EAAI,OAAO,EACtB,MAAMC,EAAYC,GAA2BL,EAAWK,EAAE,OAAO,EACjE,OAAAF,EAAI,iBAAiB,SAAU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,as as me}from"./index-CgUcYveM.js";import{u as J}from"./useFilterParams-DBRw1Hcv.js";import{D as H}from"./DataTable-spX1dFyb.js";import{S as Y}from"./StickyPagination-9ITrei_d.js";import{F as Q,a as W,b as X}from"./FilterBar-CvMBCVIo.js";import{C as I}from"./ConfirmDeleteModal-BqzOwhPr.js";import{R as Z,a as R}from"./RowActions-Bdd7z4eB.js";import{P as ee}from"./PageHeader-Csq434-v.js";import{R as E}from"./RolePill-BafrASDX.js";import{u as ue,a as pe,b as he,c as je,d as fe,e as ve,f as ge,g as ye,h as be}from"./bots-DX6jjqtF.js";import{T as Ne}from"./TimeAgo-0YVMBwls.js";import{ab as we,ac as ke,ba as Se,z as F,g as Ce,aa as te,at as Pe,D as se,U as _e,f as Re}from"./vendor-icons-B7OcUM6b.js";import{u as Ae,a as Ee,b as Ue,c as Be}from"./personas-30azkJ_s.js";import{S as De}from"./ScopeBadge-b6MIBiYD.js";import{L as Te,f as Ke}from"./vendor-react-_9U4mKFr.js";import{S as Ie}from"./SegmentedTabs-BpJh4Hwn.js";import"./EmptyState-DgC_6njU.js";import"./useContainerWidth-DSLp1gEm.js";function Fe({open:a,onClose:r}){const t=le(),[n,i]=d.useState({external_id:"",email:"",display_name:"",password:""}),[m,f]=d.useState(a);a!==m&&(f(a),a&&i({external_id:"",email:"",display_name:"",password:""}));const h=()=>{n.external_id.trim()&&t.mutate({external_id:n.external_id.trim(),email:n.email.trim()||void 0,display_name:n.display_name.trim()||void 0,password:n.password||void 0},{onSuccess:r})},u=(s,j)=>i(p=>({...p,[s]:j}));return e.jsx(A,{open:a,onClose:r,title:"Create User",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"External ID (required)"}),e.jsx("input",{type:"text",value:n.external_id,onChange:s=>u("external_id",s.target.value),placeholder:"e.g., john.doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:n.display_name,onChange:s=>u("display_name",s.target.value),placeholder:"John Doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:n.email,onChange:s=>u("email",s.target.value),placeholder:"john@example.com",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Password"}),e.jsx("input",{type:"password",value:n.password,onChange:s=>u("password",s.target.value),placeholder:"Leave blank for no password",className:"input text-xs w-full"})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:h,disabled:!n.external_id.trim()||t.isPending,className:"btn-primary text-xs",children:t.isPending?"Creating...":"Create"})]})]})})}function Me({open:a,onClose:r,user:t}){const n=re(),[i,m]=d.useState({display_name:"",email:"",status:"active"}),[f,h]=d.useState(t);t!==f&&(h(t),t&&m({display_name:t.display_name??"",email:t.email??"",status:t.status}));const u=()=>{t&&n.mutate({id:t.id,display_name:i.display_name.trim()||void 0,email:i.email.trim()||void 0,status:i.status},{onSuccess:r})};return e.jsx(A,{open:a,onClose:r,title:`Edit — ${(t==null?void 0:t.display_name)||(t==null?void 0:t.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:i.display_name,onChange:s=>m(j=>({...j,display_name:s.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:i.email,onChange:s=>m(j=>({...j,email:s.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:i.status,onChange:s=>m(j=>({...j,status:s.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),n.error&&e.jsx("p",{className:"text-xs text-status-error",children:n.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:u,disabled:n.isPending,className:"btn-primary text-xs",children:n.isPending?"Saving...":"Save"})]})]})})}function Oe({open:a,onClose:r}){const t=ue(),[n,i]=d.useState({name:"",display_name:"",description:""}),[m,f]=d.useState(a);a!==m&&(f(a),a&&i({name:"",display_name:"",description:""}));const h=()=>{n.name.trim()&&t.mutate({name:n.name.trim(),display_name:n.display_name.trim()||void 0,description:n.description.trim()||void 0},{onSuccess:r})},u=(s,j)=>i(p=>({...p,[s]:j}));return e.jsx(A,{open:a,onClose:r,title:"Create Service Account",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Name (required)"}),e.jsx("input",{type:"text",value:n.name,onChange:s=>u("name",s.target.value.replace(/\s+/g,"-").toLowerCase()),placeholder:"e.g., ci-bot",className:"input text-xs w-full font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:n.display_name,onChange:s=>u("display_name",s.target.value),placeholder:"CI Bot",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:n.description,onChange:s=>u("description",s.target.value),placeholder:"Runs scheduled workflows",className:"input text-xs w-full"})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:h,disabled:!n.name.trim()||t.isPending,className:"btn-primary text-xs",children:t.isPending?"Creating...":"Create"})]})]})})}function $e({open:a,onClose:r,bot:t}){const n=pe(),[i,m]=d.useState({display_name:"",description:"",status:"active"}),[f,h]=d.useState(t);t!==f&&(h(t),t&&m({display_name:t.display_name??"",description:t.description??"",status:t.status}));const u=()=>{t&&n.mutate({id:t.id,display_name:i.display_name.trim()||void 0,description:i.description.trim()||void 0,status:i.status},{onSuccess:r})};return e.jsx(A,{open:a,onClose:r,title:`Edit — ${(t==null?void 0:t.display_name)||(t==null?void 0:t.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:i.display_name,onChange:s=>m(j=>({...j,display_name:s.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:i.description,onChange:s=>m(j=>({...j,description:s.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:i.status,onChange:s=>m(j=>({...j,status:s.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),n.error&&e.jsx("p",{className:"text-xs text-status-error",children:n.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:u,disabled:n.isPending,className:"btn-primary text-xs",children:n.isPending?"Saving...":"Save"})]})]})})}function ze({botId:a}){const{data:r}=he(a),t=je(),n=fe(),[i,m]=d.useState(""),[f,h]=d.useState("read"),[u,s]=d.useState(null),[j,p]=d.useState(!1),[v,x]=d.useState(null),y=(r==null?void 0:r.keys)??[],o={read:{label:"Read only",scopes:["mcp:read"],hint:"Discovery and monitoring — read-safe tools only"},full:{label:"Full access",scopes:["mcp:read","mcp:full"],hint:"All tools — can modify state"}},b=()=>{i.trim()&&t.mutate({botId:a,name:i.trim(),scopes:o[f].scopes},{onSuccess:g=>{s(g.rawKey),m("")}})},N=()=>{u&&(navigator.clipboard.writeText(u),p(!0),setTimeout(()=>p(!1),2e3))},k=()=>{v&&n.mutate({botId:a,keyId:v.id},{onSuccess:()=>x(null)})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"API Keys"}),u&&e.jsxs("div",{className:"mb-3 p-3 bg-status-success/10 border border-status-success/30 rounded-md",children:[e.jsx("p",{className:"text-2xs font-semibold text-status-success mb-1",children:"Key generated — copy now, it won't be shown again"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"text-2xs font-mono text-text-primary bg-surface-sunken px-2 py-1 rounded flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:u}),e.jsx("button",{onClick:N,className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Copy to clipboard",children:j?e.jsx(we,{className:"w-3.5 h-3.5 text-status-success"}):e.jsx(ke,{className:"w-3.5 h-3.5"})})]})]}),y.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No API keys."}):e.jsx("div",{className:"space-y-1.5 mb-3",children:y.map(g=>e.jsxs("div",{className:"group/key flex items-center justify-between px-2.5 py-1.5 bg-surface-sunken rounded text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Se,{className:"w-3 h-3 text-text-tertiary"}),e.jsx("span",{className:"text-text-primary font-mono",children:g.name}),(g.scopes??[]).map(l=>e.jsx("span",{className:`px-1.5 py-0.5 rounded text-2xs font-mono ${l.includes("full")?"bg-status-warning/15 text-status-warning":"bg-accent/10 text-accent"}`,children:l},l)),g.last_used_at&&e.jsxs("span",{className:"text-2xs text-text-tertiary",children:["used ",e.jsx(Ne,{date:g.last_used_at})]})]}),e.jsx("button",{onClick:()=>x(g),className:"opacity-0 group-hover/key:opacity-100 transition-opacity text-text-tertiary hover:text-status-error",title:"Revoke key",children:e.jsx(F,{className:"w-3 h-3"})})]},g.id))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{type:"text",value:i,onChange:g=>m(g.target.value),placeholder:"Key name...",className:"input text-xs font-mono"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex rounded-md border border-surface-border overflow-hidden shrink-0",children:Object.entries(o).map(([g,l])=>e.jsx("button",{type:"button",onClick:()=>h(g),title:l.hint,className:`px-2.5 py-1 text-2xs font-medium transition-colors ${f===g?"bg-accent text-text-inverse":"bg-surface text-text-secondary hover:bg-surface-hover"}`,children:l.label},g))}),e.jsxs("button",{onClick:b,disabled:!i.trim()||t.isPending,className:"btn-primary text-xs inline-flex items-center gap-1 shrink-0",children:[e.jsx(Ce,{className:"w-3 h-3"}),t.isPending?"...":"Generate"]})]})]}),t.error&&e.jsx("p",{className:"text-2xs text-status-error mt-1",children:t.error.message}),e.jsx(I,{open:!!v,onClose:()=>x(null),onConfirm:k,title:"Revoke API Key",description:e.jsxs(e.Fragment,{children:["Revoke API key"," ",e.jsx("span",{className:"font-medium text-text-primary font-mono",children:v==null?void 0:v.name}),"? This bot will no longer be able to authenticate with this key."]}),isPending:n.isPending,error:n.error})]})}function Le({bot:a}){const{data:r}=G(),t=ve(),n=ge(),[i,m]=d.useState(""),[f,h]=d.useState("member"),u=(r==null?void 0:r.roles)??[],s=a.roles??[],j=d.useMemo(()=>{const x=new Set(s.map(y=>y.role));return u.filter(y=>!x.has(y))},[u,s]),p=()=>{i.trim()&&t.mutate({botId:a.id,role:i.trim(),type:f},{onSuccess:()=>{m(""),h("member")}})},v=x=>{n.mutate({botId:a.id,role:x})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"Roles"}),s.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:s.map(x=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx(E,{role:x.role}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:x.type}),e.jsx("button",{onClick:()=>v(x.role),className:"text-text-tertiary hover:text-status-error transition-colors ml-0.5",title:`Remove ${x.role}`,children:"×"})]},x.role))}),j.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("select",{value:i,onChange:x=>m(x.target.value),className:"select text-xs font-mono w-full min-w-0","aria-label":"Role",children:[e.jsx("option",{value:"",children:"Select a role..."}),j.map(x=>e.jsx("option",{value:x,children:x},x))]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 items-end",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{className:"block text-2xs text-text-tertiary mb-1",children:"Type"}),e.jsxs("select",{value:f,onChange:x=>h(x.target.value),className:"select text-xs w-full min-w-0","aria-label":"Role type",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:p,disabled:!i||t.isPending,className:"btn-primary text-xs",children:t.isPending?"...":"Add Role"})})]})]}),t.error&&e.jsx("p",{className:"text-2xs text-status-error mt-1",children:t.error.message})]})}function Ge({bot:a}){return a?e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:a.display_name||a.external_id}),a.description&&e.jsx("p",{className:"text-xs text-text-tertiary mt-0.5",children:a.description})]}),e.jsx(ze,{botId:a.id}),e.jsx(Le,{bot:a})]}):e.jsx("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px]",children:e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a service account to manage its API keys and roles."})})}const Ve={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"},qe=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"suspended",label:"Suspended"}];function Je({embedded:a=!1}){const{filters:r,setFilter:t,pagination:n}=J({filters:{status:"",search:""}}),i=ye(),[m,f]=d.useState(!1),[h,u]=d.useState(null),[s,j]=d.useState(null),[p,v]=d.useState(null),{data:x,isLoading:y}=be({status:r.status||void 0,search:r.search||void 0,limit:n.pageSize,offset:n.offset}),o=(x==null?void 0:x.total)??0,b=(x==null?void 0:x.bots)??[],N=d.useMemo(()=>s?b.find(l=>l.id===s.id)??s:null,[b,s]),k=[{key:"display_name",label:"Service Account",render:l=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${Ve[l.status]??"bg-status-pending"}`,title:l.status}),e.jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:l.display_name||l.external_id})]})},{key:"description",label:"Description",render:l=>e.jsx("span",{className:"block max-w-[32rem] truncate text-xs text-text-tertiary",title:l.description??void 0,children:l.description??""})},{key:"roles",label:"Roles",render:l=>e.jsx("div",{className:"flex gap-1 flex-wrap",children:(l.roles??[]).map(S=>e.jsx(E,{role:S.role},S.role))})},{key:"created_at",label:"Created",render:l=>e.jsx(V,{date:l.created_at}),className:"w-36 whitespace-nowrap"},{key:"actions",label:"",render:l=>e.jsxs(Z,{children:[e.jsx(R,{icon:te,title:"Edit service account",onClick:()=>u(l)}),e.jsx(R,{icon:F,title:"Delete service account",onClick:()=>v(l),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}],g=()=>{p&&i.mutate(p.id,{onSuccess:()=>{v(null),(s==null?void 0:s.id)===p.id&&j(null)}})};return e.jsxs("div",{children:[a?e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>f(!0),className:"btn-primary text-xs",children:"Add Service Account"})}):e.jsx(ee,{title:"Service Accounts",actions:e.jsx("button",{onClick:()=>f(!0),className:"btn-primary text-xs",children:"Add Service Account"})}),e.jsxs(Q,{children:[e.jsx(W,{label:"Search",value:r.search,onChange:l=>t("search",l),placeholder:"name, id, description…"}),e.jsx(X,{label:"Status",value:r.status,onChange:l=>t("status",l),options:qe})]}),e.jsxs("div",{className:"grid grid-cols-1 @split:grid-cols-[1fr_360px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx(H,{columns:k,data:b,keyFn:l=>l.id,isLoading:y,emptyMessage:"No service accounts yet",onRowClick:l=>j(l),activeRowKey:(N==null?void 0:N.id)??null}),e.jsx(Y,{page:n.page,totalPages:n.totalPages(o),onPageChange:n.setPage,total:o,pageSize:n.pageSize,onPageSizeChange:n.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(Ge,{bot:N})})]}),e.jsx(Oe,{open:m,onClose:()=>f(!1)}),e.jsx($e,{open:!!h,onClose:()=>u(null),bot:h}),e.jsx(I,{open:!!p,onClose:()=>v(null),onConfirm:g,title:"Delete Service Account",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(p==null?void 0:p.display_name)||(p==null?void 0:p.external_id)}),"? This will also revoke all API keys. This action cannot be undone."]}),isPending:i.isPending,error:i.error})]})}function He({value:a,systemKeys:r=[],pending:t=!1,error:n,onPatch:i}){const m=Object.entries(a??{}),f=new Set(r),[h,u]=d.useState(null),[s,j]=d.useState(""),[p,v]=d.useState(""),[x,y]=d.useState(null),[o,b]=d.useState(null),[N,k]=d.useState(""),[g,l]=d.useState(""),[S,C]=d.useState(null),P=c=>typeof c=="string"?c:JSON.stringify(c),O=c=>{const w=c.trim();try{return JSON.parse(w)}catch{return w}};function $(c){if(f.has(c)&&o!==c){b(c);return}b(null),u(c),j(c),v(P((a??{})[c])),y(null),C(null)}function ae(){if(h===null)return;const c=s.trim();if(!c){C("Property name is required");return}if(c!==h&&m.some(([B])=>B===c)){C(`"${c}" already exists`);return}const w={};c!==h&&(w.rename={[h]:c});const _=O(p);if((P(_)!==P((a??{})[h])||c!==h)&&P(_)!==P((a??{})[h])&&(w.set={[c]:_}),!w.set&&!w.rename){U();return}i(w),U()}function U(){u(null),j(""),v(""),C(null)}function z(){const c=N.trim();if(!c){C("Property name is required");return}if(m.some(([w])=>w===c)){C(`"${c}" already exists`);return}i({set:{[c]:O(g)}}),k(""),l(""),C(null)}return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Properties"}),m.length===0&&e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No properties — add one below."}),m.map(([c,w])=>{const _=f.has(c),B=h===c,ne=x===c;return e.jsx("div",{className:"group text-xs",children:B?e.jsxs("div",{className:"space-y-1.5 border-l-2 border-l-accent pl-2",children:[e.jsx("input",{value:s,onChange:D=>j(D.target.value),"aria-label":"Property name",className:"input text-xs w-full min-w-0 font-mono"}),e.jsx("input",{value:p,onChange:D=>v(D.target.value),"aria-label":"Property value",placeholder:"value (string or JSON)",className:"input text-xs w-full min-w-0"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:ae,disabled:t,className:"text-2xs font-medium text-accent hover:text-accent-hover",children:t?"Saving...":"Save"}),e.jsx("button",{onClick:U,className:"text-2xs text-text-tertiary hover:text-text-secondary",children:"Cancel"}),e.jsx("button",{onClick:()=>{y(c),u(null)},className:"text-2xs text-status-error/50 hover:text-status-error ml-auto",children:"Remove"})]})]}):ne?e.jsxs("span",{className:"flex items-center gap-2 text-2xs",children:[e.jsxs("span",{className:"text-status-error",children:["Remove ",e.jsx("span",{className:"font-medium font-mono",children:c}),"?"]}),e.jsx("button",{onClick:()=>{i({remove:[c]}),y(null)},disabled:t,className:"font-medium text-status-error hover:text-status-error/80",children:t?"...":"Yes"}),e.jsx("button",{onClick:()=>y(null),className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):o===c?e.jsxs("span",{className:"flex items-center gap-2 text-2xs",children:[e.jsxs("span",{className:"text-text-secondary",children:[e.jsx("span",{className:"font-mono font-medium",children:c})," is a system property — the platform resolves identities with it. Edit?"]}),e.jsx("button",{onClick:()=>$(c),className:"font-medium text-accent hover:text-accent-hover",children:"Edit"}),e.jsx("button",{onClick:()=>b(null),className:"text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}):e.jsxs("button",{onClick:()=>$(c),className:"flex items-center gap-2 w-full min-w-0 text-left rounded px-1 py-0.5 -mx-1 hover:bg-surface-hover transition-colors",title:`Edit ${c}`,children:[e.jsx("span",{className:"font-mono font-medium text-text-secondary shrink-0",children:c}),_&&e.jsx("span",{className:"shrink-0 text-accent/80",title:"system",children:e.jsx(Pe,{className:"w-3 h-3","aria-label":"system"})}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-right text-text-primary tabular-nums",children:P(w)})]})},c)}),e.jsxs("div",{className:"pt-1.5 border-t border-surface-border space-y-1.5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("input",{value:N,onChange:c=>k(c.target.value),placeholder:"property","aria-label":"New property name",className:"input text-xs w-full min-w-0 font-mono"}),e.jsx("input",{value:g,onChange:c=>l(c.target.value),onKeyDown:c=>{c.key==="Enter"&&z()},placeholder:"value","aria-label":"New property value",className:"input text-xs w-full min-w-0"})]}),N.trim()&&e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:z,disabled:t,className:"btn-primary text-xs",children:t?"...":"Add Property"})})]}),(S||n)&&e.jsx("p",{role:"alert",className:"text-2xs text-status-error",children:S||n})]})}const K=[{value:"all|all",label:"See all · act on all",read_scope:"all",write_scope:"all"},{value:"all|self",label:"See all · act on self",read_scope:"all",write_scope:"self"},{value:"self|self",label:"See self · act on self",read_scope:"self",write_scope:"self"},{value:"all|none",label:"See all · read-only",read_scope:"all",write_scope:"none"},{value:"self|none",label:"See self · read-only",read_scope:"self",write_scope:"none"}],T="all|all";function L(a){return K.find(r=>r.value===a)??K[0]}function M({children:a}){return e.jsx("div",{className:"border border-surface-border bg-surface-sunken rounded-[var(--lt-radius-section)] p-4",children:a})}function Ye({user:a}){const r=oe(),{data:t}=de();return e.jsx(M,{children:e.jsx(He,{value:a.metadata??{},systemKeys:(t==null?void 0:t.keys)??[],pending:r.isPending,error:r.error?r.error.message:null,onPatch:n=>r.mutate({id:a.id,ops:n})})})}function Qe({user:a}){const{data:r}=Ae(),{data:t}=Ee(a.id),n=Ue(),i=Be(),[m,f]=d.useState(""),h=(t==null?void 0:t.personas)??[],u=d.useMemo(()=>{const s=new Set(h.map(j=>j.key));return((r==null?void 0:r.personas)??[]).filter(j=>!s.has(j.key))},[r,h]);return h.length===0&&u.length===0?null:e.jsx(M,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Personas"}),h.length>0&&e.jsx("div",{className:"flex flex-col gap-2",children:h.map(s=>e.jsxs("span",{className:"flex items-center gap-2.5 w-full min-w-0 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx(se,{className:"w-3 h-3 shrink-0 text-text-tertiary","aria-hidden":!0}),e.jsx(Te,{to:`/admin/personas/${encodeURIComponent(s.key)}`,className:"flex-1 min-w-0 truncate transition-colors hover:text-accent",title:s.key,children:s.title||s.key}),e.jsxs("span",{className:"shrink-0 text-2xs text-text-tertiary tabular-nums",children:[s.roles.length," role",s.roles.length===1?"":"s"]}),e.jsx("button",{onClick:()=>i.mutate({userId:a.id,key:s.key}),className:"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1",title:`Unassign ${s.title||s.key}`,children:"×"})]},s.key))}),u.length>0&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{value:m,onChange:s=>f(s.target.value),className:"select text-xs w-full min-w-0","aria-label":"Persona",children:[e.jsx("option",{value:"",children:"Assign a persona..."}),u.map(s=>e.jsx("option",{value:s.key,children:s.title||s.key},s.key))]}),e.jsx("button",{onClick:()=>{m&&n.mutate({userId:a.id,key:m},{onSuccess:()=>f("")})},disabled:!m||n.isPending,className:"btn-primary text-xs shrink-0",children:n.isPending?"...":"Assign"})]}),(n.error||i.error)&&e.jsx("p",{className:"text-2xs text-status-error",children:(n.error||i.error).message})]})})}function We({user:a}){const{data:r}=G(),t=ie(),n=ce(),[i,m]=d.useState(""),[f,h]=d.useState("member"),[u,s]=d.useState(T),j=(r==null?void 0:r.roles)??[],p=(a==null?void 0:a.roles)??[],v=d.useMemo(()=>{const o=new Set(p.map(b=>b.role));return j.filter(b=>!o.has(b))},[j,p]),x=()=>{if(!a||!i.trim())return;const o=L(f==="member"?u:T);t.mutate({userId:a.id,role:i.trim(),type:f,read_scope:o.read_scope,write_scope:o.write_scope},{onSuccess:()=>{m(""),h("member"),s(T)}})},y=o=>{a&&n.mutate({userId:a.id,role:o})};return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 pb-8 min-h-[300px]",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-4",children:"Role Membership"}),a?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{children:e.jsx("p",{className:"text-sm text-text-primary",children:a.display_name||a.external_id})}),e.jsx(Qe,{user:a}),e.jsx(M,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Roles"}),p.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-col gap-2",children:p.map(o=>e.jsxs("span",{className:"flex items-center gap-2.5 w-full min-w-0 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate",title:o.role,children:e.jsx(E,{role:o.role,tone:"inherit"})}),e.jsx("span",{className:"w-14 shrink-0 text-2xs uppercase tracking-wide text-text-tertiary",children:o.type}),o.type==="member"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-px h-3 bg-surface-border shrink-0","aria-hidden":!0}),e.jsx(De,{read:o.read_scope,write:o.write_scope,className:"shrink-0"})]}),o.granted_by_persona&&e.jsx("span",{className:"shrink-0",title:`Granted by persona ${o.granted_by_persona}`,children:e.jsx(se,{className:"w-3 h-3 text-text-tertiary","aria-hidden":!0})}),e.jsx("button",{onClick:()=>y(o.role),className:"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1",title:`Remove ${o.role}`,children:"×"})]},o.role))}),v.length>0&&e.jsxs("div",{className:"pt-3 border-t border-surface-border space-y-2",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Add Role"}),e.jsxs("select",{value:i,onChange:o=>m(o.target.value),className:"select text-xs font-mono w-full min-w-0","aria-label":"Role",children:[e.jsx("option",{value:"",children:"Select a role..."}),v.map(o=>e.jsx("option",{value:o,children:o},o))]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{className:"block text-2xs text-text-tertiary mb-1",children:"Type"}),e.jsxs("select",{value:f,onChange:o=>h(o.target.value),className:"select text-xs w-full min-w-0","aria-label":"Role type",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]})]}),f==="member"&&e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{className:"block text-2xs text-text-tertiary mb-1",children:"Scope"}),e.jsx("select",{value:u,onChange:o=>s(o.target.value),className:"select text-xs w-full min-w-0","aria-label":"Work-surface scope",children:K.map(o=>e.jsx("option",{value:o.value,children:o.label},o.value))})]})]}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{onClick:x,disabled:!i||t.isPending,className:"btn-primary text-xs",children:t.isPending?"...":"Add Role"})}),t.error&&e.jsx("p",{className:"text-2xs text-status-error",children:t.error.message})]})]})}),e.jsx(Ye,{user:a})]}):e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a user to manage their roles."})]})}function Xe({active:a,onChange:r}){return e.jsx(Ie,{"aria-label":"Account kind",active:a,onChange:r,tabs:[{key:"users",label:"User Accounts",icon:e.jsx(_e,{className:"w-3.5 h-3.5"})},{key:"service-accounts",label:"Service Accounts",icon:e.jsx(Re,{className:"w-3.5 h-3.5"})}]})}const Ze=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"suspended",label:"Suspended"}],et={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"};function bt(){const{isBuilder:a}=q(),[r,t]=Ke(),n=r.get("tab"),i=a&&n==="service-accounts"?"service-accounts":"users",m=f=>{t(f==="users"?{}:{tab:f})};return e.jsxs("div",{children:[e.jsx(ee,{title:"Accounts",docsHash:"#docs:dashboard.md:accounts",actions:a?e.jsx(Xe,{active:i,onChange:m}):void 0}),i==="users"?e.jsx(tt,{}):e.jsx(Je,{embedded:!0})]})}function tt(){const{isBuilder:a}=q(),{filters:r,setFilter:t,pagination:n}=J({filters:{status:"",search:""}}),i=xe(),[m,f]=d.useState(!1),[h,u]=d.useState(null),[s,j]=d.useState(null),[p,v]=d.useState(null),{data:x,isLoading:y}=me({status:r.status||void 0,search:r.search||void 0,limit:n.pageSize,offset:n.offset}),o=(x==null?void 0:x.total)??0,b=(x==null?void 0:x.users)??[],N=d.useMemo(()=>s?b.find(l=>l.id===s.id)??s:null,[b,s]),k=[{key:"display_name",label:"User",render:l=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${et[l.status]??"bg-status-pending"}`,title:l.status}),e.jsx("span",{className:"text-xs text-text-primary whitespace-nowrap",children:l.display_name||l.external_id})]})},{key:"email",label:"Email",render:l=>l.email?e.jsx("span",{className:"text-xs text-text-secondary whitespace-nowrap",children:l.email}):e.jsx("span",{className:"text-xs text-text-quaternary",children:"—"})},{key:"roles",label:"Roles",render:l=>e.jsx("div",{className:"flex gap-2 flex-wrap",children:(l.roles??[]).map(S=>e.jsx(E,{role:S.role,size:"md"},S.role))})},{key:"created_at",label:"Created",render:l=>e.jsx(V,{date:l.created_at}),className:"w-36 whitespace-nowrap"},...a?[{key:"actions",label:"",render:l=>e.jsxs(Z,{children:[e.jsx(R,{icon:te,title:"Edit user",onClick:()=>u(l)}),e.jsx(R,{icon:F,title:"Delete user",onClick:()=>v(l),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}]:[]],g=()=>{p&&i.mutate(p.id,{onSuccess:()=>v(null)})};return e.jsxs("div",{children:[a&&e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>f(!0),className:"btn-primary text-xs",children:"Add User"})}),e.jsxs(Q,{children:[e.jsx(W,{label:"Search",value:r.search,onChange:l=>t("search",l),placeholder:"name, email, id…"}),e.jsx(X,{label:"Status",value:r.status,onChange:l=>t("status",l),options:Ze})]}),e.jsxs("div",{className:"grid grid-cols-1 @split:grid-cols-[1fr_460px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx(H,{columns:k,data:b,keyFn:l=>l.id,isLoading:y,emptyMessage:"No users found",onRowClick:l=>j(l),activeRowKey:(N==null?void 0:N.id)??null}),e.jsx(Y,{page:n.page,totalPages:n.totalPages(o),onPageChange:n.setPage,total:o,pageSize:n.pageSize,onPageSizeChange:n.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(We,{user:N})})]}),e.jsx(Fe,{open:m,onClose:()=>f(!1)}),e.jsx(Me,{open:!!h,onClose:()=>u(null),user:h}),e.jsx(I,{open:!!p,onClose:()=>v(null),onConfirm:g,title:"Delete User",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(p==null?void 0:p.display_name)||(p==null?void 0:p.external_id)}),"? This action cannot be undone."]}),isPending:i.isPending,error:i.error})]})}export{bt as UsersPage};
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{a as d,j as e}from"./vendor-query-DvWWuNIB.js";import{aF as le,M as A,aG as re,Y as G,g as V,aH as ie,aI as ce,aJ as oe,aK as de,O as q,aL as xe,as as me}from"./index-N71QQ3J5.js";import{u as J}from"./useFilterParams-DBRw1Hcv.js";import{D as H}from"./DataTable-spX1dFyb.js";import{S as Y}from"./StickyPagination-BSUyf5ja.js";import{F as W,a as Q,b as X}from"./FilterBar-Dxd0wNSW.js";import{C as I}from"./ConfirmDeleteModal-D_kAbT_D.js";import{R as Z,a as R}from"./RowActions-Bdd7z4eB.js";import{P as ee}from"./PageHeader-CMd3f4bz.js";import{R as E}from"./RolePill-Di2CAHuD.js";import{u as ue,a as pe,b as he,c as je,d as fe,e as ve,f as ge,g as ye,h as be}from"./bots-bwvWYrXz.js";import{T as Ne}from"./TimeAgo-CCnz84Y4.js";import{ab as we,ac as ke,aL as Se,z as F,g as Ce,aa as te,at as Pe,D as se,U as _e,f as Re}from"./vendor-icons-CeVtUKyP.js";import{u as Ae,a as Ee,b as Ue,c as Be}from"./personas-CDndbkp4.js";import{S as De}from"./ScopeBadge-CSItPVOH.js";import{L as Ke,f as Te}from"./vendor-react-_9U4mKFr.js";import{S as Ie}from"./SegmentedTabs-BpJh4Hwn.js";import"./EmptyState-DgC_6njU.js";import"./useContainerWidth-DSLp1gEm.js";function Fe({open:a,onClose:r}){const t=le(),[n,i]=d.useState({external_id:"",email:"",display_name:"",password:""}),[m,f]=d.useState(a);a!==m&&(f(a),a&&i({external_id:"",email:"",display_name:"",password:""}));const h=()=>{n.external_id.trim()&&t.mutate({external_id:n.external_id.trim(),email:n.email.trim()||void 0,display_name:n.display_name.trim()||void 0,password:n.password||void 0},{onSuccess:r})},u=(s,j)=>i(p=>({...p,[s]:j}));return e.jsx(A,{open:a,onClose:r,title:"Create User",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"External ID (required)"}),e.jsx("input",{type:"text",value:n.external_id,onChange:s=>u("external_id",s.target.value),placeholder:"e.g., john.doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:n.display_name,onChange:s=>u("display_name",s.target.value),placeholder:"John Doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:n.email,onChange:s=>u("email",s.target.value),placeholder:"john@example.com",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Password"}),e.jsx("input",{type:"password",value:n.password,onChange:s=>u("password",s.target.value),placeholder:"Leave blank for no password",className:"input text-xs w-full"})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:h,disabled:!n.external_id.trim()||t.isPending,className:"btn-primary text-xs",children:t.isPending?"Creating...":"Create"})]})]})})}function $e({open:a,onClose:r,user:t}){const n=re(),[i,m]=d.useState({display_name:"",email:"",status:"active"}),[f,h]=d.useState(t);t!==f&&(h(t),t&&m({display_name:t.display_name??"",email:t.email??"",status:t.status}));const u=()=>{t&&n.mutate({id:t.id,display_name:i.display_name.trim()||void 0,email:i.email.trim()||void 0,status:i.status},{onSuccess:r})};return e.jsx(A,{open:a,onClose:r,title:`Edit — ${(t==null?void 0:t.display_name)||(t==null?void 0:t.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:i.display_name,onChange:s=>m(j=>({...j,display_name:s.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:i.email,onChange:s=>m(j=>({...j,email:s.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:i.status,onChange:s=>m(j=>({...j,status:s.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),n.error&&e.jsx("p",{className:"text-xs text-status-error",children:n.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:u,disabled:n.isPending,className:"btn-primary text-xs",children:n.isPending?"Saving...":"Save"})]})]})})}function Me({open:a,onClose:r}){const t=ue(),[n,i]=d.useState({name:"",display_name:"",description:""}),[m,f]=d.useState(a);a!==m&&(f(a),a&&i({name:"",display_name:"",description:""}));const h=()=>{n.name.trim()&&t.mutate({name:n.name.trim(),display_name:n.display_name.trim()||void 0,description:n.description.trim()||void 0},{onSuccess:r})},u=(s,j)=>i(p=>({...p,[s]:j}));return e.jsx(A,{open:a,onClose:r,title:"Create Service Account",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Name (required)"}),e.jsx("input",{type:"text",value:n.name,onChange:s=>u("name",s.target.value.replace(/\s+/g,"-").toLowerCase()),placeholder:"e.g., ci-bot",className:"input text-xs w-full font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:n.display_name,onChange:s=>u("display_name",s.target.value),placeholder:"CI Bot",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:n.description,onChange:s=>u("description",s.target.value),placeholder:"Runs scheduled workflows",className:"input text-xs w-full"})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:h,disabled:!n.name.trim()||t.isPending,className:"btn-primary text-xs",children:t.isPending?"Creating...":"Create"})]})]})})}function Oe({open:a,onClose:r,bot:t}){const n=pe(),[i,m]=d.useState({display_name:"",description:"",status:"active"}),[f,h]=d.useState(t);t!==f&&(h(t),t&&m({display_name:t.display_name??"",description:t.description??"",status:t.status}));const u=()=>{t&&n.mutate({id:t.id,display_name:i.display_name.trim()||void 0,description:i.description.trim()||void 0,status:i.status},{onSuccess:r})};return e.jsx(A,{open:a,onClose:r,title:`Edit — ${(t==null?void 0:t.display_name)||(t==null?void 0:t.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:i.display_name,onChange:s=>m(j=>({...j,display_name:s.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:i.description,onChange:s=>m(j=>({...j,description:s.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:i.status,onChange:s=>m(j=>({...j,status:s.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),n.error&&e.jsx("p",{className:"text-xs text-status-error",children:n.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:u,disabled:n.isPending,className:"btn-primary text-xs",children:n.isPending?"Saving...":"Save"})]})]})})}function ze({botId:a}){const{data:r}=he(a),t=je(),n=fe(),[i,m]=d.useState(""),[f,h]=d.useState("read"),[u,s]=d.useState(null),[j,p]=d.useState(!1),[v,x]=d.useState(null),y=(r==null?void 0:r.keys)??[],o={read:{label:"Read only",scopes:["mcp:read"],hint:"Discovery and monitoring — read-safe tools only"},full:{label:"Full access",scopes:["mcp:read","mcp:full"],hint:"All tools — can modify state"}},b=()=>{i.trim()&&t.mutate({botId:a,name:i.trim(),scopes:o[f].scopes},{onSuccess:g=>{s(g.rawKey),m("")}})},N=()=>{u&&(navigator.clipboard.writeText(u),p(!0),setTimeout(()=>p(!1),2e3))},k=()=>{v&&n.mutate({botId:a,keyId:v.id},{onSuccess:()=>x(null)})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"API Keys"}),u&&e.jsxs("div",{className:"mb-3 p-3 bg-status-success/10 border border-status-success/30 rounded-md",children:[e.jsx("p",{className:"text-2xs font-semibold text-status-success mb-1",children:"Key generated — copy now, it won't be shown again"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"text-2xs font-mono text-text-primary bg-surface-sunken px-2 py-1 rounded flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:u}),e.jsx("button",{onClick:N,className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Copy to clipboard",children:j?e.jsx(we,{className:"w-3.5 h-3.5 text-status-success"}):e.jsx(ke,{className:"w-3.5 h-3.5"})})]})]}),y.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No API keys."}):e.jsx("div",{className:"space-y-1.5 mb-3",children:y.map(g=>e.jsxs("div",{className:"group/key flex items-center justify-between px-2.5 py-1.5 bg-surface-sunken rounded text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Se,{className:"w-3 h-3 text-text-tertiary"}),e.jsx("span",{className:"text-text-primary font-mono",children:g.name}),(g.scopes??[]).map(l=>e.jsx("span",{className:`px-1.5 py-0.5 rounded text-2xs font-mono ${l.includes("full")?"bg-status-warning/15 text-status-warning":"bg-accent/10 text-accent"}`,children:l},l)),g.last_used_at&&e.jsxs("span",{className:"text-2xs text-text-tertiary",children:["used ",e.jsx(Ne,{date:g.last_used_at})]})]}),e.jsx("button",{onClick:()=>x(g),className:"opacity-0 group-hover/key:opacity-100 transition-opacity text-text-tertiary hover:text-status-error",title:"Revoke key",children:e.jsx(F,{className:"w-3 h-3"})})]},g.id))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{type:"text",value:i,onChange:g=>m(g.target.value),placeholder:"Key name...",className:"input text-xs font-mono"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex rounded-md border border-surface-border overflow-hidden shrink-0",children:Object.entries(o).map(([g,l])=>e.jsx("button",{type:"button",onClick:()=>h(g),title:l.hint,className:`px-2.5 py-1 text-2xs font-medium transition-colors ${f===g?"bg-accent text-text-inverse":"bg-surface text-text-secondary hover:bg-surface-hover"}`,children:l.label},g))}),e.jsxs("button",{onClick:b,disabled:!i.trim()||t.isPending,className:"btn-primary text-xs inline-flex items-center gap-1 shrink-0",children:[e.jsx(Ce,{className:"w-3 h-3"}),t.isPending?"...":"Generate"]})]})]}),t.error&&e.jsx("p",{className:"text-2xs text-status-error mt-1",children:t.error.message}),e.jsx(I,{open:!!v,onClose:()=>x(null),onConfirm:k,title:"Revoke API Key",description:e.jsxs(e.Fragment,{children:["Revoke API key"," ",e.jsx("span",{className:"font-medium text-text-primary font-mono",children:v==null?void 0:v.name}),"? This bot will no longer be able to authenticate with this key."]}),isPending:n.isPending,error:n.error})]})}function Le({bot:a}){const{data:r}=G(),t=ve(),n=ge(),[i,m]=d.useState(""),[f,h]=d.useState("member"),u=(r==null?void 0:r.roles)??[],s=a.roles??[],j=d.useMemo(()=>{const x=new Set(s.map(y=>y.role));return u.filter(y=>!x.has(y))},[u,s]),p=()=>{i.trim()&&t.mutate({botId:a.id,role:i.trim(),type:f},{onSuccess:()=>{m(""),h("member")}})},v=x=>{n.mutate({botId:a.id,role:x})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"Roles"}),s.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:s.map(x=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx(E,{role:x.role}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:x.type}),e.jsx("button",{onClick:()=>v(x.role),className:"text-text-tertiary hover:text-status-error transition-colors ml-0.5",title:`Remove ${x.role}`,children:"×"})]},x.role))}),j.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("select",{value:i,onChange:x=>m(x.target.value),className:"select text-xs font-mono w-full min-w-0","aria-label":"Role",children:[e.jsx("option",{value:"",children:"Select a role..."}),j.map(x=>e.jsx("option",{value:x,children:x},x))]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 items-end",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{className:"block text-2xs text-text-tertiary mb-1",children:"Type"}),e.jsxs("select",{value:f,onChange:x=>h(x.target.value),className:"select text-xs w-full min-w-0","aria-label":"Role type",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:p,disabled:!i||t.isPending,className:"btn-primary text-xs",children:t.isPending?"...":"Add Role"})})]})]}),t.error&&e.jsx("p",{className:"text-2xs text-status-error mt-1",children:t.error.message})]})}function Ge({bot:a}){return a?e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:a.display_name||a.external_id}),a.description&&e.jsx("p",{className:"text-xs text-text-tertiary mt-0.5",children:a.description})]}),e.jsx(ze,{botId:a.id}),e.jsx(Le,{bot:a})]}):e.jsx("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px]",children:e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a service account to manage its API keys and roles."})})}const Ve={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"},qe=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"suspended",label:"Suspended"}];function Je({embedded:a=!1}){const{filters:r,setFilter:t,pagination:n}=J({filters:{status:"",search:""}}),i=ye(),[m,f]=d.useState(!1),[h,u]=d.useState(null),[s,j]=d.useState(null),[p,v]=d.useState(null),{data:x,isLoading:y}=be({status:r.status||void 0,search:r.search||void 0,limit:n.pageSize,offset:n.offset}),o=(x==null?void 0:x.total)??0,b=(x==null?void 0:x.bots)??[],N=d.useMemo(()=>s?b.find(l=>l.id===s.id)??s:null,[b,s]),k=[{key:"display_name",label:"Service Account",render:l=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${Ve[l.status]??"bg-status-pending"}`,title:l.status}),e.jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:l.display_name||l.external_id})]})},{key:"description",label:"Description",render:l=>e.jsx("span",{className:"block max-w-[32rem] truncate text-xs text-text-tertiary",title:l.description??void 0,children:l.description??""})},{key:"roles",label:"Roles",render:l=>e.jsx("div",{className:"flex gap-1 flex-wrap",children:(l.roles??[]).map(S=>e.jsx(E,{role:S.role},S.role))})},{key:"created_at",label:"Created",render:l=>e.jsx(V,{date:l.created_at}),className:"w-36 whitespace-nowrap"},{key:"actions",label:"",render:l=>e.jsxs(Z,{children:[e.jsx(R,{icon:te,title:"Edit service account",onClick:()=>u(l)}),e.jsx(R,{icon:F,title:"Delete service account",onClick:()=>v(l),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}],g=()=>{p&&i.mutate(p.id,{onSuccess:()=>{v(null),(s==null?void 0:s.id)===p.id&&j(null)}})};return e.jsxs("div",{children:[a?e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>f(!0),className:"btn-primary text-xs",children:"Add Service Account"})}):e.jsx(ee,{title:"Service Accounts",actions:e.jsx("button",{onClick:()=>f(!0),className:"btn-primary text-xs",children:"Add Service Account"})}),e.jsxs(W,{children:[e.jsx(Q,{label:"Search",value:r.search,onChange:l=>t("search",l),placeholder:"name, id, description…"}),e.jsx(X,{label:"Status",value:r.status,onChange:l=>t("status",l),options:qe})]}),e.jsxs("div",{className:"grid grid-cols-1 @split:grid-cols-[1fr_360px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx(H,{columns:k,data:b,keyFn:l=>l.id,isLoading:y,emptyMessage:"No service accounts yet",onRowClick:l=>j(l),activeRowKey:(N==null?void 0:N.id)??null}),e.jsx(Y,{page:n.page,totalPages:n.totalPages(o),onPageChange:n.setPage,total:o,pageSize:n.pageSize,onPageSizeChange:n.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(Ge,{bot:N})})]}),e.jsx(Me,{open:m,onClose:()=>f(!1)}),e.jsx(Oe,{open:!!h,onClose:()=>u(null),bot:h}),e.jsx(I,{open:!!p,onClose:()=>v(null),onConfirm:g,title:"Delete Service Account",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(p==null?void 0:p.display_name)||(p==null?void 0:p.external_id)}),"? This will also revoke all API keys. This action cannot be undone."]}),isPending:i.isPending,error:i.error})]})}function He({value:a,systemKeys:r=[],pending:t=!1,error:n,onPatch:i}){const m=Object.entries(a??{}),f=new Set(r),[h,u]=d.useState(null),[s,j]=d.useState(""),[p,v]=d.useState(""),[x,y]=d.useState(null),[o,b]=d.useState(null),[N,k]=d.useState(""),[g,l]=d.useState(""),[S,C]=d.useState(null),P=c=>typeof c=="string"?c:JSON.stringify(c),M=c=>{const w=c.trim();try{return JSON.parse(w)}catch{return w}};function O(c){if(f.has(c)&&o!==c){b(c);return}b(null),u(c),j(c),v(P((a??{})[c])),y(null),C(null)}function ae(){if(h===null)return;const c=s.trim();if(!c){C("Property name is required");return}if(c!==h&&m.some(([B])=>B===c)){C(`"${c}" already exists`);return}const w={};c!==h&&(w.rename={[h]:c});const _=M(p);if((P(_)!==P((a??{})[h])||c!==h)&&P(_)!==P((a??{})[h])&&(w.set={[c]:_}),!w.set&&!w.rename){U();return}i(w),U()}function U(){u(null),j(""),v(""),C(null)}function z(){const c=N.trim();if(!c){C("Property name is required");return}if(m.some(([w])=>w===c)){C(`"${c}" already exists`);return}i({set:{[c]:M(g)}}),k(""),l(""),C(null)}return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Properties"}),m.length===0&&e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No properties — add one below."}),m.map(([c,w])=>{const _=f.has(c),B=h===c,ne=x===c;return e.jsx("div",{className:"group text-xs",children:B?e.jsxs("div",{className:"space-y-1.5 border-l-2 border-l-accent pl-2",children:[e.jsx("input",{value:s,onChange:D=>j(D.target.value),"aria-label":"Property name",className:"input text-xs w-full min-w-0 font-mono"}),e.jsx("input",{value:p,onChange:D=>v(D.target.value),"aria-label":"Property value",placeholder:"value (string or JSON)",className:"input text-xs w-full min-w-0"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:ae,disabled:t,className:"text-2xs font-medium text-accent hover:text-accent-hover",children:t?"Saving...":"Save"}),e.jsx("button",{onClick:U,className:"text-2xs text-text-tertiary hover:text-text-secondary",children:"Cancel"}),e.jsx("button",{onClick:()=>{y(c),u(null)},className:"text-2xs text-status-error/50 hover:text-status-error ml-auto",children:"Remove"})]})]}):ne?e.jsxs("span",{className:"flex items-center gap-2 text-2xs",children:[e.jsxs("span",{className:"text-status-error",children:["Remove ",e.jsx("span",{className:"font-medium font-mono",children:c}),"?"]}),e.jsx("button",{onClick:()=>{i({remove:[c]}),y(null)},disabled:t,className:"font-medium text-status-error hover:text-status-error/80",children:t?"...":"Yes"}),e.jsx("button",{onClick:()=>y(null),className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):o===c?e.jsxs("span",{className:"flex items-center gap-2 text-2xs",children:[e.jsxs("span",{className:"text-text-secondary",children:[e.jsx("span",{className:"font-mono font-medium",children:c})," is a system property — the platform resolves identities with it. Edit?"]}),e.jsx("button",{onClick:()=>O(c),className:"font-medium text-accent hover:text-accent-hover",children:"Edit"}),e.jsx("button",{onClick:()=>b(null),className:"text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}):e.jsxs("button",{onClick:()=>O(c),className:"flex items-center gap-2 w-full min-w-0 text-left rounded px-1 py-0.5 -mx-1 hover:bg-surface-hover transition-colors",title:`Edit ${c}`,children:[e.jsx("span",{className:"font-mono font-medium text-text-secondary shrink-0",children:c}),_&&e.jsx("span",{className:"shrink-0 text-accent/80",title:"system",children:e.jsx(Pe,{className:"w-3 h-3","aria-label":"system"})}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-right text-text-primary tabular-nums",children:P(w)})]})},c)}),e.jsxs("div",{className:"pt-1.5 border-t border-surface-border space-y-1.5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("input",{value:N,onChange:c=>k(c.target.value),placeholder:"property","aria-label":"New property name",className:"input text-xs w-full min-w-0 font-mono"}),e.jsx("input",{value:g,onChange:c=>l(c.target.value),onKeyDown:c=>{c.key==="Enter"&&z()},placeholder:"value","aria-label":"New property value",className:"input text-xs w-full min-w-0"})]}),N.trim()&&e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:z,disabled:t,className:"btn-primary text-xs",children:t?"...":"Add Property"})})]}),(S||n)&&e.jsx("p",{role:"alert",className:"text-2xs text-status-error",children:S||n})]})}const T=[{value:"all|all",label:"See all · act on all",read_scope:"all",write_scope:"all"},{value:"all|self",label:"See all · act on self",read_scope:"all",write_scope:"self"},{value:"self|self",label:"See self · act on self",read_scope:"self",write_scope:"self"},{value:"all|none",label:"See all · read-only",read_scope:"all",write_scope:"none"},{value:"self|none",label:"See self · read-only",read_scope:"self",write_scope:"none"}],K="all|all";function L(a){return T.find(r=>r.value===a)??T[0]}function $({children:a}){return e.jsx("div",{className:"border border-surface-border bg-surface-sunken rounded-[var(--lt-radius-section)] p-4",children:a})}function Ye({user:a}){const r=oe(),{data:t}=de();return e.jsx($,{children:e.jsx(He,{value:a.metadata??{},systemKeys:(t==null?void 0:t.keys)??[],pending:r.isPending,error:r.error?r.error.message:null,onPatch:n=>r.mutate({id:a.id,ops:n})})})}function We({user:a}){const{data:r}=Ae(),{data:t}=Ee(a.id),n=Ue(),i=Be(),[m,f]=d.useState(""),h=(t==null?void 0:t.personas)??[],u=d.useMemo(()=>{const s=new Set(h.map(j=>j.key));return((r==null?void 0:r.personas)??[]).filter(j=>!s.has(j.key))},[r,h]);return h.length===0&&u.length===0?null:e.jsx($,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Personas"}),h.length>0&&e.jsx("div",{className:"flex flex-col gap-2",children:h.map(s=>e.jsxs("span",{className:"flex items-center gap-2.5 w-full min-w-0 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx(se,{className:"w-3 h-3 shrink-0 text-text-tertiary","aria-hidden":!0}),e.jsx(Ke,{to:`/admin/personas/${encodeURIComponent(s.key)}`,className:"flex-1 min-w-0 truncate transition-colors hover:text-accent",title:s.key,children:s.title||s.key}),e.jsxs("span",{className:"shrink-0 text-2xs text-text-tertiary tabular-nums",children:[s.roles.length," role",s.roles.length===1?"":"s"]}),e.jsx("button",{onClick:()=>i.mutate({userId:a.id,key:s.key}),className:"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1",title:`Unassign ${s.title||s.key}`,children:"×"})]},s.key))}),u.length>0&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{value:m,onChange:s=>f(s.target.value),className:"select text-xs w-full min-w-0","aria-label":"Persona",children:[e.jsx("option",{value:"",children:"Assign a persona..."}),u.map(s=>e.jsx("option",{value:s.key,children:s.title||s.key},s.key))]}),e.jsx("button",{onClick:()=>{m&&n.mutate({userId:a.id,key:m},{onSuccess:()=>f("")})},disabled:!m||n.isPending,className:"btn-primary text-xs shrink-0",children:n.isPending?"...":"Assign"})]}),(n.error||i.error)&&e.jsx("p",{className:"text-2xs text-status-error",children:(n.error||i.error).message})]})})}function Qe({user:a}){const{data:r}=G(),t=ie(),n=ce(),[i,m]=d.useState(""),[f,h]=d.useState("member"),[u,s]=d.useState(K),j=(r==null?void 0:r.roles)??[],p=(a==null?void 0:a.roles)??[],v=d.useMemo(()=>{const o=new Set(p.map(b=>b.role));return j.filter(b=>!o.has(b))},[j,p]),x=()=>{if(!a||!i.trim())return;const o=L(f==="member"?u:K);t.mutate({userId:a.id,role:i.trim(),type:f,read_scope:o.read_scope,write_scope:o.write_scope},{onSuccess:()=>{m(""),h("member"),s(K)}})},y=o=>{a&&n.mutate({userId:a.id,role:o})};return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 pb-8 min-h-[300px]",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-4",children:"Role Membership"}),a?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{children:e.jsx("p",{className:"text-sm text-text-primary",children:a.display_name||a.external_id})}),e.jsx(We,{user:a}),e.jsx($,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Roles"}),p.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-col gap-2",children:p.map(o=>e.jsxs("span",{className:"flex items-center gap-2.5 w-full min-w-0 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate",title:o.role,children:e.jsx(E,{role:o.role,tone:"inherit"})}),e.jsx("span",{className:"w-14 shrink-0 text-2xs uppercase tracking-wide text-text-tertiary",children:o.type}),o.type==="member"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-px h-3 bg-surface-border shrink-0","aria-hidden":!0}),e.jsx(De,{read:o.read_scope,write:o.write_scope,className:"shrink-0"})]}),o.granted_by_persona&&e.jsx("span",{className:"shrink-0",title:`Granted by persona ${o.granted_by_persona}`,children:e.jsx(se,{className:"w-3 h-3 text-text-tertiary","aria-hidden":!0})}),e.jsx("button",{onClick:()=>y(o.role),className:"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1",title:`Remove ${o.role}`,children:"×"})]},o.role))}),v.length>0&&e.jsxs("div",{className:"pt-3 border-t border-surface-border space-y-2",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Add Role"}),e.jsxs("select",{value:i,onChange:o=>m(o.target.value),className:"select text-xs font-mono w-full min-w-0","aria-label":"Role",children:[e.jsx("option",{value:"",children:"Select a role..."}),v.map(o=>e.jsx("option",{value:o,children:o},o))]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{className:"block text-2xs text-text-tertiary mb-1",children:"Type"}),e.jsxs("select",{value:f,onChange:o=>h(o.target.value),className:"select text-xs w-full min-w-0","aria-label":"Role type",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]})]}),f==="member"&&e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{className:"block text-2xs text-text-tertiary mb-1",children:"Scope"}),e.jsx("select",{value:u,onChange:o=>s(o.target.value),className:"select text-xs w-full min-w-0","aria-label":"Work-surface scope",children:T.map(o=>e.jsx("option",{value:o.value,children:o.label},o.value))})]})]}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{onClick:x,disabled:!i||t.isPending,className:"btn-primary text-xs",children:t.isPending?"...":"Add Role"})}),t.error&&e.jsx("p",{className:"text-2xs text-status-error",children:t.error.message})]})]})}),e.jsx(Ye,{user:a})]}):e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a user to manage their roles."})]})}function Xe({active:a,onChange:r}){return e.jsx(Ie,{"aria-label":"Account kind",active:a,onChange:r,tabs:[{key:"users",label:"User Accounts",icon:e.jsx(_e,{className:"w-3.5 h-3.5"})},{key:"service-accounts",label:"Service Accounts",icon:e.jsx(Re,{className:"w-3.5 h-3.5"})}]})}const Ze=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"suspended",label:"Suspended"}],et={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"};function bt(){const{isBuilder:a}=q(),[r,t]=Te(),n=r.get("tab"),i=a&&n==="service-accounts"?"service-accounts":"users",m=f=>{t(f==="users"?{}:{tab:f})};return e.jsxs("div",{children:[e.jsx(ee,{title:"Accounts",docsHash:"#docs:dashboard.md:accounts",actions:a?e.jsx(Xe,{active:i,onChange:m}):void 0}),i==="users"?e.jsx(tt,{}):e.jsx(Je,{embedded:!0})]})}function tt(){const{isBuilder:a}=q(),{filters:r,setFilter:t,pagination:n}=J({filters:{status:"",search:""}}),i=xe(),[m,f]=d.useState(!1),[h,u]=d.useState(null),[s,j]=d.useState(null),[p,v]=d.useState(null),{data:x,isLoading:y}=me({status:r.status||void 0,search:r.search||void 0,limit:n.pageSize,offset:n.offset}),o=(x==null?void 0:x.total)??0,b=(x==null?void 0:x.users)??[],N=d.useMemo(()=>s?b.find(l=>l.id===s.id)??s:null,[b,s]),k=[{key:"display_name",label:"User",render:l=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${et[l.status]??"bg-status-pending"}`,title:l.status}),e.jsx("span",{className:"text-xs text-text-primary whitespace-nowrap",children:l.display_name||l.external_id})]})},{key:"email",label:"Email",render:l=>l.email?e.jsx("span",{className:"text-xs text-text-secondary whitespace-nowrap",children:l.email}):e.jsx("span",{className:"text-xs text-text-quaternary",children:"—"})},{key:"roles",label:"Roles",render:l=>e.jsx("div",{className:"flex gap-2 flex-wrap",children:(l.roles??[]).map(S=>e.jsx(E,{role:S.role,size:"md"},S.role))})},{key:"created_at",label:"Created",render:l=>e.jsx(V,{date:l.created_at}),className:"w-36 whitespace-nowrap"},...a?[{key:"actions",label:"",render:l=>e.jsxs(Z,{children:[e.jsx(R,{icon:te,title:"Edit user",onClick:()=>u(l)}),e.jsx(R,{icon:F,title:"Delete user",onClick:()=>v(l),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}]:[]],g=()=>{p&&i.mutate(p.id,{onSuccess:()=>v(null)})};return e.jsxs("div",{children:[a&&e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>f(!0),className:"btn-primary text-xs",children:"Add User"})}),e.jsxs(W,{children:[e.jsx(Q,{label:"Search",value:r.search,onChange:l=>t("search",l),placeholder:"name, email, id…"}),e.jsx(X,{label:"Status",value:r.status,onChange:l=>t("status",l),options:Ze})]}),e.jsxs("div",{className:"grid grid-cols-1 @split:grid-cols-[1fr_460px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx(H,{columns:k,data:b,keyFn:l=>l.id,isLoading:y,emptyMessage:"No users found",onRowClick:l=>j(l),activeRowKey:(N==null?void 0:N.id)??null}),e.jsx(Y,{page:n.page,totalPages:n.totalPages(o),onPageChange:n.setPage,total:o,pageSize:n.pageSize,onPageSizeChange:n.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(Qe,{user:N})})]}),e.jsx(Fe,{open:m,onClose:()=>f(!1)}),e.jsx($e,{open:!!h,onClose:()=>u(null),user:h}),e.jsx(I,{open:!!p,onClose:()=>v(null),onConfirm:g,title:"Delete User",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(p==null?void 0:p.display_name)||(p==null?void 0:p.external_id)}),"? This action cannot be undone."]}),isPending:i.isPending,error:i.error})]})}export{bt as UsersPage};
|
|
2
|
+
//# sourceMappingURL=index-IJmtbuLh.js.map
|