@wjarka/cezarion 0.18.0-dev.7899 → 0.18.0-dev.7909
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/package.json +2 -2
- package/web/dist/assets/accounts-section-C7qacMAX.js +1 -0
- package/web/dist/assets/activity-motion-CkAbct6K.js +2 -0
- package/web/dist/assets/activity-route-DkSc-BB_.js +1 -0
- package/web/dist/assets/agent-config-section-DBqtxqrI.js +4 -0
- package/web/dist/assets/agent-defaults-section-AHmatJKy.js +1 -0
- package/web/dist/assets/agents-settings-path-7X6_cvUg.js +1 -0
- package/web/dist/assets/appearance-Uyrw7pjm.js +1 -0
- package/web/dist/assets/archive-on-merge-field-w_cfxV6m.js +1 -0
- package/web/dist/assets/attention-BMiaqJnx.js +1 -0
- package/web/dist/assets/automation-format-1lHzRTbq.js +1 -0
- package/web/dist/assets/automations-route-BBzRefYM.js +1 -0
- package/web/dist/assets/badge-D9JrXe0o.js +1 -0
- package/web/dist/assets/bot-TkDIw4y-.js +1 -0
- package/web/dist/assets/bundle-mjs-rHxsej31.js +1 -0
- package/web/dist/assets/button-BQ2y4XRB.js +1 -0
- package/web/dist/assets/centered-state-V15AR_qo.js +1 -0
- package/web/dist/assets/chevron-down-CHGyCDBH.js +1 -0
- package/web/dist/assets/chevron-right-BENZ-1ZN.js +1 -0
- package/web/dist/assets/{chunk-BO2N2NFS-y7WHTKOf.js → chunk-BO2N2NFS-DQrpGzb-.js} +4 -4
- package/web/dist/assets/chunk-KS7C4IRE-Cg8l-LDN.js +3 -0
- package/web/dist/assets/collapsible-BEV4FO-1.js +1 -0
- package/web/dist/assets/command-CDt1BsZy.js +1 -0
- package/web/dist/assets/commit-diff-panel-Ba-6F5So.js +1 -0
- package/web/dist/assets/dialog-BVF6dIeS.js +1 -0
- package/web/dist/assets/diff-D3RVmX07.js +3 -0
- package/web/dist/assets/diff-controls-BSWICnsb.js +1 -0
- package/web/dist/assets/{diff-view-BG91xPpY.js → diff-view-CYIMlq04.js} +4 -4
- package/web/dist/assets/dist-BAoXdNsT.js +1 -0
- package/web/dist/assets/dist-BW234Kg5.js +1 -0
- package/web/dist/assets/dist-C28wFbz0.js +1 -0
- package/web/dist/assets/dist-C5mlVBmd.js +1 -0
- package/web/dist/assets/dist-DXO3xwbC.js +1 -0
- package/web/dist/assets/dist-Da4ckcJG.js +1 -0
- package/web/dist/assets/dropdown-menu-4e2iKSMT.js +1 -0
- package/web/dist/assets/es2015-CQth82uv.js +41 -0
- package/web/dist/assets/external-link-BE6y205O.js +1 -0
- package/web/dist/assets/file-preview-jj3RWAaW.js +2 -0
- package/web/dist/assets/folder-browser-CH0gdxd-.js +1 -0
- package/web/dist/assets/folder-o-AvL3y3.js +1 -0
- package/web/dist/assets/git-toolbar-BOaq9GcR.js +1 -0
- package/web/dist/assets/github-wkggyCqa.js +1 -0
- package/web/dist/assets/global-activity-route-BTrelHAD.js +1 -0
- package/web/dist/assets/{highlighted-body-OFNGDK62-D62LjTH2.js → highlighted-body-OFNGDK62-Cx8MiNVZ.js} +1 -1
- package/web/dist/assets/highlighter-DvLzHjjY.js +3 -0
- package/web/dist/assets/{image-preview-2AnVvt0e.js → image-preview-CNBuRrK5.js} +1 -1
- package/web/dist/assets/index-CRfojAQ1.js +21 -0
- package/web/dist/assets/index-F-X4qZSv.css +1 -0
- package/web/dist/assets/label-D6DhdNb7.js +1 -0
- package/web/dist/assets/markdown-i80v6qNq.js +4 -0
- package/web/dist/assets/mermaid-GHXKKRXX-lTc_AjAC.js +1 -0
- package/web/dist/assets/moon-CRE9nU5R.js +1 -0
- package/web/dist/assets/nav-row-styles-DqKjMToI.js +1 -0
- package/web/dist/assets/notifications-section-GGsdkedq.js +1 -0
- package/web/dist/assets/open-in-menu-DgScIVvr.js +1 -0
- package/web/dist/assets/own-lookup-DS54wXvD.js +1 -0
- package/web/dist/assets/popover-BPgUYFyu.js +1 -0
- package/web/dist/assets/preload-helper-Czpn1I53.js +1 -0
- package/web/dist/assets/preview-pane-connected-B3mexb-I.js +3 -0
- package/web/dist/assets/project-location-4UN0Eqf-.js +1 -0
- package/web/dist/assets/project-order-AcHI4Dcl.js +1 -0
- package/web/dist/assets/project-rail-sortable-BmVI4_-T.js +1 -0
- package/web/dist/assets/project-router-UyyzK1j2.js +1 -0
- package/web/dist/assets/project-scope-context-BRvkKGX1.js +4 -0
- package/web/dist/assets/projects-section-DjeKfkRK.js +1 -0
- package/web/dist/assets/prompt-templates-section-CPH3RU9O.js +1 -0
- package/web/dist/assets/queries-CQWAcH8p.js +1 -0
- package/web/dist/assets/reference-chip-DGOmeh0l.js +1 -0
- package/web/dist/assets/remote-settings-notice-BFDdo8X5.js +1 -0
- package/web/dist/assets/repo-git-PaJ9uJ6o.js +1 -0
- package/web/dist/assets/report-reader-DDDg-Iyz.js +1 -0
- package/web/dist/assets/reports-DRSGsu5b.js +1 -0
- package/web/dist/assets/resources-section-Dwx13rfP.js +1 -0
- package/web/dist/assets/run-header-q5egOxrK.js +2 -0
- package/web/dist/assets/{runners-CKrq5tR_.js → runners-BFhbiSKy.js} +1 -1
- package/web/dist/assets/settings-agent-picker-YO8UtetZ.js +1 -0
- package/web/dist/assets/settings-field-Bl6WuvGX.js +1 -0
- package/web/dist/assets/settings-shell-De1IxHYf.js +1 -0
- package/web/dist/assets/settings-shell-xK8txSJo.css +1 -0
- package/web/dist/assets/sidebar-section-CYKz48EO.js +1 -0
- package/web/dist/assets/skills-hTBIyeAr.js +1 -0
- package/web/dist/assets/smartphone-Lr8Ug2z_.js +1 -0
- package/web/dist/assets/sortable.esm-CAVTYaA3.js +5 -0
- package/web/dist/assets/square-terminal-B6RYYieR.js +1 -0
- package/web/dist/assets/status-dot-DtAOFiIi.js +1 -0
- package/web/dist/assets/switch-Bv2Zf1uU.js +1 -0
- package/web/dist/assets/tab-link-BmEGnV4R.js +1 -0
- package/web/dist/assets/task-changes-CvbqO0ug.js +1 -0
- package/web/dist/assets/task-commits-kVuYqkqB.js +1 -0
- package/web/dist/assets/task-files-DOFkMbFg.js +1 -0
- package/web/dist/assets/task-github-item-13sbVXYb.js +1 -0
- package/web/dist/assets/task-groups-Dc7pXgaS.js +1 -0
- package/web/dist/assets/task-thread-B0d0xyLV.js +9 -0
- package/web/dist/assets/tasks-table-lb5Dy-8O.js +1 -0
- package/web/dist/assets/textarea-vJt9undk.js +1 -0
- package/web/dist/assets/thread-state-BwzJmXzv.js +4 -0
- package/web/dist/assets/toaster-Bo5vCbz-.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-wRTXiZqE.js +1 -0
- package/web/dist/assets/{useInfiniteQuery-BdIIhzMI.js → useInfiniteQuery-rgb-nitU.js} +1 -1
- package/web/dist/assets/useQuery-SVV6EtG7.js +1 -0
- package/web/dist/assets/utils-DSMR_WLb.js +1 -0
- package/web/dist/assets/workflows-35bEvVkH.js +7 -0
- package/web/dist/assets/workspace-tools-Bw4MyHOW.js +1 -0
- package/web/dist/assets/worktrees-section-CLwPLrl2.js +4 -0
- package/web/dist/assets/{ws-DiWUfn_t.js → ws-D3-jE1IB.js} +1 -1
- package/web/dist/assets/zoomable-image-CIQl1Wpe.js +1 -0
- package/web/dist/index.html +49 -25
- package/web/dist/assets/activity-motion-DKY_Cd-w.js +0 -2
- package/web/dist/assets/activity-route-CFOKEc61.js +0 -1
- package/web/dist/assets/attention-B0IBc2_D.js +0 -1
- package/web/dist/assets/bundle-mjs-BT31bpU6.js +0 -1
- package/web/dist/assets/button-C1fD-ZFr.js +0 -3
- package/web/dist/assets/centered-state-CiiA8Vgw.js +0 -1
- package/web/dist/assets/commit-diff-panel-BiNUdbd8.js +0 -1
- package/web/dist/assets/dialog-B3EUmMBQ.js +0 -1
- package/web/dist/assets/diff-WtmvA0fu.js +0 -3
- package/web/dist/assets/diff-controls-CA6lS7Yp.js +0 -1
- package/web/dist/assets/dist-Du8mGhoH.js +0 -1
- package/web/dist/assets/dropdown-menu-Dso6iTId.js +0 -1
- package/web/dist/assets/es2015-Ch36azR0.js +0 -41
- package/web/dist/assets/file-preview-YCD-8e6S.js +0 -2
- package/web/dist/assets/git-toolbar-B5YAUWQ7.js +0 -1
- package/web/dist/assets/github-DHeSsbSc.js +0 -1
- package/web/dist/assets/global-activity-route-CMq49K4H.js +0 -1
- package/web/dist/assets/index-C3pMUosD.js +0 -14
- package/web/dist/assets/index-DXvh46tl.css +0 -1
- package/web/dist/assets/markdown-OTuqNLUj.js +0 -4
- package/web/dist/assets/mermaid-GHXKKRXX-C7OP146z.js +0 -1
- package/web/dist/assets/nav-row-styles-CFjnD-9J.js +0 -1
- package/web/dist/assets/picker-pill-BhCKGHAn.js +0 -15
- package/web/dist/assets/preview-pane-connected-BvOk8924.js +0 -3
- package/web/dist/assets/project-router-CcyPWtFH.js +0 -1
- package/web/dist/assets/project-scope-context-CX36ze1Q.js +0 -4
- package/web/dist/assets/prompt-template-menu-YN8kTo5-.js +0 -1
- package/web/dist/assets/queries-Cb76PEoL.js +0 -1
- package/web/dist/assets/reference-chip-BuUCKkhB.js +0 -1
- package/web/dist/assets/repo-git-B2M2bD92.js +0 -1
- package/web/dist/assets/report-reader-DeyzG6gC.js +0 -1
- package/web/dist/assets/reports-Ca8vCNah.js +0 -1
- package/web/dist/assets/run-header-DP7P0saA.js +0 -2
- package/web/dist/assets/skills-5ODbLwjd.js +0 -1
- package/web/dist/assets/sortable.esm-zp_qkYGV.js +0 -5
- package/web/dist/assets/tab-link-Dn7KFNYr.js +0 -1
- package/web/dist/assets/task-changes-BkeLycTI.js +0 -1
- package/web/dist/assets/task-commits-Db8B7L6o.js +0 -1
- package/web/dist/assets/task-files-CFVAB4Bl.js +0 -1
- package/web/dist/assets/task-github-item-z295iYNd.js +0 -1
- package/web/dist/assets/task-thread-UXl-CsYi.js +0 -9
- package/web/dist/assets/thread-state-BsbjdGGk.js +0 -4
- package/web/dist/assets/toaster-Cxgzn9ip.js +0 -1
- package/web/dist/assets/use-desktop-BqVEJ3dr.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-DXfR9R5L.js +0 -1
- package/web/dist/assets/useQuery-Dg1rzYtR.js +0 -1
- package/web/dist/assets/workflows-BCuRK6_a.js +0 -7
- package/web/dist/assets/zoomable-image-DrDnCL4V.js +0 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.18.0-dev.
|
|
2
|
+
"version": "0.18.0-dev.7909",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"node": ">=24.21.0"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@hearsay-tools/squawk": "0.18.0-dev.
|
|
14
|
+
"@hearsay-tools/squawk": "0.18.0-dev.7909"
|
|
15
15
|
},
|
|
16
16
|
"bin": {
|
|
17
17
|
"cezarion": "dist/index.js",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Jt as r,Rn as i,f as a,hn as o,i as s,ti as c}from"./project-scope-context-BRvkKGX1.js";import{At as l,Et as u,J as d,M as f,Nt as p,Wt as m,X as h,Yt as g,g as _,m as v,o as y,r as b,tt as ee}from"./queries-CQWAcH8p.js";import{t as te}from"./useQuery-SVV6EtG7.js";import{f as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as S}from"./toaster-Bo5vCbz-.js";import{i as ne,r as C,s as w,t as re}from"./runners-BFhbiSKy.js";import{y as T}from"./design-icons-CzEoMH9c.js";import{t as E}from"./createLucideIcon-BHp8sXmF.js";import{t as D}from"./folder-browser-CH0gdxd-.js";import{t as O}from"./button-BQ2y4XRB.js";import{t as k}from"./badge-D9JrXe0o.js";import{a as A,i as j,o as M,r as N,s as P,t as F}from"./dialog-BVF6dIeS.js";import{t as I}from"./status-dot-DtAOFiIi.js";import{n as L}from"./agents-settings-path-7X6_cvUg.js";import{t as R}from"./centered-state-V15AR_qo.js";import{Gt as z,Ht as B,Jt as V,Kt as H,N as U,Ut as W,Vt as G,Wt as K,j as q,qt as J}from"./index-CRfojAQ1.js";import{n as Y,r as X,t as ie}from"./settings-agent-picker-YO8UtetZ.js";var ae=E(`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`}]]),Z=e(t(),1),Q=n(),oe=`~/.claude-second`;function se({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=w().data,[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(r??n[0]??`claude`),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(!1),v=_(),y=p.trim();return(0,Q.jsx)(F,{open:e,onOpenChange:t,children:(0,Q.jsxs)(N,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(M,{children:[(0,Q.jsx)(P,{children:`Add agent account`}),(0,Q.jsx)(j,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,Q.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:l,onChange:e=>u(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,Q.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:d,placeholder:`Work`,onChange:e=>f(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,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,Q.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:p,placeholder:C(i,l)?.accountFolderExample??oe,onChange:e=>{m(e.target.value),c(null),v.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,Q.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":h,onClick:()=>g(e=>!e),children:h?`Hide folders`:`Browse…`})]}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`A `,(0,Q.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),h?(0,Q.jsx)(D,{path:a,selected:s,onSelect:e=>{c(e),m(e.path),v.reset()},onEnter:e=>{o(e),c(null),v.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,v.isError?(0,Q.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:v.error instanceof Error?v.error.message:`could not add that folder`}):null,(0,Q.jsxs)(A,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Q.jsx)(O,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(O,{"data-slot":`add-account-confirm`,disabled:y===``||v.isPending,onClick:()=>{y===``||v.isPending||v.mutate({provider:l,configDir:y,...d.trim()?{label:d.trim()}:{}},{onSuccess:()=>{t(!1),f(``),m(``),c(null),g(!1),S(`Account added — use Connect to sign in`)}})},children:v.isPending?`Adding…`:`Add account`})]})]})})}async function ce(e){return o(await a.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function le(e,t){return o(await a.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var ue={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function de(e){let t=f().data?.capabilities?.settingsAdmin===!0,n=c(),r=[`runner-install`,e],i=te({queryKey:r,queryFn:()=>ce(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}}),a=g({mutationFn:t=>le(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function fe({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,Q.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(O,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,Q.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,Q.jsx)(O,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function pe({runner:e}){let t=de(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,Q.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,Q.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?` · ${ue[r.phase]}`:``]}),a?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,Q.jsx)(fe,{state:t}),r?.installedVersion?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var $={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function me(){let e=y(),t=w();if(e.isPending||t.isPending)return(0,Q.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,Q.jsx)(R,{icon:(0,Q.jsx)(ae,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,Q.jsx)(ge,{data:e.data,runners:t.data})}function he(){let{hash:e}=x();(0,Z.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function ge({data:e,runners:t}){let n=f(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),s=ee();return he(),(0,Q.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,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Install, update and sign in to each agent, and set what a project runs when it has not chosen.`}),e.editable?null:(0,Q.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:`Agent accounts are managed from the machine that owns the checkout — this cockpit runs in hosted mode.`}),(0,Q.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-4`,children:t.runners.map(r=>(0,Q.jsx)(ve,{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:()=>i(r.id),onRemove:o},r.id))}),(0,Q.jsx)(ye,{runners:t}),r===null?null:(0,Q.jsx)(se,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,Q.jsx)(G,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,Q.jsxs)(K,{"data-slot":`accounts-remove-confirm`,children:[(0,Q.jsxs)(J,{children:[(0,Q.jsxs)(V,{children:[`Remove “`,a?.label,`”?`]}),(0,Q.jsxs)(z,{children:[`This only forgets the account. Nothing in `,a?.configDir,` 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,Q.jsxs)(H,{children:[(0,Q.jsx)(W,{children:`Cancel`}),(0,Q.jsx)(B,{"data-action":`accounts-remove-confirm`,disabled:s.isPending,onClick:()=>{let e=a;e&&s.mutate(e.id,{onSuccess:()=>{o(null),S(`Removed ${e.label}`)},onError:e=>S(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function _e({entry:e,check:t}){return t===void 0?(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking…`}):t.available?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Installed`}),t.version?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,Q.jsx)(`span`,{"data-slot":`agent-version`,children:t.version})]}):null]}):(0,Q.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`Not installed`,e.installHint?(0,Q.jsxs)(Q.Fragment,{children:[` — `,(0,Q.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function ve({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.managedInstall===!0&&n,d=a.filter(e=>e.isDefault).length,f=`${L(l)}-title`;return(0,Q.jsxs)(`section`,{id:L(l),tabIndex:-1,"aria-labelledby":f,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col gap-4 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsx)(`h3`,{id:f,className:`settings-account-provider-title`,children:e.displayName}),u?(0,Q.jsx)(pe,{runner:l}):null,(0,Q.jsxs)(`div`,{className:`settings-account-installation settings-readout`,children:[u?null:(0,Q.jsx)(_e,{entry:e,check:t}),i?(0,Q.jsxs)(`span`,{className:`settings-account-count`,children:[a.length,` `,a.length===1?`account`:`accounts`,` (`,d,` discovered, `,a.length-d,` added)`]}):null]}),i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`ul`,{children:a.map(e=>(0,Q.jsx)(Se,{account:e,runners:r,onRemove:()=>c(e)},e.id))}),o?(0,Q.jsx)(`div`,{className:`settings-account-add-row`,children:(0,Q.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`})}):(0,Q.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11px] text-soft-foreground`,children:[e.displayName,` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]})]}):e.browserLogin?(0,Q.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Discovered account`}),(0,Q.jsx)(Y,{provider:l,label:e.displayName})]}):null]})}function ye({runners:e}){let[t,n]=(0,Z.useState)(null),i=c(),a=l(),o=d(),s=m(ne(e)),u=g({mutationFn:e=>r(e),onSuccess:e=>i.setQueryData(p.config,e),onError:e=>S(e.message,{tone:`danger`})});if(a.data===void 0)return null;let f=X([],e),h=a.data.agentDefaults.runner??`claude`,_=a.data.agentDefaults.models??{};return(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,Q.jsx)(`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,Q.jsx)(ie,{rows:f,runner:h,accountFor:()=>null,providerStatus:o,disabled:u.isPending,onPick:e=>{e!==h&&u.mutate({agentDefaults:{runner:e}})}}),(0,Q.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,Q.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,Q.jsx)(`span`,{children:`Default model for`}),(0,Q.jsx)(`select`,{"aria-label":`Model agent`,value:t??h,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===(t??h)).map(t=>(0,Q.jsxs)(`label`,{className:`settings-account-model flex items-center gap-3`,children:[(0,Q.jsx)(T,{className:`size-4 text-accent-icon shrink-0`}),(0,Q.jsx)(`span`,{className:`w-24 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:_[t.id]??``,disabled:u.isPending,onChange:e=>u.mutate({agentDefaults:{models:{[t.id]:e.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[U(t.id,e,s[t.id]?.data,[_[t.id]]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,Q.jsx)(be,{runner:t.id,runners:e,catalog:s[t.id]})]})]},t.id))]})]})}function be({runner:e,runners:t,catalog:n}){let r=q(e,t,n);return r?(0,Q.jsx)(`option`,{disabled:!0,children:r}):null}function xe({account:e,runners:t,status:n}){let r=v();return(0,Q.jsxs)(Q.Fragment,{children:[n&&n.status!==`connected`&&C(t,e.provider)?.browserLogin?(0,Q.jsx)(Y,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,n&&n.status!==`connected`&&C(t,e.provider)?.terminalLogin!==!1?(0,Q.jsx)(O,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:r.isPending,onClick:()=>r.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>S(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>S(e instanceof s&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Se({account:e,runners:t,onRemove:n}){let r=i(e),a=h(),o=b(r,e.status===void 0),s=e.status??o.data?.status,c=s?$[s.status]:void 0;return(0,Q.jsx)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:(0,Q.jsxs)(`div`,{className:`settings-account-card`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,Q.jsx)(k,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`discovered`}):null]}),(0,Q.jsxs)(`div`,{className:`settings-account-readout settings-readout`,children:[(0,Q.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(I,{tone:c?.tone??`neutral`,pulse:c===void 0}),(0,Q.jsx)(`span`,{"data-slot":`account-status`,children:c?.label??`Checking…`}),!s||s.requiresAccountHome===!1?null:e.exists?e.looksValid?null:(0,Q.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,re(t,e.provider),` config yet`]}):(0,Q.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]}),s?.hint?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s.hint}):null]})]}),(0,Q.jsxs)(`div`,{className:`settings-account-actions`,children:[(0,Q.jsx)(xe,{account:e,runners:t,status:s}),(0,Q.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:a.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>a.mutate(r,{onError:e=>S(e.message,{tone:`danger`})}),children:`Check again`}),(0,Q.jsx)(Ce,{account:e,onRemove:n})]})]})})}function Ce({account:e,onRemove:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(e.label),o=u();return(0,Q.jsx)(Q.Fragment,{children:e.isDefault?null:(0,Q.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.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,Q.jsx)(O,{type:`button`,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=>S(e.message,{tone:`danger`})}),children:`Save`}),(0,Q.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,Q.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{me as GlobalAgentsSection};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{t as i}from"./live-refetch-CZb2VOyu.js";import{An as a,Ar as o,Dn as s,Mr as c,Nn as l,Ur as u,br as d,f,hn as p,i as m,jt as ee,rr as te,ti as ne,xn as re,zr as ie}from"./project-scope-context-BRvkKGX1.js";import{H as h,K as ae,L as g,M as oe,N as se,P as _,R as v,S as ce,T as le,U as ue,j as y,k as b,q as de}from"./live-protocol-D9ji1YCl.js";import{t as fe}from"./useQuery-SVV6EtG7.js";import{n as pe}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as me,t as he}from"./ws-D3-jE1IB.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as ge}from"./bot-TkDIw4y-.js";import{n as _e,r as ve,t as ye}from"./hourglass-B0lPAJvT.js";import{t as be}from"./eye-B8okNWXU.js";import{t as xe}from"./message-square-B-MD-8rD.js";import{t as Se}from"./button-BQ2y4XRB.js";import{t as S}from"./project-router-UyyzK1j2.js";import"./attention-BMiaqJnx.js";import{t as C}from"./status-dot-DtAOFiIi.js";import{$t as Ce}from"./index-CRfojAQ1.js";var we=x(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Te=x(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Ee=x(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),De=x(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Oe=x(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),ke=x(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ae=x(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),je=x(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Me=x(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),w=e(t(),1),T=n(),E=de(),D=g().int().nonnegative(),O=h().min(1),Ne=v({title:h().max(160),toolKind:b([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:b([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:E,endedAt:E.optional()}).strict(),Pe=b([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Fe=v({checks:y(v({name:h().max(100),bucket:Pe}).strict()).max(100),counts:v({pass:D,fail:D,pending:D,skipping:D,cancel:D}).strict(),truncated:_(!0).optional()}).strict(),Ie=se(`kind`,[v({kind:_(`human`),since:E,detail:v({question:h().max(500).optional(),reason:b([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:g().int().positive().optional()}).strict()}).strict(),v({kind:_(`usage-limit`),detail:v({resumeAt:h()}).strict()}).strict(),v({kind:_(`workers`),since:E,deadline:E.optional(),detail:v({owed:D,total:D,settled:D,replies:_(!0).optional(),mode:ce.optional(),recipientRunIds:y(O)}).strict()}).strict(),v({kind:_(`peers`),since:E,deadline:E,detail:v({peerRunIds:y(O)}).strict()}).strict(),v({kind:_(`subagents`),since:E,deadline:E,detail:v({running:D}).strict()}).strict(),v({kind:_(`pr`),since:E,deadline:E,detail:v({number:g().int().positive(),target:te,checks:Fe.shape.checks.optional(),counts:Fe.shape.counts.optional(),truncated:_(!0).optional()}).strict()}).strict(),v({kind:_(`process`),since:E,deadline:E,detail:v({pid:g().int(),note:h().optional()}).strict()}).strict(),v({kind:_(`timer`),since:E,deadline:E,detail:v({wakeAt:E,note:h().optional()}).strict()}).strict()]),Le={runId:O,title:h(),status:d,rung:b(s),runner:u.optional(),model:h().optional(),currentStepId:h().optional(),startedAt:h().optional(),wait:Ie.optional(),tool:Ne.optional(),rate:y(D).length(30),error:h().max(200).optional()},Re=v({...Le,revision:D,collected:oe()}).strict(),ze=v({...Le,workers:y(Re)}).strict(),Be=v({requestId:ae(),relationship:b([`family`,`peer`]),senderRunId:O,recipientRunId:O,text:h().max(500),senderTitle:h().optional(),recipientTitle:h().optional(),createdAt:E,deadline:E.optional()}).strict(),Ve=v({requestId:ae(),senderRunId:O,recipientRunId:O,status:le.shape.status,observedAt:E}).strict(),He=v({generatedAt:E,projects:y(v({projectId:h(),name:h(),loaded:oe(),unavailable:v({status:ue([_(404),_(409),_(503)]),error:h()}).strict().optional(),inReview:D,tasks:y(ze),requests:y(Be),closed:y(Ve)}).strict())}).strict();v({project:ue([_(`default`),h().regex(re)]).optional()});var Ue=5e3,We=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],Ge=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,Ke=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,qe=`the Squawk server answered /workspace/activity with an unexpected body`;function Je(e){let t=He.safeParse(e);if(!t.success)throw new m(200,qe);return t.data}async function Ye(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return Je(await p(await f.api.v1.workspace.activity.$get({query:n},ee(t)),`/workspace/activity`))}function Xe(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var Ze=new Date(0).toISOString();function Qe(e){return e!==void 0&&e!==Ze&&!Number.isNaN(Date.parse(e))}var $e=new Set([404,409,503]);function et(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??Ze,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function tt(e,t){return new m(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var nt=(e,t)=>e.kind===`project`&&$e.has(t.status)?t.status:void 0;function rt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,w.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,w.useMemo)(()=>We(n),[n]),a=ne(),s=fe({queryKey:r,queryFn:async({signal:e})=>{let t=a.getQueryData(r);try{return Xe(t,await Ye(n,{signal:e}))}catch(e){let r=e instanceof m?nt(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return et(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,w.useEffect)(()=>{let e=!0,t=t=>{a.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let i=nt(n,t);if(i!==void 0&&n.kind===`project`){a.setQueryData(r,e=>et(e,n.projectId,i,t.message));return}let o=a.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},s=n=>{let i;try{i=Je(n)}catch(e){t(e);return}a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,e=>Xe(e,i))})},l=he(Ge(n),s),u=i(Ue),d,f=()=>{let e=o()===`finite`&&u!==!1;e&&!d?d=me({path:Ke(n),intervalMs:u},(e,n)=>{n===void 0?s(e):t(tt(e,n))}):!e&&d&&(d(),d=void 0)};f();let p=c(f);return()=>{e=!1,p(),d?.(),l()}},[a,r,n]),s}var k=e=>String(e).padStart(2,`0`);function A(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${k(r)}:${k(i)}`:`${r}:${k(i)}`}function it(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${k(n%60)} min`}function j(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var at=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function M(e){let t=Date.parse(e);return Number.isNaN(t)?e:at.format(t)}function ot(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var st=new Set([`queued`,`running`,`waiting`]),ct={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},lt={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},N=e=>st.has(e),P=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,F=e=>a(e.rung).tone,ut=(e,t=`Deadline`)=>e?`${t} ${M(e)}`:void 0;function dt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${P(t.length,`task`)}`}function ft(e,t){let n=e.tool,r={verb:`Doing`,tone:F(e),icon:`tool`},i=n?.endedAt!==void 0&&j(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${it(j(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function pt(e,t){let n={verb:`Needs you`,tone:F(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${P(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function mt(e){return{verb:`Needs you`,tone:F(e),icon:`user`,main:`Permission`,action:`open`}}function ht(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:F(e),since:t.since};if(o){let e=c.length>0?dt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...I(`detail`,ut(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${gt[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...I(`detail`,ut(t.deadline))}}var gt={one:`One`,any:`Any`,all:`All`};function _t(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var vt=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function yt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=vt.reduce((e,t)=>e+i(t),0),o=vt.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var bt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function xt(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=bt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=yt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function St(e,t){let n={tone:F(e),since:t.since,...I(`detail`,ut(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:_t(t),...I(`checks`,r),...I(`overflow`,yt(t)),...I(`checkSummary`,xt(t))}}function I(e,t){return t===void 0?{}:{[e]:t}}function Ct(e,t,n){let r=F(e);switch(t.kind){case`workers`:return ht(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:dt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${M(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:P(t.detail.running,`native subagent`),detail:`Deadline ${M(t.deadline)}`};case`pr`:return St(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${A(j(t.since,n.now))} · deadline ${M(t.deadline)}`};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${M(t.detail.wakeAt)} · in ${A(-j(t.detail.wakeAt,n.now))}`};case`usage-limit`:return wt(e,t.detail.resumeAt,n);case`human`:return}}function wt(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${M(t)} · in ${A(r-n.now)}`;return{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`,detail:i}}function Tt(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:F(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${it(j(n,t.now))}`}:{}}}function L(e,t){return{verb:ct[e.status]??e.status,tone:F(e),icon:lt[e.status]??`done`,main:t}}function Et(e,t){return N(e.status)?Dt(e,t):L(e,P(e.workers.filter(e=>N(e.status)).length,`live worker`))}function Dt(e,t){let n=e.wait;switch(e.rung){case`running`:return ft(e,t);case`needs-permission`:return mt(e);case`needs-you`:return pt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?wt(e,n.detail.resumeAt,t):{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return Tt(e,t);default:return(n&&Ct(e,n,t))??Tt(e,t)}}function Ot(e,t,n){if(n!==void 0&&N(e.status))return{verb:`Asks parent`,tone:F(e),main:`“${n}”`,asks:!0};let r=kt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function kt(e,t){switch(e.status){case`done`:return L(e,e.collected?`Collected`:`Ready to collect`);case`review`:return L(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return L(e,e.error??ct[e.status]??e.status);default:return Dt({...e,workers:[]},t)}}function At(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function jt(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function R(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var z=(e,t)=>R(e,t.senderRunId,t.senderTitle),B=(e,t)=>R(e,t.recipientRunId,t.recipientTitle),Mt=(e,t)=>`wait:${e}:${t}`;function V(e){let t=[];for(let n of e){let e=n.wait;if(!(!N(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:Mt(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function Nt(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Pt(e,t){return t.filter(t=>t.waiterRunId===e)}function H(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${B(n,r)}`),r.recipientRunId===e&&i.push(`${z(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${R(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${R(n,t.waiterRunId)} waits for you to write`);return i}function Ft(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function It(e,t){let n=-j(e,t);return n>=1e3?`reply due in ${A(n)}`:`reply overdue`}function Lt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function Rt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:zt[Bt(e,t)]}}var zt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function Bt(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var Vt=new Set([`queued`,`waiting-for-capacity`]);function Ht(e){if(N(e.status))return l(e.rung)?`needsYou`:e.rung===`running`?`working`:Vt.has(e.rung)?`queued`:`waiting`}function U(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Ht(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>N(e.status)).length}}return t}function Ut(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Wt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var W={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},G={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},Gt=(e,t)=>`${e}\n${t}`;function Kt(e,t){let n=Gt(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var qt=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Jt={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Yt(e,t){let n=Jt[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},W.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},W.workerHold+W.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},W.workerHold)}function Xt(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},W.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},W.comet)}function Zt(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},W.fade);return}let a=W.comet+W.replied+W.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},W.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},W.comet+W.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},W.comet)}function Qt(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:a(t.task.rung).tone},W.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},W.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},W.workerEnter);case`worker-settled`:return Yt(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},W.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},W.cardLeave);case`check-passed`:return e.timed(`checks`,Gt(t.runId,t.name),{},W.check);case`request-opened`:return Xt(e,t.request);case`request-closed`:return Zt(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},W.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},W.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},W.fade)}}function $t(e,t,n){let r=new qt(t);if(!n)for(let t of e)Qt(r,t);return{changes:r.changes,timers:r.timers}}function en(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function tn(e,t){return t.reduce(en,e)}function nn(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}var rn={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function an({tone:e,className:t,children:n,...i}){return(0,T.jsx)(`span`,{...i,className:r(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var on={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},sn={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},cn={tool:Me,user:je,workers:ge,reply:xe,peer:Oe,subagents:ge,ci:De,merge:Ee,command:Ae,timer:Te,pause:ke,queued:ye,review:be,failed:_e,done:ve,cancelled:we};function ln(e,t){let n=a(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:fn(e,t)??n.label}}var un=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function dn(e){return e?.kind===`workers`&&!e.detail.replies&&e.detail.owed>0}function fn(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`&&!dn(n))return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return un(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return un(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return un(`waiting for`,n.detail.running,`subagent`)}function pn(e,t){if(N(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function K({run:e,role:t}){let{tone:n,shape:i,label:a}=ln(e,t);return(0,T.jsx)(`span`,{"data-activity-anchor":e.runId,className:r(`inline-flex size-[12px] shrink-0 items-center justify-center`,pn(e,i)),children:(0,T.jsx)(C,{tone:n,shape:i,role:`img`,"aria-label":a})})}function mn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=Lt(e,t),l=Pt(e,n);return c.length===0&&l.length===0?null:(0,T.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,B(r,e)]})},e.requestId)),l.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,R(r,e.peerRunId)]})},e.id))]})}var hn={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},gn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function _n({checks:e,overflow:t,passed:n}){return(0,T.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:r(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,T.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:r(`h-[5px] min-w-px flex-1 rounded-[2px]`,hn[e.bucket],gn(e.bucket,n.has(e.name)))},e.name)),t?(0,T.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`i`,{className:r(`h-[5px] w-2 rounded-[2px]`,hn[t.bucket])}),`+`,t.count]}):null]})}function vn({value:e,ink:t}){return(0,T.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:r(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var yn=new Set;function bn({box:e,now:t,dense:n,motion:i={}}){let a=cn[e.icon],o=rn[e.tone];return(0,T.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[i.sweep?(0,T.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,T.jsx)(a,{"aria-hidden":`true`,className:r(`mt-px size-[15px]`,o)}),(0,T.jsxs)(an,{tone:e.tone,className:`flex gap-2 text-[11px] font-semibold tracking-[0.04em] uppercase`,children:[(0,T.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,T.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium tracking-normal text-muted-foreground normal-case tabular-nums`,children:A(j(e.since,t))}):null]}),(0,T.jsx)(`span`,{"data-slot":`activity-main`,className:r(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,i.slideKey!==void 0&&`activity-slide`),children:e.main},i.slideKey??`still`),e.checks?(0,T.jsx)(_n,{checks:e.checks,overflow:e.overflow,passed:i.passed??yn}):null,e.checkSummary?(0,T.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,T.jsx)(vn,{value:e.bar,ink:o}),e.detail&&!n?(0,T.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function xn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),i=Math.max(4,...e);return(0,T.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:r(`block h-4 w-[62px] shrink-0`,t),children:[(0,T.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}),e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/i*14);return(0,T.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var q=e=>`/tasks/${encodeURIComponent(e)}`;function Sn(e,t){return[e.runner,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?it(j(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function Cn({texts:e}){return e.length===0?null:(0,T.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,T.jsx)(`li`,{children:e},t))})}function wn({worker:e,parentId:t,requests:n,index:i,ctx:a,motion:o}){let s=Ot(e,a,Ft(e.runId,t,n)?.text),c=o.workerHold[e.runId];return(0,T.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":s.asks?`true`:void 0,"data-hold":c?.phase,className:r(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,s.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in o.workerEnter&&`activity-row-enter`,c?.phase===`fold`&&`activity-row-fold`),children:[c?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:r(`activity-row-flash`,sn[c.tone])},c.key):null,(0,T.jsx)(`span`,{className:`mt-[3px]`,children:(0,T.jsx)(K,{run:e,role:`worker`})}),(0,T.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,T.jsx)(S,{to:q(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,T.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner,e.model].filter(Boolean).join(` · `)})]}),(0,T.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`b`,{className:r(`font-semibold`,rn[s.tone]),children:s.verb}),` · `,(0,T.jsx)(`span`,{className:r(s.mono&&`font-mono`),children:s.main})]}),(0,T.jsx)(Cn,{texts:H(e.runId,n,i)})]})}function Tn({workers:e}){return(0,T.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,T.jsx)(K,{run:e,role:`worker`},e.runId)),(0,T.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function En({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>N(e.status)||e.status===`review`||o(e.runId)),c=Wt(Ut(e,o));return(0,T.jsxs)(T.Fragment,{children:[s.length>0&&i?(0,T.jsx)(Tn,{workers:s}):null,s.length>0&&!i?(0,T.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,T.jsx)(wn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,T.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}var Dn=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;function On(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function kn(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function An({task:e,motion:t,glow:n}){let i=t.flash[e.runId];return(0,T.jsxs)(T.Fragment,{children:[n?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,i?(0,T.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":i.tone,"aria-hidden":`true`,className:r(`activity-flash`,on[i.tone])},i.key):null]})}var jn=[];function Mn({task:e,requests:t,waits:n=jn,index:i,ctx:a,dense:o,narrow:s,motion:c=G,ghost:l=!1,linked:u=!1,onHover:d}){let f=Et(e,a),p=l?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},m={sweep:e.rung===`running`&&N(e.status),slideKey:c.slides[e.runId]?.key,passed:Kt(c,e.runId)};return(0,T.jsxs)(`article`,{...p,"data-flip":e.runId,"data-rung":e.rung,"data-action":f.action,"data-linked":u&&!l?`true`:void 0,...l?{}:On(e.runId,d),className:r(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,f.action?`border-pending`:`border-border`,u&&!l&&`outline-2 outline-offset-2 outline-message-peer-accent`,kn(e,c,l)),children:[(0,T.jsx)(An,{task:e,motion:c,glow:f.action!==void 0&&!l}),(0,T.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(K,{run:e,role:`root`}),(0,T.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,T.jsx)(S,{to:q(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})}),(0,T.jsx)(xn,{rate:e.rate})]}),(0,T.jsx)(`p`,{className:`mt-0.5 mb-2 ml-5 truncate text-[11.5px] text-muted-foreground`,children:Sn(e,a.now)}),(0,T.jsx)(Cn,{texts:H(e.runId,t,i,n)}),(0,T.jsx)(bn,{box:f,now:a.now,dense:o,motion:m}),f.action?(0,T.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,T.jsx)(Se,{asChild:!0,size:`sm`,variant:f.action===`answer`?`primary`:`outline`,className:`relative z-[1] max-md:min-h-11`,children:(0,T.jsx)(S,{to:q(e.runId),children:f.action===`answer`?`Answer`:`Open task`})})}):null,s?(0,T.jsx)(mn,{runId:e.runId,requests:t,waits:n,index:i,link:S,pathOf:q,className:`mt-2 flex flex-col gap-1`,linkClassName:Dn}):null,(0,T.jsx)(En,{task:e,requests:t,index:i,ctx:a,dense:o,motion:c})]})}function Nn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function Pn(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function Fn(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(Pn(o,r).push(e),s.add(e));return o}function In(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var Ln=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function Rn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var zn=(e,...t)=>e.filter(e=>!t.some(t=>Bn(e,t))),Bn=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,Vn=e=>Math.round(e*10)/10,J=e=>`${Vn(e.x)} ${Vn(e.y)}`;function Hn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function Un(e,t=8){let n=Hn(e),r=n[0];if(!r)return``;let i=`M${J(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${J(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${J(c(r,a,s))} Q ${J(r)}, ${J(c(r,o,s))}`}return i}function Wn(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function Gn(e){return{rows:Wn(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:Wn(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var Y=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),X=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function Kn(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function qn(e,t,n,r=0){let i=Gn(n),a=Y(i.rows,e=>e.top,e.y),o=Y(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?X(i,a):X(i,a-1))+r/2,d=(s?X(i,o-1):X(i,o))+r/2,f=Kn(i,Y(i.cols,e=>e.left,e.x),Y(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}var Jn=15;function Yn(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-Jn,e.y+e.h+Jn])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function Xn(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=Yn(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),Jn-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function Zn(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
|
|
2
|
+
`);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function Qn(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var $n=e=>Math.round(e*10)/10,Z=e=>`${$n(e.x)} ${$n(e.y)}`;function er(e,t,n){return t&&t.x>e.x+40?1:t&&t.x<e.x-40?-1:e.x+e.w+96<=n+1?1:-1}function tr(e,t,n,r,i,a){let o=r>0?Math.max(e.x+e.w,t.x+t.w):Math.min(e.x,t.x),s=(70+n)*r;return{d:`M${Z({x:o,y:i})} C ${Z({x:o+s,y:i})}, ${Z({x:o+s,y:a})}, ${Z({x:o+2*r,y:a})}`,label:{x:o+s*.75,y:(i+a)/2}}}function nr(e,t,n=[],r=0,i=1){let a=e.y+22+r,o=t.y+22+r;if(Math.abs(e.x-t.x)<40)return tr(e,t,r,i,a,o);let s=t.x>e.x,c=s?e.x+e.w:e.x,l=s?t.x:t.x+t.w,u=Math.max(40,Math.abs(l-c)*.5)*(s?1:-1),d=l-(s?2:-2);if(Rn(Ln({x:c,y:a},{x:l,y:o}),zn(n,e,t))){let i=Xn({x:c,y:a},{x:l,y:o},96,zn(n,e,t),r);return{d:Un(i.points),label:i.label}}return{d:`M${Z({x:c,y:a})} C ${Z({x:c+u,y:a})}, ${Z({x:l-u,y:o})}, ${Z({x:d,y:o})}`,label:{x:(c+l)/2,y:(a+o)/2}}}function rr(e,{other:t,view:n,labelHeight:r}){let i=r/2+4,a=!t||!n?e+44:t.y>e?Math.max(e+44,n.y1-i):Math.min(e-44,n.y0+i);return n?ir(a,n.y0+i,n.y1-i):a}var ir=(e,t,n)=>Math.max(t,Math.min(n,e));function ar(e,t,n){let r=n.lane??0,i=e.y+22+r,a=n.side>0?e.x+e.w:e.x,o=a+n.side*96/2+r/2,s={x:o,y:rr(i,n)};return{d:Un(t===`sender`?[{x:a,y:i},{x:o,y:i},s]:[s,{x:o,y:i},{x:a+2*n.side,y:i}]),label:s}}function or(e,t,n,r=0){let i={x:e.x,y:e.y+e.h/2},a={x:t.x-2,y:t.y+t.h/2},o=n.x-18+r/2;return{d:`M${Z(i)} C ${Z({x:o,y:i.y})}, ${Z({x:o,y:a.y})}, ${Z(a)}`,label:{x:o,y:(i.y+a.y)/2}}}function sr(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(Rn(Ln({x:i,y:s},{x:a,y:c}),zn(n,e,t))){let i=qn(e,t,n,r);return{d:Un(i.points),label:i.label}}return{d:`M${Z({x:i,y:s})} C ${Z({x:i,y:s+l})}, ${Z({x:a,y:c-l})}, ${Z({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${Z({x:i,y:o})} C ${Z({x:i,y:c-l})}, ${Z({x:a,y:c-l})}, ${Z({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function cr(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function lr(e,t){let n=[];for(let r of e){let e=n.find(e=>Math.abs((e[0]?.at.x??NaN)-r.at.x)<t);e?e.push(r):n.push([r])}return n}function ur(e,t,n,r){let i=e.map(e=>Math.min(r,Math.max(n,e.at.y))),a=i.map((e,t)=>t).sort((e,t)=>i[e]-i[t]);for(let e=1;e<a.length;e++){let n=a[e];i[n]=Math.max(i[n],i[a[e-1]]+t)}for(let e=a.length-1;e>=0;e--){let n=a[e],o=e+1<a.length?i[a[e+1]]-t:r;i[n]=Math.min(i[n],o)}return e.map((e,t)=>({id:e.id,at:{x:e.at.x,y:i[t]}}))}function dr(e,t,n,r=4){let i=n?n.y0+t.h/2:-1/0,a=n?n.y1-t.h/2:1/0,o=new Map;for(let n of lr(e,t.w+r))for(let e of ur(n,t.h+r,i,a))o.set(e.id,e.at);return o}var fr=(e,t)=>e.x<=t.x1&&t.x0<=e.x+e.w&&e.y<=t.y1&&t.y0<=e.y+e.h;function pr(e,t,n){let r=e!==void 0&&fr(e,n),i=t!==void 0&&fr(t,n);return r&&i?`both`:r?`sender`:i?`recipient`:`none`}var mr=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function hr(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)mr(n)&&t.push(n);return t}function gr(e,t){return{x0:Math.max(e.x0,t.x0),y0:Math.max(e.y0,t.y0),x1:Math.min(e.x1,t.x1),y1:Math.min(e.y1,t.y1)}}function _r(e){let t=e.getBoundingClientRect(),n={x0:0,y0:0,x1:window.innerWidth,y1:window.innerHeight};for(let t of hr(e)){let e=t.getBoundingClientRect();e.width>0&&e.height>0&&(n=gr(n,{x0:e.left,y0:e.top,x1:e.right,y1:e.bottom}))}return{x0:n.x0-t.left,y0:n.y0-t.top,x1:n.x1-t.left,y1:n.y1-t.top}}var Q={w:88,h:40};function vr(e,t){let n=e.getBoundingClientRect(),r=new Map;for(let i of e.querySelectorAll(`[${t}]`)){let e=i.getAttribute(t);e&&r.set(e,cr(i.getBoundingClientRect(),n))}return r}function yr({base:e,from:t,to:n,fromName:r,toName:i},a,o,s){let c=a.get(t),l=a.get(n),u=s.view??{x0:-1/0,y0:-1/0,x1:1/0,y1:1/0},d=(e,t)=>({side:er(e,t,s.width),labelHeight:Q.h,lane:o??0,view:u,...t?{other:t}:{}});switch(pr(c,l,u)){case`both`:return c&&l?{...e,...nr(c,l,[...a.values()],o,er(c,void 0,s.width))}:void 0;case`sender`:return c?{...e,...ar(c,`sender`,d(c,l)),away:i()}:void 0;case`recipient`:return l?{...e,...ar(l,`recipient`,d(l,c)),away:r()}:void 0;case`none`:return}}var br=(e,t)=>({base:{id:e.requestId,kind:`peer`},from:e.senderRunId,to:e.recipientRunId,fromName:()=>z(t,e),toName:()=>B(t,e)}),xr=(e,t)=>({base:{id:e.id,kind:`wait`},from:e.peerRunId,to:e.waiterRunId,fromName:()=>R(t,e.peerRunId),toName:()=>R(t,e.waiterRunId)}),Sr=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function Cr(e,t){return[...new Set([...e.values()].map(e=>Math.round(e.x+e.w)))].filter(e=>e+96<=t+1).map(e=>e+96/2)}function wr(e,t){return t.length===0?e:{x:t.reduce((t,n)=>Math.abs(n-e.x)<Math.abs(t-e.x)?n:t),y:e.y}}function Tr(e,t,n,r,i,a){let o=r.get(e.senderRunId)?.cardId??r.get(e.recipientRunId)?.cardId,s=o===void 0?void 0:t.get(o),c=n.get(e.senderRunId),l=n.get(e.recipientRunId);if(!(!s||!c||!l||a&&!fr(s,a)))return{id:e.requestId,kind:`family`,...or(c,l,s,i)}}function Er(e,t,n,{peers:r,frame:i={width:e.clientWidth},waits:a=[]}){let o=vr(e,`data-activity-card`),s=vr(e,`data-activity-anchor`),c=Zn([...t,...a.map(Sr)]),l=[];for(let e of t){let t=c.get(e.requestId),a=e.relationship===`peer`?r?yr(br(e,n),o,t,i):void 0:Tr(e,o,s,n,t,i.view);a&&l.push(a)}for(let e of r?a:[]){let t=yr(xr(e,n),o,c.get(e.id),i);t&&l.push(t)}let u=Cr(o,i.width),d=dr(l.filter(e=>e.kind!==`family`).map(e=>({id:e.id,at:wr(e.label,u)})),Q,i.view);return l.map(e=>({...e,label:d.get(e.id)??e.label}))}function Dr(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.d===r.d&&e.away===r.away&&e.label.x===r.label.x&&e.label.y===r.label.y})}function Or({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var kr=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function Ar(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,kr(r)-n);return e.reverse?1-i:i}var jr=`http://www.w3.org/2000/svg`,Mr=[0,.03,.06,.09,.12],Nr=[4.5,3.5,3,2.5,2],Pr={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function Fr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(jr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(jr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${Pr[t.tone]} opacity-35`),r.append(i),Mr.forEach((e,n)=>{let i=document.createElementNS(jr,`circle`);i.setAttribute(`r`,String(Nr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:Pr[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function Ir(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();Fr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(Ar(r,n,Mr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var Lr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),Rr=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function zr(e,t,n){let r=w.useRef(null),i=w.useRef(void 0),a=w.useRef(new Set);return w.useEffect(()=>{let e=r.current;if(!e)return;let t=Or({frame:Lr,cancel:Rr,draw:(t,n)=>Ir(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),w.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:W.comet}))},[e,t,n]),r}function Br(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t)continue;let a={x:t.x-i.x,y:t.y-i.y};(Math.abs(a.x)>=1||Math.abs(a.y)>=1)&&n.set(r,a)}return n}function Vr(e,t){let n=new Map;for(let r of e.querySelectorAll(`[${t}]`)){let e=r.getBoundingClientRect();n.set(r.getAttribute(t)??``,{el:r,at:{x:e.left,y:e.top}})}return n}var Hr=`activity-layout-settled`;function Ur(e,t,n,r){let i=w.useRef(void 0),a=w.useRef(new Set);w.useLayoutEffect(()=>{let o=e.current;if(!o)return;let s=Vr(o,t),c=new Map([...s].map(([e,t])=>[e,t.at])),l=i.current;if(i.current={key:n,at:c},!(!r||!l||l.key===n))for(let[e,t]of Br(l.at,c)){let n=s.get(e)?.el.animate?.([{transform:`translate(${t.x}px, ${t.y}px)`},{transform:`none`}],{duration:400,easing:`cubic-bezier(0.2, 0, 0, 1)`});n&&Wr(n,a.current,o)}}),w.useEffect(()=>{if(!r)for(let e of[...a.current])e.cancel()},[r])}function Wr(e,t,n){t.add(e);let r=()=>{t.delete(e)&&t.size===0&&n.dispatchEvent(new Event(Hr))};e.addEventListener(`finish`,r),e.addEventListener(`cancel`,r)}function Gr(e,t,n,r,i,a=!1){let[o,s]=w.useState([]);return w.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?Kr(i,o):void 0;i.addEventListener(Hr,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(Hr,o),c?.()}},[e,t,n,r,i,a]),o}function Kr(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[...hr(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}var qr=28;function Jr(e){let t=e.replace(/\s+/g,` `).trim();return t.length>qr?`${t.slice(0,qr-1).trimEnd()}…`:t}function Yr(e,t){if(e.deadline!==void 0)return Xr(e.createdAt,e.deadline,t)}function Xr(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function Zr(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return r(`activity-march`,t&&`activity-line-in`)}function Qr(e,t){return t in e.waitsClosing?`activity-line-out`:r(`activity-drift`,t in e.opening&&`activity-line-in`)}var $r=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-lg border bg-background px-1.5 py-[3px] text-[10px] leading-[1.3] text-foreground tabular-nums`;function ei({line:e,wait:t,now:n,motion:i}){return(0,T.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:Q.w},className:r($r,`border-dashed border-message-peer-accent`,t.id in i.waitsClosing&&`activity-line-out`),children:[(0,T.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[(0,T.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Waiting`}),(0,T.jsx)(`span`,{className:`ml-auto shrink-0`,children:A(j(t.since,n))})]}),e.away?(0,T.jsx)(`span`,{className:`block truncate`,children:e.away}):null,(0,T.jsx)(`span`,{"data-slot":`activity-wait-bar`,className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:`block h-full bg-message-peer-accent opacity-70`,style:{width:`${Math.round(Xr(t.since,t.deadline,n)*100)}%`}})})]})}function ti({line:e,request:t,now:n,phase:i,replied:a}){let o=Yr(t,n);return(0,T.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-request":t.requestId,"data-phase":i,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:Q.w},className:r($r,a?`border-success`:`border-message-peer-accent`,i===`fade`&&`activity-line-out`),children:[(0,T.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[a?(0,T.jsx)(`span`,{className:`text-success`,children:`Replied`}):(0,T.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Request`}),(0,T.jsx)(`span`,{className:`ml-auto shrink-0`,children:A(j(t.createdAt,n))})]}),(0,T.jsx)(`span`,{className:`block truncate`,children:e.away??Jr(t.text)}),o===void 0||a?null:(0,T.jsx)(`span`,{className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:`block h-full bg-message-peer-accent`,style:{width:`${Math.round(o*100)}%`}})})]})}var ni=(e,t)=>e.closing[t]?.phase??`open`;function ri(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}var ii=new Set;function ai({line:e,motion:t}){let n=ni(t,e.id);return(0,T.jsx)(`path`,{"data-request":e.id,"data-kind":e.kind,"data-phase":n,d:e.d,fill:`none`,strokeDasharray:n===`replied`?void 0:`6 5`,strokeWidth:e.kind===`peer`?2.2:1.8,markerEnd:`url(#activity-arrow-${e.kind})`,className:r(e.kind===`peer`?`stroke-message-peer-accent`:`stroke-message-inbound-accent`,Zr(n,e.id in t.opening))})}function oi({line:e,motion:t,active:n}){return(0,T.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":n?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:n?3.2:2.4,markerEnd:`url(#activity-ring-wait)`,className:r(`stroke-message-peer-accent`,n?`opacity-100`:`opacity-80`,Qr(t,e.id))})}function si({id:e}){return(0,T.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,T.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}var ci=[];function li({requests:e,waits:t=ci,active:n=ii,index:r,peers:i,layoutKey:a,now:o,motion:s=G,paused:c=!1}){let l=w.useRef(null),u=Gr(l,w.useCallback(n=>Er(n,e,r,{peers:i,waits:t,frame:{width:n.clientWidth,view:_r(n)}}),[e,t,r,i]),Dr,`[data-activity-card]`,a,!0),d=w.useMemo(()=>new Set(u.map(e=>e.id)),[u]),f=zr(s.comets,d,c),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e]));return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`svg`,{ref:l,"data-slot":`activity-lines`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible`,children:[(0,T.jsxs)(`defs`,{children:[(0,T.jsx)(`marker`,{id:`activity-arrow-peer`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,T.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,T.jsx)(`marker`,{id:`activity-arrow-family`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,T.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-inbound-accent`})}),(0,T.jsx)(si,{id:`activity-ring-wait`})]}),u.map(e=>e.kind===`wait`?(0,T.jsx)(oi,{line:e,motion:s,active:n.has(e.id)},e.id):(0,T.jsx)(ai,{line:e,motion:s},e.id)),(0,T.jsx)(`g`,{ref:f,"data-slot":`activity-comets`})]}),u.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,T.jsx)(ei,{line:e,wait:t,now:o,motion:s},e.id);let n=p.get(e.id);return e.kind===`peer`&&n?(0,T.jsx)(ti,{line:e,request:n,now:o,phase:ni(s,e.id),replied:ri(s,e.id)},e.id):null})]})}function ui(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of jt(r))n.set(e,t);return n}var di={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function fi(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${di[t??``]??`closed`}`}var pi={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},mi=e=>e.relationship===`peer`?`peer`:`family`;function hi(e,t,n){let r=(e,n)=>R(t,e,n);switch(e.kind){case`request-opened`:return{tone:mi(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:fi(e.request,e.status,r)};case`rung-changed`:return{tone:a(e.task.rung).tone,text:`${e.task.title}: ${Et(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=pi[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:a(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function gi(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function _i(e){let t=Math.max(0,Math.floor(e/1e3));return t<5?`now`:t<60?`${t} s`:`${Math.floor(t/60)} min`}var vi=new Set;function yi(e){let[t,n]=w.useState({}),r=t.pointer??t.focus,i=w.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:w.useMemo(()=>r===void 0?vi:Nt(r,e),[r,e]),active:w.useMemo(()=>r===void 0?vi:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}var bi=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),xi=`inline-flex items-center px-3 py-[5px] text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function Si({scope:e,projectId:t}){let n=e=>r(xi,e?`bg-card-2 text-foreground`:`text-muted-foreground hover:text-foreground`);return(0,T.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex overflow-hidden rounded-lg border border-border`,children:[t===null?null:(0,T.jsx)(pe,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:n(e===`project`),children:`This project`}),(0,T.jsx)(pe,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:n(e===`all`),children:`All projects`})]})}function Ci({now:e,stale:t}){return(0,T.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":t?`true`:void 0,className:`inline-flex items-center gap-1.5 text-[12px] text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`span`,{"data-tone":`success`,className:r(`inline-flex size-[12px] items-center justify-center`,!t&&`activity-pulse`),children:(0,T.jsx)(C,{tone:t?`neutral`:`success`,"aria-hidden":`true`})}),(0,T.jsx)(`b`,{className:r(`font-semibold`,t?`text-muted-foreground`:`text-success`),children:t?`Not updating`:`Live`}),bi.format(e),` `,ot()]})}function wi({name:e,now:t,stale:n=!1,children:r}){return(0,T.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,T.jsxs)(`h1`,{className:`min-w-0 truncate text-[18px] font-semibold`,children:[`Activity `,(0,T.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e]})]}),t===void 0?null:(0,T.jsx)(Ci,{now:t,stale:n}),r]})}function Ti({value:e,bump:t}){return(0,T.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:r(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function $({icon:e,count:t,label:n,bump:r}){return(0,T.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,T.jsx)(Ti,{value:t,bump:r}),` `,n]})}function Ei({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,T.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,T.jsx)($,{icon:(0,T.jsx)(C,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,T.jsx)($,{icon:(0,T.jsx)(C,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,T.jsx)($,{icon:(0,T.jsx)(C,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,T.jsx)($,{icon:(0,T.jsx)(C,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,T.jsx)($,{icon:(0,T.jsx)(ge,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,T.jsx)($,{icon:(0,T.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,T.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,T.jsxs)(S,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,T.jsx)(C,{tone:`info`,"aria-hidden":`true`}),(0,T.jsx)(Ti,{value:e.inReview,bump:r(`inReview`)}),` in review`]})})]})}var Di=e=>new Map(e.map(e=>[e.runId,e])),Oi=e=>e!==void 0&&At(e)===void 0;function ki(e,t,n,r){let i=Di(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&N(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&N(a.status)&&!N(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function Ai(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var ji=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function Mi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),ji(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),ki(e,t,n,r),Ai(e,t,n,r)}function Ni(e,t,n){let r=Di(e.tasks),i=Di(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?Mi(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function Pi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}function Fi(e,t,n){let r=V(e.tasks),i=V(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var Ii=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function Li(e,t,n){let r=U(e),i=U(t);for(let e of Ii)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function Ri(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!Oi(t)||!Oi(e)||(Ni(t,e,r),Pi(t,e,r),Fi(t,e,r))}return Li(e.projects,t.projects,r),n}function zi(e){return{input:e,reconcile:!1,seq:0,motion:G,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function Bi(e){let{plan:t,...n}=e;return{...n,motion:G,epoch:e.epoch+1}}function Vi(e,t,n){let r=Ri(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=ui(t,n),o=r.flatMap(e=>hi(e,a,i)??[]),s=e.seq+o.length+1,c=$t(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?gi(e.feed,o,i,e.seq+1):e.feed,motion:tn(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function Hi(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:Vi(r,n,t)}function Ui(e,t){let n=e.input;if(t.scope!==n.scope)return{...zi(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={...Bi(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=Bi(r)),Hi(r,t.snapshot)}var Wi=`(prefers-reduced-motion: reduce)`,Gi=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(Wi):void 0;function Ki(e){let t=Gi();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function qi(){return Gi()?.matches??!1}function Ji(){return(0,w.useSyncExternalStore)(Ki,qi,()=>!1)}function Yi(e,t){let n=w.useRef(new Set);w.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),w.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:tn(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function Xi(e,t){let n=Ji(),r=ie(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=w.useState(()=>zi(i)),s=Ui(a,i);return s!==a&&o(s),Yi(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function Zi(e,t){let n=Ce(1e3),[r,i]=w.useState({offset:0}),a=r.offset;return Qe(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{xn as A,V as B,Nn as C,An as D,Mn as E,G as F,z as G,B as H,nn as I,Et as J,U as K,Rt as L,K as M,sn as N,Cn as O,an as P,rt as Q,H as R,Qn as S,In as T,It as U,At as V,jt as W,A as X,M as Y,j as Z,zr as _,Ei as a,cr as b,li as c,ni as d,ri as f,Ur as g,Gr as h,Si as i,mn as j,On as k,si as l,Yr as m,Xi as n,yi as o,Qr as p,N as q,wi as r,_i as s,Zi as t,Zr as u,Sr as v,Fn as w,Zn as x,sr as y,R as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{t as a}from"./arrow-right-Dh_Lx3um.js";import{A as o,B as s,C as c,E as l,F as u,G as d,H as f,I as p,K as m,L as h,N as g,Q as _,T as v,U as y,V as b,W as x,X as S,Y as C,Z as w,a as T,c as E,g as D,i as O,m as k,n as A,o as j,r as M,s as N,t as P,w as F,z as I}from"./activity-motion-CkAbct6K.js";import{t as L}from"./button-BQ2y4XRB.js";import{s as R}from"./project-router-UyyzK1j2.js";import{t as z}from"./status-dot-DtAOFiIi.js";import{ct as B}from"./index-CRfojAQ1.js";var V=e(t(),1),H=n(),U=`rounded-xl border border-border bg-card px-3.5 py-3`,W=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function G({request:e,index:t,now:n,motion:r}){let{kind:o,relation:s}=h(e,t),c=k(e,n),l=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,H.jsxs)(`li`,{"data-slot":r===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":r===`fold`||void 0,className:i(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,r===`enter`&&`activity-row-enter`,r===`fold`&&`activity-row-fold`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:d(t,e)}),(0,H.jsx)(a,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:f(t,e)}),(0,H.jsx)(`span`,{className:i(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,l),children:o})]}),(0,H.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,H.jsxs)(`span`,{children:[s,` · open `,S(w(e.createdAt,n))]}),e.deadline?(0,H.jsx)(`span`,{className:`ml-auto`,children:y(e.deadline,n)}):null]}),c===void 0?null:(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,H.jsx)(`span`,{className:i(`block h-full bg-current`,l),style:{width:`${Math.round(c*100)}%`}})})]})}function K({className:e}){return(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 5`,className:e})})}function q(){return(0,H.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,H.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,H.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]})}function J(){let e=`flex items-center gap-2`;return(0,H.jsxs)(`div`,{"data-slot":`activity-legend`,className:i(U,`grid gap-1.5 text-[11.5px] text-muted-foreground`),children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Legend`}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(z,{tone:`running`,"aria-hidden":`true`}),`Filled: working now`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(z,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),`Ring: waiting for something outside`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(z,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),`Robot: waiting for its own workers`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(o,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),`Heartbeat: tool calls, last 30 s`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-peer-accent`}),`Open request, task to task`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(q,{}),`Waits for a peer to write`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-inbound-accent`}),`Open question, worker to parent`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`circle`,{cx:`17`,cy:`5`,r:`4`,className:`fill-foreground`})}),`Comet: a message is travelling`]})]})}var Y={...g,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function X({feed:e,now:t,watchingSince:n}){return(0,H.jsxs)(`section`,{"data-slot":`activity-just-now`,className:U,children:[(0,H.jsx)(`h2`,{className:W,children:`Just now`}),e.length>0?(0,H.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,H.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:i(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:i(`size-[7px] -translate-y-px rounded-full`,Y[e.tone])}),(0,H.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,H.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:N(t-e.at)})]},e.id))}):null,(0,H.jsxs)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:[`Watching since `,C(n)]})]})}function Z({requests:e,closing:t=[],index:n,now:r,watchingSince:i,feed:a=[],motion:o=u}){return(0,H.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-4`,children:[(0,H.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:U,children:[(0,H.jsxs)(`h2`,{className:W,children:[`Open requests `,(0,H.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),e.length===0&&t.length===0?(0,H.jsx)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:`No task waits for a reply.`}):(0,H.jsxs)(`ul`,{children:[e.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:`fold`},e.requestId))]})]}),(0,H.jsx)(X,{feed:a,now:r,watchingSince:i}),(0,H.jsx)(J,{})]})}function Q(e){let[t,n]=V.useState(0);return V.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>n(t.clientWidth);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function $(e,t,n){let[r,i]=V.useState(void 0),a=F(r,e,t,n);return v(r,a)||i(a),a}function ee(e,t,n=s(e.tasks)){let r=new Set(e.tasks.map(e=>e.runId)),i=new Set(e.requests.map(e=>e.requestId)),a=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!i.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!r.has(t.task.runId)).map(e=>e.task),requests:a.map(e=>e.request),waits:p(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}function te({project:e,now:t,watchingSince:n,motion:r=u,feed:i,still:a=!1,paused:o=!1}){let d=V.useRef(null),f=c(Q(d)),p=V.useMemo(()=>x(e),[e]),m=V.useMemo(()=>s(e.tasks),[e.tasks]),h=V.useMemo(()=>ee(e,r,m),[e,r,m]),g=V.useMemo(()=>[...e.requests,...h.requests],[e.requests,h.requests]),_=V.useMemo(()=>[...m,...h.waits],[m,h.waits]),v=j(m),y=new Map([...h.cards,...e.tasks].map(e=>[e.runId,e])),b=new Set(h.cards.map(e=>e.runId)),S=e=>1+.35*(y.get(e)?.workers.length??0),C=$([...y.keys()],f,S),w=f===1,T=e.tasks.length>12,O={now:t,titleOf:e=>I(p,e)},k=C.map(e=>e.join(`,`)).join(`|`),A=`${e.tasks.length}:${f}:${T}:${k}:${g.map(e=>e.requestId).join(`,`)}:${_.map(e=>e.id).join(`,`)}`;return D(d,`data-flip`,k,!a&&!o),(0,H.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 pl-5`,children:[e.tasks.length===0?(0,H.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No active work in this project.`}):null,(0,H.jsxs)(`div`,{ref:d,"data-slot":`activity-graph`,"data-columns":f,"data-dense":T?`true`:void 0,className:`relative grid items-start`,style:{gridTemplateColumns:`repeat(${f}, minmax(0, 1fr))`,columnGap:w?0:96},children:[C.map((t,n)=>(0,H.jsx)(`div`,{"data-slot":`activity-column`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-[30px] max-md:gap-4`,children:t.map(t=>{let n=y.get(t);return n?(0,H.jsx)(l,{task:n,requests:e.requests,waits:m,index:p,ctx:O,dense:T,narrow:w,motion:r,ghost:b.has(t),linked:v.linked.has(t),onHover:v.onHover},t):null})},n)),(0,H.jsx)(E,{requests:g,waits:_,active:v.active,index:p,peers:!w,layoutKey:A,now:t,motion:r,paused:o||a})]})]}),(0,H.jsx)(Z,{requests:e.requests,closing:h.folding,index:p,now:t,watchingSince:n,feed:i,motion:r})]})}function ne(){let e=r(),t=_({kind:`project`,projectId:e}),n=R(),[i]=V.useState(()=>new Date().toISOString()),a=P(t.data?.generatedAt,t.dataUpdatedAt),{motion:o,feed:s,reduced:c,paused:l}=A(t.data,e),u=t.data?.projects[0];if(t.isPending)return(0,H.jsx)(B,{});let d=u?b(u):void 0;return u?(0,H.jsxs)(`div`,{"data-route":`activity`,"data-activity-paused":l?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(M,{name:u.name,now:a,stale:t.isError,children:(0,H.jsx)(O,{scope:`project`,projectId:n??u.projectId})}),(0,H.jsx)(T,{summary:m([u]),tasksTo:`/`,bumps:o.bumps}),d?(0,H.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`py-6 text-[13px] text-muted-foreground`,children:d}):(0,H.jsx)(te,{project:u,now:a,watchingSince:i,motion:o,feed:s,still:c,paused:l})]}):(0,H.jsxs)(`div`,{"data-route":`activity`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(M,{name:n??`project`,children:(0,H.jsx)(O,{scope:`project`,projectId:n})}),(0,H.jsxs)(`div`,{role:`alert`,className:`mt-6 flex items-center gap-3 text-[13px] text-muted-foreground`,children:[t.error?`Could not load activity: ${t.error.message}`:`This project has no activity snapshot.`,(0,H.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})]})}export{ne as ProjectActivityRoute};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{i,ti as a}from"./project-scope-context-BRvkKGX1.js";import{M as o,Y as s,a as c,i as l,t as u}from"./queries-CQWAcH8p.js";import{n as d}from"./toaster-Bo5vCbz-.js";import{i as f,n as p,s as m}from"./runners-BFhbiSKy.js";import{t as h}from"./button-BQ2y4XRB.js";import{t as g}from"./badge-D9JrXe0o.js";import{t as _}from"./centered-state-V15AR_qo.js";import{A as v,Jn as y}from"./index-CRfojAQ1.js";import{i as b,n as x,r as S}from"./highlighter-DvLzHjjY.js";import{n as C,r as w,t as T}from"./remote-settings-notice-BFDdo8X5.js";var E=e(t(),1),D=n(),O=1500;function k(e,t){let n=(0,E.useMemo)(()=>e.split(`
|
|
2
|
+
`).map(e=>[{content:e}]),[e]),r=(0,E.useMemo)(()=>x(t),[t]),i=n.length>O,[a,o]=(0,E.useState)(null);return(0,E.useEffect)(()=>{if(r===null||i)return;let t=!1;return S(e,r).then(n=>{t||o({key:e,tokens:n.tokens})}),()=>{t=!0}},[e,r,i]),r===null||i?n:a?.key===e?a.tokens:b(e,r)?.tokens??n}var A=`code-editor-surface m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function j({value:e,onChange:t,language:n,readOnly:i,className:a,...o}){let s=k(e,n),c=(0,E.useRef)(null),l=(0,E.useRef)(null),u=()=>{let e=l.current,t=c.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,E.useLayoutEffect)(u,[e]),(0,D.jsxs)(`div`,{"data-slot":`code-editor`,className:r(`relative overflow-hidden rounded-md border border-input bg-card`,a),children:[(0,D.jsx)(`pre`,{ref:c,"aria-hidden":`true`,className:r(A,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:s.map((e,t)=>(0,D.jsx)(`span`,{className:`block`,children:e.length===0?`
|
|
3
|
+
`:(0,D.jsxs)(D.Fragment,{children:[e.map((e,t)=>(0,D.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
|
|
4
|
+
`]})},t))}),(0,D.jsx)(`textarea`,{ref:l,"data-slot":`code-editor-input`,value:e,readOnly:i,onChange:e=>t?.(e.target.value),onScroll:u,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:r(A,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-hidden`,`selection:bg-accent-strong/30 focus-visible:ring-0`,i&&`cursor-default`),...o})]})}function M(e){return t=>t.runners.includes(e)}function N(e,t){let n=M(e);return t===`mcp`?e=>n(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>n(e)&&e.kind===t}function P(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:N(e.id,t)}))}}function F(e){return p(e).map(P)}function I(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function L(){let e=l();w();let t=o(),n=m(),r=n.data,i=(0,E.useMemo)(()=>F(r),[r]),a=(0,E.useMemo)(()=>t.data?v(t.data.checks,r):f(r),[t.data,r]);return n.isError?(0,D.jsx)(_,{icon:(0,D.jsx)(y,{}),tone:`danger`,title:`Runners did not load`,subtitle:n.error.message,heading:`h2`}):e.isError?(0,D.jsx)(_,{icon:(0,D.jsx)(y,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||r===void 0?(0,D.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,D.jsx)(R,{listing:e.data,descriptors:i,installed:a})}function R({listing:e,descriptors:t,installed:n}){let[i,a]=(0,E.useState)(`claude`),[o,s]=(0,E.useState)(null),c=t.find(e=>e.id===i)??t[0];if(c===void 0)return null;let l=e.files.find(e=>e.id===o)??null,u=e=>{a(e),s(null)};return(0,D.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,D.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit agent instructions and MCP configuration for this project.`}),!e.editable&&(0,D.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-soft-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,D.jsx)(`code`,{children:T}),`.`]}),(0,D.jsx)(C,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,D.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,D.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===c.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===c.id,onClick:()=>u(e.id),className:r(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===c.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,D.jsx)(g,{variant:`outline`,className:`text-[12px] text-soft-foreground`,children:`not installed`})]},e.id))}),c.note&&(0,D.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:c.note}),(0,D.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,D.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,D.jsx)(z,{agent:c,listing:e,selectedId:o,onSelect:s})}),(0,D.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:l?(0,D.jsx)(V,{file:l},l.id):(0,D.jsx)(`div`,{className:`flex h-full min-h-40 items-center justify-center rounded-md border border-dashed border-border text-[13px] text-soft-foreground`,children:`Select a config file to view or edit it.`})})]})]})}function z({agent:e,listing:t,selectedId:n,onSelect:i}){return(0,D.jsx)(D.Fragment,{children:e.groups.map(a=>{let o=t.files.filter(a.files),s=a.showsUserMcp?t.userMcp:void 0;return o.length===0&&!s&&!a.empty?null:(0,D.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":a.id,"data-agent":e.id,children:[(0,D.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:a.label}),a.note&&(0,D.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:a.note}),o.length===0&&a.empty&&(0,D.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-[12px] text-soft-foreground`,children:a.empty}),(0,D.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>i(e.id),className:r(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,D.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,D.jsx)(g,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`seeded`}),!e.exists&&(0,D.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),s&&(0,D.jsx)(B,{userMcp:s})]},a.id)})})}function B({userMcp:e}){return(0,D.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,D.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,D.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,D.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,D.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsx)(g,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,D.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,D.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function V({file:e}){let t=c(e.id),[n,r]=(0,E.useState)(null),[i,a]=(0,E.useState)(!1),[o,s]=(0,E.useState)(null),l=t.data?.version??null,u=n??t.data?.content??``,d=t.data?u!==t.data.content:!1,f=e.writable,{save:p,isSaving:m}=W({file:e,content:u,loadedVersion:l,setDraft:r,setConflict:a,setFormatError:s});return(0,E.useEffect)(()=>{t.data&&(r(t.data.content),a(!1),s(null))},[t.data?.version,t.data]),(0,D.jsxs)(`div`,{"data-slot":`settings-config-editor`,className:`flex flex-col gap-3`,children:[(0,D.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,D.jsxs)(`p`,{"data-slot":`agent-config-scope`,title:e.path,className:`text-[12px] text-muted-foreground break-words`,children:[e.scope.charAt(0).toUpperCase()+e.scope.slice(1),` scope · `,e.path]}),(0,D.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,D.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,D.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,D.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,D.jsx)(`h3`,{children:e.kind===`mcp`||e.holdsMcp?`MCP configuration`:`File contents`}),(e.kind===`mcp`||e.holdsMcp)&&(0,D.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),t.isPending?(0,D.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,D.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,D.jsx)(j,{value:u,language:e.format,readOnly:!f,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),(0,D.jsx)(H,{formatError:o,conflict:i,onReload:()=>void t.refetch()}),f&&(0,D.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,D.jsx)(h,{size:`sm`,onClick:p,disabled:!d||m,children:e.exists?`Save file`:`Create file`}),(0,D.jsx)(h,{size:`sm`,variant:`outline`,onClick:()=>r(null),disabled:!d||m,children:`Reset`}),d&&(0,D.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]}),(0,D.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,D.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,D.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[I(e),e.hotReload?` ${e.hotReload}`:``]}),(0,D.jsx)(U,{reason:e.readOnlyReason})]})]})}function H({formatError:e,conflict:t,onReload:n}){return(0,D.jsxs)(D.Fragment,{children:[e&&(0,D.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:e}),t&&(0,D.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,D.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,D.jsx)(h,{size:`sm`,variant:`outline`,onClick:n,children:`Reload from disk`})]})]})}function U({reason:e}){return e&&(0,D.jsx)(`p`,{children:e})}function W({file:e,content:t,loadedVersion:n,setDraft:r,setConflict:o,setFormatError:c}){let l=s(e.id),f=a(),p=w();return{save:()=>{c(null),o(!1),l.mutate({content:t,version:n},{onSuccess:()=>{r(null),d(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof i&&e.status===409?p().then(()=>{f.getQueryData(u.health)?.capabilities.settingsAdmin===!1?d(e.message,{tone:`danger`}):o(!0)}):e instanceof i&&e.status===400?c(e.message):d(e.message,{tone:`danger`})}})},isSaving:l.isPending}}export{L as AgentConfigSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Kt as r,Tr as i,fn as a,g as o,i as s,r as c,ti as l}from"./project-scope-context-BRvkKGX1.js";import{$ as u,J as d,Nt as f,Ut as p,Wt as m,Yt as h,at as g,lt as _,o as v,p as y,q as b,t as x,xt as S}from"./queries-CQWAcH8p.js";import{n as C}from"./toaster-Bo5vCbz-.js";import{i as w,n as T,s as E,t as D}from"./runners-BFhbiSKy.js";import{s as O}from"./design-icons-CzEoMH9c.js";import{t as k}from"./button-BQ2y4XRB.js";import{t as A}from"./switch-Bv2Zf1uU.js";import{t as ee}from"./status-dot-DtAOFiIi.js";import{t as j}from"./centered-state-V15AR_qo.js";import{N as M,j as N}from"./index-CRfojAQ1.js";import{t as P}from"./textarea-vJt9undk.js";import{a as F,i as I,n as L,r as R,t as z}from"./settings-agent-picker-YO8UtetZ.js";var B=e(t(),1),V=n(),H={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function U(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function W(e,t){return e?H[e]:t?{label:`Checking…`,tone:`neutral`}:H.unknown}function G(e,t){return e===`unknown`||t&&!e}function K({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,V.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,V.jsx)(`code`,{children:e.loginCommand}),`.`]}):G(t,r)?(0,V.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,V.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function q({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`;return(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,V.jsx)(A,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t)}),l?(0,V.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>C(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,V.jsx)(L,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,V.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,V.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>C(`${e.displayName} can be tried again.`),onError:e=>C(e.message,{tone:`danger`})}),children:`Try again`})]})}function J({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,V.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,V.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,V.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function Y(){let e=E(),t=d(),n=u(),r=_(),c=l(),[m,g]=(0,B.useState)(null),v=(0,B.useRef)(Promise.resolve()),y=(0,B.useRef)({}),b=(0,B.useRef)({}),x=(0,B.useRef)(t.data);(0,B.useEffect)(()=>{m&&i(t.data,m.provider)?.status===`connected`&&g(null)},[m,t.data]),(0,B.useEffect)(()=>{if(t.data){if(Object.values(b.current).every(e=>e===0)||!x.current){x.current=t.data;return}x.current={providers:t.data.providers.map(e=>({...e,enabled:(b.current[e.provider]??0)>0?i(x.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let S=(0,B.useCallback)((e,t)=>{let n=f.providerStatus,r=c.getQueryData(n);if(!r)return;x.current||=r;let o=U(r,e,t);b.current[e]=(b.current[e]??0)+1,c.setQueryData(n,o);let s=(y.current[e]??0)+1;y.current[e]=s,v.current=v.current.then(async()=>{try{let r=await a(e,t),o=i(r,e)?.enabled;if(o===void 0)return;if(x.current=U(x.current??r,e,o),s===y.current[e]){let t=c.getQueryData(n);c.setQueryData(n,t?U(t,e,o):r)}}catch(t){if(s===y.current[e]){let r=i(x.current,e)?.enabled,a=c.getQueryData(n);a&&r!==void 0?c.setQueryData(n,U(a,e,r)):x.current?c.setQueryData(n,x.current):c.removeQueries({queryKey:n,exact:!0}),C(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{b.current[e]=(b.current[e]??0)-1}})},[c]),w=h({mutationFn:e=>o(e),onSuccess:async(e,t)=>{g(null),C(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await c.invalidateQueries({queryKey:f.providerStatus}),await p(c,t,`none`)},onError:(t,n)=>{if(t instanceof s&&t.command){let r=D(e.data,n);g({provider:n,label:r,message:t.message,command:t.command});return}C(t.message,{tone:`danger`})}}),O=async e=>{try{await navigator.clipboard.writeText(e),C(`Command copied`)}catch{C(`Could not copy the command`,{tone:`danger`})}};return(0,V.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,V.jsxs)(`div`,{className:`mb-2`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,V.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,V.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,V.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,V.jsx)(`div`,{className:`flex flex-col gap-2`,children:T(e.data).map(e=>{let a=i(t.data,e.id),o=a?.status,s=W(o,t.isPending),c=w.isPending&&w.variables===e.id,l=a?.authFailureId;return(0,V.jsxs)(B.Fragment,{children:[(0,V.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,V.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,V.jsx)(ee,{tone:s.tone,pulse:t.isPending}),(0,V.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,V.jsx)(`span`,{children:`Disabled`}):null]}),(0,V.jsx)(K,{provider:e,state:o,current:a,statusIsError:t.isError})]}),(0,V.jsx)(q,{provider:e,state:o,current:a,isConnecting:c,incidentId:l,refresh:n,connect:w,retry:r,queueToggle:S})]}),l===void 0?null:(0,V.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,V.jsx)(J,{manual:m,provider:e.id,connected:o===`connected`,onCopy:O})]},e.id)})})]})}var X=2e4;function Z(){let e=y(),t=E(),n=m(w(t.data)),r=d();return e.isPending?(0,V.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,V.jsx)(j,{icon:(0,V.jsx)(O,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,V.jsx)(te,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function te({config:e,catalogs:t,providerStatus:n,runners:i}){let a=g(),o=l(),s=h({mutationFn:e=>r(e),onSuccess:e=>{o.setQueryData(x.config,e),o.invalidateQueries({queryKey:x.health}),o.invalidateQueries({queryKey:x.repo})},onError:e=>C(e.message,{tone:`danger`})}),[c,u]=(0,B.useState)(e.systemPrompt??``),d=c.trim(),f=d===(e.systemPrompt??``),p=d.length>X;return(0,V.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,V.jsx)(ne,{defaultRunner:e.defaultRunner,providerStatus:n,saving:s.isPending,onPick:e=>s.mutate({defaultRunner:e})}),(0,V.jsx)(Q,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,V.jsx)(`div`,{className:`flex flex-col gap-4`,children:T(i).map(r=>{let{providerConnected:a,providerReason:o}=F(n,r.id),c=t[r.id],l=N(r.id,i,c),u=M(r.id,i,c?.data,[e.defaultModels[r.id]]),d=e.defaultModels[r.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,V.jsxs)(`label`,{className:`settings-option-row`,children:[(0,V.jsx)(`div`,{children:(0,V.jsx)(`h3`,{children:r.pickerLabel})}),e.modelsLocked?(0,V.jsx)(`output`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,V.jsxs)(`select`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,value:d,title:o??r.pickerDescription,disabled:s.isPending||!a,onChange:e=>s.mutate({defaultModels:{[r.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,V.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,V.jsxs)(Q,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,children:[(0,V.jsx)(P,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:c,onChange:e=>u(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,V.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,V.jsx)(k,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:f||p||s.isPending,onClick:()=>s.mutate({systemPrompt:d===``?null:d},{onSuccess:()=>C(d===``?`System prompt cleared`:`System prompt saved`)}),children:`Save prompt`}),p?(0,V.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[d.length.toLocaleString(),` characters — the limit is`,` `,X.toLocaleString(),`.`]}):(0,V.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,V.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,V.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,V.jsx)(A,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({liveTitleUpdates:e},{onSuccess:()=>C(e?`Live title updates on`:`Live title updates off`)})}),(0,V.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,V.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,V.jsx)(A,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:s.isPending,onCheckedChange:e=>s.mutate({reviewGate:e},{onSuccess:()=>C(e?`Review gate on`:`Review gate off`)})}),(0,V.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,V.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:a.data?.info?(0,V.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:s.isPending,onChange:e=>s.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,V.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),a.data.branches.map(e=>(0,V.jsx)(`option`,{value:e,children:e},e))]}):(0,V.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:a.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,V.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,V.jsx)(`summary`,{children:`Provider connections`}),(0,V.jsx)(Y,{})]})]})}function ne({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let a=v(),o=b(),s=c(),l=g(),u=S(),d=s.projectId??`default`,f=l.data?.info?.root,p=f?a.data?.selections[f]:void 0,m=E().data,h=R(a.data?.profiles??[],m),_=I(h,m);return(0,V.jsxs)(Q,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,V.jsx)(z,{rows:h,runner:e,accountFor:e=>p?.[e]??null,providerStatus:t,disabled:n,accountDisabled:u.isPending||o.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&u.mutate({projectId:d,provider:t,profileId:n},{onError:e=>C(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&i(t.data,e)?.enabled===!1?(0,V.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,_?(0,V.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Q({title:e,hint:t,children:n}){return(0,V.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,V.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function $({title:e,hint:t,children:n}){return(0,V.jsxs)(`section`,{className:`settings-option-row`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{children:e}),(0,V.jsx)(`p`,{children:t})]}),n]})}export{Z as AgentDefaultsSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`/settings/global/agents`,t=e=>`agent-${e}`,n=n=>`${e}#${t(n)}`;export{t as n,n as r,e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{q as n}from"./queries-CQWAcH8p.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-BQ2y4XRB.js";import{Pn as s,_n as c,dt as l}from"./index-CRfojAQ1.js";var u=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),d=e(),f=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:u},{value:`dark`,label:`Dark`,icon:a}],p=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],m=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],h=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function g({slot:e,label:n,value:r,options:i,onChange:a}){return(0,d.jsx)(`div`,{role:`radiogroup`,"aria-label":n,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let n=e.value===r;return(0,d.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-value":e.value,onClick:()=>a(e.value),className:t(`flex min-h-11 items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,n?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,d.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function _({title:e,hint:t,children:n}){return(0,d.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,d.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function v(){let e=n(),{order:t,canReorder:r,reset:i}=c();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,d.jsx)(_,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,d.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function y(){let{theme:e,setTheme:t}=s(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:c}=l();return(0,d.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,d.jsx)(_,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,d.jsx)(g,{slot:`appearance-theme`,label:`Theme`,value:e,options:f,onChange:t})}),p.length>1?(0,d.jsx)(_,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,d.jsx)(g,{slot:`appearance-accent`,label:`Accent`,value:n,options:p,onChange:a})}):null,(0,d.jsx)(_,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,d.jsx)(g,{slot:`appearance-density`,label:`Density`,value:r,options:m,onChange:o})}),(0,d.jsx)(_,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,d.jsx)(g,{slot:`appearance-width`,label:`Reading width`,value:i,options:h,onChange:c})}),(0,d.jsx)(v,{}),(0,d.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,d.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,d.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,d.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-accent-strong/30 bg-accent-strong/10 px-4 py-3 text-xs text-accent-text`,children:`Open task`})]}),(0,d.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{y as AppearanceSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Jt as r,Kt as i,ti as a}from"./project-scope-context-BRvkKGX1.js";import{At as o,Nt as s,Yt as c,p as l,t as u}from"./queries-CQWAcH8p.js";var d=e(t(),1),f=n();function p(){let e=l();return e.isPending?(0,f.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,f.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,f.jsx)(h,{config:e.data,scope:`project`})}function m(){let e=o();return e.isPending?(0,f.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Loading task settings…`}):e.isError?(0,f.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,f.jsx)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:(0,f.jsx)(h,{config:e.data,scope:`global`})})}function h({config:e,scope:t}){let n=(0,d.useId)(),o=a(),l=c({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?i({archiveOnMerge:e},n[0]):r({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?o.setQueryData(n,e):(o.setQueryData(s.config,e),o.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==s.config}))}});return(0,f.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`flex min-w-0 flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,f.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,f.jsx)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived.`})]}),(0,f.jsxs)(`select`,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-2 focus-visible:outline-ring active:bg-muted disabled:opacity-50`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:l.isPending,onChange:e=>l.mutate({archiveOnMerge:e.target.value===`inherit`?null:e.target.value===`enabled`,projectKey:u.config}),children:[(0,f.jsx)(`option`,{value:`inherit`,children:t===`project`?`Inherit global setting`:`Use default`}),(0,f.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,f.jsx)(`option`,{value:`disabled`,children:`Disabled`})]}),(0,f.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,f.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),l.isPending?(0,f.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,l.isError?(0,f.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,l.error.message]}):null]})}export{p as ArchiveOnMergeField,m as TasksSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{En as e,jn as t}from"./project-scope-context-BRvkKGX1.js";function n(n){return e[t(n).bucket]<=e.waiting}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as e,L as t,P as n,R as r,U as i,k as a}from"./live-protocol-D9ji1YCl.js";var o=new Map;function s(e){let t=o.get(e);return t||(t=new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),o.set(e,t)),t}function c(e,t){try{let n=s(t).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value),i=r(`year`),a=r(`month`),o=r(`day`);return{year:i,month:a,day:o,hour:r(`hour`)%24,minute:r(`minute`),second:r(`second`),weekday:l(i,a,o)}}catch{return null}}function l(e,t,n){return(new Date(Date.UTC(e,t-1,n)).getUTCDay()+6)%7+1}function u(e,t){let n=c(t,e);return n?Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-t:null}function d(e,t,n,r,i,a){let o=Date.UTC(e,t-1,n,r,i,0,0),s=o;for(let e=0;e<3;e+=1){let e=u(a,s);if(e===null)return null;let t=o-e;if(Math.abs(t-s)<1e3)return t;s=t}return s}function f(e){if(!e)return!1;try{return s(e).format(new Date(0)),!0}catch{return!1}}var p=[`daily`,`weekdays`,`weekly`,`hours`,`once`],m=[1,2,3,4,6,8,12],h=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],g=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],_=43200,v=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/,y=[`hour`,`minute`,`day`,`every`],b=[`at`,`timeZone`,`latestStartMinutes`],x=`the due time has passed; choose a later time or use Run now`,S=a([`paused`,`waiting`,`failed`,`missed`,`archived`]);function C(e){return`unknown time zone "${e}"; use an IANA name such as Europe/Warsaw`}var w=r({type:a(p),hour:t().int().min(0).max(23).optional(),minute:t().int().min(0).max(59).optional(),day:t().int().min(1).max(7).optional(),every:i([n(1),n(2),n(3),n(4),n(6),n(8),n(12)]).optional(),at:e().regex(v,`at must be YYYY-MM-DDTHH:MM`).optional(),timeZone:e().optional(),latestStartMinutes:t().int().min(10).max(_).optional()}).superRefine((e,t)=>{let n=t=>e[t]!==void 0,r=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type!==`once`){for(let e of b)n(e)&&r(e,`${e} applies only to a once schedule`);return}for(let e of y)n(e)&&r(e,`${e} does not apply to a once schedule`);e.at===void 0?r(`at`,`a once schedule needs at (YYYY-MM-DDTHH:MM)`):v.test(e.at)&&!O(e.at)&&r(`at`,`at is not a real date and time`),e.timeZone===void 0?r(`timeZone`,`a once schedule needs a timeZone`):f(e.timeZone)||r(`timeZone`,C(e.timeZone))});function T(e){return{type:e.type,hour:e.hour??4,minute:e.minute??0,day:e.day??1,every:e.every??6,...e.at===void 0?{}:{at:e.at},...e.timeZone===void 0?{}:{timeZone:e.timeZone},...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}function E(e){if(e.type!==`once`||!e.at||!e.timeZone)return null;let t=D(e.at);return t&&d(t.year,t.month,t.day,t.hour,t.minute,e.timeZone)}function D(e){let t=v.exec(e);if(!t)return null;let[n,r,i,a,o]=t.slice(1).map(Number),s=new Date(Date.UTC(n,r,0)).getUTCDate();return r<1||r>12||i<1||i>s||a>23||o>59?null:{year:n,month:r,day:i,hour:a,minute:o}}var O=e=>D(e)!==null,k=e=>String(e).padStart(2,`0`);function A(e,t=0){return`${k(e)}:${k(t)}`}function j(e){let t=T(e);switch(t.type){case`once`:return M(t);case`daily`:return`every day at ${A(t.hour,t.minute)}`;case`weekdays`:return`weekdays at ${A(t.hour,t.minute)}`;case`hours`:return t.every===1?`every hour`:`every ${t.every} hours`;case`weekly`:return`${g[t.day-1]}s at ${A(t.hour,t.minute)}`}}function M(e){let t=e.at?D(e.at):null;if(!t)return`once`;let{year:n,month:r,day:i,hour:a,minute:o}=t;return`once on ${h[l(n,r,i)-1]} ${i} ${N[r-1]} ${n} at ${A(a,o)} (${e.timeZone??`UTC`})`}var N=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function P(e){let t=T(e);switch(t.type){case`once`:throw Error(`a once schedule has no cron form`);case`daily`:return`${t.minute} ${t.hour} * * *`;case`weekdays`:return`${t.minute} ${t.hour} * * 1-5`;case`hours`:return`0 */${t.every} * * *`;case`weekly`:return`${t.minute} ${t.hour} * * ${t.day%7}`}}function F(e,t){switch(e.type){case`once`:return[];case`daily`:return[[e.hour,e.minute]];case`weekdays`:return t<=5?[[e.hour,e.minute]]:[];case`weekly`:return t===e.day?[[e.hour,e.minute]]:[];case`hours`:{let t=[];for(let n=0;n<24;n+=e.every)t.push([n,0]);return t}}}function I(e,t,n,r,i=1e3){if(e.type===`once`){let r=E(e);return r!==null&&r>=t&&r<n&&i>0?[r]:[]}let a=T(e),o=c(t,r);if(!o||n<=t)return[];let s=[],u=Math.ceil((n-t)/864e5)+2;for(let e=-1;e<=u;e+=1){let c=new Date(Date.UTC(o.year,o.month-1,o.day+e)),u=c.getUTCFullYear(),f=c.getUTCMonth()+1,p=c.getUTCDate();for(let[e,o]of F(a,l(u,f,p))){let a=d(u,f,p,e,o,r);if(a===null||a!==s.at(-1)&&a>=t&&a<n&&(s.push(a),s.length>=i))return s}}return s}function L(e,t){let n=t-e;if(n<=0)return`now`;let r=Math.floor(n/6e4);if(r<1)return`in <1m`;if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}var R=new Map;function z(e,t){if(!Number.isFinite(e))return null;let n=R.get(t);try{n??=new Intl.DateTimeFormat(`en-GB`,{timeZone:t,weekday:`short`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}catch{return null}R.set(t,n);let r={};for(let t of n.formatToParts(e))r[t.type]=t.value;let i=new Date(`${r.month} 1, ${r.year} UTC`).getUTCMonth();return{weekday:r.weekday,day:r.day,month:r.month,hour:r.hour,minute:r.minute,key:`${r.year}-${i}-${r.day}`,dayNumber:Math.floor(Date.UTC(Number(r.year),i,Number(r.day))/864e5)}}function B(e,t){let n=z(Date.parse(e),t);return n?`${n.weekday} ${n.hour}:${n.minute}`:e}function V(e,t,n){let r=z(Date.parse(e),t),i=z(n,t);if(!r||!i)return e;let a=`${r.hour}:${r.minute}`,o=i.dayNumber-r.dayNumber;return o===0?`Today ${a}`:o===1?`Yesterday ${a}`:o>1&&o<7?`${r.weekday} ${a}`:`${r.day} ${r.month} ${a}`}var H=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],U=e=>String(e).padStart(2,`0`);function W(e){let t=e?D(e):null;if(!t)return null;let{year:n,month:r,day:i,hour:a,minute:o}=t;return{date:`${h[l(n,r,i)-1]} ${i} ${H[r-1]} ${n}`,time:`${U(a)}:${U(o)}`}}var G=36e5;function K(e){let t=E(e),n=e.timeZone,r=W(e.at),i=t===null||!n?null:c(t,n);if(t===null||!n||!r||!i)return null;let a={date:`${h[l(i.year,i.month,i.day)-1]} ${i.day} ${H[i.month-1]} ${i.year}`,time:`${U(i.hour)}:${U(i.minute)}`};if(a.date!==r.date||a.time!==r.time)return{...a,note:`${r.time} does not exist on ${r.date} in ${n}.`};let o=e=>{let t=c(e,n);return!!t&&t.day===i.day&&t.hour===i.hour&&t.minute===i.minute},s=(u(n,t-12*G)??0)-(u(n,t+12*G)??0);if(s<=0)return a;let d=o(t+s);if(!d&&!o(t-s))return a;let f=(u(n,t)??0)/6e4,p=`UTC${f<0?`-`:`+`}${U(Math.floor(Math.abs(f)/60))}:${U(Math.abs(f)%60)}`;return{...a,note:`${r.time} happens twice that day; it runs at ${d?`the first`:`the second`} (${p}).`}}export{f as _,x as a,w as c,I as d,E as f,C as g,j as h,L as i,P as l,D as m,V as n,m as o,S as p,K as r,h as s,B as t,T as u,c as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{D as a,Dr as o,Gn as s,H as c,U as l,Ur as u,W as d,Wr as f,an as p,ar as m,dn as h,i as g,jr as _,p as v,qn as y,rn as b,u as x,vn as ee,y as te,zn as S}from"./project-scope-context-BRvkKGX1.js";import{B as C,H as w,L as T,M as E,P as D,R as O,U as k,W as A,j,k as M,z as N}from"./live-protocol-D9ji1YCl.js";import{Gt as ne,J as re,kt as ie,p as ae}from"./queries-CQWAcH8p.js";import{h as oe}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as se,t as P}from"./label-D6DhdNb7.js";import{o as ce,s as le}from"./runners-BFhbiSKy.js";import{I as ue,Y as de,c as fe,d as pe,it as me,l as he,pt as ge,ut as _e,y as ve}from"./design-icons-CzEoMH9c.js";import{n as ye,r as be}from"./dist-C28wFbz0.js";import{t as F}from"./button-BQ2y4XRB.js";import{a as I,n as xe}from"./dist-BW234Kg5.js";import{a as L,i as Se,n as R,r as z,t as Ce}from"./dist-C5mlVBmd.js";import{h as we,m as Te}from"./dropdown-menu-4e2iKSMT.js";import{a as Ee,c as De,i as Oe,l as ke,n as Ae,o as je,r as Me,t as Ne,u as Pe}from"./es2015-CQth82uv.js";import{n as Fe,r as Ie,t as Le}from"./collapsible-BEV4FO-1.js";import{n as Re,t as ze}from"./switch-Bv2Zf1uU.js";import{a as Be,i as Ve,n as He,r as Ue,t as We}from"./dist-BAoXdNsT.js";import{c as Ge,s as Ke,t as B}from"./project-router-UyyzK1j2.js";import{t as qe}from"./centered-state-V15AR_qo.js";import{K as Je,N as Ye,O as Xe,Xn as Ze,Y as Qe,bn as $e,gn as et,k as tt,q as nt,r as rt,t as it,yn as at,zn as V}from"./index-CRfojAQ1.js";import{_ as ot,a as st,c as ct,d as lt,f as ut,g as dt,h as ft,i as pt,l as mt,m as ht,n as gt,o as _t,p as vt,r as yt,s as bt,t as xt,u as St,v as Ct}from"./automation-format-1lHzRTbq.js";import{t as wt}from"./textarea-vJt9undk.js";function Tt(e,[t,n]){return Math.min(n,Math.max(t,e))}var H=e(t(),1),Et=e(n(),1),U=r(),Dt=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Ot=[` `,`Enter`],W=`Select`,[kt,At,jt]=we(W),[G,Mt]=Se(W,[jt,Be]),Nt=Be(),[Pt,K]=G(W),[Ft,It]=G(W),Lt=`SelectProvider`;function Rt(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=Nt(t),[_,v]=H.useState(null),[y,b]=H.useState(null),[x,ee]=H.useState(!1),te=Te(l),[S,C]=Ce({prop:r,defaultProp:i??!1,onChange:a,caller:W}),[w,T]=Ce({prop:o,defaultProp:s,onChange:c,caller:W}),E=H.useRef(null),D=H.useRef(w);H.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>T(D.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,T]);let O=!_||!!m||!!_.closest(`form`),[k,A]=H.useState(new Set),j=ke(),M=Array.from(k).map(e=>e.props.value).join(`;`),N=H.useCallback(e=>{A(t=>new Set(t).add(e))},[]),ne=H.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),re={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:ee,contentId:j,value:w,onValueChange:T,open:S,onOpenChange:C,dir:te,triggerPointerDownPosRef:E,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:k,nativeSelectKey:M,isFormControl:O};return(0,U.jsx)(Ve,{...g,children:(0,U.jsx)(Pt,{scope:t,...re,children:(0,U.jsx)(kt.Provider,{scope:t,children:(0,U.jsx)(Ft,{scope:t,onNativeOptionAdd:N,onNativeOptionRemove:ne,children:In(h)?h(re):n})})})})}Rt.displayName=Lt;var zt=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,U.jsx)(Rt,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[n,e?(0,U.jsx)(Fn,{__scopeSelect:t}):null]})})};zt.displayName=W;var Bt=`SelectTrigger`,Vt=H.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Nt(n),o=K(Bt,n),s=o.disabled||r,c=I(t,o.onTriggerChange),l=At(n),u=H.useRef(`touch`),[d,f,p]=Rn(e=>{let t=l().filter(e=>!e.disabled),n=zn(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,U.jsx)(We,{asChild:!0,...a,children:(0,U.jsx)(L.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Ln(o.value)?``:void 0,...i,ref:c,onClick:z(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:z(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:z(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Dt.includes(e.key)&&(m(),e.preventDefault())})})})});Vt.displayName=Bt;var Ht=`SelectValue`,Ut=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=K(Ht,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=I(t,c.onValueNodeChange);R(()=>{l(u)},[l,u]);let f=Ln(c.value);return(0,U.jsx)(L.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,U.jsx)(H.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Ut.displayName=Ht;var Wt=`SelectIcon`,Gt=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(L.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Gt.displayName=Wt;var Kt=`SelectPortal`,[qt,Jt]=G(Kt,{forceMount:void 0}),Yt=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,U.jsx)(qt,{scope:e.__scopeSelect,forceMount:n,children:(0,U.jsx)(Oe,{asChild:!0,...r})})};Yt.displayName=Kt;var q=`SelectContent`,Xt=H.forwardRef((e,t)=>{let n=Jt(q,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(q,e.__scopeSelect),[o,s]=H.useState();return R(()=>{s(new DocumentFragment)},[]),(0,U.jsx)(Pe,{present:r||a.open,children:({present:e})=>e?(0,U.jsx)(tn,{...i,ref:t}):(0,U.jsx)(Zt,{...i,fragment:o})})});Xt.displayName=q;var Zt=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Et.createPortal((0,U.jsx)(Qt,{scope:n,children:(0,U.jsx)(kt.Slot,{scope:n,children:(0,U.jsx)(`div`,{ref:t,children:r})})}),i):null});Zt.displayName=`SelectContentFragment`;var J=10,[Qt,Y]=G(q),$t=`SelectContentImpl`,en=xe(`SelectContent.RemoveScroll`),tn=H.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=K(q,n),[y,b]=H.useState(null),[x,ee]=H.useState(null),te=I(t,b),[S,C]=H.useState(null),[w,T]=H.useState(null),E=At(n),[D,O]=H.useState(!1),k=H.useRef(!1);H.useEffect(()=>{if(y)return Ne(y)},[y]),Me();let A=H.useCallback(e=>{let[t,...n]=E().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[E,x]),j=H.useCallback(()=>A([S,y]),[A,S,y]);H.useEffect(()=>{D&&j()},[D,j]);let{onOpenChange:M,triggerPointerDownPosRef:N}=v;H.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(N.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(N.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||M(!1),document.removeEventListener(`pointermove`,t),N.current=null};return N.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,M,N]),H.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[ne,re]=Rn(e=>{let t=E().filter(e=>!e.disabled),n=zn(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=H.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&(C(e),r&&(k.current=!0))},[v.value]),ae=H.useCallback(()=>y?.focus(),[y]),oe=H.useCallback((e,t,n)=>{let r=!k.current&&!n;(v.value!==void 0&&v.value===t||r)&&T(e)},[v.value]),se=r===`popper`?on:rn,P=se===on?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,U.jsx)(Qt,{scope:n,content:y,viewport:x,onViewportChange:ee,itemRefCallback:ie,selectedItem:S,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:j,selectedItemText:w,position:r,isPositioned:D,searchRef:ne,children:(0,U.jsx)(Ae,{as:en,allowPinchZoom:!0,children:(0,U.jsx)(Ee,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:z(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(je,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,U.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...P,onPlaced:()=>O(!0),ref:te,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:z(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=E().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>A(t)),e.preventDefault()}})})})})})})});tn.displayName=$t;var nn=`SelectItemAlignedPosition`,rn=H.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=K(q,n),o=Y(q,n),[s,c]=H.useState(null),[l,u]=H.useState(null),d=I(t,u),f=At(n),p=H.useRef(!1),m=H.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=H.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-J,d=Tt(a,[J,Math.max(J,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-J,d=Tt(a,[J,Math.max(J,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-J*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,ee=Math.min(g.offsetHeight*5,x),te=window.getComputedStyle(h),S=parseInt(te.paddingTop,10),C=parseInt(te.paddingBottom,10),w=e.top+e.height/2-J,T=c-w,E=g.offsetHeight/2,D=g.offsetTop+E,O=m+v+D,k=x-O;if(O<=w){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=O+Math.max(T,E+(e?C:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(w,m+h.offsetTop+(e?S:0)+E)+k;s.style.height=t+`px`,h.scrollTop=O-w+h.offsetTop}s.style.margin=`${J}px 0`,s.style.minHeight=ee+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);R(()=>y(),[y]);let[b,x]=H.useState();return R(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,U.jsx)(sn,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:H.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,U.jsx)(L.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});rn.displayName=nn;var an=`SelectPopperPosition`,on=H.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=J,...a}=e,o=Nt(n);return(0,U.jsx)(Ue,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});on.displayName=an;var[sn,cn]=G(q,{}),ln=`SelectViewport`,un=H.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Y(ln,n),o=cn(ln,n),s=I(t,a.onViewportChange),c=H.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,U.jsx)(kt.Slot,{scope:n,children:(0,U.jsx)(L.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:z(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-J*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});un.displayName=ln;var dn=`SelectGroup`,[fn,pn]=G(dn),mn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ke();return(0,U.jsx)(fn,{scope:n,id:i,children:(0,U.jsx)(L.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});mn.displayName=dn;var hn=`SelectLabel`,gn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=pn(hn,n);return(0,U.jsx)(L.div,{id:i.id,...r,ref:t})});gn.displayName=hn;var _n=`SelectItem`,[vn,yn]=G(_n),bn=H.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=K(_n,n),c=Y(_n,n),l=s.value===r,[u,d]=H.useState(a??``),[f,p]=H.useState(!1),m=I(t,De(e=>c.itemRefCallback?.(e,r,i))),h=ke(),g=H.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,U.jsx)(vn,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:H.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(kt.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,U.jsx)(L.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:z(o.onFocus,()=>p(!0)),onBlur:z(o.onBlur,()=>p(!1)),onClick:z(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:z(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:z(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:z(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:z(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(Ot.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});bn.displayName=_n;var xn=`SelectItemText`,Sn=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=K(xn,n),s=Y(xn,n),c=yn(xn,n),l=It(xn,n),[u,d]=H.useState(null),f=De(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=I(t,d,c.onItemTextChange,f),m=u?.textContent,h=H.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return R(()=>(g(h),()=>_(h)),[g,_,h]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(L.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Ln(o.value)?Et.createPortal(a.children,o.valueNode):null]})});Sn.displayName=xn;var Cn=`SelectItemIndicator`,wn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return yn(Cn,n).isSelected?(0,U.jsx)(L.span,{"aria-hidden":!0,...r,ref:t}):null});wn.displayName=Cn;var Tn=`SelectScrollUpButton`,En=H.forwardRef((e,t)=>{let n=Y(Tn,e.__scopeSelect),r=cn(Tn,e.__scopeSelect),[i,a]=H.useState(!1),o=I(t,r.onScrollButtonChange);return R(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(kn,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});En.displayName=Tn;var Dn=`SelectScrollDownButton`,On=H.forwardRef((e,t)=>{let n=Y(Dn,e.__scopeSelect),r=cn(Dn,e.__scopeSelect),[i,a]=H.useState(!1),o=I(t,r.onScrollButtonChange);return R(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(kn,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});On.displayName=Dn;var kn=H.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Y(`SelectScrollButton`,n),o=H.useRef(null),s=At(n),c=H.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return H.useEffect(()=>()=>c(),[c]),R(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(L.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:z(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:z(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:z(i.onPointerLeave,()=>{c()})})}),An=`SelectSeparator`,jn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,U.jsx)(L.div,{"aria-hidden":!0,...r,ref:t})});jn.displayName=An;var Mn=`SelectArrow`,Nn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Nt(n);return Y(Mn,n).position===`popper`?(0,U.jsx)(He,{...i,...r,ref:t}):null});Nn.displayName=Mn;var Pn=`SelectBubbleInput`,Fn=H.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K(Pn,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=H.useRef(null),m=I(n,p),h=i??``,g=Re(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return H.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,U.jsxs)(L.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...ye,...t.style},ref:m,defaultValue:h,children:[Ln(i)&&!_?(0,U.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});Fn.displayName=Pn;function In(e){return typeof e==`function`}function Ln(e){return e===``||e===void 0}function Rn(e){let t=De(e),n=H.useRef(``),r=H.useRef(0),i=H.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=H.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return H.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function zn(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Bn(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Bn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vn=M([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Hn=O({includeExisting:E().optional(),authors:j(w()).optional(),assignees:j(w()).optional(),requireCurrentLabels:E().optional(),allLabels:j(w()).optional(),anyLabels:j(w()).optional(),excludeLabels:j(w()).optional(),changedLabels:j(w()).optional(),lookbackDays:T(),maxRecords:T()}),Un=M([`github`,`schedule`]),Wn=S.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:w(),variants:k([D(1),D(2),D(3)]).optional(),systemPrompt:w().optional()}),Gn=O({at:w(),outcome:M([`launched`,`cancelled`]),runId:w().optional(),receiptId:w().optional(),trigger:M([`schedule`,`late`,`manual`,`retry`]).optional()}),Kn=O({id:w(),revision:T(),name:w(),description:w().optional(),enabled:E(),kind:Un,events:j(Vn).optional(),intervalSeconds:T().optional(),filters:Hn.optional(),schedule:ct.optional(),task:Wn,archived:Gn.optional(),createdAt:w(),updatedAt:w()}),qn=O({timestamp:w(),tieBreaker:w().optional()}),Jn=O({since:w().datetime(),until:w().datetime(),source:T().int().min(0).max(2),page:T().int().min(1).max(10),item:T().int().min(0).max(100),event:T().int().min(0).max(1e3),cursor:qn.optional()}),Yn={lastError:w().max(1e3).optional(),lastErrorAt:w().datetime().optional()},Xn=O({revision:T().optional(),baselineAt:w().optional(),armedAt:w().optional(),historyScan:Jn.optional(),cursor:qn.optional(),frozenHighWatermark:qn.extend({tieBreaker:w()}).optional(),backlogAfter:qn.extend({tieBreaker:w()}).optional(),nextCheckAt:w().optional(),lastSuccessAt:w().optional(),nextRunAt:w().optional(),lastRunAt:w().optional(),etags:C(w(),w()).optional(),backoffUntil:w().optional(),consecutiveFailures:T().optional(),...Yn,onceOutcome:M([`failed`,`missed`]).optional()});function Zn(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 Qn=M([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),$n=O({seq:T(),ts:w(),automationId:w(),revision:T(),event:Vn.optional(),result:Qn,reason:w().optional(),durationMs:T().optional(),receiptId:w().optional(),runId:w().optional(),githubNumber:T().optional(),githubTitle:w().optional(),githubUrl:w().optional(),rateLimit:O({bucket:M([`core`,`search`]),remaining:T().optional(),resetAt:w().optional()}).optional()}),er=O({matches:T(),launched:T(),duplicates:T(),errors:T()}),tr=Kn.extend({state:Xn.optional(),latestLog:$n.optional(),counts:er,nextRunAt:w().optional(),onceStatus:vt.optional()});O({available:E(),reason:w().optional(),timeZone:w(),scheduler:O({state:M([`scheduled`,`idle`]),nextDue:w().optional()}),automations:j(tr)}),O({automation:Kn}).extend({once:O({dueAt:w(),timeZone:w(),resolvedInstant:w(),note:w()}).optional()}),O({automation:Kn,state:Xn.optional(),latestLog:$n.optional(),onceStatus:vt.optional()}),O({id:w(),automationId:w(),mode:M([`preview`,`execute`]),status:M([`queued`,`running`,`complete`,`error`]),createdAt:w(),completedAt:w().optional(),matches:T().optional(),truncated:E().optional(),error:w().optional()}),O({checkId:w()}),O({records:j($n)}),O({receiptId:w(),runId:w()}),O({runId:w()}),Kn.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:Un.optional(),task:Wn.omit({variants:!0}).strict(),enable:E().optional()}).omit({enable:!0}).extend({enabled:E().optional(),expectedRevision:T()}),O({archived:M([`include`,`only`]).optional()}),O({mode:M([`preview`,`execute`])});function nr({...e}){return(0,U.jsx)(zt,{"data-slot":`select`,...e})}function rr({...e}){return(0,U.jsx)(Ut,{"data-slot":`select-value`,...e})}function ir({className:e,size:t=`default`,children:n,...r}){return(0,U.jsxs)(Vt,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,U.jsx)(Gt,{asChild:!0,children:(0,U.jsx)(he,{className:`size-4 opacity-50`})})]})}function ar({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,U.jsx)(Yt,{children:(0,U.jsxs)(Xt,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,U.jsx)(sr,{}),(0,U.jsx)(un,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,U.jsx)(cr,{})]})})}function or({className:e,children:t,...n}){return(0,U.jsxs)(bn,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,U.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(wn,{children:(0,U.jsx)(fe,{className:`size-4`})})}),(0,U.jsx)(Sn,{children:t})]})}function sr({className:e,...t}){return(0,U.jsx)(En,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(pe,{className:`size-4`})})}function cr({className:e,...t}){return(0,U.jsx)(On,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(he,{className:`size-4`})})}function X({title:e,subtitle:t,action:n,children:r}){return(0,U.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,U.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function Z({text:e}){return(0,U.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var lr={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`neutral`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},ur={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 dr(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>l(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)(()=>_(a),[a]),(0,H.useEffect)(()=>se((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function fr(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 pr({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&fr(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 b(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,U.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(rt,{dot:lr[e.result],children:ur[e.result]}),(0,U.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:gt(e.ts,n,u)})]}),e.reason?(0,U.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,U.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,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,U.jsx)(F,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,U.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var mr=`all`;function hr({label:e,value:t,onChange:n,options:r}){return(0,U.jsxs)(nr,{value:t,onValueChange:n,children:[(0,U.jsx)(ir,{"aria-label":e,className:`w-full sm:w-52`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:r.map(e=>(0,U.jsx)(or,{value:e.value,children:e.label},e.value))})]})}function gr({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=dr(e),[s,c]=(0,H.useState)(mr),[l,u]=(0,H.useState)(mr),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===mr||e.result===s)&&(l===mr||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,U.jsx)(X,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})}),children:a&&!i?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:a}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,U.jsx)(Z,{text:`Nothing has run yet.`}):(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(hr,{label:`Result`,value:s,onChange:c,options:[{value:mr,label:`All results`},...Qn.options.map(e=>({value:e,label:ur[e]}))]}),f?(0,U.jsx)(hr,{label:`Event`,value:l,onChange:u,options:[{value:mr,label:`All events`},...Vn.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,U.jsx)(Z,{text:`No rows match these filters.`}):(0,U.jsx)(pr,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,U.jsx)(Z,{text:`Loading execution log…`})})}function _r({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=dr(e);return(0,U.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,U.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),o&&!a?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,U.jsx)(Z,{text:o}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?a.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,U.jsx)(pr,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading activity…`})]})}function vr({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,o=i?yt(i):null,[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(``),p=(0,H.useRef)(null),m=(0,H.useRef)(null),h=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=h.current===`keep`?m.current:h.current===`delete`?p.current:null;h.current=null,e?.focus()},[s]);let g=async()=>{u(!0);try{await a(e.id),n()}catch(e){f(e instanceof Error?e.message:String(e)),u(!1)}},_=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,U.jsx)(X,{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`,children:(0,U.jsxs)(`div`,{className:`grid min-w-0 max-w-3xl gap-5`,children:[(0,U.jsxs)(`section`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,U.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${xt(r.at,t)} (${t}).`}),o&&i?.timeZone?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${o.date} ${o.time} (${i.timeZone}).`}):null]}),(0,U.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,U.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,U.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),_.filter(([,e])=>e).map(([e,t])=>(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,U.jsxs)(`section`,{className:`min-w-0`,children:[(0,U.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,U.jsx)(B,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:l,onClick:()=>void g(),children:`Delete schedule`}),(0,U.jsx)(F,{ref:m,variant:`outline`,disabled:l,onClick:()=>{h.current=`delete`,c(!1)},children:`Keep`})]})]}):(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{ref:p,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{h.current=`keep`,c(!0)},children:`Delete`}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})})]}),d?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:d}):null]})]})})}var yr=M([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),br=j(w().trim().min(1).max(200)).max(100).optional(),xr=O({includeExisting:E().optional(),requireCurrentLabels:E().optional(),authors:br,assignees:br,allLabels:br,anyLabels:br,excludeLabels:br,changedLabels:br,lookbackDays:T().int().min(1).max(90).default(7),maxRecords:T().int().min(1).max(100).default(25)}).passthrough(),Sr=O({prompt:w().min(1).max(1e5),workflow:w().trim().min(1).max(200).optional(),steps:j(m).min(1).max(100).optional(),runner:u.optional(),model:w().trim().min(1).max(200).optional(),effort:w().trim().min(1).max(32).optional(),variants:k([D(1),D(2),D(3)]).optional(),worktree:E().optional(),autonomous:E().optional(),...s,...y,systemPrompt:w().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Cr=new Set(Object.keys(Sr.shape).filter(e=>e!==`variants`));function wr(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Cr.has(e)))}N(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??{}}},O({id:w().min(1).max(100),revision:T().int().positive(),name:w().trim().min(1).max(200),description:w().max(2e3).optional(),enabled:E().default(!1),kind:Un.default(`github`),events:j(yr).min(1).max(4).optional(),intervalSeconds:T().int().min(60).max(86400).optional(),filters:xr.optional(),schedule:ct.passthrough().optional(),task:Sr,archived:O({at:w().datetime(),outcome:M([`launched`,`cancelled`]),runId:w().optional(),receiptId:w().optional(),trigger:M([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:w().datetime(),updatedAt:w().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:f.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:f.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:f.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:f.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:f.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),O({version:D(1).default(1),automations:j(A()).default([]),tombstones:C(w(),w().datetime()).optional()}).passthrough();var Tr=O({timestamp:w().datetime(),tieBreaker:w().optional()}).passthrough(),Er=Jn.extend({cursor:Tr.optional()}),Dr=O({revision:T().int().positive().optional(),baselineAt:w().datetime().optional(),armedAt:w().datetime().optional(),historyScan:Er.optional(),cursor:Tr.optional(),frozenHighWatermark:Tr.extend({tieBreaker:w()}).optional(),backlogAfter:Tr.extend({tieBreaker:w()}).optional(),nextCheckAt:w().datetime().optional(),lastSuccessAt:w().datetime().optional(),nextRunAt:w().datetime().optional(),lastRunAt:w().datetime().optional(),etags:C(w(),w()).optional(),backoffUntil:w().datetime().optional(),consecutiveFailures:T().int().nonnegative().optional(),...Yn,onceOutcome:M([`failed`,`missed`]).optional()}).passthrough();O({version:D(1).default(1),states:C(w(),Dr).default({})}).passthrough(),O({receiptId:w().min(1),receiptKey:w().min(1),eventId:w().min(1),automationId:w().min(1),revision:T().int().positive(),status:M([`reserved`,`launched`,`launch-error`,`released`]),runId:w().optional(),observedAt:w().datetime(),updatedAt:w().datetime(),error:w().max(2e3).optional(),occurrenceAt:w().datetime().optional(),candidate:O({eventId:w(),event:yr,timestamp:w().datetime(),tieBreaker:w(),repo:w(),nodeId:w(),number:T().int().positive(),title:w().max(500),url:w().url(),author:w().max(200),assignees:j(w().max(200)).max(100),labels:j(w().max(200)).max(100),changedLabel:w().max(200).optional()}).passthrough().optional()}).passthrough();var Or=M([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);O({seq:T().int().positive(),ts:w().datetime(),automationId:w().min(1),revision:T().int().positive(),event:yr.optional(),result:Or,reason:w().max(2e3).optional(),durationMs:T().int().nonnegative().optional(),receiptId:w().optional(),runId:w().optional(),githubNumber:T().int().positive().optional(),githubTitle:w().max(500).optional(),githubUrl:w().url().optional(),rateLimit:O({bucket:M([`core`,`search`]),remaining:T().int().nonnegative().optional(),resetAt:w().datetime().optional()}).passthrough().optional()}).passthrough();var kr=`quick-task`;function Ar(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=wr(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:St(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:kr}:{}:{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 jr(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 Mr(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 Nr(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:jr(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Mr(e)}}function Pr(e){return{...Nr(e),enable:e.enabled}}function Fr(e,t){return{...Nr(e),task:{...Mr(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Q(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Ir=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Lr=new Set([`anyLabels`,`authors`,`changedLabels`]);function Rr(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=>!Ir.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||Lr.has(e)&&Array.isArray(t)&&t.length>0)}function zr(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function Br(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function $(e,t){return t.startsWith(`-`)?`--${e}=${Q(t)}`:`--${e} ${Q(t)}`}function Vr(e){let t=[`${et()} automation add`,$(`name`,e.name)];if(e.schedule?.type===`once`)t.push($(`at`,e.schedule.at),$(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push($(`latest-start`,Br(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push($(`cron`,mt(e.schedule)));else{t.push($(`on`,e.events.join(`,`)),`--every ${zr(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push($(`label`,n));for(let n of e.filters?.authors??[])t.push($(`author`,n));for(let n of e.filters?.changedLabels??[])t.push($(`changed-label`,n))}return t.push(...Hr(e.task)),e.enable===!0&&t.push(`--enable`),t.push($(`prompt`,e.task.prompt)),t.join(` `)}function Hr(e){let t=[];return e.workflow&&t.push($(`workflow`,e.workflow)),e.runner&&t.push($(`runner`,e.runner)),e.model&&t.push($(`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 Ur(e,t){let n=Pr(e),r=Rr(n)?Vr(n):`${et()} automation create --json ${Q(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Q(t.origin)} CEZ_PROJECT_ID=${Q(t.projectId)} HSQ_COCKPIT_URL=${Q(t.origin)} HSQ_PROJECT_ID=${Q(t.projectId)} ${r}`:r}function Wr({draft:e}){let t=Ke(),n=window.location.origin,r=(0,H.useMemo)(()=>Ur(e,t?{origin:n,projectId:t}:void 0),[e,n,t]),[i,a]=(0,H.useState)(`idle`),o=(0,H.useRef)(void 0);(0,H.useEffect)(()=>()=>clearTimeout(o.current),[]),(0,H.useEffect)(()=>a(`idle`),[r]);let s=async()=>{clearTimeout(o.current);try{await navigator.clipboard.writeText(r),a(`copied`),o.current=setTimeout(()=>a(`idle`),1600)}catch{a(`failed`)}};return(0,U.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`mbs-4 rounded-xl border bg-card p-4`,children:[(0,U.jsxs)(`div`,{className:`mbe-2 flex items-center gap-2`,children:[(0,U.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[15px] font-medium`,children:`Copy as CLI`}),(0,U.jsxs)(F,{type:`button`,variant:`ghost`,size:`sm`,className:`ms-auto`,onClick:()=>void s(),children:[i===`copied`?(0,U.jsx)(be,{"aria-hidden":`true`}):(0,U.jsx)(Ze,{"aria-hidden":`true`}),i===`copied`?`Copied`:`Copy`]})]}),(0,U.jsx)(`pre`,{className:`m-0 rounded-lg border bg-muted px-2.5 py-2 font-mono text-xs/relaxed break-words whitespace-pre-wrap text-muted-foreground`,children:r}),(0,U.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:i===`failed`?`Could not copy — select the line and copy it by hand.`:(0,U.jsxs)(U.Fragment,{children:[`The definition Save would create. `,(0,U.jsxs)(`code`,{children:[et(),` automation schema`]}),` prints its shape.`]})})]})}function Gr({pressed:e,onClick:t,disabled:n,children:r}){return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:i(Qe,`h-11 px-4 text-[13px]`,e&&`border-transparent bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong hover:text-accent-strong-foreground`),children:r})}var Kr=Vn.options,qr=[{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`}],Jr=[{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.`}],Yr=e=>(e??[]).join(`, `),Xr=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function Zr(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 Qr(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`}. ${Zr(e.filters.includeExisting)}`}function $r({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=Xr(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=qr.some(t=>t.seconds===e.intervalSeconds)?qr:[...qr,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,U.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,U.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:Kr.map(t=>(0,U.jsx)(Gr,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-interval`,children:`Check every`}),(0,U.jsxs)(nr,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,U.jsx)(ir,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:o.map(e=>(0,U.jsx)(or,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(ze,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,U.jsx)(`span`,{children:`Include existing items`})]}),(0,U.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:Zr(e.filters.includeExisting)})]}),(0,U.jsxs)(Le,{children:[(0,U.jsxs)(Ie,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,U.jsx)(he,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,U.jsx)(Fe,{children:(0,U.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[Jr.map(t=>(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,U.jsx)(V,{id:`automation-filter-${t.key}`,placeholder:`comma separated`,value:Yr(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,U.jsx)(V,{id:`automation-filter-lookback`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,U.jsx)(V,{id:`automation-filter-max`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var ei=e=>String(e).padStart(2,`0`);function ti({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,H.useState)(ei(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${ei(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(V,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 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(ei(t))}),s?(0,U.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var ni=[{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`}],ri=`none`,ii=e=>String(e).padStart(2,`0`);function ai(e,t=Date.now()){let n=Ct(t,e)??Ct(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${ii(r.getUTCMonth()+1)}-${ii(r.getUTCDate())}T09:00`}function oi(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function si({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?ht(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${ii(t)}:${ii(n)}`}),l=(0,H.useRef)(null),u=(0,H.useId)(),d=ut(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?st:``)},[f]);let p=yt(e);return(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-date`,children:`Date`}),(0,U.jsx)(V,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full`,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,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,U.jsx)(ti,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,U.jsx)(ti,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,U.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:st}):null,(0,U.jsx)(li,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,U.jsx)(ui,{value:e.latestStartMinutes,onChange:t=>n(ci(e,t))}),p?(0,U.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 ci(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function li({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)(oi),c=n!==e||!ot(n),l=dt(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,U.jsx)(V,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),ot(e.target.value)&&t(e.target.value)}}),(0,U.jsx)(`datalist`,{id:a,children:s.map(e=>(0,U.jsx)(`option`,{value:e},e))}),c?(0,U.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function ui({value:e,onChange:t}){let n=ni.some(t=>t.minutes===e)||e===void 0?ni:[...ni,{minutes:e,label:`${e} minutes`}];return(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,U.jsxs)(nr,{value:e===void 0?ri:String(e),onValueChange:e=>t(e===ri?void 0:Number(e)),children:[(0,U.jsx)(ir,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:n.map(e=>(0,U.jsx)(or,{value:e.minutes===void 0?ri:String(e.minutes),children:e.label},e.label))})]}),(0,U.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 di=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function fi({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??ai(r),timeZone:e.timeZone??r}:{type:t});return(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:di.map(t=>(0,U.jsx)(Gr,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,U.jsx)(si,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,U.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:bt.map((t,n)=>(0,U.jsx)(Gr,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-every`,children:`Run every`}),(0,U.jsxs)(nr,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,U.jsx)(ir,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,U.jsx)(rr,{})}),(0,U.jsx)(ar,{children:_t.map(e=>(0,U.jsx)(or,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,U.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,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,U.jsx)(ti,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,U.jsx)(ti,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,U.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,U.jsx)(`code`,{className:`font-mono text-foreground`,children:mt(e)})]})]})}var pi=40*864e5,mi=5;function hi({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,U.jsx)(gi,{schedule:e,now:n});let r=lt(e,n+1,n+pi,t,mi);return(0,U.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,U.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,U.jsx)(`span`,{className:`font-medium tabular-nums`,children:xt(new Date(e).toISOString(),t)}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:pt(n,e)})]},e))}),(0,U.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function gi({schedule:e,now:t}){let n=ut(e),r=yt(e);return(0,U.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Runs once`}),n===null||!r?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,U.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:pt(t,n)}):null]}),r?.note?(0,U.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,U.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,U.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 _i={schedule:`On a schedule`,github:`When GitHub changes`};function vi(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/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 yi({title:e,failure:t,section:n,children:r}){return(0,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,U.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:t.message}):null]})}function bi({draft:e,patch:t,forge:n,automation:r}){return(0,U.jsx)(U.Fragment,{children:r?(0,U.jsxs)(`p`,{className:`text-sm`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),_i[e.kind]]}):(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,U.jsx)(it,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:_i.schedule},{value:`github`,label:_i.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function xi({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,U.jsx)(fi,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,U.jsx)($r,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Si({draft:e,patch:t,saving:n,automation:r}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,U.jsx)(wt,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:4,required:!0}),(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,U.jsxs)(U.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,U.jsxs)(U.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,U.jsx)(Ti,{draft:e,patch:t}),(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(ze,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,U.jsxs)(`span`,{children:[`Autonomous `,(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,U.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,U.jsx)(tt,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,U.jsx)(Xe,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Ci({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,U.jsx)(ze,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,U.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,U.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:Zr(e.filters.includeExisting)})]})}function wi({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[o,s]=(0,H.useState)(()=>Ar(e)),[c,l]=(0,H.useState)(e?.revision),[u,d]=(0,H.useState)(),[f,p]=(0,H.useState)(!1),[m,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(!1),[b,x]=(0,H.useState)(``),S=e=>s(t=>({...t,...e})),C=async t=>{if(t.preventDefault(),f)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}p(!0),d(void 0);let i=`save`;try{if(e&&c!==void 0){let{automation:t}=await ee(e.id,Fr({...o,enabled:e.enabled},c));l(t.revision),o.enabled!==e.enabled&&(i=`enable`,await h(e.id,o.enabled))}else await te(Pr(o));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof g&&t.status===409&&/revision conflict/i.test(n)?d({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):d({section:i===`enable`?`enable`:vi(n),message:n})}finally{p(!1)}},w=async()=>{if(!(!e||v)){y(!0),x(``);try{await a(e.id),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}},T=e?`Save changes`:o.enabled?`Save and enable`:`Save paused`,E=o.kind===`schedule`;return(0,U.jsx)(X,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,U.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:C,children:[(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,U.jsx)(yi,{title:`Name`,section:`name`,failure:u,children:(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(P,{htmlFor:`automation-name`,children:`Name`}),(0,U.jsx)(V,{id:`automation-name`,value:o.name,onChange:e=>S({name:e.target.value}),required:!0})]})}),(0,U.jsxs)(yi,{title:`When`,section:`when`,failure:u,children:[(0,U.jsx)(bi,{draft:o,patch:S,forge:t,automation:e}),(0,U.jsx)(xi,{draft:o,patch:S,forge:t,timeZone:n,automation:e})]}),(0,U.jsx)(yi,{title:`What to run`,section:`run`,failure:u,children:(0,U.jsx)(Si,{draft:o,patch:S,saving:f,automation:e})}),(0,U.jsx)(yi,{title:`Enable`,section:`enable`,failure:u,children:(0,U.jsx)(Ci,{draft:o,patch:S,automation:e})}),u?.section===`form`?(0,U.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,U.jsx)(`span`,{className:`break-words`,children:u.message}),u.conflict&&i?(0,U.jsx)(F,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{type:`submit`,disabled:f,children:f?`Saving…`:T}),(0,U.jsx)(F,{type:`button`,variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations`,children:`Cancel`})})]}),e?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:v,onClick:()=>void w(),children:`Delete automation`}),(0,U.jsx)(F,{type:`button`,variant:`outline`,disabled:v,onClick:()=>{_(!1),x(``)},children:`Keep`})]})]}):(0,U.jsx)(F,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>_(!0),children:`Delete`}),b?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:b}):null]}):null]}),(0,U.jsxs)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:[E?(0,U.jsx)(hi,{schedule:o.schedule,timeZone:n}):(0,U.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,U.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:Qr(o)})]}),(0,U.jsx)(Wr,{draft:o})]})]})})}function Ti({draft:e,patch:t}){let n=ie(),r=re(),i=ae(),a=le(),s=e.runner??i.data?.defaultRunner??`claude`,c=ne(s),l=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],u=[...new Set([...o(r.data,a.data),...e.runner?[e.runner]:[]])],d=Ye(s,a.data,c.data,[e.model]),f=d.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,p=e=>(0,U.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,U.jsx)(nt,{children:(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(Je,{slot:`automation-workflow-pill`,icon:p(_e),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:l.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,U.jsx)(Je,{slot:`automation-runner-pill`,icon:p(me),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner??`default`,value:e.runner??``,disabled:!a.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...u.map(e=>({value:e,label:ce(a.data,e)}))],onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,U.jsx)(Je,{slot:`automation-model-pill`,icon:p(ve),fieldLabel:!0,ariaLabel:`Model`,label:f,value:e.model??``,options:d.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Ei({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,H.useState)({}),[s,l]=(0,H.useState)({}),u=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),d=async(e,t)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){u(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},f=e=>d(e.id,async()=>{u(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await p(e.id);u(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),m=e=>d(e.id,async()=>{u(e.id,void 0),await h(e.id,!e.enabled),await n()}),g=e=>d(e.id,async()=>{u(e.id,void 0),await x(e.id),await n()}),_=e=>d(e.id,async()=>{u(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await v(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await c(t);if(r.status===`complete`){u(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`)throw Error(r.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)});return(0,U.jsx)(X,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,action:(0,U.jsx)(F,{asChild:!0,children:(0,U.jsx)(B,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:t}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Di,{data:e}),i?(0,U.jsx)(`div`,{className:`mb-4 flex flex-wrap gap-2`,children:(0,U.jsx)(Gr,{pressed:r,onClick:()=>i(!r),children:`Archived`})}):null,r&&e.automations.length===0?(0,U.jsx)(Z,{text:`No archived one-time schedules.`}):e.automations.length===0?(0,U.jsx)(qe,{icon:(0,U.jsx)(ge,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,U.jsx)(F,{asChild:!0,children:(0,U.jsx)(B,{to:`/automations/new`,children:`New automation`})})}):(0,U.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,U.jsx)(Ri,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:s[t.id]===!0,onRun:()=>void f(t),onToggle:()=>void m(t),onPreview:()=>void _(t),onCancel:()=>void g(t)},t.id))})]}):(0,U.jsx)(Z,{text:`Loading automations…`})})}function Di({data:e}){return(0,U.jsx)(`p`,{"data-slot":`automation-scheduler`,className:i(`mb-4 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 Oi(e){return e.kind===`schedule`&&e.schedule?ft(e.schedule):`on ${(e.events??[]).join(`, `)} · every ${Math.round((e.intervalSeconds??300)/60)} min`}var ki={waiting:{label:`Waiting`,dot:`success`},paused:{label:`Paused`,dot:`neutral`},failed:{label:`Failed`,dot:`danger`},missed:{label:`Missed`,dot:`pending`},archived:{label:`Archived`,dot:`neutral`}};function Ai(e){if(e.schedule?.type===`once`)return ki[e.onceStatus??(e.enabled?`waiting`:`paused`)]}function ji({automation:e,badge:t}){return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,U.jsx)(e.kind===`schedule`?de:ue,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,U.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:Oi(e)})]}),t?(0,U.jsx)(rt,{dot:t.dot,children:t.label}):(0,U.jsx)(rt,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]})}function Mi({automation:e,archive:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`mt-3 text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,U.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}`,children:`Details`})})})]})}function Ni({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return(0,U.jsx)(`p`,{className:`mt-3 text-sm`,children:!n&&e.enabled?(0,U.jsx)(`span`,{children:`continuous`}):r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:`Next run: ${xt(r,t)}`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${pt(Date.now(),Date.parse(r))}`})]}):(0,U.jsx)(`span`,{children:`Next run: —`})})}function Pi({automation:e,timeZone:t}){let n=e.enabled?Zn(e.state):void 0;return n?(0,U.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`mt-3 text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${xt(n.retryAt,t)}`}):null]}):null}function Fi({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,U.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}`,children:`Edit`})}),(0,U.jsx)(F,{variant:`outline`,asChild:!0,children:(0,U.jsx)(B,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,U.jsx)(F,{variant:`outline`,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),l&&!n?(0,U.jsx)(F,{variant:`outline`,ref:r,"data-action":`automation-cancel`,disabled:t,onClick:s,children:`Cancel`}):null]})}function Ii({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,U.jsxs)(`div`,{className:`mt-3 grid justify-items-start gap-2`,children:[(0,U.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(F,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,U.jsx)(F,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function Li({note:e}){return(0,U.jsxs)(`p`,{role:e.tone===`error`?`alert`:`status`,className:i(`mt-3 text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.runId?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(B,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function Ri({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,U.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,U.jsx)(ji,{automation:e,badge:Ai(e)}),h?(0,U.jsx)(Mi,{automation:e,archive:h}):null,h?null:(0,U.jsx)(Ni,{automation:e,timeZone:t}),h?null:(0,U.jsx)(Pi,{automation:e,timeZone:t}),h?null:(0,U.jsx)(Fi,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,U.jsx)(Ii,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,U.jsx)(Li,{note:n}):null,(0,U.jsx)(_r,{automationId:e.id,automationName:e.name,timeZone:t})]})}function zi(e){let t=Ke(),n=$e(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.useCallback)(t=>d({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)(()=>_(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>se((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 Bi({mode:e=`list`}){let{automationId:t}=oe(),n=Ge(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=zi(e===`list`?r?`only`:void 0:`include`),[c,l]=(0,H.useState)(0),u=at();if(u===`unknown`)return(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Z,{text:`Loading automations…`})});if(u===`unavailable`)return(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(qe,{icon:(0,U.jsx)(ge,{}),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,U.jsx)(Ei,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,U.jsx)(X,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,U.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,U.jsx)(Z,{text:o}),(0,U.jsx)(F,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,U.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(Z,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,U.jsx)(wi,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,U.jsx)(vr,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,U.jsx)(wi,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,U.jsx)(X,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,U.jsx)(F,{asChild:!0,variant:`outline`,children:(0,U.jsx)(B,{to:`/automations`,children:`Back to automations`})})}):t?(0,U.jsx)(gr,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,U.jsx)(Z,{text:`Automation not found.`})}export{Bi as AutomationsRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{t as n}from"./utils-DSMR_WLb.js";import{r}from"./button-BQ2y4XRB.js";import{t as i}from"./dist-BW234Kg5.js";e();var a=t(),o=r(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-accent-strong text-accent-strong-foreground [a&]:hover:bg-accent-strong/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-link-foreground underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function s({className:e,variant:t=`default`,asChild:r=!1,...s}){return(0,a.jsx)(r?i:`span`,{"data-slot":`badge`,"data-variant":t,className:n(o({variant:t}),e),...s})}export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-BHp8sXmF.js";var t=e(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]);export{t};
|