@overlordai/server 1.0.160 → 1.0.162
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/dist/notifier/notification-consumer.d.ts.map +1 -1
- package/dist/notifier/notification-consumer.js +8 -10
- package/dist/notifier/notification-consumer.js.map +1 -1
- package/dist/notifier/template.service.d.ts +2 -0
- package/dist/notifier/template.service.d.ts.map +1 -1
- package/dist/notifier/template.service.js +15 -22
- package/dist/notifier/template.service.js.map +1 -1
- package/dist/web/dashboard.service.d.ts.map +1 -1
- package/dist/web/dashboard.service.js +19 -12
- package/dist/web/dashboard.service.js.map +1 -1
- package/package.json +4 -4
- package/public/assets/{AccessTokensPage-CxvWjRaD.js → AccessTokensPage-Cz6_wrut.js} +1 -1
- package/public/assets/{AdminPage-S0jrKR6E.js → AdminPage-DXc82K3p.js} +1 -1
- package/public/assets/{AgentCliPage-uDorwo15.js → AgentCliPage-D0tQHvL4.js} +1 -1
- package/public/assets/{ApiReferencePage-Dv4MmKBP.js → ApiReferencePage-DqGWpX-4.js} +1 -1
- package/public/assets/{ArchitecturePage-BJzQXQGJ.js → ArchitecturePage-nG2w6t2E.js} +1 -1
- package/public/assets/{AuditLogPage-bVvcYeOT.js → AuditLogPage-D5gWzJ0P.js} +1 -1
- package/public/assets/{AutomationCreatePage-Ckd6nqYh.js → AutomationCreatePage-CI9vJRdR.js} +1 -1
- package/public/assets/{AutomationDetailPage-DVMOnCJt.js → AutomationDetailPage-Cwz_y--l.js} +4 -4
- package/public/assets/{AutomationEditPage-b-BIxblL.js → AutomationEditPage-PbtfID7h.js} +1 -1
- package/public/assets/AutomationListPage-hPXYhJZw.js +26 -0
- package/public/assets/{AutomationRunDetailPage-BzpdyR3G.js → AutomationRunDetailPage-XMhiza0a.js} +2 -2
- package/public/assets/{BindPlatformPage-IXtYsMly.js → BindPlatformPage-D36RKZPv.js} +1 -1
- package/public/assets/{BotIntegrationPage-CyHSAUIU.js → BotIntegrationPage-yio00YuG.js} +1 -1
- package/public/assets/BotManage-qk6JfUef.js +6 -0
- package/public/assets/{BotSetupPage-DE2HgKG3.js → BotSetupPage-gmkR4sCQ.js} +1 -1
- package/public/assets/ChangelogPage-CaqdaZNJ.js +1 -0
- package/public/assets/{CliReferencePage-Cmh8UtrY.js → CliReferencePage-BjU1I2wI.js} +1 -1
- package/public/assets/{ConfirmStageDialog-CyJKvubn.js → ConfirmStageDialog-B-iFH-TU.js} +1 -1
- package/public/assets/{DeploymentPage-DQ_eEogm.js → DeploymentPage-C3sfaalS.js} +1 -1
- package/public/assets/{DevWorkflowPage-CtPqkQ6l.js → DevWorkflowPage-DowijA3N.js} +1 -1
- package/public/assets/{DeveloperManage-BSAPces9.js → DeveloperManage-9ceYsFuk.js} +1 -1
- package/public/assets/{DeveloperSetupPage-DGs1q2NG.js → DeveloperSetupPage-BSIGPcMk.js} +1 -1
- package/public/assets/{DocsIndexPage-D5yQDCnp.js → DocsIndexPage-WiWMNYxg.js} +1 -1
- package/public/assets/{DocsLayout-D8by4Lb_.js → DocsLayout-DWqDUdXZ.js} +1 -1
- package/public/assets/{DocsPrimitives-oq1zaE5F.js → DocsPrimitives-Cbz6cuzp.js} +1 -1
- package/public/assets/{EditProjectPage-BD1wZL1a.js → EditProjectPage-D5qxTGrq.js} +1 -1
- package/public/assets/{EmptyState-Dbl97TyM.js → EmptyState-CDWpRpuV.js} +1 -1
- package/public/assets/{EnvVariablesPage-Dsw4PF-s.js → EnvVariablesPage-C9GE5IaB.js} +1 -1
- package/public/assets/{HomePage-GwOxONlH.js → HomePage-_PKSWh0s.js} +1 -1
- package/public/assets/{InfoRow-C-RV0Oka.js → InfoRow-Bv5CaTOM.js} +1 -1
- package/public/assets/{InstallationPage-DPHR8bFl.js → InstallationPage-COQWDM4q.js} +1 -1
- package/public/assets/{LandingPage-CLibhlQV.js → LandingPage-B1DfVD8p.js} +1 -1
- package/public/assets/{LocalDevelopmentPage-b97DdYXQ.js → LocalDevelopmentPage-BFmxbXTv.js} +1 -1
- package/public/assets/{LoginPage-D_vrxbPB.js → LoginPage-Clj62c3F.js} +1 -1
- package/public/assets/{MetricBar-D-aSaWwO.js → MetricBar-Bmhl0pTh.js} +1 -1
- package/public/assets/{MultiSelect-O_y5r4fT.js → MultiSelect-D3RBVEea.js} +1 -1
- package/public/assets/{NotFoundPage-zWpMyw68.js → NotFoundPage-D89IwFDt.js} +1 -1
- package/public/assets/{OnboardingGuide-CeOkWxtc.js → OnboardingGuide-D865xE8W.js} +1 -1
- package/public/assets/{PermissionsPage-DPyfUIY1.js → PermissionsPage-D8h_i4Oh.js} +1 -1
- package/public/assets/{PipelineConfigPage-DldwgiiZ.js → PipelineConfigPage-CDayqz2e.js} +1 -1
- package/public/assets/{PipelineEditorPage-ifpc4COS.js → PipelineEditorPage-rNPi0ugZ.js} +1 -1
- package/public/assets/{PlanPage-D9EvceKX.js → PlanPage-JbT0pRBJ.js} +1 -1
- package/public/assets/{ProfilePage-D1OFWv4z.js → ProfilePage-Dk92jNCk.js} +1 -1
- package/public/assets/{ProjectDetailPage-Ru0L5eGo.js → ProjectDetailPage-Cz8Crb4p.js} +1 -1
- package/public/assets/{ProjectListPage-IbCPThLe.js → ProjectListPage-BkO_mcf-.js} +1 -1
- package/public/assets/{PtyTerminal-Djq_rc8h.js → PtyTerminal-D0uP9O1B.js} +1 -1
- package/public/assets/{QuickAuth-BaFintf6.js → QuickAuth-BxTSZ3qt.js} +1 -1
- package/public/assets/{RemoveMemberConfirmDialog-B-g5e9rV.js → RemoveMemberConfirmDialog-jdeHgmJJ.js} +1 -1
- package/public/assets/{ReviewAggregatePage-BcrC6_Hk.js → ReviewAggregatePage-gpJaHX6W.js} +1 -1
- package/public/assets/{ReviewPage-C_OaoeDe.js → ReviewPage-tVq8cFas.js} +1 -1
- package/public/assets/{Select-Ch24iBMt.js → Select-4G0X2Q3W.js} +1 -1
- package/public/assets/{SettingsPage-UaFnKRVp.js → SettingsPage-CMkCiqmX.js} +1 -1
- package/public/assets/{Skeleton-DCg7UPBm.js → Skeleton-C0wXgPZt.js} +1 -1
- package/public/assets/{SkillPage-CBVxmnK9.js → SkillPage-Tf_Bw6aP.js} +1 -1
- package/public/assets/{TaskDetailPage-mXMT6XXL.js → TaskDetailPage-uF3UG0fB.js} +1 -1
- package/public/assets/{TaskGuidePage-BQJ26avd.js → TaskGuidePage-fyVoCqv6.js} +1 -1
- package/public/assets/{TaskListPage-BhMDXY0D.js → TaskListPage-BKU5VryN.js} +1 -1
- package/public/assets/{TaskStatusBadge-DV4WBIMb.js → TaskStatusBadge-BWvcwQ2v.js} +1 -1
- package/public/assets/{TerminalHomePage-De0uOWyd.js → TerminalHomePage-DiaGTNFt.js} +1 -1
- package/public/assets/{TokenManage-Cpo9QU7h.js → TokenManage-BXPfXB9B.js} +1 -1
- package/public/assets/{Tooltip-OpvOlear.js → Tooltip-COMdOkoL.js} +1 -1
- package/public/assets/{TotpSetupPage-H20UTGwd.js → TotpSetupPage-OK2Gxwpf.js} +1 -1
- package/public/assets/{WorkerDetailPage-CM1E5mwg.js → WorkerDetailPage-BeGi-NRM.js} +1 -1
- package/public/assets/{WorkerListPage-Da4uo6Ie.js → WorkerListPage-BHeNCtLo.js} +1 -1
- package/public/assets/{WorkerOperationsPage-rf-Gjoke.js → WorkerOperationsPage-BHc5o9fQ.js} +1 -1
- package/public/assets/{WorkerSetupGuidePage-CsXc3pcr.js → WorkerSetupGuidePage-DDc5PkmM.js} +1 -1
- package/public/assets/{WorkerSetupPage-n4Ago8kJ.js → WorkerSetupPage-H7o5Jy4K.js} +1 -1
- package/public/assets/{agent-type-options-DbT4qy5G.js → agent-type-options-EjFbnlSh.js} +1 -1
- package/public/assets/{arrow-left-D9HtV2zL.js → arrow-left-CLNiZlZS.js} +1 -1
- package/public/assets/{arrow-right-CDEZ_p1Q.js → arrow-right-DGiVEyFk.js} +1 -1
- package/public/assets/{bot-C1bsSvfD.js → bot-B9xkTT6o.js} +1 -1
- package/public/assets/{chevron-down-bn0Ond8n.js → chevron-down-ChzosZD0.js} +1 -1
- package/public/assets/{chevron-left-BzSDghc0.js → chevron-left-OFbFCrMn.js} +1 -1
- package/public/assets/{chevron-right-vh5yqi5l.js → chevron-right-lM0458oI.js} +1 -1
- package/public/assets/{chevron-up-DWHqCXvZ.js → chevron-up-Dd87ybnP.js} +1 -1
- package/public/assets/{circle-alert-D5BYJ3yr.js → circle-alert-C8SKuTbx.js} +1 -1
- package/public/assets/{clock-aHYz4zIT.js → clock-D8iJj9QR.js} +1 -1
- package/public/assets/{copy-1Yutpg4R.js → copy-BRzSzear.js} +1 -1
- package/public/assets/{download-DdDeD9PS.js → download-gUrPccu3.js} +1 -1
- package/public/assets/{external-link-COJ97BAU.js → external-link-Dsa5Qmn0.js} +1 -1
- package/public/assets/{git-fork-5hCW9TJA.js → git-fork-Bm1J3LCr.js} +1 -1
- package/public/assets/{index-D1YhueJk.js → index-Z2T6ck1q.js} +2 -2
- package/public/assets/index-pQSLMYLJ.css +1 -0
- package/public/assets/{key-3XOayJVa.js → key-Dp6RnU-E.js} +1 -1
- package/public/assets/{loader-circle-BB2SxY9k.js → loader-circle-CL-BZ5IE.js} +1 -1
- package/public/assets/{pencil-DFsy0iR9.js → pencil-DIHgG69z.js} +1 -1
- package/public/assets/{play-D5mtZ6I2.js → play-D9jrg8Qc.js} +1 -1
- package/public/assets/{plus-COHc-hyb.js → plus-bI3rFRiW.js} +1 -1
- package/public/assets/{rotate-ccw-DLf0EBFI.js → rotate-ccw-Brb2hK4t.js} +1 -1
- package/public/assets/{scroll-text-C5D4WrOQ.js → scroll-text-DdTxoQvv.js} +1 -1
- package/public/assets/{settings-gWsQONIu.js → settings-Y8RhS59b.js} +1 -1
- package/public/assets/{skip-forward-CsmkFtlk.js → skip-forward-DLl2Lm6x.js} +1 -1
- package/public/assets/{status-colors-adoNbhKM.js → status-colors-f3zLnx2a.js} +1 -1
- package/public/assets/{task-agent-HpWH7Tib.js → task-agent-DmCoOKYB.js} +1 -1
- package/public/assets/{task-constants-BZhmnuZe.js → task-constants-96s9uX9D.js} +1 -1
- package/public/assets/{task.store-DnD12VNZ.js → task.store-WfiFG9s9.js} +1 -1
- package/public/assets/{timer-BdGB8vr5.js → timer-Btkw5jG2.js} +1 -1
- package/public/assets/{trash-2-CBaNAvms.js → trash-2-Dh9HvXnr.js} +1 -1
- package/public/assets/{useFetch-NHu516ED.js → useFetch-DKpzQTs3.js} +1 -1
- package/public/assets/{users-D8pktWAj.js → users-CyHoo5aW.js} +1 -1
- package/public/assets/{wifi-DqVPGJ9j.js → wifi-TUicRn1y.js} +1 -1
- package/public/assets/{workflow-D_fJbE6W.js → workflow-B2wc2Qq1.js} +1 -1
- package/public/assets/{zap-kbETrVz8.js → zap-CjhTaRfz.js} +1 -1
- package/public/index.html +2 -2
- package/public/sw.js +1 -1
- package/public/assets/AutomationListPage-DAlzP8xj.js +0 -26
- package/public/assets/BotManage-xGu7Xasl.js +0 -6
- package/public/assets/ChangelogPage-B5Qv4_18.js +0 -1
- package/public/assets/index-CULr4DFs.css +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as e}from"./index-D1YhueJk.js";import{a as s}from"./DocsPrimitives-oq1zaE5F.js";import"./copy-1Yutpg4R.js";function d(){return e.jsx("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// agent cli integration"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["overlord supports three ai agent clis. each project configures an ",e.jsx("code",{className:"text-[var(--accent)]",children:"agent_type"})," that determines which cli the worker uses to execute tasks. the prompt is written to pty stdin after the cli starts — not passed as a cli argument."]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// supported agents"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"agent"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"cli binary"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"config value"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"subscription"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"claude code"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"claude"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"claude"})}),e.jsx("td",{className:"px-3 py-2",children:"anthropic / claude"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"cursor agent"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"agent"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"cursor"})}),e.jsx("td",{className:"px-3 py-2",children:"cursor"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:"openai codex"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"codex"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"codex"})}),e.jsx("td",{className:"px-3 py-2",children:"openai"})]})]})]})}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// the cursor agent cli binary is ",e.jsx("code",{className:"text-[var(--accent)]",children:"agent"}),", not ",e.jsx("code",{className:"text-[var(--accent)]",children:"cursor"}),". the config value ",e.jsx("code",{className:"text-[var(--accent)]",children:"cursor"})," maps to the ",e.jsx("code",{className:"text-[var(--accent)]",children:"agent"})," binary."]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// permission strategy"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["all agents run in fully automated mode by default. the ",e.jsx("code",{className:"text-[var(--accent)]",children:"allowedTools"})," project config controls the permission level:"]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"allowedTools"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"claude"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"cursor"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"codex"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"null (default)"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--dangerously-skip-permissions"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--yolo --approve-mcps"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--dangerously-bypass-approvals-and-sandbox"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"specific value"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--allowedTools <value>"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--yolo --approve-mcps"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--full-auto"})})]})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// cli flag mapping"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--accent)]",children:"claude code"}),e.jsx(s,{code:"claude --dangerously-skip-permissions [--allowedTools <tools>] [--plugin-dir <path>]"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"config field"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"cli flag"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"notes"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"allowedTools"})}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("code",{children:"--allowedTools"})," or ",e.jsx("code",{children:"--dangerously-skip-permissions"})]}),e.jsx("td",{className:"px-3 py-2",children:"see permission strategy"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"skillsPath"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{children:"--plugin-dir <path>"})}),e.jsx("td",{className:"px-3 py-2",children:"load custom skills/plugins"})]})]})]})}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["environment: symlinks ",e.jsx("code",{className:"text-[var(--accent)]",children:".claude.json"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:".credentials.json"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:"settings.json"})," from real home. pre-trusts worktree in ",e.jsx("code",{className:"text-[var(--accent)]",children:"trustedDirectories"}),"."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--accent)]",children:"cursor agent"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--warning)]/30 bg-[var(--warning)]/5 px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--warning)]",children:'⚠ macos limitation: cursor agent stores auth tokens in macos keychain, which requires a gui login session. headless workers (launchd/ssh) cannot access keychain and will fail with "keychain operation timed out". cursor agent is currently only supported on linux workers.'})}),e.jsx(s,{code:"agent --yolo --approve-mcps"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"flag"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"purpose"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{children:"--yolo"})}),e.jsx("td",{className:"px-3 py-2",children:"skip all confirmation prompts (alias for --force)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"line-through opacity-50",children:"--trust"})}),e.jsx("td",{className:"px-3 py-2",children:"removed — only works in headless/print mode. trust is auto-accepted via pty."})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{children:"--approve-mcps"})}),e.jsx("td",{className:"px-3 py-2",children:"auto-approve mcp servers"})]})]})]})}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["environment: relies on workspace-manager's xdg ",e.jsx("code",{className:"text-[var(--accent)]",children:".config/"})," symlink."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--accent)]",children:"openai codex"}),e.jsx(s,{code:"codex --dangerously-bypass-approvals-and-sandbox"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"config field"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"cli flag"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"notes"})]})}),e.jsx("tbody",{className:"text-[var(--text-secondary)]",children:e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"allowedTools"})}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("code",{children:"--dangerously-bypass-approvals-and-sandbox"})," or ",e.jsx("code",{children:"--full-auto"})]}),e.jsx("td",{className:"px-3 py-2",children:"see permission strategy"})]})})]})}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["environment: symlinks ",e.jsx("code",{className:"text-[var(--accent)]",children:"~/.codex"})," directory if it exists."]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// configsnapshot fields"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"project-level config fields passed to executors:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"field"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"type"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"used by"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"description"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"agentType"})}),e.jsx("td",{className:"px-3 py-2",children:"claude | cursor | codex"}),e.jsx("td",{className:"px-3 py-2",children:"all"}),e.jsx("td",{className:"px-3 py-2",children:"which cli to spawn"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"allowedTools"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"claude, codex"}),e.jsx("td",{className:"px-3 py-2",children:"permission strategy control"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"skillsPath"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"claude"}),e.jsx("td",{className:"px-3 py-2",children:"plugin directory path"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"maxTurns"})}),e.jsx("td",{className:"px-3 py-2",children:"number"}),e.jsx("td",{className:"px-3 py-2",children:"stage monitor"}),e.jsx("td",{className:"px-3 py-2",children:"max stage retry loops"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"pipeline"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"pipeline compiler"}),e.jsx("td",{className:"px-3 py-2",children:"custom pipeline json (null = default 6-stage)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"agentEnv"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"worker"}),e.jsx("td",{className:"px-3 py-2",children:"extra env vars json merged into pty env"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"setupCommands"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"worker"}),e.jsx("td",{className:"px-3 py-2",children:"json array of shell commands run before agent starts (120s timeout each)"})]})]})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// git hooks"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["worker creates isolated git worktrees for each task. by default, project-level git hooks (husky, lefthook, etc.) are not installed because ",e.jsx("code",{className:"text-[var(--accent)]",children:"npm install"})," is not run automatically. use the project's ",e.jsx("code",{className:"text-[var(--accent)]",children:"setupCommands"})," field to install hooks before the agent starts."]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"hook tool"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"setupCommands"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"husky"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:'["npm install", "npx husky install"]'})})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"lefthook"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:'["npm install", "npx lefthook install"]'})})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"simple-git-hooks"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:'["npm install", "npx simple-git-hooks"]'})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:"native (.githooks/)"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:'["git config core.hooksPath .githooks"]'})})]})]})]})}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["the lightest option is native git hooks — commit hook scripts to a ",e.jsx("code",{className:"text-[var(--accent)]",children:".githooks/"})," directory in your repo, then use a single ",e.jsx("code",{className:"text-[var(--accent)]",children:"git config"})," command. no ",e.jsx("code",{className:"text-[var(--accent)]",children:"npm install"})," needed."]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// capability detection"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers auto-detect installed agent clis on startup and report capabilities to the server. if a capability degrades at runtime (auth failure, rate limit), the server temporarily removes it. it auto-recovers when the next task execution succeeds."}),e.jsx(s,{code:`which claude && claude --version → capability: 'claude'
|
|
1
|
+
import{j as e}from"./index-Z2T6ck1q.js";import{a as s}from"./DocsPrimitives-Cbz6cuzp.js";import"./copy-BRzSzear.js";function d(){return e.jsx("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// agent cli integration"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["overlord supports three ai agent clis. each project configures an ",e.jsx("code",{className:"text-[var(--accent)]",children:"agent_type"})," that determines which cli the worker uses to execute tasks. the prompt is written to pty stdin after the cli starts — not passed as a cli argument."]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// supported agents"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"agent"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"cli binary"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"config value"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"subscription"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"claude code"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"claude"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"claude"})}),e.jsx("td",{className:"px-3 py-2",children:"anthropic / claude"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"cursor agent"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"agent"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"cursor"})}),e.jsx("td",{className:"px-3 py-2",children:"cursor"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:"openai codex"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"codex"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"codex"})}),e.jsx("td",{className:"px-3 py-2",children:"openai"})]})]})]})}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// the cursor agent cli binary is ",e.jsx("code",{className:"text-[var(--accent)]",children:"agent"}),", not ",e.jsx("code",{className:"text-[var(--accent)]",children:"cursor"}),". the config value ",e.jsx("code",{className:"text-[var(--accent)]",children:"cursor"})," maps to the ",e.jsx("code",{className:"text-[var(--accent)]",children:"agent"})," binary."]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// permission strategy"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["all agents run in fully automated mode by default. the ",e.jsx("code",{className:"text-[var(--accent)]",children:"allowedTools"})," project config controls the permission level:"]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"allowedTools"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"claude"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"cursor"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"codex"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"null (default)"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--dangerously-skip-permissions"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--yolo --approve-mcps"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--dangerously-bypass-approvals-and-sandbox"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"specific value"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--allowedTools <value>"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--yolo --approve-mcps"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"--full-auto"})})]})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// cli flag mapping"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--accent)]",children:"claude code"}),e.jsx(s,{code:"claude --dangerously-skip-permissions [--allowedTools <tools>] [--plugin-dir <path>]"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"config field"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"cli flag"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"notes"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"allowedTools"})}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("code",{children:"--allowedTools"})," or ",e.jsx("code",{children:"--dangerously-skip-permissions"})]}),e.jsx("td",{className:"px-3 py-2",children:"see permission strategy"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"skillsPath"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{children:"--plugin-dir <path>"})}),e.jsx("td",{className:"px-3 py-2",children:"load custom skills/plugins"})]})]})]})}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["environment: symlinks ",e.jsx("code",{className:"text-[var(--accent)]",children:".claude.json"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:".credentials.json"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:"settings.json"})," from real home. pre-trusts worktree in ",e.jsx("code",{className:"text-[var(--accent)]",children:"trustedDirectories"}),"."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--accent)]",children:"cursor agent"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--warning)]/30 bg-[var(--warning)]/5 px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--warning)]",children:'⚠ macos limitation: cursor agent stores auth tokens in macos keychain, which requires a gui login session. headless workers (launchd/ssh) cannot access keychain and will fail with "keychain operation timed out". cursor agent is currently only supported on linux workers.'})}),e.jsx(s,{code:"agent --yolo --approve-mcps"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"flag"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"purpose"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{children:"--yolo"})}),e.jsx("td",{className:"px-3 py-2",children:"skip all confirmation prompts (alias for --force)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"line-through opacity-50",children:"--trust"})}),e.jsx("td",{className:"px-3 py-2",children:"removed — only works in headless/print mode. trust is auto-accepted via pty."})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{children:"--approve-mcps"})}),e.jsx("td",{className:"px-3 py-2",children:"auto-approve mcp servers"})]})]})]})}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["environment: relies on workspace-manager's xdg ",e.jsx("code",{className:"text-[var(--accent)]",children:".config/"})," symlink."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--accent)]",children:"openai codex"}),e.jsx(s,{code:"codex --dangerously-bypass-approvals-and-sandbox"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"config field"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"cli flag"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"notes"})]})}),e.jsx("tbody",{className:"text-[var(--text-secondary)]",children:e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"allowedTools"})}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("code",{children:"--dangerously-bypass-approvals-and-sandbox"})," or ",e.jsx("code",{children:"--full-auto"})]}),e.jsx("td",{className:"px-3 py-2",children:"see permission strategy"})]})})]})}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["environment: symlinks ",e.jsx("code",{className:"text-[var(--accent)]",children:"~/.codex"})," directory if it exists."]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// configsnapshot fields"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"project-level config fields passed to executors:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"field"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"type"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"used by"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"description"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"agentType"})}),e.jsx("td",{className:"px-3 py-2",children:"claude | cursor | codex"}),e.jsx("td",{className:"px-3 py-2",children:"all"}),e.jsx("td",{className:"px-3 py-2",children:"which cli to spawn"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"allowedTools"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"claude, codex"}),e.jsx("td",{className:"px-3 py-2",children:"permission strategy control"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"skillsPath"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"claude"}),e.jsx("td",{className:"px-3 py-2",children:"plugin directory path"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"maxTurns"})}),e.jsx("td",{className:"px-3 py-2",children:"number"}),e.jsx("td",{className:"px-3 py-2",children:"stage monitor"}),e.jsx("td",{className:"px-3 py-2",children:"max stage retry loops"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"pipeline"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"pipeline compiler"}),e.jsx("td",{className:"px-3 py-2",children:"custom pipeline json (null = default 6-stage)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"agentEnv"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"worker"}),e.jsx("td",{className:"px-3 py-2",children:"extra env vars json merged into pty env"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"setupCommands"})}),e.jsx("td",{className:"px-3 py-2",children:"string | null"}),e.jsx("td",{className:"px-3 py-2",children:"worker"}),e.jsx("td",{className:"px-3 py-2",children:"json array of shell commands run before agent starts (120s timeout each)"})]})]})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// git hooks"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["worker creates isolated git worktrees for each task. by default, project-level git hooks (husky, lefthook, etc.) are not installed because ",e.jsx("code",{className:"text-[var(--accent)]",children:"npm install"})," is not run automatically. use the project's ",e.jsx("code",{className:"text-[var(--accent)]",children:"setupCommands"})," field to install hooks before the agent starts."]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"hook tool"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"setupCommands"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"husky"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:'["npm install", "npx husky install"]'})})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"lefthook"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:'["npm install", "npx lefthook install"]'})})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"simple-git-hooks"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:'["npm install", "npx simple-git-hooks"]'})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:"native (.githooks/)"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:'["git config core.hooksPath .githooks"]'})})]})]})]})}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["the lightest option is native git hooks — commit hook scripts to a ",e.jsx("code",{className:"text-[var(--accent)]",children:".githooks/"})," directory in your repo, then use a single ",e.jsx("code",{className:"text-[var(--accent)]",children:"git config"})," command. no ",e.jsx("code",{className:"text-[var(--accent)]",children:"npm install"})," needed."]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// capability detection"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers auto-detect installed agent clis on startup and report capabilities to the server. if a capability degrades at runtime (auth failure, rate limit), the server temporarily removes it. it auto-recovers when the next task execution succeeds."}),e.jsx(s,{code:`which claude && claude --version → capability: 'claude'
|
|
2
2
|
which agent && agent --version → capability: 'cursor'
|
|
3
3
|
which codex && codex --version → capability: 'codex'`})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// default pipeline"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the default pipeline has 7 stages:"}),e.jsx("div",{className:"flex flex-wrap items-center gap-1 text-xs",children:["implement","test","verify","review","simplify","rebase","submit"].map((a,t)=>e.jsxs("span",{children:[e.jsx("code",{className:"rounded-[4px] bg-[var(--bg-primary)] px-2 py-0.5 text-[var(--accent)]",children:a}),t<6&&e.jsx("span",{className:"mx-1 text-[var(--text-muted)]",children:"→"})]},a))}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["the ",e.jsx("code",{className:"text-[var(--accent)]",children:"verify"})," and ",e.jsx("code",{className:"text-[var(--accent)]",children:"review"})," stages loop back to ",e.jsx("code",{className:"text-[var(--accent)]",children:"implement"})," on failure (max 3 loops). the ",e.jsx("code",{className:"text-[var(--accent)]",children:"simplify"})," and ",e.jsx("code",{className:"text-[var(--accent)]",children:"rebase"})," stages loop back to themselves on failure (max 3 loops)."]})]})]})})}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as d,a as o,x as p,r as n,j as t}from"./index-D1YhueJk.js";import{Q as c}from"./QuickAuth-BaFintf6.js";import{P as h}from"./plus-COHc-hyb.js";import"./copy-1Yutpg4R.js";const l={GET:"text-green-400",POST:"text-blue-400",PUT:"text-yellow-400",DELETE:"text-red-400"},m=[{title:"authentication",prefix:"/api/auth",endpoints:[{method:"POST",path:"/login",description:"authenticate with username + password (optional totpCode)",auth:"none",body:'{ "username": "string", "password": "string", "totpCode?": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/refresh",description:"refresh access token (rotates refresh token)",auth:"none",body:'{ "refreshToken": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/logout",description:"invalidate refresh token",auth:"jwt",body:'{ "refreshToken": "string" }'}]},{title:"tasks",prefix:"/api/web/tasks",endpoints:[{method:"GET",path:"",description:"list tasks with optional filters",auth:"jwt",response:'[ { "id": 1, "description": "...", "status": "RUNNING", ... } ]'},{method:"POST",path:"",description:"create a new task (name is AI-generated if LLM is configured, otherwise null)",auth:"jwt",body:'{ "projectKey": "string", "description": "string", "workerId?": "string", "taskType?": "feat|fix|refactor|docs|chore", "branchSlug?": "string", "targetBranch?": "string" }',response:'{ "id": 1, "description": "...", "name": "string | null", "branchSlug": "string | null", "status": "PENDING", ... }'},{method:"GET",path:"/:id",description:"get task details",auth:"jwt"},{method:"POST",path:"/:id/cancel",description:"cancel a running task",auth:"jwt"},{method:"POST",path:"/:id/retry",description:"retry a failed or cancelled task",auth:"jwt"},{method:"POST",path:"/:id/confirm-stage",description:"confirm/choose/input for suspended stage",auth:"jwt",body:'{ "stageIndex": "number", "result": "string" }'},{method:"POST",path:"/:id/pty-token",description:"get pty websocket token",auth:"jwt"}]},{title:"workers",prefix:"/api/web/workers",endpoints:[{method:"GET",path:"",description:"list all workers",auth:"jwt"},{method:"GET",path:"/:id",description:"get worker details",auth:"jwt"},{method:"GET",path:"/:id/tasks",description:"list tasks assigned to a worker",auth:"jwt"},{method:"POST",path:"/:id/drain",description:"start draining a worker",auth:"jwt"},{method:"POST",path:"/:id/undrain",description:"cancel worker drain",auth:"jwt"}]},{title:"projects",prefix:"/api/web/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"GET",path:"/:key",description:"get project details",auth:"jwt"}]},{title:"profile",prefix:"/api/web/profile",endpoints:[{method:"GET",path:"",description:"get current user profile",auth:"jwt"},{method:"PUT",path:"",description:"update profile (gitName, gitEmail)",auth:"jwt",body:'{ "gitName?": "string", "gitEmail?": "string" }'},{method:"PUT",path:"/password",description:"change password",auth:"jwt",body:'{ "currentPassword": "string", "newPassword": "string" }'},{method:"POST",path:"/totp/setup",description:"initialize totp setup",auth:"jwt"},{method:"POST",path:"/totp/verify",description:"verify totp setup code",auth:"jwt",body:'{ "code": "string" }'},{method:"GET",path:"/tokens",description:"list personal access tokens",auth:"jwt"},{method:"POST",path:"/tokens",description:"create a personal access token",auth:"jwt",body:'{ "label": "string", "expiresAt?": "string" }'},{method:"POST",path:"/tokens/:id/revoke",description:"revoke a token",auth:"jwt"},{method:"POST",path:"/bind-platform",description:"link a chat platform account using a one-time bind token",auth:"jwt",body:'{ "token": "string" }',response:'{ "success": true, "platform": "lark" }'}]},{title:"workspaces & tunnels",prefix:"/api/web",endpoints:[{method:"GET",path:"/workspaces/:taskId",description:"get workspace for a task",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/start",description:"start a cursor remote tunnel",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/stop",description:"stop a running tunnel",auth:"jwt"},{method:"GET",path:"/workspace-tunnel/:taskId/status",description:"get tunnel status",auth:"jwt"}]},{title:"dashboard",prefix:"/api/web/dashboard",endpoints:[{method:"GET",path:"/stats",description:"get dashboard statistics",auth:"jwt"},{method:"GET",path:"/recent-tasks",description:"get recent tasks for dashboard",auth:"jwt"},{method:"GET",path:"/recent-activity",description:"get recent activity feed",auth:"jwt"}]},{title:"notifications",prefix:"/api/web/notifications",endpoints:[{method:"GET",path:"",description:"list notifications with cursor pagination",auth:"jwt"},{method:"POST",path:"/:id/read",description:"mark a notification as read",auth:"jwt"},{method:"POST",path:"/read-all",description:"mark all notifications as read",auth:"jwt"}]},{title:"search",prefix:"/api/web",endpoints:[{method:"GET",path:"/search?q=query",description:"global search across tasks, workers, projects",auth:"jwt"}]},{title:"admin — developers",prefix:"/api/admin/developers",endpoints:[{method:"GET",path:"",description:"list all developers",auth:"jwt"},{method:"POST",path:"",description:"create a developer",auth:"jwt",body:'{ "name": "string", "password": "string", "role": "string", "gitName": "string", "gitEmail": "string" }'},{method:"PUT",path:"/:id",description:"update developer",auth:"jwt"},{method:"PUT",path:"/:id/reset-totp",description:"reset developer totp",auth:"jwt"}]},{title:"admin — projects",prefix:"/api/admin/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"POST",path:"",description:"create a project",auth:"jwt"},{method:"PUT",path:"/:key",description:"update project (including pipeline)",auth:"jwt"},{method:"DELETE",path:"/:key",description:"delete a project",auth:"jwt"},{method:"GET",path:"/:key/members",description:"get project members",auth:"jwt"},{method:"POST",path:"/:key/members",description:"add project member",auth:"jwt"},{method:"DELETE",path:"/:key/members?developerId=N",description:"remove project member",auth:"jwt"}]},{title:"admin — worker tokens",prefix:"/api/admin/worker-tokens",endpoints:[{method:"GET",path:"",description:"list all worker enrollment tokens",auth:"jwt"},{method:"POST",path:"",description:"generate a new worker token",auth:"jwt"},{method:"POST",path:"/:id/revoke",description:"revoke a worker token",auth:"jwt"},{method:"GET",path:"/:id/status",description:"get token status and linked worker",auth:"jwt"}]},{title:"admin — workers",prefix:"/api/admin/workers",endpoints:[{method:"GET",path:"",description:"list all workers (admin)",auth:"jwt"},{method:"PUT",path:"/:id",description:"update worker status",auth:"jwt",body:'{ "status?": "string" }'}]},{title:"admin — bots",prefix:"/api/admin/bots",endpoints:[{method:"GET",path:"",description:"list bot instances",auth:"jwt"},{method:"POST",path:"",description:"create a bot instance",auth:"jwt"},{method:"GET",path:"/:id/bindings",description:"get group bindings for a bot",auth:"jwt"},{method:"POST",path:"/:id/bindings",description:"create a group binding",auth:"jwt"},{method:"DELETE",path:"/:id/bindings",description:"delete a group binding",auth:"jwt"}]},{title:"admin — audit & settings",prefix:"/api/admin",endpoints:[{method:"GET",path:"/audit-logs",description:"query audit log with filters",auth:"jwt"},{method:"GET",path:"/settings",description:"get all system settings",auth:"jwt"},{method:"PUT",path:"/settings",description:"update system settings",auth:"jwt"}]},{title:"websocket",prefix:"",endpoints:[{method:"GET",path:"WS /ws/pty/:taskId",description:'pty terminal websocket — first obtain a channel token via POST /api/web/tasks/:taskId/pty-token, then send an auth frame after connection: { type: "auth", token: "<jwt>", channelToken: "<channel-token>" }',auth:"jwt"},{method:"GET",path:"WS /api/workers/pty/:taskId",description:'worker pty websocket — auth via frame: { type: "auth", workerJwt: "<worker-jwt>", channelToken: "<channel-token>" }',auth:"worker-token"}]}];function u({ep:e,prefix:a}){const[s,r]=n.useState(!1),{t:i}=o();return t.jsxs("div",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[t.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 sm:gap-3 px-3 md:px-4 py-2.5 text-left transition-colors hover:bg-[var(--bg-input)] min-w-0",onClick:()=>r(!s),children:[t.jsx("span",{className:`w-12 shrink-0 text-xs font-bold ${l[e.method]}`,children:e.method}),t.jsxs("code",{className:"flex-1 text-xs text-[var(--text-primary)] truncate min-w-0",children:[a,e.path]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)] hidden sm:inline truncate max-w-[200px]",children:["// ",e.description]})]}),s&&t.jsxs("div",{className:"border-t border-[var(--border-row)] bg-[var(--bg-primary)] px-3 md:px-4 py-3 space-y-2",children:[t.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// ",e.description]}),t.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[t.jsx("span",{className:"text-[var(--text-muted)]",children:"auth:"}),t.jsx("span",{className:e.auth==="none"?"text-[var(--text-muted)]":"text-[var(--accent)]",children:e.auth})]}),e.body&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:i("docs.request_body")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.body})]}),e.response&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:i("docs.response")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.response})]})]})]})}function g(){const e=d(),{t:a}=o();return p(n.useMemo(()=>t.jsxs("button",{onClick:()=>e("/access-tokens"),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[t.jsx(h,{className:"h-3.5 w-3.5"}),a("access_tokens.create_token")]}),[e,a])),t.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[t.jsx("div",{className:"mb-8",children:t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("docs.api_base_url_desc",{url:"http://localhost:9000"})})}),t.jsx(c,{mode:"api"}),t.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("docs.authentication")}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"jwt"}),t.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["obtained via /api/auth/login — pass as ",t.jsx("code",{children:"authorization: bearer <token>"})]})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"pat"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"personal access token — same header format, for cli/api usage"})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-yellow-400",children:"worker-token"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"enrollment token for worker registration — used during initial handshake"})]})]}),t.jsx("div",{className:"space-y-6",children:m.map(s=>t.jsxs("div",{children:[t.jsxs("h2",{className:"mb-2 text-sm text-[var(--accent)]",children:["> ",s.title]}),t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:s.endpoints.map((r,i)=>t.jsx(u,{ep:r,prefix:s.prefix},`${r.method}-${r.path}-${i}`))})]},s.title))})]})}export{g as default};
|
|
1
|
+
import{f as d,a as o,x as p,r as n,j as t}from"./index-Z2T6ck1q.js";import{Q as c}from"./QuickAuth-BxTSZ3qt.js";import{P as h}from"./plus-bI3rFRiW.js";import"./copy-BRzSzear.js";const l={GET:"text-green-400",POST:"text-blue-400",PUT:"text-yellow-400",DELETE:"text-red-400"},m=[{title:"authentication",prefix:"/api/auth",endpoints:[{method:"POST",path:"/login",description:"authenticate with username + password (optional totpCode)",auth:"none",body:'{ "username": "string", "password": "string", "totpCode?": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/refresh",description:"refresh access token (rotates refresh token)",auth:"none",body:'{ "refreshToken": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/logout",description:"invalidate refresh token",auth:"jwt",body:'{ "refreshToken": "string" }'}]},{title:"tasks",prefix:"/api/web/tasks",endpoints:[{method:"GET",path:"",description:"list tasks with optional filters",auth:"jwt",response:'[ { "id": 1, "description": "...", "status": "RUNNING", ... } ]'},{method:"POST",path:"",description:"create a new task (name is AI-generated if LLM is configured, otherwise null)",auth:"jwt",body:'{ "projectKey": "string", "description": "string", "workerId?": "string", "taskType?": "feat|fix|refactor|docs|chore", "branchSlug?": "string", "targetBranch?": "string" }',response:'{ "id": 1, "description": "...", "name": "string | null", "branchSlug": "string | null", "status": "PENDING", ... }'},{method:"GET",path:"/:id",description:"get task details",auth:"jwt"},{method:"POST",path:"/:id/cancel",description:"cancel a running task",auth:"jwt"},{method:"POST",path:"/:id/retry",description:"retry a failed or cancelled task",auth:"jwt"},{method:"POST",path:"/:id/confirm-stage",description:"confirm/choose/input for suspended stage",auth:"jwt",body:'{ "stageIndex": "number", "result": "string" }'},{method:"POST",path:"/:id/pty-token",description:"get pty websocket token",auth:"jwt"}]},{title:"workers",prefix:"/api/web/workers",endpoints:[{method:"GET",path:"",description:"list all workers",auth:"jwt"},{method:"GET",path:"/:id",description:"get worker details",auth:"jwt"},{method:"GET",path:"/:id/tasks",description:"list tasks assigned to a worker",auth:"jwt"},{method:"POST",path:"/:id/drain",description:"start draining a worker",auth:"jwt"},{method:"POST",path:"/:id/undrain",description:"cancel worker drain",auth:"jwt"}]},{title:"projects",prefix:"/api/web/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"GET",path:"/:key",description:"get project details",auth:"jwt"}]},{title:"profile",prefix:"/api/web/profile",endpoints:[{method:"GET",path:"",description:"get current user profile",auth:"jwt"},{method:"PUT",path:"",description:"update profile (gitName, gitEmail)",auth:"jwt",body:'{ "gitName?": "string", "gitEmail?": "string" }'},{method:"PUT",path:"/password",description:"change password",auth:"jwt",body:'{ "currentPassword": "string", "newPassword": "string" }'},{method:"POST",path:"/totp/setup",description:"initialize totp setup",auth:"jwt"},{method:"POST",path:"/totp/verify",description:"verify totp setup code",auth:"jwt",body:'{ "code": "string" }'},{method:"GET",path:"/tokens",description:"list personal access tokens",auth:"jwt"},{method:"POST",path:"/tokens",description:"create a personal access token",auth:"jwt",body:'{ "label": "string", "expiresAt?": "string" }'},{method:"POST",path:"/tokens/:id/revoke",description:"revoke a token",auth:"jwt"},{method:"POST",path:"/bind-platform",description:"link a chat platform account using a one-time bind token",auth:"jwt",body:'{ "token": "string" }',response:'{ "success": true, "platform": "lark" }'}]},{title:"workspaces & tunnels",prefix:"/api/web",endpoints:[{method:"GET",path:"/workspaces/:taskId",description:"get workspace for a task",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/start",description:"start a cursor remote tunnel",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/stop",description:"stop a running tunnel",auth:"jwt"},{method:"GET",path:"/workspace-tunnel/:taskId/status",description:"get tunnel status",auth:"jwt"}]},{title:"dashboard",prefix:"/api/web/dashboard",endpoints:[{method:"GET",path:"/stats",description:"get dashboard statistics",auth:"jwt"},{method:"GET",path:"/recent-tasks",description:"get recent tasks for dashboard",auth:"jwt"},{method:"GET",path:"/recent-activity",description:"get recent activity feed",auth:"jwt"}]},{title:"notifications",prefix:"/api/web/notifications",endpoints:[{method:"GET",path:"",description:"list notifications with cursor pagination",auth:"jwt"},{method:"POST",path:"/:id/read",description:"mark a notification as read",auth:"jwt"},{method:"POST",path:"/read-all",description:"mark all notifications as read",auth:"jwt"}]},{title:"search",prefix:"/api/web",endpoints:[{method:"GET",path:"/search?q=query",description:"global search across tasks, workers, projects",auth:"jwt"}]},{title:"admin — developers",prefix:"/api/admin/developers",endpoints:[{method:"GET",path:"",description:"list all developers",auth:"jwt"},{method:"POST",path:"",description:"create a developer",auth:"jwt",body:'{ "name": "string", "password": "string", "role": "string", "gitName": "string", "gitEmail": "string" }'},{method:"PUT",path:"/:id",description:"update developer",auth:"jwt"},{method:"PUT",path:"/:id/reset-totp",description:"reset developer totp",auth:"jwt"}]},{title:"admin — projects",prefix:"/api/admin/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"POST",path:"",description:"create a project",auth:"jwt"},{method:"PUT",path:"/:key",description:"update project (including pipeline)",auth:"jwt"},{method:"DELETE",path:"/:key",description:"delete a project",auth:"jwt"},{method:"GET",path:"/:key/members",description:"get project members",auth:"jwt"},{method:"POST",path:"/:key/members",description:"add project member",auth:"jwt"},{method:"DELETE",path:"/:key/members?developerId=N",description:"remove project member",auth:"jwt"}]},{title:"admin — worker tokens",prefix:"/api/admin/worker-tokens",endpoints:[{method:"GET",path:"",description:"list all worker enrollment tokens",auth:"jwt"},{method:"POST",path:"",description:"generate a new worker token",auth:"jwt"},{method:"POST",path:"/:id/revoke",description:"revoke a worker token",auth:"jwt"},{method:"GET",path:"/:id/status",description:"get token status and linked worker",auth:"jwt"}]},{title:"admin — workers",prefix:"/api/admin/workers",endpoints:[{method:"GET",path:"",description:"list all workers (admin)",auth:"jwt"},{method:"PUT",path:"/:id",description:"update worker status",auth:"jwt",body:'{ "status?": "string" }'}]},{title:"admin — bots",prefix:"/api/admin/bots",endpoints:[{method:"GET",path:"",description:"list bot instances",auth:"jwt"},{method:"POST",path:"",description:"create a bot instance",auth:"jwt"},{method:"GET",path:"/:id/bindings",description:"get group bindings for a bot",auth:"jwt"},{method:"POST",path:"/:id/bindings",description:"create a group binding",auth:"jwt"},{method:"DELETE",path:"/:id/bindings",description:"delete a group binding",auth:"jwt"}]},{title:"admin — audit & settings",prefix:"/api/admin",endpoints:[{method:"GET",path:"/audit-logs",description:"query audit log with filters",auth:"jwt"},{method:"GET",path:"/settings",description:"get all system settings",auth:"jwt"},{method:"PUT",path:"/settings",description:"update system settings",auth:"jwt"}]},{title:"websocket",prefix:"",endpoints:[{method:"GET",path:"WS /ws/pty/:taskId",description:'pty terminal websocket — first obtain a channel token via POST /api/web/tasks/:taskId/pty-token, then send an auth frame after connection: { type: "auth", token: "<jwt>", channelToken: "<channel-token>" }',auth:"jwt"},{method:"GET",path:"WS /api/workers/pty/:taskId",description:'worker pty websocket — auth via frame: { type: "auth", workerJwt: "<worker-jwt>", channelToken: "<channel-token>" }',auth:"worker-token"}]}];function u({ep:e,prefix:a}){const[s,r]=n.useState(!1),{t:i}=o();return t.jsxs("div",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[t.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 sm:gap-3 px-3 md:px-4 py-2.5 text-left transition-colors hover:bg-[var(--bg-input)] min-w-0",onClick:()=>r(!s),children:[t.jsx("span",{className:`w-12 shrink-0 text-xs font-bold ${l[e.method]}`,children:e.method}),t.jsxs("code",{className:"flex-1 text-xs text-[var(--text-primary)] truncate min-w-0",children:[a,e.path]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)] hidden sm:inline truncate max-w-[200px]",children:["// ",e.description]})]}),s&&t.jsxs("div",{className:"border-t border-[var(--border-row)] bg-[var(--bg-primary)] px-3 md:px-4 py-3 space-y-2",children:[t.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// ",e.description]}),t.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[t.jsx("span",{className:"text-[var(--text-muted)]",children:"auth:"}),t.jsx("span",{className:e.auth==="none"?"text-[var(--text-muted)]":"text-[var(--accent)]",children:e.auth})]}),e.body&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:i("docs.request_body")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.body})]}),e.response&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:i("docs.response")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.response})]})]})]})}function g(){const e=d(),{t:a}=o();return p(n.useMemo(()=>t.jsxs("button",{onClick:()=>e("/access-tokens"),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[t.jsx(h,{className:"h-3.5 w-3.5"}),a("access_tokens.create_token")]}),[e,a])),t.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[t.jsx("div",{className:"mb-8",children:t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("docs.api_base_url_desc",{url:"http://localhost:9000"})})}),t.jsx(c,{mode:"api"}),t.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("docs.authentication")}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"jwt"}),t.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["obtained via /api/auth/login — pass as ",t.jsx("code",{children:"authorization: bearer <token>"})]})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"pat"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"personal access token — same header format, for cli/api usage"})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-yellow-400",children:"worker-token"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"enrollment token for worker registration — used during initial handshake"})]})]}),t.jsx("div",{className:"space-y-6",children:m.map(s=>t.jsxs("div",{children:[t.jsxs("h2",{className:"mb-2 text-sm text-[var(--accent)]",children:["> ",s.title]}),t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:s.endpoints.map((r,i)=>t.jsx(u,{ep:r,prefix:s.prefix},`${r.method}-${r.path}-${i}`))})]},s.title))})]})}export{g as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-Z2T6ck1q.js";import{C as s}from"./DocsPrimitives-Cbz6cuzp.js";import"./copy-BRzSzear.js";const r=` ┌──────────────────┐
|
|
2
2
|
│ Developer │
|
|
3
3
|
│ (create / attach) │
|
|
4
4
|
└──┬─────┬──────┬──┘
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,r,h as S,j as e,y as k}from"./index-
|
|
1
|
+
import{a as C,r,h as S,j as e,y as k}from"./index-Z2T6ck1q.js";import{S as L}from"./Select-4G0X2Q3W.js";import{E}from"./EmptyState-CDWpRpuV.js";import{T}from"./Skeleton-C0wXgPZt.js";import{S as A}from"./scroll-text-DdTxoQvv.js";import{C as F}from"./chevron-left-OFbFCrMn.js";import{C as P}from"./chevron-right-lM0458oI.js";import"./chevron-down-ChzosZD0.js";function q(){const{t:a}=C(),h=[{value:"",label:a("admin.all_actions")},{value:"login",label:a("admin.action_login")},{value:"logout",label:a("admin.action_logout")},{value:"create",label:a("admin.action_create")},{value:"update",label:a("admin.action_update")},{value:"delete",label:a("admin.action_delete")},{value:"revoke",label:a("admin.action_revoke")},{value:"reset_2fa",label:a("admin.action_reset_2fa")},{value:"generate_token",label:a("admin.action_generate_token")}],[n,b]=r.useState([]),[f,p]=r.useState(!0),[i,j]=r.useState(""),[o,g]=r.useState(""),[N,c]=r.useState(void 0),[x,m]=r.useState([]),[l,w]=r.useState(void 0),d=r.useCallback(async t=>{try{p(!0);const s={limit:"50"};t&&(s.cursor=t),i&&(s.action=i),o&&(s.user=o);const v=await S.get("admin/audit-logs",{searchParams:s}).json();b(v.data),w(v.nextCursor)}catch{}finally{p(!1)}},[i,o]);r.useEffect(()=>{c(void 0),m([]),d()},[d]);function _(){l&&(m(t=>[...t,N??""]),c(l),d(l))}function y(){if(x.length===0)return;const t=[...x],s=t.pop();m(t),c(s||void 0),d(s||void 0)}function u(t){return t.startsWith("delete")||t==="revoke"?"text-[var(--destructive)]":t.startsWith("create")||t==="generate_token"?"text-[var(--accent)]":t.startsWith("update")||t==="reset_2fa"?"text-[var(--warning)]":t==="login"?"text-[var(--info)]":"text-[var(--text-secondary)]"}return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.audit_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.audit_subtitle")})]}),e.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx(L,{value:i,onChange:j,options:h}),e.jsxs("div",{className:"relative w-full max-w-xs",children:[e.jsx(k,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("admin.filter_by_user"),value:o,onChange:t=>g(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]}),f?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(T,{rows:5})}):n.length===0?e.jsx(E,{icon:A,title:a("admin.no_audit_entries"),description:a("admin.audit_logs_appear")}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.timestamp")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.user_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.action")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.resource")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.detail")}),e.jsx("th",{className:"pb-2 font-normal",children:a("admin.ip")})]})}),e.jsx("tbody",{children:n.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"whitespace-nowrap py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleString()}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.userId}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:u(t.action),children:t.action})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.resource}),e.jsx("td",{className:"max-w-xs truncate py-2.5 pr-4 text-[var(--text-muted)]",children:t.detail}),e.jsx("td",{className:"py-2.5 text-[var(--text-muted)]",children:t.ip})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:n.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsx("div",{className:"text-[11px] text-[var(--text-muted)] mb-1",children:new Date(t.createdAt).toLocaleString()}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2 mb-1",children:[e.jsx("span",{className:`shrink-0 text-[11px] ${u(t.action)}`,children:t.action}),e.jsx("span",{className:"min-w-0 truncate text-[11px] text-[var(--text-secondary)]",children:t.resource})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-muted)] truncate",children:t.detail}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-[11px] text-[var(--text-muted)]",children:[e.jsxs("span",{children:["User: ",t.userId]}),e.jsx("span",{children:t.ip})]})]},t.id))}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.showing_entries",{count:String(n.length)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",disabled:x.length===0,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",onClick:y,children:[e.jsx(F,{className:"h-3.5 w-3.5"}),a("common.previous")]}),e.jsxs("button",{type:"button",disabled:!l,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",onClick:_,children:[a("common.next"),e.jsx(P,{className:"h-3.5 w-3.5"})]})]})]})]})]})}export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as J,a as Q,F as W,a1 as A,r,h as X,t as d,j as e}from"./index-D1YhueJk.js";import{S as b}from"./Select-Ch24iBMt.js";import{M as ee}from"./MultiSelect-O_y5r4fT.js";import{A as te}from"./arrow-left-D9HtV2zL.js";import"./chevron-down-bn0Ond8n.js";const ae=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],re=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],oe=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],se=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Australia/Sydney"];function ne(m){const a=m.trim().split(/\s+/);return a.length===5||a.length===6}function me(){const m=J(),{t:a}=Q(),[Y]=W(),u=Y.get("templateId"),{createAutomation:w}=A(),[h,P]=r.useState(""),[y,F]=r.useState(""),[s,M]=r.useState([]),[i,$]=r.useState("cron"),[B,j]=r.useState("0 0 * * *"),[v,_]=r.useState("0 0 * * *"),[k,K]=r.useState("UTC"),[N,L]=r.useState("COMPLETED"),[x,C]=r.useState(""),[f,D]=r.useState(""),[g,z]=r.useState("readonly"),[S,T]=r.useState("claude"),[E,I]=r.useState(!0),[U,V]=r.useState({}),[O,G]=r.useState([]),[q,R]=r.useState(!1);r.useEffect(()=>{x&&(s.length===0||!s.includes(x))&&C("")},[x,s]),r.useEffect(()=>{let t=!1;return X.get("web/projects").json().then(n=>{t||G(n),!t&&n.length===1&&(M([n[0].key]),T(n[0].agentType))}).catch(()=>{t||d.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{if(!u)return;let t=!1;return A.getState().fetchTemplates().then(()=>{if(t)return;const o=A.getState().templates.find(l=>l.id===Number(u));if(o){P(o.name),F(o.taskDescription),$(o.triggerType),z(o.executionMode);const l=o.triggerConfig;if(o.triggerType==="cron"&&l.cron&&(_(l.cron),j(""),l.timezone&&K(l.timezone)),o.triggerType==="task_event"&&l.event){L(l.event);const c=l.filter;c!=null&&c.projectKey&&C(c.projectKey),c!=null&&c.taskMode&&D(c.taskMode)}const p=o.taskConfig;p&&V(p),p!=null&&p.agentType&&T(p.agentType),I(!0)}}),()=>{t=!0}},[u]);const Z=t=>{j(t),t&&_(t)},H=r.useCallback(async()=>{if(!h.trim()){d.error(a("automation.name_required"));return}if(s.length===0){d.error(a("automation.project_required"));return}let t={};if(i==="cron"){if(!v.trim()){d.error(a("automation.cron_expression_required"));return}if(!ne(v)){d.error(a("automation.cron_expression_invalid"));return}t={cron:v,timezone:k}}else i==="task_event"&&(t={event:N,filter:{...x&&{projectKey:x},...f&&{taskMode:f}}});R(!0);try{const n=await w({projectKey:s[0],projectKeys:s,name:h.trim(),description:y.trim(),triggerType:i,triggerConfig:t,executionMode:g,taskConfig:{...U,agentType:S},notifyProjectChats:E,...u?{templateId:Number(u)}:{}});d.success(a("automation.automation_created")),m(`/automations/${n.id}`)}catch(n){const o=n instanceof Error?n.message:a("automation.failed_create");d.error(o)}finally{R(!1)}},[h,y,s,i,v,k,N,x,f,g,S,E,u,w,m,a]);return e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(te,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.create_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-project",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(ee,{values:s,onChange:M,options:O.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"create-name",type:"text",value:h,onChange:t=>P(t.target.value),placeholder:a("automation.name_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"create-description",value:y,onChange:t=>F(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>$(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${i===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),i==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(b,{value:B,onChange:Z,options:ae.map(t=>({value:t.value,label:t.value?`${t.label} (${t.value})`:t.label}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"create-cron-expression",type:"text",value:v,onChange:t=>{_(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(b,{value:k,onChange:K,options:se.map(t=>({value:t,label:t}))})]})]}),i==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(b,{value:N,onChange:L,options:re})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(b,{value:x,onChange:C,options:[{value:"",label:a("automation.all_projects")},...O.filter(t=>s.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:s.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(b,{value:f,onChange:D,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>z(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${g===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(g==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:oe.map(t=>e.jsx("button",{onClick:()=>T(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${S===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:E,onChange:t=>I(t.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),a("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:H,disabled:q,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(q?"automation.creating":"automation.create_automation")}),e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{me as default};
|
|
1
|
+
import{f as J,a as Q,F as W,a1 as A,r,h as X,t as d,j as e}from"./index-Z2T6ck1q.js";import{S as b}from"./Select-4G0X2Q3W.js";import{M as ee}from"./MultiSelect-D3RBVEea.js";import{A as te}from"./arrow-left-CLNiZlZS.js";import"./chevron-down-ChzosZD0.js";const ae=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],re=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],oe=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],se=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Australia/Sydney"];function ne(m){const a=m.trim().split(/\s+/);return a.length===5||a.length===6}function me(){const m=J(),{t:a}=Q(),[Y]=W(),u=Y.get("templateId"),{createAutomation:w}=A(),[h,P]=r.useState(""),[y,F]=r.useState(""),[s,M]=r.useState([]),[i,$]=r.useState("cron"),[B,j]=r.useState("0 0 * * *"),[v,_]=r.useState("0 0 * * *"),[k,K]=r.useState("UTC"),[N,L]=r.useState("COMPLETED"),[x,C]=r.useState(""),[f,D]=r.useState(""),[g,z]=r.useState("readonly"),[S,T]=r.useState("claude"),[E,I]=r.useState(!0),[U,V]=r.useState({}),[O,G]=r.useState([]),[q,R]=r.useState(!1);r.useEffect(()=>{x&&(s.length===0||!s.includes(x))&&C("")},[x,s]),r.useEffect(()=>{let t=!1;return X.get("web/projects").json().then(n=>{t||G(n),!t&&n.length===1&&(M([n[0].key]),T(n[0].agentType))}).catch(()=>{t||d.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{if(!u)return;let t=!1;return A.getState().fetchTemplates().then(()=>{if(t)return;const o=A.getState().templates.find(l=>l.id===Number(u));if(o){P(o.name),F(o.taskDescription),$(o.triggerType),z(o.executionMode);const l=o.triggerConfig;if(o.triggerType==="cron"&&l.cron&&(_(l.cron),j(""),l.timezone&&K(l.timezone)),o.triggerType==="task_event"&&l.event){L(l.event);const c=l.filter;c!=null&&c.projectKey&&C(c.projectKey),c!=null&&c.taskMode&&D(c.taskMode)}const p=o.taskConfig;p&&V(p),p!=null&&p.agentType&&T(p.agentType),I(!0)}}),()=>{t=!0}},[u]);const Z=t=>{j(t),t&&_(t)},H=r.useCallback(async()=>{if(!h.trim()){d.error(a("automation.name_required"));return}if(s.length===0){d.error(a("automation.project_required"));return}let t={};if(i==="cron"){if(!v.trim()){d.error(a("automation.cron_expression_required"));return}if(!ne(v)){d.error(a("automation.cron_expression_invalid"));return}t={cron:v,timezone:k}}else i==="task_event"&&(t={event:N,filter:{...x&&{projectKey:x},...f&&{taskMode:f}}});R(!0);try{const n=await w({projectKey:s[0],projectKeys:s,name:h.trim(),description:y.trim(),triggerType:i,triggerConfig:t,executionMode:g,taskConfig:{...U,agentType:S},notifyProjectChats:E,...u?{templateId:Number(u)}:{}});d.success(a("automation.automation_created")),m(`/automations/${n.id}`)}catch(n){const o=n instanceof Error?n.message:a("automation.failed_create");d.error(o)}finally{R(!1)}},[h,y,s,i,v,k,N,x,f,g,S,E,u,w,m,a]);return e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(te,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.create_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-project",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(ee,{values:s,onChange:M,options:O.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"create-name",type:"text",value:h,onChange:t=>P(t.target.value),placeholder:a("automation.name_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"create-description",value:y,onChange:t=>F(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>$(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${i===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),i==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(b,{value:B,onChange:Z,options:ae.map(t=>({value:t.value,label:t.value?`${t.label} (${t.value})`:t.label}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"create-cron-expression",type:"text",value:v,onChange:t=>{_(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(b,{value:k,onChange:K,options:se.map(t=>({value:t,label:t}))})]})]}),i==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(b,{value:N,onChange:L,options:re})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(b,{value:x,onChange:C,options:[{value:"",label:a("automation.all_projects")},...O.filter(t=>s.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:s.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(b,{value:f,onChange:D,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>z(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${g===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(g==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:oe.map(t=>e.jsx("button",{onClick:()=>T(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${S===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:E,onChange:t=>I(t.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),a("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:H,disabled:q,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(q?"automation.creating":"automation.create_automation")}),e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{me as default};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as v,f as I,a as $,B as D,a1 as L,r as o,a2 as O,p as F,t as i,x as q,j as t,s as K}from"./index-Z2T6ck1q.js";import{E as _}from"./EmptyState-CDWpRpuV.js";import{T as z}from"./Skeleton-C0wXgPZt.js";import{f as A,c as B}from"./date-CmcdoD87.js";import{C}from"./clock-D8iJj9QR.js";import{A as G}from"./arrow-left-CLNiZlZS.js";import{P as T}from"./play-D9jrg8Qc.js";import{T as H}from"./trash-2-Dh9HvXnr.js";import{T as U}from"./timer-Btkw5jG2.js";import{Z as W}from"./zap-CjhTaRfz.js";import{E as Z}from"./external-link-Dsa5Qmn0.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const J=v("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
7
7
|
* @license lucide-react v0.469.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Q=
|
|
11
|
+
*/const Q=v("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
|
|
12
12
|
* @license lucide-react v0.469.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const V=
|
|
16
|
+
*/const V=v("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);function X(n){switch(n){case"COMPLETED":return"bg-[var(--accent)]";case"RUNNING":return"bg-[var(--accent)]";case"PENDING":return"bg-[var(--warning)]";case"FAILED":return"bg-[var(--destructive)]";case"SKIPPED":return"bg-[#525252]";default:return"bg-[#525252]"}}function Y(n,e){return(n&&n.length>0?n:[e]).join(", ")}function dt(){const n=I(),{t:e}=$(),{id:b}=D(),r=Number(b),{currentAutomation:a,loading:P,fetchAutomation:x,enableAutomation:g,disableAutomation:f,triggerAutomation:j,deleteAutomation:y,runs:N,fetchRuns:c,clearRunQuery:w}=L(),[E,k]=o.useState(!1),p=o.useRef(!1);o.useEffect(()=>(x(r),c({automationId:r,limit:20}),()=>{w()}),[r,x,c,w]),o.useEffect(()=>{p.current=!0;const s=O.onStatus(l=>{p.current&&l==="connected"&&c({automationId:r,limit:20})});return()=>{p.current=!1,s()}},[r,c]),F((a==null?void 0:a.name)??null);const M=o.useCallback(async()=>{if(a)try{a.enabled?(await f(a.id),await x(r),i.success(e("automation.automation_disabled"))):(await g(a.id),await x(r),i.success(e("automation.automation_enabled")))}catch{i.error(e("automation.failed_toggle"))}},[a,r,g,f,x,e]),R=o.useCallback(async()=>{try{await j(r),i.success(e("automation.automation_triggered")),c({automationId:r,limit:20})}catch{i.error(e("automation.failed_trigger"))}},[r,j,c,e]),S=o.useCallback(async()=>{try{await y(r),i.success(e("automation.automation_deleted")),n("/automations")}catch{i.error(e("automation.failed_delete"))}},[r,y,n,e]);if(q(null),P&&!a)return t.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:t.jsx(z,{rows:6})});if(!a)return t.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:t.jsx(_,{icon:C,title:e("automation.automation_not_found")})});const d=a.triggerConfig,u=a.taskConfig;return t.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[t.jsxs("div",{className:"mb-6 flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:()=>n("/automations"),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:t.jsx(G,{className:"h-4 w-4"})}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a.name}),t.jsx("span",{className:`h-2 w-2 rounded-full ${a.enabled?"bg-[var(--accent)]":"bg-[var(--text-muted)]"}`}),t.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:a.enabled?e("automation.enabled"):e("automation.disabled")})]}),a.description&&t.jsx("p",{className:"mt-0.5 text-[11px] text-[var(--text-muted)] line-clamp-2",children:a.description})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:M,className:`flex items-center gap-1 rounded-[4px] border px-3 py-1.5 text-[11px] transition-colors ${a.enabled?"border-[var(--warning)] text-[var(--warning)] hover:bg-[var(--warning)]/10":"border-[var(--accent)] text-[var(--accent)] hover:bg-[var(--accent)]/10"}`,children:a.enabled?t.jsxs(t.Fragment,{children:[t.jsx(J,{className:"h-3 w-3"})," ",e("automation.disable")]}):t.jsxs(t.Fragment,{children:[t.jsx(Q,{className:"h-3 w-3"})," ",e("automation.enable")]})}),t.jsxs("button",{onClick:()=>n(`/automations/${a.id}/edit`),className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:[t.jsx(V,{className:"h-3 w-3"})," ",e("automation.edit")]}),t.jsxs("button",{onClick:R,className:"flex items-center gap-1 whitespace-nowrap rounded-[4px] border border-[var(--accent)] px-3 py-1.5 text-[11px] text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:[t.jsx(T,{className:"h-3 w-3 shrink-0"})," ",e("automation.trigger_now")]}),t.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--destructive)] hover:border-[var(--destructive)] transition-colors",children:[t.jsx(H,{className:"h-3 w-3"})," ",e("automation.delete")]})]})]}),t.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[t.jsx("h2",{className:"mb-3 text-[11px] font-bold text-[var(--text-muted)]",children:e("automation.configuration")}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.trigger_type")}),t.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-[var(--text-primary)]",children:[a.triggerType==="cron"&&t.jsx(U,{className:"h-3 w-3"}),a.triggerType==="task_event"&&t.jsx(W,{className:"h-3 w-3"}),a.triggerType==="manual"&&t.jsx(T,{className:"h-3 w-3"}),a.triggerType]})]}),a.triggerType==="cron"&&!!d.cron&&t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.schedule")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:d.cron}),t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:d.timezone??"UTC"})]}),a.triggerType==="task_event"&&!!d.event&&t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.event")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:d.event})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.agent_type")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:(u==null?void 0:u.agentType)??"claude"})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.execution_mode")}),t.jsx("span",{className:`mt-0.5 block text-xs ${a.executionMode==="writable"?"text-[var(--warning)]":"text-[var(--text-primary)]"}`,children:a.executionMode})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block whitespace-nowrap text-[10px] text-[var(--text-muted)]",children:e("automation.notify_project_chats")}),t.jsx("span",{className:"mt-0.5 block whitespace-nowrap text-xs text-[var(--text-primary)]",children:a.notifyProjectChats?e("automation.notify_project_chats_enabled"):e("automation.notify_project_chats_disabled")})]})]}),t.jsxs("div",{className:"mt-3 flex items-center gap-4 text-[10px] text-[var(--text-muted)]",children:[t.jsxs("span",{children:[e("automation.project"),": ",Y(a.projectKeys,a.projectKey)]}),a.lastRunAt&&t.jsx("span",{children:e("automation.last_run",{time:A(a.lastRunAt)})}),a.nextRunAt&&t.jsx("span",{children:e("automation.next_run",{time:B(a.nextRunAt)})})]})]}),t.jsxs("div",{children:[t.jsx("h2",{className:"mb-3 text-[11px] font-bold text-[var(--text-muted)]",children:e("automation.run_history")}),N.length===0?t.jsx(_,{icon:C,title:e("automation.no_runs"),compact:!0}):t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:t.jsxs("table",{className:"w-full text-left",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_time")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.project")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_status")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_findings")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_task")})]})}),t.jsx("tbody",{children:N.map(s=>t.jsxs("tr",{className:"cursor-pointer border-b border-[var(--border)] last:border-b-0 hover:bg-[var(--bg-input)] transition-colors",onClick:()=>n(`/automations/runs/${s.id}`),children:[t.jsx("td",{className:"px-4 py-2.5 text-xs text-[var(--text-primary)]",children:A(s.createdAt)}),t.jsx("td",{className:"px-4 py-2.5 text-xs text-[var(--text-primary)]",children:s.projectKey??a.projectKey}),t.jsx("td",{className:"px-4 py-2.5",children:t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-[var(--text-primary)]",children:[t.jsx("span",{className:`h-2 w-2 rounded-full ${X(s.status)}`}),s.status.toLowerCase()]})}),t.jsx("td",{className:"px-4 py-2.5 text-xs text-[var(--text-muted)]",children:(()=>{if(!s.hasFindings||!s.findings||!Array.isArray(s.findings))return"-";const l=s.findings.flatMap(m=>{if(m.detail&&typeof m.detail=="string"&&m.detail.trimStart().startsWith("{"))try{const h=JSON.parse(m.detail);if(Array.isArray(h.findings)&&h.findings.length>0)return h.findings}catch{}return[m]});return`${l.length} finding${l.length!==1?"s":""}`})()}),t.jsx("td",{className:"px-4 py-2.5",children:s.taskId?t.jsxs("button",{onClick:l=>{l.stopPropagation(),n(`/tasks/${s.taskId}`)},className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:["#",s.taskId,t.jsx(Z,{className:"h-2.5 w-2.5"})]}):t.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"-"})})]},s.id))})]})})]}),t.jsx(K,{isOpen:E,onClose:()=>k(!1),onConfirm:S,title:e("automation.delete_title"),message:e("automation.delete_confirm",{name:a.name}),confirmLabel:e("automation.delete"),confirmVariant:"danger"})]})}export{dt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as X,a as ee,B as te,a1 as ae,r,h as re,t as m,j as e}from"./index-D1YhueJk.js";import{S as v}from"./Select-Ch24iBMt.js";import{M as oe}from"./MultiSelect-O_y5r4fT.js";import{T as se}from"./Skeleton-DCg7UPBm.js";import{E as ne}from"./EmptyState-Dbl97TyM.js";import{C as le}from"./clock-aHYz4zIT.js";import{A as ie}from"./arrow-left-D9HtV2zL.js";import"./chevron-down-bn0Ond8n.js";const R=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],ce=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],de=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],U=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Asia/Kolkata","Australia/Sydney"];function xe(u){const a=u.trim().split(/\s+/);return a.length===5||a.length===6}function je(){const u=X(),{t:a}=ee(),{id:Y}=te(),n=Number(Y),{currentAutomation:o,loading:B,fetchAutomation:E,updateAutomation:S}=ae(),[b,T]=r.useState(""),[y,w]=r.useState(""),[l,A]=r.useState([]),[c,P]=r.useState("cron"),[V,j]=r.useState(""),[p,g]=r.useState(""),[d,M]=r.useState("UTC"),[_,$]=r.useState("COMPLETED"),[x,N]=r.useState(""),[h,F]=r.useState(""),[f,K]=r.useState("readonly"),[k,L]=r.useState("claude"),[C,z]=r.useState(!1),[D,G]=r.useState([]),[O,I]=r.useState(!1),[q,Z]=r.useState(!1);r.useEffect(()=>{E(n)},[n,E]),r.useEffect(()=>{let t=!1;return re.get("web/projects").json().then(i=>{t||G(i)}).catch(()=>{t||m.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{x&&(l.length===0||!l.includes(x))&&N("")},[x,l]),r.useEffect(()=>{if(!o||o.id!==n||q)return;T(o.name),w(o.description),A(o.projectKeys??[o.projectKey]),P(o.triggerType),K(o.executionMode);const t=o.triggerConfig;if(o.triggerType==="cron"){const s=t.cron??"";g(s);const Q=R.find(W=>W.value===s);j(Q?s:""),M(t.timezone??"UTC")}if(o.triggerType==="task_event"){$(t.event??"COMPLETED");const s=t.filter;N((s==null?void 0:s.projectKey)??""),F((s==null?void 0:s.taskMode)??"")}const i=o.taskConfig;L((i==null?void 0:i.agentType)??"claude"),z(o.notifyProjectChats),Z(!0)},[o,n,q]);const H=t=>{j(t),t&&g(t)},J=r.useCallback(async()=>{if(!b.trim()){m.error(a("automation.name_required"));return}if(l.length===0){m.error(a("automation.project_required"));return}let t={};if(c==="cron"){if(!p.trim()){m.error(a("automation.cron_expression_required"));return}if(!xe(p)){m.error(a("automation.cron_expression_invalid"));return}t={cron:p,timezone:d}}else c==="task_event"&&(t={event:_,filter:{...x&&{projectKey:x},...h&&{taskMode:h}}});I(!0);try{await S(n,{projectKey:l[0],projectKeys:l,name:b.trim(),description:y.trim(),triggerType:c,triggerConfig:t,executionMode:f,taskConfig:{...(o==null?void 0:o.taskConfig)??{},agentType:k},notifyProjectChats:C}),m.success(a("automation.automation_updated")),u(`/automations/${n}`)}catch(i){const s=i instanceof Error?i.message:a("automation.failed_update");m.error(s)}finally{I(!1)}},[b,y,l,c,p,d,_,x,h,f,k,C,n,S,u,a]);return B&&!o?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(se,{rows:6})}):!o||o.id!==n?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(ne,{icon:le,title:a("automation.automation_not_found")})}):e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(ie,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.edit_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-projects",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(oe,{values:l,onChange:A,options:D.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"edit-name",type:"text",value:b,onChange:t=>T(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"edit-description",value:y,onChange:t=>w(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>P(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${c===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),c==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(v,{value:V,onChange:H,options:R.map(t=>({value:t.value,label:`${t.label}${t.value?` (${t.value})`:""}`}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"edit-cron-expression",type:"text",value:p,onChange:t=>{g(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(v,{value:d,onChange:M,options:[...d&&!U.includes(d)?[{value:d,label:d}]:[],...U.map(t=>({value:t,label:t}))]})]})]}),c==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(v,{value:_,onChange:$,options:ce})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(v,{value:x,onChange:N,options:[{value:"",label:a("automation.all_projects")},...D.filter(t=>l.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:l.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(v,{value:h,onChange:F,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>K(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${f===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(f==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:de.map(t=>e.jsx("button",{onClick:()=>L(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${k===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:C,onChange:t=>z(t.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),a("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:J,disabled:O,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(O?"automation.saving":"automation.save_changes")}),e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{je as default};
|
|
1
|
+
import{f as X,a as ee,B as te,a1 as ae,r,h as re,t as m,j as e}from"./index-Z2T6ck1q.js";import{S as v}from"./Select-4G0X2Q3W.js";import{M as oe}from"./MultiSelect-D3RBVEea.js";import{T as se}from"./Skeleton-C0wXgPZt.js";import{E as ne}from"./EmptyState-CDWpRpuV.js";import{C as le}from"./clock-D8iJj9QR.js";import{A as ie}from"./arrow-left-CLNiZlZS.js";import"./chevron-down-ChzosZD0.js";const R=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],ce=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],de=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],U=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Asia/Kolkata","Australia/Sydney"];function xe(u){const a=u.trim().split(/\s+/);return a.length===5||a.length===6}function je(){const u=X(),{t:a}=ee(),{id:Y}=te(),n=Number(Y),{currentAutomation:o,loading:B,fetchAutomation:E,updateAutomation:S}=ae(),[b,T]=r.useState(""),[y,w]=r.useState(""),[l,A]=r.useState([]),[c,P]=r.useState("cron"),[V,j]=r.useState(""),[p,g]=r.useState(""),[d,M]=r.useState("UTC"),[_,$]=r.useState("COMPLETED"),[x,N]=r.useState(""),[h,F]=r.useState(""),[f,K]=r.useState("readonly"),[k,L]=r.useState("claude"),[C,z]=r.useState(!1),[D,G]=r.useState([]),[O,I]=r.useState(!1),[q,Z]=r.useState(!1);r.useEffect(()=>{E(n)},[n,E]),r.useEffect(()=>{let t=!1;return re.get("web/projects").json().then(i=>{t||G(i)}).catch(()=>{t||m.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{x&&(l.length===0||!l.includes(x))&&N("")},[x,l]),r.useEffect(()=>{if(!o||o.id!==n||q)return;T(o.name),w(o.description),A(o.projectKeys??[o.projectKey]),P(o.triggerType),K(o.executionMode);const t=o.triggerConfig;if(o.triggerType==="cron"){const s=t.cron??"";g(s);const Q=R.find(W=>W.value===s);j(Q?s:""),M(t.timezone??"UTC")}if(o.triggerType==="task_event"){$(t.event??"COMPLETED");const s=t.filter;N((s==null?void 0:s.projectKey)??""),F((s==null?void 0:s.taskMode)??"")}const i=o.taskConfig;L((i==null?void 0:i.agentType)??"claude"),z(o.notifyProjectChats),Z(!0)},[o,n,q]);const H=t=>{j(t),t&&g(t)},J=r.useCallback(async()=>{if(!b.trim()){m.error(a("automation.name_required"));return}if(l.length===0){m.error(a("automation.project_required"));return}let t={};if(c==="cron"){if(!p.trim()){m.error(a("automation.cron_expression_required"));return}if(!xe(p)){m.error(a("automation.cron_expression_invalid"));return}t={cron:p,timezone:d}}else c==="task_event"&&(t={event:_,filter:{...x&&{projectKey:x},...h&&{taskMode:h}}});I(!0);try{await S(n,{projectKey:l[0],projectKeys:l,name:b.trim(),description:y.trim(),triggerType:c,triggerConfig:t,executionMode:f,taskConfig:{...(o==null?void 0:o.taskConfig)??{},agentType:k},notifyProjectChats:C}),m.success(a("automation.automation_updated")),u(`/automations/${n}`)}catch(i){const s=i instanceof Error?i.message:a("automation.failed_update");m.error(s)}finally{I(!1)}},[b,y,l,c,p,d,_,x,h,f,k,C,n,S,u,a]);return B&&!o?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(se,{rows:6})}):!o||o.id!==n?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(ne,{icon:le,title:a("automation.automation_not_found")})}):e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(ie,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.edit_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-projects",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(oe,{values:l,onChange:A,options:D.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"edit-name",type:"text",value:b,onChange:t=>T(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"edit-description",value:y,onChange:t=>w(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>P(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${c===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),c==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(v,{value:V,onChange:H,options:R.map(t=>({value:t.value,label:`${t.label}${t.value?` (${t.value})`:""}`}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"edit-cron-expression",type:"text",value:p,onChange:t=>{g(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(v,{value:d,onChange:M,options:[...d&&!U.includes(d)?[{value:d,label:d}]:[],...U.map(t=>({value:t,label:t}))]})]})]}),c==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(v,{value:_,onChange:$,options:ce})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(v,{value:x,onChange:N,options:[{value:"",label:a("automation.all_projects")},...D.filter(t=>l.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:l.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(v,{value:h,onChange:F,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>K(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${f===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(f==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:de.map(t=>e.jsx("button",{onClick:()=>L(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${k===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:C,onChange:t=>z(t.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),a("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:J,disabled:O,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(O?"automation.saving":"automation.save_changes")}),e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{je as default};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{c as E,f as R,a as K,r as l,a1 as M,x as Y,j as e,a2 as Z,a3 as P,a4 as J,a5 as F,t as h,V as Q,G as X,v as ee,h as te,X as ae}from"./index-Z2T6ck1q.js";import{E as $}from"./EmptyState-CDWpRpuV.js";import{T as I}from"./Skeleton-C0wXgPZt.js";import{f as O,d as re}from"./date-CmcdoD87.js";import{S as se}from"./Select-4G0X2Q3W.js";import{M as ne}from"./MultiSelect-D3RBVEea.js";import{P as oe}from"./plus-bI3rFRiW.js";import{P as ie}from"./play-D9jrg8Qc.js";import{Z as ce}from"./zap-CjhTaRfz.js";import{T as le}from"./timer-Btkw5jG2.js";import{C as de}from"./clock-D8iJj9QR.js";import{C as xe}from"./chevron-right-lM0458oI.js";import"./chevron-down-ChzosZD0.js";/**
|
|
2
|
+
* @license lucide-react v0.469.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const me=E("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
|
|
7
|
+
* @license lucide-react v0.469.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const H=E("BookDashed",[["path",{d:"M12 17h1.5",key:"1gkc67"}],["path",{d:"M12 22h1.5",key:"1my7sn"}],["path",{d:"M12 2h1.5",key:"19tvb7"}],["path",{d:"M17.5 22H19a1 1 0 0 0 1-1",key:"10akbh"}],["path",{d:"M17.5 2H19a1 1 0 0 1 1 1v1.5",key:"1vrfjs"}],["path",{d:"M20 14v3h-2.5",key:"1naeju"}],["path",{d:"M20 8.5V10",key:"1ctpfu"}],["path",{d:"M4 10V8.5",key:"1o3zg5"}],["path",{d:"M4 19.5V14",key:"ob81pf"}],["path",{d:"M4 4.5A2.5 2.5 0 0 1 6.5 2H8",key:"s8vcyb"}],["path",{d:"M8 22H6.5a1 1 0 0 1 0-5H8",key:"1cu73q"}]]);/**
|
|
12
|
+
* @license lucide-react v0.469.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const ue=E("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
|
|
17
|
+
* @license lucide-react v0.469.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const pe=E("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
|
|
22
|
+
* @license lucide-react v0.469.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const he=E("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);function ge({severity:a}){const t={critical:"border-[var(--destructive)] text-[var(--destructive)]",warning:"border-[var(--warning)] text-[var(--warning)]",info:"border-[var(--info)] text-[var(--info)]"};return e.jsx("span",{className:`rounded-[4px] border px-1.5 py-0.5 text-[10px] ${t[a]??"border-[var(--border)] text-[var(--text-muted)]"}`,children:a})}function z({type:a}){const o={cron:le,task_event:ce,manual:ie}[a]??de;return e.jsxs("span",{className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:[e.jsx(o,{className:"h-2.5 w-2.5"}),a]})}function V({mode:a}){const t=a==="writable";return e.jsx("span",{className:`rounded-[4px] border px-1.5 py-0.5 text-[10px] ${t?"border-[var(--warning)] text-[var(--warning)]":"border-[var(--border)] text-[var(--text-muted)]"}`,children:a})}function be(a,t){const o=a&&a.length>0?a:[t];return o.length<=2?o.join(", "):`${o.slice(0,2).join(", ")} +${o.length-2}`}function ve(){const a=R(),{t}=K(),{runs:o,loading:i,fetchRuns:d,updateRunStatus:v,batchUpdateRuns:x,clearRunQuery:f}=M(),[r,y]=l.useState(new Set),k=l.useRef(!1);l.useEffect(()=>(d({inboxStatus:"unread",limit:50}),()=>{f()}),[d,f]),l.useEffect(()=>{k.current=!0;const s=Z.onStatus(g=>{k.current&&g==="connected"&&d({inboxStatus:"unread",limit:50})});return()=>{k.current=!1,s()}},[d]);const c=s=>{y(g=>{const u=new Set(g);return u.has(s)?u.delete(s):u.add(s),u})},p=()=>{r.size===o.length?y(new Set):y(new Set(o.map(s=>s.id)))},m=async s=>{try{await v(s,"read"),h.success(t("automation.marked_as_read"))}catch{h.error(t("automation.failed_mark_read"))}},N=async s=>{try{await v(s,"archived"),h.success(t("automation.archived"))}catch{h.error(t("automation.failed_archive"))}},w=async()=>{if(r.size!==0)try{await x(Array.from(r),"read"),y(new Set),h.success(t("automation.marked_n_read",{n:r.size}))}catch{h.error(t("automation.failed_batch_update"))}},j=s=>!s.findings||!Array.isArray(s.findings)?[]:s.findings.flatMap(g=>{if(g.detail&&typeof g.detail=="string"&&g.detail.trimStart().startsWith("{"))try{const u=JSON.parse(g.detail);if(Array.isArray(u.findings)&&u.findings.length>0)return u.findings}catch{}return[g]}),C=s=>j(s).length;if(i&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});const T=o.filter(s=>s.inboxStatus==="unread");return T.length===0?e.jsx($,{icon:pe,title:t("automation.no_unread_findings"),description:t("automation.inbox_description")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("button",{onClick:p,className:"rounded-[4px] border border-[var(--border)] px-2.5 py-1.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r.size===T.length?t("automation.deselect_all"):t("automation.select_all")}),r.size>0&&e.jsxs("button",{onClick:w,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--accent)] transition-colors",children:[e.jsx(P,{className:"h-3 w-3"}),t("automation.mark_all_read")," (",r.size,")"]})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:T.map(s=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0",children:[e.jsx("input",{type:"checkbox",checked:r.has(s.id),onChange:()=>c(s.id),className:"h-3.5 w-3.5 shrink-0 accent-[var(--accent)]"}),e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsxs("div",{className:"flex min-w-0 flex-1 cursor-pointer flex-col gap-0.5",onClick:()=>a(`/automations/runs/${s.id}`),children:[e.jsx("span",{className:"truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors",children:t("automation.run_label",{id:s.id,automationId:s.automationId})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(z,{type:s.triggerType}),C(s)>0&&e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:C(s)!==1?t("automation.findings_count",{count:C(s)}):t("automation.finding_count",{count:C(s)})}),C(s)>0&&(()=>{const g=new Set(j(s).map(u=>u.severity));return Array.from(g).map(u=>e.jsx(ge,{severity:u},u))})()]})]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:O(s.createdAt)}),e.jsx("button",{onClick:()=>m(s.id),className:"shrink-0 rounded-[4px] p-1.5 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",title:t("automation.mark_read"),children:e.jsx(P,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>N(s.id),className:"shrink-0 rounded-[4px] p-1.5 text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",title:t("automation.archive"),children:e.jsx(me,{className:"h-3.5 w-3.5"})})]},s.id))})]})}function fe(){const a=R(),{t}=K(),{automations:o,loading:i,fetchAutomations:d,enableAutomation:v,disableAutomation:x}=M();l.useEffect(()=>{d()},[d]);const f=async r=>{try{r.enabled?(await x(r.id),h.success(t("automation.automation_disabled"))):(await v(r.id),h.success(t("automation.automation_enabled")))}catch{h.error(t("automation.failed_toggle"))}};return i&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})}):o.length===0?e.jsx($,{icon:J,title:t("automation.no_automations"),description:t("automation.create_first_description"),actionLabel:t("automation.new_automation"),onAction:()=>a("/automations/new")}):e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:o.map(r=>e.jsxs("div",{className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]/30",onClick:()=>a(`/automations/${r.id}`),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-xs font-bold text-[var(--text-primary)]",children:r.name}),e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${r.enabled?"bg-[var(--accent)]":"bg-[var(--text-muted)]"}`})]}),r.description&&e.jsx("p",{className:"mt-1 truncate text-[11px] text-[var(--text-muted)]",children:r.description}),e.jsxs("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:[t("automation.project"),": ",be(r.projectKeys,r.projectKey)]})]}),e.jsx("button",{type:"button",onClick:y=>{y.stopPropagation(),f(r)},"aria-pressed":r.enabled,className:`relative h-5 w-9 shrink-0 cursor-pointer rounded-full transition-colors focus:outline-none ${r.enabled?"bg-[var(--accent)]":"bg-[var(--border)]"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white shadow-sm transition-transform ${r.enabled?"translate-x-4":"translate-x-0"}`})})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx(z,{type:r.triggerType}),e.jsx(V,{mode:r.executionMode})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[r.lastRunAt&&e.jsx("span",{children:t("automation.last_run",{time:O(r.lastRunAt)})}),r.nextRunAt&&e.jsx("span",{children:t("automation.next_run",{time:re(r.nextRunAt)})}),!r.lastRunAt&&!r.nextRunAt&&e.jsx("span",{children:t("automation.no_runs_yet")})]})]},r.id))})}const B={status_reports:{titleKey:"automation.template_category_status_reports",descriptionKey:"automation.template_category_status_reports_description",icon:X,order:0,iconClass:"border-sky-500/30 bg-sky-500/10 text-sky-300"},release_prep:{titleKey:"automation.template_category_release_prep",descriptionKey:"automation.template_category_release_prep_description",icon:P,order:1,iconClass:"border-emerald-500/30 bg-emerald-500/10 text-emerald-300"},incidents_triage:{titleKey:"automation.template_category_incidents_triage",descriptionKey:"automation.template_category_incidents_triage_description",icon:Q,order:2,iconClass:"border-rose-500/30 bg-rose-500/10 text-rose-300"},code_quality:{titleKey:"automation.template_category_code_quality",descriptionKey:"automation.template_category_code_quality_description",icon:ue,order:3,iconClass:"border-amber-500/30 bg-amber-500/10 text-amber-300"},repo_maintenance:{titleKey:"automation.template_category_repo_maintenance",descriptionKey:"automation.template_category_repo_maintenance_description",icon:he,order:4,iconClass:"border-fuchsia-500/30 bg-fuchsia-500/10 text-fuchsia-300"},growth_exploration:{titleKey:"automation.template_category_growth_exploration",descriptionKey:"automation.template_category_growth_exploration_description",icon:F,order:5,iconClass:"border-violet-500/30 bg-violet-500/10 text-violet-300"},other:{titleKey:"automation.template_category_other",descriptionKey:"automation.template_category_other_description",icon:H,order:99,iconClass:"border-[var(--border)] bg-[var(--bg-input)] text-[var(--text-muted)]"}},ye={standup_summary:0,weekly_engineering_summary:1,weekly_release_notes:2,daily_bug_scan:3},je=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}];function S(a){return B[a??""]??B.other}function _e(a){const t=S(a.category);return{Icon:t.icon,iconClass:t.iconClass}}function U(a){const t=a.builtinKey!=null?ye[a.builtinKey]??50:50,o=S(a.category).order,i=a.isBuiltin?0:20,d=a.executionMode==="readonly"?0:2;return t+o*5+i+d}function D({template:a,onUse:t,emphasized:o=!1,sourceLabel:i,actionLabel:d}){const{Icon:v,iconClass:x}=_e(a);return e.jsxs("article",{className:`group rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]/30 ${o?"min-h-[220px]":""}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-[4px] border ${x}`,children:e.jsx(v,{className:"h-4 w-4"})}),e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[10px] text-[var(--text-muted)]",children:i})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-sm font-bold text-[var(--text-primary)]",children:a.name}),e.jsx("p",{className:`mt-2 text-xs leading-5 text-[var(--text-secondary)] ${o?"line-clamp-4":"line-clamp-3"}`,children:a.description})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsx(z,{type:a.triggerType}),e.jsx(V,{mode:a.executionMode})]}),e.jsxs("button",{onClick:()=>t(a.id),className:"mt-5 inline-flex items-center gap-1 text-xs font-bold text-[var(--accent)] transition-colors hover:text-[var(--text-primary)]",children:[d,e.jsx(xe,{className:"h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5"})]})]})}function Ne(a){const t=a.trim().split(/\s+/);return t.length===5||t.length===6}function ke({template:a,onClose:t,onCreated:o}){const{t:i}=K(),{createAutomation:d}=M(),[v,x]=l.useState([]),[f,r]=l.useState([]),[y,k]=l.useState(""),[c,p]=l.useState("UTC"),[m,N]=l.useState("claude"),[w,j]=l.useState(!0),[C,T]=l.useState(!1),[s,g]=l.useState(!1),[u,L]=l.useState(!1);if(ee(!!a),l.useEffect(()=>{if(!a)return;const n=a.triggerConfig??{},b=a.taskConfig??{};r([]),k(typeof n.cron=="string"?n.cron:""),p(typeof n.timezone=="string"?n.timezone:"UTC"),N(typeof b.agentType=="string"?b.agentType:"claude"),j(!0),T(!1),g(!0);let _=!1;return te.get("web/projects").json().then(A=>{_||(x(A),A.length===1&&(r([A[0].key]),N(A[0].agentType)))}).catch(()=>{_||h.error(i("automation.failed_load_projects"))}).finally(()=>{_||g(!1)}),()=>{_=!0}},[a,i]),l.useEffect(()=>{if(!a)return;const n=b=>{b.key==="Escape"&&!u&&t()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[a,t,u]),!a)return null;const q=n=>{if(r(n),C)return;const b=v.find(_=>_.key===n[0]);b&&N(b.agentType)},G=n=>{N(n),T(!0)},W=async()=>{if(f.length===0){h.error(i("automation.project_required"));return}let n=a.triggerConfig??{};if(a.triggerType==="cron"){if(!y.trim()){h.error(i("automation.cron_expression_required"));return}if(!Ne(y)){h.error(i("automation.cron_expression_invalid"));return}n={...n,cron:y.trim(),timezone:c}}else if(a.triggerType==="task_event"){const b=typeof n.filter=="object"&&n.filter!==null&&!Array.isArray(n.filter)?n.filter:{},{projectKey:_,...A}=b;n={...n,filter:{...A,...f.length===1?{projectKey:f[0]}:{}}}}L(!0);try{const b=a.taskConfig??{},_=await d({projectKey:f[0],projectKeys:f,name:a.name,description:a.taskDescription,triggerType:a.triggerType,triggerConfig:n,executionMode:a.executionMode,notifyProjectChats:w,taskConfig:{...b,agentType:m},templateId:a.id});h.success(i("automation.automation_created")),t(),o(_.id)}catch(b){const _=b instanceof Error?b.message:i("automation.failed_create");h.error(_)}finally{L(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-black/70 p-4",onClick:t,children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":a.name,onClick:n=>n.stopPropagation(),className:"mx-auto my-4 max-h-[calc(100vh-2rem)] w-full max-w-5xl overflow-y-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono shadow-2xl",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--border)] px-6 py-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--accent)]",children:i("automation.template_preview")}),e.jsx("h2",{className:"mt-2 text-2xl font-semibold text-[var(--text-primary)]",children:a.name}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--text-secondary)]",children:a.description})]}),e.jsx("button",{type:"button","aria-label":i("common.close"),onClick:t,className:"rounded-[4px] border border-[var(--border)] p-2 text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ae,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"px-6 py-6",children:e.jsxs("div",{className:"max-h-[40vh] overflow-y-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] p-5",children:[e.jsx("p",{className:"mb-3 text-[11px] text-[var(--text-muted)]",children:i("automation.template_prompt")}),e.jsx("p",{className:"whitespace-pre-wrap text-lg leading-9 text-[var(--text-primary)]",children:a.taskDescription})]})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-[var(--border)] px-6 py-5",children:[e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_200px]",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.project")}),e.jsx(ne,{values:f,onChange:q,options:v.map(n=>({value:n.key,label:`${n.name} (${n.key})`})),placeholder:i(s?"common.loading":"automation.select_project"),className:"w-full"})]}),a.triggerType==="cron"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.schedule")}),e.jsx("input",{type:"text",value:y,onChange:n=>k(n.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.timezone")}),e.jsx(se,{value:c,onChange:p,options:[{value:"UTC",label:"UTC"},{value:"Asia/Shanghai",label:"Asia/Shanghai"},{value:"Asia/Singapore",label:"Asia/Singapore"},{value:"America/Los_Angeles",label:"America/Los_Angeles"},{value:"America/New_York",label:"America/New_York"}],placeholder:i("automation.timezone"),className:"w-full"})]})]}):e.jsxs("div",{className:"lg:col-span-2 flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.trigger_type")}),e.jsx("div",{className:"flex h-9 items-center rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 text-xs text-[var(--text-primary)]",children:a.triggerType})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:je.map(n=>e.jsx("button",{type:"button",onClick:()=>G(n.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${m===n.value?"border-[var(--accent)] bg-[var(--accent)]/5 text-[var(--accent)]":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:n.label},n.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:w,onChange:n=>j(n.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),i("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:i("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"text-sm text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:i("automation.cancel")}),e.jsx("button",{type:"button",onClick:W,disabled:u,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-sm font-bold text-black transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",children:i(u?"automation.creating":"automation.create_from_template")})]})]})]})})}function we(){const a=R(),{t}=K(),{templates:o,loading:i,fetchTemplates:d}=M(),[v,x]=l.useState(null);if(l.useEffect(()=>{d()},[d]),i&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});if(o.length===0)return e.jsx($,{icon:H,title:t("automation.no_templates"),description:t("automation.templates_description")});const f=o.reduce((c,p)=>{const m=p.category||"other";return c[m]||(c[m]=[]),c[m].push(p),c},{}),r=Object.entries(f).sort(([c],[p])=>S(c).order-S(p).order),y=[...o].sort((c,p)=>U(c)-U(p)).slice(0,Math.min(4,o.length)),k=c=>{const p=o.find(m=>m.id===c)??null;x(p)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--accent)]",children:[e.jsx(F,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:t("automation.templates_suggested")})]}),e.jsx("h2",{className:"mt-2 text-sm font-bold text-[var(--text-primary)]",children:t("automation.templates_suggested_title")}),e.jsx("p",{className:"mt-1 max-w-2xl text-xs leading-5 text-[var(--text-muted)]",children:t("automation.templates_suggested_description")})]}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:t("automation.templates_ready_count",{count:o.length})})]}),e.jsx("div",{className:"mt-4 grid gap-3 xl:grid-cols-2",children:y.map(c=>e.jsx(D,{template:c,emphasized:!0,onUse:k,sourceLabel:c.isBuiltin?t("automation.template_source_builtin"):t("automation.template_source_custom"),actionLabel:t("automation.use_template")},`suggested-${c.id}`))})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[220px_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"h-fit rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 lg:sticky lg:top-4",children:[e.jsx("p",{className:"text-[11px] font-bold text-[var(--text-primary)]",children:t("automation.templates_browse")}),e.jsx("p",{className:"mt-1 text-[11px] leading-5 text-[var(--text-muted)]",children:t("automation.templates_browse_description")}),e.jsx("div",{className:"mt-3 space-y-1.5",children:r.map(([c,p])=>{const m=S(c),N=m.icon,w=`automation-template-category-${c}`;return e.jsxs("button",{type:"button","aria-label":t(m.titleKey),onClick:()=>{var j;(j=document.getElementById(w))==null||j.scrollIntoView({behavior:"smooth",block:"start"})},className:"flex w-full items-center justify-between rounded-[4px] border border-transparent bg-[var(--bg-input)] px-3 py-2 text-left transition-colors hover:border-[var(--border)] hover:text-[var(--text-primary)]",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-xs text-[var(--text-secondary)]",children:[e.jsx(N,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:t(m.titleKey)})]}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:p.length})]},`nav-${c}`)})})]}),e.jsx("div",{className:"space-y-6",children:r.map(([c,p])=>{const m=S(c),N=m.icon,w=`automation-template-category-${c}`;return e.jsxs("section",{id:w,className:"scroll-mt-4",children:[e.jsxs("div",{className:"mb-3 border-b border-[var(--border)] pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx(N,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:t(m.titleKey)})]}),e.jsx("h3",{className:"mt-2 text-sm font-bold text-[var(--text-primary)]",children:t(m.titleKey)}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--text-muted)]",children:t(m.descriptionKey)})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:p.map(j=>e.jsx(D,{template:j,onUse:k,sourceLabel:j.isBuiltin?t("automation.template_source_builtin"):t("automation.template_source_custom"),actionLabel:t("automation.use_template")},j.id))})]},c)})})]}),e.jsx(ke,{template:v,onClose:()=>x(null),onCreated:c=>a(`/automations/${c}`)})]})}function Ue(){const a=R(),{t}=K(),[o,i]=l.useState("inbox"),d=M(x=>x.inboxUnreadCount);l.useEffect(()=>{M.getState().fetchInboxCount()},[]),Y(l.useMemo(()=>e.jsxs("button",{onClick:()=>a("/automations/new"),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(oe,{className:"h-3.5 w-3.5"}),t("automation.new_automation")]}),[a,t]));const v=[{key:"inbox",label:t("automation.tab_inbox"),count:d>0?d:void 0},{key:"automations",label:t("automation.tab_automations")},{key:"templates",label:t("automation.tab_templates")}];return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("h1",{className:"sr-only",children:t("automation.title")}),e.jsx("div",{className:"mb-4 flex items-center gap-1 overflow-x-auto pb-1 no-scrollbar",children:v.map(x=>e.jsxs("button",{onClick:()=>i(x.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors flex items-center gap-1.5 ${o===x.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:[x.label,x.count!==void 0&&e.jsx("span",{className:"flex h-4 min-w-[16px] items-center justify-center rounded-full bg-[var(--accent)] px-1 text-[10px] font-bold text-black",children:x.count})]},x.key))}),o==="inbox"&&e.jsx(ve,{}),o==="automations"&&e.jsx(fe,{}),o==="templates"&&e.jsx(we,{})]})}export{Ue as default};
|