@hotmeshio/long-tail 0.8.4 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/escalations/index.d.ts +1 -1
- package/build/api/escalations/index.js +2 -1
- package/build/api/escalations/resolve.d.ts +28 -0
- package/build/api/escalations/resolve.js +98 -0
- package/build/api/roles.d.ts +21 -0
- package/build/api/roles.js +50 -0
- package/build/lib/db/index.js +12 -1
- package/build/lib/db/migrate.js +27 -0
- package/build/lib/db/schemas/021_role_list_schema.sql +27 -0
- package/build/modules/defaults.d.ts +2 -0
- package/build/modules/defaults.js +3 -1
- package/build/routes/escalations/resolve.js +18 -0
- package/build/routes/roles.js +20 -0
- package/build/sdk/index.d.ts +8 -0
- package/build/sdk/index.js +1 -0
- package/build/services/escalation/crud.d.ts +36 -0
- package/build/services/escalation/crud.js +53 -0
- package/build/services/maintenance/index.js +22 -0
- package/build/services/role/index.d.ts +13 -1
- package/build/services/role/index.js +27 -0
- package/build/services/role/sql.d.ts +14 -2
- package/build/services/role/sql.js +51 -3
- package/build/services/role/types.d.ts +27 -0
- package/build/types/maintenance.d.ts +6 -1
- package/dashboard/dist/assets/{AdminDashboard-B-JptT54.js → AdminDashboard-5bWcBxyS.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-B-JptT54.js.map → AdminDashboard-5bWcBxyS.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-B1Jc6iJk.js → AgentConfigPage-CVg_tFbf.js} +6 -6
- package/dashboard/dist/assets/{AgentConfigPage-B1Jc6iJk.js.map → AgentConfigPage-CVg_tFbf.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-CWpclCOY.js → AgentDetailPage-CLlkIoRQ.js} +4 -4
- package/dashboard/dist/assets/{AgentDetailPage-CWpclCOY.js.map → AgentDetailPage-CLlkIoRQ.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-DyAf5GA2.js → AgentsPage-CjruF_ek.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-DyAf5GA2.js.map → AgentsPage-CjruF_ek.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-h6awiuVk.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-h6awiuVk.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-B1RdaNuY.js → BotPicker-CGEFHHDE.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-B1RdaNuY.js.map → BotPicker-CGEFHHDE.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-CxHDnyjX.js → CapabilitiesPage-BI1tNYun.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-CxHDnyjX.js.map → CapabilitiesPage-BI1tNYun.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-Ds0e8cCO.js → CollapsibleSection-B9f52Z2K.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-Ds0e8cCO.js.map → CollapsibleSection-B9f52Z2K.js.map} +1 -1
- package/dashboard/dist/assets/{CopyableId-blg-gZvT.js → CopyableId-uot2mE_g.js} +2 -2
- package/dashboard/dist/assets/{CopyableId-blg-gZvT.js.map → CopyableId-uot2mE_g.js.map} +1 -1
- package/dashboard/dist/assets/CountdownTimer-C71erQ67.js +2 -0
- package/dashboard/dist/assets/CountdownTimer-C71erQ67.js.map +1 -0
- package/dashboard/dist/assets/{CredentialsPage-D8UVO-3A.js → CredentialsPage-smk5H_mP.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-D8UVO-3A.js.map → CredentialsPage-smk5H_mP.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-ZesYXxCH.js → CronLabel-CCJLmkIq.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-ZesYXxCH.js.map → CronLabel-CCJLmkIq.js.map} +1 -1
- package/dashboard/dist/assets/CustomDurationPicker-DQ28g5GB.js +2 -0
- package/dashboard/dist/assets/CustomDurationPicker-DQ28g5GB.js.map +1 -0
- package/dashboard/dist/assets/DataTable-Byn3oyT9.js +2 -0
- package/dashboard/dist/assets/DataTable-Byn3oyT9.js.map +1 -0
- package/dashboard/dist/assets/{DropZone-SgiK1WOl.js → DropZone-C_Mc4UrO.js} +2 -2
- package/dashboard/dist/assets/{DropZone-SgiK1WOl.js.map → DropZone-C_Mc4UrO.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-CO8S6vdb.js → ElapsedCell-Cw1uvJKx.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-CO8S6vdb.js.map → ElapsedCell-Cw1uvJKx.js.map} +1 -1
- package/dashboard/dist/assets/EscalationListSchemaPage-3v2tiCnq.js +20 -0
- package/dashboard/dist/assets/EscalationListSchemaPage-3v2tiCnq.js.map +1 -0
- package/dashboard/dist/assets/EscalationSchemaPage-DIq2pMED.js +9 -0
- package/dashboard/dist/assets/EscalationSchemaPage-DIq2pMED.js.map +1 -0
- package/dashboard/dist/assets/{EscalationsOverview-DMpRvVql.js → EscalationsOverview-BqOZ1v8w.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DMpRvVql.js.map → EscalationsOverview-BqOZ1v8w.js.map} +1 -1
- package/dashboard/dist/assets/EventTable-CyfHfOWj.js +2 -0
- package/dashboard/dist/assets/EventTable-CyfHfOWj.js.map +1 -0
- package/dashboard/dist/assets/{FilterBar-B4Mk2PvT.js → FilterBar-DDIn8TOs.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-B4Mk2PvT.js.map → FilterBar-DDIn8TOs.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-CTuul-av.js → GraphInvokePage-DbNUaWhH.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-CTuul-av.js.map → GraphInvokePage-DbNUaWhH.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-BKFpOaHX.js → HomePage-Cj9sLt4Z.js} +2 -2
- package/dashboard/dist/assets/{HomePage-BKFpOaHX.js.map → HomePage-Cj9sLt4Z.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-Dz2_neVF.js → ListToolbar-D7PoQOZC.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-Dz2_neVF.js.map → ListToolbar-D7PoQOZC.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-Do-vaEqV.js → McpOverview-D9g1iJyn.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-Do-vaEqV.js.map → McpOverview-D9g1iJyn.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-HwDGNSbN.js → McpQueryDetailPage-DwS1pXdT.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-HwDGNSbN.js.map → McpQueryDetailPage-DwS1pXdT.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-DxMUpQ7R.js → McpQueryPage-DZQ1z6-H.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-DxMUpQ7R.js.map → McpQueryPage-DZQ1z6-H.js.map} +1 -1
- package/dashboard/dist/assets/McpRunDetailPage-Bx6w39lr.js +2 -0
- package/dashboard/dist/assets/{McpRunDetailPage-BzzZIXIk.js.map → McpRunDetailPage-Bx6w39lr.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-D3J42d2i.js → McpRunsPage-C-oS_tTh.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-D3J42d2i.js.map → McpRunsPage-C-oS_tTh.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-SErKwgkb.js → NamespacePill-DhgC3EUO.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-SErKwgkb.js.map → NamespacePill-DhgC3EUO.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-CQzX6jM1.js +2 -0
- package/dashboard/dist/assets/OperationsPage-CQzX6jM1.js.map +1 -0
- package/dashboard/dist/assets/OperatorDashboard-Cqf87ojd.js +2 -0
- package/dashboard/dist/assets/{OperatorDashboard-BqJn8wEZ.js.map → OperatorDashboard-Cqf87ojd.js.map} +1 -1
- package/dashboard/dist/assets/PageHeader-sGNTmSXX.js +2 -0
- package/dashboard/dist/assets/PageHeader-sGNTmSXX.js.map +1 -0
- package/dashboard/dist/assets/{PageHeaderWithStats-W3akV6nB.js → PageHeaderWithStats-87STTAJX.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-W3akV6nB.js.map → PageHeaderWithStats-87STTAJX.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-C8sT2xuE.js → ProcessDetailPage-CplnDXkz.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-C8sT2xuE.js.map → ProcessDetailPage-CplnDXkz.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-eA8buUgd.js → ProcessesListPage-DFOJC27f.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-eA8buUgd.js.map → ProcessesListPage-DFOJC27f.js.map} +1 -1
- package/dashboard/dist/assets/RoleDetailPage-VrWOaPlg.js +8 -0
- package/dashboard/dist/assets/RoleDetailPage-VrWOaPlg.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-DHWixsQR.js → RolePill-C91qbDOW.js} +2 -2
- package/dashboard/dist/assets/{RolePill-DHWixsQR.js.map → RolePill-C91qbDOW.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-BQNQxsMY.js → RolesPage-DdI1rVAP.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-BQNQxsMY.js.map → RolesPage-DdI1rVAP.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-mhusrlYE.js → RunAsSelector-C6EozzKV.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-mhusrlYE.js.map → RunAsSelector-C6EozzKV.js.map} +1 -1
- package/dashboard/dist/assets/SlidePanel-BpWveV1T.js +2 -0
- package/dashboard/dist/assets/SlidePanel-BpWveV1T.js.map +1 -0
- package/dashboard/dist/assets/{StatusBadge-DZ9137bI.js → StatusBadge-CEQMRmSQ.js} +2 -2
- package/dashboard/dist/assets/StatusBadge-CEQMRmSQ.js.map +1 -0
- package/dashboard/dist/assets/{StickyPagination-CqT9Q1I6.js → StickyPagination-BEgkYJ0-.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-CqT9Q1I6.js.map → StickyPagination-BEgkYJ0-.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-jOJaoupp.js → StreamMessageDetail-DWVPtzj7.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-jOJaoupp.js.map → StreamMessageDetail-DWVPtzj7.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-BrfmWgAj.js → SwimlaneTimeline-4NrDJNYc.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-BrfmWgAj.js.map → SwimlaneTimeline-4NrDJNYc.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-CGGC3DTR.js → TagInput-Csm36_pS.js} +2 -2
- package/dashboard/dist/assets/{TagInput-CGGC3DTR.js.map → TagInput-Csm36_pS.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-Cus_JHIC.js → TaskDetailPage-BvdaAUtF.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-Cus_JHIC.js.map → TaskDetailPage-BvdaAUtF.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-D6omQJNY.js → TaskQueuePill-5XdNaqwM.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-D6omQJNY.js.map → TaskQueuePill-5XdNaqwM.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-B7GK8AoX.js → TasksListPage-BxA161LH.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-B7GK8AoX.js.map → TasksListPage-BxA161LH.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-C606LzT3.js → TimeAgo-ChwJ4fjZ.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-C606LzT3.js.map → TimeAgo-ChwJ4fjZ.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-hfh6zvH-.js → TimestampCell-C7KzmvyC.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-hfh6zvH-.js.map → TimestampCell-C7KzmvyC.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-BW0iRwZu.js → ToolPill-CAwj7EPw.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-BW0iRwZu.js.map → ToolPill-CAwj7EPw.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-CsPsyvQq.js → ToolTestPanel-ISkuXtkT.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-CsPsyvQq.js.map → ToolTestPanel-ISkuXtkT.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-Diz6r7zr.js → TopicDetailPage-D8uZ8Wbs.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-Diz6r7zr.js.map → TopicDetailPage-D8uZ8Wbs.js.map} +1 -1
- package/dashboard/dist/assets/TopicsPage-rj88vA_1.js +2 -0
- package/dashboard/dist/assets/{TopicsPage-B6fn7fFh.js.map → TopicsPage-rj88vA_1.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-Cc-5QH5q.js → UserName-D03Lh6Aj.js} +2 -2
- package/dashboard/dist/assets/{UserName-Cc-5QH5q.js.map → UserName-D03Lh6Aj.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-LD9WzPee.js +2 -0
- package/dashboard/dist/assets/WorkflowExecutionPage-LD9WzPee.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowPill-BtNBSplz.js → WorkflowPill-fodIWnT3.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-BtNBSplz.js.map → WorkflowPill-fodIWnT3.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-CHCM6hUa.js → WorkflowsDashboard-DH0jitAb.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-CHCM6hUa.js.map → WorkflowsDashboard-DH0jitAb.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-WeOvl8-_.js → WorkflowsOverview-D6BVaH9e.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-WeOvl8-_.js.map → WorkflowsOverview-D6BVaH9e.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-6GfhVDpv.js → YamlWorkflowDetailPage-D_CfNEqW.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-6GfhVDpv.js.map → YamlWorkflowDetailPage-D_CfNEqW.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-DqcY3ocP.js → YamlWorkflowsPage-BMJgtcAq.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-DqcY3ocP.js.map → YamlWorkflowsPage-BMJgtcAq.js.map} +1 -1
- package/dashboard/dist/assets/{agents-DlzvjNxE.js → agents-Ci0tZDO3.js} +2 -2
- package/dashboard/dist/assets/{agents-DlzvjNxE.js.map → agents-Ci0tZDO3.js.map} +1 -1
- package/dashboard/dist/assets/{bots-CWMN-KUI.js → bots-DZyt1oO4.js} +2 -2
- package/dashboard/dist/assets/{bots-CWMN-KUI.js.map → bots-DZyt1oO4.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-_WSZ7cxO.js → capabilities-DzVKeWyC.js} +2 -2
- package/dashboard/dist/assets/{capabilities-_WSZ7cxO.js.map → capabilities-DzVKeWyC.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-_k9nWZy3.js → controlplane-CQzrn-rD.js} +2 -2
- package/dashboard/dist/assets/{controlplane-_k9nWZy3.js.map → controlplane-CQzrn-rD.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-s29Q4mrF.js +2 -0
- package/dashboard/dist/assets/{escalation-columns-Dyrf6Tdp.js.map → escalation-columns-s29Q4mrF.js.map} +1 -1
- package/dashboard/dist/assets/{index-kKufOPLo.js → index-3SrgIA7w.js} +2 -2
- package/dashboard/dist/assets/{index-kKufOPLo.js.map → index-3SrgIA7w.js.map} +1 -1
- package/dashboard/dist/assets/{index-Dd4Si1Rl.js → index-B2dB90aC.js} +2 -2
- package/dashboard/dist/assets/{index-Dd4Si1Rl.js.map → index-B2dB90aC.js.map} +1 -1
- package/dashboard/dist/assets/index-BSOcWfeR.js +5 -0
- package/dashboard/dist/assets/index-BSOcWfeR.js.map +1 -0
- package/dashboard/dist/assets/{index-uUYXmvFf.js → index-BWy4UvaT.js} +2 -2
- package/dashboard/dist/assets/{index-uUYXmvFf.js.map → index-BWy4UvaT.js.map} +1 -1
- package/dashboard/dist/assets/{index-C3h0qGzG.js → index-BqKxJ2fB.js} +2 -2
- package/dashboard/dist/assets/{index-C3h0qGzG.js.map → index-BqKxJ2fB.js.map} +1 -1
- package/dashboard/dist/assets/{index-DwWP-Z_c.js → index-C9moIiIq.js} +5 -5
- package/dashboard/dist/assets/{index-DwWP-Z_c.js.map → index-C9moIiIq.js.map} +1 -1
- package/dashboard/dist/assets/{index-Dc-Ye2wk.js → index-CcKXMU-s.js} +2 -2
- package/dashboard/dist/assets/{index-Dc-Ye2wk.js.map → index-CcKXMU-s.js.map} +1 -1
- package/dashboard/dist/assets/index-DIPe82gq.css +1 -0
- package/dashboard/dist/assets/{index-D8GcHxNJ.js → index-DOHGHMP7.js} +2 -2
- package/dashboard/dist/assets/{index-D8GcHxNJ.js.map → index-DOHGHMP7.js.map} +1 -1
- package/dashboard/dist/assets/{index-C5Yc3TT7.js → index-DTn4XzYN.js} +2 -2
- package/dashboard/dist/assets/{index-C5Yc3TT7.js.map → index-DTn4XzYN.js.map} +1 -1
- package/dashboard/dist/assets/index-Dv8mzG9B.js +2 -0
- package/dashboard/dist/assets/index-Dv8mzG9B.js.map +1 -0
- package/dashboard/dist/assets/{index-Ex5tEte8.js → index-LwodswlU.js} +2 -2
- package/dashboard/dist/assets/{index-Ex5tEte8.js.map → index-LwodswlU.js.map} +1 -1
- package/dashboard/dist/assets/{index-C7VXLKJs.js → index-kPipMHZx.js} +2 -2
- package/dashboard/dist/assets/{index-C7VXLKJs.js.map → index-kPipMHZx.js.map} +1 -1
- package/dashboard/dist/assets/{index-BiApvBEz.js → index-sdc9ecdW.js} +2 -2
- package/dashboard/dist/assets/{index-BiApvBEz.js.map → index-sdc9ecdW.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-fYoEF4Lx.js → knowledge-fi5z5YLq.js} +2 -2
- package/dashboard/dist/assets/{knowledge-fYoEF4Lx.js.map → knowledge-fi5z5YLq.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-1lzlgtS8.js → mcp-CH8Tj9Pw.js} +2 -2
- package/dashboard/dist/assets/{mcp-1lzlgtS8.js.map → mcp-CH8Tj9Pw.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-nlrAz7m_.js → mcp-query-6alwNh7K.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-nlrAz7m_.js.map → mcp-query-6alwNh7K.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-Ihi7EKXi.js → pipelines-Dqh9PLUw.js} +2 -2
- package/dashboard/dist/assets/{pipelines-Ihi7EKXi.js.map → pipelines-Dqh9PLUw.js.map} +1 -1
- package/dashboard/dist/assets/roles-dJKBZUBh.js +2 -0
- package/dashboard/dist/assets/roles-dJKBZUBh.js.map +1 -0
- package/dashboard/dist/assets/{tasks-Crk9Y3C4.js → tasks-BYz490un.js} +2 -2
- package/dashboard/dist/assets/{tasks-Crk9Y3C4.js.map → tasks-BYz490un.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CtfcCyw9.js → topics-Dt975EWi.js} +2 -2
- package/dashboard/dist/assets/{topics-CtfcCyw9.js.map → topics-Dt975EWi.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-Dn_vN2xE.js → useEventHooks-ZT6RV2Gj.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-Dn_vN2xE.js.map → useEventHooks-ZT6RV2Gj.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-Cfs3vKWk.js → useNamespace-B_G1iE9i.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-Cfs3vKWk.js.map → useNamespace-B_G1iE9i.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-ymobxH47.js → useYamlActivityEvents-DGkvIadL.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-ymobxH47.js.map → useYamlActivityEvents-DGkvIadL.js.map} +1 -1
- package/dashboard/dist/assets/{users-DngGIiC_.js → users-C2jopvM1.js} +2 -2
- package/dashboard/dist/assets/{users-DngGIiC_.js.map → users-C2jopvM1.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-DOIDKgo6.js → vendor-icons-BXhWQC7l.js} +161 -121
- package/dashboard/dist/assets/vendor-icons-BXhWQC7l.js.map +1 -0
- package/dashboard/dist/assets/{workflows-DuUspMAl.js → workflows-By8Wgvig.js} +2 -2
- package/dashboard/dist/assets/{workflows-DuUspMAl.js.map → workflows-By8Wgvig.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-DXQCiOsP.js → yaml-workflows-Cq_vp41d.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-DXQCiOsP.js.map → yaml-workflows-Cq_vp41d.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/api/http/escalations.md +20 -0
- package/docs/api/sdk/escalations.md +37 -2
- package/docs/dashboard.md +16 -3
- package/docs/data.md +1 -1
- package/docs/hitl-guide.md +240 -21
- package/docs/maintenance.md +6 -3
- package/docs/oauth-and-delegation.md +1 -1
- package/package.json +3 -3
- package/dashboard/dist/assets/AvailableEscalationsPage-DDwAgklw.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-DDwAgklw.js.map +0 -1
- package/dashboard/dist/assets/CustomDurationPicker-OKlwH5a_.js +0 -2
- package/dashboard/dist/assets/CustomDurationPicker-OKlwH5a_.js.map +0 -1
- package/dashboard/dist/assets/DataTable-ZWgVQg7F.js +0 -2
- package/dashboard/dist/assets/DataTable-ZWgVQg7F.js.map +0 -1
- package/dashboard/dist/assets/EscalationSchemaPage-Br5sD8-N.js +0 -9
- package/dashboard/dist/assets/EscalationSchemaPage-Br5sD8-N.js.map +0 -1
- package/dashboard/dist/assets/EventTable-BARJeiS2.js +0 -2
- package/dashboard/dist/assets/EventTable-BARJeiS2.js.map +0 -1
- package/dashboard/dist/assets/McpRunDetailPage-BzzZIXIk.js +0 -2
- package/dashboard/dist/assets/OperationsPage-BaM-QDhy.js +0 -2
- package/dashboard/dist/assets/OperationsPage-BaM-QDhy.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-BqJn8wEZ.js +0 -2
- package/dashboard/dist/assets/PageHeader-DJo7yMUR.js +0 -2
- package/dashboard/dist/assets/PageHeader-DJo7yMUR.js.map +0 -1
- package/dashboard/dist/assets/RoleDetailPage-aR-ror5v.js +0 -11
- package/dashboard/dist/assets/RoleDetailPage-aR-ror5v.js.map +0 -1
- package/dashboard/dist/assets/StatusBadge-DZ9137bI.js.map +0 -1
- package/dashboard/dist/assets/TopicsPage-B6fn7fFh.js +0 -2
- package/dashboard/dist/assets/WorkflowExecutionPage-BFq7UdhA.js +0 -2
- package/dashboard/dist/assets/WorkflowExecutionPage-BFq7UdhA.js.map +0 -1
- package/dashboard/dist/assets/escalation-CK8ElYzD.js +0 -2
- package/dashboard/dist/assets/escalation-CK8ElYzD.js.map +0 -1
- package/dashboard/dist/assets/escalation-columns-Dyrf6Tdp.js +0 -2
- package/dashboard/dist/assets/index-BdqKh0UK.css +0 -1
- package/dashboard/dist/assets/index-OV1JoB_P.js +0 -6
- package/dashboard/dist/assets/index-OV1JoB_P.js.map +0 -1
- package/dashboard/dist/assets/index-ZBj6Xgim.js +0 -2
- package/dashboard/dist/assets/index-ZBj6Xgim.js.map +0 -1
- package/dashboard/dist/assets/roles-D4Wn7kE9.js +0 -2
- package/dashboard/dist/assets/roles-D4Wn7kE9.js.map +0 -1
- package/dashboard/dist/assets/useCollapsedSections-BU5HULGs.js +0 -2
- package/dashboard/dist/assets/useCollapsedSections-BU5HULGs.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-DOIDKgo6.js.map +0 -1
|
@@ -13,6 +13,8 @@ exports.updateRoleMetadata = updateRoleMetadata;
|
|
|
13
13
|
exports.getRoleUpstreams = getRoleUpstreams;
|
|
14
14
|
exports.listRoleSchemaVersions = listRoleSchemaVersions;
|
|
15
15
|
exports.getRoleSchema = getRoleSchema;
|
|
16
|
+
exports.listRoleListSchemaVersions = listRoleListSchemaVersions;
|
|
17
|
+
exports.getRoleListSchema = getRoleListSchema;
|
|
16
18
|
exports.getRoleFormSchema = getRoleFormSchema;
|
|
17
19
|
exports.getRoleMetadataSchema = getRoleMetadataSchema;
|
|
18
20
|
exports.deleteRole = deleteRole;
|
|
@@ -143,6 +145,7 @@ async function updateRoleMetadata(role, input) {
|
|
|
143
145
|
provided('priority_facet'), input.priority_facet ?? null,
|
|
144
146
|
input.change_summary ?? null,
|
|
145
147
|
provided('upstream_roles'), upstreams,
|
|
148
|
+
provided('list_schema'), input.list_schema != null ? JSON.stringify(input.list_schema) : null,
|
|
146
149
|
]);
|
|
147
150
|
if (!rows[0])
|
|
148
151
|
return null;
|
|
@@ -184,6 +187,30 @@ async function getRoleSchema(role, version) {
|
|
|
184
187
|
return null;
|
|
185
188
|
return { ...rows[0], role };
|
|
186
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* List the list-schema version history for a role (newest first). The schema is
|
|
192
|
+
* elided — presence flag only; fetch a full snapshot via getRoleListSchema.
|
|
193
|
+
*/
|
|
194
|
+
async function listRoleListSchemaVersions(role) {
|
|
195
|
+
const pool = (0, db_1.getPool)();
|
|
196
|
+
const { rows } = await pool.query(sql_1.LIST_ROLE_LIST_SCHEMA_VERSIONS, [role]);
|
|
197
|
+
return rows;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Fetch a role's list schema. With a version, reads the immutable snapshot from
|
|
201
|
+
* lt_role_list_schemas; without one, the live (latest) column — a role that has
|
|
202
|
+
* never versioned its list schema still answers with version null. Returns null
|
|
203
|
+
* when the role (or the requested version) does not exist.
|
|
204
|
+
*/
|
|
205
|
+
async function getRoleListSchema(role, version) {
|
|
206
|
+
const pool = (0, db_1.getPool)();
|
|
207
|
+
const { rows } = version != null
|
|
208
|
+
? await pool.query(sql_1.GET_ROLE_LIST_SCHEMA_VERSION, [role, version])
|
|
209
|
+
: await pool.query(sql_1.GET_ROLE_LIST_SCHEMA_CURRENT, [role]);
|
|
210
|
+
if (!rows[0])
|
|
211
|
+
return null;
|
|
212
|
+
return { ...rows[0], role };
|
|
213
|
+
}
|
|
187
214
|
/**
|
|
188
215
|
* Fetch a role's live form_schema — the escalation form the dashboard renders.
|
|
189
216
|
*/
|
|
@@ -34,8 +34,13 @@ export declare const DELETE_ROLE = "\n DELETE FROM lt_roles WHERE role = $1";
|
|
|
34
34
|
* touching the same row: the DELETE only removes rows leaving the set, and the
|
|
35
35
|
* INSERT's ON CONFLICT DO NOTHING skips rows that stay (delete+insert of the
|
|
36
36
|
* SAME key in one statement would silently drop it — CTEs share a snapshot).
|
|
37
|
+
*
|
|
38
|
+
* The list_schema ($29 = provided sentinel, $30 = value) versions INDEPENDENTLY
|
|
39
|
+
* of the form/metadata pair: its own current_list_schema_version and its own
|
|
40
|
+
* snapshot table (lt_role_list_schemas), so a list-view edit never advances the
|
|
41
|
+
* resolve form's version. It shares $26 as the change summary.
|
|
37
42
|
*/
|
|
38
|
-
export declare const UPDATE_ROLE_METADATA = "\n WITH updated AS (\n UPDATE lt_roles SET\n title = CASE WHEN $2::boolean THEN $3 ELSE title END,\n description = CASE WHEN $4::boolean THEN $5 ELSE description END,\n form_schema = CASE WHEN $6::boolean THEN $7::jsonb ELSE form_schema END,\n metadata_schema = CASE WHEN $8::boolean THEN $9::jsonb ELSE metadata_schema END,\n properties = CASE WHEN $10::boolean THEN COALESCE($11::jsonb, '{}'::jsonb) ELSE properties END,\n ops_visible = CASE WHEN $12::boolean THEN $13::boolean ELSE ops_visible END,\n parent_role = CASE WHEN $14::boolean THEN $15 ELSE parent_role END,\n sla_minutes = CASE WHEN $16::boolean THEN $17::numeric ELSE sla_minutes END,\n target_per_hour = CASE WHEN $18::boolean THEN $19::numeric ELSE target_per_hour END,\n worker_count = CASE WHEN $20::boolean THEN $21::int ELSE worker_count END,\n priority_threshold_minutes\n = CASE WHEN $22::boolean THEN $23::numeric ELSE priority_threshold_minutes END,\n priority_facet = CASE WHEN $24::boolean THEN $25 ELSE priority_facet END,\n current_schema_version = CASE\n WHEN ($6::boolean AND $7::jsonb IS DISTINCT FROM form_schema)\n OR ($8::boolean AND $9::jsonb IS DISTINCT FROM metadata_schema)\n THEN COALESCE(current_schema_version, 0) + 1\n ELSE current_schema_version END\n WHERE role = $1\n RETURNING\n role, title, description, form_schema, metadata_schema, properties,\n ops_visible, parent_role, sla_minutes, target_per_hour, worker_count,\n priority_threshold_minutes, priority_facet,\n current_schema_version\n ), snapshot AS (\n INSERT INTO lt_role_schemas (role, version, form_schema, metadata_schema, change_summary)\n SELECT role, current_schema_version, form_schema, metadata_schema, $26\n FROM updated\n WHERE ($6::boolean OR $8::boolean) AND current_schema_version IS NOT NULL\n ON CONFLICT (role, version) DO NOTHING\n ), upstream_prune AS (\n DELETE FROM lt_role_upstreams\n WHERE $27::boolean AND role = $1 AND upstream_role <> ALL($28::text[])\n ), upstream_add AS (\n INSERT INTO lt_role_upstreams (role, upstream_role)\n SELECT $1, u FROM unnest($28::text[]) AS u\n WHERE $27::boolean\n ON CONFLICT DO NOTHING\n )\n SELECT * FROM updated";
|
|
43
|
+
export declare const UPDATE_ROLE_METADATA = "\n WITH updated AS (\n UPDATE lt_roles SET\n title = CASE WHEN $2::boolean THEN $3 ELSE title END,\n description = CASE WHEN $4::boolean THEN $5 ELSE description END,\n form_schema = CASE WHEN $6::boolean THEN $7::jsonb ELSE form_schema END,\n metadata_schema = CASE WHEN $8::boolean THEN $9::jsonb ELSE metadata_schema END,\n properties = CASE WHEN $10::boolean THEN COALESCE($11::jsonb, '{}'::jsonb) ELSE properties END,\n ops_visible = CASE WHEN $12::boolean THEN $13::boolean ELSE ops_visible END,\n parent_role = CASE WHEN $14::boolean THEN $15 ELSE parent_role END,\n sla_minutes = CASE WHEN $16::boolean THEN $17::numeric ELSE sla_minutes END,\n target_per_hour = CASE WHEN $18::boolean THEN $19::numeric ELSE target_per_hour END,\n worker_count = CASE WHEN $20::boolean THEN $21::int ELSE worker_count END,\n priority_threshold_minutes\n = CASE WHEN $22::boolean THEN $23::numeric ELSE priority_threshold_minutes END,\n priority_facet = CASE WHEN $24::boolean THEN $25 ELSE priority_facet END,\n list_schema = CASE WHEN $29::boolean THEN $30::jsonb ELSE list_schema END,\n current_schema_version = CASE\n WHEN ($6::boolean AND $7::jsonb IS DISTINCT FROM form_schema)\n OR ($8::boolean AND $9::jsonb IS DISTINCT FROM metadata_schema)\n THEN COALESCE(current_schema_version, 0) + 1\n ELSE current_schema_version END,\n current_list_schema_version = CASE\n WHEN $29::boolean AND $30::jsonb IS DISTINCT FROM list_schema\n THEN COALESCE(current_list_schema_version, 0) + 1\n ELSE current_list_schema_version END\n WHERE role = $1\n RETURNING\n role, title, description, form_schema, metadata_schema, properties,\n ops_visible, parent_role, sla_minutes, target_per_hour, worker_count,\n priority_threshold_minutes, priority_facet,\n current_schema_version, list_schema, current_list_schema_version\n ), snapshot AS (\n INSERT INTO lt_role_schemas (role, version, form_schema, metadata_schema, change_summary)\n SELECT role, current_schema_version, form_schema, metadata_schema, $26\n FROM updated\n WHERE ($6::boolean OR $8::boolean) AND current_schema_version IS NOT NULL\n ON CONFLICT (role, version) DO NOTHING\n ), list_snapshot AS (\n INSERT INTO lt_role_list_schemas (role, version, list_schema, change_summary)\n SELECT role, current_list_schema_version, list_schema, $26\n FROM updated\n WHERE $29::boolean AND current_list_schema_version IS NOT NULL\n ON CONFLICT (role, version) DO NOTHING\n ), upstream_prune AS (\n DELETE FROM lt_role_upstreams\n WHERE $27::boolean AND role = $1 AND upstream_role <> ALL($28::text[])\n ), upstream_add AS (\n INSERT INTO lt_role_upstreams (role, upstream_role)\n SELECT $1, u FROM unnest($28::text[]) AS u\n WHERE $27::boolean\n ON CONFLICT DO NOTHING\n )\n SELECT * FROM updated";
|
|
39
44
|
export declare const GET_ROLE_FORM_SCHEMA = "\n SELECT form_schema FROM lt_roles WHERE role = $1";
|
|
40
45
|
export declare const GET_ROLE_METADATA_SCHEMA = "\n SELECT metadata_schema FROM lt_roles WHERE role = $1";
|
|
41
46
|
export declare const GET_ROLE_UPSTREAMS = "\n SELECT upstream_role FROM lt_role_upstreams WHERE role = $1 ORDER BY upstream_role";
|
|
@@ -46,7 +51,14 @@ export declare const GET_ROLE_SCHEMA_VERSION = "\n SELECT s.role, s.version, s.
|
|
|
46
51
|
* versioned its schema still answers, with version NULL).
|
|
47
52
|
*/
|
|
48
53
|
export declare const GET_ROLE_SCHEMA_CURRENT = "\n SELECT r.role, r.current_schema_version AS version, r.form_schema,\n r.metadata_schema, s.change_summary, s.created_at,\n r.current_schema_version AS latest_version\n FROM lt_roles r\n LEFT JOIN lt_role_schemas s\n ON s.role = r.role AND s.version = r.current_schema_version\n WHERE r.role = $1";
|
|
49
|
-
export declare const
|
|
54
|
+
export declare const LIST_ROLE_LIST_SCHEMA_VERSIONS = "\n SELECT\n s.version,\n s.list_schema IS NOT NULL AS has_list_schema,\n s.change_summary,\n s.created_at,\n s.version = r.current_list_schema_version AS is_current\n FROM lt_role_list_schemas s\n JOIN lt_roles r ON r.role = s.role\n WHERE s.role = $1\n ORDER BY s.version DESC";
|
|
55
|
+
export declare const GET_ROLE_LIST_SCHEMA_VERSION = "\n SELECT s.role, s.version, s.list_schema,\n s.change_summary, s.created_at, r.current_list_schema_version AS latest_version\n FROM lt_role_list_schemas s\n JOIN lt_roles r ON r.role = s.role\n WHERE s.role = $1 AND s.version = $2";
|
|
56
|
+
/**
|
|
57
|
+
* Latest list schema resolves from the live lt_roles column (a role that has
|
|
58
|
+
* never versioned its list schema still answers, with version NULL).
|
|
59
|
+
*/
|
|
60
|
+
export declare const GET_ROLE_LIST_SCHEMA_CURRENT = "\n SELECT r.role, r.current_list_schema_version AS version, r.list_schema,\n s.change_summary, s.created_at,\n r.current_list_schema_version AS latest_version\n FROM lt_roles r\n LEFT JOIN lt_role_list_schemas s\n ON s.role = r.role AND s.version = r.current_list_schema_version\n WHERE r.role = $1";
|
|
61
|
+
export declare const LIST_ROLES_WITH_DETAILS = "\n WITH\n user_counts AS (\n SELECT role, COUNT(DISTINCT user_id)::int AS cnt\n FROM lt_user_roles\n GROUP BY role\n ),\n chain_counts AS (\n SELECT role, COUNT(*)::int AS cnt\n FROM (\n SELECT source_role AS role FROM lt_config_role_escalations\n UNION ALL\n SELECT target_role AS role FROM lt_config_role_escalations\n ) c\n GROUP BY role\n ),\n workflow_counts AS (\n SELECT role, COUNT(*)::int AS cnt\n FROM lt_config_roles\n GROUP BY role\n ),\n upstreams AS (\n SELECT role, array_agg(upstream_role ORDER BY upstream_role) AS ups\n FROM lt_role_upstreams\n GROUP BY role\n )\n SELECT\n r.role,\n r.title,\n r.description,\n r.form_schema,\n r.metadata_schema,\n r.properties,\n r.ops_visible,\n r.parent_role,\n r.sla_minutes,\n r.target_per_hour,\n r.worker_count,\n r.priority_threshold_minutes,\n r.priority_facet,\n r.current_schema_version,\n r.list_schema,\n r.current_list_schema_version,\n COALESCE(up.ups, '{}') AS upstream_roles,\n COALESCE(uc.cnt, 0) AS user_count,\n COALESCE(cc.cnt, 0) AS chain_count,\n COALESCE(wc.cnt, 0) AS workflow_count\n FROM lt_roles r\n LEFT JOIN user_counts uc ON uc.role = r.role\n LEFT JOIN chain_counts cc ON cc.role = r.role\n LEFT JOIN workflow_counts wc ON wc.role = r.role\n LEFT JOIN upstreams up ON up.role = r.role\n ORDER BY r.role";
|
|
50
62
|
export declare const COUNT_USER_ROLE_REFS = "\n SELECT COUNT(*)::int AS cnt FROM lt_user_roles WHERE role = $1";
|
|
51
63
|
export declare const COUNT_CHAIN_REFS = "\n SELECT COUNT(*)::int AS cnt\n FROM lt_config_role_escalations\n WHERE source_role = $1 OR target_role = $1";
|
|
52
64
|
export declare const COUNT_WORKFLOW_REFS = "\n SELECT COUNT(*)::int AS cnt FROM lt_config_roles WHERE role = $1";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// ─── Escalation chain queries ───────────────────────────────────────────────
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.COUNT_ACTIVE_ESCALATION_REFS = exports.COUNT_WORKFLOW_REFS = exports.COUNT_CHAIN_REFS = exports.COUNT_USER_ROLE_REFS = exports.LIST_ROLES_WITH_DETAILS = exports.GET_ROLE_SCHEMA_CURRENT = exports.GET_ROLE_SCHEMA_VERSION = exports.LIST_ROLE_SCHEMA_VERSIONS = exports.GET_ROLE_UPSTREAMS = exports.GET_ROLE_METADATA_SCHEMA = exports.GET_ROLE_FORM_SCHEMA = exports.UPDATE_ROLE_METADATA = exports.DELETE_ROLE = exports.LIST_ROLES = exports.ENSURE_ROLE_EXISTS = exports.CHECK_ESCALATION_CHAIN_EXISTS = exports.DELETE_ESCALATION_CHAINS_BY_SOURCE = exports.DELETE_ESCALATION_CHAIN = exports.ADD_ESCALATION_CHAIN = exports.INSERT_ESCALATION_CHAIN = exports.GET_ALL_ESCALATION_CHAINS = exports.GET_ESCALATION_TARGETS = void 0;
|
|
4
|
+
exports.COUNT_ACTIVE_ESCALATION_REFS = exports.COUNT_WORKFLOW_REFS = exports.COUNT_CHAIN_REFS = exports.COUNT_USER_ROLE_REFS = exports.LIST_ROLES_WITH_DETAILS = exports.GET_ROLE_LIST_SCHEMA_CURRENT = exports.GET_ROLE_LIST_SCHEMA_VERSION = exports.LIST_ROLE_LIST_SCHEMA_VERSIONS = exports.GET_ROLE_SCHEMA_CURRENT = exports.GET_ROLE_SCHEMA_VERSION = exports.LIST_ROLE_SCHEMA_VERSIONS = exports.GET_ROLE_UPSTREAMS = exports.GET_ROLE_METADATA_SCHEMA = exports.GET_ROLE_FORM_SCHEMA = exports.UPDATE_ROLE_METADATA = exports.DELETE_ROLE = exports.LIST_ROLES = exports.ENSURE_ROLE_EXISTS = exports.CHECK_ESCALATION_CHAIN_EXISTS = exports.DELETE_ESCALATION_CHAINS_BY_SOURCE = exports.DELETE_ESCALATION_CHAIN = exports.ADD_ESCALATION_CHAIN = exports.INSERT_ESCALATION_CHAIN = exports.GET_ALL_ESCALATION_CHAINS = exports.GET_ESCALATION_TARGETS = void 0;
|
|
5
5
|
exports.GET_ESCALATION_TARGETS = `
|
|
6
6
|
SELECT target_role
|
|
7
7
|
FROM lt_config_role_escalations
|
|
@@ -68,6 +68,11 @@ exports.DELETE_ROLE = `
|
|
|
68
68
|
* touching the same row: the DELETE only removes rows leaving the set, and the
|
|
69
69
|
* INSERT's ON CONFLICT DO NOTHING skips rows that stay (delete+insert of the
|
|
70
70
|
* SAME key in one statement would silently drop it — CTEs share a snapshot).
|
|
71
|
+
*
|
|
72
|
+
* The list_schema ($29 = provided sentinel, $30 = value) versions INDEPENDENTLY
|
|
73
|
+
* of the form/metadata pair: its own current_list_schema_version and its own
|
|
74
|
+
* snapshot table (lt_role_list_schemas), so a list-view edit never advances the
|
|
75
|
+
* resolve form's version. It shares $26 as the change summary.
|
|
71
76
|
*/
|
|
72
77
|
exports.UPDATE_ROLE_METADATA = `
|
|
73
78
|
WITH updated AS (
|
|
@@ -85,23 +90,34 @@ exports.UPDATE_ROLE_METADATA = `
|
|
|
85
90
|
priority_threshold_minutes
|
|
86
91
|
= CASE WHEN $22::boolean THEN $23::numeric ELSE priority_threshold_minutes END,
|
|
87
92
|
priority_facet = CASE WHEN $24::boolean THEN $25 ELSE priority_facet END,
|
|
93
|
+
list_schema = CASE WHEN $29::boolean THEN $30::jsonb ELSE list_schema END,
|
|
88
94
|
current_schema_version = CASE
|
|
89
95
|
WHEN ($6::boolean AND $7::jsonb IS DISTINCT FROM form_schema)
|
|
90
96
|
OR ($8::boolean AND $9::jsonb IS DISTINCT FROM metadata_schema)
|
|
91
97
|
THEN COALESCE(current_schema_version, 0) + 1
|
|
92
|
-
ELSE current_schema_version END
|
|
98
|
+
ELSE current_schema_version END,
|
|
99
|
+
current_list_schema_version = CASE
|
|
100
|
+
WHEN $29::boolean AND $30::jsonb IS DISTINCT FROM list_schema
|
|
101
|
+
THEN COALESCE(current_list_schema_version, 0) + 1
|
|
102
|
+
ELSE current_list_schema_version END
|
|
93
103
|
WHERE role = $1
|
|
94
104
|
RETURNING
|
|
95
105
|
role, title, description, form_schema, metadata_schema, properties,
|
|
96
106
|
ops_visible, parent_role, sla_minutes, target_per_hour, worker_count,
|
|
97
107
|
priority_threshold_minutes, priority_facet,
|
|
98
|
-
current_schema_version
|
|
108
|
+
current_schema_version, list_schema, current_list_schema_version
|
|
99
109
|
), snapshot AS (
|
|
100
110
|
INSERT INTO lt_role_schemas (role, version, form_schema, metadata_schema, change_summary)
|
|
101
111
|
SELECT role, current_schema_version, form_schema, metadata_schema, $26
|
|
102
112
|
FROM updated
|
|
103
113
|
WHERE ($6::boolean OR $8::boolean) AND current_schema_version IS NOT NULL
|
|
104
114
|
ON CONFLICT (role, version) DO NOTHING
|
|
115
|
+
), list_snapshot AS (
|
|
116
|
+
INSERT INTO lt_role_list_schemas (role, version, list_schema, change_summary)
|
|
117
|
+
SELECT role, current_list_schema_version, list_schema, $26
|
|
118
|
+
FROM updated
|
|
119
|
+
WHERE $29::boolean AND current_list_schema_version IS NOT NULL
|
|
120
|
+
ON CONFLICT (role, version) DO NOTHING
|
|
105
121
|
), upstream_prune AS (
|
|
106
122
|
DELETE FROM lt_role_upstreams
|
|
107
123
|
WHERE $27::boolean AND role = $1 AND upstream_role <> ALL($28::text[])
|
|
@@ -149,6 +165,36 @@ exports.GET_ROLE_SCHEMA_CURRENT = `
|
|
|
149
165
|
LEFT JOIN lt_role_schemas s
|
|
150
166
|
ON s.role = r.role AND s.version = r.current_schema_version
|
|
151
167
|
WHERE r.role = $1`;
|
|
168
|
+
// ─── Versioned role LIST schemas (independent version lineage) ──────────────
|
|
169
|
+
exports.LIST_ROLE_LIST_SCHEMA_VERSIONS = `
|
|
170
|
+
SELECT
|
|
171
|
+
s.version,
|
|
172
|
+
s.list_schema IS NOT NULL AS has_list_schema,
|
|
173
|
+
s.change_summary,
|
|
174
|
+
s.created_at,
|
|
175
|
+
s.version = r.current_list_schema_version AS is_current
|
|
176
|
+
FROM lt_role_list_schemas s
|
|
177
|
+
JOIN lt_roles r ON r.role = s.role
|
|
178
|
+
WHERE s.role = $1
|
|
179
|
+
ORDER BY s.version DESC`;
|
|
180
|
+
exports.GET_ROLE_LIST_SCHEMA_VERSION = `
|
|
181
|
+
SELECT s.role, s.version, s.list_schema,
|
|
182
|
+
s.change_summary, s.created_at, r.current_list_schema_version AS latest_version
|
|
183
|
+
FROM lt_role_list_schemas s
|
|
184
|
+
JOIN lt_roles r ON r.role = s.role
|
|
185
|
+
WHERE s.role = $1 AND s.version = $2`;
|
|
186
|
+
/**
|
|
187
|
+
* Latest list schema resolves from the live lt_roles column (a role that has
|
|
188
|
+
* never versioned its list schema still answers, with version NULL).
|
|
189
|
+
*/
|
|
190
|
+
exports.GET_ROLE_LIST_SCHEMA_CURRENT = `
|
|
191
|
+
SELECT r.role, r.current_list_schema_version AS version, r.list_schema,
|
|
192
|
+
s.change_summary, s.created_at,
|
|
193
|
+
r.current_list_schema_version AS latest_version
|
|
194
|
+
FROM lt_roles r
|
|
195
|
+
LEFT JOIN lt_role_list_schemas s
|
|
196
|
+
ON s.role = r.role AND s.version = r.current_list_schema_version
|
|
197
|
+
WHERE r.role = $1`;
|
|
152
198
|
// ─── Role detail aggregation ────────────────────────────────────────────────
|
|
153
199
|
exports.LIST_ROLES_WITH_DETAILS = `
|
|
154
200
|
WITH
|
|
@@ -191,6 +237,8 @@ exports.LIST_ROLES_WITH_DETAILS = `
|
|
|
191
237
|
r.priority_threshold_minutes,
|
|
192
238
|
r.priority_facet,
|
|
193
239
|
r.current_schema_version,
|
|
240
|
+
r.list_schema,
|
|
241
|
+
r.current_list_schema_version,
|
|
194
242
|
COALESCE(up.ups, '{}') AS upstream_roles,
|
|
195
243
|
COALESCE(uc.cnt, 0) AS user_count,
|
|
196
244
|
COALESCE(cc.cnt, 0) AS chain_count,
|
|
@@ -46,6 +46,14 @@ export interface RoleDetail {
|
|
|
46
46
|
* role first carries a schema.
|
|
47
47
|
*/
|
|
48
48
|
current_schema_version: number | null;
|
|
49
|
+
/**
|
|
50
|
+
* JSON contract (x-lt-* markup) that richly formats the escalation LIST page
|
|
51
|
+
* when it is scoped to just this role. Opt-in and versioned INDEPENDENTLY of
|
|
52
|
+
* form_schema — a display template, always rendered at its latest version.
|
|
53
|
+
*/
|
|
54
|
+
list_schema: Record<string, any> | null;
|
|
55
|
+
/** Version of the live list_schema; null until the role first carries one. */
|
|
56
|
+
current_list_schema_version: number | null;
|
|
49
57
|
/**
|
|
50
58
|
* Roles this station draws input from that live in OTHER sequences.
|
|
51
59
|
* parent_role is the single "prior step" placing the role in one sequence;
|
|
@@ -77,11 +85,30 @@ export interface RoleSchemaVersionSummary {
|
|
|
77
85
|
created_at: string;
|
|
78
86
|
is_current: boolean;
|
|
79
87
|
}
|
|
88
|
+
/** One immutable snapshot of a role's LIST schema (independent version lineage). */
|
|
89
|
+
export interface RoleListSchemaVersion {
|
|
90
|
+
role: string;
|
|
91
|
+
version: number | null;
|
|
92
|
+
list_schema: Record<string, any> | null;
|
|
93
|
+
change_summary: string | null;
|
|
94
|
+
created_at: string | null;
|
|
95
|
+
latest_version: number | null;
|
|
96
|
+
}
|
|
97
|
+
/** Listing row for the list-schema version history (schema elided). */
|
|
98
|
+
export interface RoleListSchemaVersionSummary {
|
|
99
|
+
version: number;
|
|
100
|
+
has_list_schema: boolean;
|
|
101
|
+
change_summary: string | null;
|
|
102
|
+
created_at: string;
|
|
103
|
+
is_current: boolean;
|
|
104
|
+
}
|
|
80
105
|
export interface UpdateRoleInput {
|
|
81
106
|
title?: string | null;
|
|
82
107
|
description?: string | null;
|
|
83
108
|
form_schema?: Record<string, any> | null;
|
|
84
109
|
metadata_schema?: Record<string, any> | null;
|
|
110
|
+
/** JSON contract that richly formats this role's escalation list page. */
|
|
111
|
+
list_schema?: Record<string, any> | null;
|
|
85
112
|
properties?: Record<string, any> | null;
|
|
86
113
|
ops_visible?: boolean;
|
|
87
114
|
parent_role?: string | null;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface LTMaintenanceRule {
|
|
5
5
|
/** Which resource to target */
|
|
6
|
-
target: 'streams' | 'jobs';
|
|
6
|
+
target: 'streams' | 'jobs' | 'escalations';
|
|
7
7
|
/** delete = hard-delete rows; prune = strip execution artifacts */
|
|
8
8
|
action: 'delete' | 'prune';
|
|
9
9
|
/** Postgres interval for the retention window, e.g. '7 days', '90 days' */
|
|
@@ -12,6 +12,11 @@ export interface LTMaintenanceRule {
|
|
|
12
12
|
hasEntity?: boolean;
|
|
13
13
|
/** When true, only target jobs that have already been pruned (pruned_at IS NOT NULL) */
|
|
14
14
|
pruned?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* When target is 'escalations': which terminal statuses to age out.
|
|
17
|
+
* Defaults to all three. Pending rows and live waiters are never touched.
|
|
18
|
+
*/
|
|
19
|
+
statuses?: Array<'resolved' | 'cancelled' | 'expired'>;
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
22
|
* Full maintenance configuration: schedule + ordered rules.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as o}from"./vendor-query-B2UbickB.js";import{c as n}from"./tasks-
|
|
2
|
-
//# sourceMappingURL=AdminDashboard-
|
|
1
|
+
import{j as o}from"./vendor-query-B2UbickB.js";import{c as n}from"./tasks-BYz490un.js";import{j as m}from"./index-C9moIiIq.js";import{f as c}from"./useEventHooks-ZT6RV2Gj.js";import{u}from"./mcp-CH8Tj9Pw.js";import{P as d}from"./PageHeaderWithStats-87STTAJX.js";import"./vendor-react-CXumBFUA.js";import"./vendor-icons-BXhWQC7l.js";function S(){var a;c();const{data:s}=n({limit:1}),{data:e}=m({status:"pending",limit:1}),{data:t}=u(),r=((a=t==null?void 0:t.servers)==null?void 0:a.filter(i=>i.status==="connected").length)??0,l=t?`${r}/${t.total}`:"—";return o.jsx("div",{children:o.jsx(d,{title:"Admin",stats:[{label:"Tasks",value:(s==null?void 0:s.total)??"—"},{label:"Pending Escalations",value:(e==null?void 0:e.total)??"—",dotClass:"bg-status-pending"},{label:"MCP Servers",value:l},{label:"System",value:"Healthy",dotClass:"bg-status-success"}]})})}export{S as AdminDashboard};
|
|
2
|
+
//# sourceMappingURL=AdminDashboard-5bWcBxyS.js.map
|
package/dashboard/dist/assets/{AdminDashboard-B-JptT54.js.map → AdminDashboard-5bWcBxyS.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminDashboard-
|
|
1
|
+
{"version":3,"file":"AdminDashboard-5bWcBxyS.js","sources":["../../src/pages/admin/AdminDashboard.tsx"],"sourcesContent":["import { useTasks } from '../../api/tasks';\nimport { useEscalations } from '../../api/escalations';\nimport { useEscalationListEvents } from '../../hooks/useEventHooks';\nimport { useMcpServers } from '../../api/mcp';\nimport { PageHeaderWithStats } from '../../components/common/layout/PageHeaderWithStats';\n\nexport function AdminDashboard() {\n useEscalationListEvents();\n const { data: taskData } = useTasks({ limit: 1 });\n const { data: pendingEsc } = useEscalations({ status: 'pending', limit: 1 });\n const { data: mcpData } = useMcpServers();\n\n const connectedServers =\n mcpData?.servers?.filter((s) => s.status === 'connected').length ?? 0;\n const mcpLabel = mcpData ? `${connectedServers}/${mcpData.total}` : '—';\n\n return (\n <div>\n <PageHeaderWithStats\n title=\"Admin\"\n stats={[\n { label: 'Tasks', value: taskData?.total ?? '—' },\n { label: 'Pending Escalations', value: pendingEsc?.total ?? '—', dotClass: 'bg-status-pending' },\n { label: 'MCP Servers', value: mcpLabel },\n { label: 'System', value: 'Healthy', dotClass: 'bg-status-success' },\n ]}\n />\n </div>\n );\n}\n"],"names":["AdminDashboard","useEscalationListEvents","taskData","useTasks","pendingEsc","useEscalations","mcpData","useMcpServers","connectedServers","_a","s","mcpLabel","jsx","PageHeaderWithStats"],"mappings":"4UAMO,SAASA,GAAiB,OAC/BC,EAAA,EACA,KAAM,CAAE,KAAMC,CAAA,EAAaC,EAAS,CAAE,MAAO,EAAG,EAC1C,CAAE,KAAMC,CAAA,EAAeC,EAAe,CAAE,OAAQ,UAAW,MAAO,EAAG,EACrE,CAAE,KAAMC,CAAA,EAAYC,EAAA,EAEpBC,IACJC,EAAAH,GAAA,YAAAA,EAAS,UAAT,YAAAG,EAAkB,OAAQC,GAAMA,EAAE,SAAW,aAAa,SAAU,EAChEC,EAAWL,EAAU,GAAGE,CAAgB,IAAIF,EAAQ,KAAK,GAAK,IAEpE,aACG,MAAA,CACC,SAAAM,EAAAA,IAACC,EAAA,CACC,MAAM,QACN,MAAO,CACL,CAAE,MAAO,QAAS,OAAOX,GAAA,YAAAA,EAAU,QAAS,GAAA,EAC5C,CAAE,MAAO,sBAAuB,OAAOE,GAAA,YAAAA,EAAY,QAAS,IAAK,SAAU,mBAAA,EAC3E,CAAE,MAAO,cAAe,MAAOO,CAAA,EAC/B,CAAE,MAAO,SAAU,MAAO,UAAW,SAAU,mBAAA,CAAoB,CACrE,CAAA,EAEJ,CAEJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{j as e,a as v}from"./vendor-query-B2UbickB.js";import{a as re,d as ce,b as le}from"./agents-DlzvjNxE.js";import{E as oe,C as de,u as pe,a as xe,b as ue,c as me}from"./CronLabel-ZesYXxCH.js";import{b as he,u as fe}from"./index-DwWP-Z_c.js";import{P as ve}from"./PageHeader-DJo7yMUR.js";import{B as O,e as U,t as be,R as Y,l as T,p as Z,a6 as G,b as V,aM as ee,V as ye}from"./vendor-icons-DOIDKgo6.js";import{e as ge}from"./knowledge-fYoEF4Lx.js";import{R as te}from"./RunAsSelector-mhusrlYE.js";import{u as je}from"./workflows-DuUspMAl.js";import{u as we}from"./yaml-workflows-DXQCiOsP.js";import{u as se}from"./capabilities-_WSZ7cxO.js";import{u as Ne}from"./topics-CtfcCyw9.js";import{W as Q}from"./WorkflowPill-BtNBSplz.js";import{e as _e,c as ke,f as Ce}from"./vendor-react-CXumBFUA.js";import"./BotPicker-B1RdaNuY.js";import"./bots-CWMN-KUI.js";const X={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},Se={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",server_id:"",tool_name:"",input_mapping:"{}",execute_as:"",enabled:!0},qe={cron:"0 * * * *",reaction_type:"durable",workflow_type:"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""};function Re(s,a){var l,x,u;const r=(x=(l=s.behaviors)==null?void 0:l.schedules)!=null&&x.length?s.behaviors.schedules.map(n=>({cron:n.cron||"",reaction_type:n.reaction_type||"durable",workflow_type:n.workflow_type||"",pipeline_id:n.pipeline_id||"",server_id:n.server_id||"",tool_name:n.tool_name||"",envelope:n.envelope?JSON.stringify(n.envelope,null,2):"{}",execute_as:n.execute_as||""})):(u=s.behaviors)!=null&&u.cron?[{cron:s.behaviors.cron,reaction_type:"durable",workflow_type:s.workflow_type??"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""}]:[];return{name:s.id,description:s.description??"",goals:s.goals??"",rules:s.rules??"",user_id:s.user_id??"",knowledge_domain:s.knowledge_domain??"",subscriptions:a.map(n=>({id:n.id,topic:n.topic,filter:n.filter?JSON.stringify(n.filter,null,2):"",reaction_type:n.reaction_type,workflow_type:n.workflow_type??"",pipeline_id:n.pipeline_id??"",mcp_prompt:n.mcp_prompt??"",server_id:n.server_id??"",tool_name:n.tool_name??"",input_mapping:JSON.stringify(n.input_mapping??{},null,2),execute_as:n.execute_as??"",enabled:n.enabled})),schedules:r}}function Ae(s){var r;const a={};return s.schedules.length>0&&(a.schedules=s.schedules.map(l=>({cron:l.cron,reaction_type:l.reaction_type||"durable",workflow_type:l.reaction_type==="pipeline"?void 0:l.workflow_type,pipeline_id:l.reaction_type==="pipeline"?l.pipeline_id:void 0,envelope:B(l.envelope)??{},execute_as:l.execute_as||void 0})),a.cron=s.schedules[0].cron),{id:s.name,description:s.description||void 0,goals:s.goals||void 0,rules:s.rules||void 0,user_id:s.user_id||void 0,knowledge_domain:s.knowledge_domain||void 0,behaviors:a,workflow_type:((r=s.schedules[0])==null?void 0:r.workflow_type)||void 0,pipeline_id:void 0}}function Oe(s){return s.subscriptions.map(a=>({id:a.id,topic:a.topic,filter:a.filter?B(a.filter):void 0,reaction_type:a.reaction_type,workflow_type:a.workflow_type||void 0,pipeline_id:a.pipeline_id||void 0,mcp_prompt:a.mcp_prompt||void 0,server_id:a.server_id||void 0,tool_name:a.tool_name||void 0,input_mapping:B(a.input_mapping)??{},execute_as:a.execute_as||void 0,enabled:a.enabled}))}function B(s){if(s.trim())try{return JSON.parse(s)}catch{return}}function Ee(s,a,r,l){let x;try{x=JSON.parse(s)}catch{x={}}const u=l.includes(a),n=r===""||r===void 0||r===null||Array.isArray(r)&&r.length===0||r==="[]";if(!u&&n){const{[a]:p,...o}=x;return JSON.stringify(o,null,2)}let h=r;if(typeof r=="string")try{const p=JSON.parse(r);Array.isArray(p)&&(h=p)}catch{}return JSON.stringify({...x,[a]:h},null,2)}const S="section-header mt-[3em] first:mt-0",$="label",_="hint",R="input",L="input-json w-full";function $e({form:s,set:a}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Give your automation a name and describe what it does. The name appears everywhere — in events, logs, and the dashboard."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:identity"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Identity",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Name *"}),e.jsx("input",{type:"text",value:s.name,onChange:r=>a("name",r.target.value),placeholder:"health-monitor",className:R}),e.jsx("p",{className:_,children:"Lowercase, kebab-case. This appears everywhere."})]}),e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Description"}),e.jsx("input",{type:"text",value:s.description,onChange:r=>a("description",r.target.value),placeholder:"Watches for workflow failures and captures diagnostics",className:R}),e.jsx("p",{className:_,children:"One sentence that explains what this automation does."})]})]})}function Pe({form:s,set:a}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Goals define what drives the automation. Rules define what constrains it."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:motivation"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Motivation",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Goals"}),e.jsx("textarea",{value:s.goals,onChange:r=>a("goals",r.target.value),placeholder:"Detect failures early, capture diagnostics, alert before cascading",rows:4,className:`${R} resize-none`}),e.jsx("p",{className:_,children:"Primary motivation. What the automation is trying to achieve."})]}),e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Rules"}),e.jsx("textarea",{value:s.rules,onChange:r=>a("rules",r.target.value),placeholder:"Never auto-restart failed workflows. Always escalate to humans.",rows:4,className:`${R} resize-none`}),e.jsx("p",{className:_,children:"Guardrails. What it must never do, even when goals suggest it should."})]})]})]})}function Ie({form:s,set:a}){const{data:r}=ge(),l=(r==null?void 0:r.domains)??[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Assign a knowledge domain — the automation's memory. It stores context here over time."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:knowledge"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Knowledge",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Knowledge Domain"}),e.jsx("input",{type:"text",value:s.knowledge_domain,onChange:x=>a("knowledge_domain",x.target.value),placeholder:"e.g., system-health, content-review, vendor-data",className:R,list:"domain-suggestions"}),e.jsx("datalist",{id:"domain-suggestions",children:l.map(x=>e.jsx("option",{value:x.domain},x.domain))}),e.jsx("p",{className:_,children:"Choose an existing domain to share memory, or type a new name to create one."})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Existing Domains"}),e.jsx("div",{className:"space-y-0.5 mt-2",children:l.map(x=>e.jsxs("button",{type:"button",onClick:()=>a("knowledge_domain",x.domain),className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${s.knowledge_domain===x.domain?"border-l-2 border-l-accent bg-accent/5":"hover:bg-surface-hover border-l-2 border-l-transparent"}`,children:[e.jsx(U,{className:"w-3.5 h-3.5 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary flex-1",children:x.domain}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[x.count," entries"]}),e.jsx("span",{className:"text-[9px] text-text-quaternary",children:e.jsx(he,{date:x.latest})})]},x.domain))})]})]})}function We({serverId:s,toolName:a,onChange:r}){const{data:l}=se(),x=v.useMemo(()=>{var t;return((t=l==null?void 0:l.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[l]),[u,n]=v.useState(!1),[h,p]=v.useState(""),o=v.useRef(null),f=v.useRef(null);v.useEffect(()=>{if(!u)return;function t(i){f.current&&!f.current.contains(i.target)&&n(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[u]);const c=a?`${a}`:"",d=u?h:c,y=v.useMemo(()=>{const t=(u?h:"").toLowerCase();return t?x.filter(i=>i.name.toLowerCase().includes(t)||i.serverName.toLowerCase().includes(t)||(i.description??"").toLowerCase().includes(t)):x},[x,h,u]),m=a?x.find(t=>t.serverId===s&&t.name===a):void 0;return e.jsxs("div",{ref:f,className:"relative",children:[e.jsx("input",{ref:o,type:"text",value:d,onFocus:()=>{n(!0),p(c)},onChange:t=>{const i=t.target.value;p(i),i||r("",""),u||n(!0)},placeholder:"Search capabilities...",className:"input font-mono text-sm w-full"}),!u&&(m==null?void 0:m.description)&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-1 italic",children:m.description}),u&&y.length>0&&e.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 max-h-64 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg",children:y.map(t=>e.jsxs("button",{type:"button",onClick:()=>{r(t.serverId,t.name),p(t.name),n(!1)},className:`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 ${s===t.serverId&&a===t.name?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-[11px] font-mono text-text-primary shrink-0",children:t.name}),e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[9px] font-medium shrink-0 bg-accent/10 text-accent",children:[e.jsx(be,{className:"w-2 h-2",strokeWidth:1.5}),t.serverName]}),t.description&&e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:t.description})]},`${t.serverId}:${t.name}`))}),u&&y.length===0&&h&&e.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 rounded-md border border-surface-border bg-surface shadow-lg px-3 py-4 text-center",children:e.jsxs("p",{className:"text-[11px] text-text-quaternary",children:['No capabilities match "',h,'"']})})]})}const Me={durable:"Workflow",pipeline:"Pipeline",capability:"Capability",mcp_query:"MCP Query"},Te=["durable","pipeline","capability","mcp_query"];function ae({reactionType:s,onReactionTypeChange:a,workflowType:r,onWorkflowTypeChange:l,pipelineId:x,onPipelineIdChange:u,serverId:n,toolName:h,onCapabilityChange:p,mcpPrompt:o,onMcpPromptChange:f,availableTypes:c=[...Te]}){const{data:d}=je(),y=(d??[]).filter(i=>i.invocable).map(i=>i.workflow_type),{data:m}=we({status:"active"}),t=((m==null?void 0:m.workflows)??[]).map(i=>({id:i.id,name:i.graph_topic||i.id}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1",children:c.map(i=>{const b=s===i;return e.jsx("button",{type:"button",onClick:()=>a(i),className:`px-3 py-1.5 text-[11px] font-medium rounded-md transition-colors ${b?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:Me[i]},i)})}),s==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Workflow *"}),e.jsxs("select",{value:r,onChange:i=>l(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select workflow..."}),y.map(i=>e.jsx("option",{value:i,children:i},i))]})]}),s==="pipeline"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Pipeline *"}),e.jsxs("select",{value:x,onChange:i=>u(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select pipeline..."}),t.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id))]})]}),s==="capability"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Capability *"}),e.jsx(We,{serverId:n,toolName:h,onChange:p})]}),s==="mcp_query"&&f&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Prompt *"}),e.jsx("textarea",{value:o??"",onChange:i=>f(i.target.value),placeholder:"Analyze the error and suggest remediation...",rows:3,className:"input resize-none"})]})]})}const Le={task:"bg-status-active/10 text-status-active",workflow:"bg-accent/15 text-accent",escalation:"bg-status-warning/10 text-status-warning",activity:"bg-status-active/10 text-status-active",knowledge:"bg-accent/10 text-accent",file:"bg-status-draft/10 text-status-draft",agent:"bg-status-success/10 text-status-success",app:"bg-status-error/10 text-status-error",milestone:"bg-accent/10 text-accent"};function Je({form:s,set:a}){const{data:r}=Ne({limit:200}),{data:l}=se(),x=(r==null?void 0:r.topics)??[],u=v.useMemo(()=>{var t;return((t=l==null?void 0:l.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[l]),[n,h]=v.useState(0),p=(t,i,b)=>{const g=[...s.subscriptions];g[t]={...g[t],[i]:b},a("subscriptions",g)},o=()=>{a("subscriptions",[...s.subscriptions,{...Se}]),h(s.subscriptions.length)},f=t=>{a("subscriptions",s.subscriptions.filter((i,b)=>b!==t)),n>=s.subscriptions.length-1&&h(Math.max(0,s.subscriptions.length-2))},c=s.subscriptions,d=c[n],y=t=>t.topic?t.reaction_type==="durable"?!!t.workflow_type:t.reaction_type==="pipeline"?!!t.pipeline_id:t.reaction_type==="mcp_query"?!!t.mcp_prompt:t.reaction_type==="capability"?!!t.server_id&&!!t.tool_name:!1:!1,m=d?x.find(t=>t.topic===d.topic):void 0;return c.length===0?e.jsxs("div",{className:"max-w-xl",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-8",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the automation runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Y,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No event subscriptions yet"}),e.jsx("p",{className:"text-[11px] text-text-quaternary max-w-sm mb-6",children:"Each subscription listens for a topic pattern and runs a workflow when it matches."}),e.jsxs("button",{onClick:o,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(T,{className:"w-3.5 h-3.5"})," Add first subscription"]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-6",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the automation runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("div",{className:"w-52 shrink-0 space-y-0.5",children:[c.map((t,i)=>e.jsxs("div",{className:`group/sub flex items-center rounded-md transition-colors ${n===i?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>h(i),className:"flex-1 text-left px-3 py-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full dot-ring shrink-0 ${y(t)?"bg-status-success":"bg-surface-border"}`}),e.jsx("span",{className:"text-[11px] font-mono truncate",children:t.topic||"new subscription"})]}),e.jsxs("span",{className:"text-[9px] text-text-quaternary ml-3",children:["→ ",t.workflow_type||t.tool_name||t.reaction_type]})]}),e.jsx("button",{onClick:b=>{b.stopPropagation(),confirm(`Remove subscription "${t.topic||"new"}"?
|
|
1
|
+
import{j as e,a as v}from"./vendor-query-B2UbickB.js";import{a as re,d as ce,b as le}from"./agents-Ci0tZDO3.js";import{E as oe,C as de,u as pe,a as xe,b as ue,c as me}from"./CronLabel-CCJLmkIq.js";import{b as he,u as fe}from"./index-C9moIiIq.js";import{P as ve}from"./PageHeader-sGNTmSXX.js";import{B as O,e as U,t as be,R as Y,l as M,p as Z,a9 as G,b as V,aV as ee,V as ye}from"./vendor-icons-BXhWQC7l.js";import{e as ge}from"./knowledge-fi5z5YLq.js";import{R as te}from"./RunAsSelector-C6EozzKV.js";import{u as je}from"./workflows-By8Wgvig.js";import{u as we}from"./yaml-workflows-Cq_vp41d.js";import{u as se}from"./capabilities-DzVKeWyC.js";import{u as Ne}from"./topics-Dt975EWi.js";import{W as Q}from"./WorkflowPill-fodIWnT3.js";import{e as _e,c as ke,f as Ce}from"./vendor-react-CXumBFUA.js";import"./BotPicker-CGEFHHDE.js";import"./bots-DZyt1oO4.js";const X={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},Se={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",server_id:"",tool_name:"",input_mapping:"{}",execute_as:"",enabled:!0},qe={cron:"0 * * * *",reaction_type:"durable",workflow_type:"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""};function Re(s,a){var l,x,u;const r=(x=(l=s.behaviors)==null?void 0:l.schedules)!=null&&x.length?s.behaviors.schedules.map(n=>({cron:n.cron||"",reaction_type:n.reaction_type||"durable",workflow_type:n.workflow_type||"",pipeline_id:n.pipeline_id||"",server_id:n.server_id||"",tool_name:n.tool_name||"",envelope:n.envelope?JSON.stringify(n.envelope,null,2):"{}",execute_as:n.execute_as||""})):(u=s.behaviors)!=null&&u.cron?[{cron:s.behaviors.cron,reaction_type:"durable",workflow_type:s.workflow_type??"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""}]:[];return{name:s.id,description:s.description??"",goals:s.goals??"",rules:s.rules??"",user_id:s.user_id??"",knowledge_domain:s.knowledge_domain??"",subscriptions:a.map(n=>({id:n.id,topic:n.topic,filter:n.filter?JSON.stringify(n.filter,null,2):"",reaction_type:n.reaction_type,workflow_type:n.workflow_type??"",pipeline_id:n.pipeline_id??"",mcp_prompt:n.mcp_prompt??"",server_id:n.server_id??"",tool_name:n.tool_name??"",input_mapping:JSON.stringify(n.input_mapping??{},null,2),execute_as:n.execute_as??"",enabled:n.enabled})),schedules:r}}function Ae(s){var r;const a={};return s.schedules.length>0&&(a.schedules=s.schedules.map(l=>({cron:l.cron,reaction_type:l.reaction_type||"durable",workflow_type:l.reaction_type==="pipeline"?void 0:l.workflow_type,pipeline_id:l.reaction_type==="pipeline"?l.pipeline_id:void 0,envelope:B(l.envelope)??{},execute_as:l.execute_as||void 0})),a.cron=s.schedules[0].cron),{id:s.name,description:s.description||void 0,goals:s.goals||void 0,rules:s.rules||void 0,user_id:s.user_id||void 0,knowledge_domain:s.knowledge_domain||void 0,behaviors:a,workflow_type:((r=s.schedules[0])==null?void 0:r.workflow_type)||void 0,pipeline_id:void 0}}function Oe(s){return s.subscriptions.map(a=>({id:a.id,topic:a.topic,filter:a.filter?B(a.filter):void 0,reaction_type:a.reaction_type,workflow_type:a.workflow_type||void 0,pipeline_id:a.pipeline_id||void 0,mcp_prompt:a.mcp_prompt||void 0,server_id:a.server_id||void 0,tool_name:a.tool_name||void 0,input_mapping:B(a.input_mapping)??{},execute_as:a.execute_as||void 0,enabled:a.enabled}))}function B(s){if(s.trim())try{return JSON.parse(s)}catch{return}}function Ee(s,a,r,l){let x;try{x=JSON.parse(s)}catch{x={}}const u=l.includes(a),n=r===""||r===void 0||r===null||Array.isArray(r)&&r.length===0||r==="[]";if(!u&&n){const{[a]:p,...o}=x;return JSON.stringify(o,null,2)}let h=r;if(typeof r=="string")try{const p=JSON.parse(r);Array.isArray(p)&&(h=p)}catch{}return JSON.stringify({...x,[a]:h},null,2)}const S="section-header mt-[3em] first:mt-0",$="label",_="hint",R="input",L="input-json w-full";function $e({form:s,set:a}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Give your automation a name and describe what it does. The name appears everywhere — in events, logs, and the dashboard."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:identity"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Identity",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Name *"}),e.jsx("input",{type:"text",value:s.name,onChange:r=>a("name",r.target.value),placeholder:"health-monitor",className:R}),e.jsx("p",{className:_,children:"Lowercase, kebab-case. This appears everywhere."})]}),e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Description"}),e.jsx("input",{type:"text",value:s.description,onChange:r=>a("description",r.target.value),placeholder:"Watches for workflow failures and captures diagnostics",className:R}),e.jsx("p",{className:_,children:"One sentence that explains what this automation does."})]})]})}function Pe({form:s,set:a}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Goals define what drives the automation. Rules define what constrains it."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:motivation"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Motivation",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Goals"}),e.jsx("textarea",{value:s.goals,onChange:r=>a("goals",r.target.value),placeholder:"Detect failures early, capture diagnostics, alert before cascading",rows:4,className:`${R} resize-none`}),e.jsx("p",{className:_,children:"Primary motivation. What the automation is trying to achieve."})]}),e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Rules"}),e.jsx("textarea",{value:s.rules,onChange:r=>a("rules",r.target.value),placeholder:"Never auto-restart failed workflows. Always escalate to humans.",rows:4,className:`${R} resize-none`}),e.jsx("p",{className:_,children:"Guardrails. What it must never do, even when goals suggest it should."})]})]})]})}function Ie({form:s,set:a}){const{data:r}=ge(),l=(r==null?void 0:r.domains)??[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Assign a knowledge domain — the automation's memory. It stores context here over time."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:knowledge"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Knowledge",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Knowledge Domain"}),e.jsx("input",{type:"text",value:s.knowledge_domain,onChange:x=>a("knowledge_domain",x.target.value),placeholder:"e.g., system-health, content-review, vendor-data",className:R,list:"domain-suggestions"}),e.jsx("datalist",{id:"domain-suggestions",children:l.map(x=>e.jsx("option",{value:x.domain},x.domain))}),e.jsx("p",{className:_,children:"Choose an existing domain to share memory, or type a new name to create one."})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:$,children:"Existing Domains"}),e.jsx("div",{className:"space-y-0.5 mt-2",children:l.map(x=>e.jsxs("button",{type:"button",onClick:()=>a("knowledge_domain",x.domain),className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${s.knowledge_domain===x.domain?"border-l-2 border-l-accent bg-accent/5":"hover:bg-surface-hover border-l-2 border-l-transparent"}`,children:[e.jsx(U,{className:"w-3.5 h-3.5 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary flex-1",children:x.domain}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[x.count," entries"]}),e.jsx("span",{className:"text-[9px] text-text-quaternary",children:e.jsx(he,{date:x.latest})})]},x.domain))})]})]})}function We({serverId:s,toolName:a,onChange:r}){const{data:l}=se(),x=v.useMemo(()=>{var t;return((t=l==null?void 0:l.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[l]),[u,n]=v.useState(!1),[h,p]=v.useState(""),o=v.useRef(null),f=v.useRef(null);v.useEffect(()=>{if(!u)return;function t(i){f.current&&!f.current.contains(i.target)&&n(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[u]);const c=a?`${a}`:"",d=u?h:c,y=v.useMemo(()=>{const t=(u?h:"").toLowerCase();return t?x.filter(i=>i.name.toLowerCase().includes(t)||i.serverName.toLowerCase().includes(t)||(i.description??"").toLowerCase().includes(t)):x},[x,h,u]),m=a?x.find(t=>t.serverId===s&&t.name===a):void 0;return e.jsxs("div",{ref:f,className:"relative",children:[e.jsx("input",{ref:o,type:"text",value:d,onFocus:()=>{n(!0),p(c)},onChange:t=>{const i=t.target.value;p(i),i||r("",""),u||n(!0)},placeholder:"Search capabilities...",className:"input font-mono text-sm w-full"}),!u&&(m==null?void 0:m.description)&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-1 italic",children:m.description}),u&&y.length>0&&e.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 max-h-64 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg",children:y.map(t=>e.jsxs("button",{type:"button",onClick:()=>{r(t.serverId,t.name),p(t.name),n(!1)},className:`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 ${s===t.serverId&&a===t.name?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-[11px] font-mono text-text-primary shrink-0",children:t.name}),e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[9px] font-medium shrink-0 bg-accent/10 text-accent",children:[e.jsx(be,{className:"w-2 h-2",strokeWidth:1.5}),t.serverName]}),t.description&&e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:t.description})]},`${t.serverId}:${t.name}`))}),u&&y.length===0&&h&&e.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 rounded-md border border-surface-border bg-surface shadow-lg px-3 py-4 text-center",children:e.jsxs("p",{className:"text-[11px] text-text-quaternary",children:['No capabilities match "',h,'"']})})]})}const Te={durable:"Workflow",pipeline:"Pipeline",capability:"Capability",mcp_query:"MCP Query"},Me=["durable","pipeline","capability","mcp_query"];function ae({reactionType:s,onReactionTypeChange:a,workflowType:r,onWorkflowTypeChange:l,pipelineId:x,onPipelineIdChange:u,serverId:n,toolName:h,onCapabilityChange:p,mcpPrompt:o,onMcpPromptChange:f,availableTypes:c=[...Me]}){const{data:d}=je(),y=(d??[]).filter(i=>i.invocable).map(i=>i.workflow_type),{data:m}=we({status:"active"}),t=((m==null?void 0:m.workflows)??[]).map(i=>({id:i.id,name:i.graph_topic||i.id}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1",children:c.map(i=>{const b=s===i;return e.jsx("button",{type:"button",onClick:()=>a(i),className:`px-3 py-1.5 text-[11px] font-medium rounded-md transition-colors ${b?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:Te[i]},i)})}),s==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Workflow *"}),e.jsxs("select",{value:r,onChange:i=>l(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select workflow..."}),y.map(i=>e.jsx("option",{value:i,children:i},i))]})]}),s==="pipeline"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Pipeline *"}),e.jsxs("select",{value:x,onChange:i=>u(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select pipeline..."}),t.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id))]})]}),s==="capability"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Capability *"}),e.jsx(We,{serverId:n,toolName:h,onChange:p})]}),s==="mcp_query"&&f&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Prompt *"}),e.jsx("textarea",{value:o??"",onChange:i=>f(i.target.value),placeholder:"Analyze the error and suggest remediation...",rows:3,className:"input resize-none"})]})]})}const Le={task:"bg-status-active/10 text-status-active",workflow:"bg-accent/15 text-accent",escalation:"bg-status-warning/10 text-status-warning",activity:"bg-status-active/10 text-status-active",knowledge:"bg-accent/10 text-accent",file:"bg-status-draft/10 text-status-draft",agent:"bg-status-success/10 text-status-success",app:"bg-status-error/10 text-status-error",milestone:"bg-accent/10 text-accent"};function Je({form:s,set:a}){const{data:r}=Ne({limit:200}),{data:l}=se(),x=(r==null?void 0:r.topics)??[],u=v.useMemo(()=>{var t;return((t=l==null?void 0:l.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[l]),[n,h]=v.useState(0),p=(t,i,b)=>{const g=[...s.subscriptions];g[t]={...g[t],[i]:b},a("subscriptions",g)},o=()=>{a("subscriptions",[...s.subscriptions,{...Se}]),h(s.subscriptions.length)},f=t=>{a("subscriptions",s.subscriptions.filter((i,b)=>b!==t)),n>=s.subscriptions.length-1&&h(Math.max(0,s.subscriptions.length-2))},c=s.subscriptions,d=c[n],y=t=>t.topic?t.reaction_type==="durable"?!!t.workflow_type:t.reaction_type==="pipeline"?!!t.pipeline_id:t.reaction_type==="mcp_query"?!!t.mcp_prompt:t.reaction_type==="capability"?!!t.server_id&&!!t.tool_name:!1:!1,m=d?x.find(t=>t.topic===d.topic):void 0;return c.length===0?e.jsxs("div",{className:"max-w-xl",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-8",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the automation runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Y,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No event subscriptions yet"}),e.jsx("p",{className:"text-[11px] text-text-quaternary max-w-sm mb-6",children:"Each subscription listens for a topic pattern and runs a workflow when it matches."}),e.jsxs("button",{onClick:o,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(M,{className:"w-3.5 h-3.5"})," Add first subscription"]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-6",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the automation runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("div",{className:"w-52 shrink-0 space-y-0.5",children:[c.map((t,i)=>e.jsxs("div",{className:`group/sub flex items-center rounded-md transition-colors ${n===i?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>h(i),className:"flex-1 text-left px-3 py-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full dot-ring shrink-0 ${y(t)?"bg-status-success":"bg-surface-border"}`}),e.jsx("span",{className:"text-[11px] font-mono truncate",children:t.topic||"new subscription"})]}),e.jsxs("span",{className:"text-[9px] text-text-quaternary ml-3",children:["→ ",t.workflow_type||t.tool_name||t.reaction_type]})]}),e.jsx("button",{onClick:b=>{b.stopPropagation(),confirm(`Remove subscription "${t.topic||"new"}"?
|
|
2
2
|
|
|
3
|
-
This takes effect when you save.`)&&f(i)},className:"opacity-0 group-hover/sub:opacity-100 px-2 text-text-quaternary hover:text-status-error transition-all",title:"Remove",children:e.jsx(Z,{className:"w-3 h-3"})})]},i)),e.jsxs("button",{onClick:o,className:"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors",children:[e.jsx(
|
|
3
|
+
This takes effect when you save.`)&&f(i)},className:"opacity-0 group-hover/sub:opacity-100 px-2 text-text-quaternary hover:text-status-error transition-all",title:"Remove",children:e.jsx(Z,{className:"w-3 h-3"})})]},i)),e.jsxs("button",{onClick:o,className:"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors",children:[e.jsx(M,{className:"w-3 h-3"})," Add"]})]}),d&&e.jsxs("div",{className:"flex-1 min-w-0 space-y-12",children:[e.jsxs("div",{children:[e.jsx("label",{className:S,children:"When this event fires"}),e.jsx(ze,{value:d.topic,onChange:t=>p(n,"topic",t),topics:x}),(m==null?void 0:m.payload_schema)&&e.jsxs("div",{className:"mt-3 p-3 rounded-md bg-surface-sunken border border-surface-border",children:[e.jsx("p",{className:"text-[10px] text-text-quaternary mb-1 uppercase tracking-wider font-medium",children:"Payload Schema"}),e.jsx("pre",{className:"text-[11px] font-mono text-text-secondary whitespace-pre-wrap overflow-x-auto max-h-40",children:JSON.stringify(m.payload_schema.properties??m.payload_schema,null,2)}),m.description&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-2 italic",children:m.description})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run this reaction"}),e.jsx(ae,{reactionType:d.reaction_type,onReactionTypeChange:t=>p(n,"reaction_type",t),workflowType:d.workflow_type,onWorkflowTypeChange:t=>p(n,"workflow_type",t),pipelineId:d.pipeline_id,onPipelineIdChange:t=>p(n,"pipeline_id",t),serverId:d.server_id,toolName:d.tool_name,onCapabilityChange:(t,i)=>{var A;const b=[...s.subscriptions],g={...b[n],server_id:t,tool_name:i},k=u.find(w=>w.serverId===t&&w.name===i),E=(A=k==null?void 0:k.inputSchema)==null?void 0:A.properties;if(E&&i){const w={};for(const P of Object.keys(E))P.startsWith("_")||(w[P]=`{event.data.${P}}`);g.input_mapping=JSON.stringify(w,null,2)}b[n]=g,a("subscriptions",b)},mcpPrompt:d.mcp_prompt,onMcpPromptChange:t=>p(n,"mcp_prompt",t)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:S,children:"As identity"}),e.jsx(te,{selected:d.execute_as,onChange:t=>p(n,"execute_as",t)}),e.jsx("p",{className:_,children:"Identity used when invoking the workflow."})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"But only if"}),e.jsx("input",{type:"text",value:d.filter,onChange:t=>p(n,"filter",t.target.value),placeholder:'{"extension": "png"}',className:`${R} font-mono text-xs`}),e.jsx("p",{className:_,children:"JSON filter against event.data. Click an operator to insert:"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:[{label:"equals",value:'{"key": "val"}'},{label:"not equal",value:'{"key": {"$ne": "val"}}'},{label:"in list",value:'{"key": {"$in": ["a", "b"]}}'},{label:"exists",value:'{"key": {"$exists": true}}'}].map(t=>e.jsx("button",{type:"button",onClick:()=>p(n,"filter",t.value),className:"px-2 py-0.5 text-[10px] font-mono rounded bg-accent/8 text-accent hover:bg-accent/15 transition-colors",children:t.label},t.label))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"With this data"}),d.reaction_type==="capability"&&d.tool_name?e.jsx(Fe,{tool:u.find(t=>t.serverId===d.server_id&&t.name===d.tool_name),value:d.input_mapping,onChange:t=>p(n,"input_mapping",t),eventSchema:m==null?void 0:m.payload_schema}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{value:d.input_mapping,onChange:t=>p(n,"input_mapping",t.target.value),rows:10,className:L,placeholder:`{
|
|
4
4
|
"data": {
|
|
5
5
|
"orderId": "{event.data.orderId}",
|
|
6
6
|
"error": "{event.data.error}"
|
|
@@ -8,9 +8,9 @@ This takes effect when you save.`)&&f(i)},className:"opacity-0 group-hover/sub:o
|
|
|
8
8
|
}`}),e.jsxs("p",{className:_,children:["Maps event fields to workflow input. ","{event.data.fieldName}"," resolves at runtime."]})]})]})]})]})]})}function Fe({tool:s,value:a,onChange:r,eventSchema:l}){var y,m;const[x,u]=v.useState(!1),n=((y=s==null?void 0:s.inputSchema)==null?void 0:y.properties)??{},h=((m=s==null?void 0:s.inputSchema)==null?void 0:m.required)??[],p=Object.entries(n).filter(([t])=>!t.startsWith("_")),o=v.useMemo(()=>[...p].sort(([t],[i])=>{const b=h.indexOf(t),g=h.indexOf(i);return b!==-1&&g!==-1?b-g:b!==-1?-1:g!==-1?1:t.localeCompare(i)}),[p,h]),f=v.useMemo(()=>{const t=[{value:"{event.type}",label:"event type"},{value:"{event.source}",label:"event source"},{value:"{event.timestamp}",label:"ISO timestamp"},{value:"{event.workflowId}",label:"workflow ID"},{value:"{event.workflowName}",label:"workflow name"}],i=l==null?void 0:l.properties;if(i)for(const[b,g]of Object.entries(i))t.push({value:`{event.data.${b}}`,label:g.description||b});return t},[l]),c=v.useMemo(()=>{try{return JSON.parse(a)}catch{return{}}},[a]),d=(t,i)=>{r(Ee(a,t,i,h))};return o.length===0||x?e.jsxs("div",{children:[o.length>0&&e.jsx("div",{className:"flex justify-end mb-1",children:e.jsx("button",{type:"button",onClick:()=>u(!1),className:"text-[10px] text-accent hover:text-accent-hover transition-colors",children:"Form view"})}),e.jsx("textarea",{value:a,onChange:t=>r(t.target.value),rows:8,className:L,placeholder:`{
|
|
9
9
|
"domain": "{event.data.name}",
|
|
10
10
|
"key": "{event.data.path}"
|
|
11
|
-
}`}),e.jsxs("p",{className:_,children:["Maps event fields to capability inputs. ","{event.data.fieldName}"," resolves at runtime."]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("p",{className:"text-[11px] text-text-tertiary",children:"Map each input to an event field or enter a static value."}),e.jsx("button",{type:"button",onClick:()=>u(!0),className:"text-[10px] text-text-tertiary hover:text-accent transition-colors",children:"Raw JSON"})]}),e.jsx("div",{className:"space-y-4",children:o.map(([t,i])=>{const b=h.includes(t),g=i.description,k=i.type,E=typeof c[t]=="string"?c[t]:typeof c[t]=="object"?JSON.stringify(c[t]):c[t]!=null?String(c[t]):"";return e.jsxs("div",{className:"bg-surface-sunken/30 rounded-md px-4 py-3",children:[e.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[e.jsxs("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[t.replace(/[_-]/g," "),b&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]}),k&&e.jsx("span",{className:"text-[9px] text-text-quaternary",children:k})]}),g&&e.jsx("p",{className:"text-[10px] text-text-quaternary mb-2",children:g}),e.jsx(De,{value:E,onChange:A=>d(t,A),suggestions:f,fieldType:k,placeholder:`{event.data.${t}}`})]},t)})})]})}function De({value:s,onChange:a,suggestions:r,fieldType:l,placeholder:x}){const[u,n]=v.useState(!1),[h,p]=v.useState(""),o=v.useRef(null);v.useEffect(()=>{if(!u)return;function c(d){o.current&&!o.current.contains(d.target)&&n(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[u]);const f=r.filter(c=>c.value.toLowerCase().includes(h.toLowerCase())||c.label.toLowerCase().includes(h.toLowerCase()));if(l==="object")return e.jsx("textarea",{value:s,onChange:c=>{try{a(JSON.parse(c.target.value))}catch{a(c.target.value)}},rows:3,className:`${L} text-xs`,placeholder:'{ "source": "{event.source}" }'});if(l==="array"){const c=(()=>{try{const d=JSON.parse(s);if(Array.isArray(d))return d.map(String)}catch{}return s?s.split(",").map(d=>d.trim()).filter(Boolean):[]})();return e.jsxs("div",{children:[e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 min-h-[28px]",children:c.map((d,y)=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] font-mono bg-accent/10 text-accent rounded-full",children:[d,e.jsx("button",{type:"button",onClick:()=>{const m=c.filter((t,i)=>i!==y);a(JSON.stringify(m))},className:"text-accent/50 hover:text-accent ml-0.5",children:"×"})]},y))}),e.jsx("input",{type:"text",className:"input font-mono text-xs w-full",placeholder:"Type a value and press Enter",onKeyDown:d=>{if(d.key==="Enter"||d.key===","){d.preventDefault();const y=d.target.value.trim();y&&(a(JSON.stringify([...c,y])),d.target.value="")}}})]})}return e.jsxs("div",{ref:o,className:"relative",children:[e.jsx("input",{type:"text",value:s,onFocus:()=>{n(!0),p("")},onChange:c=>{a(c.target.value),p(c.target.value),u||n(!0)},className:"input font-mono text-xs w-full",placeholder:x}),u&&f.length>0&&e.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 max-h-48 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg",children:f.map(c=>e.jsxs("button",{type:"button",onClick:()=>{a(c.value),n(!1)},className:`w-full text-left px-3 py-1.5 hover:bg-surface-hover transition-colors flex items-center gap-3 ${s===c.value?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-[11px] font-mono text-accent shrink-0",children:c.value}),e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:c.label})]},c.value))})]})}function ze({value:s,onChange:a,topics:r}){const[l,x]=v.useState(!1),[u,n]=v.useState(""),h=v.useRef(null),p=v.useRef(null);v.useEffect(()=>{function c(d){p.current&&!p.current.contains(d.target)&&x(!1)}return l&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[l]);const o=l?u:s,f=r.filter(c=>c.topic.toLowerCase().includes((l?u:"").toLowerCase())||(c.description??"").toLowerCase().includes((l?u:"").toLowerCase()));return e.jsxs("div",{ref:p,className:"relative",children:[e.jsx("input",{ref:h,type:"text",value:o,onFocus:()=>{x(!0),n(s)},onChange:c=>{const d=c.target.value;n(d),a(d),l||x(!0)},placeholder:"workflow.failed or app.>",className:`${R} font-mono`}),l&&f.length>0&&e.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 max-h-64 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg",children:f.map(c=>{const d=Le[c.category]??"bg-surface-sunken text-text-tertiary";return e.jsxs("button",{type:"button",onClick:()=>{a(c.topic),n(c.topic),x(!1)},className:`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 ${s===c.topic?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-[11px] font-mono text-text-primary shrink-0",children:c.topic}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-medium shrink-0 ${d}`,children:c.category}),c.description&&e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:c.description})]},c.topic)})})]})}const Be=["*/5 * * * *","*/15 * * * *","0 * * * *","0 */4 * * *","0 7 * * *","0 9 * * 1-5"];function z(s){return{"* * * * *":"Every minute","*/5 * * * *":"Every 5 min","*/15 * * * *":"Every 15 min","0 * * * *":"Hourly","0 */4 * * *":"Every 4 hours","0 7 * * *":"Daily 7 AM UTC","0 9 * * 1-5":"Weekdays 9 AM UTC","0 0 * * 1":"Weekly Monday"}[s]||s}function Ue({form:s,set:a}){const[r,l]=v.useState(0),x=(o,f,c)=>{const d=[...s.schedules];d[o]={...d[o],[f]:c},a("schedules",d)},u=()=>{a("schedules",[...s.schedules,{...qe}]),l(s.schedules.length)},n=o=>{a("schedules",s.schedules.filter((f,c)=>c!==o)),r>=s.schedules.length-1&&l(Math.max(0,s.schedules.length-2))},h=s.schedules,p=h[r];return h.length===0?e.jsxs("div",{children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 mb-8 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. Each schedule runs a workflow on a cron timer."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:schedule"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Schedule",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(G,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No schedules"}),e.jsx("p",{className:"text-[11px] text-text-quaternary max-w-sm mb-6",children:"Add a schedule to run a workflow on a recurring cron timer."}),e.jsxs("button",{onClick:u,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(
|
|
11
|
+
}`}),e.jsxs("p",{className:_,children:["Maps event fields to capability inputs. ","{event.data.fieldName}"," resolves at runtime."]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("p",{className:"text-[11px] text-text-tertiary",children:"Map each input to an event field or enter a static value."}),e.jsx("button",{type:"button",onClick:()=>u(!0),className:"text-[10px] text-text-tertiary hover:text-accent transition-colors",children:"Raw JSON"})]}),e.jsx("div",{className:"space-y-4",children:o.map(([t,i])=>{const b=h.includes(t),g=i.description,k=i.type,E=typeof c[t]=="string"?c[t]:typeof c[t]=="object"?JSON.stringify(c[t]):c[t]!=null?String(c[t]):"";return e.jsxs("div",{className:"bg-surface-sunken/30 rounded-md px-4 py-3",children:[e.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[e.jsxs("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[t.replace(/[_-]/g," "),b&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]}),k&&e.jsx("span",{className:"text-[9px] text-text-quaternary",children:k})]}),g&&e.jsx("p",{className:"text-[10px] text-text-quaternary mb-2",children:g}),e.jsx(De,{value:E,onChange:A=>d(t,A),suggestions:f,fieldType:k,placeholder:`{event.data.${t}}`})]},t)})})]})}function De({value:s,onChange:a,suggestions:r,fieldType:l,placeholder:x}){const[u,n]=v.useState(!1),[h,p]=v.useState(""),o=v.useRef(null);v.useEffect(()=>{if(!u)return;function c(d){o.current&&!o.current.contains(d.target)&&n(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[u]);const f=r.filter(c=>c.value.toLowerCase().includes(h.toLowerCase())||c.label.toLowerCase().includes(h.toLowerCase()));if(l==="object")return e.jsx("textarea",{value:s,onChange:c=>{try{a(JSON.parse(c.target.value))}catch{a(c.target.value)}},rows:3,className:`${L} text-xs`,placeholder:'{ "source": "{event.source}" }'});if(l==="array"){const c=(()=>{try{const d=JSON.parse(s);if(Array.isArray(d))return d.map(String)}catch{}return s?s.split(",").map(d=>d.trim()).filter(Boolean):[]})();return e.jsxs("div",{children:[e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 min-h-[28px]",children:c.map((d,y)=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] font-mono bg-accent/10 text-accent rounded-full",children:[d,e.jsx("button",{type:"button",onClick:()=>{const m=c.filter((t,i)=>i!==y);a(JSON.stringify(m))},className:"text-accent/50 hover:text-accent ml-0.5",children:"×"})]},y))}),e.jsx("input",{type:"text",className:"input font-mono text-xs w-full",placeholder:"Type a value and press Enter",onKeyDown:d=>{if(d.key==="Enter"||d.key===","){d.preventDefault();const y=d.target.value.trim();y&&(a(JSON.stringify([...c,y])),d.target.value="")}}})]})}return e.jsxs("div",{ref:o,className:"relative",children:[e.jsx("input",{type:"text",value:s,onFocus:()=>{n(!0),p("")},onChange:c=>{a(c.target.value),p(c.target.value),u||n(!0)},className:"input font-mono text-xs w-full",placeholder:x}),u&&f.length>0&&e.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 max-h-48 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg",children:f.map(c=>e.jsxs("button",{type:"button",onClick:()=>{a(c.value),n(!1)},className:`w-full text-left px-3 py-1.5 hover:bg-surface-hover transition-colors flex items-center gap-3 ${s===c.value?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-[11px] font-mono text-accent shrink-0",children:c.value}),e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:c.label})]},c.value))})]})}function ze({value:s,onChange:a,topics:r}){const[l,x]=v.useState(!1),[u,n]=v.useState(""),h=v.useRef(null),p=v.useRef(null);v.useEffect(()=>{function c(d){p.current&&!p.current.contains(d.target)&&x(!1)}return l&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[l]);const o=l?u:s,f=r.filter(c=>c.topic.toLowerCase().includes((l?u:"").toLowerCase())||(c.description??"").toLowerCase().includes((l?u:"").toLowerCase()));return e.jsxs("div",{ref:p,className:"relative",children:[e.jsx("input",{ref:h,type:"text",value:o,onFocus:()=>{x(!0),n(s)},onChange:c=>{const d=c.target.value;n(d),a(d),l||x(!0)},placeholder:"workflow.failed or app.>",className:`${R} font-mono`}),l&&f.length>0&&e.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 max-h-64 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg",children:f.map(c=>{const d=Le[c.category]??"bg-surface-sunken text-text-tertiary";return e.jsxs("button",{type:"button",onClick:()=>{a(c.topic),n(c.topic),x(!1)},className:`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 ${s===c.topic?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-[11px] font-mono text-text-primary shrink-0",children:c.topic}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-medium shrink-0 ${d}`,children:c.category}),c.description&&e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:c.description})]},c.topic)})})]})}const Be=["*/5 * * * *","*/15 * * * *","0 * * * *","0 */4 * * *","0 7 * * *","0 9 * * 1-5"];function z(s){return{"* * * * *":"Every minute","*/5 * * * *":"Every 5 min","*/15 * * * *":"Every 15 min","0 * * * *":"Hourly","0 */4 * * *":"Every 4 hours","0 7 * * *":"Daily 7 AM UTC","0 9 * * 1-5":"Weekdays 9 AM UTC","0 0 * * 1":"Weekly Monday"}[s]||s}function Ue({form:s,set:a}){const[r,l]=v.useState(0),x=(o,f,c)=>{const d=[...s.schedules];d[o]={...d[o],[f]:c},a("schedules",d)},u=()=>{a("schedules",[...s.schedules,{...qe}]),l(s.schedules.length)},n=o=>{a("schedules",s.schedules.filter((f,c)=>c!==o)),r>=s.schedules.length-1&&l(Math.max(0,s.schedules.length-2))},h=s.schedules,p=h[r];return h.length===0?e.jsxs("div",{children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 mb-8 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Optional. Each schedule runs a workflow on a cron timer."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:schedule"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Schedule",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(G,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No schedules"}),e.jsx("p",{className:"text-[11px] text-text-quaternary max-w-sm mb-6",children:"Add a schedule to run a workflow on a recurring cron timer."}),e.jsxs("button",{onClick:u,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(M,{className:"w-3.5 h-3.5"})," Add schedule"]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 mb-6 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Each schedule runs a workflow on a timer. An automation can have multiple schedules targeting different workflows."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:schedule"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Schedule",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("div",{className:"w-48 shrink-0 space-y-0.5",children:[h.map((o,f)=>e.jsxs("div",{className:`group/sched flex items-center rounded-md transition-colors ${r===f?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>l(f),className:"flex-1 text-left px-3 py-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] font-mono block",children:o.cron||"new schedule"}),e.jsxs("span",{className:"text-[9px] text-text-quaternary",children:[(o.reaction_type==="pipeline"?o.pipeline_id:o.workflow_type)||"no target"," · ",z(o.cron)]})]}),e.jsx("button",{onClick:c=>{c.stopPropagation(),confirm(`Remove schedule "${o.cron||"new"}"?
|
|
12
12
|
|
|
13
|
-
This takes effect when you save.`)&&n(f)},className:"opacity-0 group-hover/sched:opacity-100 px-2 text-text-quaternary hover:text-status-error transition-all",title:"Remove",children:e.jsx(Z,{className:"w-3 h-3"})})]},f)),e.jsxs("button",{onClick:u,className:"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors",children:[e.jsx(
|
|
13
|
+
This takes effect when you save.`)&&n(f)},className:"opacity-0 group-hover/sched:opacity-100 px-2 text-text-quaternary hover:text-status-error transition-all",title:"Remove",children:e.jsx(Z,{className:"w-3 h-3"})})]},f)),e.jsxs("button",{onClick:u,className:"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors",children:[e.jsx(M,{className:"w-3 h-3"})," Add"]})]}),p&&e.jsxs("div",{className:"flex-1 min-w-0 space-y-12",children:[e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run every"}),e.jsx("input",{type:"text",value:p.cron,onChange:o=>x(r,"cron",o.target.value),placeholder:"0 * * * *",className:`${R} font-mono`}),p.cron&&e.jsx("p",{className:"text-[11px] text-accent/80 mt-1",children:z(p.cron)}),e.jsx("div",{className:"flex gap-3 mt-2 overflow-x-auto",children:Be.map(o=>e.jsx("button",{type:"button",onClick:()=>x(r,"cron",o),className:`text-[10px] font-mono whitespace-nowrap transition-colors ${p.cron===o?"text-accent font-medium":"text-accent/50 hover:text-accent"}`,children:z(o)},o))})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run this reaction"}),e.jsx(ae,{reactionType:p.reaction_type,onReactionTypeChange:o=>x(r,"reaction_type",o),workflowType:p.workflow_type,onWorkflowTypeChange:o=>x(r,"workflow_type",o),pipelineId:p.pipeline_id,onPipelineIdChange:o=>x(r,"pipeline_id",o),serverId:p.server_id,toolName:p.tool_name,onCapabilityChange:(o,f)=>{x(r,"server_id",o),x(r,"tool_name",f)},availableTypes:["durable","pipeline","capability"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"As identity"}),e.jsx(te,{selected:p.execute_as,onChange:o=>x(r,"execute_as",o)}),e.jsx("p",{className:_,children:"Identity used when invoking."})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"With this data"}),e.jsx("textarea",{value:p.envelope,onChange:o=>x(r,"envelope",o.target.value),rows:10,className:L,placeholder:`{
|
|
14
14
|
"data": { "source": "cron" }
|
|
15
|
-
}`}),e.jsx("p",{className:_,children:"Static payload passed to the workflow on each invocation."})]})]})]})]})}function W({icon:s,color:a,title:r,children:l}){return e.jsxs("div",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 pb-1.5 border-b border-surface-border/40",children:[e.jsx(s,{className:`w-3.5 h-3.5 ${a}`,strokeWidth:1.5}),e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-widest text-accent/80",children:r})]}),e.jsx("div",{className:"pl-5.5",children:l})]})}function
|
|
16
|
-
//# sourceMappingURL=AgentConfigPage-
|
|
15
|
+
}`}),e.jsx("p",{className:_,children:"Static payload passed to the workflow on each invocation."})]})]})]})]})}function W({icon:s,color:a,title:r,children:l}){return e.jsxs("div",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 pb-1.5 border-b border-surface-border/40",children:[e.jsx(s,{className:`w-3.5 h-3.5 ${a}`,strokeWidth:1.5}),e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-widest text-accent/80",children:r})]}),e.jsx("div",{className:"pl-5.5",children:l})]})}function T({label:s,children:a}){return e.jsxs("div",{className:"flex gap-3 py-0.5",children:[e.jsx("span",{className:"text-[10px] text-text-quaternary w-20 shrink-0",children:s}),e.jsx("span",{className:"text-xs text-text-primary",children:a})]})}function Ye({form:s}){return e.jsxs("div",{children:[e.jsxs(W,{icon:V,color:"text-accent",title:"Identity",children:[e.jsx(T,{label:"Name",children:s.name||"—"}),s.description&&e.jsx(T,{label:"Description",children:s.description})]}),(s.goals||s.rules)&&e.jsxs(W,{icon:ee,color:"text-accent",title:"Motivation",children:[s.goals&&e.jsx(T,{label:"Goals",children:s.goals}),s.rules&&e.jsx(T,{label:"Rules",children:s.rules})]}),e.jsx(W,{icon:U,color:"text-accent",title:"Knowledge",children:e.jsx(T,{label:"Domain",children:s.knowledge_domain||"None"})}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-10",children:[e.jsx(W,{icon:Y,color:"text-accent",title:`Subscriptions (${s.subscriptions.length})`,children:s.subscriptions.length===0?e.jsx("span",{className:"text-[11px] text-text-quaternary",children:"None configured"}):e.jsx("div",{className:"divide-y divide-surface-border/30",children:s.subscriptions.map((a,r)=>e.jsxs("div",{className:"flex items-center py-1.5",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(oe,{topic:a.topic||"unset"})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"text-text-quaternary text-[10px]",children:"→"}),a.workflow_type?e.jsx(Q,{type:a.workflow_type}):e.jsx("span",{className:"text-[11px] text-text-quaternary",children:a.reaction_type})]})]},r))})}),e.jsx(W,{icon:G,color:"text-accent",title:`Schedules (${s.schedules.length})`,children:s.schedules.length===0?e.jsx("span",{className:"text-[11px] text-text-quaternary",children:"None configured"}):e.jsx("div",{className:"divide-y divide-surface-border/30",children:s.schedules.map((a,r)=>e.jsxs("div",{className:"flex items-center py-1.5",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(de,{cron:a.cron})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"text-text-quaternary text-[10px]",children:"→"}),a.workflow_type?e.jsx(Q,{type:a.workflow_type}):e.jsx("span",{className:"text-[11px] text-text-quaternary",children:"no workflow"})]})]},r))})})]}),e.jsx("div",{className:"border-l-2 border-status-success/30 pl-3 py-2 mt-6",children:e.jsx("p",{className:"text-[11px] text-text-tertiary leading-relaxed",children:"After saving, subscriptions and schedules activate immediately. You can pause the automation anytime."})})]})}const Ge=[{id:1,label:"Identity",icon:V},{id:2,label:"Motivation",icon:ee},{id:3,label:"Knowledge",icon:U},{id:4,label:"Subscriptions",icon:Y},{id:5,label:"Schedules",icon:G},{id:6,label:"Review",icon:ye}];function dt(){var H;const{id:s}=_e(),a=!s,r=ke(),{data:l}=fe(),u=!!((H=l==null?void 0:l.ai)!=null&&H.enabled)?"Agent":"Automation",{data:n,isLoading:h}=re(a?null:s),{data:p}=pe(a?null:s),o=ce(),f=le(),c=xe(),d=ue(),y=me(),[m,t]=v.useState(X),[i,b]=v.useState(!1),[g,k]=v.useState(""),[E,A]=Ce(),w=parseInt(E.get("step")||"1",10),P=v.useCallback(j=>{A(N=>{const q=new URLSearchParams(N);return q.set("step",String(j)),q},{replace:!0})},[A]);v.useEffect(()=>{if(!i){if(a){t(X),b(!0);return}n&&p&&(t(Re(n,p.subscriptions??[])),b(!0))}},[n,p,a,i]);const I=(j,N)=>t(q=>({...q,[j]:N})),ne=async()=>{k("");try{const j=Ae(m);let N=s;a?N=(await o.mutateAsync(j)).id:await f.mutateAsync({id:s,...j});const q=Oe(m),ie=(p==null?void 0:p.subscriptions)??[],J=new Set(ie.map(C=>C.id));for(const C of q)if(C.id&&J.has(C.id)){const{id:F,...D}=C;await d.mutateAsync({agentId:N,subId:F,...D}),J.delete(F)}else{const{id:F,...D}=C;await c.mutateAsync({agentId:N,...D})}for(const C of J)await y.mutateAsync({agentId:N,subId:C});r(`/agents/${N}`)}catch(j){k(j.message)}};if(!a&&h)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-60 bg-surface-sunken rounded"})]});const K=o.isPending||f.isPending;return e.jsxs("div",{children:[e.jsx(ve,{title:a?`New ${u}`:`${u}: ${(n==null?void 0:n.id)??""}`,docsHash:"#docs:agents.md"}),e.jsxs("div",{className:"flex gap-10",children:[e.jsxs("nav",{className:"w-44 shrink-0 sticky top-0 self-start pt-2",children:[e.jsx("div",{className:"space-y-0.5",children:Ge.map(j=>{const N=j.icon,q=w===j.id;return e.jsxs("button",{onClick:()=>P(j.id),className:`w-full flex items-center gap-2.5 px-3 py-2 rounded-md text-left transition-colors ${q?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(N,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-xs font-medium",children:j.label})]},j.id)})}),e.jsxs("div",{className:"mt-8 pt-4 border-t border-surface-border space-y-2",children:[e.jsx("button",{onClick:ne,disabled:!m.name.trim()||K,className:"w-full btn-primary text-xs disabled:opacity-50",children:K?"Saving...":a?`Create ${u}`:"Save"}),e.jsx("button",{onClick:()=>r(a?"/agents":`/agents/${s}`),className:"w-full btn-ghost text-xs",children:"Cancel"})]}),g&&e.jsx("p",{className:"text-xs text-status-error mt-3",children:g})]}),e.jsxs("div",{className:"flex-1 min-w-0 pt-2",children:[w===1&&e.jsx($e,{form:m,set:I}),w===2&&e.jsx(Pe,{form:m,set:I}),w===3&&e.jsx(Ie,{form:m,set:I}),w===4&&e.jsx(Je,{form:m,set:I}),w===5&&e.jsx(Ue,{form:m,set:I}),w===6&&e.jsx(Ye,{form:m})]})]})]})}export{dt as AgentConfigPage};
|
|
16
|
+
//# sourceMappingURL=AgentConfigPage-CVg_tFbf.js.map
|