@hotmeshio/long-tail 0.4.17 → 0.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/build/adapters/express.js +4 -0
- package/build/api/auth-sso.d.ts +12 -0
- package/build/api/auth-sso.js +54 -0
- package/build/api/escalations/bulk.js +2 -2
- package/build/api/escalations/claim.js +3 -13
- package/build/api/escalations/create.js +3 -2
- package/build/api/escalations/helpers.d.ts +1 -0
- package/build/api/escalations/helpers.js +6 -4
- package/build/api/escalations/list.d.ts +1 -0
- package/build/api/escalations/list.js +1 -0
- package/build/api/escalations/metadata.js +4 -4
- package/build/api/escalations/single.js +3 -2
- package/build/api/settings.js +6 -1
- package/build/api/topics.d.ts +9 -0
- package/build/api/topics.js +31 -2
- package/build/lib/events/index.d.ts +1 -0
- package/build/lib/events/index.js +4 -0
- package/build/lib/events/nats.d.ts +5 -0
- package/build/lib/events/nats.js +9 -0
- package/build/lib/events/publish.d.ts +12 -9
- package/build/lib/events/publish.js +27 -17
- package/build/modules/auth.d.ts +7 -0
- package/build/modules/auth.js +104 -2
- package/build/modules/sso.d.ts +6 -0
- package/build/modules/sso.js +20 -0
- package/build/routes/auth-sso.d.ts +2 -0
- package/build/routes/auth-sso.js +51 -0
- package/build/routes/bot-accounts.js +1 -1
- package/build/routes/controlplane.js +6 -6
- package/build/routes/escalations/list.js +1 -0
- package/build/routes/index.js +2 -0
- package/build/routes/mcp-endpoint.d.ts +17 -0
- package/build/routes/mcp-endpoint.js +70 -0
- package/build/routes/nats-credentials.js +1 -1
- package/build/routes/roles.js +5 -5
- package/build/routes/topics.js +2 -0
- package/build/routes/users.js +31 -5
- package/build/sdk/index.d.ts +1 -0
- package/build/services/agent/input-mapper.js +17 -1
- package/build/services/escalation/crud.js +14 -1
- package/build/services/escalation/queries.d.ts +1 -0
- package/build/services/escalation/queries.js +7 -0
- package/build/services/mcp/exposure.d.ts +15 -0
- package/build/services/mcp/exposure.js +18 -0
- package/build/services/mcp/external-server.d.ts +15 -0
- package/build/services/mcp/external-server.js +125 -0
- package/build/services/mcp/seed-service-account.d.ts +11 -0
- package/build/services/mcp/seed-service-account.js +77 -0
- package/build/services/role/index.d.ts +1 -1
- package/build/services/role/index.js +2 -2
- package/build/services/topics/system-topics.js +29 -25
- package/build/services/user/index.d.ts +1 -1
- package/build/services/user/index.js +2 -1
- package/build/services/user/rbac.d.ts +11 -0
- package/build/services/user/rbac.js +17 -0
- package/build/services/user/sso-provision.d.ts +19 -0
- package/build/services/user/sso-provision.js +62 -0
- package/build/services/workflow-invocation.js +5 -3
- package/build/start/config.js +6 -0
- package/build/start/server.js +2 -0
- package/build/start/workers.js +15 -0
- package/build/system/index.js +53 -35
- package/build/system/mcp-servers/admin/agent-subscriptions.d.ts +5 -0
- package/build/system/mcp-servers/admin/agent-subscriptions.js +78 -0
- package/build/system/mcp-servers/admin/agents.d.ts +5 -0
- package/build/system/mcp-servers/admin/agents.js +103 -0
- package/build/system/mcp-servers/admin/bot-accounts.d.ts +5 -0
- package/build/system/mcp-servers/admin/bot-accounts.js +126 -0
- package/build/system/mcp-servers/admin/controlplane.d.ts +5 -0
- package/build/system/mcp-servers/admin/controlplane.js +107 -0
- package/build/system/mcp-servers/admin/escalations.js +88 -0
- package/build/system/mcp-servers/admin/exports.d.ts +5 -0
- package/build/system/mcp-servers/admin/exports.js +101 -0
- package/build/system/mcp-servers/admin/index.d.ts +16 -8
- package/build/system/mcp-servers/admin/index.js +36 -21
- package/build/system/mcp-servers/admin/pipelines.d.ts +5 -0
- package/build/system/mcp-servers/admin/pipelines.js +96 -0
- package/build/system/mcp-servers/admin/schemas.d.ts +614 -6
- package/build/system/mcp-servers/admin/schemas.js +239 -1
- package/build/system/mcp-servers/admin/settings.d.ts +5 -0
- package/build/system/mcp-servers/admin/settings.js +53 -0
- package/build/system/mcp-servers/admin/topics.d.ts +5 -0
- package/build/system/mcp-servers/admin/topics.js +101 -0
- package/build/system/seed/tool-manifests-admin.d.ts +5077 -188
- package/build/system/seed/tool-manifests-admin.js +79 -30
- package/build/system/seed/tool-manifests-data.d.ts +20 -0
- package/build/system/seed/tool-manifests-data.js +24 -6
- package/build/system/seed/tool-manifests-escalation.d.ts +5 -0
- package/build/system/seed/tool-manifests-escalation.js +5 -0
- package/build/system/seed/tool-manifests-events.d.ts +4 -0
- package/build/system/seed/tool-manifests-events.js +4 -0
- package/build/system/seed/tool-manifests-knowledge.d.ts +6 -0
- package/build/system/seed/tool-manifests-knowledge.js +7 -0
- package/build/system/seed/tool-manifests-workflows.d.ts +8 -0
- package/build/system/seed/tool-manifests-workflows.js +8 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/auth.d.ts +71 -0
- package/build/types/events.d.ts +17 -6
- package/build/types/index.d.ts +1 -1
- package/build/types/startup.d.ts +22 -1
- package/dashboard/dist/assets/{AdminDashboard-Cfo0mwL2.js → AdminDashboard-BwUGcCxQ.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-Cfo0mwL2.js.map → AdminDashboard-BwUGcCxQ.js.map} +1 -1
- package/dashboard/dist/assets/AgentConfigPage-DgrYzLwq.js +16 -0
- package/dashboard/dist/assets/AgentConfigPage-DgrYzLwq.js.map +1 -0
- package/dashboard/dist/assets/{AgentDetailPage-3mZA7SOb.js → AgentDetailPage-XJpl7wfJ.js} +4 -4
- package/dashboard/dist/assets/AgentDetailPage-XJpl7wfJ.js.map +1 -0
- package/dashboard/dist/assets/{AgentsPage-CTVocfBb.js → AgentsPage-CGpVG6r8.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-CTVocfBb.js.map → AgentsPage-CGpVG6r8.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-DR1e0TQZ.js +2 -0
- package/dashboard/dist/assets/{AvailableEscalationsPage-CA9x9o5s.js.map → AvailableEscalationsPage-DR1e0TQZ.js.map} +1 -1
- package/dashboard/dist/assets/BotPicker-BKtjl6IL.js +2 -0
- package/dashboard/dist/assets/{BotPicker-BQp_Vs73.js.map → BotPicker-BKtjl6IL.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-wpVtkGeU.js → CapabilitiesPage-kCB8fyOj.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-wpVtkGeU.js.map → CapabilitiesPage-kCB8fyOj.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-2eZMMZiG.js → CollapsibleSection-C3tU61hB.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-2eZMMZiG.js.map → CollapsibleSection-C3tU61hB.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-DJGLssm0.js → CredentialsPage-Dt4nJs_B.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-DJGLssm0.js.map → CredentialsPage-Dt4nJs_B.js.map} +1 -1
- package/dashboard/dist/assets/CronLabel-BdE6mHyA.js +2 -0
- package/dashboard/dist/assets/CronLabel-BdE6mHyA.js.map +1 -0
- package/dashboard/dist/assets/{CustomDurationPicker-DbyqfK35.js → CustomDurationPicker-B_Yxfb-u.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-DbyqfK35.js.map → CustomDurationPicker-B_Yxfb-u.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-BkfRoUcm.js → DropZone-CptiQ0wc.js} +2 -2
- package/dashboard/dist/assets/{DropZone-BkfRoUcm.js.map → DropZone-CptiQ0wc.js.map} +1 -1
- package/dashboard/dist/assets/ElapsedCell-tcGx5PFI.js +2 -0
- package/dashboard/dist/assets/{ElapsedCell-BPYm8RA7.js.map → ElapsedCell-tcGx5PFI.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-kYGHfnLf.js → EscalationsOverview-1KO5dXzk.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-kYGHfnLf.js.map → EscalationsOverview-1KO5dXzk.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-DSDzJMer.js → EventTable-DnpsQ6Ew.js} +2 -2
- package/dashboard/dist/assets/{EventTable-DSDzJMer.js.map → EventTable-DnpsQ6Ew.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-B2Jgo1J1.js +2 -0
- package/dashboard/dist/assets/HomePage-B2Jgo1J1.js.map +1 -0
- package/dashboard/dist/assets/ListToolbar-jrVba7QN.js +2 -0
- package/dashboard/dist/assets/{ListToolbar-DEef1_-T.js.map → ListToolbar-jrVba7QN.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-CZFW5qMb.js → McpOverview-BzyxJyc9.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-CZFW5qMb.js.map → McpOverview-BzyxJyc9.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-q9xH-QRo.js → McpQueryDetailPage-DXNseeKl.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-q9xH-QRo.js.map → McpQueryDetailPage-DXNseeKl.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-D14466yi.js → McpQueryPage-WZfTY43_.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-D14466yi.js.map → McpQueryPage-WZfTY43_.js.map} +1 -1
- package/dashboard/dist/assets/McpRunDetailPage-DKZp-p7S.js +2 -0
- package/dashboard/dist/assets/McpRunDetailPage-DKZp-p7S.js.map +1 -0
- package/dashboard/dist/assets/McpRunsPage-SXyiwc0d.js +2 -0
- package/dashboard/dist/assets/{McpRunsPage-aZg057y3.js.map → McpRunsPage-SXyiwc0d.js.map} +1 -1
- package/dashboard/dist/assets/OperatorDashboard-Cy7ySMXj.js +2 -0
- package/dashboard/dist/assets/OperatorDashboard-Cy7ySMXj.js.map +1 -0
- package/dashboard/dist/assets/{PageHeader-CR6TpJG_.js → PageHeader-BuJpMxyu.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-CR6TpJG_.js.map → PageHeader-BuJpMxyu.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-CRcQEAO1.js → PageHeaderWithStats-yD_PTbOl.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-CRcQEAO1.js.map → PageHeaderWithStats-yD_PTbOl.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-DyzNjwu8.js → ProcessDetailPage-DYIfvWyc.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-DyzNjwu8.js.map → ProcessDetailPage-DYIfvWyc.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-CT_3b5Wt.js → ProcessesListPage-DR1RGaMl.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-CT_3b5Wt.js.map → ProcessesListPage-DR1RGaMl.js.map} +1 -1
- package/dashboard/dist/assets/{RolePill-BC54Vn-U.js → RolePill-SasQKc_B.js} +2 -2
- package/dashboard/dist/assets/{RolePill-BC54Vn-U.js.map → RolePill-SasQKc_B.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-CpRJq-sg.js → RolesPage-pMERxj15.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-CpRJq-sg.js.map → RolesPage-pMERxj15.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-C20rdNsC.js → RunAsSelector-B-ksMoEj.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-C20rdNsC.js.map → RunAsSelector-B-ksMoEj.js.map} +1 -1
- package/dashboard/dist/assets/ServerName-CHspudaC.js +2 -0
- package/dashboard/dist/assets/{ServerName-Q6okiv4f.js.map → ServerName-CHspudaC.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-CbFaU4bq.js → SwimlaneTimeline-Cr_K5qpu.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-CbFaU4bq.js.map → SwimlaneTimeline-Cr_K5qpu.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-D6l1SPWd.js → TagInput-DvF3j8MA.js} +2 -2
- package/dashboard/dist/assets/{TagInput-D6l1SPWd.js.map → TagInput-DvF3j8MA.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-22cJsFmM.js → TaskDetailPage-BO5p7AEe.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-22cJsFmM.js.map → TaskDetailPage-BO5p7AEe.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-iDBVCEQQ.js → TaskQueuePill-BCQrS2oK.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-iDBVCEQQ.js.map → TaskQueuePill-BCQrS2oK.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-BDmaUIKu.js → TasksListPage-BRg-uFtF.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-BDmaUIKu.js.map → TasksListPage-BRg-uFtF.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-7wqEp87-.js → TimeAgo-BSzN6rAH.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-7wqEp87-.js.map → TimeAgo-BSzN6rAH.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BBCf8zsN.js → TimestampCell-DL6zMNEQ.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BBCf8zsN.js.map → TimestampCell-DL6zMNEQ.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-HcRTggHo.js → ToolPill-1aTqYtzp.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-HcRTggHo.js.map → ToolPill-1aTqYtzp.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-Dosq1cqG.js → ToolTestPanel-fLzNp79U.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-Dosq1cqG.js.map → ToolTestPanel-fLzNp79U.js.map} +1 -1
- package/dashboard/dist/assets/TopicDetailPage-D7gCsPKB.js +9 -0
- package/dashboard/dist/assets/TopicDetailPage-D7gCsPKB.js.map +1 -0
- package/dashboard/dist/assets/{TopicsPage-tVPdz-k0.js → TopicsPage-B3Aa8Haz.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-tVPdz-k0.js.map → TopicsPage-B3Aa8Haz.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-DX7IBjFn.js → UserName-BjHIJWgh.js} +2 -2
- package/dashboard/dist/assets/{UserName-DX7IBjFn.js.map → UserName-BjHIJWgh.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-BjC0j9_L.js → WorkflowExecutionPage-BQ7AYlQA.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-BjC0j9_L.js.map → WorkflowExecutionPage-BQ7AYlQA.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-54px0YiY.js → WorkflowPill-Z-zHRKOK.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-54px0YiY.js.map → WorkflowPill-Z-zHRKOK.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowsDashboard-D-G8Xudz.js +2 -0
- package/dashboard/dist/assets/WorkflowsDashboard-D-G8Xudz.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowsOverview-DaJRDkNy.js → WorkflowsOverview-B4DUcVxs.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-DaJRDkNy.js.map → WorkflowsOverview-B4DUcVxs.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-CkpQaUmz.js → YamlWorkflowsPage-CnTNOku0.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-CkpQaUmz.js.map → YamlWorkflowsPage-CnTNOku0.js.map} +1 -1
- package/dashboard/dist/assets/{agents-B-P5MlEx.js → agents-CkvQDr9b.js} +2 -2
- package/dashboard/dist/assets/{agents-B-P5MlEx.js.map → agents-CkvQDr9b.js.map} +1 -1
- package/dashboard/dist/assets/{bots-CZz9iVys.js → bots-CzuMCVgU.js} +2 -2
- package/dashboard/dist/assets/{bots-CZz9iVys.js.map → bots-CzuMCVgU.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-DrZ8Vw_v.js → capabilities-CbGmS0ty.js} +2 -2
- package/dashboard/dist/assets/{capabilities-DrZ8Vw_v.js.map → capabilities-CbGmS0ty.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-cj-1c-1C.js → controlplane-DGvwkuYx.js} +2 -2
- package/dashboard/dist/assets/{controlplane-cj-1c-1C.js.map → controlplane-DGvwkuYx.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-BEVFyQnE.js → escalation-B7ysVToF.js} +2 -2
- package/dashboard/dist/assets/{escalation-BEVFyQnE.js.map → escalation-B7ysVToF.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-Beox3TXH.js → escalation-columns-CHQEJU1j.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-Beox3TXH.js.map → escalation-columns-CHQEJU1j.js.map} +1 -1
- package/dashboard/dist/assets/{helpers-B4gzNq9h.js → helpers-BFOjXa4r.js} +2 -2
- package/dashboard/dist/assets/{helpers-B4gzNq9h.js.map → helpers-BFOjXa4r.js.map} +1 -1
- package/dashboard/dist/assets/index-B9_1AZaG.js +2 -0
- package/dashboard/dist/assets/{index-3n5VREXN.js.map → index-B9_1AZaG.js.map} +1 -1
- package/dashboard/dist/assets/{index-BCQ65lNu.js → index-BFaDxPxA.js} +2 -2
- package/dashboard/dist/assets/{index-BCQ65lNu.js.map → index-BFaDxPxA.js.map} +1 -1
- package/dashboard/dist/assets/index-BduDiGcw.js +15 -0
- package/dashboard/dist/assets/{index-UtAfnStw.js.map → index-BduDiGcw.js.map} +1 -1
- package/dashboard/dist/assets/{index-Bh-PnP17.js → index-BeLphL59.js} +2 -2
- package/dashboard/dist/assets/{index-Bh-PnP17.js.map → index-BeLphL59.js.map} +1 -1
- package/dashboard/dist/assets/index-C--SEsU7.css +1 -0
- package/dashboard/dist/assets/{index-_DfbFHXk.js → index-CRiBkHPb.js} +2 -2
- package/dashboard/dist/assets/{index-_DfbFHXk.js.map → index-CRiBkHPb.js.map} +1 -1
- package/dashboard/dist/assets/{index-DdKbIZNE.js → index-CbrMW-gM.js} +2 -2
- package/dashboard/dist/assets/{index-DdKbIZNE.js.map → index-CbrMW-gM.js.map} +1 -1
- package/dashboard/dist/assets/{index-aJRDh4zW.js → index-CvOGgvzP.js} +2 -2
- package/dashboard/dist/assets/{index-aJRDh4zW.js.map → index-CvOGgvzP.js.map} +1 -1
- package/dashboard/dist/assets/{index-D1MywQ2z.js → index-DDlrQeTj.js} +2 -2
- package/dashboard/dist/assets/{index-D1MywQ2z.js.map → index-DDlrQeTj.js.map} +1 -1
- package/dashboard/dist/assets/{index-BYXiz05a.js → index-DQHmfTPo.js} +2 -2
- package/dashboard/dist/assets/{index-BYXiz05a.js.map → index-DQHmfTPo.js.map} +1 -1
- package/dashboard/dist/assets/{index-BpN31nuC.js → index-_BRA9uFL.js} +25 -25
- package/dashboard/dist/assets/index-_BRA9uFL.js.map +1 -0
- package/dashboard/dist/assets/index-a98qWLB-.js +2 -0
- package/dashboard/dist/assets/index-a98qWLB-.js.map +1 -0
- package/dashboard/dist/assets/index-l_8R6U4r.js +6 -0
- package/dashboard/dist/assets/index-l_8R6U4r.js.map +1 -0
- package/dashboard/dist/assets/{index-D4KGadbW.js → index-v0OQpgXS.js} +2 -2
- package/dashboard/dist/assets/{index-D4KGadbW.js.map → index-v0OQpgXS.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-DhtKWMON.js → knowledge-BlF8UMrk.js} +2 -2
- package/dashboard/dist/assets/{knowledge-DhtKWMON.js.map → knowledge-BlF8UMrk.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-BXN7-wGF.js → mcp-MtXuky8q.js} +2 -2
- package/dashboard/dist/assets/{mcp-BXN7-wGF.js.map → mcp-MtXuky8q.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-BIJP4mQJ.js → mcp-query-DQ-J1Q0K.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-BIJP4mQJ.js.map → mcp-query-DQ-J1Q0K.js.map} +1 -1
- package/dashboard/dist/assets/{namespaces-ne_yDQZX.js → namespaces-DtsT_GoV.js} +2 -2
- package/dashboard/dist/assets/{namespaces-ne_yDQZX.js.map → namespaces-DtsT_GoV.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-Bcz62DoS.js → pipelines-BjlCm9VH.js} +2 -2
- package/dashboard/dist/assets/{pipelines-Bcz62DoS.js.map → pipelines-BjlCm9VH.js.map} +1 -1
- package/dashboard/dist/assets/{roles-De2CzGCy.js → roles-D-LhJ82d.js} +2 -2
- package/dashboard/dist/assets/{roles-De2CzGCy.js.map → roles-D-LhJ82d.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-4yL5EfxI.js → tasks-BrP_8uEN.js} +2 -2
- package/dashboard/dist/assets/{tasks-4yL5EfxI.js.map → tasks-BrP_8uEN.js.map} +1 -1
- package/dashboard/dist/assets/topics-DUk-zX5D.js +2 -0
- package/dashboard/dist/assets/{topics-DDKHpRwP.js.map → topics-DUk-zX5D.js.map} +1 -1
- package/dashboard/dist/assets/useEventHooks-XNNzwADV.js +2 -0
- package/dashboard/dist/assets/useEventHooks-XNNzwADV.js.map +1 -0
- package/dashboard/dist/assets/{useYamlActivityEvents-Dv6GhDkh.js → useYamlActivityEvents-DANQ5jIY.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-Dv6GhDkh.js.map → useYamlActivityEvents-DANQ5jIY.js.map} +1 -1
- package/dashboard/dist/assets/{users-pSMWP58G.js → users-vj0JgOkA.js} +2 -2
- package/dashboard/dist/assets/{users-pSMWP58G.js.map → users-vj0JgOkA.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-CrrAvF2g.js → vendor-icons-Doy0g69_.js} +116 -111
- package/dashboard/dist/assets/vendor-icons-Doy0g69_.js.map +1 -0
- package/dashboard/dist/assets/{workflows-COYPOe2I.js → workflows-CmqgGPzI.js} +2 -2
- package/dashboard/dist/assets/{workflows-COYPOe2I.js.map → workflows-CmqgGPzI.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-1dF3ig6u.js → yaml-workflows-DNFyjBXH.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-1dF3ig6u.js.map → yaml-workflows-DNFyjBXH.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/api/http/controlplane.md +1 -1
- package/docs/api/http/mcp-endpoint.md +133 -0
- package/docs/api/http/roles.md +46 -0
- package/docs/api/http/service-accounts.md +15 -0
- package/docs/api/http/settings.md +6 -0
- package/docs/api/mcp/admin.md +1187 -0
- package/docs/api/mcp/claude-code.md +47 -0
- package/docs/api/mcp/docs.md +54 -0
- package/docs/api/mcp/events.md +80 -0
- package/docs/api/mcp/file-storage.md +76 -0
- package/docs/api/mcp/http-fetch.md +64 -0
- package/docs/api/mcp/human-queue.md +101 -0
- package/docs/api/mcp/index.md +52 -0
- package/docs/api/mcp/knowledge.md +125 -0
- package/docs/api/mcp/oauth.md +62 -0
- package/docs/api/mcp/schema-exchange.md +56 -0
- package/docs/api/mcp/translation.md +28 -0
- package/docs/api/mcp/vision.md +46 -0
- package/docs/api/sdk/settings.md +3 -1
- package/docs/auth.md +109 -0
- package/docs/dashboard.md +1 -1
- package/package.json +1 -1
- package/build/system/mcp-servers/playwright/browser-lifecycle.d.ts +0 -26
- package/build/system/mcp-servers/playwright/browser-lifecycle.js +0 -125
- package/build/system/mcp-servers/playwright/index.d.ts +0 -25
- package/build/system/mcp-servers/playwright/index.js +0 -42
- package/build/system/mcp-servers/playwright/schemas.d.ts +0 -394
- package/build/system/mcp-servers/playwright/schemas.js +0 -90
- package/build/system/mcp-servers/playwright/tools-atomic.d.ts +0 -2
- package/build/system/mcp-servers/playwright/tools-atomic.js +0 -9
- package/build/system/mcp-servers/playwright/tools-navigation.d.ts +0 -2
- package/build/system/mcp-servers/playwright/tools-navigation.js +0 -153
- package/build/system/mcp-servers/playwright/tools-page-interaction.d.ts +0 -2
- package/build/system/mcp-servers/playwright/tools-page-interaction.js +0 -162
- package/build/system/mcp-servers/playwright/tools-run-script.d.ts +0 -2
- package/build/system/mcp-servers/playwright/tools-run-script.js +0 -207
- package/build/system/mcp-servers/playwright/types.d.ts +0 -8
- package/build/system/mcp-servers/playwright/types.js +0 -30
- package/build/system/mcp-servers/playwright/vision-helper.d.ts +0 -12
- package/build/system/mcp-servers/playwright/vision-helper.js +0 -81
- package/build/system/mcp-servers/playwright-cli/helpers.d.ts +0 -11
- package/build/system/mcp-servers/playwright-cli/helpers.js +0 -20
- package/build/system/mcp-servers/playwright-cli/index.d.ts +0 -4
- package/build/system/mcp-servers/playwright-cli/index.js +0 -15
- package/build/system/mcp-servers/playwright-cli/schemas.d.ts +0 -219
- package/build/system/mcp-servers/playwright-cli/schemas.js +0 -75
- package/build/system/mcp-servers/playwright-cli/tools-auth.d.ts +0 -2
- package/build/system/mcp-servers/playwright-cli/tools-auth.js +0 -183
- package/build/system/mcp-servers/playwright-cli/tools-capture.d.ts +0 -2
- package/build/system/mcp-servers/playwright-cli/tools-capture.js +0 -273
- package/build/system/seed/tool-manifests-browser.d.ts +0 -577
- package/build/system/seed/tool-manifests-browser.js +0 -158
- package/dashboard/dist/assets/AgentConfigPage-DBtvb2x5.js +0 -16
- package/dashboard/dist/assets/AgentConfigPage-DBtvb2x5.js.map +0 -1
- package/dashboard/dist/assets/AgentDetailPage-3mZA7SOb.js.map +0 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-CA9x9o5s.js +0 -2
- package/dashboard/dist/assets/BotPicker-BQp_Vs73.js +0 -2
- package/dashboard/dist/assets/CronLabel-DY8VdTS9.js +0 -2
- package/dashboard/dist/assets/CronLabel-DY8VdTS9.js.map +0 -1
- package/dashboard/dist/assets/ElapsedCell-BPYm8RA7.js +0 -2
- package/dashboard/dist/assets/EventTopicPill-CCWCs07y.js +0 -2
- package/dashboard/dist/assets/EventTopicPill-CCWCs07y.js.map +0 -1
- package/dashboard/dist/assets/HomePage-CwRebzmO.js +0 -2
- package/dashboard/dist/assets/HomePage-CwRebzmO.js.map +0 -1
- package/dashboard/dist/assets/ListToolbar-DEef1_-T.js +0 -2
- package/dashboard/dist/assets/McpRunDetailPage-X0sfRFTk.js +0 -2
- package/dashboard/dist/assets/McpRunDetailPage-X0sfRFTk.js.map +0 -1
- package/dashboard/dist/assets/McpRunsPage-aZg057y3.js +0 -2
- package/dashboard/dist/assets/OperatorDashboard-iZEHnndU.js +0 -2
- package/dashboard/dist/assets/OperatorDashboard-iZEHnndU.js.map +0 -1
- package/dashboard/dist/assets/ServerName-Q6okiv4f.js +0 -2
- package/dashboard/dist/assets/TopicDetailPage-DW97-YHQ.js +0 -9
- package/dashboard/dist/assets/TopicDetailPage-DW97-YHQ.js.map +0 -1
- package/dashboard/dist/assets/WorkflowsDashboard-eCH4gpAk.js +0 -2
- package/dashboard/dist/assets/WorkflowsDashboard-eCH4gpAk.js.map +0 -1
- package/dashboard/dist/assets/index-3n5VREXN.js +0 -2
- package/dashboard/dist/assets/index-BAXzN-QB.js +0 -6
- package/dashboard/dist/assets/index-BAXzN-QB.js.map +0 -1
- package/dashboard/dist/assets/index-BpN31nuC.js.map +0 -1
- package/dashboard/dist/assets/index-C37LMzJa.css +0 -1
- package/dashboard/dist/assets/index-C5dHozmW.js +0 -2
- package/dashboard/dist/assets/index-C5dHozmW.js.map +0 -1
- package/dashboard/dist/assets/index-UtAfnStw.js +0 -15
- package/dashboard/dist/assets/topics-DDKHpRwP.js +0 -2
- package/dashboard/dist/assets/useEventHooks-NzIyvoGY.js +0 -2
- package/dashboard/dist/assets/useEventHooks-NzIyvoGY.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-CrrAvF2g.js.map +0 -1
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// ── Browser automation tool manifests ────────────────────────────────────────
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.PLAYWRIGHT_CLI_TOOLS = exports.PLAYWRIGHT_TOOLS = void 0;
|
|
5
|
-
exports.PLAYWRIGHT_TOOLS = [
|
|
6
|
-
{ name: 'navigate', description: 'Open a URL in a browser page. Returns a page_id handle for subsequent tool calls.', inputSchema: { type: 'object', properties: { url: { type: 'string' }, wait_until: { type: 'string', description: 'load | domcontentloaded | networkidle' } }, required: ['url'] } },
|
|
7
|
-
{ name: 'screenshot', description: 'Capture a screenshot and save as PNG. Pass url for a self-contained navigate+screenshot, or page_id to screenshot an existing page.', inputSchema: { type: 'object', properties: { url: { type: 'string' }, wait_until: { type: 'string' }, path: { type: 'string' }, page_id: { type: 'string' }, full_page: { type: 'boolean' }, selector: { type: 'string' } }, required: ['path'] } },
|
|
8
|
-
{ name: 'click', description: 'Click an element by CSS selector. Waits 500ms after click for SPA transitions.', inputSchema: { type: 'object', properties: { selector: { type: 'string' }, page_id: { type: 'string' } }, required: ['selector'] } },
|
|
9
|
-
{ name: 'fill', description: 'Type a value into an input field by CSS selector.', inputSchema: { type: 'object', properties: { selector: { type: 'string' }, value: { type: 'string' }, page_id: { type: 'string' } }, required: ['selector', 'value'] } },
|
|
10
|
-
{ name: 'wait_for', description: 'Wait for a CSS selector to appear on the page. For URL-based waiting, use run_script with wait_for_url action instead.', inputSchema: { type: 'object', properties: { selector: { type: 'string' }, page_id: { type: 'string' }, timeout: { type: 'number' } }, required: ['selector'] } },
|
|
11
|
-
{ name: 'evaluate', description: 'Evaluate JavaScript in the page context. Returns the expression result.', inputSchema: { type: 'object', properties: { script: { type: 'string' }, page_id: { type: 'string' } }, required: ['script'] } },
|
|
12
|
-
{
|
|
13
|
-
name: 'run_script',
|
|
14
|
-
description: 'Execute a multi-step browser script in a single call. All steps share one page. Actions: navigate (go to URL), screenshot (save PNG), click (CSS selector), fill (input value), wait_for (CSS selector appears), wait_for_url (URL matches/not-matches pattern), wait (fixed delay in ms), evaluate (run JS). Use wait_for_url with not=true after login clicks to wait for SPA navigation.',
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
steps: {
|
|
19
|
-
type: 'array',
|
|
20
|
-
description: 'Ordered list of browser actions to execute sequentially on a single page',
|
|
21
|
-
items: {
|
|
22
|
-
type: 'object',
|
|
23
|
-
properties: {
|
|
24
|
-
action: { type: 'string', enum: ['navigate', 'screenshot', 'click', 'fill', 'wait_for', 'wait_for_url', 'wait', 'evaluate'] },
|
|
25
|
-
url: { type: 'string', description: 'URL for navigate, or URL pattern for wait_for_url' },
|
|
26
|
-
wait_until: { type: 'string' },
|
|
27
|
-
path: { type: 'string' },
|
|
28
|
-
full_page: { type: 'boolean' },
|
|
29
|
-
selector: { type: 'string' },
|
|
30
|
-
value: { type: 'string' },
|
|
31
|
-
script: { type: 'string' },
|
|
32
|
-
timeout: { type: 'number', description: 'Timeout in ms for wait_for/wait_for_url, or delay for wait' },
|
|
33
|
-
not: { type: 'boolean', description: 'For wait_for_url: wait until URL does NOT match (default: false)' },
|
|
34
|
-
},
|
|
35
|
-
required: ['action'],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
required: ['steps'],
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
{ name: 'list_pages', description: 'List all open browser pages.', inputSchema: { type: 'object', properties: {} } },
|
|
43
|
-
{ name: 'close_page', description: 'Close a browser page by ID.', inputSchema: { type: 'object', properties: { page_id: { type: 'string' } }, required: ['page_id'] } },
|
|
44
|
-
];
|
|
45
|
-
exports.PLAYWRIGHT_CLI_TOOLS = [
|
|
46
|
-
{
|
|
47
|
-
name: 'login_and_capture',
|
|
48
|
-
description: 'Log into a website and capture a screenshot of the authenticated page. Handles navigation, credential entry, form submission, and post-login waiting in one call.',
|
|
49
|
-
inputSchema: {
|
|
50
|
-
type: 'object',
|
|
51
|
-
properties: {
|
|
52
|
-
url: { type: 'string', description: 'Login page URL' },
|
|
53
|
-
username_selector: { type: 'string', description: 'CSS selector for username input' },
|
|
54
|
-
password_selector: { type: 'string', description: 'CSS selector for password input' },
|
|
55
|
-
username: { type: 'string', description: 'Username value' },
|
|
56
|
-
password: { type: 'string', description: 'Password value' },
|
|
57
|
-
submit_selector: { type: 'string', description: 'CSS selector for submit button' },
|
|
58
|
-
wait_after_login: { type: 'string', description: 'CSS selector or URL pattern to wait for after login' },
|
|
59
|
-
screenshot_path: { type: 'string', description: 'Path for post-login screenshot' },
|
|
60
|
-
full_page: { type: 'boolean' },
|
|
61
|
-
timeout: { type: 'number', description: 'Max wait time in ms (default: 15000)' },
|
|
62
|
-
},
|
|
63
|
-
required: ['url', 'username_selector', 'password_selector', 'username', 'password', 'submit_selector'],
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: 'capture_page',
|
|
68
|
-
description: 'Navigate to a URL, capture a screenshot, and save it to persistent file storage in one call. The returned `path` and `storage_ref` are the storage reference — no separate write_file call is needed. Optionally waits for a selector or fixed delay before capture. Pass page_id to reuse an existing authenticated session from login_and_capture.',
|
|
69
|
-
inputSchema: {
|
|
70
|
-
type: 'object',
|
|
71
|
-
properties: {
|
|
72
|
-
url: { type: 'string' },
|
|
73
|
-
screenshot_path: { type: 'string', description: 'Storage path for the screenshot PNG (persisted to file storage). Auto-derived from URL if omitted. No separate write_file call needed.' },
|
|
74
|
-
page_id: { type: 'string', description: 'Reuse an existing page to preserve session' },
|
|
75
|
-
full_page: { type: 'boolean' },
|
|
76
|
-
wait_for_selector: { type: 'string' },
|
|
77
|
-
wait_ms: { type: 'number', description: 'Fixed delay in ms before capture (default: 2000)' },
|
|
78
|
-
wait_until: { type: 'string' },
|
|
79
|
-
timeout: { type: 'number' },
|
|
80
|
-
},
|
|
81
|
-
required: ['url'],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'capture_authenticated_pages',
|
|
86
|
-
description: 'Log in once, then navigate to multiple URLs capturing a screenshot of each. Reuses the authenticated session across all pages. Ideal for generating documentation screenshots.',
|
|
87
|
-
inputSchema: {
|
|
88
|
-
type: 'object',
|
|
89
|
-
properties: {
|
|
90
|
-
login: {
|
|
91
|
-
type: 'object',
|
|
92
|
-
description: 'Login parameters',
|
|
93
|
-
properties: {
|
|
94
|
-
url: { type: 'string', description: 'Login page URL' },
|
|
95
|
-
username_selector: { type: 'string', description: 'CSS selector for username input' },
|
|
96
|
-
password_selector: { type: 'string', description: 'CSS selector for password input' },
|
|
97
|
-
username: { type: 'string' },
|
|
98
|
-
password: { type: 'string' },
|
|
99
|
-
submit_selector: { type: 'string', description: 'CSS selector for submit button' },
|
|
100
|
-
wait_after_login: { type: 'string', description: 'CSS selector or URL pattern to wait for after login' },
|
|
101
|
-
timeout: { type: 'number' },
|
|
102
|
-
},
|
|
103
|
-
required: ['url', 'username_selector', 'password_selector', 'username', 'password', 'submit_selector'],
|
|
104
|
-
},
|
|
105
|
-
pages: {
|
|
106
|
-
type: 'array',
|
|
107
|
-
description: 'Pages to capture after login',
|
|
108
|
-
items: {
|
|
109
|
-
type: 'object',
|
|
110
|
-
properties: {
|
|
111
|
-
url: { type: 'string', description: 'URL to navigate to' },
|
|
112
|
-
screenshot_path: { type: 'string', description: 'Path to save screenshot' },
|
|
113
|
-
wait_for_selector: { type: 'string', description: 'Wait for this selector before capture' },
|
|
114
|
-
wait_ms: { type: 'number', description: 'Fixed delay before capture (default: 3000)' },
|
|
115
|
-
full_page: { type: 'boolean' },
|
|
116
|
-
},
|
|
117
|
-
required: ['url', 'screenshot_path'],
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
required: ['login', 'pages'],
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: 'extract_content',
|
|
126
|
-
description: 'Extract structured content (text, links, metadata) from a page. Navigate to a URL or pass page_id to extract from an existing authenticated session. Returns page text by default, with optional link and meta tag extraction.',
|
|
127
|
-
inputSchema: {
|
|
128
|
-
type: 'object',
|
|
129
|
-
properties: {
|
|
130
|
-
url: { type: 'string', description: 'URL to navigate to. Omit to extract from existing page_id.' },
|
|
131
|
-
page_id: { type: 'string', description: 'Reuse an existing page (from login_and_capture)' },
|
|
132
|
-
selector: { type: 'string', description: 'CSS selector to extract text from' },
|
|
133
|
-
script: { type: 'string', description: 'Custom JS to evaluate' },
|
|
134
|
-
extract_links: { type: 'boolean' },
|
|
135
|
-
extract_metadata: { type: 'boolean' },
|
|
136
|
-
wait_for_selector: { type: 'string' },
|
|
137
|
-
wait_ms: { type: 'number' },
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: 'submit_form',
|
|
143
|
-
description: 'Navigate to a form page, fill multiple fields, submit, and capture the result. Handles the full form lifecycle in one call.',
|
|
144
|
-
inputSchema: {
|
|
145
|
-
type: 'object',
|
|
146
|
-
properties: {
|
|
147
|
-
url: { type: 'string' },
|
|
148
|
-
fields: { type: 'array', description: 'Fields to fill', items: { type: 'object', properties: { selector: { type: 'string' }, value: { type: 'string' } }, required: ['selector', 'value'] } },
|
|
149
|
-
submit_selector: { type: 'string' },
|
|
150
|
-
wait_after_submit: { type: 'string', description: 'CSS selector or URL pattern to wait for' },
|
|
151
|
-
screenshot_path: { type: 'string' },
|
|
152
|
-
full_page: { type: 'boolean' },
|
|
153
|
-
timeout: { type: 'number' },
|
|
154
|
-
},
|
|
155
|
-
required: ['url', 'fields', 'submit_selector'],
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
];
|
|
@@ -1,16 +0,0 @@
|
|
|
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-B-P5MlEx.js";import{C as ce,u as de,a as pe,b as xe,c as ue}from"./CronLabel-DY8VdTS9.js";import{d as me,u as he}from"./index-BpN31nuC.js";import{P as fe}from"./PageHeader-CR6TpJG_.js";import{B as O,f as U,j as ve,R as Y,o as L,u as X,aa as G,a as Z,aL as ee,a0 as be}from"./vendor-icons-CrrAvF2g.js";import{e as ye}from"./knowledge-DhtKWMON.js";import{R as te}from"./RunAsSelector-C20rdNsC.js";import{u as je}from"./workflows-COYPOe2I.js";import{u as ge}from"./yaml-workflows-1dF3ig6u.js";import{u as se}from"./capabilities-DrZ8Vw_v.js";import{u as we}from"./topics-DDKHpRwP.js";import{E as Ne}from"./EventTopicPill-CCWCs07y.js";import{W as Q}from"./WorkflowPill-54px0YiY.js";import{e as _e,c as ke,f as Ce}from"./vendor-react-CXumBFUA.js";import"./BotPicker-BQp_Vs73.js";import"./bots-CZz9iVys.js";const V={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,x,u;const l=(x=(o=s.behaviors)==null?void 0:o.schedules)!=null&&x.length?s.behaviors.schedules.map(i=>({cron:i.cron||"",reaction_type:i.reaction_type||"durable",workflow_type:i.workflow_type||"",pipeline_id:i.pipeline_id||"",server_id:i.server_id||"",tool_name:i.tool_name||"",envelope:i.envelope?JSON.stringify(i.envelope,null,2):"{}",execute_as:i.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(i=>({id:i.id,topic:i.topic,filter:i.filter?JSON.stringify(i.filter,null,2):"",reaction_type:i.reaction_type,workflow_type:i.workflow_type??"",pipeline_id:i.pipeline_id??"",mcp_prompt:i.mcp_prompt??"",server_id:i.server_id??"",tool_name:i.tool_name??"",input_mapping:JSON.stringify(i.input_mapping??{},null,2),execute_as:i.execute_as??"",enabled:i.enabled})),schedules:l}}function Ae(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 Oe(s){return s.subscriptions.map(a=>({id:a.id,topic:a.topic,filter:a.filter?B(a.filter):void 0,reaction_type:a.reaction_type,workflow_type:a.workflow_type||void 0,pipeline_id:a.pipeline_id||void 0,mcp_prompt:a.mcp_prompt||void 0,server_id:a.server_id||void 0,tool_name:a.tool_name||void 0,input_mapping:B(a.input_mapping)??{},execute_as:a.execute_as||void 0,enabled:a.enabled}))}function B(s){if(s.trim())try{return JSON.parse(s)}catch{return}}const S="section-header mt-[3em] first:mt-0",E="label",k="hint",R="input",M="input-json w-full";function $e({form:s,set:a}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-[12px] text-text-secondary italic leading-relaxed",children:"Give your automation a name and describe what it does. The name appears everywhere — in events, logs, and the dashboard."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:identity"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Identity",children:e.jsx(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className: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:k,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:k,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(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("label",{className: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:k,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:k,children:"Guardrails. What it must never do, even when goals suggest it should."})]})]})]})}function Pe({form:s,set:a}){const{data:l}=ye(),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(O,{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:x=>a("knowledge_domain",x.target.value),placeholder:"e.g., system-health, content-review, vendor-data",className:R,list:"domain-suggestions"}),e.jsx("datalist",{id:"domain-suggestions",children:o.map(x=>e.jsx("option",{value:x.domain},x.domain))}),e.jsx("p",{className:k,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(x=>e.jsxs("button",{type:"button",onClick:()=>a("knowledge_domain",x.domain),className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${s.knowledge_domain===x.domain?"border-l-2 border-l-accent bg-accent/5":"hover:bg-surface-hover border-l-2 border-l-transparent"}`,children:[e.jsx(U,{className:"w-3.5 h-3.5 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary flex-1",children:x.domain}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[x.count," entries"]}),e.jsx("span",{className:"text-[9px] text-text-quaternary",children:e.jsx(me,{date:x.latest})})]},x.domain))})]})]})}function Ie({serverId:s,toolName:a,onChange:l}){const{data:o}=se(),x=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(n=>n.tools))??[]},[o]),[u,i]=f.useState(!1),[v,p]=f.useState(""),d=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{if(!u)return;function t(n){h.current&&!h.current.contains(n.target)&&i(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[u]);const r=a?`${a}`:"",c=u?v:r,j=f.useMemo(()=>{const t=(u?v:"").toLowerCase();return t?x.filter(n=>n.name.toLowerCase().includes(t)||n.serverName.toLowerCase().includes(t)||(n.description??"").toLowerCase().includes(t)):x},[x,v,u]),m=a?x.find(t=>t.serverId===s&&t.name===a):void 0;return e.jsxs("div",{ref:h,className:"relative",children:[e.jsx("input",{ref:d,type:"text",value:c,onFocus:()=>{i(!0),p(r)},onChange:t=>{const n=t.target.value;p(n),n||l("",""),u||i(!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&&j.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:j.map(t=>e.jsxs("button",{type:"button",onClick:()=>{l(t.serverId,t.name),p(t.name),i(!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&&j.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 We={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:x,onPipelineIdChange:u,serverId:i,toolName:v,onCapabilityChange:p,mcpPrompt:d,onMcpPromptChange:h,availableTypes:r=[...Te]}){const{data:c}=je(),j=(c??[]).filter(n=>n.invocable).map(n=>n.workflow_type),{data:m}=ge({status:"active"}),t=((m==null?void 0:m.workflows)??[]).map(n=>({id:n.id,name:n.graph_topic||n.id}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1",children:r.map(n=>{const b=s===n;return e.jsx("button",{type:"button",onClick:()=>a(n),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:We[n]},n)})}),s==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Workflow *"}),e.jsxs("select",{value:l,onChange:n=>o(n.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select workflow..."}),j.map(n=>e.jsx("option",{value:n,children:n},n))]})]}),s==="pipeline"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Pipeline *"}),e.jsxs("select",{value:x,onChange:n=>u(n.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select pipeline..."}),t.map(n=>e.jsx("option",{value:n.id,children:n.name},n.id))]})]}),s==="capability"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Capability *"}),e.jsx(Ie,{serverId:i,toolName:v,onChange:p})]}),s==="mcp_query"&&h&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Prompt *"}),e.jsx("textarea",{value:d??"",onChange:n=>h(n.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(),x=(l==null?void 0:l.topics)??[],u=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(n=>n.tools))??[]},[o]),[i,v]=f.useState(0),p=(t,n,b)=>{const y=[...s.subscriptions];y[t]={...y[t],[n]:b},a("subscriptions",y)},d=()=>{a("subscriptions",[...s.subscriptions,{...Se}]),v(s.subscriptions.length)},h=t=>{a("subscriptions",s.subscriptions.filter((n,b)=>b!==t)),i>=s.subscriptions.length-1&&v(Math.max(0,s.subscriptions.length-2))},r=s.subscriptions,c=r[i],j=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=c?x.find(t=>t.topic===c.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(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Y,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No event subscriptions yet"}),e.jsx("p",{className:"text-[11px] text-text-quaternary max-w-sm mb-6",children:"Each subscription listens for a topic pattern and runs a workflow when it matches."}),e.jsxs("button",{onClick:d,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(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("div",{className:"w-52 shrink-0 space-y-0.5",children:[r.map((t,n)=>e.jsxs("div",{className:`group/sub flex items-center rounded-md transition-colors ${i===n?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>v(n),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 ${j(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
|
-
|
|
3
|
-
This takes effect when you save.`)&&h(n)},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"})})]},n)),e.jsxs("button",{onClick:d,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"]})]}),c&&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(Fe,{value:c.topic,onChange:t=>p(i,"topic",t),topics:x}),(m==null?void 0:m.payload_schema)&&e.jsxs("div",{className:"mt-3 p-3 rounded-md bg-surface-sunken border border-surface-border",children:[e.jsx("p",{className:"text-[10px] text-text-quaternary mb-1 uppercase tracking-wider font-medium",children:"Payload Schema"}),e.jsx("pre",{className:"text-[11px] font-mono text-text-secondary whitespace-pre-wrap overflow-x-auto max-h-40",children:JSON.stringify(m.payload_schema.properties??m.payload_schema,null,2)}),m.description&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-2 italic",children:m.description})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run this reaction"}),e.jsx(ae,{reactionType:c.reaction_type,onReactionTypeChange:t=>p(i,"reaction_type",t),workflowType:c.workflow_type,onWorkflowTypeChange:t=>p(i,"workflow_type",t),pipelineId:c.pipeline_id,onPipelineIdChange:t=>p(i,"pipeline_id",t),serverId:c.server_id,toolName:c.tool_name,onCapabilityChange:(t,n)=>{var A;const b=[...s.subscriptions],y={...b[i],server_id:t,tool_name:n},w=u.find(N=>N.serverId===t&&N.name===n),$=(A=w==null?void 0:w.inputSchema)==null?void 0:A.properties;if($&&n){const N={};for(const P of Object.keys($))P.startsWith("_")||(N[P]=`{event.data.${P}}`);y.input_mapping=JSON.stringify(N,null,2)}b[i]=y,a("subscriptions",b)},mcpPrompt:c.mcp_prompt,onMcpPromptChange:t=>p(i,"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:c.execute_as,onChange:t=>p(i,"execute_as",t)}),e.jsx("p",{className:k,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:c.filter,onChange:t=>p(i,"filter",t.target.value),placeholder:'{"extension": "png"}',className:`${R} font-mono text-xs`}),e.jsx("p",{className:k,children:"JSON filter against event.data. Click an operator to insert:"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:[{label:"equals",value:'{"key": "val"}'},{label:"not equal",value:'{"key": {"$ne": "val"}}'},{label:"in list",value:'{"key": {"$in": ["a", "b"]}}'},{label:"exists",value:'{"key": {"$exists": true}}'}].map(t=>e.jsx("button",{type:"button",onClick:()=>p(i,"filter",t.value),className:"px-2 py-0.5 text-[10px] font-mono rounded bg-accent/8 text-accent hover:bg-accent/15 transition-colors",children:t.label},t.label))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"With this data"}),c.reaction_type==="capability"&&c.tool_name?e.jsx(Je,{tool:u.find(t=>t.serverId===c.server_id&&t.name===c.tool_name),value:c.input_mapping,onChange:t=>p(i,"input_mapping",t),eventSchema:m==null?void 0:m.payload_schema}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{value:c.input_mapping,onChange:t=>p(i,"input_mapping",t.target.value),rows:10,className:M,placeholder:`{
|
|
4
|
-
"data": {
|
|
5
|
-
"orderId": "{event.data.orderId}",
|
|
6
|
-
"error": "{event.data.error}"
|
|
7
|
-
}
|
|
8
|
-
}`}),e.jsxs("p",{className:k,children:["Maps event fields to workflow input. ","{event.data.fieldName}"," resolves at runtime."]})]})]})]})]})]})}function Je({tool:s,value:a,onChange:l,eventSchema:o}){var j,m;const[x,u]=f.useState(!1),i=((j=s==null?void 0:s.inputSchema)==null?void 0:j.properties)??{},v=((m=s==null?void 0:s.inputSchema)==null?void 0:m.required)??[],p=Object.entries(i).filter(([t])=>!t.startsWith("_")),d=f.useMemo(()=>[...p].sort(([t],[n])=>{const b=v.indexOf(t),y=v.indexOf(n);return b!==-1&&y!==-1?b-y:b!==-1?-1:y!==-1?1:t.localeCompare(n)}),[p,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"}],n=o==null?void 0:o.properties;if(n)for(const[b,y]of Object.entries(n))t.push({value:`{event.data.${b}}`,label:y.description||b});return t},[o]),r=f.useMemo(()=>{try{return JSON.parse(a)}catch{return{}}},[a]),c=(t,n)=>{let b=n;if(typeof n=="string")try{const w=JSON.parse(n);Array.isArray(w)&&(b=w)}catch{}const y={...r,[t]:b};l(JSON.stringify(y,null,2))};return d.length===0||x?e.jsxs("div",{children:[d.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
|
-
"domain": "{event.data.name}",
|
|
10
|
-
"key": "{event.data.path}"
|
|
11
|
-
}`}),e.jsxs("p",{className:k,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:d.map(([t,n])=>{const b=v.includes(t),y=n.description,w=n.type,$=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:"*"})]}),w&&e.jsx("span",{className:"text-[9px] text-text-quaternary",children:w})]}),y&&e.jsx("p",{className:"text-[10px] text-text-quaternary mb-2",children:y}),e.jsx(De,{value:$,onChange:A=>c(t,A),suggestions:h,fieldType:w,placeholder:`{event.data.${t}}`})]},t)})})]})}function De({value:s,onChange:a,suggestions:l,fieldType:o,placeholder:x}){const[u,i]=f.useState(!1),[v,p]=f.useState(""),d=f.useRef(null);f.useEffect(()=>{if(!u)return;function r(c){d.current&&!d.current.contains(c.target)&&i(!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()));if(o==="object")return 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}" }'});if(o==="array"){const r=(()=>{try{const c=JSON.parse(s);if(Array.isArray(c))return c.map(String)}catch{}return s?s.split(",").map(c=>c.trim()).filter(Boolean):[]})();return e.jsxs("div",{children:[e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 min-h-[28px]",children:r.map((c,j)=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] font-mono bg-accent/10 text-accent rounded-full",children:[c,e.jsx("button",{type:"button",onClick:()=>{const m=r.filter((t,n)=>n!==j);a(JSON.stringify(m))},className:"text-accent/50 hover:text-accent ml-0.5",children:"×"})]},j))}),e.jsx("input",{type:"text",className:"input font-mono text-xs w-full",placeholder:"Type a value and press Enter",onKeyDown:c=>{if(c.key==="Enter"||c.key===","){c.preventDefault();const j=c.target.value.trim();j&&(a(JSON.stringify([...r,j])),c.target.value="")}}})]})}return e.jsxs("div",{ref:d,className:"relative",children:[e.jsx("input",{type:"text",value:s,onFocus:()=>{i(!0),p("")},onChange:r=>{a(r.target.value),p(r.target.value),u||i(!0)},className:"input font-mono text-xs w-full",placeholder:x}),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),i(!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 Fe({value:s,onChange:a,topics:l}){const[o,x]=f.useState(!1),[u,i]=f.useState(""),v=f.useRef(null),p=f.useRef(null);f.useEffect(()=>{function r(c){p.current&&!p.current.contains(c.target)&&x(!1)}return o&&document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[o]);const d=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:p,className:"relative",children:[e.jsx("input",{ref:v,type:"text",value:d,onFocus:()=>{x(!0),i(s)},onChange:r=>{const c=r.target.value;i(c),a(c),o||x(!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 c=Le[r.category]??"bg-zinc-400/15 text-zinc-400";return e.jsxs("button",{type:"button",onClick:()=>{a(r.topic),i(r.topic),x(!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 ${c}`,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),x=(d,h,r)=>{const c=[...s.schedules];c[d]={...c[d],[h]:r},a("schedules",c)},u=()=>{a("schedules",[...s.schedules,{...qe}]),o(s.schedules.length)},i=d=>{a("schedules",s.schedules.filter((h,r)=>r!==d)),l>=s.schedules.length-1&&o(Math.max(0,s.schedules.length-2))},v=s.schedules,p=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(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(G,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No schedules"}),e.jsx("p",{className:"text-[11px] text-text-quaternary max-w-sm mb-6",children:"Add a schedule to run a workflow on a recurring cron timer."}),e.jsxs("button",{onClick:u,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(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(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("div",{className:"w-48 shrink-0 space-y-0.5",children:[v.map((d,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:d.cron||"new schedule"}),e.jsxs("span",{className:"text-[9px] text-text-quaternary",children:[(d.reaction_type==="pipeline"?d.pipeline_id:d.workflow_type)||"no target"," · ",z(d.cron)]})]}),e.jsx("button",{onClick:r=>{r.stopPropagation(),confirm(`Remove schedule "${d.cron||"new"}"?
|
|
12
|
-
|
|
13
|
-
This takes effect when you save.`)&&i(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"]})]}),p&&e.jsxs("div",{className:"flex-1 min-w-0 space-y-12",children:[e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run every"}),e.jsx("input",{type:"text",value:p.cron,onChange:d=>x(l,"cron",d.target.value),placeholder:"0 * * * *",className:`${R} font-mono`}),p.cron&&e.jsx("p",{className:"text-[11px] text-accent/80 mt-1",children:z(p.cron)}),e.jsx("div",{className:"flex gap-3 mt-2 overflow-x-auto",children:ze.map(d=>e.jsx("button",{type:"button",onClick:()=>x(l,"cron",d),className:`text-[10px] font-mono whitespace-nowrap transition-colors ${p.cron===d?"text-accent font-medium":"text-accent/50 hover:text-accent"}`,children:z(d)},d))})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run this reaction"}),e.jsx(ae,{reactionType:p.reaction_type,onReactionTypeChange:d=>x(l,"reaction_type",d),workflowType:p.workflow_type,onWorkflowTypeChange:d=>x(l,"workflow_type",d),pipelineId:p.pipeline_id,onPipelineIdChange:d=>x(l,"pipeline_id",d),serverId:p.server_id,toolName:p.tool_name,onCapabilityChange:(d,h)=>{x(l,"server_id",d),x(l,"tool_name",h)},availableTypes:["durable","pipeline","capability"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"As identity"}),e.jsx(te,{selected:p.execute_as,onChange:d=>x(l,"execute_as",d)}),e.jsx("p",{className:k,children:"Identity used when invoking."})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"With this data"}),e.jsx("textarea",{value:p.envelope,onChange:d=>x(l,"envelope",d.target.value),rows:10,className:M,placeholder:`{
|
|
14
|
-
"data": { "source": "cron" }
|
|
15
|
-
}`}),e.jsx("p",{className:k,children:"Static payload passed to the workflow on each invocation."})]})]})]})]})}function W({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 Ue({form:s}){return e.jsxs("div",{children:[e.jsxs(W,{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(W,{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(W,{icon:U,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(W,{icon:Y,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(Q,{type:a.workflow_type}):e.jsx("span",{className:"text-[11px] text-text-quaternary",children:a.reaction_type})]})]},l))})}),e.jsx(W,{icon:G,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(Q,{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 Ye=[{id:1,label:"Identity",icon:Z},{id:2,label:"Motivation",icon:ee},{id:3,label:"Knowledge",icon:U},{id:4,label:"Subscriptions",icon:Y},{id:5,label:"Schedules",icon:G},{id:6,label:"Review",icon: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:i,isLoading:v}=re(a?null:s),{data:p}=de(a?null:s),d=le(),h=oe(),r=pe(),c=xe(),j=ue(),[m,t]=f.useState(V),[n,b]=f.useState(!1),[y,w]=f.useState(""),[$,A]=Ce(),N=parseInt($.get("step")||"1",10),P=f.useCallback(g=>{A(_=>{const q=new URLSearchParams(_);return q.set("step",String(g)),q},{replace:!0})},[A]);f.useEffect(()=>{if(!n){if(a){t(V),b(!0);return}i&&p&&(t(Re(i,p.subscriptions??[])),b(!0))}},[i,p,a,n]);const I=(g,_)=>t(q=>({...q,[g]:_})),ne=async()=>{w("");try{const g=Ae(m);let _=s;a?_=(await d.mutateAsync(g)).id:await h.mutateAsync({id:s,...g});const q=Oe(m),ie=(p==null?void 0:p.subscriptions)??[],J=new Set(ie.map(C=>C.id));for(const C of q)if(C.id&&J.has(C.id)){const{id:D,...F}=C;await c.mutateAsync({agentId:_,subId:D,...F}),J.delete(D)}else{const{id:D,...F}=C;await r.mutateAsync({agentId:_,...F})}for(const C of J)await j.mutateAsync({agentId:_,subId:C});l(`/agents/${_}`)}catch(g){w(g.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=d.isPending||h.isPending;return e.jsxs("div",{children:[e.jsx(fe,{title:a?`New ${u}`:`${u}: ${(i==null?void 0:i.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:Ye.map(g=>{const _=g.icon,q=N===g.id;return e.jsxs("button",{onClick:()=>P(g.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(_,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-xs font-medium",children:g.label})]},g.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"})]}),y&&e.jsx("p",{className:"text-xs text-status-error mt-3",children:y})]}),e.jsxs("div",{className:"flex-1 min-w-0 pt-2",children:[N===1&&e.jsx($e,{form:m,set:I}),N===2&&e.jsx(Ee,{form:m,set:I}),N===3&&e.jsx(Pe,{form:m,set:I}),N===4&&e.jsx(Me,{form:m,set:I}),N===5&&e.jsx(Be,{form:m,set:I}),N===6&&e.jsx(Ue,{form:m})]})]})]})}export{dt as AgentConfigPage};
|
|
16
|
-
//# sourceMappingURL=AgentConfigPage-DBtvb2x5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AgentConfigPage-DBtvb2x5.js","sources":["../../src/pages/agents/detail/agent-form-types.ts","../../src/pages/agents/detail/IdentityStep.tsx","../../src/pages/agents/detail/MotivationStep.tsx","../../src/pages/agents/detail/KnowledgeStep.tsx","../../src/components/common/form/CapabilityCombobox.tsx","../../src/components/common/form/ReactionSelector.tsx","../../src/pages/agents/detail/SubscriptionsStep.tsx","../../src/pages/agents/detail/ScheduleStep.tsx","../../src/pages/agents/detail/ReviewStep.tsx","../../src/pages/agents/detail/AgentConfigPage.tsx"],"sourcesContent":["import type { Agent, AgentBehaviors } from '../../../api/agents';\nimport type { AgentSubscription } from '../../../api/agent-subscriptions';\n\nexport interface SubscriptionFormState {\n id?: string;\n topic: string;\n filter: string;\n reaction_type: 'durable' | 'pipeline' | 'mcp_query' | 'capability';\n workflow_type: string;\n pipeline_id: string;\n mcp_prompt: string;\n server_id: string;\n tool_name: string;\n input_mapping: string;\n execute_as: string;\n enabled: boolean;\n}\n\nexport interface ScheduleFormState {\n cron: string;\n reaction_type: 'durable' | 'pipeline' | 'capability';\n workflow_type: string;\n pipeline_id: string;\n server_id: string;\n tool_name: string;\n envelope: string; // JSON string\n execute_as: string;\n}\n\nexport interface AgentFormState {\n name: string;\n description: string;\n goals: string;\n rules: string;\n user_id: string;\n knowledge_domain: string;\n subscriptions: SubscriptionFormState[];\n schedules: ScheduleFormState[];\n}\n\nexport const EMPTY_FORM: AgentFormState = {\n name: '',\n description: '',\n goals: '',\n rules: '',\n user_id: '',\n knowledge_domain: '',\n subscriptions: [],\n schedules: [],\n};\n\nexport const STEP_LABELS = ['Identity', 'Motivation', 'Knowledge', 'Subscriptions', 'Schedule', 'Review'];\n\nexport const EMPTY_SUBSCRIPTION: SubscriptionFormState = {\n topic: '',\n filter: '',\n reaction_type: 'durable',\n workflow_type: '',\n pipeline_id: '',\n mcp_prompt: '',\n server_id: '',\n tool_name: '',\n input_mapping: '{}',\n execute_as: '',\n enabled: true,\n};\n\nexport const EMPTY_SCHEDULE: ScheduleFormState = {\n cron: '0 * * * *',\n reaction_type: 'durable',\n workflow_type: '',\n pipeline_id: '',\n server_id: '',\n tool_name: '',\n envelope: '{}',\n execute_as: '',\n};\n\nexport function isStepValid(step: number, form: AgentFormState): boolean {\n switch (step) {\n case 1: return form.name.trim().length > 0;\n case 2: return true;\n case 3: return true;\n case 4: {\n return form.subscriptions.every((s) => {\n if (!s.topic.trim()) return false;\n if (s.reaction_type === 'durable' && !s.workflow_type) return false;\n if (s.reaction_type === 'pipeline' && !s.pipeline_id) return false;\n if (s.reaction_type === 'mcp_query' && !s.mcp_prompt) return false;\n if (s.reaction_type === 'capability' && (!s.server_id || !s.tool_name)) return false;\n return true;\n });\n }\n case 5: {\n return form.schedules.every((s) => {\n if (!s.cron) return false;\n if (s.reaction_type === 'pipeline') return !!s.pipeline_id;\n if (s.reaction_type === 'capability') return !!s.server_id && !!s.tool_name;\n return !!s.workflow_type;\n });\n }\n case 6: return true;\n default: return true;\n }\n}\n\nexport function agentToForm(\n agent: Agent,\n subscriptions: AgentSubscription[],\n): AgentFormState {\n // Parse schedules from behaviors.schedules or fall back to legacy single cron\n const schedules: ScheduleFormState[] = agent.behaviors?.schedules?.length\n ? (agent.behaviors.schedules as any[]).map((s: any) => ({\n cron: s.cron || '',\n reaction_type: s.reaction_type || 'durable',\n workflow_type: s.workflow_type || '',\n pipeline_id: s.pipeline_id || '',\n server_id: s.server_id || '',\n tool_name: s.tool_name || '',\n envelope: s.envelope ? JSON.stringify(s.envelope, null, 2) : '{}',\n execute_as: s.execute_as || '',\n }))\n : agent.behaviors?.cron\n ? [{ cron: agent.behaviors.cron, reaction_type: 'durable' as const, workflow_type: agent.workflow_type ?? '', pipeline_id: '', server_id: '', tool_name: '', envelope: '{}', execute_as: '' }]\n : [];\n\n return {\n name: agent.id,\n description: agent.description ?? '',\n goals: agent.goals ?? '',\n rules: agent.rules ?? '',\n user_id: agent.user_id ?? '',\n knowledge_domain: agent.knowledge_domain ?? '',\n subscriptions: subscriptions.map((s) => ({\n id: s.id,\n topic: s.topic,\n filter: s.filter ? JSON.stringify(s.filter, null, 2) : '',\n reaction_type: s.reaction_type,\n workflow_type: s.workflow_type ?? '',\n pipeline_id: s.pipeline_id ?? '',\n mcp_prompt: s.mcp_prompt ?? '',\n server_id: s.server_id ?? '',\n tool_name: s.tool_name ?? '',\n input_mapping: JSON.stringify(s.input_mapping ?? {}, null, 2),\n execute_as: s.execute_as ?? '',\n enabled: s.enabled,\n })),\n schedules,\n };\n}\n\nexport function formToAgentPayload(form: AgentFormState): Record<string, any> {\n const behaviors: AgentBehaviors = {};\n // Store schedules array in behaviors\n if (form.schedules.length > 0) {\n (behaviors as any).schedules = form.schedules.map((s) => ({\n cron: s.cron,\n reaction_type: s.reaction_type || 'durable',\n workflow_type: s.reaction_type === 'pipeline' ? undefined : s.workflow_type,\n pipeline_id: s.reaction_type === 'pipeline' ? s.pipeline_id : undefined,\n envelope: tryParseJson(s.envelope) ?? {},\n execute_as: s.execute_as || undefined,\n }));\n // Legacy compat: also set top-level cron from first schedule\n behaviors.cron = form.schedules[0].cron;\n }\n\n return {\n id: form.name,\n description: form.description || undefined,\n goals: form.goals || undefined,\n rules: form.rules || undefined,\n user_id: form.user_id || undefined,\n knowledge_domain: form.knowledge_domain || undefined,\n behaviors,\n workflow_type: form.schedules[0]?.workflow_type || undefined,\n pipeline_id: undefined,\n };\n}\n\nexport function formToSubscriptionPayloads(form: AgentFormState): Array<{\n id?: string;\n topic: string;\n filter?: Record<string, any>;\n reaction_type: string;\n workflow_type?: string;\n pipeline_id?: string;\n mcp_prompt?: string;\n input_mapping: Record<string, any>;\n execute_as?: string;\n enabled: boolean;\n}> {\n return form.subscriptions.map((s) => ({\n id: s.id,\n topic: s.topic,\n filter: s.filter ? tryParseJson(s.filter) : undefined,\n reaction_type: s.reaction_type,\n workflow_type: s.workflow_type || undefined,\n pipeline_id: s.pipeline_id || undefined,\n mcp_prompt: s.mcp_prompt || undefined,\n server_id: s.server_id || undefined,\n tool_name: s.tool_name || undefined,\n input_mapping: tryParseJson(s.input_mapping) ?? {},\n execute_as: s.execute_as || undefined,\n enabled: s.enabled,\n }));\n}\n\nfunction tryParseJson(s: string): Record<string, any> | undefined {\n if (!s.trim()) return undefined;\n try { return JSON.parse(s); } catch { return undefined; }\n}\n\nexport const sectionCls = 'section-header mt-[3em] first:mt-0';\nexport const labelCls = 'label';\nexport const hintCls = 'hint';\nexport const inputCls = 'input';\nexport const jsonCls = 'input-json w-full';\n","import { BookOpen } from 'lucide-react';\nimport type { AgentFormState } from './agent-form-types';\nimport { labelCls, hintCls, inputCls } from './agent-form-types';\n\ninterface Props {\n form: AgentFormState;\n set: (field: keyof AgentFormState, value: any) => void;\n}\n\nexport function IdentityStep({ form, set }: Props) {\n return (\n <div className=\"space-y-8\">\n <div className=\"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between\">\n <p className=\"text-[12px] text-text-secondary italic leading-relaxed\">\n Give your automation a name and describe what it does. The name appears everywhere — in events, logs, and the dashboard.\n </p>\n <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\"><BookOpen className=\"w-3 h-3\" strokeWidth={1.5} /></button>\n </div>\n\n <div>\n <label className={labelCls}>Name *</label>\n <input type=\"text\" value={form.name} onChange={(e) => set('name', e.target.value)} placeholder=\"health-monitor\" className={inputCls} />\n <p className={hintCls}>Lowercase, kebab-case. This appears everywhere.</p>\n </div>\n\n <div>\n <label className={labelCls}>Description</label>\n <input type=\"text\" value={form.description} onChange={(e) => set('description', e.target.value)} placeholder=\"Watches for workflow failures and captures diagnostics\" className={inputCls} />\n <p className={hintCls}>One sentence that explains what this automation does.</p>\n </div>\n </div>\n );\n}\n","import { BookOpen } from 'lucide-react';\nimport type { AgentFormState } from './agent-form-types';\nimport { labelCls, hintCls, inputCls } from './agent-form-types';\n\ninterface Props {\n form: AgentFormState;\n set: (field: keyof AgentFormState, value: any) => void;\n}\n\nexport function MotivationStep({ form, set }: Props) {\n return (\n <div className=\"space-y-8\">\n <div className=\"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between\">\n <p className=\"text-[12px] text-text-secondary italic leading-relaxed\">\n Goals define what drives the automation. Rules define what constrains it.\n </p>\n <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\"><BookOpen className=\"w-3 h-3\" strokeWidth={1.5} /></button>\n </div>\n\n <div className=\"grid grid-cols-2 gap-8\">\n <div>\n <label className={labelCls}>Goals</label>\n <textarea value={form.goals} onChange={(e) => set('goals', e.target.value)} placeholder=\"Detect failures early, capture diagnostics, alert before cascading\" rows={4} className={`${inputCls} resize-none`} />\n <p className={hintCls}>Primary motivation. What the automation is trying to achieve.</p>\n </div>\n <div>\n <label className={labelCls}>Rules</label>\n <textarea value={form.rules} onChange={(e) => set('rules', e.target.value)} placeholder=\"Never auto-restart failed workflows. Always escalate to humans.\" rows={4} className={`${inputCls} resize-none`} />\n <p className={hintCls}>Guardrails. What it must never do, even when goals suggest it should.</p>\n </div>\n </div>\n </div>\n );\n}\n","import { Brain, BookOpen } from 'lucide-react';\nimport { useListDomains } from '../../../api/knowledge';\nimport { DateValue } from '../../../components/common/display/DateValue';\nimport type { AgentFormState } from './agent-form-types';\nimport { labelCls, hintCls, inputCls } from './agent-form-types';\n\ninterface Props {\n form: AgentFormState;\n set: (field: keyof AgentFormState, value: any) => void;\n}\n\nexport function KnowledgeStep({ form, set }: Props) {\n const { data: domainData } = useListDomains();\n const domains = domainData?.domains ?? [];\n\n return (\n <div className=\"space-y-6\">\n <div className=\"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between\">\n <p className=\"text-[12px] text-text-secondary italic leading-relaxed\">\n Assign a knowledge domain — the automation's memory. It stores context here over time.\n </p>\n <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\"><BookOpen className=\"w-3 h-3\" strokeWidth={1.5} /></button>\n </div>\n\n <div>\n <label className={labelCls}>Knowledge Domain</label>\n <input\n type=\"text\"\n value={form.knowledge_domain}\n onChange={(e) => set('knowledge_domain', e.target.value)}\n placeholder=\"e.g., system-health, content-review, vendor-data\"\n className={inputCls}\n list=\"domain-suggestions\"\n />\n <datalist id=\"domain-suggestions\">\n {domains.map((d) => <option key={d.domain} value={d.domain} />)}\n </datalist>\n <p className={hintCls}>Choose an existing domain to share memory, or type a new name to create one.</p>\n </div>\n\n {domains.length > 0 && (\n <div>\n <label className={labelCls}>Existing Domains</label>\n <div className=\"space-y-0.5 mt-2\">\n {domains.map((d) => (\n <button\n key={d.domain}\n type=\"button\"\n onClick={() => set('knowledge_domain', d.domain)}\n className={`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${\n form.knowledge_domain === d.domain ? 'border-l-2 border-l-accent bg-accent/5' : 'hover:bg-surface-hover border-l-2 border-l-transparent'\n }`}\n >\n <Brain className=\"w-3.5 h-3.5 text-text-quaternary shrink-0\" strokeWidth={1.5} />\n <span className=\"text-sm text-text-primary flex-1\">{d.domain}</span>\n <span className=\"text-[10px] text-text-quaternary\">{d.count} entries</span>\n <span className=\"text-[9px] text-text-quaternary\"><DateValue date={d.latest} /></span>\n </button>\n ))}\n </div>\n </div>\n )}\n </div>\n );\n}\n","import { useState, useRef, useEffect, useMemo } from 'react';\nimport { Server } from 'lucide-react';\nimport { useCapabilities } from '../../../api/capabilities';\n\n/**\n * Searchable combobox for selecting a capability (MCP server tool).\n *\n * Searches across ALL tools from all servers in a single flat list.\n * Selecting a tool sets both serverId and toolName in one action.\n * Styled to match the TopicCombobox used for event topic selection.\n */\nexport function CapabilityCombobox({ serverId, toolName, onChange }: {\n serverId: string;\n toolName: string;\n onChange: (serverId: string, toolName: string) => void;\n}) {\n const { data } = useCapabilities();\n const allTools = useMemo(\n () => data?.categories?.flatMap((c) => c.tools) ?? [],\n [data],\n );\n\n const [open, setOpen] = useState(false);\n const [filter, setFilter] = useState('');\n const inputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Close on outside click\n useEffect(() => {\n if (!open) return;\n function handleClick(e: MouseEvent) {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setOpen(false);\n }\n }\n document.addEventListener('mousedown', handleClick);\n return () => document.removeEventListener('mousedown', handleClick);\n }, [open]);\n\n const displayValue = toolName ? `${toolName}` : '';\n const filterText = open ? filter : displayValue;\n\n const filtered = useMemo(() => {\n const q = (open ? filter : '').toLowerCase();\n if (!q) return allTools;\n return allTools.filter((t) =>\n t.name.toLowerCase().includes(q) ||\n t.serverName.toLowerCase().includes(q) ||\n (t.description ?? '').toLowerCase().includes(q),\n );\n }, [allTools, filter, open]);\n\n const selectedTool = toolName\n ? allTools.find((t) => t.serverId === serverId && t.name === toolName)\n : undefined;\n\n return (\n <div ref={containerRef} className=\"relative\">\n <input\n ref={inputRef}\n type=\"text\"\n value={filterText}\n onFocus={() => { setOpen(true); setFilter(displayValue); }}\n onChange={(e) => {\n const v = e.target.value;\n setFilter(v);\n if (!v) onChange('', '');\n if (!open) setOpen(true);\n }}\n placeholder=\"Search capabilities...\"\n className=\"input font-mono text-sm w-full\"\n />\n\n {/* Selected tool description */}\n {!open && selectedTool?.description && (\n <p className=\"text-[10px] text-text-tertiary mt-1 italic\">{selectedTool.description}</p>\n )}\n\n {open && filtered.length > 0 && (\n <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\">\n {filtered.map((t) => (\n <button\n key={`${t.serverId}:${t.name}`}\n type=\"button\"\n onClick={() => {\n onChange(t.serverId, t.name);\n setFilter(t.name);\n setOpen(false);\n }}\n className={`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 ${\n serverId === t.serverId && toolName === t.name ? 'bg-accent/5' : ''\n }`}\n >\n <span className=\"text-[11px] font-mono text-text-primary shrink-0\">{t.name}</span>\n <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\">\n <Server className=\"w-2 h-2\" strokeWidth={1.5} />\n {t.serverName}\n </span>\n {t.description && (\n <span className=\"text-[10px] text-text-quaternary truncate\">{t.description}</span>\n )}\n </button>\n ))}\n </div>\n )}\n\n {open && filtered.length === 0 && filter && (\n <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\">\n <p className=\"text-[11px] text-text-quaternary\">No capabilities match \"{filter}\"</p>\n </div>\n )}\n </div>\n );\n}\n","import { useWorkflowConfigs } from '../../../api/workflows';\nimport { useYamlWorkflows } from '../../../api/yaml-workflows';\nimport { CapabilityCombobox } from './CapabilityCombobox';\n\nconst LABELS: Record<string, string> = {\n durable: 'Workflow',\n pipeline: 'Pipeline',\n capability: 'Capability',\n mcp_query: 'MCP Query',\n};\n\nconst ALL_TYPES = ['durable', 'pipeline', 'capability', 'mcp_query'] as const;\n\nexport interface ReactionSelectorProps {\n reactionType: string;\n onReactionTypeChange: (type: string) => void;\n workflowType: string;\n onWorkflowTypeChange: (v: string) => void;\n pipelineId: string;\n onPipelineIdChange: (v: string) => void;\n serverId: string;\n toolName: string;\n onCapabilityChange: (serverId: string, toolName: string) => void;\n mcpPrompt?: string;\n onMcpPromptChange?: (v: string) => void;\n availableTypes?: typeof ALL_TYPES[number][];\n}\n\nexport function ReactionSelector({\n reactionType,\n onReactionTypeChange,\n workflowType,\n onWorkflowTypeChange,\n pipelineId,\n onPipelineIdChange,\n serverId,\n toolName,\n onCapabilityChange,\n mcpPrompt,\n onMcpPromptChange,\n availableTypes = [...ALL_TYPES],\n}: ReactionSelectorProps) {\n const { data: configs } = useWorkflowConfigs();\n const invocableWorkflows = (configs ?? []).filter((c: any) => c.invocable).map((c: any) => c.workflow_type as string);\n const { data: pipelineData } = useYamlWorkflows({ status: 'active' });\n const pipelines = (pipelineData?.workflows ?? []).map((w: any) => ({ id: w.id as string, name: (w.graph_topic || w.id) as string }));\n\n return (\n <div className=\"space-y-4\">\n {/* Type tabs */}\n <div className=\"flex gap-1\">\n {availableTypes.map((rt) => {\n const active = reactionType === rt;\n return (\n <button\n key={rt}\n type=\"button\"\n onClick={() => onReactionTypeChange(rt)}\n className={`px-3 py-1.5 text-[11px] font-medium rounded-md transition-colors ${\n active\n ? 'bg-accent/10 text-accent'\n : 'text-text-tertiary hover:text-text-primary hover:bg-surface-hover'\n }`}\n >\n {LABELS[rt]}\n </button>\n );\n })}\n </div>\n\n {/* Target selector per type */}\n {reactionType === 'durable' && (\n <div>\n <label className=\"label\">Workflow *</label>\n <select value={workflowType} onChange={(e) => onWorkflowTypeChange(e.target.value)} className=\"input\">\n <option value=\"\">Select workflow...</option>\n {invocableWorkflows.map((wt) => <option key={wt} value={wt}>{wt}</option>)}\n </select>\n </div>\n )}\n\n {reactionType === 'pipeline' && (\n <div>\n <label className=\"label\">Pipeline *</label>\n <select value={pipelineId} onChange={(e) => onPipelineIdChange(e.target.value)} className=\"input\">\n <option value=\"\">Select pipeline...</option>\n {pipelines.map((p) => <option key={p.id} value={p.id}>{p.name}</option>)}\n </select>\n </div>\n )}\n\n {reactionType === 'capability' && (\n <div>\n <label className=\"label\">Capability *</label>\n <CapabilityCombobox\n serverId={serverId}\n toolName={toolName}\n onChange={onCapabilityChange}\n />\n </div>\n )}\n\n {reactionType === 'mcp_query' && onMcpPromptChange && (\n <div>\n <label className=\"label\">Prompt *</label>\n <textarea\n value={mcpPrompt ?? ''}\n onChange={(e) => onMcpPromptChange(e.target.value)}\n placeholder=\"Analyze the error and suggest remediation...\"\n rows={3}\n className=\"input resize-none\"\n />\n </div>\n )}\n </div>\n );\n}\n","import { useState, useRef, useEffect, useMemo } from 'react';\nimport { Plus, Trash2, Radio, BookOpen } from 'lucide-react';\nimport { RunAsSelector } from '../../../components/common/form/RunAsSelector';\nimport { ReactionSelector } from '../../../components/common/form/ReactionSelector';\nimport { useTopics, type TopicCatalogEntry } from '../../../api/topics';\nimport { useCapabilities } from '../../../api/capabilities';\nimport type { AgentFormState, SubscriptionFormState } from './agent-form-types';\nimport { EMPTY_SUBSCRIPTION, sectionCls, hintCls, inputCls, jsonCls } from './agent-form-types';\n\nconst CATEGORY_COLORS: Record<string, string> = {\n task: 'bg-blue-400/15 text-blue-400',\n workflow: 'bg-accent/15 text-accent',\n escalation: 'bg-amber-400/15 text-amber-400',\n activity: 'bg-cyan-400/15 text-cyan-400',\n knowledge: 'bg-violet-400/15 text-violet-400',\n file: 'bg-orange-400/15 text-orange-400',\n agent: 'bg-emerald-400/15 text-emerald-400',\n app: 'bg-rose-400/15 text-rose-400',\n milestone: 'bg-violet-400/15 text-violet-400',\n};\n\ninterface Props {\n form: AgentFormState;\n set: (field: keyof AgentFormState, value: any) => void;\n}\n\nexport function SubscriptionsStep({ form, set }: Props) {\n const { data: topicsData } = useTopics({ limit: 200 });\n const { data: capData } = useCapabilities();\n const catalogTopics = topicsData?.topics ?? [];\n const allTools = useMemo(() => capData?.categories?.flatMap((c) => c.tools) ?? [], [capData]);\n const [selected, setSelected] = useState(0);\n\n const updateSub = (index: number, field: keyof SubscriptionFormState, value: any) => {\n const next = [...form.subscriptions];\n next[index] = { ...next[index], [field]: value };\n set('subscriptions', next);\n };\n\n const addSub = () => {\n set('subscriptions', [...form.subscriptions, { ...EMPTY_SUBSCRIPTION }]);\n setSelected(form.subscriptions.length);\n };\n\n const removeSub = (index: number) => {\n set('subscriptions', form.subscriptions.filter((_, i) => i !== index));\n if (selected >= form.subscriptions.length - 1) setSelected(Math.max(0, form.subscriptions.length - 2));\n };\n\n const subs = form.subscriptions;\n const sub = subs[selected];\n const isComplete = (s: SubscriptionFormState) => {\n if (!s.topic) return false;\n if (s.reaction_type === 'durable') return !!s.workflow_type;\n if (s.reaction_type === 'pipeline') return !!s.pipeline_id;\n if (s.reaction_type === 'mcp_query') return !!s.mcp_prompt;\n if (s.reaction_type === 'capability') return !!s.server_id && !!s.tool_name;\n return false;\n };\n\n // Find the selected topic's catalog entry for schema preview\n const selectedCatalogEntry = sub ? catalogTopics.find((t) => t.topic === sub.topic) : undefined;\n\n if (subs.length === 0) {\n return (\n <div className=\"max-w-xl\">\n <div className=\"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-8\">\n <p className=\"text-[12px] text-text-secondary italic leading-relaxed\">\n Optional. When a matching event is published, the automation runs the configured workflow with the event payload.\n </p>\n <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\"><BookOpen className=\"w-3 h-3\" strokeWidth={1.5} /></button>\n </div>\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <Radio className=\"w-8 h-8 text-text-quaternary/40 mb-3\" strokeWidth={1} />\n <p className=\"text-sm text-text-tertiary mb-2\">No event subscriptions yet</p>\n <p className=\"text-[11px] text-text-quaternary max-w-sm mb-6\">\n Each subscription listens for a topic pattern and runs a workflow when it matches.\n </p>\n <button onClick={addSub} className=\"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors\">\n <Plus className=\"w-3.5 h-3.5\" /> Add first subscription\n </button>\n </div>\n </div>\n );\n }\n\n return (\n <div>\n <div className=\"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-6\">\n <p className=\"text-[12px] text-text-secondary italic leading-relaxed\">\n Optional. When a matching event is published, the automation runs the configured workflow with the event payload.\n </p>\n <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\"><BookOpen className=\"w-3 h-3\" strokeWidth={1.5} /></button>\n </div>\n\n <div className=\"flex gap-8\">\n {/* Sub-index */}\n <div className=\"w-52 shrink-0 space-y-0.5\">\n {subs.map((s, i) => (\n <div key={i} className={`group/sub flex items-center rounded-md transition-colors ${\n selected === i ? 'bg-accent/10 text-accent' : 'text-text-tertiary hover:text-text-primary hover:bg-surface-hover'\n }`}>\n <button onClick={() => setSelected(i)} className=\"flex-1 text-left px-3 py-2 min-w-0\">\n <div className=\"flex items-center gap-1.5\">\n <span className={`w-1.5 h-1.5 rounded-full shrink-0 ${isComplete(s) ? 'bg-emerald-400' : 'bg-zinc-500'}`} />\n <span className=\"text-[11px] font-mono truncate\">{s.topic || 'new subscription'}</span>\n </div>\n <span className=\"text-[9px] text-text-quaternary ml-3\">→ {s.workflow_type || s.tool_name || s.reaction_type}</span>\n </button>\n <button onClick={(e) => { e.stopPropagation(); if (confirm(`Remove subscription \"${s.topic || 'new'}\"?\\n\\nThis takes effect when you save.`)) removeSub(i); }} className=\"opacity-0 group-hover/sub:opacity-100 px-2 text-text-quaternary hover:text-red-400 transition-all\" title=\"Remove\">\n <Trash2 className=\"w-3 h-3\" />\n </button>\n </div>\n ))}\n <button onClick={addSub} className=\"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors\">\n <Plus className=\"w-3 h-3\" /> Add\n </button>\n </div>\n\n {/* Detail form */}\n {sub && (\n <div className=\"flex-1 min-w-0 space-y-12\">\n\n {/* When — topic combobox */}\n <div>\n <label className={sectionCls}>When this event fires</label>\n <TopicCombobox\n value={sub.topic}\n onChange={(v) => updateSub(selected, 'topic', v)}\n topics={catalogTopics}\n />\n\n {/* Schema preview when a catalog topic is selected */}\n {selectedCatalogEntry?.payload_schema && (\n <div className=\"mt-3 p-3 rounded-md bg-surface-sunken border border-surface-border\">\n <p className=\"text-[10px] text-text-quaternary mb-1 uppercase tracking-wider font-medium\">Payload Schema</p>\n <pre className=\"text-[11px] font-mono text-text-secondary whitespace-pre-wrap overflow-x-auto max-h-40\">\n {JSON.stringify(selectedCatalogEntry.payload_schema.properties ?? selectedCatalogEntry.payload_schema, null, 2)}\n </pre>\n {selectedCatalogEntry.description && (\n <p className=\"text-[10px] text-text-tertiary mt-2 italic\">{selectedCatalogEntry.description}</p>\n )}\n </div>\n )}\n </div>\n\n {/* Reaction selector — full width */}\n <div>\n <label className={sectionCls}>Run this reaction</label>\n <ReactionSelector\n reactionType={sub.reaction_type}\n onReactionTypeChange={(v) => updateSub(selected, 'reaction_type', v)}\n workflowType={sub.workflow_type}\n onWorkflowTypeChange={(v) => updateSub(selected, 'workflow_type', v)}\n pipelineId={sub.pipeline_id}\n onPipelineIdChange={(v) => updateSub(selected, 'pipeline_id', v)}\n serverId={sub.server_id}\n toolName={sub.tool_name}\n onCapabilityChange={(sid, tn) => {\n const next = [...form.subscriptions];\n const entry = { ...next[selected], server_id: sid, tool_name: tn };\n // Auto-generate mapping template from tool schema\n const tool = allTools.find((t) => t.serverId === sid && t.name === tn);\n const props = tool?.inputSchema?.properties as Record<string, any> | undefined;\n if (props && tn) {\n const template: Record<string, string> = {};\n for (const key of Object.keys(props)) {\n if (key.startsWith('_')) continue;\n template[key] = `{event.data.${key}}`;\n }\n entry.input_mapping = JSON.stringify(template, null, 2);\n }\n next[selected] = entry;\n set('subscriptions', next);\n }}\n mcpPrompt={sub.mcp_prompt}\n onMcpPromptChange={(v) => updateSub(selected, 'mcp_prompt', v)}\n\n />\n </div>\n\n {/* Identity + Filter — 2 col */}\n <div className=\"grid grid-cols-2 gap-6\">\n <div>\n <label className={sectionCls}>As identity</label>\n <RunAsSelector selected={sub.execute_as} onChange={(v) => updateSub(selected, 'execute_as', v)} />\n <p className={hintCls}>Identity used when invoking the workflow.</p>\n </div>\n <div>\n <label className={sectionCls}>But only if</label>\n <input type=\"text\" value={sub.filter} onChange={(e) => updateSub(selected, 'filter', e.target.value)} placeholder='{\"extension\": \"png\"}' className={`${inputCls} font-mono text-xs`} />\n <p className={hintCls}>JSON filter against event.data. Click an operator to insert:</p>\n <div className=\"flex flex-wrap gap-1.5 mt-1.5\">\n {[\n { label: 'equals', value: '{\"key\": \"val\"}' },\n { label: 'not equal', value: '{\"key\": {\"$ne\": \"val\"}}' },\n { label: 'in list', value: '{\"key\": {\"$in\": [\"a\", \"b\"]}}' },\n { label: 'exists', value: '{\"key\": {\"$exists\": true}}' },\n ].map((op) => (\n <button\n key={op.label}\n type=\"button\"\n onClick={() => updateSub(selected, 'filter', op.value)}\n className=\"px-2 py-0.5 text-[10px] font-mono rounded bg-accent/8 text-accent hover:bg-accent/15 transition-colors\"\n >\n {op.label}\n </button>\n ))}\n </div>\n </div>\n </div>\n\n {/* Input Mapping full width */}\n <div>\n <label className={sectionCls}>With this data</label>\n {sub.reaction_type === 'capability' && sub.tool_name ? (\n <CapabilityMappingForm\n tool={allTools.find((t) => t.serverId === sub.server_id && t.name === sub.tool_name)}\n value={sub.input_mapping}\n onChange={(v) => updateSub(selected, 'input_mapping', v)}\n eventSchema={selectedCatalogEntry?.payload_schema}\n />\n ) : (\n <>\n <textarea value={sub.input_mapping} onChange={(e) => updateSub(selected, 'input_mapping', e.target.value)} rows={10} className={jsonCls} placeholder={'{\\n \"data\": {\\n \"orderId\": \"{event.data.orderId}\",\\n \"error\": \"{event.data.error}\"\\n }\\n}'} />\n <p className={hintCls}>Maps event fields to workflow input. {'{event.data.fieldName}'} resolves at runtime.</p>\n </>\n )}\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n\n// ── Capability Mapping Form ─────────────────────────────────────────────────\n\nfunction CapabilityMappingForm({ tool, value, onChange, eventSchema }: {\n tool?: { name: string; description?: string; inputSchema: Record<string, any> };\n value: string;\n onChange: (v: string) => void;\n eventSchema?: Record<string, any>;\n}) {\n const [jsonMode, setJsonMode] = useState(false);\n const props = (tool?.inputSchema?.properties ?? {}) as Record<string, any>;\n const required = (tool?.inputSchema?.required as string[]) ?? [];\n const allFields = Object.entries(props).filter(([k]) => !k.startsWith('_'));\n\n // Required fields first (in declared required-array order), then optional alphabetically\n const fields = useMemo(() =>\n [...allFields].sort(([a], [b]) => {\n const ai = required.indexOf(a);\n const bi = required.indexOf(b);\n if (ai !== -1 && bi !== -1) return ai - bi;\n if (ai !== -1) return -1;\n if (bi !== -1) return 1;\n return a.localeCompare(b);\n }),\n [allFields, required]);\n\n // Build event field suggestions from the topic's payload schema\n const eventSuggestions = useMemo(() => {\n const suggestions: Array<{ value: string; label: string }> = [\n { value: '{event.type}', label: 'event type' },\n { value: '{event.source}', label: 'event source' },\n { value: '{event.timestamp}', label: 'ISO timestamp' },\n { value: '{event.workflowId}', label: 'workflow ID' },\n { value: '{event.workflowName}', label: 'workflow name' },\n ];\n const schemaProps = eventSchema?.properties as Record<string, any> | undefined;\n if (schemaProps) {\n for (const [key, def] of Object.entries(schemaProps)) {\n suggestions.push({\n value: `{event.data.${key}}`,\n label: (def as any).description || key,\n });\n }\n }\n return suggestions;\n }, [eventSchema]);\n\n const parsed = useMemo(() => {\n try { return JSON.parse(value) as Record<string, any>; }\n catch { return {} as Record<string, any>; }\n }, [value]);\n\n const updateField = (key: string, fieldValue: any) => {\n // If the value is a JSON array string, parse it so the output is a real array\n let resolved = fieldValue;\n if (typeof fieldValue === 'string') {\n try {\n const p = JSON.parse(fieldValue);\n if (Array.isArray(p)) resolved = p;\n } catch { /* keep as string */ }\n }\n const next = { ...parsed, [key]: resolved };\n onChange(JSON.stringify(next, null, 2));\n };\n\n if (fields.length === 0 || jsonMode) {\n return (\n <div>\n {fields.length > 0 && (\n <div className=\"flex justify-end mb-1\">\n <button type=\"button\" onClick={() => setJsonMode(false)} className=\"text-[10px] text-accent hover:text-accent-hover transition-colors\">Form view</button>\n </div>\n )}\n <textarea value={value} onChange={(e) => onChange(e.target.value)} rows={8} className={jsonCls} placeholder={'{\\n \"domain\": \"{event.data.name}\",\\n \"key\": \"{event.data.path}\"\\n}'} />\n <p className={hintCls}>Maps event fields to capability inputs. {'{event.data.fieldName}'} resolves at runtime.</p>\n </div>\n );\n }\n\n return (\n <div>\n <div className=\"flex items-center justify-between mb-3\">\n <p className=\"text-[11px] text-text-tertiary\">\n Map each input to an event field or enter a static value.\n </p>\n <button type=\"button\" onClick={() => setJsonMode(true)} className=\"text-[10px] text-text-tertiary hover:text-accent transition-colors\">Raw JSON</button>\n </div>\n\n <div className=\"space-y-4\">\n {fields.map(([key, def]) => {\n const isReq = required.includes(key);\n const desc = (def as any).description;\n const fieldType = (def as any).type;\n const currentVal = typeof parsed[key] === 'string' ? parsed[key]\n : typeof parsed[key] === 'object' ? JSON.stringify(parsed[key])\n : parsed[key] != null ? String(parsed[key]) : '';\n\n return (\n <div key={key} className=\"bg-surface-sunken/30 rounded-md px-4 py-3\">\n <div className=\"flex items-baseline gap-2 mb-0.5\">\n <label className=\"text-[11px] font-semibold uppercase tracking-wider text-text-secondary\">\n {key.replace(/[_-]/g, ' ')}\n {isReq && <span className=\"text-status-error ml-0.5\">*</span>}\n </label>\n {fieldType && <span className=\"text-[9px] text-text-quaternary\">{fieldType}</span>}\n </div>\n {desc && <p className=\"text-[10px] text-text-quaternary mb-2\">{desc}</p>}\n <MappingFieldInput\n value={currentVal}\n onChange={(v) => updateField(key, v)}\n suggestions={eventSuggestions}\n fieldType={fieldType}\n placeholder={`{event.data.${key}}`}\n />\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\n/** Input with dropdown suggestions for event field references */\nfunction MappingFieldInput({ value, onChange, suggestions, fieldType, placeholder }: {\n value: string;\n onChange: (v: string) => void;\n suggestions: Array<{ value: string; label: string }>;\n fieldType?: string;\n placeholder: string;\n}) {\n const [open, setOpen] = useState(false);\n const [filter, setFilter] = useState('');\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!open) return;\n function handleClick(e: MouseEvent) {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) setOpen(false);\n }\n document.addEventListener('mousedown', handleClick);\n return () => document.removeEventListener('mousedown', handleClick);\n }, [open]);\n\n const filtered = suggestions.filter((s) =>\n s.value.toLowerCase().includes(filter.toLowerCase()) ||\n s.label.toLowerCase().includes(filter.toLowerCase()),\n );\n\n if (fieldType === 'object') {\n return (\n <textarea\n value={value}\n onChange={(e) => {\n try { onChange(JSON.parse(e.target.value)); }\n catch { onChange(e.target.value); }\n }}\n rows={3}\n className={`${jsonCls} text-xs`}\n placeholder={`{ \"source\": \"{event.source}\" }`}\n />\n );\n }\n\n if (fieldType === 'array') {\n // Parse existing value: could be a JSON array string or comma-separated\n const items: string[] = (() => {\n try {\n const parsed = JSON.parse(value);\n if (Array.isArray(parsed)) return parsed.map(String);\n } catch { /* fall through */ }\n return value ? value.split(',').map((s: string) => s.trim()).filter(Boolean) : [];\n })();\n\n return (\n <div>\n <div className=\"flex flex-wrap gap-1.5 mb-2 min-h-[28px]\">\n {items.map((item, i) => (\n <span key={i} className=\"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] font-mono bg-accent/10 text-accent rounded-full\">\n {item}\n <button\n type=\"button\"\n onClick={() => { const next = items.filter((_, j) => j !== i); onChange(JSON.stringify(next)); }}\n className=\"text-accent/50 hover:text-accent ml-0.5\"\n >\n ×\n </button>\n </span>\n ))}\n </div>\n <input\n type=\"text\"\n className=\"input font-mono text-xs w-full\"\n placeholder=\"Type a value and press Enter\"\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ',') {\n e.preventDefault();\n const v = (e.target as HTMLInputElement).value.trim();\n if (v) {\n onChange(JSON.stringify([...items, v]));\n (e.target as HTMLInputElement).value = '';\n }\n }\n }}\n />\n </div>\n );\n }\n\n return (\n <div ref={containerRef} className=\"relative\">\n <input\n type=\"text\"\n value={value}\n onFocus={() => { setOpen(true); setFilter(''); }}\n onChange={(e) => { onChange(e.target.value); setFilter(e.target.value); if (!open) setOpen(true); }}\n className=\"input font-mono text-xs w-full\"\n placeholder={placeholder}\n />\n {open && filtered.length > 0 && (\n <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\">\n {filtered.map((s) => (\n <button\n key={s.value}\n type=\"button\"\n onClick={() => { onChange(s.value); setOpen(false); }}\n className={`w-full text-left px-3 py-1.5 hover:bg-surface-hover transition-colors flex items-center gap-3 ${value === s.value ? 'bg-accent/5' : ''}`}\n >\n <span className=\"text-[11px] font-mono text-accent shrink-0\">{s.value}</span>\n <span className=\"text-[10px] text-text-quaternary truncate\">{s.label}</span>\n </button>\n ))}\n </div>\n )}\n </div>\n );\n}\n\n// ── Topic Combobox ──────────────────────────────────────────────────────────\n\nfunction TopicCombobox({ value, onChange, topics }: {\n value: string;\n onChange: (v: string) => void;\n topics: TopicCatalogEntry[];\n}) {\n const [open, setOpen] = useState(false);\n const [filter, setFilter] = useState('');\n const inputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Close on outside click\n useEffect(() => {\n function handleClick(e: MouseEvent) {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setOpen(false);\n }\n }\n if (open) document.addEventListener('mousedown', handleClick);\n return () => document.removeEventListener('mousedown', handleClick);\n }, [open]);\n\n const filterText = open ? filter : value;\n const filtered = topics.filter((t) =>\n t.topic.toLowerCase().includes((open ? filter : '').toLowerCase()) ||\n (t.description ?? '').toLowerCase().includes((open ? filter : '').toLowerCase()),\n );\n\n return (\n <div ref={containerRef} className=\"relative\">\n <input\n ref={inputRef}\n type=\"text\"\n value={filterText}\n onFocus={() => { setOpen(true); setFilter(value); }}\n onChange={(e) => {\n const v = e.target.value;\n setFilter(v);\n onChange(v);\n if (!open) setOpen(true);\n }}\n placeholder=\"workflow.failed or app.>\"\n className={`${inputCls} font-mono`}\n />\n\n {open && filtered.length > 0 && (\n <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\">\n {filtered.map((t) => {\n const catCls = CATEGORY_COLORS[t.category] ?? 'bg-zinc-400/15 text-zinc-400';\n return (\n <button\n key={t.topic}\n type=\"button\"\n onClick={() => {\n onChange(t.topic);\n setFilter(t.topic);\n setOpen(false);\n }}\n className={`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 ${\n value === t.topic ? 'bg-accent/5' : ''\n }`}\n >\n <span className=\"text-[11px] font-mono text-text-primary shrink-0\">{t.topic}</span>\n <span className={`inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-medium shrink-0 ${catCls}`}>{t.category}</span>\n {t.description && (\n <span className=\"text-[10px] text-text-quaternary truncate\">{t.description}</span>\n )}\n </button>\n );\n })}\n </div>\n )}\n </div>\n );\n}\n","import { useState } from 'react';\nimport { Plus, Trash2, Clock, BookOpen } from 'lucide-react';\nimport { RunAsSelector } from '../../../components/common/form/RunAsSelector';\nimport { ReactionSelector } from '../../../components/common/form/ReactionSelector';\nimport type { AgentFormState, ScheduleFormState } from './agent-form-types';\nimport { EMPTY_SCHEDULE, sectionCls, hintCls, inputCls, jsonCls } from './agent-form-types';\n\nconst CRON_PRESETS = [\n '*/5 * * * *',\n '*/15 * * * *',\n '0 * * * *',\n '0 */4 * * *',\n '0 7 * * *',\n '0 9 * * 1-5',\n];\n\nfunction describeCron(expr: string): string {\n const m: Record<string, string> = {\n '* * * * *': 'Every minute',\n '*/5 * * * *': 'Every 5 min',\n '*/15 * * * *': 'Every 15 min',\n '0 * * * *': 'Hourly',\n '0 */4 * * *': 'Every 4 hours',\n '0 7 * * *': 'Daily 7 AM UTC',\n '0 9 * * 1-5': 'Weekdays 9 AM UTC',\n '0 0 * * 1': 'Weekly Monday',\n };\n return m[expr] || expr;\n}\n\ninterface Props {\n form: AgentFormState;\n set: (field: keyof AgentFormState, value: any) => void;\n}\n\nexport function ScheduleStep({ form, set }: Props) {\n const [selected, setSelected] = useState(0);\n\n const updateSched = (index: number, field: keyof ScheduleFormState, value: any) => {\n const next = [...form.schedules];\n next[index] = { ...next[index], [field]: value };\n set('schedules', next);\n };\n\n const addSched = () => {\n set('schedules', [...form.schedules, { ...EMPTY_SCHEDULE }]);\n setSelected(form.schedules.length);\n };\n\n const removeSched = (index: number) => {\n set('schedules', form.schedules.filter((_: any, i: number) => i !== index));\n if (selected >= form.schedules.length - 1) setSelected(Math.max(0, form.schedules.length - 2));\n };\n\n const scheds = form.schedules;\n const sched = scheds[selected];\n\n if (scheds.length === 0) {\n return (\n <div>\n <div className=\"border-l-2 border-accent/30 pl-3 py-1 mb-8 flex items-start justify-between\">\n <p className=\"text-[12px] text-text-secondary italic leading-relaxed\">\n Optional. Each schedule runs a workflow on a cron timer.\n </p>\n <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\"><BookOpen className=\"w-3 h-3\" strokeWidth={1.5} /></button>\n </div>\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <Clock className=\"w-8 h-8 text-text-quaternary/40 mb-3\" strokeWidth={1} />\n <p className=\"text-sm text-text-tertiary mb-2\">No schedules</p>\n <p className=\"text-[11px] text-text-quaternary max-w-sm mb-6\">\n Add a schedule to run a workflow on a recurring cron timer.\n </p>\n <button onClick={addSched} className=\"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors\">\n <Plus className=\"w-3.5 h-3.5\" /> Add schedule\n </button>\n </div>\n </div>\n );\n }\n\n return (\n <div>\n <div className=\"border-l-2 border-accent/30 pl-3 py-1 mb-6 flex items-start justify-between\">\n <p className=\"text-[12px] text-text-secondary italic leading-relaxed\">\n Each schedule runs a workflow on a timer. An automation can have multiple schedules targeting different workflows.\n </p>\n <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\"><BookOpen className=\"w-3 h-3\" strokeWidth={1.5} /></button>\n </div>\n\n <div className=\"flex gap-8\">\n {/* Sub-index */}\n <div className=\"w-48 shrink-0 space-y-0.5\">\n {scheds.map((s, i) => (\n <div key={i} className={`group/sched flex items-center rounded-md transition-colors ${\n selected === i ? 'bg-accent/10 text-accent' : 'text-text-tertiary hover:text-text-primary hover:bg-surface-hover'\n }`}>\n <button onClick={() => setSelected(i)} className=\"flex-1 text-left px-3 py-2 min-w-0\">\n <span className=\"text-[11px] font-mono block\">{s.cron || 'new schedule'}</span>\n <span className=\"text-[9px] text-text-quaternary\">{(s.reaction_type === 'pipeline' ? s.pipeline_id : s.workflow_type) || 'no target'} · {describeCron(s.cron)}</span>\n </button>\n <button onClick={(e) => { e.stopPropagation(); if (confirm(`Remove schedule \"${s.cron || 'new'}\"?\\n\\nThis takes effect when you save.`)) removeSched(i); }} className=\"opacity-0 group-hover/sched:opacity-100 px-2 text-text-quaternary hover:text-red-400 transition-all\" title=\"Remove\">\n <Trash2 className=\"w-3 h-3\" />\n </button>\n </div>\n ))}\n <button onClick={addSched} className=\"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors\">\n <Plus className=\"w-3 h-3\" /> Add\n </button>\n </div>\n\n {/* Detail form */}\n {sched && (\n <div className=\"flex-1 min-w-0 space-y-12\">\n\n {/* Every — cron + presets */}\n <div>\n <label className={sectionCls}>Run every</label>\n <input type=\"text\" value={sched.cron} onChange={(e) => updateSched(selected, 'cron', e.target.value)} placeholder=\"0 * * * *\" className={`${inputCls} font-mono`} />\n {sched.cron && <p className=\"text-[11px] text-accent/80 mt-1\">{describeCron(sched.cron)}</p>}\n <div className=\"flex gap-3 mt-2 overflow-x-auto\">\n {CRON_PRESETS.map((p) => (\n <button key={p} type=\"button\" onClick={() => updateSched(selected, 'cron', p)}\n className={`text-[10px] font-mono whitespace-nowrap transition-colors ${sched.cron === p ? 'text-accent font-medium' : 'text-accent/50 hover:text-accent'}`}\n >{describeCron(p)}</button>\n ))}\n </div>\n </div>\n\n {/* Run this reaction */}\n <div>\n <label className={sectionCls}>Run this reaction</label>\n <ReactionSelector\n reactionType={sched.reaction_type}\n onReactionTypeChange={(v) => updateSched(selected, 'reaction_type', v)}\n workflowType={sched.workflow_type}\n onWorkflowTypeChange={(v) => updateSched(selected, 'workflow_type', v)}\n pipelineId={sched.pipeline_id}\n onPipelineIdChange={(v) => updateSched(selected, 'pipeline_id', v)}\n serverId={sched.server_id}\n toolName={sched.tool_name}\n onCapabilityChange={(sid, tn) => { updateSched(selected, 'server_id', sid); updateSched(selected, 'tool_name', tn); }}\n availableTypes={['durable', 'pipeline', 'capability']}\n\n />\n </div>\n\n {/* As identity */}\n <div>\n <label className={sectionCls}>As identity</label>\n <RunAsSelector selected={sched.execute_as} onChange={(v) => updateSched(selected, 'execute_as', v)} />\n <p className={hintCls}>Identity used when invoking.</p>\n </div>\n\n {/* Envelope */}\n <div>\n <label className={sectionCls}>With this data</label>\n <textarea value={sched.envelope} onChange={(e) => updateSched(selected, 'envelope', e.target.value)} rows={10} className={jsonCls} placeholder={'{\\n \"data\": { \"source\": \"cron\" }\\n}'} />\n <p className={hintCls}>Static payload passed to the workflow on each invocation.</p>\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n","import { Bot, Compass, Brain, Radio, Clock } from 'lucide-react';\nimport { EventTopicPill } from '../../../components/common/display/EventTopicPill';\nimport { CronLabel } from '../../../components/common/display/CronLabel';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\nimport type { AgentFormState } from './agent-form-types';\n\ninterface Props {\n form: AgentFormState;\n}\n\nfunction Section({ icon: Icon, color, title, children }: { icon: React.ElementType; color: string; title: string; children: React.ReactNode }) {\n return (\n <div className=\"mb-10\">\n <div className=\"flex items-center gap-2 mb-2 pb-1.5 border-b border-surface-border/40\">\n <Icon className={`w-3.5 h-3.5 ${color}`} strokeWidth={1.5} />\n <h3 className=\"text-xs font-semibold uppercase tracking-widest text-accent/80\">{title}</h3>\n </div>\n <div className=\"pl-5.5\">{children}</div>\n </div>\n );\n}\n\nfunction Field({ label, children }: { label: string; children: React.ReactNode }) {\n return (\n <div className=\"flex gap-3 py-0.5\">\n <span className=\"text-[10px] text-text-quaternary w-20 shrink-0\">{label}</span>\n <span className=\"text-xs text-text-primary\">{children}</span>\n </div>\n );\n}\n\nexport function ReviewStep({ form }: Props) {\n return (\n <div>\n <Section icon={Bot} color=\"text-accent\" title=\"Identity\">\n <Field label=\"Name\">{form.name || '—'}</Field>\n {form.description && <Field label=\"Description\">{form.description}</Field>}\n </Section>\n\n {(form.goals || form.rules) && (\n <Section icon={Compass} color=\"text-rose-400\" title=\"Motivation\">\n {form.goals && <Field label=\"Goals\">{form.goals}</Field>}\n {form.rules && <Field label=\"Rules\">{form.rules}</Field>}\n </Section>\n )}\n\n <Section icon={Brain} color=\"text-emerald-400\" title=\"Knowledge\">\n <Field label=\"Domain\">{form.knowledge_domain || 'None'}</Field>\n </Section>\n\n {/* Subscriptions + Schedule side by side */}\n <div className=\"grid grid-cols-2 gap-x-10\">\n <Section icon={Radio} color=\"text-cyan-400\" title={`Subscriptions (${form.subscriptions.length})`}>\n {form.subscriptions.length === 0 ? (\n <span className=\"text-[11px] text-text-quaternary\">None configured</span>\n ) : (\n <div className=\"divide-y divide-surface-border/30\">\n {form.subscriptions.map((sub, i) => (\n <div key={i} className=\"flex items-center py-1.5\">\n <div className=\"flex-1 min-w-0\"><EventTopicPill topic={sub.topic || 'unset'} /></div>\n <div className=\"flex items-center gap-1.5 shrink-0\"><span className=\"text-text-quaternary text-[10px]\">→</span>{sub.workflow_type ? <WorkflowPill type={sub.workflow_type} /> : <span className=\"text-[11px] text-text-quaternary\">{sub.reaction_type}</span>}</div>\n </div>\n ))}\n </div>\n )}\n </Section>\n\n <Section icon={Clock} color=\"text-amber-400\" title={`Schedules (${form.schedules.length})`}>\n {form.schedules.length === 0 ? (\n <span className=\"text-[11px] text-text-quaternary\">None configured</span>\n ) : (\n <div className=\"divide-y divide-surface-border/30\">\n {form.schedules.map((s, i) => (\n <div key={i} className=\"flex items-center py-1.5\">\n <div className=\"flex-1 min-w-0\"><CronLabel cron={s.cron} /></div>\n <div className=\"flex items-center gap-1.5 shrink-0\"><span className=\"text-text-quaternary text-[10px]\">→</span>{s.workflow_type ? <WorkflowPill type={s.workflow_type} /> : <span className=\"text-[11px] text-text-quaternary\">no workflow</span>}</div>\n </div>\n ))}\n </div>\n )}\n </Section>\n </div>\n\n <div className=\"border-l-2 border-emerald-400/30 pl-3 py-2 mt-6\">\n <p className=\"text-[11px] text-text-tertiary leading-relaxed\">\n After saving, subscriptions and schedules activate immediately. You can pause the automation anytime.\n </p>\n </div>\n </div>\n );\n}\n","import { useState, useEffect, useCallback } from 'react';\nimport { useParams, useNavigate, useSearchParams } from 'react-router-dom';\nimport {\n Bot, Brain, Radio, Clock, Check, Compass,\n} from 'lucide-react';\nimport { useAgent, useCreateAgent, useUpdateAgent } from '../../../api/agents';\nimport { useAgentSubscriptions, useCreateSubscription, useUpdateSubscription, useDeleteSubscription } from '../../../api/agent-subscriptions';\nimport { useSettings } from '../../../api/settings';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport {\n EMPTY_FORM,\n agentToForm,\n formToAgentPayload,\n formToSubscriptionPayloads,\n} from './agent-form-types';\nimport type { AgentFormState } from './agent-form-types';\nimport { IdentityStep } from './IdentityStep';\nimport { MotivationStep } from './MotivationStep';\nimport { KnowledgeStep } from './KnowledgeStep';\nimport { SubscriptionsStep } from './SubscriptionsStep';\nimport { ScheduleStep } from './ScheduleStep';\nimport { ReviewStep } from './ReviewStep';\n\nconst SECTIONS = [\n { id: 1, label: 'Identity', icon: Bot },\n { id: 2, label: 'Motivation', icon: Compass },\n { id: 3, label: 'Knowledge', icon: Brain },\n { id: 4, label: 'Subscriptions', icon: Radio },\n { id: 5, label: 'Schedules', icon: Clock },\n { id: 6, label: 'Review', icon: Check },\n];\n\nexport function AgentConfigPage() {\n const { id } = useParams<{ id: string }>();\n const isNew = !id;\n const navigate = useNavigate();\n const { data: settings } = useSettings();\n const aiEnabled = !!settings?.ai?.enabled;\n const noun = aiEnabled ? 'Agent' : 'Automation';\n const { data: existing, isLoading } = useAgent(isNew ? null : id!);\n const { data: subsData } = useAgentSubscriptions(isNew ? null : id!);\n\n const createAgent = useCreateAgent();\n const updateAgent = useUpdateAgent();\n const createSub = useCreateSubscription();\n const updateSub = useUpdateSubscription();\n const deleteSub = useDeleteSubscription();\n\n const [form, setForm] = useState<AgentFormState>(EMPTY_FORM);\n const [initialized, setInitialized] = useState(false);\n const [saveError, setSaveError] = useState('');\n\n const [searchParams, setSearchParams] = useSearchParams();\n const section = parseInt(searchParams.get('step') || '1', 10);\n const setSection = useCallback((s: number) => {\n setSearchParams((prev) => {\n const next = new URLSearchParams(prev);\n next.set('step', String(s));\n return next;\n }, { replace: true });\n }, [setSearchParams]);\n\n useEffect(() => {\n if (initialized) return;\n if (isNew) { setForm(EMPTY_FORM); setInitialized(true); return; }\n if (existing && subsData) {\n setForm(agentToForm(existing, subsData.subscriptions ?? []));\n setInitialized(true);\n }\n }, [existing, subsData, isNew, initialized]);\n\n const set = (field: keyof AgentFormState, value: any) =>\n setForm((f) => ({ ...f, [field]: value }));\n\n const handleSave = async () => {\n setSaveError('');\n try {\n const payload = formToAgentPayload(form);\n let agentId = id;\n\n if (isNew) {\n const created = await createAgent.mutateAsync(payload as any);\n agentId = created.id;\n } else {\n await updateAgent.mutateAsync({ id: id!, ...payload } as any);\n }\n\n const subPayloads = formToSubscriptionPayloads(form);\n const existingSubs = subsData?.subscriptions ?? [];\n const existingIds = new Set(existingSubs.map((s) => s.id));\n\n for (const sub of subPayloads) {\n if (sub.id && existingIds.has(sub.id)) {\n const { id: subId, ...rest } = sub;\n await updateSub.mutateAsync({ agentId: agentId!, subId: subId!, ...rest } as any);\n existingIds.delete(subId!);\n } else {\n const { id: _ignored, ...rest } = sub;\n await createSub.mutateAsync({ agentId: agentId!, ...rest } as any);\n }\n }\n\n for (const removedId of existingIds) {\n await deleteSub.mutateAsync({ agentId: agentId!, subId: removedId });\n }\n\n navigate(`/agents/${agentId}`);\n } catch (err: any) {\n setSaveError(err.message);\n }\n };\n\n if (!isNew && isLoading) {\n return <div className=\"animate-pulse space-y-4\"><div className=\"h-8 bg-surface-sunken rounded w-48\" /><div className=\"h-60 bg-surface-sunken rounded\" /></div>;\n }\n\n const isPending = createAgent.isPending || updateAgent.isPending;\n\n return (\n <div>\n <PageHeader\n title={isNew ? `New ${noun}` : `${noun}: ${existing?.id ?? ''}`}\n docsHash=\"#docs:agents.md\"\n />\n\n <div className=\"flex gap-10\">\n {/* Section nav — sticky left sidebar */}\n <nav className=\"w-44 shrink-0 sticky top-0 self-start pt-2\">\n <div className=\"space-y-0.5\">\n {SECTIONS.map((s) => {\n const Icon = s.icon;\n const active = section === s.id;\n return (\n <button\n key={s.id}\n onClick={() => setSection(s.id)}\n className={`w-full flex items-center gap-2.5 px-3 py-2 rounded-md text-left transition-colors ${\n active\n ? 'bg-accent/10 text-accent'\n : 'text-text-tertiary hover:text-text-primary hover:bg-surface-hover'\n }`}\n >\n <Icon className=\"w-3.5 h-3.5 shrink-0\" strokeWidth={1.5} />\n <span className=\"text-xs font-medium\">{s.label}</span>\n </button>\n );\n })}\n </div>\n\n {/* Save / Cancel — always visible */}\n <div className=\"mt-8 pt-4 border-t border-surface-border space-y-2\">\n <button\n onClick={handleSave}\n disabled={!form.name.trim() || isPending}\n className=\"w-full btn-primary text-xs disabled:opacity-50\"\n >\n {isPending ? 'Saving...' : isNew ? `Create ${noun}` : 'Save'}\n </button>\n <button\n onClick={() => navigate(isNew ? '/agents' : `/agents/${id}`)}\n className=\"w-full btn-ghost text-xs\"\n >\n Cancel\n </button>\n </div>\n\n {saveError && <p className=\"text-xs text-status-error mt-3\">{saveError}</p>}\n </nav>\n\n {/* Section content */}\n <div className=\"flex-1 min-w-0 pt-2\">\n {section === 1 && <IdentityStep form={form} set={set} />}\n {section === 2 && <MotivationStep form={form} set={set} />}\n {section === 3 && <KnowledgeStep form={form} set={set} />}\n {section === 4 && <SubscriptionsStep form={form} set={set} />}\n {section === 5 && <ScheduleStep form={form} set={set} />}\n {section === 6 && <ReviewStep form={form} />}\n </div>\n </div>\n </div>\n );\n}\n"],"names":["EMPTY_FORM","EMPTY_SUBSCRIPTION","EMPTY_SCHEDULE","agentToForm","agent","subscriptions","schedules","_b","_a","s","_c","formToAgentPayload","form","behaviors","tryParseJson","formToSubscriptionPayloads","sectionCls","labelCls","hintCls","inputCls","jsonCls","IdentityStep","set","jsxs","jsx","BookOpen","e","MotivationStep","KnowledgeStep","domainData","useListDomains","domains","d","Brain","DateValue","CapabilityCombobox","serverId","toolName","onChange","data","useCapabilities","allTools","useMemo","c","open","setOpen","useState","filter","setFilter","inputRef","useRef","containerRef","useEffect","handleClick","displayValue","filterText","filtered","q","t","selectedTool","v","Server","LABELS","ALL_TYPES","ReactionSelector","reactionType","onReactionTypeChange","workflowType","onWorkflowTypeChange","pipelineId","onPipelineIdChange","onCapabilityChange","mcpPrompt","onMcpPromptChange","availableTypes","configs","useWorkflowConfigs","invocableWorkflows","pipelineData","useYamlWorkflows","pipelines","w","rt","active","wt","p","CATEGORY_COLORS","SubscriptionsStep","topicsData","useTopics","capData","catalogTopics","selected","setSelected","updateSub","index","field","value","next","addSub","removeSub","_","i","subs","sub","isComplete","selectedCatalogEntry","Radio","Plus","Trash2","TopicCombobox","sid","tn","entry","tool","props","template","key","RunAsSelector","op","CapabilityMappingForm","Fragment","eventSchema","jsonMode","setJsonMode","required","allFields","k","fields","a","b","ai","bi","eventSuggestions","suggestions","schemaProps","def","parsed","updateField","fieldValue","resolved","isReq","desc","fieldType","currentVal","MappingFieldInput","placeholder","items","item","j","topics","catCls","CRON_PRESETS","describeCron","expr","ScheduleStep","updateSched","addSched","removeSched","scheds","sched","Clock","Section","Icon","color","title","children","Field","label","ReviewStep","Bot","Compass","EventTopicPill","WorkflowPill","CronLabel","SECTIONS","Check","AgentConfigPage","id","useParams","isNew","navigate","useNavigate","settings","useSettings","noun","existing","isLoading","useAgent","subsData","useAgentSubscriptions","createAgent","useCreateAgent","updateAgent","useUpdateAgent","createSub","useCreateSubscription","useUpdateSubscription","deleteSub","useDeleteSubscription","setForm","initialized","setInitialized","saveError","setSaveError","searchParams","setSearchParams","useSearchParams","section","setSection","useCallback","prev","f","handleSave","payload","agentId","subPayloads","existingSubs","existingIds","subId","rest","_ignored","removedId","err","isPending","PageHeader"],"mappings":"m4BAwCO,MAAMA,EAA6B,CACxC,KAAM,GACN,YAAa,GACb,MAAO,GACP,MAAO,GACP,QAAS,GACT,iBAAkB,GAClB,cAAe,CAAA,EACf,UAAW,CAAA,CACb,EAIaC,GAA4C,CACvD,MAAO,GACP,OAAQ,GACR,cAAe,UACf,cAAe,GACf,YAAa,GACb,WAAY,GACZ,UAAW,GACX,UAAW,GACX,cAAe,KACf,WAAY,GACZ,QAAS,EACX,EAEaC,GAAoC,CAC/C,KAAM,YACN,cAAe,UACf,cAAe,GACf,YAAa,GACb,UAAW,GACX,UAAW,GACX,SAAU,KACV,WAAY,EACd,EA8BO,SAASC,GACdC,EACAC,EACgB,WAEhB,MAAMC,GAAiCC,GAAAC,EAAAJ,EAAM,YAAN,YAAAI,EAAiB,YAAjB,MAAAD,EAA4B,OAC9DH,EAAM,UAAU,UAAoB,IAAKK,IAAY,CACpD,KAAMA,EAAE,MAAQ,GAChB,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