@hotmeshio/long-tail 0.4.4 → 0.4.6
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/agent-subscriptions.js +14 -0
- package/build/api/files.js +8 -0
- package/build/api/topics.d.ts +5 -0
- package/build/api/topics.js +20 -0
- package/build/lib/events/index.js +3 -0
- package/build/lib/events/nats.js +2 -0
- package/build/routes/topics.js +12 -0
- package/build/services/agent/index.js +14 -0
- package/build/services/agent/trigger-registry.d.ts +11 -0
- package/build/services/agent/trigger-registry.js +62 -10
- package/build/start/workers.js +3 -0
- package/build/types/events.d.ts +1 -1
- package/dashboard/dist/assets/{AdminDashboard-DISq0Tz8.js → AdminDashboard-qZYNzvw8.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-DISq0Tz8.js.map → AdminDashboard-qZYNzvw8.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-DqaJpB3K.js → AgentConfigPage-_SMbioNp.js} +5 -5
- package/dashboard/dist/assets/AgentConfigPage-_SMbioNp.js.map +1 -0
- package/dashboard/dist/assets/{AgentDetailPage-BPzPk2GC.js → AgentDetailPage-Cf_SRtbT.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-BPzPk2GC.js.map → AgentDetailPage-Cf_SRtbT.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-CLcxJWjC.js → AgentsPage-q53C1Xk_.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-CLcxJWjC.js.map → AgentsPage-q53C1Xk_.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-hOcjAAIj.js → AvailableEscalationsPage-DHWciaKb.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-hOcjAAIj.js.map → AvailableEscalationsPage-DHWciaKb.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-DuAZgHbJ.js → BotPicker-638n5Jaz.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-DuAZgHbJ.js.map → BotPicker-638n5Jaz.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-PRel6TXd.js → CapabilitiesPage-PmgEhPl8.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-PRel6TXd.js.map → CapabilitiesPage-PmgEhPl8.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-DnoUFQVf.js → CollapsibleSection-BEZoI6NU.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-DnoUFQVf.js.map → CollapsibleSection-BEZoI6NU.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-CqedUU7b.js → CredentialsPage-Dl15oW3U.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-CqedUU7b.js.map → CredentialsPage-Dl15oW3U.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-CPEjE-mH.js → CronLabel-Dg8U0s5a.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-CPEjE-mH.js.map → CronLabel-Dg8U0s5a.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-BIQWzbv0.js → CustomDurationPicker-BCbVMr-4.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-BIQWzbv0.js.map → CustomDurationPicker-BCbVMr-4.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-e5EOL5gC.js → DropZone-lw2wmqty.js} +2 -2
- package/dashboard/dist/assets/{DropZone-e5EOL5gC.js.map → DropZone-lw2wmqty.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-CzVjr74Y.js → ElapsedCell-fuG5wRDw.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-CzVjr74Y.js.map → ElapsedCell-fuG5wRDw.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-Bcrb44xJ.js → EscalationsOverview-nYOZczYx.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-Bcrb44xJ.js.map → EscalationsOverview-nYOZczYx.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-CGfJU7e1.js → EventTable-Cm0Ql46x.js} +2 -2
- package/dashboard/dist/assets/{EventTable-CGfJU7e1.js.map → EventTable-Cm0Ql46x.js.map} +1 -1
- package/dashboard/dist/assets/{EventTopicPill-xJJnxvlP.js → EventTopicPill-RaASGdZz.js} +2 -2
- package/dashboard/dist/assets/{EventTopicPill-xJJnxvlP.js.map → EventTopicPill-RaASGdZz.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-BIzUcGW9.js → HomePage-Cx6pvCFX.js} +2 -2
- package/dashboard/dist/assets/{HomePage-BIzUcGW9.js.map → HomePage-Cx6pvCFX.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-DNAGFe14.js → ListToolbar-YHesiWwN.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-DNAGFe14.js.map → ListToolbar-YHesiWwN.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-BpYk21es.js → McpOverview-BWsaxVKL.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-BpYk21es.js.map → McpOverview-BWsaxVKL.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-DlrZiSuL.js → McpQueryDetailPage-CQk3YpR-.js} +2 -2
- package/dashboard/dist/assets/McpQueryDetailPage-CQk3YpR-.js.map +1 -0
- package/dashboard/dist/assets/{McpQueryPage-COfPssO7.js → McpQueryPage-Uf5DKujM.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-COfPssO7.js.map → McpQueryPage-Uf5DKujM.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-Cra0nQSw.js → McpRunDetailPage-D9GU27cS.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-Cra0nQSw.js.map → McpRunDetailPage-D9GU27cS.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-BlgcGN3k.js → McpRunsPage-5dVAu25-.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-BlgcGN3k.js.map → McpRunsPage-5dVAu25-.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-BbO6cWzb.js → OperatorDashboard-DNJtUDxl.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-BbO6cWzb.js.map → OperatorDashboard-DNJtUDxl.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-B_gV_jKk.js → PageHeader-B4w-LDUF.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-B_gV_jKk.js.map → PageHeader-B4w-LDUF.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-D0I0nrnx.js → PageHeaderWithStats-DQmNXYcG.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-D0I0nrnx.js.map → PageHeaderWithStats-DQmNXYcG.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-s_iV8ICg.js → ProcessDetailPage-BPsvlG0E.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-s_iV8ICg.js.map → ProcessDetailPage-BPsvlG0E.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-MnLMnxAa.js → ProcessesListPage-CnuCtHSP.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-MnLMnxAa.js.map → ProcessesListPage-CnuCtHSP.js.map} +1 -1
- package/dashboard/dist/assets/{RolePill-BOBytzrP.js → RolePill-Dk-YUxCm.js} +2 -2
- package/dashboard/dist/assets/{RolePill-BOBytzrP.js.map → RolePill-Dk-YUxCm.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-BH7KASM7.js → RolesPage-BGJMx2S2.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-BH7KASM7.js.map → RolesPage-BGJMx2S2.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-_QbJKhlo.js → RunAsSelector-CcNnj5AF.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-_QbJKhlo.js.map → RunAsSelector-CcNnj5AF.js.map} +1 -1
- package/dashboard/dist/assets/{ServerName-uqa4eBqm.js → ServerName-BXSm_14r.js} +2 -2
- package/dashboard/dist/assets/{ServerName-uqa4eBqm.js.map → ServerName-BXSm_14r.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-F9FZsRy9.js → StickyPagination-BWhFSr2d.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-F9FZsRy9.js.map → StickyPagination-BWhFSr2d.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-og79Llvs.js → SwimlaneTimeline-fWiYlTQw.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-og79Llvs.js.map → SwimlaneTimeline-fWiYlTQw.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-D3f11sbM.js → TagInput-CYh3PFNq.js} +2 -2
- package/dashboard/dist/assets/{TagInput-D3f11sbM.js.map → TagInput-CYh3PFNq.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-DPV4ySd9.js → TaskDetailPage-Byz19B5I.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-DPV4ySd9.js.map → TaskDetailPage-Byz19B5I.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-Bc45J7X1.js → TaskQueuePill-BSFLiBcf.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-Bc45J7X1.js.map → TaskQueuePill-BSFLiBcf.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-BYj3OqUi.js → TasksListPage-pe1Opw6s.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-BYj3OqUi.js.map → TasksListPage-pe1Opw6s.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-W7TdJpV-.js → TimeAgo-8aYUlXT9.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-W7TdJpV-.js.map → TimeAgo-8aYUlXT9.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-Bi2nc9Q_.js → TimestampCell-_1fW34op.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-Bi2nc9Q_.js.map → TimestampCell-_1fW34op.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-CuoXcmhv.js → ToolPill-CcKNnnrK.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-CuoXcmhv.js.map → ToolPill-CcKNnnrK.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-Dl3C53zb.js → ToolTestPanel-BD7ZkPeM.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-Dl3C53zb.js.map → ToolTestPanel-BD7ZkPeM.js.map} +1 -1
- package/dashboard/dist/assets/TopicDetailPage-DL6QarSi.js +9 -0
- package/dashboard/dist/assets/TopicDetailPage-DL6QarSi.js.map +1 -0
- package/dashboard/dist/assets/{TopicsPage-BfsJEC1p.js → TopicsPage-JYAk0csl.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-BfsJEC1p.js.map → TopicsPage-JYAk0csl.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-b4baWHM_.js → UserName-Dcn8reNm.js} +2 -2
- package/dashboard/dist/assets/{UserName-b4baWHM_.js.map → UserName-Dcn8reNm.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-BGmJnXnk.js → WorkflowExecutionPage-DPie2xiD.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-BGmJnXnk.js.map → WorkflowExecutionPage-DPie2xiD.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-Bg2-0Hkg.js → WorkflowPill-BkfIn8N3.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-Bg2-0Hkg.js.map → WorkflowPill-BkfIn8N3.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-BzH7jMRu.js → WorkflowsDashboard-BRKurUye.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-BzH7jMRu.js.map → WorkflowsDashboard-BRKurUye.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-BcUgBvjD.js → WorkflowsOverview-C9Wob38P.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-BcUgBvjD.js.map → WorkflowsOverview-C9Wob38P.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-OhpCQJ0l.js → YamlWorkflowsPage-BoKSRpKN.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-OhpCQJ0l.js.map → YamlWorkflowsPage-BoKSRpKN.js.map} +1 -1
- package/dashboard/dist/assets/{agents-Ce3HmPz4.js → agents-CpLOugsY.js} +2 -2
- package/dashboard/dist/assets/{agents-Ce3HmPz4.js.map → agents-CpLOugsY.js.map} +1 -1
- package/dashboard/dist/assets/{bots-B0BomNnf.js → bots-DRrquJqC.js} +2 -2
- package/dashboard/dist/assets/{bots-B0BomNnf.js.map → bots-DRrquJqC.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-t-w5N9K9.js → capabilities-xbHvOXKc.js} +2 -2
- package/dashboard/dist/assets/{capabilities-t-w5N9K9.js.map → capabilities-xbHvOXKc.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-BrtAZnJM.js → controlplane-FilVp8jI.js} +2 -2
- package/dashboard/dist/assets/{controlplane-BrtAZnJM.js.map → controlplane-FilVp8jI.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-DilnDxw2.js → escalation-SGea3mBy.js} +2 -2
- package/dashboard/dist/assets/{escalation-DilnDxw2.js.map → escalation-SGea3mBy.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-C0slywOY.js → escalation-columns-C6sLGnSX.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-C0slywOY.js.map → escalation-columns-C6sLGnSX.js.map} +1 -1
- package/dashboard/dist/assets/{helpers-BMvPqQr8.js → helpers-wHzG3Maf.js} +2 -2
- package/dashboard/dist/assets/{helpers-BMvPqQr8.js.map → helpers-wHzG3Maf.js.map} +1 -1
- package/dashboard/dist/assets/{index-Ck2QdJXT.js → index-90jmsIHz.js} +2 -2
- package/dashboard/dist/assets/{index-Ck2QdJXT.js.map → index-90jmsIHz.js.map} +1 -1
- package/dashboard/dist/assets/index-B7Vxutyl.js +63 -0
- package/dashboard/dist/assets/index-B7Vxutyl.js.map +1 -0
- package/dashboard/dist/assets/{index-H5TlloTk.js → index-BS3KIrQL.js} +2 -2
- package/dashboard/dist/assets/{index-H5TlloTk.js.map → index-BS3KIrQL.js.map} +1 -1
- package/dashboard/dist/assets/{index-30-pN97P.js → index-Bu2EEWNN.js} +2 -2
- package/dashboard/dist/assets/{index-30-pN97P.js.map → index-Bu2EEWNN.js.map} +1 -1
- package/dashboard/dist/assets/{index-DnsVYMMg.js → index-C7k3xfpt.js} +2 -2
- package/dashboard/dist/assets/{index-DnsVYMMg.js.map → index-C7k3xfpt.js.map} +1 -1
- package/dashboard/dist/assets/{index-BxOuF0hm.js → index-C8xDd-Ys.js} +2 -2
- package/dashboard/dist/assets/{index-BxOuF0hm.js.map → index-C8xDd-Ys.js.map} +1 -1
- package/dashboard/dist/assets/{index-pIMl0mYp.js → index-CkYNpw4d.js} +2 -2
- package/dashboard/dist/assets/{index-pIMl0mYp.js.map → index-CkYNpw4d.js.map} +1 -1
- package/dashboard/dist/assets/{index-f-0Duls3.js → index-DVxBi47d.js} +2 -2
- package/dashboard/dist/assets/{index-f-0Duls3.js.map → index-DVxBi47d.js.map} +1 -1
- package/dashboard/dist/assets/{index-BPxglOYm.css → index-DZI2L4ag.css} +1 -1
- package/dashboard/dist/assets/{index-DPW_i3fH.js → index-Dr8WJAGM.js} +2 -2
- package/dashboard/dist/assets/index-Dr8WJAGM.js.map +1 -0
- package/dashboard/dist/assets/{index-DNmlrCAp.js → index-DzgixtgL.js} +2 -2
- package/dashboard/dist/assets/{index-DNmlrCAp.js.map → index-DzgixtgL.js.map} +1 -1
- package/dashboard/dist/assets/index-E1i1ADY1.js +15 -0
- package/dashboard/dist/assets/{index-D_wqdvG_.js.map → index-E1i1ADY1.js.map} +1 -1
- package/dashboard/dist/assets/{index-Bl9wzQ8Q.js → index-H2tN256i.js} +2 -2
- package/dashboard/dist/assets/{index-Bl9wzQ8Q.js.map → index-H2tN256i.js.map} +1 -1
- package/dashboard/dist/assets/{index-qNuxC8kX.js → index-WwUcAoas.js} +2 -2
- package/dashboard/dist/assets/{index-qNuxC8kX.js.map → index-WwUcAoas.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-D01NdF5h.js → knowledge-CQWNz28-.js} +2 -2
- package/dashboard/dist/assets/{knowledge-D01NdF5h.js.map → knowledge-CQWNz28-.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-CjXjDZI0.js → mcp-J_cDlKuA.js} +2 -2
- package/dashboard/dist/assets/{mcp-CjXjDZI0.js.map → mcp-J_cDlKuA.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-LlKQcWLJ.js → mcp-query-C1zyeRvo.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-LlKQcWLJ.js.map → mcp-query-C1zyeRvo.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-runs-C0C54hU6.js → mcp-runs-BR4fvXXw.js} +2 -2
- package/dashboard/dist/assets/{mcp-runs-C0C54hU6.js.map → mcp-runs-BR4fvXXw.js.map} +1 -1
- package/dashboard/dist/assets/{namespaces-6qWDXXJV.js → namespaces-XOr9_XCV.js} +2 -2
- package/dashboard/dist/assets/{namespaces-6qWDXXJV.js.map → namespaces-XOr9_XCV.js.map} +1 -1
- package/dashboard/dist/assets/{roles-Dtj0uabn.js → roles-yuxJgQBf.js} +2 -2
- package/dashboard/dist/assets/{roles-Dtj0uabn.js.map → roles-yuxJgQBf.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-BevFBjZq.js → tasks-CI3qsHdP.js} +2 -2
- package/dashboard/dist/assets/{tasks-BevFBjZq.js.map → tasks-CI3qsHdP.js.map} +1 -1
- package/dashboard/dist/assets/topics-lm2GYKuv.js +2 -0
- package/dashboard/dist/assets/{topics-BMG5tx2g.js.map → topics-lm2GYKuv.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-CPyvFlVR.js → useEventHooks-DpvfSw9p.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-CPyvFlVR.js.map → useEventHooks-DpvfSw9p.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-Bll8NPNQ.js → useYamlActivityEvents-D-zuU9Ts.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-Bll8NPNQ.js.map → useYamlActivityEvents-D-zuU9Ts.js.map} +1 -1
- package/dashboard/dist/assets/{users-XZ349b0r.js → users-DRkulG9o.js} +2 -2
- package/dashboard/dist/assets/{users-XZ349b0r.js.map → users-DRkulG9o.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-B_Yla7iD.js → vendor-icons-5gSix3t2.js} +106 -101
- package/dashboard/dist/assets/vendor-icons-5gSix3t2.js.map +1 -0
- package/dashboard/dist/assets/{workflows-Do-Eiv8f.js → workflows-dhvM792w.js} +2 -2
- package/dashboard/dist/assets/{workflows-Do-Eiv8f.js.map → workflows-dhvM792w.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-DolGRQ5f.js → yaml-workflows-DqbGpE2x.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-DolGRQ5f.js.map → yaml-workflows-DqbGpE2x.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/package.json +1 -1
- package/dashboard/dist/assets/AgentConfigPage-DqaJpB3K.js.map +0 -1
- package/dashboard/dist/assets/McpQueryDetailPage-DlrZiSuL.js.map +0 -1
- package/dashboard/dist/assets/TopicDetailPage-CjaZn4WP.js +0 -9
- package/dashboard/dist/assets/TopicDetailPage-CjaZn4WP.js.map +0 -1
- package/dashboard/dist/assets/index-DPW_i3fH.js.map +0 -1
- package/dashboard/dist/assets/index-DZX-E_3q.js +0 -63
- package/dashboard/dist/assets/index-DZX-E_3q.js.map +0 -1
- package/dashboard/dist/assets/index-D_wqdvG_.js +0 -15
- package/dashboard/dist/assets/topics-BMG5tx2g.js +0 -2
- package/dashboard/dist/assets/vendor-icons-B_Yla7iD.js.map +0 -1
|
@@ -38,6 +38,15 @@ exports.createSubscription = createSubscription;
|
|
|
38
38
|
exports.updateSubscription = updateSubscription;
|
|
39
39
|
exports.deleteSubscription = deleteSubscription;
|
|
40
40
|
const subService = __importStar(require("../services/agent/subscriptions"));
|
|
41
|
+
const publish_1 = require("../lib/events/publish");
|
|
42
|
+
function notifyTriggersChanged(agentId) {
|
|
43
|
+
(0, publish_1.publishAgentEvent)({
|
|
44
|
+
type: 'agent.triggers_changed',
|
|
45
|
+
agentId,
|
|
46
|
+
agentName: agentId,
|
|
47
|
+
data: { action: 'subscription_changed' },
|
|
48
|
+
});
|
|
49
|
+
}
|
|
41
50
|
async function listSubscriptions(input) {
|
|
42
51
|
try {
|
|
43
52
|
const subs = await subService.listSubscriptions(input.agentId);
|
|
@@ -51,6 +60,7 @@ async function createSubscription(input) {
|
|
|
51
60
|
try {
|
|
52
61
|
const { agentId, ...data } = input;
|
|
53
62
|
const sub = await subService.createSubscription(agentId, data);
|
|
63
|
+
notifyTriggersChanged(agentId);
|
|
54
64
|
return { status: 201, data: sub };
|
|
55
65
|
}
|
|
56
66
|
catch (err) {
|
|
@@ -63,6 +73,7 @@ async function updateSubscription(input) {
|
|
|
63
73
|
const sub = await subService.updateSubscription(id, data);
|
|
64
74
|
if (!sub)
|
|
65
75
|
return { status: 404, error: 'Subscription not found' };
|
|
76
|
+
notifyTriggersChanged(sub.agent_id);
|
|
66
77
|
return { status: 200, data: sub };
|
|
67
78
|
}
|
|
68
79
|
catch (err) {
|
|
@@ -71,9 +82,12 @@ async function updateSubscription(input) {
|
|
|
71
82
|
}
|
|
72
83
|
async function deleteSubscription(input) {
|
|
73
84
|
try {
|
|
85
|
+
const sub = await subService.getSubscription(input.id);
|
|
74
86
|
const deleted = await subService.deleteSubscription(input.id);
|
|
75
87
|
if (!deleted)
|
|
76
88
|
return { status: 404, error: 'Subscription not found' };
|
|
89
|
+
if (sub)
|
|
90
|
+
notifyTriggersChanged(sub.agent_id);
|
|
77
91
|
return { status: 200, data: { deleted: true } };
|
|
78
92
|
}
|
|
79
93
|
catch (err) {
|
package/build/api/files.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.uploadFile = uploadFile;
|
|
|
7
7
|
exports.generateSignedUrl = generateSignedUrl;
|
|
8
8
|
const storage_1 = require("../lib/storage");
|
|
9
9
|
const mime_1 = require("../lib/storage/mime");
|
|
10
|
+
const publish_1 = require("../lib/events/publish");
|
|
10
11
|
const ALLOWED_EXPIRY = [3600, 21600, 86400, 604800, 2592000]; // 1h, 6h, 24h, 7d, 30d
|
|
11
12
|
async function browseFiles(input) {
|
|
12
13
|
try {
|
|
@@ -38,6 +39,7 @@ async function deleteFile(input) {
|
|
|
38
39
|
if (!result.deleted) {
|
|
39
40
|
return { status: 404, error: 'File not found' };
|
|
40
41
|
}
|
|
42
|
+
(0, publish_1.publishFileEvent)({ type: 'file.deleted', path: input.filePath });
|
|
41
43
|
return { status: 200, data: { deleted: true, path: input.filePath } };
|
|
42
44
|
}
|
|
43
45
|
catch (err) {
|
|
@@ -48,6 +50,12 @@ async function uploadFile(input) {
|
|
|
48
50
|
try {
|
|
49
51
|
const result = await (0, storage_1.getStorageBackend)().write(input.path, input.buffer);
|
|
50
52
|
const contentType = (0, mime_1.mimeFromPath)(input.path);
|
|
53
|
+
(0, publish_1.publishFileEvent)({
|
|
54
|
+
type: 'file.stored',
|
|
55
|
+
path: input.path,
|
|
56
|
+
size: result.size,
|
|
57
|
+
mime: contentType,
|
|
58
|
+
});
|
|
51
59
|
return {
|
|
52
60
|
status: 200,
|
|
53
61
|
data: { path: input.path, size: result.size, content_type: contentType },
|
package/build/api/topics.d.ts
CHANGED
|
@@ -20,3 +20,8 @@ export declare function updateTopic(input: {
|
|
|
20
20
|
export declare function deleteTopic(input: {
|
|
21
21
|
topic: string;
|
|
22
22
|
}): Promise<LTApiResult>;
|
|
23
|
+
export declare function publishTopic(input: {
|
|
24
|
+
topic: string;
|
|
25
|
+
data: Record<string, any>;
|
|
26
|
+
source?: string;
|
|
27
|
+
}): Promise<LTApiResult>;
|
package/build/api/topics.js
CHANGED
|
@@ -38,7 +38,9 @@ exports.getTopic = getTopic;
|
|
|
38
38
|
exports.createTopic = createTopic;
|
|
39
39
|
exports.updateTopic = updateTopic;
|
|
40
40
|
exports.deleteTopic = deleteTopic;
|
|
41
|
+
exports.publishTopic = publishTopic;
|
|
41
42
|
const topicService = __importStar(require("../services/topics"));
|
|
43
|
+
const events_1 = require("../lib/events");
|
|
42
44
|
async function listTopics(input) {
|
|
43
45
|
try {
|
|
44
46
|
const result = await topicService.listTopics(input);
|
|
@@ -102,3 +104,21 @@ async function deleteTopic(input) {
|
|
|
102
104
|
return { status: 500, error: err.message };
|
|
103
105
|
}
|
|
104
106
|
}
|
|
107
|
+
async function publishTopic(input) {
|
|
108
|
+
try {
|
|
109
|
+
const event = {
|
|
110
|
+
type: input.topic,
|
|
111
|
+
source: input.source || 'dashboard',
|
|
112
|
+
workflowId: '',
|
|
113
|
+
workflowName: '',
|
|
114
|
+
taskQueue: '',
|
|
115
|
+
data: input.data,
|
|
116
|
+
timestamp: new Date().toISOString(),
|
|
117
|
+
};
|
|
118
|
+
await events_1.eventRegistry.publish(event);
|
|
119
|
+
return { status: 200, data: { published: true, topic: input.topic, timestamp: event.timestamp } };
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
return { status: 500, error: err.message };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -68,11 +68,14 @@ class LTEventRegistry {
|
|
|
68
68
|
* delivery implements `setCallbackBridge` on the LTEventAdapter interface.
|
|
69
69
|
*/
|
|
70
70
|
bridgeCallbackAdapter(callbackAdapter) {
|
|
71
|
+
let bridged = 0;
|
|
71
72
|
for (const adapter of this.adapters) {
|
|
72
73
|
if (adapter !== callbackAdapter && typeof adapter.setCallbackBridge === 'function') {
|
|
73
74
|
adapter.setCallbackBridge(callbackAdapter);
|
|
75
|
+
bridged++;
|
|
74
76
|
}
|
|
75
77
|
}
|
|
78
|
+
logger_1.loggerRegistry.info(`[lt-events] callback bridge wired to ${bridged} transport adapter(s)`);
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
/** Singleton event registry */
|
package/build/lib/events/nats.js
CHANGED
|
@@ -61,6 +61,7 @@ class NatsEventAdapter {
|
|
|
61
61
|
// Skip events that originated from this container
|
|
62
62
|
if (event._originId === this.originId)
|
|
63
63
|
continue;
|
|
64
|
+
logger_1.loggerRegistry.info(`[lt-events:nats] bridge received: ${event.type} from ${event._originId?.slice(0, 8)}`);
|
|
64
65
|
adapter.publish(event);
|
|
65
66
|
}
|
|
66
67
|
catch {
|
|
@@ -76,6 +77,7 @@ class NatsEventAdapter {
|
|
|
76
77
|
const subject = `${this.subjectPrefix}.${event.type}`;
|
|
77
78
|
const enriched = { ...event, _originId: this.originId };
|
|
78
79
|
this.nc.publish(subject, sc.encode(JSON.stringify(enriched)));
|
|
80
|
+
logger_1.loggerRegistry.info(`[lt-events:nats] published: ${subject} (origin=${this.originId.slice(0, 8)})`);
|
|
79
81
|
}
|
|
80
82
|
async disconnect() {
|
|
81
83
|
if (this.sub) {
|
package/build/routes/topics.js
CHANGED
|
@@ -87,4 +87,16 @@ router.delete('/by-name/:topic', async (req, res) => {
|
|
|
87
87
|
const result = await api.deleteTopic({ topic: decodeURIComponent(req.params.topic) });
|
|
88
88
|
res.status(result.status).json(result.data ?? { error: result.error });
|
|
89
89
|
});
|
|
90
|
+
/**
|
|
91
|
+
* POST /api/topics/by-name/:topic/publish
|
|
92
|
+
* Publish a test event to the event bus with the given topic and payload.
|
|
93
|
+
*/
|
|
94
|
+
router.post('/by-name/:topic/publish', async (req, res) => {
|
|
95
|
+
const result = await api.publishTopic({
|
|
96
|
+
topic: decodeURIComponent(req.params.topic),
|
|
97
|
+
data: req.body.data ?? {},
|
|
98
|
+
source: req.body.source ?? 'dashboard',
|
|
99
|
+
});
|
|
100
|
+
res.status(result.status).json(result.data ?? { error: result.error });
|
|
101
|
+
});
|
|
90
102
|
exports.default = router;
|
|
@@ -115,6 +115,13 @@ async function updateAgent(id, data) {
|
|
|
115
115
|
if (updated && (data.status || data.behaviors)) {
|
|
116
116
|
Promise.resolve().then(() => __importStar(require('./trigger-registry'))).then(({ agentTriggerRegistry }) => agentTriggerRegistry.restartAgent(id)).catch(() => { });
|
|
117
117
|
Promise.resolve().then(() => __importStar(require('../cron'))).then(({ cronRegistry }) => cronRegistry.restartAgentCrons(updated)).catch(() => { });
|
|
118
|
+
// Signal other containers to re-arm triggers for this agent
|
|
119
|
+
(0, publish_1.publishAgentEvent)({
|
|
120
|
+
type: 'agent.triggers_changed',
|
|
121
|
+
agentId: id,
|
|
122
|
+
agentName: id,
|
|
123
|
+
data: { action: 'updated' },
|
|
124
|
+
});
|
|
118
125
|
}
|
|
119
126
|
return updated;
|
|
120
127
|
}
|
|
@@ -122,6 +129,13 @@ async function deleteAgent(id) {
|
|
|
122
129
|
// Stop event triggers and cron schedules before deleting
|
|
123
130
|
Promise.resolve().then(() => __importStar(require('./trigger-registry'))).then(({ agentTriggerRegistry }) => agentTriggerRegistry.stopAgent(id)).catch(() => { });
|
|
124
131
|
Promise.resolve().then(() => __importStar(require('../cron'))).then(({ cronRegistry }) => cronRegistry.stopAgentCrons(id)).catch(() => { });
|
|
132
|
+
// Signal other containers to stop triggers for this agent
|
|
133
|
+
(0, publish_1.publishAgentEvent)({
|
|
134
|
+
type: 'agent.triggers_changed',
|
|
135
|
+
agentId: id,
|
|
136
|
+
agentName: id,
|
|
137
|
+
data: { action: 'deleted' },
|
|
138
|
+
});
|
|
125
139
|
const pool = (0, db_1.getPool)();
|
|
126
140
|
const { rowCount } = await pool.query(sql_1.DELETE_AGENT, [id]);
|
|
127
141
|
return (rowCount ?? 0) > 0;
|
|
@@ -12,6 +12,8 @@ declare class AgentTriggerRegistry {
|
|
|
12
12
|
private connected;
|
|
13
13
|
/**
|
|
14
14
|
* Load all active subscriptions from DB and arm event listeners.
|
|
15
|
+
* Also subscribes to `agent.triggers_changed` so other containers
|
|
16
|
+
* can signal this one to re-arm after subscription CRUD.
|
|
15
17
|
*/
|
|
16
18
|
connect(adapter: CallbackEventAdapter): Promise<void>;
|
|
17
19
|
/**
|
|
@@ -32,6 +34,15 @@ declare class AgentTriggerRegistry {
|
|
|
32
34
|
* Shallow key-value match: every key in filter must match the corresponding
|
|
33
35
|
* key in event.data. Missing keys in event.data fail the match.
|
|
34
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* Match event.data against a filter object.
|
|
39
|
+
*
|
|
40
|
+
* Supports:
|
|
41
|
+
* - Equality: { "extension": "png" }
|
|
42
|
+
* - Negation: { "extension": { "$ne": "png" } }
|
|
43
|
+
* - In-list: { "extension": { "$in": ["png", "jpg"] } }
|
|
44
|
+
* - Exists: { "trace_id": { "$exists": true } }
|
|
45
|
+
*/
|
|
35
46
|
private matchesFilter;
|
|
36
47
|
/**
|
|
37
48
|
* Deterministic workflow ID derived from the subscription + event.
|
|
@@ -55,13 +55,32 @@ class AgentTriggerRegistry {
|
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Load all active subscriptions from DB and arm event listeners.
|
|
58
|
+
* Also subscribes to `agent.triggers_changed` so other containers
|
|
59
|
+
* can signal this one to re-arm after subscription CRUD.
|
|
58
60
|
*/
|
|
59
61
|
async connect(adapter) {
|
|
60
62
|
this.adapter = adapter;
|
|
61
63
|
const subs = await (0, subscriptions_1.listActiveSubscriptions)();
|
|
62
64
|
for (const sub of subs) {
|
|
65
|
+
logger_1.loggerRegistry.info(`[long-tail] arming trigger: ${sub.agent_name}/${sub.topic} → ${sub.reaction_type}:${sub.tool_name || sub.workflow_type || sub.mcp_prompt?.slice(0, 20) || '?'}`);
|
|
63
66
|
this.armSubscription(sub);
|
|
64
67
|
}
|
|
68
|
+
// Listen for cross-container trigger sync signals
|
|
69
|
+
adapter.on('agent.triggers_changed', (event) => {
|
|
70
|
+
const agentId = event.data?.agentId;
|
|
71
|
+
const action = event.data?.action;
|
|
72
|
+
if (!agentId)
|
|
73
|
+
return;
|
|
74
|
+
if (action === 'deleted') {
|
|
75
|
+
this.stopAgent(agentId);
|
|
76
|
+
logger_1.loggerRegistry.info(`[long-tail] agent triggers stopped (remote): ${agentId}`);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.restartAgent(agentId).then(() => {
|
|
80
|
+
logger_1.loggerRegistry.info(`[long-tail] agent triggers synced (remote): ${agentId}`);
|
|
81
|
+
}).catch(() => { });
|
|
82
|
+
}
|
|
83
|
+
});
|
|
65
84
|
this.connected = true;
|
|
66
85
|
logger_1.loggerRegistry.info(`[long-tail] agent trigger registry: ${subs.length} subscription(s) armed`);
|
|
67
86
|
}
|
|
@@ -123,8 +142,10 @@ class AgentTriggerRegistry {
|
|
|
123
142
|
buildHandler(sub) {
|
|
124
143
|
return async (event) => {
|
|
125
144
|
try {
|
|
145
|
+
logger_1.loggerRegistry.info(`[long-tail] trigger matched: ${sub.agent_name}/${sub.topic} for event ${event.type}`);
|
|
126
146
|
// 1. Evaluate optional filter
|
|
127
147
|
if (sub.filter && !this.matchesFilter(event, sub.filter)) {
|
|
148
|
+
logger_1.loggerRegistry.info(`[long-tail] trigger filtered out: ${sub.agent_name}/${sub.topic}`);
|
|
128
149
|
return;
|
|
129
150
|
}
|
|
130
151
|
// 2. Derive deterministic workflow ID for distributed dedup
|
|
@@ -154,14 +175,22 @@ class AgentTriggerRegistry {
|
|
|
154
175
|
}).catch(() => { }); // best-effort
|
|
155
176
|
}
|
|
156
177
|
catch (err) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
178
|
+
// Duplicate job errors are expected in multi-container — another
|
|
179
|
+
// container won the race. Log as info and continue.
|
|
180
|
+
const isDuplicate = err.message?.includes('already exists');
|
|
181
|
+
if (isDuplicate) {
|
|
182
|
+
logger_1.loggerRegistry.info(`[long-tail] agent trigger dedup (another container handled): ${sub.agent_name}/${sub.topic}`);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
(0, publish_1.publishAgentEvent)({
|
|
186
|
+
type: 'agent.failed',
|
|
187
|
+
agentId: sub.agent_id,
|
|
188
|
+
agentName: sub.agent_name,
|
|
189
|
+
status: 'error',
|
|
190
|
+
data: { topic: sub.topic, error: err.message },
|
|
191
|
+
});
|
|
192
|
+
logger_1.loggerRegistry.warn(`[long-tail] agent trigger failed: ${sub.agent_name}/${sub.topic}: ${err.message}`);
|
|
193
|
+
}
|
|
165
194
|
}
|
|
166
195
|
};
|
|
167
196
|
}
|
|
@@ -169,11 +198,34 @@ class AgentTriggerRegistry {
|
|
|
169
198
|
* Shallow key-value match: every key in filter must match the corresponding
|
|
170
199
|
* key in event.data. Missing keys in event.data fail the match.
|
|
171
200
|
*/
|
|
201
|
+
/**
|
|
202
|
+
* Match event.data against a filter object.
|
|
203
|
+
*
|
|
204
|
+
* Supports:
|
|
205
|
+
* - Equality: { "extension": "png" }
|
|
206
|
+
* - Negation: { "extension": { "$ne": "png" } }
|
|
207
|
+
* - In-list: { "extension": { "$in": ["png", "jpg"] } }
|
|
208
|
+
* - Exists: { "trace_id": { "$exists": true } }
|
|
209
|
+
*/
|
|
172
210
|
matchesFilter(event, filter) {
|
|
173
211
|
const data = event.data ?? {};
|
|
174
212
|
for (const [key, expected] of Object.entries(filter)) {
|
|
175
|
-
|
|
176
|
-
|
|
213
|
+
const actual = data[key];
|
|
214
|
+
if (expected && typeof expected === 'object' && !Array.isArray(expected)) {
|
|
215
|
+
if ('$ne' in expected && actual === expected.$ne)
|
|
216
|
+
return false;
|
|
217
|
+
if ('$in' in expected && !expected.$in.includes(actual))
|
|
218
|
+
return false;
|
|
219
|
+
if ('$exists' in expected) {
|
|
220
|
+
const exists = actual !== undefined && actual !== null;
|
|
221
|
+
if (expected.$exists !== exists)
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
if (actual !== expected)
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
177
229
|
}
|
|
178
230
|
return true;
|
|
179
231
|
}
|
package/build/start/workers.js
CHANGED
|
@@ -313,6 +313,9 @@ async function startWorkers(startConfig, workers, builtinMcpServerFactories) {
|
|
|
313
313
|
logger_1.loggerRegistry.warn(`[long-tail] agent cron schedules: ${err.message}`);
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
+
else {
|
|
317
|
+
logger_1.loggerRegistry.info('[long-tail] readonly mode — agent triggers and crons skipped');
|
|
318
|
+
}
|
|
316
319
|
// Ensure system bot account exists for cron/system-initiated workflows
|
|
317
320
|
const { ensureSystemBot } = await Promise.resolve().then(() => __importStar(require('../services/iam/bots')));
|
|
318
321
|
await ensureSystemBot().catch((err) => logger_1.loggerRegistry.warn(`[long-tail] system bot seed error: ${err.message}`));
|
package/build/types/events.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { LTMilestone } from './task';
|
|
|
6
6
|
*
|
|
7
7
|
* Dashboard subscribes to `lt.events.>` to receive all events.
|
|
8
8
|
*/
|
|
9
|
-
export type LTEventType = 'task.created' | 'task.started' | 'task.completed' | 'task.escalated' | 'task.failed' | 'escalation.created' | 'escalation.resolved' | 'escalation.claimed' | 'escalation.released' | 'workflow.started' | 'workflow.completed' | 'workflow.failed' | 'activity.started' | 'activity.completed' | 'activity.failed' | 'knowledge.stored' | 'knowledge.deleted' | 'file.stored' | 'file.deleted' | 'agent.started' | 'agent.completed' | 'agent.failed' | 'agent.status_changed' | 'milestone';
|
|
9
|
+
export type LTEventType = 'task.created' | 'task.started' | 'task.completed' | 'task.escalated' | 'task.failed' | 'escalation.created' | 'escalation.resolved' | 'escalation.claimed' | 'escalation.released' | 'workflow.started' | 'workflow.completed' | 'workflow.failed' | 'activity.started' | 'activity.completed' | 'activity.failed' | 'knowledge.stored' | 'knowledge.deleted' | 'file.stored' | 'file.deleted' | 'agent.started' | 'agent.completed' | 'agent.failed' | 'agent.status_changed' | 'agent.triggers_changed' | 'milestone';
|
|
10
10
|
/**
|
|
11
11
|
* Application-defined event type.
|
|
12
12
|
* Convention: `app.{namespace}.{entity}.{action}`
|
|
@@ -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-CI3qsHdP.js";import{r as m}from"./index-B7Vxutyl.js";import{f as c}from"./useEventHooks-DpvfSw9p.js";import{u}from"./mcp-J_cDlKuA.js";import{P as d}from"./PageHeaderWithStats-DQmNXYcG.js";import"./vendor-react-CX88sFS5.js";import"./vendor-icons-5gSix3t2.js";function j(){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{j as AdminDashboard};
|
|
2
|
+
//# sourceMappingURL=AdminDashboard-qZYNzvw8.js.map
|
package/dashboard/dist/assets/{AdminDashboard-DISq0Tz8.js.map → AdminDashboard-qZYNzvw8.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminDashboard-
|
|
1
|
+
{"version":3,"file":"AdminDashboard-qZYNzvw8.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 f}from"./vendor-query-B2UbickB.js";import{a as re,d as le,b as oe}from"./agents-Ce3HmPz4.js";import{C as ce,u as de,a as pe,b as xe,c as ue}from"./CronLabel-CPEjE-mH.js";import{d as me,u as he}from"./index-DZX-E_3q.js";import{P as fe}from"./PageHeader-B_gV_jKk.js";import{B as I,d as B,b as ve,R as U,Y as L,n as X,a4 as G,a as Z,aF as ee,K as be}from"./vendor-icons-B_Yla7iD.js";import{e as je}from"./knowledge-D01NdF5h.js";import{R as te}from"./RunAsSelector-_QbJKhlo.js";import{u as ge}from"./workflows-Do-Eiv8f.js";import{u as ye}from"./yaml-workflows-DolGRQ5f.js";import{u as se}from"./capabilities-t-w5N9K9.js";import{u as we}from"./topics-BMG5tx2g.js";import{E as Ne}from"./EventTopicPill-xJJnxvlP.js";import{W as V}from"./WorkflowPill-Bg2-0Hkg.js";import{e as _e,c as ke,f as Ce}from"./vendor-react-CX88sFS5.js";import"./BotPicker-DuAZgHbJ.js";import"./bots-B0BomNnf.js";const Q={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 o,p,u;const l=(p=(o=s.behaviors)==null?void 0:o.schedules)!=null&&p.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:l}}function Pe(s){var l;const a={};return s.schedules.length>0&&(a.schedules=s.schedules.map(o=>({cron:o.cron,reaction_type:o.reaction_type||"durable",workflow_type:o.reaction_type==="pipeline"?void 0:o.workflow_type,pipeline_id:o.reaction_type==="pipeline"?o.pipeline_id:void 0,envelope:Y(o.envelope)??{},execute_as:o.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:((l=s.schedules[0])==null?void 0:l.workflow_type)||void 0,pipeline_id:void 0}}function Ie(s){return s.subscriptions.map(a=>({id:a.id,topic:a.topic,filter:a.filter?Y(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:Y(a.input_mapping)??{},execute_as:a.execute_as||void 0,enabled:a.enabled}))}function Y(s){if(s.trim())try{return JSON.parse(s)}catch{return}}const S="section-header mt-[3em] first:mt-0",W="label",_="hint",R="input",M="input-json w-full";function Ee({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(I,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:W,children:"Name *"}),e.jsx("input",{type:"text",value:s.name,onChange:l=>a("name",l.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:W,children:"Description"}),e.jsx("input",{type:"text",value:s.description,onChange:l=>a("description",l.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 We({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(I,{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:W,children:"Goals"}),e.jsx("textarea",{value:s.goals,onChange:l=>a("goals",l.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:W,children:"Rules"}),e.jsx("textarea",{value:s.rules,onChange:l=>a("rules",l.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 $e({form:s,set:a}){const{data:l}=je(),o=(l==null?void 0:l.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(I,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:W,children:"Knowledge Domain"}),e.jsx("input",{type:"text",value:s.knowledge_domain,onChange:p=>a("knowledge_domain",p.target.value),placeholder:"e.g., system-health, content-review, vendor-data",className:R,list:"domain-suggestions"}),e.jsx("datalist",{id:"domain-suggestions",children:o.map(p=>e.jsx("option",{value:p.domain},p.domain))}),e.jsx("p",{className:_,children:"Choose an existing domain to share memory, or type a new name to create one."})]}),o.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:W,children:"Existing Domains"}),e.jsx("div",{className:"space-y-0.5 mt-2",children:o.map(p=>e.jsxs("button",{type:"button",onClick:()=>a("knowledge_domain",p.domain),className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${s.knowledge_domain===p.domain?"border-l-2 border-l-accent bg-accent/5":"hover:bg-surface-hover border-l-2 border-l-transparent"}`,children:[e.jsx(B,{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:p.domain}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[p.count," entries"]}),e.jsx("span",{className:"text-[9px] text-text-quaternary",children:e.jsx(me,{date:p.latest})})]},p.domain))})]})]})}function Ae({serverId:s,toolName:a,onChange:l}){const{data:o}=se(),p=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[o]),[u,n]=f.useState(!1),[v,d]=f.useState(""),c=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{if(!u)return;function t(i){h.current&&!h.current.contains(i.target)&&n(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[u]);const r=a?`${a}`:"",x=u?v:r,w=f.useMemo(()=>{const t=(u?v:"").toLowerCase();return t?p.filter(i=>i.name.toLowerCase().includes(t)||i.serverName.toLowerCase().includes(t)||(i.description??"").toLowerCase().includes(t)):p},[p,v,u]),m=a?p.find(t=>t.serverId===s&&t.name===a):void 0;return e.jsxs("div",{ref:h,className:"relative",children:[e.jsx("input",{ref:c,type:"text",value:x,onFocus:()=>{n(!0),d(r)},onChange:t=>{const i=t.target.value;d(i),i||l("",""),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&&w.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:w.map(t=>e.jsxs("button",{type:"button",onClick:()=>{l(t.serverId,t.name),d(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(ve,{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&&w.length===0&&v&&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 "',v,'"']})})]})}const Oe={durable:"Workflow",pipeline:"Pipeline",capability:"Capability",mcp_query:"MCP Query"},Te=["durable","pipeline","capability","mcp_query"];function ae({reactionType:s,onReactionTypeChange:a,workflowType:l,onWorkflowTypeChange:o,pipelineId:p,onPipelineIdChange:u,serverId:n,toolName:v,onCapabilityChange:d,mcpPrompt:c,onMcpPromptChange:h,availableTypes:r=[...Te]}){const{data:x}=ge(),w=(x??[]).filter(i=>i.invocable).map(i=>i.workflow_type),{data:m}=ye({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:r.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:Oe[i]},i)})}),s==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Workflow *"}),e.jsxs("select",{value:l,onChange:i=>o(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select workflow..."}),w.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:p,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(Ae,{serverId:n,toolName:v,onChange:d})]}),s==="mcp_query"&&h&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Prompt *"}),e.jsx("textarea",{value:c??"",onChange:i=>h(i.target.value),placeholder:"Analyze the error and suggest remediation...",rows:3,className:"input resize-none"})]})]})}const Le={task:"bg-blue-400/15 text-blue-400",workflow:"bg-accent/15 text-accent",escalation:"bg-amber-400/15 text-amber-400",activity:"bg-cyan-400/15 text-cyan-400",knowledge:"bg-violet-400/15 text-violet-400",file:"bg-orange-400/15 text-orange-400",agent:"bg-emerald-400/15 text-emerald-400",app:"bg-rose-400/15 text-rose-400",milestone:"bg-violet-400/15 text-violet-400"};function Me({form:s,set:a}){const{data:l}=we({limit:200}),{data:o}=se(),p=(l==null?void 0:l.topics)??[],u=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[o]),[n,v]=f.useState(0),d=(t,i,b)=>{const j=[...s.subscriptions];j[t]={...j[t],[i]:b},a("subscriptions",j)},c=()=>{a("subscriptions",[...s.subscriptions,{...Se}]),v(s.subscriptions.length)},h=t=>{a("subscriptions",s.subscriptions.filter((i,b)=>b!==t)),n>=s.subscriptions.length-1&&v(Math.max(0,s.subscriptions.length-2))},r=s.subscriptions,x=r[n],w=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=x?p.find(t=>t.topic===x.topic):void 0;return r.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(I,{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(U,{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:c,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(L,{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(I,{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:[r.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:()=>v(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 shrink-0 ${w(t)?"bg-emerald-400":"bg-zinc-500"}`}),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 f}from"./vendor-query-B2UbickB.js";import{a as re,d as le,b as oe}from"./agents-CpLOugsY.js";import{C as ce,u as de,a as pe,b as xe,c as ue}from"./CronLabel-Dg8U0s5a.js";import{d as me,u as he}from"./index-B7Vxutyl.js";import{P as fe}from"./PageHeader-B4w-LDUF.js";import{B as P,d as G,b as ve,R as U,l as L,p as X,a5 as Y,a as Z,aG as ee,Q as be}from"./vendor-icons-5gSix3t2.js";import{e as je}from"./knowledge-CQWNz28-.js";import{R as te}from"./RunAsSelector-CcNnj5AF.js";import{u as ye}from"./workflows-dhvM792w.js";import{u as ge}from"./yaml-workflows-DqbGpE2x.js";import{u as se}from"./capabilities-xbHvOXKc.js";import{u as we}from"./topics-lm2GYKuv.js";import{E as Ne}from"./EventTopicPill-RaASGdZz.js";import{W as V}from"./WorkflowPill-BkfIn8N3.js";import{e as _e,c as ke,f as Ce}from"./vendor-react-CX88sFS5.js";import"./BotPicker-638n5Jaz.js";import"./bots-DRrquJqC.js";const Q={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 o,p,u;const l=(p=(o=s.behaviors)==null?void 0:o.schedules)!=null&&p.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:l}}function $e(s){var l;const a={};return s.schedules.length>0&&(a.schedules=s.schedules.map(o=>({cron:o.cron,reaction_type:o.reaction_type||"durable",workflow_type:o.reaction_type==="pipeline"?void 0:o.workflow_type,pipeline_id:o.reaction_type==="pipeline"?o.pipeline_id:void 0,envelope:B(o.envelope)??{},execute_as:o.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:((l=s.schedules[0])==null?void 0:l.workflow_type)||void 0,pipeline_id:void 0}}function Pe(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}}const S="section-header mt-[3em] first:mt-0",E="label",_="hint",R="input",M="input-json w-full";function Ie({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(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,children:"Name *"}),e.jsx("input",{type:"text",value:s.name,onChange:l=>a("name",l.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:E,children:"Description"}),e.jsx("input",{type:"text",value:s.description,onChange:l=>a("description",l.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 Ee({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(P,{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:E,children:"Goals"}),e.jsx("textarea",{value:s.goals,onChange:l=>a("goals",l.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:E,children:"Rules"}),e.jsx("textarea",{value:s.rules,onChange:l=>a("rules",l.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 Oe({form:s,set:a}){const{data:l}=je(),o=(l==null?void 0:l.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(P,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,children:"Knowledge Domain"}),e.jsx("input",{type:"text",value:s.knowledge_domain,onChange:p=>a("knowledge_domain",p.target.value),placeholder:"e.g., system-health, content-review, vendor-data",className:R,list:"domain-suggestions"}),e.jsx("datalist",{id:"domain-suggestions",children:o.map(p=>e.jsx("option",{value:p.domain},p.domain))}),e.jsx("p",{className:_,children:"Choose an existing domain to share memory, or type a new name to create one."})]}),o.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:E,children:"Existing Domains"}),e.jsx("div",{className:"space-y-0.5 mt-2",children:o.map(p=>e.jsxs("button",{type:"button",onClick:()=>a("knowledge_domain",p.domain),className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${s.knowledge_domain===p.domain?"border-l-2 border-l-accent bg-accent/5":"hover:bg-surface-hover border-l-2 border-l-transparent"}`,children:[e.jsx(G,{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:p.domain}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[p.count," entries"]}),e.jsx("span",{className:"text-[9px] text-text-quaternary",children:e.jsx(me,{date:p.latest})})]},p.domain))})]})]})}function We({serverId:s,toolName:a,onChange:l}){const{data:o}=se(),p=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[o]),[u,n]=f.useState(!1),[v,d]=f.useState(""),c=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{if(!u)return;function t(i){h.current&&!h.current.contains(i.target)&&n(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[u]);const r=a?`${a}`:"",x=u?v:r,w=f.useMemo(()=>{const t=(u?v:"").toLowerCase();return t?p.filter(i=>i.name.toLowerCase().includes(t)||i.serverName.toLowerCase().includes(t)||(i.description??"").toLowerCase().includes(t)):p},[p,v,u]),m=a?p.find(t=>t.serverId===s&&t.name===a):void 0;return e.jsxs("div",{ref:h,className:"relative",children:[e.jsx("input",{ref:c,type:"text",value:x,onFocus:()=>{n(!0),d(r)},onChange:t=>{const i=t.target.value;d(i),i||l("",""),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&&w.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:w.map(t=>e.jsxs("button",{type:"button",onClick:()=>{l(t.serverId,t.name),d(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(ve,{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&&w.length===0&&v&&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 "',v,'"']})})]})}const Ae={durable:"Workflow",pipeline:"Pipeline",capability:"Capability",mcp_query:"MCP Query"},Te=["durable","pipeline","capability","mcp_query"];function ae({reactionType:s,onReactionTypeChange:a,workflowType:l,onWorkflowTypeChange:o,pipelineId:p,onPipelineIdChange:u,serverId:n,toolName:v,onCapabilityChange:d,mcpPrompt:c,onMcpPromptChange:h,availableTypes:r=[...Te]}){const{data:x}=ye(),w=(x??[]).filter(i=>i.invocable).map(i=>i.workflow_type),{data:m}=ge({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:r.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:Ae[i]},i)})}),s==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Workflow *"}),e.jsxs("select",{value:l,onChange:i=>o(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select workflow..."}),w.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:p,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:v,onChange:d})]}),s==="mcp_query"&&h&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Prompt *"}),e.jsx("textarea",{value:c??"",onChange:i=>h(i.target.value),placeholder:"Analyze the error and suggest remediation...",rows:3,className:"input resize-none"})]})]})}const Le={task:"bg-blue-400/15 text-blue-400",workflow:"bg-accent/15 text-accent",escalation:"bg-amber-400/15 text-amber-400",activity:"bg-cyan-400/15 text-cyan-400",knowledge:"bg-violet-400/15 text-violet-400",file:"bg-orange-400/15 text-orange-400",agent:"bg-emerald-400/15 text-emerald-400",app:"bg-rose-400/15 text-rose-400",milestone:"bg-violet-400/15 text-violet-400"};function Me({form:s,set:a}){const{data:l}=we({limit:200}),{data:o}=se(),p=(l==null?void 0:l.topics)??[],u=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[o]),[n,v]=f.useState(0),d=(t,i,b)=>{const j=[...s.subscriptions];j[t]={...j[t],[i]:b},a("subscriptions",j)},c=()=>{a("subscriptions",[...s.subscriptions,{...Se}]),v(s.subscriptions.length)},h=t=>{a("subscriptions",s.subscriptions.filter((i,b)=>b!==t)),n>=s.subscriptions.length-1&&v(Math.max(0,s.subscriptions.length-2))},r=s.subscriptions,x=r[n],w=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=x?p.find(t=>t.topic===x.topic):void 0;return r.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(P,{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(U,{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:c,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(L,{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(P,{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:[r.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:()=>v(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 shrink-0 ${w(t)?"bg-emerald-400":"bg-zinc-500"}`}),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.`)&&h(i)},className:"opacity-0 group-hover/sub:opacity-100 px-2 text-text-quaternary hover:text-red-400 transition-all",title:"Remove",children:e.jsx(X,{className:"w-3 h-3"})})]},i)),e.jsxs("button",{onClick:c,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(L,{className:"w-3 h-3"})," Add"]})]}),x&&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(Je,{value:x.topic,onChange:t=>d(n,"topic",t),topics:p}),(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:x.reaction_type,onReactionTypeChange:t=>d(n,"reaction_type",t),workflowType:x.workflow_type,onWorkflowTypeChange:t=>d(n,"workflow_type",t),pipelineId:x.pipeline_id,onPipelineIdChange:t=>d(n,"pipeline_id",t),serverId:x.server_id,toolName:x.tool_name,onCapabilityChange:(t,i)=>{var
|
|
3
|
+
This takes effect when you save.`)&&h(i)},className:"opacity-0 group-hover/sub:opacity-100 px-2 text-text-quaternary hover:text-red-400 transition-all",title:"Remove",children:e.jsx(X,{className:"w-3 h-3"})})]},i)),e.jsxs("button",{onClick:c,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(L,{className:"w-3 h-3"})," Add"]})]}),x&&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(Je,{value:x.topic,onChange:t=>d(n,"topic",t),topics:p}),(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:x.reaction_type,onReactionTypeChange:t=>d(n,"reaction_type",t),workflowType:x.workflow_type,onWorkflowTypeChange:t=>d(n,"workflow_type",t),pipelineId:x.pipeline_id,onPipelineIdChange:t=>d(n,"pipeline_id",t),serverId:x.server_id,toolName:x.tool_name,onCapabilityChange:(t,i)=>{var $;const b=[...s.subscriptions],j={...b[n],server_id:t,tool_name:i},k=u.find(g=>g.serverId===t&&g.name===i),I=($=k==null?void 0:k.inputSchema)==null?void 0:$.properties;if(I&&i){const g={};for(const O of Object.keys(I))O.startsWith("_")||(g[O]=`{event.data.${O}}`);j.input_mapping=JSON.stringify(g,null,2)}b[n]=j,a("subscriptions",b)},mcpPrompt:x.mcp_prompt,onMcpPromptChange:t=>d(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:x.execute_as,onChange:t=>d(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:x.filter,onChange:t=>d(n,"filter",t.target.value),placeholder:'{"extension": "png"}',className:`${R} font-mono text-xs`}),e.jsxs("p",{className:_,children:["JSON filter against event.data. Operators: equality ",e.jsx("code",{className:"text-accent",children:'{"key":"val"}'}),", negation ",e.jsx("code",{className:"text-accent",children:'{"key":{"$ne":"val"}}'}),", in-list ",e.jsx("code",{className:"text-accent",children:'{"key":{"$in":["a","b"]}}'}),", exists ",e.jsx("code",{className:"text-accent",children:'{"key":{"$exists":true}}'})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"With this data"}),x.reaction_type==="capability"&&x.tool_name?e.jsx(Fe,{tool:u.find(t=>t.serverId===x.server_id&&t.name===x.tool_name),value:x.input_mapping,onChange:t=>d(n,"input_mapping",t),eventSchema:m==null?void 0:m.payload_schema}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{value:x.input_mapping,onChange:t=>d(n,"input_mapping",t.target.value),rows:10,className:M,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.`)&&h(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:l,eventSchema:o}){var w,m;const[p,u]=f.useState(!1),n=((w=s==null?void 0:s.inputSchema)==null?void 0:w.properties)??{},v=((m=s==null?void 0:s.inputSchema)==null?void 0:m.required)??[],d=Object.entries(n).filter(([t])=>!t.startsWith("_")),c=f.useMemo(()=>[...d].sort(([t],[i])=>{const b=v.indexOf(t),j=v.indexOf(i);return b!==-1&&j!==-1?b-j:b!==-1?-1:j!==-1?1:t.localeCompare(i)}),[d,v]),h=f.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=o==null?void 0:o.properties;if(i)for(const[b,j]of Object.entries(i))t.push({value:`{event.data.${b}}`,label:j.description||b});return t},[o]),r=f.useMemo(()=>{try{return JSON.parse(a)}catch{return{}}},[a]),x=(t,i)=>{const b={...r,[t]:i};l(JSON.stringify(b,null,2))};return c.length===0||p?e.jsxs("div",{children:[c.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=>l(t.target.value),rows:8,className:M,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:c.map(([t,i])=>{const b=v.includes(t),j=i.description,k=i.type,
|
|
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:c.map(([t,i])=>{const b=v.includes(t),j=i.description,k=i.type,I=typeof r[t]=="string"?r[t]:typeof r[t]=="object"?JSON.stringify(r[t]):r[t]!=null?String(r[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})]}),j&&e.jsx("p",{className:"text-[10px] text-text-quaternary mb-2",children:j}),e.jsx(De,{value:I,onChange:$=>x(t,$),suggestions:h,fieldType:k,placeholder:`{event.data.${t}}`})]},t)})})]})}function De({value:s,onChange:a,suggestions:l,fieldType:o,placeholder:p}){const[u,n]=f.useState(!1),[v,d]=f.useState(""),c=f.useRef(null);f.useEffect(()=>{if(!u)return;function r(x){c.current&&!c.current.contains(x.target)&&n(!1)}return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[u]);const h=l.filter(r=>r.value.toLowerCase().includes(v.toLowerCase())||r.label.toLowerCase().includes(v.toLowerCase()));return o==="object"?e.jsx("textarea",{value:s,onChange:r=>{try{a(JSON.parse(r.target.value))}catch{a(r.target.value)}},rows:3,className:`${M} text-xs`,placeholder:'{ "source": "{event.source}" }'}):e.jsxs("div",{ref:c,className:"relative",children:[e.jsx("input",{type:"text",value:s,onFocus:()=>{n(!0),d("")},onChange:r=>{a(r.target.value),d(r.target.value),u||n(!0)},className:"input font-mono text-xs w-full",placeholder:p}),u&&h.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:h.map(r=>e.jsxs("button",{type:"button",onClick:()=>{a(r.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===r.value?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-[11px] font-mono text-accent shrink-0",children:r.value}),e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:r.label})]},r.value))})]})}function Je({value:s,onChange:a,topics:l}){const[o,p]=f.useState(!1),[u,n]=f.useState(""),v=f.useRef(null),d=f.useRef(null);f.useEffect(()=>{function r(x){d.current&&!d.current.contains(x.target)&&p(!1)}return o&&document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[o]);const c=o?u:s,h=l.filter(r=>r.topic.toLowerCase().includes((o?u:"").toLowerCase())||(r.description??"").toLowerCase().includes((o?u:"").toLowerCase()));return e.jsxs("div",{ref:d,className:"relative",children:[e.jsx("input",{ref:v,type:"text",value:c,onFocus:()=>{p(!0),n(s)},onChange:r=>{const x=r.target.value;n(x),a(x),o||p(!0)},placeholder:"workflow.failed or app.>",className:`${R} font-mono`}),o&&h.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:h.map(r=>{const x=Le[r.category]??"bg-zinc-400/15 text-zinc-400";return e.jsxs("button",{type:"button",onClick:()=>{a(r.topic),n(r.topic),p(!1)},className:`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 ${s===r.topic?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-[11px] font-mono text-text-primary shrink-0",children:r.topic}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-medium shrink-0 ${x}`,children:r.category}),r.description&&e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:r.description})]},r.topic)})})]})}const ze=["*/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 Be({form:s,set:a}){const[l,o]=f.useState(0),p=(c,h,r)=>{const x=[...s.schedules];x[c]={...x[c],[h]:r},a("schedules",x)},u=()=>{a("schedules",[...s.schedules,{...qe}]),o(s.schedules.length)},n=c=>{a("schedules",s.schedules.filter((h,r)=>r!==c)),l>=s.schedules.length-1&&o(Math.max(0,s.schedules.length-2))},v=s.schedules,d=v[l];return v.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(P,{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 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(L,{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(P,{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:[v.map((c,h)=>e.jsxs("div",{className:`group/sched flex items-center rounded-md transition-colors ${l===h?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>o(h),className:"flex-1 text-left px-3 py-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] font-mono block",children:c.cron||"new schedule"}),e.jsxs("span",{className:"text-[9px] text-text-quaternary",children:[(c.reaction_type==="pipeline"?c.pipeline_id:c.workflow_type)||"no target"," · ",z(c.cron)]})]}),e.jsx("button",{onClick:r=>{r.stopPropagation(),confirm(`Remove schedule "${c.cron||"new"}"?
|
|
12
12
|
|
|
13
13
|
This takes effect when you save.`)&&n(h)},className:"opacity-0 group-hover/sched:opacity-100 px-2 text-text-quaternary hover:text-red-400 transition-all",title:"Remove",children:e.jsx(X,{className:"w-3 h-3"})})]},h)),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(L,{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:"Run every"}),e.jsx("input",{type:"text",value:d.cron,onChange:c=>p(l,"cron",c.target.value),placeholder:"0 * * * *",className:`${R} font-mono`}),d.cron&&e.jsx("p",{className:"text-[11px] text-accent/80 mt-1",children:z(d.cron)}),e.jsx("div",{className:"flex gap-3 mt-2 overflow-x-auto",children:ze.map(c=>e.jsx("button",{type:"button",onClick:()=>p(l,"cron",c),className:`text-[10px] font-mono whitespace-nowrap transition-colors ${d.cron===c?"text-accent font-medium":"text-accent/50 hover:text-accent"}`,children:z(c)},c))})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run this reaction"}),e.jsx(ae,{reactionType:d.reaction_type,onReactionTypeChange:c=>p(l,"reaction_type",c),workflowType:d.workflow_type,onWorkflowTypeChange:c=>p(l,"workflow_type",c),pipelineId:d.pipeline_id,onPipelineIdChange:c=>p(l,"pipeline_id",c),serverId:d.server_id,toolName:d.tool_name,onCapabilityChange:(c,h)=>{p(l,"server_id",c),p(l,"tool_name",h)},availableTypes:["durable","pipeline","capability"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"As identity"}),e.jsx(te,{selected:d.execute_as,onChange:c=>p(l,"execute_as",c)}),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:d.envelope,onChange:c=>p(l,"envelope",c.target.value),rows:10,className:M,placeholder:`{
|
|
14
14
|
"data": { "source": "cron" }
|
|
15
|
-
}`}),e.jsx("p",{className:_,children:"Static payload passed to the workflow on each invocation."})]})]})]})]})}function
|
|
16
|
-
//# sourceMappingURL=AgentConfigPage-
|
|
15
|
+
}`}),e.jsx("p",{className:_,children:"Static payload passed to the workflow on each invocation."})]})]})]})]})}function A({icon:s,color:a,title:l,children:o}){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:l})]}),e.jsx("div",{className:"pl-5.5",children:o})]})}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 Ge({form:s}){return e.jsxs("div",{children:[e.jsxs(A,{icon:Z,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(A,{icon:ee,color:"text-rose-400",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(A,{icon:G,color:"text-emerald-400",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(A,{icon:U,color:"text-cyan-400",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,l)=>e.jsxs("div",{className:"flex items-center py-1.5",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(Ne,{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(V,{type:a.workflow_type}):e.jsx("span",{className:"text-[11px] text-text-quaternary",children:a.reaction_type})]})]},l))})}),e.jsx(A,{icon:Y,color:"text-amber-400",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,l)=>e.jsxs("div",{className:"flex items-center py-1.5",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ce,{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(V,{type:a.workflow_type}):e.jsx("span",{className:"text-[11px] text-text-quaternary",children:"no workflow"})]})]},l))})})]}),e.jsx("div",{className:"border-l-2 border-emerald-400/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 Ue=[{id:1,label:"Identity",icon:Z},{id:2,label:"Motivation",icon:ee},{id:3,label:"Knowledge",icon:G},{id:4,label:"Subscriptions",icon:U},{id:5,label:"Schedules",icon:Y},{id:6,label:"Review",icon:be}];function dt(){var H;const{id:s}=_e(),a=!s,l=ke(),{data:o}=he(),u=!!((H=o==null?void 0:o.ai)!=null&&H.enabled)?"Agent":"Automation",{data:n,isLoading:v}=re(a?null:s),{data:d}=de(a?null:s),c=le(),h=oe(),r=pe(),x=xe(),w=ue(),[m,t]=f.useState(Q),[i,b]=f.useState(!1),[j,k]=f.useState(""),[I,$]=Ce(),g=parseInt(I.get("step")||"1",10),O=f.useCallback(y=>{$(N=>{const q=new URLSearchParams(N);return q.set("step",String(y)),q},{replace:!0})},[$]);f.useEffect(()=>{if(!i){if(a){t(Q),b(!0);return}n&&d&&(t(Re(n,d.subscriptions??[])),b(!0))}},[n,d,a,i]);const W=(y,N)=>t(q=>({...q,[y]:N})),ne=async()=>{k("");try{const y=$e(m);let N=s;a?N=(await c.mutateAsync(y)).id:await h.mutateAsync({id:s,...y});const q=Pe(m),ie=(d==null?void 0:d.subscriptions)??[],F=new Set(ie.map(C=>C.id));for(const C of q)if(C.id&&F.has(C.id)){const{id:D,...J}=C;await x.mutateAsync({agentId:N,subId:D,...J}),F.delete(D)}else{const{id:D,...J}=C;await r.mutateAsync({agentId:N,...J})}for(const C of F)await w.mutateAsync({agentId:N,subId:C});l(`/agents/${N}`)}catch(y){k(y.message)}};if(!a&&v)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=c.isPending||h.isPending;return e.jsxs("div",{children:[e.jsx(fe,{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:Ue.map(y=>{const N=y.icon,q=g===y.id;return e.jsxs("button",{onClick:()=>O(y.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:y.label})]},y.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:()=>l(a?"/agents":`/agents/${s}`),className:"w-full btn-ghost text-xs",children:"Cancel"})]}),j&&e.jsx("p",{className:"text-xs text-status-error mt-3",children:j})]}),e.jsxs("div",{className:"flex-1 min-w-0 pt-2",children:[g===1&&e.jsx(Ie,{form:m,set:W}),g===2&&e.jsx(Ee,{form:m,set:W}),g===3&&e.jsx(Oe,{form:m,set:W}),g===4&&e.jsx(Me,{form:m,set:W}),g===5&&e.jsx(Be,{form:m,set:W}),g===6&&e.jsx(Ge,{form:m})]})]})]})}export{dt as AgentConfigPage};
|
|
16
|
+
//# sourceMappingURL=AgentConfigPage-_SMbioNp.js.map
|