@spencerboucher/switchyard 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/bridge/pi-model.js +12 -0
- package/dist/bridge/switchyard-terminal.js +66 -1
- package/dist/switchyard.mjs +7442 -5422
- package/dist/terminal/holder.js +76 -4
- package/package.json +1 -1
- package/web-dist/assets/AutomationView-CrKqim2i.js +2 -0
- package/web-dist/assets/{AutomationView-D7Syv1En.js.map → AutomationView-CrKqim2i.js.map} +1 -1
- package/web-dist/assets/Card-XMb6DfZU.js +2 -0
- package/web-dist/assets/Card-XMb6DfZU.js.map +1 -0
- package/web-dist/assets/Checkbox-CeUPbVi7.js +2 -0
- package/web-dist/assets/Checkbox-CeUPbVi7.js.map +1 -0
- package/web-dist/assets/Copy-CGnl0Vga.js +2 -0
- package/web-dist/assets/{Copy-B6XSAIUd.js.map → Copy-CGnl0Vga.js.map} +1 -1
- package/web-dist/assets/DangerZone-og55TRug.js +2 -0
- package/web-dist/assets/DangerZone-og55TRug.js.map +1 -0
- package/web-dist/assets/Field-DVurWE-E.js +2 -0
- package/web-dist/assets/Field-DVurWE-E.js.map +1 -0
- package/web-dist/assets/{InteractionCard-DF1EcSpm.js → InteractionCard-1ePc4XOF.js} +4 -4
- package/web-dist/assets/{InteractionCard-DF1EcSpm.js.map → InteractionCard-1ePc4XOF.js.map} +1 -1
- package/web-dist/assets/Menu-CYZQ97c0.js +2 -0
- package/web-dist/assets/Menu-CYZQ97c0.js.map +1 -0
- package/web-dist/assets/Overlay-DlLhg1cK.js +2 -0
- package/web-dist/assets/Overlay-DlLhg1cK.js.map +1 -0
- package/web-dist/assets/Priority-BCHLJqWN.js +2 -0
- package/web-dist/assets/{Priority-CHmzfoHg.js.map → Priority-BCHLJqWN.js.map} +1 -1
- package/web-dist/assets/{SegmentedControl-C_hEVQMB.js → SegmentedControl-CSO0EMTX.js} +2 -2
- package/web-dist/assets/{SegmentedControl-C_hEVQMB.js.map → SegmentedControl-CSO0EMTX.js.map} +1 -1
- package/web-dist/assets/{Select-Cfql4Nwu.js → Select-Dgmnmpz3.js} +2 -2
- package/web-dist/assets/{Select-Cfql4Nwu.js.map → Select-Dgmnmpz3.js.map} +1 -1
- package/web-dist/assets/{Switch-DBfzmqkm.js → Switch-DS4NRENd.js} +2 -2
- package/web-dist/assets/{Switch-DBfzmqkm.js.map → Switch-DS4NRENd.js.map} +1 -1
- package/web-dist/assets/{Tabs-BNuL3_Et.js → Tabs-9xp-tGja.js} +4 -4
- package/web-dist/assets/{Tabs-BNuL3_Et.js.map → Tabs-9xp-tGja.js.map} +1 -1
- package/web-dist/assets/{TextArea-CKybrQyn.js → TextArea-PfVKaz29.js} +2 -2
- package/web-dist/assets/{TextArea-CKybrQyn.js.map → TextArea-PfVKaz29.js.map} +1 -1
- package/web-dist/assets/{TextLink-OzzyP2-p.js → TextLink-CYqiAUlK.js} +2 -2
- package/web-dist/assets/{TextLink-OzzyP2-p.js.map → TextLink-CYqiAUlK.js.map} +1 -1
- package/web-dist/assets/attention-CTkX5JXq.js +2 -0
- package/web-dist/assets/attention-CTkX5JXq.js.map +1 -0
- package/web-dist/assets/automations-CsdtA3xp.js +2 -0
- package/web-dist/assets/{automations-Cw5Gacgm.js.map → automations-CsdtA3xp.js.map} +1 -1
- package/web-dist/assets/board-CJL75uGb.js +10 -0
- package/web-dist/assets/board-CJL75uGb.js.map +1 -0
- package/web-dist/assets/code-B1njb2Cr.css +1 -0
- package/web-dist/assets/code-CEYPZt-J.js +21 -0
- package/web-dist/assets/code-CEYPZt-J.js.map +1 -0
- package/web-dist/assets/{describe-D6KLGKWa.js → describe-DjRsBpcB.js} +3 -3
- package/web-dist/assets/{describe-D6KLGKWa.js.map → describe-DjRsBpcB.js.map} +1 -1
- package/web-dist/assets/enroll-DcEYGgoX.js +2 -0
- package/web-dist/assets/{enroll-DwT7AcuS.js.map → enroll-DcEYGgoX.js.map} +1 -1
- package/web-dist/assets/index-BeJqGnFE.css +2 -0
- package/web-dist/assets/index-DSJZdQ79.js +11 -0
- package/web-dist/assets/index-DSJZdQ79.js.map +1 -0
- package/web-dist/assets/more-BQSa_-H6.js +2 -0
- package/web-dist/assets/{more-DQR5uu1c.js.map → more-BQSa_-H6.js.map} +1 -1
- package/web-dist/assets/plus-BLP-wIYD.js +2 -0
- package/web-dist/assets/plus-BLP-wIYD.js.map +1 -0
- package/web-dist/assets/preload-helper-Huh16h6r.js +13 -0
- package/web-dist/assets/preload-helper-Huh16h6r.js.map +1 -0
- package/web-dist/assets/queue-CCjBjQhT.js +2 -0
- package/web-dist/assets/{queue-DUg1rS8t.js.map → queue-CCjBjQhT.js.map} +1 -1
- package/web-dist/assets/repo-pkFfpra6.js +2 -0
- package/web-dist/assets/repo-pkFfpra6.js.map +1 -0
- package/web-dist/assets/settings-vrxspmWN.js +7 -0
- package/web-dist/assets/settings-vrxspmWN.js.map +1 -0
- package/web-dist/assets/shared-Bm6Rhfqw.js +3 -0
- package/web-dist/assets/shared-Bm6Rhfqw.js.map +1 -0
- package/web-dist/assets/states-BQxrRFdh.js +56 -0
- package/web-dist/assets/states-BQxrRFdh.js.map +1 -0
- package/web-dist/assets/{terminal-login-S5CAd5xA.js → terminal-login-D9enO0EH.js} +2 -2
- package/web-dist/assets/{terminal-login-S5CAd5xA.js.map → terminal-login-D9enO0EH.js.map} +1 -1
- package/web-dist/assets/timer-BCIucSXh.js +2 -0
- package/web-dist/assets/timer-BCIucSXh.js.map +1 -0
- package/web-dist/assets/useBreakpoint-LY_qlpRG.js +2 -0
- package/web-dist/assets/useBreakpoint-LY_qlpRG.js.map +1 -0
- package/web-dist/assets/useNow-BUvGqrfn.js +2 -0
- package/web-dist/assets/{useNow-Dj7oEiwn.js.map → useNow-BUvGqrfn.js.map} +1 -1
- package/web-dist/assets/{useResource-CDGSq2At.js → useResource-Dul6MTDM.js} +2 -2
- package/web-dist/assets/{useResource-CDGSq2At.js.map → useResource-Dul6MTDM.js.map} +1 -1
- package/web-dist/index.html +10 -3
- package/web-dist/sw.js +1 -1
- package/web-dist/sw.js.map +1 -1
- package/web-dist/assets/AutomationView-D7Syv1En.js +0 -2
- package/web-dist/assets/Checkbox-D6tRfEeI.js +0 -2
- package/web-dist/assets/Checkbox-D6tRfEeI.js.map +0 -1
- package/web-dist/assets/Copy-B6XSAIUd.js +0 -2
- package/web-dist/assets/DangerZone-DfYlxDC1.js +0 -2
- package/web-dist/assets/DangerZone-DfYlxDC1.js.map +0 -1
- package/web-dist/assets/Field-D-Ty7fKT.js +0 -2
- package/web-dist/assets/Field-D-Ty7fKT.js.map +0 -1
- package/web-dist/assets/Menu-BfOszNC4.js +0 -2
- package/web-dist/assets/Menu-BfOszNC4.js.map +0 -1
- package/web-dist/assets/Overlay-DUQwh6_b.js +0 -2
- package/web-dist/assets/Overlay-DUQwh6_b.js.map +0 -1
- package/web-dist/assets/Priority-CHmzfoHg.js +0 -2
- package/web-dist/assets/attention-V86Gye3I.js +0 -2
- package/web-dist/assets/attention-V86Gye3I.js.map +0 -1
- package/web-dist/assets/automations-Cw5Gacgm.js +0 -2
- package/web-dist/assets/board-B8X7TYYR.js +0 -10
- package/web-dist/assets/board-B8X7TYYR.js.map +0 -1
- package/web-dist/assets/code-BKroYJmR.js +0 -12
- package/web-dist/assets/code-BKroYJmR.js.map +0 -1
- package/web-dist/assets/enroll-DwT7AcuS.js +0 -2
- package/web-dist/assets/index-B3F7WcYf.css +0 -2
- package/web-dist/assets/index-hxvDvCS7.js +0 -12
- package/web-dist/assets/index-hxvDvCS7.js.map +0 -1
- package/web-dist/assets/more-DQR5uu1c.js +0 -2
- package/web-dist/assets/queue-DUg1rS8t.js +0 -2
- package/web-dist/assets/repo-XzzzEI0d.js +0 -2
- package/web-dist/assets/repo-XzzzEI0d.js.map +0 -1
- package/web-dist/assets/search-C6cn5WOo.js +0 -2
- package/web-dist/assets/search-C6cn5WOo.js.map +0 -1
- package/web-dist/assets/server-BqZ-w6M8.js +0 -2
- package/web-dist/assets/server-BqZ-w6M8.js.map +0 -1
- package/web-dist/assets/settings-DyUu0tJM.js +0 -8
- package/web-dist/assets/settings-DyUu0tJM.js.map +0 -1
- package/web-dist/assets/states-ZhrxQa3K.js +0 -56
- package/web-dist/assets/states-ZhrxQa3K.js.map +0 -1
- package/web-dist/assets/useBackTo-BIrCq3W2.js +0 -2
- package/web-dist/assets/useBackTo-BIrCq3W2.js.map +0 -1
- package/web-dist/assets/useNow-Dj7oEiwn.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,f as t,i as n,m as r,n as i,p as a,t as o,u as s}from"./jsx-runtime-D13aM9HY.js";import{A as c,P as l,_ as u,_t as ee,bt as d,c as f,d as p,gt as m,h,ht as te,i as ne,it as g,n as _,nt as re,r as v,s as ie,t as y,u as b,v as x,vt as ae,yt as oe,z as S}from"./states-ZhrxQa3K.js";import{a as se,i as ce,n as le,t as C}from"./Field-D-Ty7fKT.js";import{t as w}from"./calendar-clock-B8zE4JsX.js";import{n as T,r as E}from"./Copy-B6XSAIUd.js";import{n as D,r as O,t as ue}from"./Priority-CHmzfoHg.js";import{t as de}from"./key-round-VDbE9E4X.js";import{t as fe}from"./play-CjoDg3ws.js";import{i as pe,n as me,r as he}from"./useBackTo-BIrCq3W2.js";import{n as k,r as ge,t as _e}from"./DangerZone-DfYlxDC1.js";import{J as ve,M as ye,T as be,V as xe,X as A,Y as Se,b as j,j as Ce,m as we,z as M}from"./index-hxvDvCS7.js";import{o as Te,t as Ee}from"./Overlay-DUQwh6_b.js";import{n as N,r as P}from"./TextArea-CKybrQyn.js";import{t as F}from"./TextLink-OzzyP2-p.js";import{t as I}from"./SegmentedControl-C_hEVQMB.js";import{t as L}from"./Select-Cfql4Nwu.js";import{t as R}from"./Switch-DBfzmqkm.js";import{E as z,O as De,S as Oe,T as B,a as V,b as ke,d as Ae,f as H,g as je,h as U,i as W,l as G,m as Me,n as Ne,o as Pe,p as K,r as Fe,s as Ie,t as Le,u as Re,v as ze,w as q,x as Be,y as Ve}from"./describe-D6KLGKWa.js";var J={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};J.node;var He=i(J),Y=e(r(),1),X=o(),Ue=e=>`/tasks/${encodeURIComponent(e)}`;function Z(e){return d(e)&&(e.status===404||e.status===405||e.status===501)}function We({summary:e,errorCount:t}){return(0,X.jsxs)(k,{stack:!0,title:`Summary`,testId:`automation-summary`,children:[(0,X.jsx)(`p`,{className:`text-sm break-words`,children:e}),t>0&&(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm text-danger`,children:[(0,X.jsx)(x,{"aria-hidden":!0,className:`size-4 shrink-0`}),t===1?`1 field needs attention`:`${t} fields need attention`]})]})}async function Q(e,t,n){return e&&!n?m(q(e,`/preview`)):ae(`/api/automations/preview`,t)}function Ge({automationId:e,dirty:t,getInput:n,currentKey:r}){let[i,a]=(0,Y.useState)({status:`idle`}),o=async()=>{let r=n();if(!r)j.error(`Fix the highlighted fields to preview the task`);else{a({status:`loading`});try{let n=await Q(e,r,t);a({status:`done`,preview:n,key:JSON.stringify(r)})}catch(e){a(Z(e)?{status:`unsupported`}:{status:`error`,error:e})}}};return(0,X.jsxs)(k,{stack:!0,title:`Preview`,description:`See the task an occurrence would create, and when it would run next.`,testId:`automation-preview`,children:[(0,X.jsx)(`div`,{children:(0,X.jsx)(p,{icon:(0,X.jsx)(xe,{className:`size-4`}),busy:i.status===`loading`,onClick:()=>void o(),children:`Preview resulting task`})}),i.status===`unsupported`&&(0,X.jsx)(b,{capability:`Task preview`,reason:`This coordinator does not offer automation previews.`,fallback:`Read the summary above, or save and use Run now to see a real task.`}),i.status===`error`&&(0,X.jsx)(_,{compact:!0,title:`Could not preview`,error:i.error,onRetry:()=>void o()}),i.status===`done`&&(0,X.jsx)(Ke,{preview:i.preview,stale:i.key!==r})]})}function Ke({preview:e,stale:t}){let{task:n}=e;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-warning`,role:`status`,children:[(0,X.jsx)(x,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`The form changed since this preview. Preview again to refresh it.`]}),(0,X.jsx)(`p`,{className:`text-sm break-words text-muted`,children:e.summary}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 rounded-md border border-border bg-surface-2 p-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`min-w-0 font-medium break-words`,children:n.title}),(0,X.jsx)(D,{priority:n.priority,muted:!0,className:`shrink-0 text-xs`})]}),n.objective?(0,X.jsx)(`p`,{className:`text-sm break-words whitespace-pre-wrap`,children:n.objective}):(0,X.jsx)(`p`,{className:`text-sm text-muted`,children:`No objective.`}),n.acceptanceCriteria.length>0&&(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`h4`,{className:`flex items-center gap-1 text-xs font-medium text-muted`,children:[(0,X.jsx)(M,{"aria-hidden":!0,className:`size-3.5`}),`Acceptance criteria`]}),(0,X.jsx)(`ul`,{className:`mt-1 list-disc pl-5 text-sm`,children:n.acceptanceCriteria.map((e,t)=>(0,X.jsx)(`li`,{className:`break-words`,children:e},t))})]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium`,children:`Next occurrences`}),e.next.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted`,children:`No scheduled times: this trigger fires on demand, on a webhook, or when a task is done.`}):(0,X.jsx)(`ol`,{className:`mt-1 flex flex-col gap-0.5 text-sm`,children:e.next.slice(0,5).map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap gap-x-2`,children:[(0,X.jsx)(`time`,{dateTime:e,children:K(e)}),(0,X.jsx)(`span`,{className:`text-muted`,children:h(e)})]},e))})]})]})}function qe({label:e,value:t,mono:n=!0}){return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsx)(`code`,{className:`min-w-0 flex-1 rounded border border-border bg-surface px-2 py-1.5 text-xs break-all select-all ${n?`font-mono`:``}`,children:t}),(0,X.jsx)(p,{size:`sm`,icon:(0,X.jsx)(E,{className:`size-3.5`}),onClick:()=>void T(t,`${e} copied`),"aria-label":`Copy ${e.toLowerCase()}`,children:`Copy`})]})]})}function Je({automation:e}){let[t,n]=(0,Y.useState)(!1),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(!1),l=e.webhookTokenSet||a!==null,u=async()=>{i(!1),n(!0);try{let t=await ae(q(e.id,`/webhook-token`)),n=re.safeParse(t);if(!n.success)throw Error(`The coordinator returned an unexpected token response`);let r=new URL(n.data.url,window.location.origin).toString();o({token:n.data.token,url:r}),j.success(l?`Webhook token rotated`:`Webhook token created`)}catch(e){Z(e)?c(!0):j.error(`Could not issue a webhook token: ${oe(e)}`)}finally{n(!1)}};return(0,X.jsxs)(k,{stack:!0,title:`Webhook`,description:`POST JSON to the URL with the token as a Bearer header. Filters decide which payloads fire.`,testId:`webhook-token`,children:[(0,X.jsx)(`p`,{className:`flex items-center gap-1.5 text-sm`,children:l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{"aria-hidden":!0,className:`size-4 shrink-0 text-success`}),`A token is set`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Se,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),`No token yet: webhook calls are rejected until you create one`]})}),s?(0,X.jsx)(b,{capability:`Webhook tokens`,reason:`This coordinator does not issue webhook tokens.`}):(0,X.jsx)(`div`,{children:(0,X.jsx)(p,{icon:(0,X.jsx)(de,{className:`size-4`}),busy:t,onClick:()=>l?i(!0):void u(),children:l?`Rotate token`:`Create token`})}),a&&(0,X.jsxs)(`div`,{role:`alert`,className:`flex min-w-0 flex-col gap-3 rounded-md border border-warning bg-warning-soft p-3`,children:[(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,X.jsx)(x,{"aria-hidden":!0,className:`size-4 shrink-0 text-warning`}),`This token is shown once. Copy it now.`]}),(0,X.jsx)(qe,{label:`Token`,value:a.token}),(0,X.jsx)(qe,{label:`URL`,value:a.url}),(0,X.jsx)(qe,{label:`Example`,value:Pe(a.token,a.url)}),(0,X.jsx)(`div`,{children:(0,X.jsx)(p,{size:`sm`,onClick:()=>o(null),children:`I have copied it`})})]}),(0,X.jsx)(Ee,{open:r,onClose:()=>i(!1),title:`Rotate webhook token?`,description:`The current token stops working immediately. Update every sender with the new token.`,confirmLabel:`Rotate token`,busy:t,onConfirm:()=>void u()})]})}var Ye=[];function Xe({automationId:e,refreshKey:t,onRun:n}){let r=S(t=>t.occurrences[e]??Ye),i=S(e=>e.tasks),[a,o]=(0,Y.useState)({status:`loading`}),s=(0,Y.useCallback)(async t=>{o(e=>e.status===`done`?e:{status:`loading`});try{let n=await m(q(e,`/history`),{},t);o({status:`done`,items:ze(n)})}catch(e){if(t?.aborted)return;o(Z(e)?{status:`unsupported`}:{status:`error`,error:e})}},[e]);(0,Y.useEffect)(()=>{let e=new AbortController;return s(e.signal),()=>e.abort()},[s,t]);let c=je(a.status===`done`?a.items:[],r);return(0,X.jsxs)(k,{stack:!0,title:`History`,description:`Occurrences of this automation. Routine successes are hidden from the board and appear only here.`,testId:`automation-history`,children:[a.status===`unsupported`&&(0,X.jsx)(b,{capability:`Automation history`,reason:`This coordinator does not serve stored history; only occurrences seen live in this session are shown.`}),a.status===`error`&&(0,X.jsx)(_,{compact:!0,title:`Could not load history`,error:a.error,onRetry:()=>void s()}),a.status===`loading`&&c.length===0?(0,X.jsx)(f,{label:`Loading history…`,className:`py-4`}):c.length===0&&a.status!==`error`?(0,X.jsx)(y,{className:`py-4`,icon:(0,X.jsx)(He,{className:`size-6`}),title:`No occurrences yet`,description:`Occurrences appear here when the trigger fires or you run it.`,action:{label:`Run now`,onClick:n,icon:(0,X.jsx)(fe,{className:`size-4`})}}):(0,X.jsx)(`ol`,{className:`flex flex-col divide-y divide-border`,children:c.map(e=>{let t=Ve(e),n=e.taskId?i[e.taskId]:void 0,r=[e.reason,e.outcome].filter(Boolean).join(` · `);return(0,X.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1 py-2 first:pt-0 last:pb-0`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(be,{kind:`occurrence`,value:e.state,size:`sm`}),(0,X.jsx)(`time`,{dateTime:t,className:`text-sm`,children:K(t)}),(0,X.jsx)(`span`,{className:`text-xs text-muted`,children:h(t)})]}),r&&(0,X.jsx)(`p`,{className:`text-sm break-words text-muted`,children:r}),e.taskId&&(0,X.jsxs)(F,{to:Ue(e.taskId),variant:`action`,size:`sm`,className:`self-start`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:n?`Task: ${n.title}`:`Open task`}),n?.hiddenFromBoard&&(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted`,children:`(hidden from board)`})]})]},e.id)})})]})}var Ze=`/automations`,Qe=e=>`/automations/${encodeURIComponent(e)}`,$e=`sy:automation-draft`;function et(){let{automationId:e=`new`}=a();return(0,X.jsx)(tt,{automationId:e},e)}function tt({automationId:e}){let t=e===`new`,n=S(e=>e.hydrated),r=z(t?void 0:e),[i,a]=(0,Y.useState)({status:`idle`}),o=(0,Y.useCallback)(async()=>{a({status:`loading`});try{let t=await m(q(e)),n=g.safeParse(t);if(!n.success){a({status:`fatal`,error:Error(`The coordinator returned this automation in an unexpected format.`)});return}B.getState().put(n.data),a({status:`idle`})}catch(e){d(e)&&e.status===404?a({status:`notfound`}):a({status:`error`,error:e})}},[e]),s=!t&&!r;return(0,Y.useEffect)(()=>{s&&i.status===`idle`&&o()},[s,i.status,o]),t?(0,X.jsx)(at,{automation:null}):r?(0,X.jsx)(at,{automation:r}):i.status===`notfound`?(0,X.jsx)(y,{icon:(0,X.jsx)(ye,{className:`size-8`}),title:`Automation not found`,description:`It may have been deleted, or the link is wrong.`,action:{label:`Back to automations`,to:Ze}}):i.status===`error`?(0,X.jsx)(_,{title:`Could not load this automation`,error:i.error,onRetry:()=>void o()}):i.status===`fatal`?(0,X.jsx)(v,{error:i.error}):(0,X.jsx)(f,{label:n?`Loading automation…`:`Loading…`})}function nt(e){let t=Ae({projectId:e,timezone:U()});try{let e=sessionStorage.getItem($e);if(!e)return t;let n=JSON.parse(e);return!n||typeof n!=`object`?t:{...t,...n,filters:Array.isArray(n.filters)?n.filters:[]}}catch{return t}}function rt(e){try{e?sessionStorage.setItem($e,JSON.stringify(e)):sessionStorage.removeItem($e)}catch{}}var $=e=>JSON.stringify(Re(e));function it(e){if(!d(e))return{};let t=e.details,n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.issues)?t.issues:[],r={};for(let e of n){if(!e||typeof e!=`object`)continue;let{path:t,message:n}=e;if(!Array.isArray(t)||typeof n!=`string`)continue;let i=H(t);i!==`form`&&!r[i]&&(r[i]=n)}return r}function at({automation:e}){let r=t(),i=s(),a=he(Ze),o=we(),d=o===`desktop`,f=l(),m=c(),h=S(e=>e.hosts),g=S(e=>e.profiles),_=S(e=>e.tasks),re=S(e=>e.projects),v=e===null,y=(0,Y.useId)(),b=(0,Y.useRef)(null),[C,w]=(0,Y.useState)(()=>e?G(e):nt(f[0]?.id)),[T,E]=(0,Y.useState)(()=>$(C)),[D,O]=(0,Y.useState)(!1),[ue,de]=(0,Y.useState)({}),[pe,k]=(0,Y.useState)(!1),[ye,be]=(0,Y.useState)(!1),[xe,A]=(0,Y.useState)(!1),[Se,M]=(0,Y.useState)(!1),[Te,N]=(0,Y.useState)(0),P=(0,Y.useRef)(e?.updatedAt),F=$(C),I=F!==T;(0,Y.useEffect)(()=>{if(!e||e.updatedAt===P.current)return;P.current=e.updatedAt;let t=G(e),n=$(t);F===T?(w(t),M(!1)):n!==F&&M(!0),E(n)},[e,F,T]),(0,Y.useEffect)(()=>{v&&rt(C)},[v,C]),(0,Y.useEffect)(()=>{v&&!C.projectId&&f[0]&&w(e=>e.projectId?e:{...e,projectId:f[0].id})},[v,C.projectId,f]);let L=(0,Y.useCallback)((e,t)=>{w(n=>({...n,[e]:t})),de(e=>Object.keys(e).length?{}:e)},[]),R=(0,Y.useMemo)(()=>Oe(C),[C]),z={...ue,...D?R.errors:{}},V=e=>z[e],H=re[C.projectId],je=C.hostId||H?.defaultHostId||null,W=je?h[je]:void 0,Me=C.profileId||H?.defaultProfileId||null,Ne=(0,Y.useCallback)(e=>_[e]?.title,[_]),Pe=(0,Y.useMemo)(()=>ke(Re(C),{projectName:H?.name,hostName:C.hostId?h[C.hostId]?.name??null:null,profileName:C.profileId?g[C.profileId]?.name??null:null,taskTitle:Ne}),[C,H?.name,h,g,Ne]),K=()=>{requestAnimationFrame(()=>{b.current?.querySelector(`[aria-invalid="true"]`)?.focus()})},Fe=()=>(O(!0),R.input||K(),R.input),Ie=async()=>{let t=Fe();if(!t)j.error(`Fix the highlighted fields before saving`);else{k(!0);try{if(v){let e=await ae(`/api/automations`,t);if(!e||typeof e!=`object`||!e.id)throw Error(`The coordinator did not return the new automation`);B.getState().put(e),rt(null),j.success(`Created ${e.name}`),r(Qe(e.id),{replace:!0,state:i.state});return}let n=await ee(q(e.id),t);if(n&&typeof n==`object`&&n.id){B.getState().put(n),P.current=n.updatedAt;let e=G(n);w(e),E($(e))}else E(F);M(!1),O(!1),j.success(`Saved ${t.name}`)}catch(e){let t=it(e);de(t),Object.keys(t).length&&K(),j.error(`Could not save: ${oe(e)}. Your changes are kept.`)}finally{k(!1)}}},Le=async()=>{if(e){be(!0);try{await te(q(e.id)),A(!1),j.success(`Deleted ${e.name}`),a(),B.getState().remove(e.id)}catch(e){j.error(`Could not delete: ${oe(e)}`)}finally{be(!1)}}},{busy:ze,run:Be}=De(()=>N(e=>e+1)),Ve=e?!!ze[e.id]:!1,J=()=>e&&void Be(e),He=()=>{let e=Ae({projectId:f[0]?.id,timezone:U()});w(e),O(!1),rt(null)},Ue=v?`New automation`:e.name,Z=(0,X.jsxs)(X.Fragment,{children:[!v&&(0,X.jsx)(p,{icon:(0,X.jsx)(fe,{className:`size-4`}),busy:Ve,onClick:J,title:I?`Runs the saved version`:void 0,children:`Run now`}),v&&I&&(0,X.jsx)(p,{variant:`ghost`,icon:(0,X.jsx)(Ce,{className:`size-4`}),onClick:He,children:`Discard draft`})]}),Q=e=>(0,X.jsx)(p,{type:`submit`,form:y,variant:`primary`,busy:pe,block:e,icon:(0,X.jsx)(ge,{className:`size-4`}),children:v?`Create automation`:`Save`}),Ke=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(We,{summary:Pe,errorCount:D?Object.keys(R.errors).length:0}),(0,X.jsx)(Ge,{automationId:e?.id??null,dirty:I,getInput:Fe,currentKey:JSON.stringify(R.input)}),e&&e.trigger.kind===`webhook`&&(0,X.jsx)(Je,{automation:e}),e&&(0,X.jsx)(Xe,{automationId:e.id,refreshKey:Te,onRun:J})]});return(0,X.jsxs)(`div`,{"data-testid":`automation-editor`,className:`flex w-full min-w-0 flex-col gap-4 px-4 pt-4 md:px-6`,children:[(0,X.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsxs)(n,{to:Ze,onClick:me(a),className:`tap inline-flex items-center gap-1 self-start rounded text-sm text-muted hover:text-text`,children:[(0,X.jsx)(se,{"aria-hidden":!0,className:`size-4`}),`Automations`]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h1`,{className:`min-w-0 text-lg font-semibold break-words`,children:Ue}),I&&(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted`,children:[(0,X.jsx)(ve,{"aria-hidden":!0,className:`size-3.5`}),`Unsaved changes`]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Z,d&&Q()]})]})]}),(0,X.jsx)(ie,{subject:`automations`,consequence:`Changes are sent once the coordinator is reachable again.`}),W&&W.connectivity!==`connected`&&(0,X.jsx)(ne,{compact:!0,hostName:W.name,connectivity:W.connectivity,lastSeenAt:W.lastSeenAt,detail:`Occurrences are still recorded; their tasks wait until the host is reachable.`}),Se&&(0,X.jsxs)(`p`,{role:`status`,className:`flex items-start gap-1.5 rounded-md border border-border bg-warning-soft px-3 py-2 text-sm`,children:[(0,X.jsx)(x,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-warning`}),`This automation changed elsewhere. Saving overwrites those changes with yours.`]}),(0,X.jsxs)(`div`,{className:u(`grid min-w-0 gap-4`,d?`grid-cols-[minmax(0,1fr)_minmax(320px,400px)] items-start`:`grid-cols-1`),children:[(0,X.jsxs)(`form`,{id:y,ref:b,noValidate:!0,"aria-label":Ue,onSubmit:e=>{e.preventDefault(),Ie()},className:`flex min-w-0 flex-col gap-4`,children:[(0,X.jsx)(ot,{draft:C,update:L,err:V,projects:f}),(0,X.jsx)(lt,{draft:C,update:L,err:V,tasks:_,projectsById:re,savedAutomation:e,segmented:o!==`mobile`}),(0,X.jsx)(ut,{draft:C,setDraft:w,err:V}),(0,X.jsx)(dt,{draft:C,update:L,err:V}),(0,X.jsx)(pt,{draft:C,update:L,err:V,hosts:m,profiles:Object.values(g).sort((e,t)=>e.name.localeCompare(t.name)),defaultHostName:H?.defaultHostId?h[H.defaultHostId]?.name:void 0,defaultProfileName:H?.defaultProfileId?g[H.defaultProfileId]?.name:void 0,selectedProfileMissing:!!Me&&!g[Me]}),(0,X.jsx)(mt,{draft:C,update:L}),(0,X.jsx)(ht,{draft:C,update:L,err:V}),(0,X.jsx)(gt,{draft:C,update:L,err:V,projectChecks:H?.checks}),z.form&&(0,X.jsx)(le,{children:z.form})]}),(0,X.jsx)(`aside`,{"aria-label":`Summary, preview and history`,className:`flex min-w-0 flex-col gap-4`,children:Ke})]}),!v&&e&&(0,X.jsx)(_e,{description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,children:(0,X.jsx)(p,{variant:`danger`,icon:(0,X.jsx)(ce,{className:`size-4`}),onClick:()=>A(!0),children:`Delete automation`})}),d?(0,X.jsx)(`div`,{className:`h-4`}):(0,X.jsxs)(`div`,{className:`sticky bottom-0 z-10 -mx-4 flex items-center gap-3 border-t border-border bg-surface px-4 py-2 md:-mx-6 md:px-6`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-muted`,children:I?`Unsaved changes`:v?`Not saved yet`:`All changes saved`}),Q()]}),(0,X.jsx)(Ee,{open:xe,onClose:()=>A(!1),title:`Delete ${e?.name??`automation`}?`,description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,confirmLabel:`Delete automation`,confirmIcon:(0,X.jsx)(ce,{className:`size-4`}),busy:ye,onConfirm:()=>void Le()})]})}function ot({draft:e,update:t,err:n,projects:r}){return(0,X.jsxs)(k,{stack:!0,title:`Basics`,children:[(0,X.jsx)(C,{label:`Name`,error:n(`name`),children:n=>(0,X.jsx)(P,{...n,value:e.name,onChange:e=>t(`name`,e.target.value),placeholder:`Daily dependency check`,autoComplete:`off`})}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsx)(C,{label:`Project`,error:n(`projectId`),hint:r.length===0?(0,X.jsxs)(X.Fragment,{children:[`No projects yet.`,` `,(0,X.jsx)(F,{to:`/settings/projects`,children:`Add a project in Settings`}),`.`]}):void 0,children:n=>(0,X.jsxs)(L,{...n,value:e.projectId,onChange:e=>t(`projectId`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`Choose a project`}),r.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,X.jsx)(C,{label:`Status`,hint:`Disabled automations keep their history and can still run manually.`,children:n=>(0,X.jsx)(R,{...n,checked:e.enabled,onChange:e=>t(`enabled`,e),label:`Enabled`,onText:`Enabled`,offText:`Disabled`,className:`self-start`})})]})]})}var st=[`manual`,`once`,`cron`,`webhook`,`dependency`],ct={manual:`Runs only when you press Run now (or from the CLI).`,once:`Runs a single time at the chosen moment.`,cron:`Runs on a timezone-aware cron schedule.`,webhook:`Runs when an authenticated JSON POST arrives at this automation's webhook URL.`,dependency:`Runs when the chosen task is done.`};function lt({draft:e,update:t,err:n,tasks:r,projectsById:i,savedAutomation:a,segmented:o}){let s=S(e=>e.hydrated),c=e.triggerKind===`cron`?Be(e.cronExpr):null,l=e.triggerKind===`cron`&&!c?Ie(e.cronExpr,e.cronTimezone.trim()||void 0)??`Valid expression (no plain-language description available)`:null,u=(0,Y.useMemo)(()=>{try{return Intl.supportedValuesOf?.(`timeZone`)}catch{return}},[]),ee=(0,Y.useId)(),d=U(),f=(0,Y.useMemo)(()=>Object.values(r).filter(t=>t.state!==`canceled`||t.id===e.dependencyTaskId).sort((e,t)=>e.title.localeCompare(t.title)),[r,e.dependencyTaskId]),p=e.triggerKind===`once`?Me(e.onceAt):``;return(0,X.jsxs)(k,{stack:!0,title:`Trigger`,description:ct[e.triggerKind],children:[o?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`text-sm font-medium`,children:`Trigger kind`}),(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsx)(I,{label:`Trigger kind`,value:e.triggerKind,onChange:e=>t(`triggerKind`,e),options:st.map(e=>({value:e,label:V[e]}))})})]}):(0,X.jsx)(C,{label:`Trigger kind`,children:n=>(0,X.jsx)(L,{...n,value:e.triggerKind,onChange:e=>t(`triggerKind`,e.target.value),children:st.map(e=>(0,X.jsx)(`option`,{value:e,children:V[e]},e))})}),e.triggerKind===`once`&&(0,X.jsx)(C,{label:`Run at`,error:n(`onceAt`),hint:`Local time (${d})${p?`; saved as ${p}`:``}.`,children:n=>(0,X.jsx)(P,{...n,type:`datetime-local`,value:e.onceAt,onChange:e=>t(`onceAt`,e.target.value)})}),e.triggerKind===`cron`&&(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsx)(C,{label:`Cron expression`,error:n(`cronExpr`)??c??void 0,hint:`minute hour day-of-month month day-of-week, e.g. 0 9 * * 1-5`,children:n=>(0,X.jsx)(P,{...n,"aria-invalid":c?!0:n[`aria-invalid`],value:e.cronExpr,onChange:e=>t(`cronExpr`,e.target.value),className:`font-mono`,autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`})}),(0,X.jsx)(C,{label:`Timezone`,error:n(`cronTimezone`),hint:e.cronTimezone.trim()===d?`IANA timezone name; daylight saving is handled.`:(0,X.jsxs)(F,{onClick:()=>t(`cronTimezone`,d),children:[`Use this device's timezone (`,d,`)`]}),children:n=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{...n,list:u?ee:void 0,value:e.cronTimezone,onChange:e=>t(`cronTimezone`,e.target.value),autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`}),u&&(0,X.jsx)(`datalist`,{id:ee,children:u.map(e=>(0,X.jsx)(`option`,{value:e},e))})]})}),l&&(0,X.jsxs)(`p`,{className:`flex items-start gap-1.5 text-sm sm:col-span-2`,"aria-live":`polite`,"data-testid":`cron-description`,children:[(0,X.jsx)(w,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,X.jsx)(`span`,{className:`min-w-0 break-words`,children:l})]})]}),e.triggerKind===`webhook`&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-muted`,children:[(0,X.jsxs)(`p`,{children:[`Senders POST a JSON body (up to 256 KB) with`,` `,(0,X.jsx)(`code`,{children:`Authorization: Bearer <token>`}),`. Use the filters below to fire only for matching payloads, and `,(0,X.jsx)(`code`,{children:`{{payload.<path>}}`}),` to copy payload values into the task.`]}),a?a.trigger.kind===`webhook`?(0,X.jsxs)(`p`,{children:[`Token:`,` `,a.webhookTokenSet?`set (see Webhook below to rotate)`:`not created yet`]}):(0,X.jsx)(`p`,{children:`Save to switch this automation to a webhook trigger, then create a token.`}):(0,X.jsx)(`p`,{children:`Save the automation to create its webhook token and URL.`})]}),e.triggerKind===`dependency`&&(0,X.jsx)(C,{label:`When this task is done`,error:n(`dependencyTaskId`),hint:`Fires once each time the task enters Done.`,children:n=>(0,X.jsxs)(L,{...n,value:e.dependencyTaskId,onChange:e=>t(`dependencyTaskId`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`Choose a task`}),e.dependencyTaskId&&!r[e.dependencyTaskId]&&(0,X.jsx)(`option`,{value:e.dependencyTaskId,children:s?`Deleted task`:`Loading task…`}),f.map(e=>(0,X.jsxs)(`option`,{value:e.id,children:[e.title,i[e.projectId]?` (${i[e.projectId].name})`:``,e.state===`done`?` - done`:``]},e.id))]})})]})}function ut({draft:e,setDraft:t,err:n}){let r=(e,n)=>t(t=>({...t,filters:t.filters.map((t,r)=>r===e?{...t,...n}:t)})),i=e.triggerKind===`webhook`;return(0,X.jsxs)(k,{stack:!0,title:`Filters`,description:`Filters apply to webhook payloads. Each row compares a dot path (for example pull_request.base.ref) with an exact value; all rows must match. Payloads that do not match are recorded as Filtered out.`,children:[!i&&(0,X.jsx)(`p`,{className:`text-sm text-muted`,children:`Filters are ignored unless the trigger is Webhook.`}),e.filters.length===0&&(0,X.jsx)(`p`,{className:`text-sm text-muted`,children:`No filters: every payload fires.`}),e.filters.map((e,i)=>(0,X.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-end gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,X.jsx)(C,{label:`Path ${i+1}`,error:n(`filters.${i}.path`),children:t=>(0,X.jsx)(P,{...t,value:e.path,onChange:e=>r(i,{path:e.target.value}),placeholder:`action`,className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})}),(0,X.jsx)(C,{label:`Equals ${i+1}`,error:n(`filters.${i}.equals`),className:`col-start-1 row-start-2 sm:col-start-auto sm:row-start-auto`,children:t=>(0,X.jsx)(P,{...t,value:e.equals,onChange:e=>r(i,{equals:e.target.value}),placeholder:`opened`})}),(0,X.jsx)(Te,{label:`Remove filter ${i+1}`,icon:(0,X.jsx)(Ce,{className:`size-4`}),onClick:()=>t(e=>({...e,filters:e.filters.filter((e,t)=>t!==i)}))})]},i)),(0,X.jsx)(`div`,{children:(0,X.jsx)(p,{size:`sm`,icon:(0,X.jsx)(pe,{className:`size-3.5`}),onClick:()=>t(e=>({...e,filters:[...e.filters,{path:``,equals:``}]})),children:`Add filter`})})]})}function dt({draft:e,update:t,err:n}){return(0,X.jsxs)(k,{stack:!0,title:`Task template`,description:`Use ${W.join(`, `)} in the title, objective, criteria and grouping key.`,children:[(0,X.jsx)(C,{label:`Task title`,error:n(`title`),children:n=>(0,X.jsx)(P,{...n,value:e.title,onChange:e=>t(`title`,e.target.value),placeholder:`Triage new issues for {{date}}`})}),(0,X.jsx)(C,{label:`Objective`,error:n(`objective`),children:n=>(0,X.jsx)(N,{...n,minRows:4,value:e.objective,onChange:e=>t(`objective`,e.target.value)})}),(0,X.jsx)(C,{label:`Acceptance criteria`,error:n(`criteria`),hint:`One criterion per line.`,optional:!0,children:n=>(0,X.jsx)(N,{...n,minRows:3,value:e.criteria,onChange:e=>t(`criteria`,e.target.value)})}),(0,X.jsx)(C,{label:`Priority`,error:n(`priority`),children:n=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(ue,{priority:e.priority}),(0,X.jsx)(O,{...n,value:e.priority,onChange:e=>t(`priority`,e),className:`sm:max-w-48`})]})})]})}function ft({legend:e,value:t,options:n,onChange:r,hint:i}){let a=(0,Y.useId)();return(0,X.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:e}),(0,X.jsx)(`div`,{className:`grid min-w-0 gap-2 sm:grid-cols-3`,children:n.map(e=>(0,X.jsxs)(`label`,{className:u(`tap flex min-w-0 cursor-pointer items-start gap-2 rounded-md border p-2.5 text-sm`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-1`,t===e.value?`border-accent bg-accent-soft`:`border-border hover:bg-surface-2`),children:[(0,X.jsx)(`input`,{type:`radio`,name:a,value:e.value,checked:t===e.value,onChange:()=>r(e.value),className:`mt-0.5 size-4 shrink-0 accent-[var(--color-accent)]`}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:e.label}),(0,X.jsx)(`span`,{className:`block text-xs text-muted`,children:e.explanation})]})]},e.value))}),i&&(0,X.jsx)(`p`,{className:`text-xs text-muted`,children:i})]})}function pt({draft:e,update:t,err:n,hosts:r,profiles:i,defaultHostName:a,defaultProfileName:o,selectedProfileMissing:s}){return(0,X.jsxs)(k,{stack:!0,title:`Where and how it runs`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsx)(C,{label:`Host`,error:n(`hostId`),children:n=>(0,X.jsxs)(L,{...n,value:e.hostId,onChange:e=>t(`hostId`,e.target.value),children:[(0,X.jsxs)(`option`,{value:``,children:[`Project default`,a?` (${a})`:``]}),e.hostId&&!r.some(t=>t.id===e.hostId)&&(0,X.jsx)(`option`,{value:e.hostId,children:`Unknown host`}),r.map(e=>(0,X.jsxs)(`option`,{value:e.id,children:[e.name,e.connectivity===`connected`?``:` (${e.connectivity})`]},e.id))]})}),(0,X.jsx)(C,{label:`Profile`,error:n(`profileId`),hint:s?`The selected profile is no longer available.`:void 0,children:n=>(0,X.jsxs)(L,{...n,value:e.profileId,onChange:e=>t(`profileId`,e.target.value),children:[(0,X.jsxs)(`option`,{value:``,children:[`Project default`,o?` (${o})`:``]}),e.profileId&&!i.some(t=>t.id===e.profileId)&&(0,X.jsx)(`option`,{value:e.profileId,children:`Unknown profile`}),i.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})]}),(0,X.jsx)(ft,{legend:`Mode`,value:e.mode,options:Ne,onChange:e=>t(`mode`,e)}),(0,X.jsx)(C,{label:`Grouping key`,optional:e.mode!==`continue`,error:n(`groupingKey`),hint:`Occurrences with the same rendered key are the same work: Continue reuses that task and overlap checks compare it. Supports template variables, e.g. pr-{{payload.number}}.`,children:n=>(0,X.jsx)(P,{...n,value:e.groupingKey,onChange:e=>t(`groupingKey`,e.target.value),className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})})]})}function mt({draft:e,update:t}){let n=e.triggerKind===`cron`||e.triggerKind===`once`;return(0,X.jsxs)(k,{stack:!0,title:`Overlap and missed runs`,children:[(0,X.jsx)(ft,{legend:`When previous work is still open`,value:e.overlap,options:Fe,onChange:e=>t(`overlap`,e)}),(0,X.jsx)(ft,{legend:`Missed runs`,value:e.missed,options:Le,onChange:e=>t(`missed`,e),hint:n?`A run is missed when the coordinator was down at its scheduled time.`:`Only applies to Schedule and Once triggers.`})]})}function ht({draft:e,update:t,err:n}){return(0,X.jsxs)(k,{stack:!0,title:`Limits`,description:`Continuation prompts the agent to keep going after a turn ends without finishing. It is off by default.`,children:[(0,X.jsx)(C,{label:`Automatic continuation`,children:n=>(0,X.jsx)(R,{...n,checked:e.continuationEnabled,onChange:e=>t(`continuationEnabled`,e),label:`Automatic continuation`,className:`self-start`})}),e.continuationEnabled&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(C,{label:`Continuation objective`,error:n(`continuationObjective`),hint:`What the agent must achieve before it reports done.`,children:n=>(0,X.jsx)(N,{...n,minRows:2,value:e.continuationObjective,onChange:e=>t(`continuationObjective`,e.target.value)})}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsx)(C,{label:`Max continuations`,error:n(`maxContinuations`),hint:`1–50`,children:n=>(0,X.jsx)(P,{...n,type:`number`,inputMode:`numeric`,min:1,max:50,step:1,value:e.maxContinuations,onChange:e=>t(`maxContinuations`,e.target.value)})}),(0,X.jsx)(C,{label:`Max elapsed minutes`,error:n(`maxElapsedMinutes`),hint:`1–1440`,children:n=>(0,X.jsx)(P,{...n,type:`number`,inputMode:`numeric`,min:1,max:1440,step:1,value:e.maxElapsedMinutes,onChange:e=>t(`maxElapsedMinutes`,e.target.value)})}),(0,X.jsx)(C,{label:`Max tokens`,optional:!0,error:n(`maxTokens`),children:n=>(0,X.jsx)(P,{...n,type:`number`,inputMode:`numeric`,min:1,step:1,value:e.maxTokens,onChange:e=>t(`maxTokens`,e.target.value)})}),(0,X.jsx)(C,{label:`Max cost (USD)`,optional:!0,error:n(`maxCostUsd`),children:n=>(0,X.jsx)(P,{...n,type:`number`,inputMode:`decimal`,min:.01,step:.01,value:e.maxCostUsd,onChange:e=>t(`maxCostUsd`,e.target.value)})})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted`,children:`Token and cost limits are enforced only when the provider reports accounting; otherwise the run shows that accounting is unavailable and only the count and time limits apply.`})]})]})}function gt({draft:e,update:t,err:n,projectChecks:r}){let i=r&&r.length>0?`the project's checks (${r.join(`, `)})`:`the project's checks`;return(0,X.jsxs)(k,{stack:!0,title:`Review`,children:[(0,X.jsx)(C,{label:`Checks`,optional:!0,error:n(`checks`),hint:`One command per line. Leave empty to use ${i}.`,children:n=>(0,X.jsx)(N,{...n,minRows:2,value:e.checks,onChange:e=>t(`checks`,e.target.value),className:`font-mono`,spellCheck:!1,autoCapitalize:`off`})}),(0,X.jsx)(C,{label:`Human review`,hint:`When on, finished work waits in Review for you instead of completing on passing checks.`,children:n=>(0,X.jsx)(R,{...n,checked:e.requireHumanReview,onChange:e=>t(`requireHumanReview`,e),label:`Require human review`,onText:`Required`,offText:`Not required`,className:`self-start`})})]})}export{et as default};
|
|
2
|
-
//# sourceMappingURL=AutomationView-D7Syv1En.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,m as t,t as n}from"./jsx-runtime-D13aM9HY.js";import{_ as r}from"./states-ZhrxQa3K.js";var i=e(t(),1),a=n();function o({label:e,description:t,checked:n,onChange:o,className:s,id:c,...l}){let u=(0,i.useId)(),d=t?`${c??u}-desc`:void 0;return(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,a.jsxs)(`label`,{className:r(`tap inline-flex min-w-0 cursor-pointer items-center gap-2 text-sm`,s),children:[(0,a.jsx)(`input`,{...l,id:c,type:`checkbox`,checked:n,onChange:e=>o(e.target.checked),"aria-describedby":d??l[`aria-describedby`],className:`size-4 shrink-0 accent-[var(--sy-accent)]`}),(0,a.jsx)(`span`,{className:r(`min-w-0`,!!t&&`font-medium`),children:e})]}),t&&(0,a.jsx)(`p`,{id:d,className:`pl-6 text-sm text-muted`,children:t})]})}export{o as t};
|
|
2
|
-
//# sourceMappingURL=Checkbox-D6tRfEeI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox-D6tRfEeI.js","names":["useId","__toESM","require_react","require_jsx_runtime","cn","import_react","import_jsx_runtime","Checkbox","rest","generated","descId","description","id","className","onChange","label"],"sources":["../../src/components/ui/Checkbox.tsx"],"sourcesContent":["import { type InputHTMLAttributes, type ReactNode, useId } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface CheckboxProps\n extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"checked\" | \"onChange\" | \"className\"\n > {\n label: ReactNode;\n /** Shown under the label; kept outside the label so it is not part of the accessible name. */\n description?: ReactNode;\n checked: boolean;\n onChange(checked: boolean): void;\n /** Classes for the clickable label row. */\n className?: string;\n}\n\n/** Native checkbox with its label; the whole row is the touch target. */\nexport function Checkbox({\n label,\n description,\n checked,\n onChange,\n className,\n id,\n ...rest\n}: CheckboxProps) {\n const generated = useId();\n const descId = description ? `${id ?? generated}-desc` : undefined;\n return (\n <div className=\"flex min-w-0 flex-col\">\n <label\n className={cn(\n \"tap inline-flex min-w-0 cursor-pointer items-center gap-2 text-sm\",\n className,\n )}\n >\n <input\n {...rest}\n id={id}\n type=\"checkbox\"\n checked={checked}\n onChange={(e) => onChange(e.target.checked)}\n aria-describedby={descId ?? rest[\"aria-describedby\"]}\n className=\"size-4 shrink-0 accent-[var(--sy-accent)]\"\n />\n <span className={cn(\"min-w-0\", !!description && \"font-medium\")}>{label}</span>\n </label>\n {description && (\n <p id={descId} className=\"pl-6 text-sm text-muted\">\n {description}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":"A,0HAkBA,SAAgBO,EAAS,CACvB,QACA,cACA,UACA,WACA,YACA,KACA,GAAGC,GACa,CAChB,IAAMC,GAAA,EAAYT,EAAAA,MAAAA,CAAM,EAClBU,EAASC,EAAc,GAAGC,GAAMH,EAAU,OAAS,IAAA,GACzD,OACE,EAAAH,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,wBAAf,SAAA,EACE,EAAAA,EAAA,KAAA,CAAC,QAAD,CACE,UAAWF,EACT,oEACAS,CACF,EAJF,SAAA,EAME,EAAAP,EAAA,IAAA,CAAC,QAAD,CACE,GAAIE,EACA,KACJ,KAAK,WACI,UACT,SAAW,GAAMM,EAAS,EAAE,OAAO,OAAO,EAC1C,mBAAkBJ,GAAUF,EAAK,oBACjC,UAAU,2CACX,CAAA,GACD,EAAAF,EAAA,IAAA,CAAC,OAAD,CAAM,UAAWF,EAAG,UAAW,CAAC,CAACO,GAAe,aAAa,EAAI,SAAAI,CAAY,CAAA,CACxE,CACN,CAAA,EAAAJ,IACC,EAAAL,EAAA,IAAA,CAAC,IAAD,CAAG,GAAII,EAAQ,UAAU,0BACtB,SAAAC,CACA,CAAA,CAEF,C,EAET,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{d as i}from"./states-ZhrxQa3K.js";import{b as a}from"./index-hxvDvCS7.js";var o={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};o.node;var s=n(o),c={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};c.node;var l=n(c),u=e(t(),1),d=r();async function f(e,t=`Copied to clipboard`){try{return await navigator.clipboard.writeText(e),t&&a.success(t),!0}catch{return a.error(`Could not copy. Select the text and copy it manually.`),!1}}function p({text:e,label:t=`Copy`,toastMessage:n,size:r=`sm`}){let[a,o]=(0,u.useState)(!1),c=(0,u.useRef)(null);return(0,u.useEffect)(()=>()=>void(c.current&&clearTimeout(c.current)),[]),(0,d.jsx)(i,{size:r,icon:a?(0,d.jsx)(s,{className:`size-4`}):(0,d.jsx)(l,{className:`size-4`}),onClick:async()=>{await f(e,n)&&(o(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2e3))},children:a?`Copied`:t})}function m({text:e,label:t,copyLabel:n=`Copy`}){return(0,d.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-2 sm:flex-row sm:items-start`,children:[(0,d.jsx)(`figcaption`,{className:`sr-only`,children:t}),(0,d.jsx)(`pre`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-all rounded-md border border-border bg-surface-2 px-3 py-2 font-mono text-sm`,children:e}),(0,d.jsx)(p,{text:e,label:n})]})}export{s as i,f as n,l as r,m as t};
|
|
2
|
-
//# sourceMappingURL=Copy-B6XSAIUd.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{_ as i}from"./states-ZhrxQa3K.js";var a={name:`save`,size:24,node:[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]};a.node;var o=n(a),s=e(t(),1),c=r();function l({title:e,description:t,actions:n,children:r,className:a,testId:o,stack:l}){let u=(0,s.useId)();return(0,c.jsxs)(`section`,{"aria-labelledby":e?u:void 0,"data-testid":o,className:i(`min-w-0 rounded-lg border border-border bg-surface p-4`,a),children:[(e||n)&&(0,c.jsxs)(`div`,{className:`mb-3 flex min-w-0 flex-wrap items-start gap-2`,children:[(0,c.jsxs)(`div`,{className:`min-w-0 flex-[1_1_12rem]`,children:[e&&(0,c.jsx)(`h2`,{id:u,className:`text-base font-semibold`,children:e}),t&&(0,c.jsx)(`p`,{className:`text-sm text-muted`,children:t})]}),n&&(0,c.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:n})]}),l?(0,c.jsx)(`div`,{className:`flex flex-col gap-4`,children:r}):r]})}function u({description:e,children:t}){let n=(0,s.useId)();return(0,c.jsxs)(`section`,{"aria-labelledby":n,"data-testid":`danger-zone`,className:`min-w-0 rounded-lg border border-danger/50 bg-surface p-4`,children:[(0,c.jsx)(`h2`,{id:n,className:`text-base font-semibold text-danger`,children:`Danger zone`}),e&&(0,c.jsx)(`p`,{className:`text-sm text-muted`,children:e}),(0,c.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:t})]})}export{l as n,o as r,u as t};
|
|
2
|
-
//# sourceMappingURL=DangerZone-DfYlxDC1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DangerZone-DfYlxDC1.js","names":["useId","useId","__toESM","require_react","require_jsx_runtime","cn","__iconData","Save","createLucideIcon","import_react","import_jsx_runtime","Card","titleId","title","testId","className","actions","description","stack","children","DangerZone","id"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/save.mjs","../../src/components/ui/Card.tsx","../../src/components/ui/DangerZone.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"save\",\n size: 24,\n node: [\n [\n \"path\",\n {\n d: \"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z\",\n key: \"1c8476\"\n }\n ],\n [\"path\", { d: \"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7\", key: \"1ydtos\" }],\n [\"path\", { d: \"M7 3v4a1 1 0 0 0 1 1h7\", key: \"t51u73\" }]\n ]\n};\n__iconData.node;\nconst Save = createLucideIcon(__iconData);\n\nexport { __iconData, Save as default };\n//# sourceMappingURL=save.mjs.map\n","import { type ReactNode, useId } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface CardProps {\n title?: ReactNode;\n description?: ReactNode;\n actions?: ReactNode;\n children?: ReactNode;\n className?: string;\n testId?: string;\n /** Wrap the children in a flex column with gap-4. */\n stack?: boolean;\n}\n\n/** A titled, bordered block. The title is its accessible name. */\nexport function Card({\n title,\n description,\n actions,\n children,\n className,\n testId,\n stack,\n}: CardProps) {\n const titleId = useId();\n return (\n <section\n aria-labelledby={title ? titleId : undefined}\n data-testid={testId}\n className={cn(\"min-w-0 rounded-lg border border-border bg-surface p-4\", className)}\n >\n {(title || actions) && (\n <div className=\"mb-3 flex min-w-0 flex-wrap items-start gap-2\">\n <div className=\"min-w-0 flex-[1_1_12rem]\">\n {title && (\n <h2 id={titleId} className=\"text-base font-semibold\">\n {title}\n </h2>\n )}\n {description && <p className=\"text-sm text-muted\">{description}</p>}\n </div>\n {actions && <div className=\"flex flex-wrap items-center gap-2\">{actions}</div>}\n </div>\n )}\n {stack ? <div className=\"flex flex-col gap-4\">{children}</div> : children}\n </section>\n );\n}\n","import { type ReactNode, useId } from \"react\";\n\n/** Destructive actions, set apart at the bottom of a detail page. */\nexport function DangerZone({\n description,\n children,\n}: {\n description?: ReactNode;\n children: ReactNode;\n}) {\n const id = useId();\n return (\n <section\n aria-labelledby={id}\n data-testid=\"danger-zone\"\n className=\"min-w-0 rounded-lg border border-danger/50 bg-surface p-4\"\n >\n <h2 id={id} className=\"text-base font-semibold text-danger\">\n Danger zone\n </h2>\n {description && <p className=\"text-sm text-muted\">{description}</p>}\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">{children}</div>\n </section>\n );\n}\n"],"ignoreList":[0],"mappings":"A,uGASA,IAAMM,EAAa,CACjB,KAAM,OACN,KAAM,GACN,KAAM,CACJ,CACE,OACA,CACE,EAAG,qGACH,IAAK,QACP,CACF,EACA,CAAC,OAAQ,CAAE,EAAG,4CAA6C,IAAK,QAAS,CAAC,EAC1E,CAAC,OAAQ,CAAE,EAAG,yBAA0B,IAAK,QAAS,CAAC,CACzD,CACF,EACAA,EAAW,KACX,IAAMC,EAAOC,EAAiBF,CAAU,E,iBCVxC,SAAgBK,EAAK,CACnB,QACA,cACA,UACA,WACA,YACA,SACA,SACY,CACZ,IAAMC,GAAA,EAAUZ,EAAAA,MAAAA,CAAM,EACtB,OACE,EAAAU,EAAA,KAAA,CAAC,UAAD,CACE,kBAAiBG,EAAQD,EAAU,IAAA,GACnC,cAAaE,EACb,UAAWT,EAAG,yDAA0DU,CAAS,EAHnF,SAAA,EAKIF,GAASG,KACT,EAAAN,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,gDAAf,SAAA,EACE,EAAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,2BAAf,SAAA,CACGG,IACC,EAAAH,EAAA,IAAA,CAAC,KAAD,CAAI,GAAIE,EAAS,UAAU,0BACxB,SAAAC,CACC,CAAA,EAELI,IAAe,EAAAP,EAAA,IAAA,CAAC,IAAD,CAAG,UAAU,qBAAsB,SAAAO,CAAe,CAAA,CAC/D,CACJ,CAAA,EAAAD,IAAW,EAAAN,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,oCAAqC,SAAAM,CAAa,CAAA,CAC1E,CAEN,CAAA,EAAAE,GAAQ,EAAAR,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,sBAAuB,UAAc,CAAA,EAAIS,CAC1D,C,EAEb,CC5CA,SAAgBC,EAAW,CACzB,cACA,YAIC,CACD,IAAMC,GAAA,EAAKpB,EAAAA,MAAAA,CAAM,EACjB,OACE,EAAAS,EAAA,KAAA,CAAC,UAAD,CACE,kBAAiBW,EACjB,cAAY,cACZ,UAAU,4DAHZ,SAAA,EAKE,EAAAX,EAAA,IAAA,CAAC,KAAD,CAAQ,KAAI,UAAU,sCAAsC,SAAA,aAExD,CAAA,EACHO,IAAe,EAAAP,EAAA,IAAA,CAAC,IAAD,CAAG,UAAU,qBAAsB,SAAAO,CAAe,CAAA,GAClE,EAAAP,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,yCAA0C,UAAc,CAAA,CAChE,C,EAEb,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{_ as i,v as a}from"./states-ZhrxQa3K.js";var o={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};o.node;var s=n(o),c={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};c.node;var l=n(c),u=e(t(),1),d=r();function f(e,t){let n=[t.hint&&`${e}-hint`,t.error&&`${e}-error`].filter(Boolean);return{"aria-describedby":n.length?n.join(` `):void 0,"aria-invalid":t.error?!0:void 0}}function p({id:e,children:t}){return(0,d.jsxs)(`p`,{id:e,className:`flex items-start gap-1 text-xs text-danger`,"data-field-error":!0,children:[(0,d.jsx)(a,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0`}),(0,d.jsx)(`span`,{className:`min-w-0 whitespace-pre-line break-words`,children:t})]})}function m({label:e,hint:t,error:n,optional:r,id:a,className:o,children:s}){let c=(0,u.useId)(),l=a??c;return(0,d.jsxs)(`div`,{className:i(`flex w-full min-w-0 max-w-2xl flex-col gap-1`,o),children:[(0,d.jsxs)(`label`,{htmlFor:l,className:`text-sm font-medium`,children:[e,r&&(0,d.jsx)(`span`,{className:`font-normal text-muted`,children:` (optional)`})]}),typeof s==`function`?s({id:l,...f(l,{hint:!!t,error:n})}):s,t&&(0,d.jsx)(`p`,{id:`${l}-hint`,className:`text-xs text-muted`,children:t}),n&&(0,d.jsx)(p,{id:`${l}-error`,children:n})]})}export{s as a,l as i,p as n,f as r,m as t};
|
|
2
|
-
//# sourceMappingURL=Field-D-Ty7fKT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Field-D-Ty7fKT.js","names":["__iconData","useId","__toESM","require_react","require_jsx_runtime","cn","TriangleAlert","__iconData$1","ArrowLeft","createLucideIcon","__iconData","Trash","import_react","import_jsx_runtime","fieldControlProps","ids","opts","id","FieldError","Field","generated","controlId","className","label","optional","children","hint","error"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/arrow-left.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/trash.mjs","../../src/components/ui/Field.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"arrow-left\",\n size: 24,\n node: [\n [\"path\", { d: \"m12 19-7-7 7-7\", key: \"1l729n\" }],\n [\"path\", { d: \"M19 12H5\", key: \"x3x0zl\" }]\n ]\n};\n__iconData.node;\nconst ArrowLeft = createLucideIcon(__iconData);\n\nexport { __iconData, ArrowLeft as default };\n//# sourceMappingURL=arrow-left.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"trash\",\n size: 24,\n node: [\n [\"path\", { d: \"M10 11v6\", key: \"nco0om\" }],\n [\"path\", { d: \"M14 11v6\", key: \"outv1u\" }],\n [\"path\", { d: \"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\", key: \"miytrc\" }],\n [\"path\", { d: \"M3 6h18\", key: \"d0wm0j\" }],\n [\"path\", { d: \"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\", key: \"e791ji\" }]\n ],\n aliases: [\"trash-2\"]\n};\n__iconData.node;\nconst Trash = createLucideIcon(__iconData);\n\nexport { __iconData, Trash as default };\n//# sourceMappingURL=trash.mjs.map\n","import { TriangleAlert } from \"lucide-react\";\nimport { type ReactElement, type ReactNode, useId } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\n/** Props to spread on the control inside a Field. */\nexport interface FieldControlProps {\n id: string;\n \"aria-invalid\"?: true;\n \"aria-describedby\"?: string;\n}\n\nexport interface FieldProps {\n label: ReactNode;\n hint?: ReactNode;\n error?: string | null;\n /** Appends \" (optional)\" in muted text. */\n optional?: boolean;\n /** Control id; defaults to a generated one. */\n id?: string;\n className?: string;\n /** The control, or a render function that receives the props to spread on it. */\n children: ReactNode | ((p: FieldControlProps) => ReactElement);\n}\n\n/** aria-describedby / aria-invalid props for the control of a Field with this id. */\nexport function fieldControlProps(\n id: string,\n opts: { hint?: boolean; error?: string | null },\n): Omit<FieldControlProps, \"id\"> {\n const ids = [opts.hint && `${id}-hint`, opts.error && `${id}-error`].filter(Boolean);\n return {\n \"aria-describedby\": ids.length ? ids.join(\" \") : undefined,\n \"aria-invalid\": opts.error ? true : undefined,\n };\n}\n\n/** Inline field error with an icon (the icon keeps it from relying on colour). */\nexport function FieldError({ id, children }: { id?: string; children: ReactNode }) {\n return (\n <p id={id} className=\"flex items-start gap-1 text-xs text-danger\" data-field-error>\n <TriangleAlert aria-hidden className=\"mt-0.5 size-3.5 shrink-0\" />\n <span className=\"min-w-0 whitespace-pre-line break-words\">{children}</span>\n </p>\n );\n}\n\n/** Label, control, hint and error. Controls must use the `id` and described-by props. */\nexport function Field({ label, hint, error, optional, id, className, children }: FieldProps) {\n const generated = useId();\n const controlId = id ?? generated;\n return (\n <div className={cn(\"flex w-full min-w-0 max-w-2xl flex-col gap-1\", className)}>\n <label htmlFor={controlId} className=\"text-sm font-medium\">\n {label}\n {optional && <span className=\"font-normal text-muted\"> (optional)</span>}\n </label>\n {typeof children === \"function\"\n ? children({ id: controlId, ...fieldControlProps(controlId, { hint: !!hint, error }) })\n : children}\n {hint && (\n <p id={`${controlId}-hint`} className=\"text-xs text-muted\">\n {hint}\n </p>\n )}\n {error && <FieldError id={`${controlId}-error`}>{error}</FieldError>}\n </div>\n );\n}\n"],"ignoreList":[0,1],"mappings":"A,8GASA,IAAMA,EAAa,CACjB,KAAM,aACN,KAAM,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AMC,GAAA,EAAYnB,EAAAA,MAAAA,CAAM,EAClBoB,EAAYJ,GAAMG,EACxB,OACE,EAAAP,EAAA,KAAA,CAAC,MAAD,CAAK,UAAWR,EAAG,+CAAgDiB,CAAS,EAA5E,SAAA,EACE,EAAAT,EAAA,KAAA,CAAC,QAAD,CAAO,QAASQ,EAAW,UAAU,sBAArC,SAAA,CACGE,EACAC,IAAY,EAAAX,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,yBAAyB,SAAA,aAAiB,CAAA,CAClE,C,GACN,OAAOY,GAAa,WACjBA,EAAS,CAAE,GAAIJ,EAAW,GAAGP,EAAkBO,EAAW,CAAE,KAAM,CAAC,CAACK,EAAM,OAAM,CAAC,CAAE,CAAC,EACpFD,EACHC,IACC,EAAAb,EAAA,IAAA,CAAC,IAAD,CAAG,GAAI,GAAGQ,EAAU,OAAQ,UAAU,qBACnC,SAAAK,CACA,CAAA,EAEJC,IAAS,EAAAd,EAAA,IAAA,CAACK,EAAD,CAAY,GAAI,GAAGG,EAAU,QAAU,SAAAM,CAAkB,CAAA,CAChE,C,EAET,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{_ as i}from"./states-ZhrxQa3K.js";import{i as a}from"./Copy-B6XSAIUd.js";var o={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};o.node;var s=n(o),c={name:`panel-right-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]};c.node;var l=n(c),u=e(t(),1),d=r();function f({trigger:e,items:t,align:n=`end`,side:r=`bottom`,label:o,className:s}){let[c,l]=(0,u.useState)(!1),f=(0,u.useId)(),m=(0,u.useRef)(null),h=(0,u.useRef)(null),g=e=>p(h.current,e);(0,u.useEffect)(()=>{if(!c)return;requestAnimationFrame(()=>p(h.current,`first`));let e=e=>{!h.current?.contains(e.target)&&!m.current?.contains(e.target)&&l(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[c]);let _=(e=!0)=>{l(!1),e&&m.current?.focus()};return(0,d.jsxs)(`div`,{className:i(`relative inline-flex`,s),children:[e({ref:m,onClick:()=>l(e=>!e),onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),l(!0))},"aria-haspopup":`menu`,"aria-expanded":c,"aria-controls":f}),c&&(0,d.jsx)(`div`,{ref:h,id:f,role:`menu`,"aria-label":o,tabIndex:-1,className:i(`absolute z-40 min-w-48 max-w-[min(20rem,calc(100vw-1rem))] rounded-lg border border-border bg-surface py-1 shadow-pop`,r===`top`?`bottom-full mb-1`:`top-full mt-1`,n===`end`?`right-0`:`left-0`),onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),g(1)):e.key===`ArrowUp`?(e.preventDefault(),g(-1)):e.key===`Home`?(e.preventDefault(),g(`first`)):e.key===`End`?(e.preventDefault(),g(`last`)):e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),_()):e.key===`Tab`&&_(!1)},children:t.map((e,t)=>e===`separator`?(0,d.jsx)(`hr`,{className:`my-1 border-t border-border`},`sep-${t}`):`heading`in e?(0,d.jsx)(`div`,{role:`presentation`,className:`px-3 pt-1.5 pb-1 text-xs font-medium text-muted`,children:e.heading},e.id):(0,d.jsxs)(`button`,{type:`button`,role:e.kind===`radio`?`menuitemradio`:e.kind===`checkbox`?`menuitemcheckbox`:`menuitem`,"aria-checked":e.kind?!!e.checked:void 0,disabled:e.disabled,className:i(`tap flex w-full items-start gap-2 px-3 py-2 text-left text-sm hover:bg-surface-2 focus:bg-surface-2 focus:outline-none disabled:opacity-55`,e.danger?`text-danger`:`text-text`),onClick:()=>{_(),e.onSelect()},children:[e.kind?(0,d.jsx)(`span`,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0`,children:e.checked&&(0,d.jsx)(a,{className:`size-4`})}):e.icon&&(0,d.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e.icon}),(0,d.jsxs)(`span`,{className:`min-w-0`,children:[(0,d.jsx)(`span`,{className:`block`,children:e.label}),e.hint&&(0,d.jsx)(`span`,{className:`block text-xs text-muted`,children:e.hint})]})]},e.id))})]})}function p(e,t){let n=[...e?.querySelectorAll(`[role^="menuitem"]:not([disabled])`)??[]];if(n.length===0)return;let r=n.indexOf(document.activeElement),i=0;i=t===`first`?0:t===`last`?n.length-1:(r+t+n.length)%n.length,n[i].focus()}export{l as n,s as r,f as t};
|
|
2
|
-
//# sourceMappingURL=Menu-BfOszNC4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Menu-BfOszNC4.js","names":["__iconData","useState","useId","useRef","__toESM","require_react","require_jsx_runtime","cn","Check","__iconData$1","ChevronDown","createLucideIcon","__iconData","PanelRightOpen","import_react","import_jsx_runtime","Menu","open","setOpen","id","btnRef","menuRef","focusItem","focusMenuItem","dir","onDoc","close","refocus","className","trigger","o","label","side","align","items","item","i","els","menu","idx","next"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/chevron-down.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/panel-right-open.mjs","../../src/components/ui/Menu.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"chevron-down\",\n size: 24,\n node: [[\"path\", { d: \"m6 9 6 6 6-6\", key: \"qrunsl\" }]]\n};\n__iconData.node;\nconst ChevronDown = createLucideIcon(__iconData);\n\nexport { __iconData, ChevronDown as default };\n//# sourceMappingURL=chevron-down.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"panel-right-open\",\n size: 24,\n node: [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", key: \"afitv7\" }],\n [\"path\", { d: \"M15 3v18\", key: \"14nvp0\" }],\n [\"path\", { d: \"m10 15-3-3 3-3\", key: \"1pgupc\" }]\n ]\n};\n__iconData.node;\nconst PanelRightOpen = createLucideIcon(__iconData);\n\nexport { __iconData, PanelRightOpen as default };\n//# sourceMappingURL=panel-right-open.mjs.map\n","import { Check } from \"lucide-react\";\nimport { type ReactNode, useEffect, useId, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface MenuItem {\n id: string;\n label: string;\n icon?: ReactNode;\n onSelect: () => void;\n danger?: boolean;\n disabled?: boolean;\n /** Short explanation shown under the label (e.g. why it is disabled). */\n hint?: string;\n /** A radio or checkbox item shows a check mark when `checked`. */\n kind?: \"radio\" | \"checkbox\";\n checked?: boolean;\n}\n\n/** A non-interactive label above a group of items. */\nexport interface MenuHeading {\n id: string;\n heading: string;\n}\n\nexport interface MenuProps {\n /** Render the trigger; spread the given props onto a button. */\n trigger: (props: {\n ref: React.Ref<HTMLButtonElement>;\n onClick: () => void;\n onKeyDown: (e: React.KeyboardEvent) => void;\n \"aria-haspopup\": \"menu\";\n \"aria-expanded\": boolean;\n \"aria-controls\": string;\n }) => ReactNode;\n items: (MenuItem | MenuHeading | \"separator\")[];\n align?: \"start\" | \"end\";\n /** Open below (default) or above the trigger. */\n side?: \"bottom\" | \"top\";\n /** Extra classes for the wrapper (e.g. `w-full`). */\n className?: string;\n /** Accessible name of the menu. */\n label: string;\n}\n\n/** Popup menu with arrow-key navigation, Escape and outside click to close. */\nexport function Menu({\n trigger,\n items,\n align = \"end\",\n side = \"bottom\",\n label,\n className,\n}: MenuProps) {\n const [open, setOpen] = useState(false);\n const id = useId();\n const btnRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n\n const focusItem = (dir: 1 | -1 | \"first\" | \"last\") => focusMenuItem(menuRef.current, dir);\n\n useEffect(() => {\n if (!open) return;\n requestAnimationFrame(() => focusMenuItem(menuRef.current, \"first\"));\n const onDoc = (e: PointerEvent) => {\n if (\n !menuRef.current?.contains(e.target as Node) &&\n !btnRef.current?.contains(e.target as Node)\n ) {\n setOpen(false);\n }\n };\n document.addEventListener(\"pointerdown\", onDoc);\n return () => document.removeEventListener(\"pointerdown\", onDoc);\n }, [open]);\n\n const close = (refocus = true) => {\n setOpen(false);\n if (refocus) btnRef.current?.focus();\n };\n\n return (\n <div className={cn(\"relative inline-flex\", className)}>\n {trigger({\n ref: btnRef,\n onClick: () => setOpen((o) => !o),\n onKeyDown: (e) => {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n setOpen(true);\n }\n },\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": open,\n \"aria-controls\": id,\n })}\n {open && (\n <div\n ref={menuRef}\n id={id}\n role=\"menu\"\n aria-label={label}\n tabIndex={-1}\n className={cn(\n \"absolute z-40 min-w-48 max-w-[min(20rem,calc(100vw-1rem))] rounded-lg border border-border bg-surface py-1 shadow-pop\",\n side === \"top\" ? \"bottom-full mb-1\" : \"top-full mt-1\",\n align === \"end\" ? \"right-0\" : \"left-0\",\n )}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n focusItem(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n focusItem(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n focusItem(\"first\");\n } else if (e.key === \"End\") {\n e.preventDefault();\n focusItem(\"last\");\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n close();\n } else if (e.key === \"Tab\") {\n close(false);\n }\n }}\n >\n {items.map((item, i) =>\n item === \"separator\" ? (\n // biome-ignore lint/suspicious/noArrayIndexKey: separators have no identity\n <hr key={`sep-${i}`} className=\"my-1 border-t border-border\" />\n ) : \"heading\" in item ? (\n <div\n key={item.id}\n role=\"presentation\"\n className=\"px-3 pt-1.5 pb-1 text-xs font-medium text-muted\"\n >\n {item.heading}\n </div>\n ) : (\n // biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-checked is only set with the menuitemradio/menuitemcheckbox roles\n <button\n key={item.id}\n type=\"button\"\n role={\n item.kind === \"radio\"\n ? \"menuitemradio\"\n : item.kind === \"checkbox\"\n ? \"menuitemcheckbox\"\n : \"menuitem\"\n }\n aria-checked={item.kind ? !!item.checked : undefined}\n disabled={item.disabled}\n className={cn(\n \"tap flex w-full items-start gap-2 px-3 py-2 text-left text-sm hover:bg-surface-2 focus:bg-surface-2 focus:outline-none disabled:opacity-55\",\n item.danger ? \"text-danger\" : \"text-text\",\n )}\n onClick={() => {\n close();\n item.onSelect();\n }}\n >\n {item.kind ? (\n <span aria-hidden className=\"mt-0.5 size-4 shrink-0\">\n {item.checked && <Check className=\"size-4\" />}\n </span>\n ) : (\n item.icon && <span className=\"mt-0.5 shrink-0\">{item.icon}</span>\n )}\n <span className=\"min-w-0\">\n <span className=\"block\">{item.label}</span>\n {item.hint && <span className=\"block text-xs text-muted\">{item.hint}</span>}\n </span>\n </button>\n ),\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction focusMenuItem(menu: HTMLElement | null, dir: 1 | -1 | \"first\" | \"last\"): void {\n const els = [\n ...(menu?.querySelectorAll<HTMLElement>('[role^=\"menuitem\"]:not([disabled])') ?? []),\n ];\n if (els.length === 0) return;\n const idx = els.indexOf(document.activeElement as HTMLElement);\n let next = 0;\n if (dir === \"first\") next = 0;\n else if (dir === \"last\") next = els.length - 1;\n else next = (idx + dir + els.length) % els.length;\n els[next]!.focus();\n}\n"],"ignoreList":[0,1],"mappings":"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}from"./states-ZhrxQa3K.js";import{j as c,rt as l}from"./index-hxvDvCS7.js";var u=l(),d=e(t(),1),f=n(),p=(0,d.forwardRef)(function({label:e,icon:t,variant:n=`ghost`,size:i=`md`,className:a,type:o,...s},c){return(0,f.jsx)(`button`,{ref:c,type:o??`button`,"aria-label":e,title:e,className:r(`tap inline-flex shrink-0 items-center justify-center rounded-md border transition-colors`,`disabled:opacity-55 disabled:pointer-events-none`,i===`sm`?`size-8`:`size-9`,n===`ghost`&&`border-transparent text-muted hover:bg-surface-2 hover:text-text`,n===`secondary`&&`border-border bg-surface text-text hover:bg-surface-2`,n===`danger`&&`border-transparent text-danger hover:bg-danger-soft`,a),...s,children:t})}),m=`a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]`;function h(e){return[...e.querySelectorAll(m)].filter(e=>!e.hasAttribute(`inert`)&&e.getClientRects().length>0)}function g(e,t,n,r){let i=(0,d.useRef)(n);i.current=n;let a=(0,d.useRef)(null),o=(0,d.useRef)(!1);t&&!o.current&&typeof document<`u`&&(a.current=document.activeElement),o.current=t,(0,d.useEffect)(()=>{if(!t)return;let n=e.current;if(!n)return;let o=a.current,s=o&&!n.contains(o)?o:document.activeElement,c=r?.current??h(n)[0]??n,l=requestAnimationFrame(()=>{(r?.current||!n.contains(document.activeElement))&&c.focus({preventScroll:!0})}),u=e=>{if(e.key===`Escape`&&i.current){e.stopPropagation(),i.current();return}if(e.key!==`Tab`)return;let t=h(n);if(t.length===0){e.preventDefault(),n.focus();return}let r=t[0],a=t[t.length-1],o=document.activeElement;e.shiftKey&&(o===r||!n.contains(o))?(e.preventDefault(),a.focus()):e.shiftKey||o!==a&&n.contains(o)||(e.preventDefault(),r.focus())};return n.addEventListener(`keydown`,u),()=>{cancelAnimationFrame(l),n.removeEventListener(`keydown`,u),s&&document.contains(s)&&s.focus({preventScroll:!0})}},[t,e,r])}function _(e){(0,d.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e])}function v({placement:e,open:t,onClose:n,title:i,description:a,children:o,footer:s,initialFocus:l,dismissOnBackdrop:m=!0,headerActions:h,className:v,flush:y,bodyClassName:b,fullHeight:x,style:S}){let C=(0,d.useRef)(null),w=(0,d.useId)(),T=(0,d.useId)();return g(C,t,n,l),_(t),t?(0,u.createPortal)((0,f.jsxs)(`div`,{className:r(`fixed inset-0 z-50 flex`,e===`right`&&`justify-end`,e===`bottom`&&`items-end`,e===`center`&&`items-center justify-center p-4`),children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-overlay`,"aria-hidden":!0,onClick:m?n:void 0}),(0,f.jsxs)(`div`,{ref:C,role:`dialog`,"aria-modal":`true`,"aria-labelledby":w,"aria-describedby":a?T:void 0,tabIndex:-1,style:S,className:r(`relative flex flex-col bg-surface text-text shadow-pop outline-none`,e===`right`&&`h-full max-w-full border-l border-border safe-pt safe-pb`,e===`bottom`&&(x?`h-dvh w-full safe-pt safe-pb`:`max-h-[90dvh] w-full rounded-t-xl border-t border-border safe-pb`),e===`center`&&`max-h-[min(90dvh,720px)] w-full max-w-lg rounded-xl border border-border`,v),children:[e===`bottom`&&!x&&(0,f.jsx)(`div`,{className:`flex justify-center pt-2`,"aria-hidden":!0,children:(0,f.jsx)(`div`,{className:`h-1 w-10 rounded-full bg-border-strong`})}),(0,f.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-border px-4 py-3`,children:[(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(`h2`,{id:w,className:`text-base font-semibold leading-6`,children:i}),a&&(0,f.jsx)(`p`,{id:T,className:`text-sm text-muted`,children:a})]}),h,(0,f.jsx)(p,{label:`Close`,icon:(0,f.jsx)(c,{className:`size-4`}),onClick:n})]}),(0,f.jsx)(`div`,{className:r(`min-h-0 flex-1 overflow-y-auto overscroll-contain`,!y&&`px-4 py-3`,b),children:o}),s&&(0,f.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3`,children:s})]})]}),document.body):null}function y({width:e=520,...t}){return(0,f.jsx)(v,{...t,placement:`right`,style:{width:`min(${e}px, 100vw)`}})}function b(e){return(0,f.jsx)(v,{...e,placement:`bottom`})}function x(e){return(0,f.jsx)(v,{...e,placement:`center`})}function S({open:e,onClose:t,title:n,description:r,confirmLabel:c,onConfirm:l,busy:u,error:d,errorTitle:p,danger:m=!0,confirmIcon:h,confirmDisabled:g,disabledReason:_,children:v}){return(0,f.jsx)(x,{open:e,onClose:u?()=>void 0:t,dismissOnBackdrop:!u,title:n,description:r,footer:(0,f.jsxs)(f.Fragment,{children:[g&&_&&(0,f.jsx)(`p`,{className:`mr-auto min-w-0 flex-1 basis-full text-xs text-muted sm:basis-auto`,children:_}),(0,f.jsx)(a,{onClick:t,disabled:u,children:`Cancel`}),(0,f.jsx)(a,{variant:m?`danger`:`primary`,icon:h,busy:u,disabled:g,onClick:l,children:c})]}),children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v,p?!!d&&(0,f.jsx)(o,{compact:!0,title:p,error:s(d)}):(0,f.jsx)(i,{error:d})]})})}export{g as a,b as i,x as n,p as o,y as r,S as t};
|
|
2
|
-
//# sourceMappingURL=Overlay-DUQwh6_b.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Overlay-DUQwh6_b.js","names":["forwardRef","useRef","useRef","useId","createPortal","_Fragment","__toESM","require_react","require_jsx_runtime","cn","InlineError","Button","ErrorState","errorMessage","X","require_react_dom","import_react_dom","import_react","import_jsx_runtime","IconButton","rest","type","label","size","variant","className","icon","FOCUSABLE","focusableWithin","root","el","useFocusTrap","escRef","onEscape","triggerRef","wasActive","active","ref","captured","previous","target","initialFocus","raf","onKey","items","first","last","activeEl","useScrollLock","prev","Surface","titleId","descId","open","onClose","placement","dismissOnBackdrop","description","fullHeight","title","headerActions","flush","bodyClassName","footer","Drawer","props","width","Sheet","Dialog","ConfirmDialog","busy","confirmDisabled","disabledReason","danger","confirmIcon","onConfirm","confirmLabel","children","errorTitle","error"],"sources":["../../src/components/ui/IconButton.tsx","../../src/components/ui/useFocusTrap.ts","../../src/components/ui/Overlay.tsx"],"sourcesContent":["import { type ButtonHTMLAttributes, forwardRef, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"aria-label\"> {\n /** Accessible name (also the tooltip). Required: icon-only controls need a label. */\n label: string;\n icon: ReactNode;\n variant?: \"ghost\" | \"secondary\" | \"danger\";\n size?: \"sm\" | \"md\";\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { label, icon, variant = \"ghost\", size = \"md\", className, type, ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type ?? \"button\"}\n aria-label={label}\n title={label}\n className={cn(\n \"tap inline-flex shrink-0 items-center justify-center rounded-md border transition-colors\",\n \"disabled:opacity-55 disabled:pointer-events-none\",\n size === \"sm\" ? \"size-8\" : \"size-9\",\n variant === \"ghost\" && \"border-transparent text-muted hover:bg-surface-2 hover:text-text\",\n variant === \"secondary\" && \"border-border bg-surface text-text hover:bg-surface-2\",\n variant === \"danger\" && \"border-transparent text-danger hover:bg-danger-soft\",\n className,\n )}\n {...rest}\n >\n {icon}\n </button>\n );\n});\n","import { type RefObject, useEffect, useRef } from \"react\";\n\nconst FOCUSABLE =\n 'a[href], area[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]';\n\nexport function focusableWithin(root: HTMLElement): HTMLElement[] {\n return [...root.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(\n (el) => !el.hasAttribute(\"inert\") && el.getClientRects().length > 0,\n );\n}\n\n/**\n * Modal focus management: moves focus into `ref` when `active`, keeps Tab\n * inside it, closes on Escape, and returns focus to the element that had it\n * (the trigger) when deactivated.\n */\nexport function useFocusTrap(\n ref: RefObject<HTMLElement | null>,\n active: boolean,\n onEscape?: () => void,\n initialFocus?: RefObject<HTMLElement | null>,\n): void {\n const escRef = useRef(onEscape);\n escRef.current = onEscape;\n // Remember the trigger while rendering the opening frame: by the time effects run, an\n // `autoFocus` field inside the surface has already taken focus.\n const triggerRef = useRef<HTMLElement | null>(null);\n const wasActive = useRef(false);\n if (active && !wasActive.current && typeof document !== \"undefined\") {\n triggerRef.current = document.activeElement as HTMLElement | null;\n }\n wasActive.current = active;\n useEffect(() => {\n if (!active) return;\n const root = ref.current;\n if (!root) return;\n const captured = triggerRef.current;\n const previous =\n captured && !root.contains(captured)\n ? captured\n : (document.activeElement as HTMLElement | null);\n const target = initialFocus?.current ?? focusableWithin(root)[0] ?? root;\n // Defer so the element is laid out (portals, transitions).\n // An `autoFocus` field inside keeps its focus unless an explicit initial focus was given.\n const raf = requestAnimationFrame(() => {\n if (!initialFocus?.current && root.contains(document.activeElement)) return;\n target.focus({ preventScroll: true });\n });\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\" && escRef.current) {\n e.stopPropagation();\n escRef.current();\n return;\n }\n if (e.key !== \"Tab\") return;\n const items = focusableWithin(root);\n if (items.length === 0) {\n e.preventDefault();\n root.focus();\n return;\n }\n const first = items[0]!;\n const last = items[items.length - 1]!;\n const activeEl = document.activeElement;\n if (e.shiftKey && (activeEl === first || !root.contains(activeEl))) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && (activeEl === last || !root.contains(activeEl))) {\n e.preventDefault();\n first.focus();\n }\n };\n root.addEventListener(\"keydown\", onKey);\n return () => {\n cancelAnimationFrame(raf);\n root.removeEventListener(\"keydown\", onKey);\n if (previous && document.contains(previous)) previous.focus({ preventScroll: true });\n };\n }, [active, ref, initialFocus]);\n}\n\n/** Lock body scroll while a modal surface is open. */\nexport function useScrollLock(active: boolean): void {\n useEffect(() => {\n if (!active) return;\n const prev = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n return () => {\n document.body.style.overflow = prev;\n };\n }, [active]);\n}\n","import { X } from \"lucide-react\";\nimport { type ReactNode, type RefObject, useId, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../../lib/cn\";\nimport { errorMessage } from \"../../sync/api\";\nimport { Button } from \"./Button\";\nimport { IconButton } from \"./IconButton\";\nimport { ErrorState, InlineError } from \"./states\";\nimport { useFocusTrap, useScrollLock } from \"./useFocusTrap\";\n\nexport interface OverlayProps {\n open: boolean;\n onClose: () => void;\n /** Visible heading; also the accessible name. */\n title: ReactNode;\n /** Accessible description shown under the title. */\n description?: ReactNode;\n children?: ReactNode;\n /** Sticky footer (actions). */\n footer?: ReactNode;\n /** Element to focus first (defaults to the first focusable). */\n initialFocus?: RefObject<HTMLElement | null>;\n /** Close when the backdrop is clicked (default true). */\n dismissOnBackdrop?: boolean;\n /** Extra header controls before the close button. */\n headerActions?: ReactNode;\n className?: string;\n /** No padding around the body (for content that draws its own edges). */\n flush?: boolean;\n /** Extra body classes. Additive only: it cannot override the padding, use `flush`. */\n bodyClassName?: string;\n /** Bottom sheet only: fill the viewport height. */\n fullHeight?: boolean;\n}\n\ntype Placement = \"right\" | \"bottom\" | \"center\";\n\nfunction Surface({\n placement,\n open,\n onClose,\n title,\n description,\n children,\n footer,\n initialFocus,\n dismissOnBackdrop = true,\n headerActions,\n className,\n flush,\n bodyClassName,\n fullHeight,\n style,\n}: OverlayProps & { placement: Placement; style?: React.CSSProperties }) {\n const ref = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const descId = useId();\n useFocusTrap(ref, open, onClose, initialFocus);\n useScrollLock(open);\n if (!open) return null;\n return createPortal(\n <div\n className={cn(\n \"fixed inset-0 z-50 flex\",\n placement === \"right\" && \"justify-end\",\n placement === \"bottom\" && \"items-end\",\n placement === \"center\" && \"items-center justify-center p-4\",\n )}\n >\n <div\n className=\"absolute inset-0 bg-overlay\"\n aria-hidden\n onClick={dismissOnBackdrop ? onClose : undefined}\n />\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={description ? descId : undefined}\n tabIndex={-1}\n style={style}\n className={cn(\n \"relative flex flex-col bg-surface text-text shadow-pop outline-none\",\n placement === \"right\" && \"h-full max-w-full border-l border-border safe-pt safe-pb\",\n placement === \"bottom\" &&\n (fullHeight\n ? \"h-dvh w-full safe-pt safe-pb\"\n : \"max-h-[90dvh] w-full rounded-t-xl border-t border-border safe-pb\"),\n placement === \"center\" &&\n \"max-h-[min(90dvh,720px)] w-full max-w-lg rounded-xl border border-border\",\n className,\n )}\n >\n {placement === \"bottom\" && !fullHeight && (\n <div className=\"flex justify-center pt-2\" aria-hidden>\n <div className=\"h-1 w-10 rounded-full bg-border-strong\" />\n </div>\n )}\n <div className=\"flex items-start gap-2 border-b border-border px-4 py-3\">\n <div className=\"min-w-0 flex-1\">\n <h2 id={titleId} className=\"text-base font-semibold leading-6\">\n {title}\n </h2>\n {description && (\n <p id={descId} className=\"text-sm text-muted\">\n {description}\n </p>\n )}\n </div>\n {headerActions}\n <IconButton label=\"Close\" icon={<X className=\"size-4\" />} onClick={onClose} />\n </div>\n <div\n className={cn(\n \"min-h-0 flex-1 overflow-y-auto overscroll-contain\",\n !flush && \"px-4 py-3\",\n bodyClassName,\n )}\n >\n {children}\n </div>\n {footer && (\n <div className=\"flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3\">\n {footer}\n </div>\n )}\n </div>\n </div>,\n document.body,\n );\n}\n\nexport interface DrawerProps extends OverlayProps {\n /** Width in px (default 520, the task drawer width). Never wider than the viewport. */\n width?: number;\n}\n\n/** Right-side drawer with focus trap, Escape to close, and focus returned to the trigger. */\nexport function Drawer({ width = 520, ...props }: DrawerProps) {\n return <Surface {...props} placement=\"right\" style={{ width: `min(${width}px, 100vw)` }} />;\n}\n\n/** Bottom sheet for mobile; same accessibility behavior as Drawer. */\nexport function Sheet(props: OverlayProps) {\n return <Surface {...props} placement=\"bottom\" />;\n}\n\n/** Centered modal dialog. */\nexport function Dialog(props: OverlayProps) {\n return <Surface {...props} placement=\"center\" />;\n}\n\nexport interface ConfirmDialogProps {\n open: boolean;\n onClose: () => void;\n title: ReactNode;\n description?: ReactNode;\n confirmLabel: string;\n onConfirm: () => void;\n busy?: boolean;\n error?: unknown;\n /** Heading for the error; renders a titled error panel instead of the plain message. */\n errorTitle?: string;\n danger?: boolean;\n /** Icon before the confirm label. */\n confirmIcon?: ReactNode;\n confirmDisabled?: boolean;\n /** Shown next to the actions when the confirm button is disabled. */\n disabledReason?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * Confirmation dialog. Never closes on its own: the caller closes it after the\n * server acknowledges (no optimistic success). It cannot be dismissed while busy.\n */\nexport function ConfirmDialog({\n open,\n onClose,\n title,\n description,\n confirmLabel,\n onConfirm,\n busy,\n error,\n errorTitle,\n danger = true,\n confirmIcon,\n confirmDisabled,\n disabledReason,\n children,\n}: ConfirmDialogProps) {\n return (\n <Dialog\n open={open}\n onClose={busy ? () => undefined : onClose}\n dismissOnBackdrop={!busy}\n title={title}\n description={description}\n footer={\n <>\n {confirmDisabled && disabledReason && (\n <p className=\"mr-auto min-w-0 flex-1 basis-full text-xs text-muted sm:basis-auto\">\n {disabledReason}\n </p>\n )}\n <Button onClick={onClose} disabled={busy}>\n Cancel\n </Button>\n <Button\n variant={danger ? \"danger\" : \"primary\"}\n icon={confirmIcon}\n busy={busy}\n disabled={confirmDisabled}\n onClick={onConfirm}\n >\n {confirmLabel}\n </Button>\n </>\n }\n >\n <div className=\"flex flex-col gap-3\">\n {children}\n {errorTitle ? (\n !!error && <ErrorState compact title={errorTitle} error={errorMessage(error)} />\n ) : (\n <InlineError error={error} />\n )}\n </div>\n </Dialog>\n );\n}\n"],"mappings":"A,6MAYamB,GAAA,EAAanB,EAAAA,WAAAA,CAA+C,SACvE,CAAE,QAA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ACN,SAAUH,EACV,QAASI,EAER,SAAAC,CACK,CAAA,CACR,CAAA,CAAA,EAGJ,UAAA,EAAA1D,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,sBAAf,SAAA,CACG2D,EACAC,EACC,CAAC,CAACC,IAAS,EAAA7D,EAAA,IAAA,CAACN,EAAD,CAAY,QAAA,GAAQ,MAAOkE,EAAY,MAAOjE,EAAakE,CAAK,CAAI,CAAA,GAE/E,EAAA7D,EAAA,IAAA,CAACR,EAAD,CAAoB,OAAQ,CAAA,CAE3B,C,EACC,CAAA,CAEZ,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./jsx-runtime-D13aM9HY.js";import{_ as n,lt as r}from"./states-ZhrxQa3K.js";import{t as i}from"./arrow-down-C-iLrN8I.js";import{t as a}from"./arrow-up-Dj-VTKx4.js";import{A as o}from"./index-hxvDvCS7.js";import{t as s}from"./Select-Cfql4Nwu.js";var c={name:`chevrons-up`,size:24,node:[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]};c.node;var l=e(c),u={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};u.node;var d=e(u),f=t(),p={0:{label:r[0],icon:l,tone:`danger`},1:{label:r[1],icon:a,tone:`warning`},2:{label:r[2],icon:d,tone:`neutral`},3:{label:r[3],icon:i,tone:`neutral`}};function m({priority:e,className:t,colored:r=!0}){let i=p[e]??p[2],a=i.icon;return(0,f.jsx)(a,{"aria-hidden":!0,className:n(`shrink-0`,r&&o[i.tone],t??`size-4`)})}function h({priority:e,className:t,suffix:r,muted:i}){let a=p[e]??p[2];return(0,f.jsxs)(`span`,{className:n(`inline-flex items-center gap-1`,i?`text-muted`:o[a.tone],t),children:[(0,f.jsx)(m,{priority:e,className:`size-3.5`}),a.label,r]})}function g({value:e,onChange:t,...n}){return(0,f.jsx)(s,{...n,value:e,onChange:e=>t(Number(e.target.value)),children:r.map((e,t)=>(0,f.jsx)(`option`,{value:t,children:e},e))})}export{h as n,g as r,m as t};
|
|
2
|
-
//# sourceMappingURL=Priority-CHmzfoHg.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,n as r,t as i}from"./jsx-runtime-D13aM9HY.js";import{b as a,c as o,d as s,f as c,gt as l,h as u,i as d,j as f,n as p,s as m,t as h,u as g,vt as _,yt as v,z as y}from"./states-ZhrxQa3K.js";import{t as b}from"./external-link-3jjTxo92.js";import{n as x,t as S}from"./InteractionCard-DF1EcSpm.js";import{t as C}from"./server-BqZ-w6M8.js";import{T as w,V as T,X as E,Z as D,b as O,c as k,v as A,x as j}from"./index-hxvDvCS7.js";import{t as M}from"./SegmentedControl-C_hEVQMB.js";import{r as N}from"./useResource-CDGSq2At.js";var P={name:`list-todo`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]};P.node;var F=r(P),I=e(n(),1),L=[`needs_input`,`failed`,`ready_for_review`,`unsupported_interaction`,`host_unreachable`];function R(e){let t=Object.fromEntries(L.map(e=>[e,[]]));for(let n of e)t[n.reason]?.push(n);return t}function z(e){return e===`dismissed`||e===`history`?e:`open`}function B(e,t){return t===`history`?[]:e.filter(e=>t===`open`?!e.acknowledgedAt:!!e.acknowledgedAt)}function V(e,t,n){return[e?.name,t?.title,n&&n.title!==t?.title?n.title:null].filter(Boolean).join(` · `)||`Switchyard`}function H(e){let t=N(e?`attention-history`:null,e=>l(`/api/attention`,{resolvedOnly:`true`,limit:200},e),{refreshMs:3e4,check:Array.isArray}),n=y(e=>e.attention),r=(0,I.useRef)(!0),{reload:i}=t;return(0,I.useEffect)(()=>{if(r.current){r.current=!1;return}if(!e)return;let t=setTimeout(i,500);return()=>clearTimeout(t)},[n,e,i]),t}var U=i(),W={needs_input:`Questions from Pi waiting for your answer.`,failed:`Runs that failed or were blocked. Open the task to see why.`,ready_for_review:`Finished runs waiting for your review.`,unsupported_interaction:`Questions this client cannot display. Answer them in a terminal attached to the session.`,host_unreachable:`Running work on hosts that stopped responding. Nothing is restarted elsewhere.`};function G(){let e=f(),t=y(e=>e.hydrated),[n,r]=A(`attentionShow`,`open`),i=z(n),s=e=>r(e),c=(0,I.useMemo)(()=>B(e,i),[e,i]),l=(0,I.useMemo)(()=>B(e,`dismissed`).length,[e]),u=(0,I.useMemo)(()=>R(c),[c]),d=H(i===`history`);return(0,U.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-4 px-4 pb-4 safe-pt-4 md:px-6`,children:[(0,U.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,U.jsx)(`h1`,{className:`flex-1 text-lg font-semibold`,children:`Attention`}),(0,U.jsx)(M,{label:`Show`,className:`max-sm:w-full max-sm:basis-full`,value:i,onChange:s,options:[{value:`open`,label:`Open`},{value:`dismissed`,label:`Dismissed`},{value:`history`,label:`History`}]})]}),(0,U.jsx)(m,{subject:`attention items`,consequence:`Answers are sent once the connection is back.`,show:t}),i===`history`?(0,U.jsx)(`div`,{"data-testid":`attention-history`,className:`flex min-w-0 flex-col gap-2`,children:!d.data&&d.loading?(0,U.jsx)(o,{label:`Loading history…`}):!d.data&&d.error?(0,U.jsx)(p,{compact:!0,title:`Could not load history`,error:v(d.error),onRetry:d.reload}):!d.data||d.data.length===0?(0,U.jsx)(h,{icon:(0,U.jsx)(a,{className:`size-8`}),title:`No history yet`,description:`Resolved questions, failures and reviews show up here.`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-2`,children:d.data.map(e=>(0,U.jsx)(`li`,{className:`min-w-0`,children:(0,U.jsx)(q,{item:e})},e.id))}),d.data.length>=200&&(0,U.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Showing the `,200,` most recent.`]})]})}):t?c.length===0?i===`dismissed`?(0,U.jsx)(h,{icon:(0,U.jsx)(D,{className:`size-8`}),title:`No dismissed items`,description:`Items you dismiss stay here until their question or task is resolved.`,action:{label:`Show open`,onClick:()=>s(`open`)}}):(0,U.jsx)(h,{icon:(0,U.jsx)(D,{className:`size-8`}),title:l>0?`All caught up`:`Nothing needs your attention`,description:l>0?`${l} dismissed ${l===1?`item is`:`items are`} still open.`:`Questions, failures and finished work show up here.`,action:l>0?{label:`Show dismissed`,onClick:()=>s(`dismissed`)}:{label:`Go to Sessions`,to:k.code},secondaryAction:l>0?{label:`Go to Sessions`,to:k.code}:{label:`Go to Board`,to:k.board}}):L.filter(e=>u[e].length>0).map(e=>{let t=j[e],n=t.icon;return(0,U.jsxs)(`section`,{"data-testid":`attention-group-${e}`,"aria-labelledby":`att-${e}`,className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h2`,{id:`att-${e}`,className:`flex items-center gap-2 text-base font-semibold`,children:[(0,U.jsx)(n,{"aria-hidden":!0,className:`size-4 text-muted`}),t.label,(0,U.jsxs)(`span`,{className:`text-sm font-normal text-muted`,children:[`(`,u[e].length,`)`]})]}),(0,U.jsx)(`p`,{className:`text-sm text-muted`,children:W[e]})]}),(0,U.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-2`,children:u[e].map(e=>(0,U.jsx)(`li`,{className:`min-w-0`,children:(0,U.jsx)(K,{item:e})},e.id))})]},e)}):(0,U.jsx)(o,{label:`Loading attention…`})]})}function K({item:e}){let n=y(t=>e.projectId?t.projects[e.projectId]:void 0),r=y(t=>e.taskId?t.tasks[e.taskId]:void 0),i=y(t=>e.sessionId?t.sessions[e.sessionId]:void 0),a=y(e=>i?e.hosts[i.hostId]:void 0),o=y(t=>e.interactionId?t.interactions[e.interactionId]:void 0),[l,f]=(0,I.useState)(!1),[m,h]=(0,I.useState)(null),D=async()=>{f(!0),h(null);try{let t=await _(`/api/attention/${encodeURIComponent(e.id)}/acknowledge`),n=t&&typeof t==`object`&&`id`in t?t:{...e,acknowledgedAt:new Date().toISOString()};y.setState(t=>t.attention[e.id]?{attention:{...t.attention,[e.id]:n}}:{}),O.success(`Dismissed. It stays under All until the task or question is resolved.`)}catch(e){h(e)}finally{f(!1)}},A=e.sessionId?e.interactionId?k.interaction(e.sessionId,e.interactionId):k.session(e.sessionId):null,M=!!a&&a.connectivity!==`connected`,N=null;switch(e.reason){case`needs_input`:N=o&&o.state===`pending`?(0,U.jsx)(S,{flush:!0,interaction:o,readOnlyReason:M?`Host ${a?.name} is offline. You can answer once it reconnects.`:i?.readOnly?`This session is read-only.`:null}):o?(0,U.jsx)(S,{flush:!0,interaction:o}):A?(0,U.jsxs)(t,{to:A,className:c(`primary`,`sm`),children:[(0,U.jsx)(b,{"aria-hidden":!0,className:`size-3.5`}),`Answer in session`]}):null;break;case`failed`:N=e.taskId?(0,U.jsxs)(t,{to:k.task(e.taskId),className:c(`primary`,`sm`),children:[(0,U.jsx)(F,{"aria-hidden":!0,className:`size-3.5`}),`Open task`]}):null;break;case`ready_for_review`:N=e.sessionId?(0,U.jsxs)(t,{to:`${k.session(e.sessionId)}?tab=changes`,className:c(`primary`,`sm`),children:[(0,U.jsx)(T,{"aria-hidden":!0,className:`size-3.5`}),`Review changes`]}):e.taskId?(0,U.jsxs)(t,{to:k.task(e.taskId),className:c(`primary`,`sm`),children:[(0,U.jsx)(T,{"aria-hidden":!0,className:`size-3.5`}),`Open review`]}):null;break;case`unsupported_interaction`:N=o?(0,U.jsx)(S,{interaction:o,readOnlyReason:M?`Host ${a?.name} is offline. You can choose once it reconnects.`:i?.readOnly?`This session is read-only.`:null}):(0,U.jsx)(g,{capability:`This dialog`,reason:`An extension opened a terminal-only dialog. In RPC mode Pi gave it no answer, so the extension continued without one.`});break;case`host_unreachable`:N=a?(0,U.jsx)(d,{compact:!0,hostName:a.name,connectivity:a.connectivity===`reconnecting`?`reconnecting`:`unreachable`,lastSeenAt:a.lastSeenAt}):null}let P=V(n,r,i),L=!!o&&(e.reason===`needs_input`||e.reason===`unsupported_interaction`);return e.reason===`needs_input`&&o?.state===`pending`&&x(o.presentation)?(0,U.jsxs)(`article`,{"aria-label":`Plan awaiting approval: ${P}`,className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted`,children:[(0,U.jsx)(`span`,{className:`min-w-0 basis-full truncate sm:basis-auto sm:flex-1`,children:P}),A&&(0,U.jsxs)(t,{to:A,className:c(`ghost`,`sm`),children:[(0,U.jsx)(b,{"aria-hidden":!0,className:`size-3.5`}),`Open session`]}),(0,U.jsx)(`time`,{dateTime:e.createdAt,className:`shrink-0 text-xs text-subtle sm:ml-auto`,children:u(e.createdAt)}),!e.acknowledgedAt&&(0,U.jsx)(s,{size:`sm`,variant:`ghost`,busy:l,onClick:()=>void D(),children:`Dismiss`})]}),N,m!==null&&(0,U.jsx)(p,{compact:!0,title:`Could not dismiss`,error:v(m),onRetry:()=>void D()})]}):(0,U.jsxs)(`article`,{"aria-label":`${j[e.reason].label}: ${r?.title??i?.title??e.summary}`,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(w,{kind:`attention`,value:e.reason,size:`sm`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted`,children:P}),(0,U.jsx)(`time`,{dateTime:e.createdAt,className:`shrink-0 text-xs text-subtle`,children:u(e.createdAt)})]}),!L&&(0,U.jsx)(`p`,{className:`min-w-0 text-sm break-words`,children:e.summary}),N&&(0,U.jsx)(`div`,{className:`flex min-w-0 flex-col items-start`,children:N}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.reason!==`failed`&&e.taskId&&(0,U.jsxs)(t,{to:k.task(e.taskId),className:c(`ghost`,`sm`),children:[(0,U.jsx)(F,{"aria-hidden":!0,className:`size-3.5`}),`Task`]}),A&&(0,U.jsxs)(t,{to:A,className:c(`ghost`,`sm`),children:[(0,U.jsx)(b,{"aria-hidden":!0,className:`size-3.5`}),`Open session`]}),e.reason===`host_unreachable`&&a&&(0,U.jsxs)(t,{to:`${k.settings(`hosts`)}/${encodeURIComponent(a.id)}`,className:c(`ghost`,`sm`),children:[(0,U.jsx)(C,{"aria-hidden":!0,className:`size-3.5`}),`Host details`]}),(0,U.jsx)(`span`,{className:`ml-auto`}),e.acknowledgedAt?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted`,children:[(0,U.jsx)(E,{"aria-hidden":!0,className:`size-3.5`}),`Dismissed `,u(e.acknowledgedAt)]}):(0,U.jsx)(s,{size:`sm`,busy:l,onClick:()=>void D(),children:`Dismiss`})]}),m!==null&&(0,U.jsx)(p,{compact:!0,title:`Could not dismiss`,error:v(m),onRetry:()=>void D()})]})}function q({item:e}){let n=y(t=>e.projectId?t.projects[e.projectId]:void 0),r=y(t=>e.taskId?t.tasks[e.taskId]:void 0),i=y(t=>e.sessionId?t.sessions[e.sessionId]:void 0);return(0,U.jsxs)(`article`,{"aria-label":`${j[e.reason].label}: ${r?.title??i?.title??e.summary}`,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(w,{kind:`attention`,value:e.reason,size:`sm`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted`,children:V(n,r,i)}),e.resolvedAt&&(0,U.jsxs)(`time`,{dateTime:e.resolvedAt,className:`shrink-0 text-xs text-subtle`,children:[`Resolved `,u(e.resolvedAt)]})]}),(0,U.jsx)(`p`,{className:`min-w-0 text-sm break-words`,children:e.summary}),(e.taskId||e.sessionId)&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.taskId&&(0,U.jsxs)(t,{to:k.task(e.taskId),className:c(`ghost`,`sm`),children:[(0,U.jsx)(F,{"aria-hidden":!0,className:`size-3.5`}),`Task`]}),e.sessionId&&(0,U.jsxs)(t,{to:k.session(e.sessionId),className:c(`ghost`,`sm`),children:[(0,U.jsx)(b,{"aria-hidden":!0,className:`size-3.5`}),`Open session`]})]})]})}export{G as default};
|
|
2
|
-
//# sourceMappingURL=attention-V86Gye3I.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attention-V86Gye3I.js","names":["useRef","useMemo","History","_Fragment","useState","__toESM","Link","require_react","createLucideIcon","require_jsx_runtime","RotateCcwClock","LoadingState","Button","buttonClasses","apiGet","formatRelative","HostUnavailable","useOpenAttention","ErrorState","LastKnownNote","EmptyState","UnsupportedCapability","apiPost","errorMessage","useSyncStore","ExternalLink","isDocumentPresentation","InteractionCard","Server","StatusChip","Eye","CircleCheck","Bell","toast","ROUTES","useFilter","ATTENTION_STATUS","SegmentedControl","useResource","__iconData","ListTodo","import_react","ATTENTION_GROUPS","groupAttention","out","r","a","items","normalizeShow","v","visibleAttention","show","all","attentionMeta","project","task","session","useAttentionHistory","res","enabled","signal","attention","s","first","reload","import_jsx_runtime","GROUP_HINT","AttentionView","hydrated","stored","setStored","setShow","dismissedCount","groups","history","HistoryRow","info","reason","Icon","AttentionRow","item","host","interaction","busy","setBusy","ackError","setAckError","acknowledge","next","sessionHref","hostOffline","action","metaText","showsCard"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/list-todo.mjs","../../src/features/attention/logic.ts","../../src/features/attention/useAttentionHistory.ts","../../src/features/attention/index.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"list-todo\",\n size: 24,\n node: [\n [\"path\", { d: \"M13 5h8\", key: \"a7qcls\" }],\n [\"path\", { d: \"M13 12h8\", key: \"h98zly\" }],\n [\"path\", { d: \"M13 19h8\", key: \"c3s6r1\" }],\n [\"path\", { d: \"m3 17 2 2 4-4\", key: \"1jhpwq\" }],\n [\"rect\", { x: \"3\", y: \"4\", width: \"6\", height: \"6\", rx: \"1\", key: \"cif1o7\" }]\n ]\n};\n__iconData.node;\nconst ListTodo = createLucideIcon(__iconData);\n\nexport { __iconData, ListTodo as default };\n//# sourceMappingURL=list-todo.mjs.map\n","import type { AttentionItem, AttentionReason, Project, Session, Task } from \"@switchyard/protocol\";\n\nexport const ATTENTION_GROUPS: AttentionReason[] = [\n \"needs_input\",\n \"failed\",\n \"ready_for_review\",\n \"unsupported_interaction\",\n \"host_unreachable\",\n];\n\n/** Group open attention by reason, keeping the input order within a group. */\nexport function groupAttention(items: AttentionItem[]): Record<AttentionReason, AttentionItem[]> {\n const out = Object.fromEntries(ATTENTION_GROUPS.map((r) => [r, [] as AttentionItem[]])) as Record<\n AttentionReason,\n AttentionItem[]\n >;\n for (const a of items) out[a.reason]?.push(a);\n return out;\n}\n\nexport type AttentionShow = \"open\" | \"dismissed\" | \"history\";\n\n/** Stored prefs from before History: \"all\" (open + dismissed) and unknown values read as \"open\". */\nexport function normalizeShow(v: unknown): AttentionShow {\n return v === \"dismissed\" || v === \"history\" ? v : \"open\";\n}\n\n/** Unacknowledged items for \"open\", acknowledged for \"dismissed\"; [] for \"history\". */\nexport function visibleAttention(all: AttentionItem[], show: AttentionShow): AttentionItem[] {\n if (show === \"history\") return [];\n return all.filter((a) => (show === \"open\" ? !a.acknowledgedAt : !!a.acknowledgedAt));\n}\n\n/** \"project · task · session\" (session only when its title differs from the task's), else \"Switchyard\". */\nexport function attentionMeta(project?: Project, task?: Task, session?: Session): string {\n return (\n [project?.name, task?.title, session && session.title !== task?.title ? session.title : null]\n .filter(Boolean)\n .join(\" · \") || \"Switchyard\"\n );\n}\n","import type { AttentionItem } from \"@switchyard/protocol\";\nimport { useEffect, useRef } from \"react\";\nimport { type Resource, useResource } from \"../../lib/useResource\";\nimport { apiGet } from \"../../sync/api\";\nimport { useSyncStore } from \"../../sync/store\";\n\nexport const HISTORY_LIMIT = 200;\n\n/**\n * Resolved attention items, newest first. The sync store drops resolved items, so they come\n * from the API; refetched when open attention changes (debounced) and every 30 s.\n */\nexport function useAttentionHistory(enabled: boolean): Resource<AttentionItem[]> {\n const res = useResource<AttentionItem[]>(\n enabled ? \"attention-history\" : null,\n (signal) =>\n apiGet<AttentionItem[]>(\n \"/api/attention\",\n { resolvedOnly: \"true\", limit: HISTORY_LIMIT },\n signal,\n ),\n { refreshMs: 30_000, check: Array.isArray },\n );\n const attention = useSyncStore((s) => s.attention);\n const first = useRef(true);\n const { reload } = res;\n // biome-ignore lint/correctness/useExhaustiveDependencies: refetch on attention changes\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n if (!enabled) return;\n const t = setTimeout(reload, 500);\n return () => clearTimeout(t);\n }, [attention, enabled, reload]);\n return res;\n}\n","import type { AttentionItem, AttentionReason } from \"@switchyard/protocol\";\nimport { Bell, CircleCheck, ExternalLink, Eye, History, ListTodo, Server } from \"lucide-react\";\nimport { useMemo, useState } from \"react\";\nimport { Link } from \"react-router\";\nimport { ROUTES } from \"../../app/routes\";\nimport { InteractionCard, isDocumentPresentation } from \"../../components/intent/InteractionCard\";\nimport { Button, buttonClasses } from \"../../components/ui/Button\";\nimport { SegmentedControl } from \"../../components/ui/SegmentedControl\";\nimport { ATTENTION_STATUS, StatusChip } from \"../../components/ui/StatusChip\";\nimport {\n EmptyState,\n ErrorState,\n HostUnavailable,\n LastKnownNote,\n LoadingState,\n UnsupportedCapability,\n} from \"../../components/ui/states\";\nimport { toast } from \"../../components/ui/Toast\";\nimport { formatRelative } from \"../../lib/time\";\nimport { useFilter } from \"../../prefs\";\nimport { apiPost, errorMessage } from \"../../sync/api\";\nimport { useOpenAttention, useSyncStore } from \"../../sync/store\";\nimport {\n ATTENTION_GROUPS,\n type AttentionShow,\n attentionMeta,\n groupAttention,\n normalizeShow,\n visibleAttention,\n} from \"./logic\";\nimport { HISTORY_LIMIT, useAttentionHistory } from \"./useAttentionHistory\";\n\nconst GROUP_HINT: Record<AttentionReason, string> = {\n needs_input: \"Questions from Pi waiting for your answer.\",\n failed: \"Runs that failed or were blocked. Open the task to see why.\",\n ready_for_review: \"Finished runs waiting for your review.\",\n unsupported_interaction:\n \"Questions this client cannot display. Answer them in a terminal attached to the session.\",\n host_unreachable:\n \"Running work on hosts that stopped responding. Nothing is restarted elsewhere.\",\n};\n\n/** /attention: Needs input, Failed, Ready for review (plus unsupported and unreachable). */\nexport default function AttentionView() {\n const all = useOpenAttention();\n const hydrated = useSyncStore((s) => s.hydrated);\n const [stored, setStored] = useFilter<AttentionShow | \"all\">(\"attentionShow\", \"open\");\n const show = normalizeShow(stored);\n const setShow = (v: AttentionShow) => setStored(v);\n const items = useMemo(() => visibleAttention(all, show), [all, show]);\n const dismissedCount = useMemo(() => visibleAttention(all, \"dismissed\").length, [all]);\n const groups = useMemo(() => groupAttention(items), [items]);\n const history = useAttentionHistory(show === \"history\");\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-4 px-4 pb-4 safe-pt-4 md:px-6\">\n <header className=\"flex min-w-0 flex-wrap items-center gap-3\">\n <h1 className=\"flex-1 text-lg font-semibold\">Attention</h1>\n <SegmentedControl\n label=\"Show\"\n className=\"max-sm:w-full max-sm:basis-full\"\n value={show}\n onChange={setShow}\n options={[\n { value: \"open\", label: \"Open\" },\n { value: \"dismissed\", label: \"Dismissed\" },\n { value: \"history\", label: \"History\" },\n ]}\n />\n </header>\n <LastKnownNote\n subject=\"attention items\"\n consequence=\"Answers are sent once the connection is back.\"\n show={hydrated}\n />\n {show === \"history\" ? (\n <div data-testid=\"attention-history\" className=\"flex min-w-0 flex-col gap-2\">\n {!history.data && history.loading ? (\n <LoadingState label=\"Loading history…\" />\n ) : !history.data && history.error ? (\n <ErrorState\n compact\n title=\"Could not load history\"\n error={errorMessage(history.error)}\n onRetry={history.reload}\n />\n ) : !history.data || history.data.length === 0 ? (\n <EmptyState\n icon={<History className=\"size-8\" />}\n title=\"No history yet\"\n description=\"Resolved questions, failures and reviews show up here.\"\n />\n ) : (\n <>\n <ul className=\"flex min-w-0 flex-col gap-2\">\n {history.data.map((a) => (\n <li key={a.id} className=\"min-w-0\">\n <HistoryRow item={a} />\n </li>\n ))}\n </ul>\n {history.data.length >= HISTORY_LIMIT && (\n <p className=\"text-sm text-muted\">Showing the {HISTORY_LIMIT} most recent.</p>\n )}\n </>\n )}\n </div>\n ) : !hydrated ? (\n <LoadingState label=\"Loading attention…\" />\n ) : items.length === 0 ? (\n show === \"dismissed\" ? (\n <EmptyState\n icon={<Bell className=\"size-8\" />}\n title=\"No dismissed items\"\n description=\"Items you dismiss stay here until their question or task is resolved.\"\n action={{ label: \"Show open\", onClick: () => setShow(\"open\") }}\n />\n ) : (\n <EmptyState\n icon={<Bell className=\"size-8\" />}\n title={dismissedCount > 0 ? \"All caught up\" : \"Nothing needs your attention\"}\n description={\n dismissedCount > 0\n ? `${dismissedCount} dismissed ${dismissedCount === 1 ? \"item is\" : \"items are\"} still open.`\n : \"Questions, failures and finished work show up here.\"\n }\n action={\n dismissedCount > 0\n ? { label: \"Show dismissed\", onClick: () => setShow(\"dismissed\") }\n : { label: \"Go to Sessions\", to: ROUTES.code }\n }\n secondaryAction={\n dismissedCount > 0\n ? { label: \"Go to Sessions\", to: ROUTES.code }\n : { label: \"Go to Board\", to: ROUTES.board }\n }\n />\n )\n ) : (\n ATTENTION_GROUPS.filter((r) => groups[r].length > 0).map((reason) => {\n const info = ATTENTION_STATUS[reason];\n const Icon = info.icon;\n return (\n <section\n key={reason}\n data-testid={`attention-group-${reason}`}\n aria-labelledby={`att-${reason}`}\n className=\"flex min-w-0 flex-col gap-2\"\n >\n <div>\n <h2\n id={`att-${reason}`}\n className=\"flex items-center gap-2 text-base font-semibold\"\n >\n <Icon aria-hidden className=\"size-4 text-muted\" />\n {info.label}\n <span className=\"text-sm font-normal text-muted\">({groups[reason].length})</span>\n </h2>\n <p className=\"text-sm text-muted\">{GROUP_HINT[reason]}</p>\n </div>\n <ul className=\"flex min-w-0 flex-col gap-2\">\n {groups[reason].map((a) => (\n <li key={a.id} className=\"min-w-0\">\n <AttentionRow item={a} />\n </li>\n ))}\n </ul>\n </section>\n );\n })\n )}\n </div>\n );\n}\n\nfunction AttentionRow({ item }: { item: AttentionItem }) {\n const project = useSyncStore((s) => (item.projectId ? s.projects[item.projectId] : undefined));\n const task = useSyncStore((s) => (item.taskId ? s.tasks[item.taskId] : undefined));\n const session = useSyncStore((s) => (item.sessionId ? s.sessions[item.sessionId] : undefined));\n const host = useSyncStore((s) => (session ? s.hosts[session.hostId] : undefined));\n const interaction = useSyncStore((s) =>\n item.interactionId ? s.interactions[item.interactionId] : undefined,\n );\n const [busy, setBusy] = useState(false);\n const [ackError, setAckError] = useState<unknown>(null);\n\n const acknowledge = async () => {\n setBusy(true);\n setAckError(null);\n try {\n const res = await apiPost<AttentionItem>(\n `/api/attention/${encodeURIComponent(item.id)}/acknowledge`,\n );\n const next =\n res && typeof res === \"object\" && \"id\" in res\n ? res\n : { ...item, acknowledgedAt: new Date().toISOString() };\n useSyncStore.setState((s) =>\n s.attention[item.id] ? { attention: { ...s.attention, [item.id]: next } } : {},\n );\n toast.success(\"Dismissed. It stays under All until the task or question is resolved.\");\n } catch (e) {\n setAckError(e);\n } finally {\n setBusy(false);\n }\n };\n\n const sessionHref = item.sessionId\n ? item.interactionId\n ? ROUTES.interaction(item.sessionId, item.interactionId)\n : ROUTES.session(item.sessionId)\n : null;\n const hostOffline = !!host && host.connectivity !== \"connected\";\n\n let action: React.ReactNode = null;\n switch (item.reason) {\n case \"needs_input\":\n action =\n interaction && interaction.state === \"pending\" ? (\n <InteractionCard\n flush\n interaction={interaction}\n readOnlyReason={\n hostOffline\n ? `Host ${host?.name} is offline. You can answer once it reconnects.`\n : session?.readOnly\n ? \"This session is read-only.\"\n : null\n }\n />\n ) : interaction ? (\n <InteractionCard flush interaction={interaction} />\n ) : sessionHref ? (\n <Link to={sessionHref} className={buttonClasses(\"primary\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Answer in session\n </Link>\n ) : null;\n break;\n case \"failed\":\n action = item.taskId ? (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"primary\", \"sm\")}>\n <ListTodo aria-hidden className=\"size-3.5\" />\n Open task\n </Link>\n ) : null;\n break;\n case \"ready_for_review\":\n action = item.sessionId ? (\n <Link\n to={`${ROUTES.session(item.sessionId)}?tab=changes`}\n className={buttonClasses(\"primary\", \"sm\")}\n >\n <Eye aria-hidden className=\"size-3.5\" />\n Review changes\n </Link>\n ) : item.taskId ? (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"primary\", \"sm\")}>\n <Eye aria-hidden className=\"size-3.5\" />\n Open review\n </Link>\n ) : null;\n break;\n case \"unsupported_interaction\":\n action = interaction ? (\n <InteractionCard\n interaction={interaction}\n readOnlyReason={\n hostOffline\n ? `Host ${host?.name} is offline. You can choose once it reconnects.`\n : session?.readOnly\n ? \"This session is read-only.\"\n : null\n }\n />\n ) : (\n <UnsupportedCapability\n capability=\"This dialog\"\n reason=\"An extension opened a terminal-only dialog. In RPC mode Pi gave it no answer, so the extension continued without one.\"\n />\n );\n break;\n case \"host_unreachable\":\n action = host ? (\n <HostUnavailable\n compact\n hostName={host.name}\n connectivity={host.connectivity === \"reconnecting\" ? \"reconnecting\" : \"unreachable\"}\n lastSeenAt={host.lastSeenAt}\n />\n ) : null;\n break;\n }\n\n const metaText = attentionMeta(project, task, session);\n\n const showsCard =\n !!interaction && (item.reason === \"needs_input\" || item.reason === \"unsupported_interaction\");\n\n // A plan awaiting approval gets the whole width: one meta line, no card around it.\n if (\n item.reason === \"needs_input\" &&\n interaction?.state === \"pending\" &&\n isDocumentPresentation(interaction.presentation)\n ) {\n return (\n <article\n aria-label={`Plan awaiting approval: ${metaText}`}\n className=\"flex min-w-0 flex-col gap-2\"\n >\n <div className=\"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted\">\n <span className=\"min-w-0 basis-full truncate sm:basis-auto sm:flex-1\">{metaText}</span>\n {sessionHref && (\n <Link to={sessionHref} className={buttonClasses(\"ghost\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Open session\n </Link>\n )}\n <time dateTime={item.createdAt} className=\"shrink-0 text-xs text-subtle sm:ml-auto\">\n {formatRelative(item.createdAt)}\n </time>\n {!item.acknowledgedAt && (\n <Button size=\"sm\" variant=\"ghost\" busy={busy} onClick={() => void acknowledge()}>\n Dismiss\n </Button>\n )}\n </div>\n {action}\n {ackError !== null && (\n <ErrorState\n compact\n title=\"Could not dismiss\"\n error={errorMessage(ackError)}\n onRetry={() => void acknowledge()}\n />\n )}\n </article>\n );\n }\n\n return (\n <article\n aria-label={`${ATTENTION_STATUS[item.reason].label}: ${task?.title ?? session?.title ?? item.summary}`}\n className=\"flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3\"\n >\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n <StatusChip kind=\"attention\" value={item.reason} size=\"sm\" />\n <span className=\"min-w-0 flex-1 truncate text-xs text-muted\">{metaText}</span>\n <time dateTime={item.createdAt} className=\"shrink-0 text-xs text-subtle\">\n {formatRelative(item.createdAt)}\n </time>\n </div>\n {!showsCard && <p className=\"min-w-0 text-sm break-words\">{item.summary}</p>}\n {action && <div className=\"flex min-w-0 flex-col items-start\">{action}</div>}\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n {item.reason !== \"failed\" && item.taskId && (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"ghost\", \"sm\")}>\n <ListTodo aria-hidden className=\"size-3.5\" />\n Task\n </Link>\n )}\n {sessionHref && (\n <Link to={sessionHref} className={buttonClasses(\"ghost\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Open session\n </Link>\n )}\n {item.reason === \"host_unreachable\" && host && (\n <Link\n to={`${ROUTES.settings(\"hosts\")}/${encodeURIComponent(host.id)}`}\n className={buttonClasses(\"ghost\", \"sm\")}\n >\n <Server aria-hidden className=\"size-3.5\" />\n Host details\n </Link>\n )}\n <span className=\"ml-auto\" />\n {item.acknowledgedAt ? (\n <span className=\"inline-flex items-center gap-1 text-xs text-muted\">\n <CircleCheck aria-hidden className=\"size-3.5\" />\n Dismissed {formatRelative(item.acknowledgedAt)}\n </span>\n ) : (\n <Button size=\"sm\" busy={busy} onClick={() => void acknowledge()}>\n Dismiss\n </Button>\n )}\n </div>\n {ackError !== null && (\n <ErrorState\n compact\n title=\"Could not dismiss\"\n error={errorMessage(ackError)}\n onRetry={() => void acknowledge()}\n />\n )}\n </article>\n );\n}\n\nfunction HistoryRow({ item }: { item: AttentionItem }) {\n const project = useSyncStore((s) => (item.projectId ? s.projects[item.projectId] : undefined));\n const task = useSyncStore((s) => (item.taskId ? s.tasks[item.taskId] : undefined));\n const session = useSyncStore((s) => (item.sessionId ? s.sessions[item.sessionId] : undefined));\n return (\n <article\n aria-label={`${ATTENTION_STATUS[item.reason].label}: ${task?.title ?? session?.title ?? item.summary}`}\n className=\"flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3\"\n >\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n <StatusChip kind=\"attention\" value={item.reason} size=\"sm\" />\n <span className=\"min-w-0 flex-1 truncate text-xs text-muted\">\n {attentionMeta(project, task, session)}\n </span>\n {item.resolvedAt && (\n <time dateTime={item.resolvedAt} className=\"shrink-0 text-xs text-subtle\">\n Resolved {formatRelative(item.resolvedAt)}\n </time>\n )}\n </div>\n <p className=\"min-w-0 text-sm break-words\">{item.summary}</p>\n {(item.taskId || item.sessionId) && (\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n {item.taskId && (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"ghost\", \"sm\")}>\n <ListTodo aria-hidden className=\"size-3.5\" />\n Task\n </Link>\n )}\n {item.sessionId && (\n <Link to={ROUTES.session(item.sessionId)} className={buttonClasses(\"ghost\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Open session\n </Link>\n )}\n </div>\n )}\n </article>\n );\n}\n"],"ignoreList":[0],"mappings":"A,oiBASA,IAAMuC,EAAa,CACjB,KAAM,YACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,EAAG,UAAW,IAAK,QAAS,CAAC,EACxC,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,EACzC,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,EACzC,CAAC,OAAQ,CAAE,EAAG,gBAAiB,IAAK,QAAS,CAAC,EAC9C,CAAC,OAAQ,CAAE,EAAG,IAAK,EAAG,IAAK,MAAO,IAAK,OAAQ,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,CAC9E,CACF,EACAA,EAAW,KACX,IAAMC,EAAWhC,EAAiB+B,CAAU,E,WCnB/BG,EAAsC,CACjD,cACA,SACA,mBACA,0BACA,kBACF,EAGA,SAAgBC,EAAe,EAAkE,CAC/F,IAAMC,EAAM,OAAO,YAAYF,EAAiB,IAAK,GAAM,CAACG,EAAG,CAAC,CAAoB,CAAC,CAAC,EAItF,IAAK,IAAMC,KAAKC,EAAOH,EAAIE,EAAE,OAAO,EAAE,KAAKA,CAAC,EAC5C,OAAOF,CACT,CAKA,SAAgBI,EAAc,EAA2B,CACvD,OAAOC,IAAM,aAAeA,IAAM,UAAYA,EAAI,MACpD,CAGA,SAAgBC,EAAiB,EAAsB,EAAsC,CAE3F,OADIC,IAAS,UAAkB,CAAC,EACzBC,EAAI,OAAQ,GAAOD,IAAS,OAAS,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
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,n as r,t as i}from"./jsx-runtime-D13aM9HY.js";import{_ as a,c as o,d as s,f as c,gt as l,h as u,n as d,r as f,s as p,t as m,tt as h,z as g}from"./states-ZhrxQa3K.js";import{t as _}from"./calendar-clock-B8zE4JsX.js";import{t as v}from"./chevron-right-evVLS6hq.js";import{t as y}from"./hand-UPoHamrn.js";import{t as b}from"./link-2-CaMlUDRG.js";import{t as x}from"./play-CjoDg3ws.js";import{i as S,t as C}from"./useBackTo-BIrCq3W2.js";import{M as w,N as T,U as E,m as D}from"./index-hxvDvCS7.js";import{t as O}from"./Switch-DBfzmqkm.js";import{C as k,D as A,O as j,T as M,_ as N,c as P,k as F,p as I}from"./describe-D6KLGKWa.js";var L={name:`webhook`,size:24,node:[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]};L.node;var R=r(L),z=e(n(),1),B=i(),V=`/automations/new`,H=e=>`/automations/${encodeURIComponent(e)}`,U={manual:y,once:E,cron:_,webhook:R,dependency:b};function W(){let e=g(e=>e.hydrated),n=A(),r=g(e=>e.projects),i=g(e=>e.hosts),a=g(e=>e.tasks),s=D(),[u,_]=(0,z.useState)({status:`idle`}),v=(0,z.useCallback)(async()=>{_({status:`loading`});try{let e=await l(`/api/automations`),t=Array.isArray(e)?e:e&&typeof e==`object`&&Array.isArray(e.items)?e.items:null,n=t?h.array().safeParse(t):null;if(!n?.success){_({status:`fatal`,error:Error(`The coordinator returned automations in an unexpected format.`)});return}M.getState().putMany(n.data),_({status:`done`})}catch(e){_({status:`error`,error:e})}},[]);(0,z.useEffect)(()=>{e||v()},[e,v]);let y=(0,z.useMemo)(()=>Object.values(n).sort((e,t)=>e.name.localeCompare(t.name)),[n]),b=e||u.status===`done`,x;return x=b?y.length===0?(0,B.jsx)(m,{icon:(0,B.jsx)(w,{className:`size-8`}),title:`No automations yet`,description:`Automations create tasks on a schedule, from a webhook, or when another task is done.`,action:{label:`Create an automation`,to:V,icon:(0,B.jsx)(S,{className:`size-4`})}}):(0,B.jsx)(K,{automations:y,projects:r,hosts:i,tasks:a,table:s===`desktop`}):u.status===`fatal`?(0,B.jsx)(f,{error:u.error}):u.status===`error`?(0,B.jsx)(d,{title:`Could not load automations`,error:u.error,onRetry:()=>void v()}):(0,B.jsx)(o,{label:`Loading automations…`}),(0,B.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-4 px-4 py-4 md:px-6`,children:[(0,B.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Automations`}),(0,B.jsx)(`p`,{className:`text-sm text-muted`,children:`Scheduled, webhook and dependency automations. Routine successes stay in each automation's history.`})]}),(0,B.jsxs)(t,{to:V,state:C,className:c(`primary`),children:[(0,B.jsx)(S,{"aria-hidden":!0,className:`size-4`}),`New automation`]})]}),(0,B.jsx)(p,{subject:`automations`,consequence:`Changes are sent once the coordinator is reachable again.`}),x]})}var G=`grid grid-cols-[minmax(0,2.4fr)_minmax(0,1fr)_5.5rem_minmax(0,1.2fr)_minmax(0,1.4fr)_7.5rem_7rem_auto] items-center gap-3`;function K({automations:e,projects:t,hosts:n,tasks:r,table:i}){let{busy:o,toggle:s}=F(),{busy:c,run:l}=j(),u=(0,z.useCallback)(e=>r[e]?.title,[r]);return(0,B.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-border bg-surface`,children:[i&&(0,B.jsxs)(`div`,{"aria-hidden":!0,className:a(G,`border-b border-border bg-surface-2 px-4 py-2 text-xs font-medium text-muted`),children:[(0,B.jsx)(`span`,{children:`Automation`}),(0,B.jsx)(`span`,{children:`Project`}),(0,B.jsx)(`span`,{children:`Mode`}),(0,B.jsx)(`span`,{children:`Next occurrence`}),(0,B.jsx)(`span`,{children:`Last outcome`}),(0,B.jsx)(`span`,{children:`Failures`}),(0,B.jsx)(`span`,{children:`Enabled`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Actions`})]}),(0,B.jsx)(`ul`,{"data-testid":`automations-list`,className:`divide-y divide-border`,children:e.map(e=>{let r=t[e.projectId],a=e.hostId??r?.defaultHostId??null,d=a?n[a]:void 0,f={automation:e,projectName:r?.name??`Unknown project`,host:d,trigger:P(e.trigger,{taskTitle:u}),toggling:!!o[e.id],running:!!c[e.id],onToggle:t=>void s(e,t),onRun:()=>void l(e)};return(0,B.jsx)(`li`,{"data-testid":`automation-row`,"data-automation-id":e.id,children:i?(0,B.jsx)(Z,{...f}):(0,B.jsx)(Q,{...f})},e.id)})})]})}function q({automation:e,trigger:t}){let n=U[e.trigger.kind];return(0,B.jsxs)(`span`,{className:`flex min-w-0 items-start gap-1.5 text-sm text-muted`,children:[(0,B.jsx)(n,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`min-w-0 break-words`,children:t})]})}function J({automation:e}){if(!e.enabled)return(0,B.jsx)(`span`,{className:`text-sm text-muted`,children:`Disabled`});if(!e.nextAt){let t=e.trigger.kind;return(0,B.jsx)(`span`,{className:`text-sm text-muted`,children:t===`manual`?`On demand`:t===`webhook`?`On webhook`:t===`dependency`?`When the task is done`:`None scheduled`})}return(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col text-sm`,children:[(0,B.jsx)(`span`,{children:u(e.nextAt)}),(0,B.jsx)(`time`,{dateTime:e.nextAt,className:`text-xs text-muted`,children:I(e.nextAt)})]})}function Y({host:e}){return!e||e.connectivity===`connected`?null:(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-danger`,children:[(0,B.jsx)(T,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,B.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`Host `,e.name,` `,e.connectivity===`reconnecting`?`reconnecting`:`unreachable`]})]})}function X({running:e,onRun:t,name:n}){return(0,B.jsx)(s,{size:`sm`,busy:e,icon:(0,B.jsx)(x,{className:`size-3.5`}),onClick:t,"aria-label":`Run ${n} now`,children:`Run now`})}function Z(e){let n=e.automation;return(0,B.jsxs)(`div`,{className:a(G,`px-4 py-3`),children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(t,{to:H(n.id),state:C,className:`truncate font-medium text-text hover:underline focus-visible:underline`,children:n.name}),(0,B.jsx)(q,{automation:n,trigger:e.trigger})]}),(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:`Project: `}),(0,B.jsx)(`span`,{className:`truncate text-sm`,children:e.projectName}),(0,B.jsx)(Y,{host:e.host})]}),(0,B.jsxs)(`span`,{className:`text-sm`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:`Mode: `}),N(n.mode)]}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:`Next occurrence: `}),(0,B.jsx)(J,{automation:n})]}),(0,B.jsxs)(`div`,{className:`min-w-0 text-sm break-words`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:`Last outcome: `}),n.lastOutcome??(0,B.jsx)(`span`,{className:`text-muted`,children:`No runs yet`})]}),(0,B.jsx)(k,{count:n.failureCount}),(0,B.jsx)(O,{checked:n.enabled,onChange:e.onToggle,busy:e.toggling,label:`Enable ${n.name}`,onText:`Enabled`,offText:`Disabled`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(X,{running:e.running,onRun:e.onRun,name:n.name}),(0,B.jsx)(t,{to:H(n.id),state:C,"aria-label":`Edit ${n.name}`,title:`Edit`,className:`tap inline-flex size-9 items-center justify-center rounded-md text-muted hover:bg-surface-2 hover:text-text`,children:(0,B.jsx)(v,{"aria-hidden":!0,className:`size-4`})})]})]})}function Q(e){let n=e.automation;return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 px-4 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(t,{to:H(n.id),state:C,className:`font-medium break-words text-text hover:underline focus-visible:underline`,children:n.name}),(0,B.jsx)(q,{automation:n,trigger:e.trigger})]}),(0,B.jsx)(O,{checked:n.enabled,onChange:e.onToggle,busy:e.toggling,label:`Enable ${n.name}`,onText:`Enabled`,offText:`Disabled`})]}),(0,B.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-sm`,children:[(0,B.jsx)(`dt`,{className:`text-muted`,children:`Project`}),(0,B.jsxs)(`dd`,{className:`flex min-w-0 flex-col break-words`,children:[e.projectName,(0,B.jsx)(Y,{host:e.host})]}),(0,B.jsx)(`dt`,{className:`text-muted`,children:`Mode`}),(0,B.jsx)(`dd`,{children:N(n.mode)}),(0,B.jsx)(`dt`,{className:`text-muted`,children:`Next`}),(0,B.jsx)(`dd`,{className:`min-w-0`,children:(0,B.jsx)(J,{automation:n})}),(0,B.jsx)(`dt`,{className:`text-muted`,children:`Last outcome`}),(0,B.jsx)(`dd`,{className:`min-w-0 break-words`,children:n.lastOutcome??(0,B.jsx)(`span`,{className:`text-muted`,children:`No runs yet`})}),(0,B.jsx)(`dt`,{className:`text-muted`,children:`Failures`}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(k,{count:n.failureCount})})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(X,{running:e.running,onRun:e.onRun,name:n.name}),(0,B.jsxs)(t,{to:H(n.id),state:C,className:c(`ghost`,`sm`),children:[`Edit`,(0,B.jsx)(v,{"aria-hidden":!0,className:`size-3.5`})]})]})]})}export{W as default};
|
|
2
|
-
//# sourceMappingURL=automations-Cw5Gacgm.js.map
|