@hearsay-tools/squawk 0.19.0-dev.9220 → 0.19.0-dev.9235
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/activity/read-model.js +5 -2
- package/dist/activity/read-model.js.map +1 -1
- package/dist/contract/hosts.d.ts +3 -0
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +2257 -1939
- package/dist/contract/projects.d.ts +6 -0
- package/dist/contract/runs.d.ts +117 -0
- package/dist/contract/task-result.d.ts +1075 -0
- package/dist/core/forge-registry.d.ts +8 -0
- package/dist/core/forge-registry.js +36 -13
- package/dist/core/forge-registry.js.map +1 -1
- package/dist/delegation/readiness.d.ts +8 -5
- package/dist/delegation/readiness.js +23 -9
- package/dist/delegation/readiness.js.map +1 -1
- package/dist/delegation/routes.d.ts +4 -4
- package/dist/delegation/service.js +4 -2
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/worker-cleanup.js +1 -1
- package/dist/delegation/worker-cleanup.js.map +1 -1
- package/dist/features/hosts/routes.d.ts +2 -0
- package/dist/features/webhooks/routes.d.ts +3 -0
- package/dist/project-migration/journal.d.ts +2 -0
- package/dist/project-migration/journal.js +1 -1
- package/dist/project-migration/journal.js.map +1 -1
- package/dist/project-migration/plan.js +2 -0
- package/dist/project-migration/plan.js.map +1 -1
- package/dist/runs/legacy-run-rows.d.ts +1 -1
- package/dist/runs/legacy-run-rows.js +7 -3
- package/dist/runs/legacy-run-rows.js.map +1 -1
- package/dist/runs/ports.d.ts +16 -1
- package/dist/runs/project-run-connection.d.ts +3 -0
- package/dist/runs/project-run-connection.js +57 -10
- package/dist/runs/project-run-connection.js.map +1 -1
- package/dist/runs/project-run-sources.d.ts +6 -0
- package/dist/runs/project-run-sources.js +20 -0
- package/dist/runs/project-run-sources.js.map +1 -1
- package/dist/runs/run-archive.d.ts +19 -0
- package/dist/runs/run-decode.d.ts +58 -0
- package/dist/runs/run-decode.js +10 -0
- package/dist/runs/run-decode.js.map +1 -1
- package/dist/runs/run-exits.d.ts +114 -0
- package/dist/runs/run-retention.d.ts +2 -0
- package/dist/runs/run-retention.js +11 -2
- package/dist/runs/run-retention.js.map +1 -1
- package/dist/runs/store.d.ts +3 -0
- package/dist/runs/store.js +11 -5
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/task-result-commit.d.ts +24 -0
- package/dist/runs/task-result-commit.js +114 -0
- package/dist/runs/task-result-commit.js.map +1 -0
- package/dist/runs/task-results.d.ts +61 -0
- package/dist/runs/task-results.js +220 -0
- package/dist/runs/task-results.js.map +1 -0
- package/dist/runs/worker-result-commit.d.ts +12 -12
- package/dist/runs/worker-result-commit.js +77 -55
- package/dist/runs/worker-result-commit.js.map +1 -1
- package/dist/runs/worker-results.d.ts +10 -26
- package/dist/runs/worker-results.js +11 -73
- package/dist/runs/worker-results.js.map +1 -1
- package/dist/server/projects-routes.d.ts +6 -0
- package/dist/server/runs-routes.d.ts +189 -18
- package/dist/server/server.d.ts +1666 -1318
- package/dist/workflows/continuation-admission.d.ts +91 -72
- package/dist/workflows/input-acknowledgement.d.ts +24 -24
- package/dist/workflows/run/completion-gate.js +10 -4
- package/dist/workflows/run/completion-gate.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +91 -72
- package/dist/workspace/projects.d.ts +5 -0
- package/dist/workspace/projects.js +8 -2
- package/dist/workspace/projects.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-BOZ9JyE6.js +1 -0
- package/web/dist/assets/{activity-motion-CXlbNrMI.js → activity-motion-D48R7Vry.js} +1 -1
- package/web/dist/assets/{activity-route-BL-QWLNp.js → activity-route-jcGRtnMT.js} +1 -1
- package/web/dist/assets/{agent-accounts-Du8CHfFX.js → agent-accounts-CUthX0Yh.js} +1 -1
- package/web/dist/assets/{agent-config-section-BzMSlPK0.js → agent-config-section-BvwoyNZb.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-CqEVmRK0.js → agent-defaults-section-Hb-jy4TN.js} +1 -1
- package/web/dist/assets/{appearance-vI6ae_So.js → appearance-EXKzoghV.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-C4hrO55O.js → archive-on-merge-field-Ni7bKGkG.js} +1 -1
- package/web/dist/assets/{ask-card-hEb8IHjL.js → ask-card-CkE44gm3.js} +3 -3
- package/web/dist/assets/automations-route-3bhtdTy3.js +2 -0
- package/web/dist/assets/{commit-list-Jr1_04RS.js → commit-list-DSw7qvVY.js} +1 -1
- package/web/dist/assets/{diff-BOF9OXhn.js → diff-BidPzsVK.js} +2 -2
- package/web/dist/assets/{diff-controls-CkxtRrbB.js → diff-controls-DeMSGYln.js} +1 -1
- package/web/dist/assets/{diff-view-Chu6rn_i.js → diff-view-BqU4sJld.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-BB47RqdX.js → discard-changes-dialog-B1AO0GSt.js} +1 -1
- package/web/dist/assets/{file-preview-DNM-krBZ.js → file-preview-BIZXTzkp.js} +1 -1
- package/web/dist/assets/{folder-browser-TNWat5kt.js → folder-browser-C9Phl0rS.js} +1 -1
- package/web/dist/assets/{git-toolbar-CoKBTzNV.js → git-toolbar-BBon1yHh.js} +1 -1
- package/web/dist/assets/{github-t611QkCi.js → github-QOB5Qi4v.js} +1 -1
- package/web/dist/assets/{global-activity-route-B9DMoviv.js → global-activity-route-lSnYAZE9.js} +1 -1
- package/web/dist/assets/{host-context-iTMFRMT5.js → host-context-KsSKxKbI.js} +1 -1
- package/web/dist/assets/host-storage-BHtMSWBL.js +1 -0
- package/web/dist/assets/{hosts-rdWe_OBc.js → hosts-DDwDUxT9.js} +1 -1
- package/web/dist/assets/{image-preview-C_xACQXI.js → image-preview-CvcSCCBU.js} +1 -1
- package/web/dist/assets/index-BuR9xHfb.js +21 -0
- package/web/dist/assets/index-DZXi-K2N.css +1 -0
- package/web/dist/assets/{label-B_s8eiYA.js → label-D6vgq5lF.js} +1 -1
- package/web/dist/assets/{markdown-Bmdr6MIa.js → markdown-A6dvDky9.js} +1 -1
- package/web/dist/assets/{open-in-menu-DkFneOWr.js → open-in-menu-Bb_jc7pm.js} +1 -1
- package/web/dist/assets/{option-select-BxTmKg8G.js → option-select-CCpypHbW.js} +1 -1
- package/web/dist/assets/{preferences-section-B_yl_o-g.js → preferences-section-B75Zx0mY.js} +1 -1
- package/web/dist/assets/{preview-D3zYSmIA.js → preview-DiBpgf-5.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-s9LvCVbp.js → preview-pane-connected-BVu2oO0V.js} +2 -2
- package/web/dist/assets/{project-location-BczZtNyO.js → project-location-D1etWKHg.js} +1 -1
- package/web/dist/assets/{project-router-CfEuKuz1.js → project-router-yoWCTDaT.js} +1 -1
- package/web/dist/assets/project-scope-context-hfRzPMZ4.js +4 -0
- package/web/dist/assets/{projects-section-C6DnyUa2.js → projects-section-BRnIJ47e.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-BQvKWcaX.js → prompt-templates-section-D7JLM5BM.js} +2 -2
- package/web/dist/assets/queries-ChH9ctc-.js +1 -0
- package/web/dist/assets/{reference-chip-e-fG4-yW.js → reference-chip-BPRZm7Kb.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CUqI2DdF.js → remote-settings-notice-Ip6H5hLU.js} +1 -1
- package/web/dist/assets/{repo-git-NG_TxE7N.js → repo-git-Wf30akEt.js} +1 -1
- package/web/dist/assets/{report-reader-LYNHrAe-.js → report-reader-DhcZcNql.js} +1 -1
- package/web/dist/assets/{report-selection-nUbQVjJu.js → report-selection-CwPw7vbG.js} +1 -1
- package/web/dist/assets/{reports-DuT4m7i5.js → reports-DPKDwzxY.js} +1 -1
- package/web/dist/assets/{resources-section-CT48TCXY.js → resources-section-DaWcyqur.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-C7HCRebB.js → review-notes-drafts-D7QuBuTL.js} +1 -1
- package/web/dist/assets/{review-panel-BffLSkRo.js → review-panel-Bpxl4TvO.js} +1 -1
- package/web/dist/assets/{review-strip-COa0ir6V.js → review-strip-Da5n1k8s.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-Db5HOGMX.js → run-detail-refresh-CVSK_VKG.js} +1 -1
- package/web/dist/assets/{run-diff-DldSY8BJ.js → run-diff-CPuNFD3X.js} +1 -1
- package/web/dist/assets/run-header-B8EAOHFc.js +2 -0
- package/web/dist/assets/{select-Cd8wvwvm.js → select-xjUzLrk9.js} +1 -1
- package/web/dist/assets/{session-context-section-CW8DS0dW.js → session-context-section-C7OTexKU.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-an3ysM1B.js → settings-agent-picker-mESK-hj4.js} +1 -1
- package/web/dist/assets/{settings-save-bar-BiHFQ4c0.js → settings-save-bar-BUaa1kHw.js} +1 -1
- package/web/dist/assets/{settings-shell-KZ801oLH.js → settings-shell-BKSsBxqQ.js} +1 -1
- package/web/dist/assets/{sidebar-section-BRMO7aY4.js → sidebar-section-BFBZlQ-x.js} +1 -1
- package/web/dist/assets/{skills-DHkLoxXb.js → skills-BSqszv5g.js} +1 -1
- package/web/dist/assets/{status-dot-Da1M54kK.js → status-dot-Fp5SnPHI.js} +1 -1
- package/web/dist/assets/{tab-link-DL1UtKVR.js → tab-link-j06AaWSU.js} +1 -1
- package/web/dist/assets/{task-changes-CQhwyj0L.js → task-changes-B4KFHxVa.js} +2 -2
- package/web/dist/assets/{task-commits-CTP8izpc.js → task-commits-D-UAUoZ5.js} +1 -1
- package/web/dist/assets/{task-file-scope-CDIfOvl-.js → task-file-scope-BhWG35a8.js} +1 -1
- package/web/dist/assets/{task-files-CGlRH86B.js → task-files-BOCx_Lp0.js} +1 -1
- package/web/dist/assets/{task-github-item-ChgjULzj.js → task-github-item-CZqaaxNv.js} +1 -1
- package/web/dist/assets/task-thread-D3d419VX.js +2 -0
- package/web/dist/assets/{thread-state-D2KJrZ1o.js → thread-state-B0pz2Y8K.js} +1 -1
- package/web/dist/assets/{use-finish-run-DifixlCM.js → use-finish-run-TX3pIPCS.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-Bjh1EnB3.js → use-hand-to-agent-state-D2oChRzw.js} +1 -1
- package/web/dist/assets/use-path-bases-DFxEHoyU.js +1 -0
- package/web/dist/assets/use-workspace-config-save-DR8brU5p.js +1 -0
- package/web/dist/assets/{workflows-BDc-MpiC.js → workflows-BwzNhxT0.js} +1 -1
- package/web/dist/assets/{workspace-tools-D7kUSb-0.js → workspace-tools-Be_j9oke.js} +1 -1
- package/web/dist/assets/{worktrees-section-Cv65NBgq.js → worktrees-section-cnibWU5-.js} +4 -4
- package/web/dist/assets/{zoomable-image-DJ1lJEMc.js → zoomable-image-Dv85Vr4A.js} +1 -1
- package/web/dist/index.html +17 -17
- package/web/dist/live-worker.js +1 -1
- package/web/dist/assets/accounts-section-s6sAdUT8.js +0 -1
- package/web/dist/assets/automations-route-Bd6crv15.js +0 -2
- package/web/dist/assets/host-storage-Cr_NKfWy.js +0 -1
- package/web/dist/assets/index-C3kap2_j.js +0 -21
- package/web/dist/assets/index-CWmMYQdT.css +0 -1
- package/web/dist/assets/project-scope-context-DNrHbqd2.js +0 -4
- package/web/dist/assets/queries-DD_9iITj.js +0 -1
- package/web/dist/assets/run-header-DxpN6yVQ.js +0 -2
- package/web/dist/assets/task-thread-Cj9B2ISO.js +0 -2
- package/web/dist/assets/use-path-bases-AV9YYh2B.js +0 -1
- package/web/dist/assets/use-workspace-config-save-02qlUK8v.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,F as i,G as a,J as o,M as s,P as c,St as l,W as u,_r as d,bt as f,et as p,ft as m,gt as h,ht as g,j as _,pt as v,rt as y}from"./queries-DD_9iITj.js";import{An as b,Bi as x,Cn as S,Zi as C,a as w,qn as ee,wn as T}from"./project-scope-context-DNrHbqd2.js";import{p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{b as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./createLucideIcon-BHp8sXmF.js";import{t as te}from"./folder-browser-TNWat5kt.js";import{t as k}from"./button-BV_AiLj2.js";import{t as ne}from"./badge-DAnkqD7i.js";import{a as re,i as ie,o as ae,r as oe,s as se,t as A}from"./dialog-DKr-j9S6.js";import{t as j}from"./status-dot-Da1M54kK.js";import{n as M}from"./agents-settings-path-7X6_cvUg.js";import{t as N}from"./centered-state-N8vWM_Hw.js";import{$t as P,Hn as F,I,Mn as L,On as R,P as z,R as B,an as V,en as H,in as U,jn as W,nn as G,on as K,rn as ce,tn as le}from"./index-C3kap2_j.js";import{t as q}from"./option-select-BxTmKg8G.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-an3ysM1B.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-CUqI2DdF.js";import{n as he,t as ge}from"./save-cue-CpHgT93o.js";import{t as _e}from"./use-path-bases-AV9YYh2B.js";import{t as ve}from"./use-workspace-config-save-02qlUK8v.js";var ye=O(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),be=`~/.claude-second`;function xe({open:e,onOpenChange:t,providers:n,initialProvider:r}){let a=f().data,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(r??n[0]??`claude`),[p,m]=(0,Y.useState)(``),[h,_]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=i(),S=h.trim();return(0,X.jsx)(A,{open:e,onOpenChange:t,children:(0,X.jsxs)(oe,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ae,{children:[(0,X.jsx)(se,{children:`Add agent account`}),(0,X.jsx)(ie,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:u,onValueChange:e=>d(e),className:`settings-select max-w-full bg-card text-[13px]`,options:n.map(e=>({value:e,label:v(a,e)}))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:p,placeholder:`Work`,onChange:e=>m(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:h,placeholder:g(a,u)?.accountFolderExample??be,onChange:e=>{_(e.target.value),l(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(te,{path:o,selected:c,onSelect:e=>{l(e),_(e.path),x.reset()},onEnter:e=>{s(e),l(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(re,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(k,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(k,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:u,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),m(``),_(``),l(null),b(!1),w(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function Se(e){return b(await T.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function Ce(e,t){return b(await T.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var we={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function Te(e){let t=r().data?.capabilities?.settingsAdmin===!0,n=C(),i=[`runner-install`,e],a=x({queryKey:i,queryFn:()=>Se(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),o=d({mutationFn:t=>Ce(e,t),retry:!1,onSuccess:e=>{n.setQueryData(i,e)}}),s=a.data;return{allowed:t,data:s,busy:o.isPending||!!s&&s.phase!==`idle`&&s.phase!==`failed`,error:o.error?.message??a.error?.message??s?.error,action:o,status:a}}function Ee({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(k,{className:`active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(k,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(k,{className:`active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function De({runner:e}){let t=Te(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${we[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Ee,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var Oe={connected:L(`connected`),disconnected:L(`disconnected`),"not-installed":L(`not-installed`),unknown:L(`unknown`)};function ke(){let e=s(),t=f();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(N,{icon:(0,X.jsx)(ye,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(je,{data:e.data,runners:t.data})}function Z(e,t){let n=F(e,t),r=n.split(`/`);return r.length>4?`…/${r.slice(-3).join(`/`)}`:n}function Ae(){let{hash:e}=E();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function je({data:e,runners:t}){let n=r(),[i,a]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=o();return Ae(),pe(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(fe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:me}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Fe,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>a(r.id),onRemove:c},r.id))}),(0,X.jsx)(Ie,{runners:t}),i===null?null:(0,X.jsx)(xe,{open:!0,onOpenChange:e=>!e&&a(null),providers:e.profileCapableProviders,initialProvider:i},i),(0,X.jsx)(P,{open:s!==null,onOpenChange:e=>!e&&c(null),children:(0,X.jsxs)(G,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(K,{children:[`Remove “`,s?.label,`”?`]}),(0,X.jsxs)(ce,{children:[`This only forgets the account. Nothing in `,s?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(U,{children:[(0,X.jsx)(le,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:l.isPending,onClick:()=>{let e=s;e&&l.mutate(e.id,{onSuccess:()=>{c(null),w(`Removed ${e.label}`)},onError:e=>w(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Me({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:W(t.version)?`CLI simulated`:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Ne,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Ne({version:e}){return W(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:R.label}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function Pe({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Q({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(Pe,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Fe({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${M(l)}-title`,m=i&&o?(0,X.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Me,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:M(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(De,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function Ie({runners:e}){let[t,n]=(0,Y.useState)(null),r=y(),i=u(),a=l(h(e)),o=ve(),s=he(),c=e=>o.mutate(e,{onSuccess:s.flash});if(r.data===void 0)return null;let d=ue([],e),f=r.data.agentDefaults.runner??`claude`,p=m(t??f,h(e))??t??f,g=r.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own. `,(0,X.jsx)(ge,{saved:s.saved})]})]}),(0,X.jsx)(de,{rows:d,runner:f,accountFor:()=>null,providerStatus:i,disabled:o.isPending,onPick:e=>{e!==f&&c({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,className:`settings-select max-w-full`,value:p,onValueChange:e=>n(e),options:e.runners.map(e=>({value:e.id,label:e.displayName}))})]}),e.runners.filter(e=>e.id===p).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(D,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsx)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:g[t.id]??``,disabled:o.isPending,onValueChange:e=>c({agentDefaults:{models:{[t.id]:e||null}}}),className:`settings-select w-64 max-w-full bg-card`,options:[...B(t.id,e,a[t.id]?.data,[g[t.id]]).map(e=>({value:e.id,label:e.label})),...Le(t.id,e,a[t.id])]})]},t.id))]})]})}function Le(e,t,n){let r=I(e,t,n);return r?[{value:z,label:r,disabled:!0}]:[]}function Re({account:e,runners:t,status:n,editable:r}){let i=c();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&g(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&g(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(k,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>w(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>w(e instanceof S&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function ze(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${v(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let o=ee(e),s=a(),c=_e(),l=_(o,e.status===void 0),u=e.status??l.data?.status,d=u?Oe[u.status]:void 0,f=ze(e,t,u,n),p=f?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:d?`Sign-in: ${d.label}`:void 0,children:[(0,X.jsx)(j,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":f.slot,className:`text-foreground`,children:f.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(j,{tone:d?.tone??`neutral`,pulse:d===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:d?.label??`Checking…`})]}),m=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Re,{account:e,runners:t,status:u,editable:n}),(0,X.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:s.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>s.mutate(o,{onError:e=>w(e.message,{tone:`danger`})}),children:`Check again`})]}),h=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(ne,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-xs font-normal text-muted-foreground`,children:`discovered`}):null]}),g=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Z(e.configDir,c)}):null,v=f?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:f.guidance}):null,y=u?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:u.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Be,{account:e,onRemove:r}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[h,p]}),g,v,y]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Q,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[m,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[m,b]})]})}function Be({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=p();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>w(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ke as GlobalAgentsSection};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,bt as i,g as a,k as o,vt as s,yt as c}from"./queries-DD_9iITj.js";import{u as l}from"./host-context-iTMFRMT5.js";import{$r as u,Cn as d,H as f,Li as p,Qr as m,Ri as h,U as g,V as _,W as ee,Xr as v,_ as y,c as b,d as te,g as ne,o as re,s as ie,ti as ae,tr as oe,v as se}from"./project-scope-context-DNrHbqd2.js";import{B as x,G as ce,H as S,I as C,K as le,N as w,P as T,V as ue,W as E,j as D,z as O}from"./live-protocol-CNUmr-VT.js";import{g as de,n as fe}from"./chunk-KS7C4IRE-BdLLx37K.js";import{r as pe,t as k}from"./label-B_s8eiYA.js";import{o as A}from"./dist-CCX8mhHc.js";import{L as me,X as he,Z as ge,b as _e,ft as ve,ht as ye,nt as be,ot as xe,u as Se}from"./design-icons-QbNMZniQ.js";import{t as Ce}from"./check-OP-CVgZG.js";import{t as j}from"./button-BV_AiLj2.js";import{n as we,r as Te,t as Ee}from"./collapsible-D5i3hm2L.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-Cd8wvwvm.js";import{t as De}from"./switch-B9OfOEzC.js";import{c as Oe,s as ke,t as L}from"./project-router-CfEuKuz1.js";import{c as R,d as z,f as Ae,l as je,n as Me,o as Ne}from"./page-shell-BdjH5hyc.js";import{a as Pe}from"./agent-accounts-Du8CHfFX.js";import{r as Fe}from"./agents-settings-path-7X6_cvUg.js";import{t as Ie}from"./centered-state-N8vWM_Hw.js";import{$ as Le,Gn as Re,Kn as ze,M as Be,N as Ve,R as He,Sr as Ue,Tn as We,X as Ge,Z as Ke,ir as qe,j as Je,kn as Ye,lr as B,t as Xe}from"./index-C3kap2_j.js";import{t as Ze}from"./textarea-BGp28xFr.js";import{_ as Qe,a as $e,c as et,d as tt,f as nt,g as rt,h as it,i as at,l as ot,m as st,n as ct,o as lt,p as ut,r as dt,s as ft,t as V,u as pt,v as mt}from"./automation-format-jKMOXcHS.js";var H=e(t(),1),U=D([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),ht=x({includeExisting:T().optional(),authors:w(E()).optional(),assignees:w(E()).optional(),requireCurrentLabels:T().optional(),allLabels:w(E()).optional(),anyLabels:w(E()).optional(),excludeLabels:w(E()).optional(),changedLabels:w(E()).optional(),lookbackDays:O(),maxRecords:O()}),gt=D([`github`,`schedule`]),_t=v.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:E(),variants:ce([C(1),C(2),C(3)]).optional(),systemPrompt:E().optional()}),vt=x({at:E(),outcome:D([`launched`,`cancelled`]),runId:E().optional(),receiptId:E().optional(),trigger:D([`schedule`,`late`,`manual`,`retry`]).optional()}),W=x({id:E(),revision:O(),name:E(),description:E().optional(),enabled:T(),kind:gt,events:w(U).optional(),intervalSeconds:O().optional(),filters:ht.optional(),schedule:et.optional(),task:_t,archived:vt.optional(),createdAt:E(),updatedAt:E()}),G=x({timestamp:E(),tieBreaker:E().optional()}),yt=x({since:E().datetime(),until:E().datetime(),source:O().int().min(0).max(2),page:O().int().min(1).max(10),item:O().int().min(0).max(100),event:O().int().min(0).max(1e3),cursor:G.optional()}),bt={lastError:E().max(1e3).optional(),lastErrorAt:E().datetime().optional()},xt=x({revision:O().optional(),baselineAt:E().optional(),armedAt:E().optional(),historyScan:yt.optional(),cursor:G.optional(),frozenHighWatermark:G.extend({tieBreaker:E()}).optional(),backlogAfter:G.extend({tieBreaker:E()}).optional(),nextCheckAt:E().optional(),lastSuccessAt:E().optional(),nextRunAt:E().optional(),lastRunAt:E().optional(),etags:S(E(),E()).optional(),backoffUntil:E().optional(),consecutiveFailures:O().optional(),...bt,onceOutcome:D([`failed`,`missed`]).optional()});function St(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var Ct=D([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),wt=x({seq:O(),ts:E(),automationId:E(),revision:O(),event:U.optional(),result:Ct,reason:E().optional(),durationMs:O().optional(),receiptId:E().optional(),runId:E().optional(),githubNumber:O().optional(),githubTitle:E().optional(),githubUrl:E().optional(),rateLimit:x({bucket:D([`core`,`search`]),remaining:O().optional(),resetAt:E().optional()}).optional()}),Tt=x({matches:O(),launched:O(),duplicates:O(),errors:O()}),Et=W.extend({state:xt.optional(),latestLog:wt.optional(),counts:Tt,nextRunAt:E().optional(),onceStatus:ut.optional()});x({available:T(),reason:E().optional(),timeZone:E(),scheduler:x({state:D([`scheduled`,`idle`]),nextDue:E().optional()}),automations:w(Et)}),x({automation:W}).extend({once:x({dueAt:E(),timeZone:E(),resolvedInstant:E(),note:E()}).optional()}),x({automation:W,state:xt.optional(),latestLog:wt.optional(),onceStatus:ut.optional()}),x({id:E(),automationId:E(),mode:D([`preview`,`execute`]),status:D([`queued`,`running`,`complete`,`error`]),createdAt:E(),completedAt:E().optional(),matches:O().optional(),truncated:T().optional(),error:E().optional()}),x({checkId:E()}),x({records:w(wt)}),x({receiptId:E(),runId:E()}),x({runId:E()}),W.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:gt.optional(),task:_t.omit({variants:!0}).strict(),enable:T().optional()}).omit({enable:!0}).extend({enabled:T().optional(),expectedRevision:O()}),x({archived:D([`include`,`only`]).optional()}),x({mode:D([`preview`,`execute`])});var K=n();function q({text:e}){return(0,K.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Dt={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`pending`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},Ot={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function kt(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>y(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,H.useEffect)(()=>{a()},[a]),(0,H.useEffect)(()=>oe(a),[a]),(0,H.useEffect)(()=>pe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function At(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function jt({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&At(e,t),[o,s]=(0,H.useState)(),[c,l]=(0,H.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await _(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,K.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(qe,{dot:Dt[e.result],children:Ot[e.result]}),(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:ct(e.ts,n,u)})]}),e.reason?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,K.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,K.jsx)(j,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var J=`all`;function Mt({label:e,value:t,onChange:n,options:r}){return(0,K.jsxs)(I,{value:t,onValueChange:n,children:[(0,K.jsx)(N,{"aria-label":e,className:`w-full sm:w-52`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:r.map(e=>(0,K.jsx)(F,{value:e.value,children:e.label},e.value))})]})}function Nt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=kt(e),[s,c]=(0,H.useState)(J),[l,u]=(0,H.useState)(J),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===J||e.result===s)&&(l===J||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,K.jsx)(je,{route:`automations`,density:i?Ae(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,K.jsx)(R,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:a}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,K.jsx)(q,{text:`Nothing has run yet.`}):(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Mt,{label:`Result`,value:s,onChange:c,options:[{value:J,label:`All results`},...Ct.options.map(e=>({value:e,label:Ot[e]}))]}),f?(0,K.jsx)(Mt,{label:`Event`,value:l,onChange:u,options:[{value:J,label:`All events`},...U.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,K.jsx)(q,{text:`No rows match these filters.`}):(0,K.jsx)(jt,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,K.jsx)(q,{text:`Loading execution log…`})})}function Pt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=kt(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`flex flex-wrap items-center gap-x-2 border-t border-border pt-2.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,K.jsx)(jt,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function Ft({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?dt(i):null,[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(``),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await te(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,K.jsx)(je,{route:`automations`,density:`sparse`,header:{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`},children:(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,K.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${V(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,K.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,K.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,K.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(Pt,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,K.jsx)(j,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,K.jsx)(j,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,K.jsx)(j,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})]}),u?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var It=D([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Y=w(E().trim().min(1).max(200)).max(100).optional(),Lt=x({includeExisting:T().optional(),requireCurrentLabels:T().optional(),authors:Y,assignees:Y,allLabels:Y,anyLabels:Y,excludeLabels:Y,changedLabels:Y,lookbackDays:O().int().min(1).max(90).default(7),maxRecords:O().int().min(1).max(100).default(25)}).passthrough(),Rt=x({prompt:E().min(1).max(1e5),workflow:E().trim().min(1).max(200).optional(),steps:w(m).min(1).max(100).optional(),runner:p.optional(),model:E().trim().min(1).max(200).optional(),effort:E().trim().min(1).max(32).optional(),variants:ce([C(1),C(2),C(3)]).optional(),worktree:T().optional(),autonomous:T().optional(),...u,...ae,systemPrompt:E().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),zt=new Set(Object.keys(Rt.shape).filter(e=>e!==`variants`));function Bt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>zt.has(e)))}ue(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},x({id:E().min(1).max(100),revision:O().int().positive(),name:E().trim().min(1).max(200),description:E().max(2e3).optional(),enabled:T().default(!1),kind:gt.default(`github`),events:w(It).min(1).max(4).optional(),intervalSeconds:O().int().min(60).max(86400).optional(),filters:Lt.optional(),schedule:et.passthrough().optional(),task:Rt,archived:x({at:E().datetime(),outcome:D([`launched`,`cancelled`]),runId:E().optional(),receiptId:E().optional(),trigger:D([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:E().datetime(),updatedAt:E().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:h.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:h.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:h.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:h.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:h.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),x({version:C(1).default(1),automations:w(le()).default([]),tombstones:S(E(),E().datetime()).optional()}).passthrough();var X=x({timestamp:E().datetime(),tieBreaker:E().optional()}).passthrough(),Vt=yt.extend({cursor:X.optional()}),Ht=x({revision:O().int().positive().optional(),baselineAt:E().datetime().optional(),armedAt:E().datetime().optional(),historyScan:Vt.optional(),cursor:X.optional(),frozenHighWatermark:X.extend({tieBreaker:E()}).optional(),backlogAfter:X.extend({tieBreaker:E()}).optional(),nextCheckAt:E().datetime().optional(),lastSuccessAt:E().datetime().optional(),nextRunAt:E().datetime().optional(),lastRunAt:E().datetime().optional(),etags:S(E(),E()).optional(),backoffUntil:E().datetime().optional(),consecutiveFailures:O().int().nonnegative().optional(),...bt,onceOutcome:D([`failed`,`missed`]).optional()}).passthrough();x({version:C(1).default(1),states:S(E(),Ht).default({})}).passthrough(),x({receiptId:E().min(1),receiptKey:E().min(1),eventId:E().min(1),automationId:E().min(1),revision:O().int().positive(),status:D([`reserved`,`launched`,`launch-error`,`released`]),runId:E().optional(),observedAt:E().datetime(),updatedAt:E().datetime(),error:E().max(2e3).optional(),occurrenceAt:E().datetime().optional(),candidate:x({eventId:E(),event:It,timestamp:E().datetime(),tieBreaker:E(),repo:E(),nodeId:E(),number:O().int().positive(),title:E().max(500),url:E().url(),author:E().max(200),assignees:w(E().max(200)).max(100),labels:w(E().max(200)).max(100),changedLabel:E().max(200).optional()}).passthrough().optional()}).passthrough();var Ut=D([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);x({seq:O().int().positive(),ts:E().datetime(),automationId:E().min(1),revision:O().int().positive(),event:It.optional(),result:Ut,reason:E().max(2e3).optional(),durationMs:O().int().nonnegative().optional(),receiptId:E().optional(),runId:E().optional(),githubNumber:O().int().positive().optional(),githubTitle:E().max(500).optional(),githubUrl:E().url().optional(),rateLimit:x({bucket:D([`core`,`search`]),remaining:O().int().nonnegative().optional(),resetAt:E().datetime().optional()}).passthrough().optional()}).passthrough();var Wt=`quick-task`;function Gt(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Bt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:pt(e.schedule??{type:`daily`}),events:e.events??[U.options[0]],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Wt}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function Kt(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function qt(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Jt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Kt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:qt(e)}}function Yt(e){return{...Jt(e),enable:e.enabled}}function Xt(e,t){return{...Jt(e),task:{...qt(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Z(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Zt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Qt=new Set([`anyLabels`,`authors`,`changedLabels`]);function $t(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!Zt.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Qt.has(e)&&Array.isArray(t)&&t.length>0)}function en(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function tn(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function Q(e,t){return t.startsWith(`-`)?`--${e}=${Z(t)}`:`--${e} ${Z(t)}`}function nn(e){let t=[`${We()} automation add`,Q(`name`,e.name)];if(e.schedule?.type===`once`)t.push(Q(`at`,e.schedule.at),Q(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(Q(`latest-start`,tn(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Q(`cron`,ot(e.schedule)));else{t.push(Q(`on`,e.events.join(`,`)),`--every ${en(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(Q(`label`,n));for(let n of e.filters?.authors??[])t.push(Q(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(Q(`changed-label`,n))}return t.push(...rn(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Q(`prompt`,e.task.prompt)),t.join(` `)}function rn(e){let t=[];return e.workflow&&t.push(Q(`workflow`,e.workflow)),e.runner&&t.push(Q(`runner`,e.runner)),e.model&&t.push(Q(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function an(e,t){let n=Yt(e),r=$t(n)?nn(n):`${We()} automation create --json ${Z(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Z(t.origin)} CEZ_PROJECT_ID=${Z(t.projectId)} HSQ_COCKPIT_URL=${Z(t.origin)} HSQ_PROJECT_ID=${Z(t.projectId)} ${r}`:r}function on(e){let t=[],n=!1;for(let r of sn(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
|
|
2
|
-
`)}function sn(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];!r&&a===`\\`&&i+1<e.length?(n+=a+e[i+1],i+=1):a===`'`?(r=!r,n+=a):a===` `&&!r?(n&&t.push(n),n=``):n+=a}return n&&t.push(n),t}function cn({draft:e,saveLabel:t,editing:n}){let r=ke(),i=l(),a=window.location.origin,o=(0,H.useMemo)(()=>{let t=an(e);return r?`HSQ_COCKPIT_URL=${Z(a)} HSQ_PROJECT_ID=${Z(r)} ${t}`:t},[e,a,r]),s=(0,H.useMemo)(()=>on(o),[o]),[c,u]=(0,H.useState)(`idle`),[d,f]=(0,H.useState)(!1),p=(0,H.useId)(),m=(0,H.useRef)(void 0);if((0,H.useEffect)(()=>()=>clearTimeout(m.current),[]),(0,H.useEffect)(()=>u(`idle`),[o]),i)return(0,K.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`min-w-0 max-w-full overflow-hidden rounded-xl border border-card-edge bg-card shadow-card px-4 py-3.5`,children:[(0,K.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,K.jsx)(`p`,{"data-slot":`copy-as-cli-remote-note`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:`Run automation CLI commands on that machine.`})]});let h=async()=>{clearTimeout(m.current);try{await navigator.clipboard.writeText(s),u(`copied`),m.current=setTimeout(()=>u(`idle`),1600)}catch{u(`failed`)}};return(0,K.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`min-w-0 max-w-full overflow-hidden rounded-xl border border-card-edge bg-card shadow-card px-4 py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,K.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,K.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":d,"aria-controls":p,"aria-label":d?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium`,onClick:()=>f(e=>!e),children:[(0,K.jsx)(`span`,{className:`truncate`,children:d?`Hide`:`Show`}),(0,K.jsx)(Se,{"aria-hidden":`true`,className:A(`size-3.5 transition-transform`,d&&`rotate-180`)})]}),(0,K.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium`,onClick:()=>void h(),children:[c===`copied`?(0,K.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5`}):(0,K.jsx)(Ue,{"aria-hidden":`true`,className:`size-3.5`}),c===`copied`?`Copied`:`Copy`]})]}),(0,K.jsx)(`div`,{id:p,hidden:!d,className:`mbs-2 max-w-full rounded-lg border border-border bg-muted has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:(0,K.jsx)(`pre`,{"data-slot":`copy-as-cli-line`,tabIndex:0,"aria-label":`Command line`,className:`m-0 max-w-full px-3 pt-2.5 pb-3 font-mono text-xs leading-5 break-all whitespace-pre-wrap text-muted-foreground outline-none`,children:s})}),(0,K.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:c===`failed`?`Could not copy — select the line and copy it by hand.`:(0,K.jsxs)(K.Fragment,{children:[`The definition ${t} would ${n?`save`:`create`}.`,` `,(0,K.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${We()} automation schema`}),` prints its shape.`]})})]})}function ln({pressed:e,onClick:t,disabled:n,children:r}){return(0,K.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:A(`inline-flex min-h-11 items-center justify-center rounded-md border px-3.5 text-[13px] font-medium transition-colors outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50`,e?`border-border bg-card font-semibold text-foreground shadow-xs`:`border-transparent bg-transparent text-muted-foreground hover:text-foreground`),children:r})}var un={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},dn={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function fn(e){let t=e.map(e=>un[e]);if(t.length===0)return`When GitHub changes`;let n=t.slice(0,-1),r=t[t.length-1];return`When ${n.length>0?`${n.join(`, `)} or ${r}`:r}`}var pn=U.options,mn=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],hn=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],gn=e=>(e??[]).join(`, `),_n=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function vn(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function yn(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${vn(e.filters.includeExisting)}`}function bn({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=_n(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=mn.some(t=>t.seconds===e.intervalSeconds)?mn:[...mn,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,K.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,K.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:pn.map(t=>(0,K.jsx)(ln,{pressed:e.events.includes(t),onClick:()=>r(t),children:dn[t]},t))}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-interval`,children:`Check every`}),(0,K.jsxs)(I,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,K.jsx)(N,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:o.map(e=>(0,K.jsx)(F,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(De,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,K.jsx)(`span`,{children:`Include existing items`})]}),(0,K.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:vn(e.filters.includeExisting)})]}),(0,K.jsxs)(Ee,{children:[(0,K.jsxs)(Te,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,K.jsx)(Se,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,K.jsx)(we,{children:(0,K.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[hn.map(t=>(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,K.jsx)(B,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:gn(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,K.jsx)(B,{id:`automation-filter-lookback`,className:`border-border`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,K.jsx)(B,{id:`automation-filter-max`,className:`border-border`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var xn=e=>String(e).padStart(2,`0`);function Sn({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,H.useState)(xn(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${xn(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 border-border text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(xn(t))}),s?(0,K.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var Cn=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],wn=`none`,Tn=e=>String(e).padStart(2,`0`);function En(e,t=Date.now()){let n=mt(t,e)??mt(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${Tn(r.getUTCMonth()+1)}-${Tn(r.getUTCDate())}T09:00`}function Dn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function On({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?st(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${Tn(t)}:${Tn(n)}`}),l=(0,H.useRef)(null),u=(0,H.useId)(),d=nt(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,H.useEffect)(()=>{l.current?.setCustomValidity(f?$e:``)},[f]);let p=dt(e);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-once-date`,children:`Date`}),(0,K.jsx)(B,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full border-border`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(Sn,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(Sn,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,K.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:$e}):null,(0,K.jsx)(An,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,K.jsx)(jn,{value:e.latestStartMinutes,onChange:t=>n(kn(e,t))}),p?(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function kn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function An({value:e,onCommit:t}){let[n,r]=(0,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(Dn),c=n!==e||!Qe(n),l=rt(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,K.jsx)(B,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full border-border sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),Qe(e.target.value)&&t(e.target.value)}}),(0,K.jsx)(`datalist`,{id:a,children:s.map(e=>(0,K.jsx)(`option`,{value:e},e))}),c?(0,K.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function jn({value:e,onChange:t}){let n=Cn.some(t=>t.minutes===e)||e===void 0?Cn:[...Cn,{minutes:e,label:`${e} minutes`}];return(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,K.jsxs)(I,{value:e===void 0?wn:String(e),onValueChange:e=>t(e===wn?void 0:Number(e)),children:[(0,K.jsx)(N,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:n.map(e=>(0,K.jsx)(F,{value:e.minutes===void 0?wn:String(e.minutes),children:e.label},e.label))})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var Mn=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function Nn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??En(r),timeZone:e.timeZone??r}:{type:t});return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:Mn.map(t=>(0,K.jsx)(ln,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,K.jsx)(On,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,K.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:ft.map((t,n)=>(0,K.jsx)(ln,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(k,{htmlFor:`automation-every`,children:`Run every`}),(0,K.jsxs)(I,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,K.jsx)(N,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(P,{children:lt.map(e=>(0,K.jsx)(F,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(Sn,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(Sn,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,K.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,K.jsx)(`code`,{className:`font-mono text-foreground`,children:ot(e)})]})]})}var Pn=40*864e5,Fn=5;function In({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,K.jsx)(Ln,{schedule:e,now:n});let r=tt(e,n+1,n+Pn,t,Fn);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,K.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,K.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,K.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:V(new Date(e).toISOString(),t)}),(0,K.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:at(n,e)})]},e))}),(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Ln({schedule:e,now:t}){let n=nt(e),r=dt(e);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,K.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:at(t,n)}):null]}),r?.note?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,K.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,K.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var Rn={schedule:`On a schedule`,github:`When GitHub changes`};function zn(e){return/time zone|due time/i.test(e)?`when`:/autonomous/i.test(e)?`execution`:/placeholder|prompt|workflow|runner|model|task/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function Bn({title:e,icon:t,hideLegend:n=!1,failure:r,section:i,children:a}){let o=(0,H.useId)();return(0,K.jsxs)(`section`,{role:n?void 0:`group`,"aria-labelledby":n?void 0:o,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[n?null:t?(0,K.jsxs)(`h2`,{id:o,className:`flex items-center gap-2 text-base font-semibold text-foreground`,children:[t,e]}):(0,K.jsx)(`h2`,{id:o,className:`text-sm font-semibold text-foreground`,children:e}),a,r?.section===i&&!r.conflict?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:r.message}):null]})}function Vn({draft:e,patch:t,forge:n,automation:r}){return(0,K.jsx)(K.Fragment,{children:r?(0,K.jsxs)(`p`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),Rn[e.kind]]}):(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(Xe,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:Rn.schedule},{value:`github`,label:Rn.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Hn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,K.jsx)(Nn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,K.jsx)(bn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Un({draft:e,patch:t}){let n=e.kind===`schedule`?[`date`,`time`,`project`,`automation`]:[`github.kind`,`github.number`,`github.title`,`github.url`,`github.author`,`github.assignees`,`github.labels`,`github.event`],r=[...new Set([...e.prompt.matchAll(/\{\{([^{}]+)\}\}/g)].map(e=>e[1]))].filter(e=>!n.includes(e));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(k,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,K.jsx)(Ze,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:3,className:`[field-sizing:fixed] min-h-[88px] resize-none border-border bg-background`,required:!0}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),r.length?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:`Unavailable for this trigger: ${r.map(e=>`{{${e}}}`).join(`, `)}`}):null,(0,K.jsx)(Zn,{draft:e,patch:t})]})}function Wn({label:e,help:t,checked:n,onChange:r}){let i=(0,H.useId)();return(0,K.jsxs)(`label`,{htmlFor:i,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,K.jsx)(`span`,{id:`${i}-label`,children:e}),(0,K.jsx)(`span`,{id:`${i}-help`,className:`completion-control-help`,children:t})]}),(0,K.jsx)(De,{id:i,className:`completion-switch shrink-0`,checked:n,"aria-labelledby":`${i}-label`,"aria-describedby":`${i}-help`,onCheckedChange:r})]})}function Gn({draft:e,patch:t,saving:n,automation:r}){let i=e.kind===`schedule`,a=r?`Enabled`:`Enable after saving`,o=i&&e.schedule.type===`once`?`It runs once at the time set under When, then moves to Archived with its task.`:i?`The first run is the next occurrence in Next 5 runs.`:vn(e.filters.includeExisting);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,K.jsxs)(`div`,{"data-embedded":``,className:`grid min-w-0`,children:[(0,K.jsx)(Wn,{label:`Autonomous`,help:`Runs without waiting for answers.`,checked:e.autonomous,onChange:e=>t({autonomous:e})}),(0,K.jsx)(Ve,{embedded:!0,archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,K.jsx)(Be,{embedded:!0,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),(0,K.jsx)(Wn,{label:a,help:o,checked:e.enabled,onChange:e=>t({enabled:e})})]}),r?(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Kn({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,H.useState)(()=>Gt(e)),[s,c]=(0,H.useState)(e?.revision),[l,u]=(0,H.useState)(),[f,p]=(0,H.useState)(!1),m=e=>o(t=>({...t,...e})),h=async t=>{if(t.preventDefault(),f)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}p(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await ee(e.id,Xt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await g(e.id,a.enabled))}else await b(Yt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof d&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`execution`:zn(n),message:n})}finally{p(!1)}},_=(0,H.useId)(),v=(0,H.useId)(),y=a.kind===`schedule`;return(0,K.jsx)(Ne,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Xn({automation:e,draft:a,formId:_,saveHintId:v,saving:f}),children:(0,K.jsxs)(`form`,{id:_,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:grid-rows-[auto_1fr] md:items-start`,onSubmit:h,children:[(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,K.jsx)(Bn,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(k,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,K.jsx)(B,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>m({name:e.target.value}),required:!0})]})}),(0,K.jsxs)(Bn,{title:`When`,section:`when`,failure:l,children:[(0,K.jsx)(Vn,{draft:a,patch:m,forge:t,automation:e}),(0,K.jsx)(Hn,{draft:a,patch:m,forge:t,timeZone:n,automation:e})]}),(0,K.jsx)(Bn,{title:`What to run`,section:`run`,failure:l,children:(0,K.jsx)(Un,{draft:a,patch:m})})]}),(0,K.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4 md:col-start-2 md:row-span-2 md:row-start-1`,children:[(0,K.jsx)(Bn,{title:`Execution settings`,icon:(0,K.jsx)(be,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),section:`execution`,failure:l,children:(0,K.jsx)(Gn,{draft:a,patch:m,saving:f,automation:e})}),y?(0,K.jsx)(In,{schedule:a.schedule,timeZone:n}):(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,K.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,K.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:yn(a)})]}),(0,K.jsx)(cn,{draft:a,saveLabel:Jn(e,a),editing:e!==void 0})]}),l?.section===`form`||e?(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3.5 md:col-start-1`,children:[l?.section===`form`?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,K.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,K.jsx)(j,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,K.jsx)(qn,{automation:e,onDeleted:r}):null]}):null]})})}function qn({automation:e,onDeleted:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(``),c=async()=>{if(!i){a(!0),s(``);try{await te(e.id),t()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}};return(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[n?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:i,onClick:()=>void c(),children:`Delete automation`}),(0,K.jsx)(j,{type:`button`,variant:`outline`,disabled:i,onClick:()=>{r(!1),s(``)},children:`Keep`})]})]}):(0,K.jsx)(j,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>r(!0),children:`Delete`}),o?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:o}):null]})}function Jn(e,t){return e?`Save changes`:t.enabled?`Save and enable`:`Save paused`}function Yn(e){let t=[!e.name.trim()&&`a name`,!e.prompt.trim()&&`a prompt`].filter(Boolean);return t.length?`Add ${t.join(` and `)} to save.`:``}function Xn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Yn(t),s=Jn(e,t);return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:(0,K.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`min-h-[1lh] text-xs text-muted-foreground`,children:o}),secondaryActions:(0,K.jsx)(R,{type:`button`,variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,K.jsx)(R,{type:`submit`,form:n,variant:`primary`,disabled:i||a!==``,title:a?`${a} is required`:void 0,"aria-describedby":o?r:void 0,children:i?`Saving…`:s})}}function Zn({draft:e,patch:t}){let n=o(),l=Pe(),{runners:u,signedOut:d}=l.runnersOn(e=>l.repoAccount?.[e]),f=a(),p=i(),{runner:m,ready:h}=c(e.runner??f.data?.defaultRunner??`claude`),g=r(m,h,l.repoAccount?.[m]),_=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],ee=[...new Set([...u,...e.runner?[e.runner]:[]])],v=He(m,p.data,g.data,[e.model]),y=v.find(t=>t.id===(e.model??``))?.label??e.model??`Runner default`,b=e=>(0,K.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,K.jsx)(Ke,{children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Ge,{slot:`automation-workflow-pill`,icon:b(ve),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:_.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,K.jsx)(Ge,{slot:`automation-runner-pill`,icon:b(xe),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?s(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...ee.map(e=>({value:e,label:s(p.data,e)}))],footer:(0,K.jsx)(Le,{uninstalled:l.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,K.jsx)(Ge,{slot:`automation-model-pill`,icon:b(_e),fieldLabel:!0,ariaLabel:`Model`,label:y,value:e.model??``,options:v.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Qn(e){return{text:/\bauth\b|sign.?in|\blogin\b|\btoken\b|credentials|HTTP 401/i.test(e)?`GitHub CLI is not signed in`:/ENOENT|not found.*gh|gh.*not found/i.test(e)?`GitHub CLI is not installed`:`GitHub filter check failed`,tone:`error`,details:e}}function $n({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,H.useState)({}),[s,c]=(0,H.useState)({}),l=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),u=async(e,t,n=!1)=>{c(t=>({...t,[e]:!0}));try{await t()}catch(t){let r=t instanceof Error?t.message:String(t);l(e,n?Qn(r):{text:r,tone:`error`})}finally{c(t=>({...t,[e]:!1}))}},d=e=>u(e.id,async()=>{l(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await f(e.id);l(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),p=e=>u(e.id,async()=>{l(e.id,void 0),await g(e.id,!e.enabled),await n()}),m=e=>u(e.id,async()=>{l(e.id,void 0),await re(e.id),await n()}),h=e=>u(e.id,async()=>{l(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await ie(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await ne(t);if(r.status===`complete`){l(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`){let t=r.error??`Preview failed`;l(e.id,Qn(t));return}await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)},!0),_=e?.automations??[],ee=_.filter(e=>!e.archived),v=_.filter(e=>!!e.archived),y=r?v:ee;return(0,K.jsx)(z,{route:`automations`,density:e?Ae(y.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,K.jsx)(R,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(L,{to:`/automations/new`,children:[(0,K.jsx)(he,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&y.length>0&&!r?(0,K.jsx)(Me,{summary:`${y.length} active ${y.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,K.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:t}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[i?(0,K.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`active`,"aria-pressed":!r,onClick:()=>i(!1),className:A(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,!r&&`border-accent-text text-foreground`),children:[`Current`,(0,K.jsx)(er,{count:ee.length})]}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":r,onClick:()=>i(!0),className:A(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,r&&`border-accent-text text-foreground`),children:[`Archived`,(0,K.jsx)(er,{count:v.length})]})]}):(0,K.jsx)(`span`,{}),(0,K.jsx)(`div`,{className:`pb-2.5`,children:(0,K.jsx)(tr,{data:e})})]}),r&&y.length===0?(0,K.jsx)(q,{text:`No archived automations.`}):y.length===0?(0,K.jsx)(Ie,{icon:(0,K.jsx)(ye,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,K.jsx)(j,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(L,{to:`/automations/new`,children:[(0,K.jsx)(he,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,K.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:y.map(t=>(0,K.jsx)(ur,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:s[t.id]===!0,onRun:()=>void d(t),onToggle:()=>void p(t),onPreview:()=>void h(t),onCancel:()=>void m(t)},t.id))})]}):(0,K.jsx)(q,{text:`Loading automations…`})})}function er({count:e}){return e===0?null:(0,K.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function tr({data:e}){return(0,K.jsx)(`p`,{"data-slot":`automation-scheduler`,className:A(`text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function nr(e){return e.kind===`schedule`&&e.schedule?it(e.schedule):`${fn(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function rr({automation:e,nextRun:t}){let n=e.kind===`schedule`?ge:me,r=Ye(e);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,K.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,K.jsxs)(`p`,{"data-slot":`automation-meta`,className:`mt-1 flex flex-wrap items-baseline gap-x-1.5 ps-6 text-xs break-words text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:nr(e)}),t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,K.jsx)(qe,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function ir({automation:e,archive:t}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(j,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}`,children:`Details`})})})]})}function ar({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,K.jsx)(`span`,{children:`continuous`}):r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${V(r,t)}`}),(0,K.jsx)(`span`,{children:`· ${at(Date.now(),Date.parse(r))}`})]}):(0,K.jsx)(`span`,{children:`Next run: —`})}function or({automation:e,timeZone:t}){let n=e.enabled?St(e.state):void 0;return n?(0,K.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${V(n.retryAt,t)}`}):null]}):null}var $=`px-3`;function sr({automation:e,busy:t,confirmingCancel:n,cancelRef:r,onToggle:i,onRun:a,onPreview:o,onOpenCancel:s}){let c=e.kind===`schedule`,l=e.schedule?.type===`once`;return(0,K.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}`,children:`Edit`})}),l&&!n?(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:A($,`text-destructive`),ref:r,"data-action":`automation-cancel`,disabled:t,onClick:s,children:`Cancel`}):null,(0,K.jsx)(j,{variant:`outline`,size:`sm`,className:A($,`sm:ms-auto`),asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function cr({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,K.jsx)(j,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function lr({note:e}){return(0,K.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:A(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.details?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(fe,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:Fe(`gh`),children:`Set up`}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`min-h-11 cursor-pointer`,children:`Command details`}),(0,K.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:e.details})]})]}):null,e.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function ur({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,K.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsx)(rr,{automation:e,nextRun:h?void 0:(0,K.jsx)(ar,{automation:e,timeZone:t})}),h?(0,K.jsx)(ir,{automation:e,archive:h}):null,h?null:(0,K.jsx)(or,{automation:e,timeZone:t}),h?null:(0,K.jsx)(sr,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,K.jsx)(cr,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,K.jsx)(lr,{note:n}):null,(0,K.jsx)(Pt,{automationId:e.id,automationName:e.name,timeZone:t})]})}function dr(e){let t=ke(),n=ze(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.useCallback)(t=>se({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,H.useEffect)(()=>{n&&s()},[n,s]),(0,H.useEffect)(()=>oe(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>pe((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function fr({mode:e=`list`}){let{automationId:t}=de(),n=Oe(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=dr(`include`),[c,l]=(0,H.useState)(0),u=Re();if(u===`unknown`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});if(u===`absent`)return(0,K.jsx)(Je,{});if(u===`disabled`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(Ie,{icon:(0,K.jsx)(ye,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let d=()=>{n(`/automations`),s()},f=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,K.jsx)($n,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,K.jsx)(Kn,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,K.jsx)(Ft,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,K.jsx)(Kn,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,K.jsx)(j,{asChild:!0,variant:`outline`,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})}):t?(0,K.jsx)(Nt,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,K.jsx)(q,{text:`Automation not found.`})}export{fr as AutomationsRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./host-context-iTMFRMT5.js";var t=`cez-host:`;function n(n){let r=e();return r===null?n:`${t}${encodeURIComponent(r)}:${n}`}export{n as t};
|