@hearsay-tools/squawk 0.18.0-pr4337.8439 → 0.18.0-pr4337.8442

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.
Files changed (87) hide show
  1. package/dist/ci-wait/controller.d.ts +7 -7
  2. package/dist/contract/index.js +5 -2
  3. package/dist/contract/live-coordination.d.ts +30 -12
  4. package/dist/contract/live.d.ts +29 -0
  5. package/dist/server/activity-routes.d.ts +23 -23
  6. package/dist/server/automations-routes.d.ts +150 -150
  7. package/dist/server/live-routes.d.ts +7 -0
  8. package/dist/server/live-routes.js +1 -0
  9. package/dist/server/live-routes.js.map +1 -1
  10. package/dist/server/models-routes.d.ts +12 -12
  11. package/dist/server/project-settings-routes.js +1 -0
  12. package/dist/server/project-settings-routes.js.map +1 -1
  13. package/dist/server/providers-routes.d.ts +57 -57
  14. package/dist/server/repo-routes.d.ts +21 -21
  15. package/dist/server/reports-api.d.ts +2 -2
  16. package/dist/server/run-event-feed.d.ts +7 -1
  17. package/dist/server/run-event-feed.js +58 -9
  18. package/dist/server/run-event-feed.js.map +1 -1
  19. package/dist/server/runner-install-routes.d.ts +10 -10
  20. package/dist/server/runs-routes.d.ts +303 -303
  21. package/dist/server/server.d.ts +7 -0
  22. package/dist/server/workspace-live-routes.d.ts +7 -0
  23. package/dist/server/workspace-routes.d.ts +84 -84
  24. package/package.json +4 -4
  25. package/web/dist/assets/{accounts-section-DPb768q9.js → accounts-section-DbBWy1h-.js} +1 -1
  26. package/web/dist/assets/{activity-motion-D3CzGjrR.js → activity-motion--OtBLAG2.js} +1 -1
  27. package/web/dist/assets/{activity-route-DFJlsU13.js → activity-route-DhPIkMRQ.js} +1 -1
  28. package/web/dist/assets/{agent-config-section-2esq_SCK.js → agent-config-section-DmHFEfLn.js} +1 -1
  29. package/web/dist/assets/{agent-defaults-section-DykQGFoV.js → agent-defaults-section-BSM4exrC.js} +1 -1
  30. package/web/dist/assets/{appearance-CEhpCQZS.js → appearance-DDZh2js5.js} +1 -1
  31. package/web/dist/assets/{archive-on-merge-field-BlGo3o7a.js → archive-on-merge-field-BQXdK50c.js} +1 -1
  32. package/web/dist/assets/attention-DShuKoMT.js +1 -0
  33. package/web/dist/assets/{automation-format-CUP262Tk.js → automation-format-DB34jUyF.js} +1 -1
  34. package/web/dist/assets/{automations-route-C6e7440u.js → automations-route-5SrHa_fk.js} +1 -1
  35. package/web/dist/assets/{cez-idle-CQtDz5jk.js → cez-idle-CdswdDRd.js} +1 -1
  36. package/web/dist/assets/{commit-diff-panel-CloSSaTz.js → commit-diff-panel-DAblJOWW.js} +1 -1
  37. package/web/dist/assets/{diff-DVDzDVOV.js → diff-D6dgppr7.js} +2 -2
  38. package/web/dist/assets/{diff-view-isM51Pgu.js → diff-view-DA0QN32e.js} +1 -1
  39. package/web/dist/assets/{file-preview-BZA9e981.js → file-preview-BqpyguUL.js} +1 -1
  40. package/web/dist/assets/{folder-browser-CffyHz8w.js → folder-browser-Bv_vTEU3.js} +1 -1
  41. package/web/dist/assets/{git-toolbar-DHAavjba.js → git-toolbar-CTWmcYLa.js} +1 -1
  42. package/web/dist/assets/{github-MN8flcF0.js → github-B-xnHpoW.js} +1 -1
  43. package/web/dist/assets/{global-activity-route-CAXyZ8LF.js → global-activity-route-gYuCqamk.js} +1 -1
  44. package/web/dist/assets/{index-CHIFhfha.js → index-DCIRYVqB.js} +5 -5
  45. package/web/dist/assets/{label-6PgIe3Ny.js → label-DRrVct19.js} +1 -1
  46. package/web/dist/assets/{live-protocol-DteqtbyN.js → live-protocol-DMhTnCmf.js} +1 -1
  47. package/web/dist/assets/{live-reads-BxjlQXfN.js → live-reads-BuThrTt7.js} +1 -1
  48. package/web/dist/assets/{markdown-DhdLkyGx.js → markdown-d2-nofJ3.js} +1 -1
  49. package/web/dist/assets/{notifications-section-Yiyd4TEk.js → notifications-section-BNrYh6dQ.js} +1 -1
  50. package/web/dist/assets/{open-in-menu-AZMtej8C.js → open-in-menu-DpJFqH3v.js} +1 -1
  51. package/web/dist/assets/{preview-pane-connected-BnNucXbg.js → preview-pane-connected-BwTG5ZIm.js} +1 -1
  52. package/web/dist/assets/{project-location-DzOgHfcA.js → project-location-DNdux3-n.js} +1 -1
  53. package/web/dist/assets/{project-router-CDPfL2Jz.js → project-router-GVIIqwXL.js} +1 -1
  54. package/web/dist/assets/{project-scope-context-D9axDY18.js → project-scope-context-blU6DPq1.js} +1 -1
  55. package/web/dist/assets/{projects-section-CYnMlFyZ.js → projects-section-DfZ6ledr.js} +1 -1
  56. package/web/dist/assets/{prompt-templates-section-BaaI89Ej.js → prompt-templates-section-C2_9c8s-.js} +1 -1
  57. package/web/dist/assets/{queries-DzwCG927.js → queries-CihFAzQA.js} +1 -1
  58. package/web/dist/assets/{reference-chip-BnIoiMgY.js → reference-chip-DDmY2Wa2.js} +1 -1
  59. package/web/dist/assets/{remote-settings-notice-Drbpb7K4.js → remote-settings-notice-BEn0VAfk.js} +1 -1
  60. package/web/dist/assets/{repo-git-UR__WAGI.js → repo-git-kS-kyHgg.js} +1 -1
  61. package/web/dist/assets/{report-reader-DydKaDxP.js → report-reader-BcVFsRsD.js} +1 -1
  62. package/web/dist/assets/{reports-FE9fPBLK.js → reports-DqYF_Hlr.js} +1 -1
  63. package/web/dist/assets/{resources-section-BAz7yc3V.js → resources-section-B2o8ytO4.js} +1 -1
  64. package/web/dist/assets/{run-header-DsyPfNlS.js → run-header-BstZeaqM.js} +1 -1
  65. package/web/dist/assets/{settings-agent-picker-i4wCYEex.js → settings-agent-picker-rNyNJEU2.js} +1 -1
  66. package/web/dist/assets/{settings-shell-C1RbQ--s.js → settings-shell-BAmJvzuG.js} +1 -1
  67. package/web/dist/assets/{sidebar-section-CdvgsziI.js → sidebar-section-BTf_4d6s.js} +1 -1
  68. package/web/dist/assets/{skills-Cx1c72fB.js → skills-Cbg8WPDT.js} +1 -1
  69. package/web/dist/assets/{tab-link-BaKE6KnE.js → tab-link-Bwm_Gn01.js} +1 -1
  70. package/web/dist/assets/{task-changes-CJCU26Rn.js → task-changes-Ck289AHW.js} +1 -1
  71. package/web/dist/assets/{task-commits-BvDHw2z3.js → task-commits-Ze6RgzC8.js} +1 -1
  72. package/web/dist/assets/{task-files-BtEb73_A.js → task-files-D28yguBF.js} +1 -1
  73. package/web/dist/assets/{task-github-item-DguvLtyn.js → task-github-item-BvS_N-Rv.js} +1 -1
  74. package/web/dist/assets/{task-groups-DoiPFEfM.js → task-groups-AQ1zMByj.js} +1 -1
  75. package/web/dist/assets/{task-thread-DiiErUqw.js → task-thread-DhHHmYnk.js} +1 -1
  76. package/web/dist/assets/{tasks-table-CmESFng9.js → tasks-table-BGoadobM.js} +1 -1
  77. package/web/dist/assets/{thread-state-XrQOGOYN.js → thread-state-CNAlLytB.js} +1 -1
  78. package/web/dist/assets/{use-hand-to-agent-state-CDqXR3F2.js → use-hand-to-agent-state-B8mS8z45.js} +1 -1
  79. package/web/dist/assets/{useInfiniteQuery-GZp9laKm.js → useInfiniteQuery-CS_BO-SK.js} +1 -1
  80. package/web/dist/assets/useQuery-Ys0_fBIg.js +1 -0
  81. package/web/dist/assets/{workflows-C8Wu6BrK.js → workflows-Ck02MIW2.js} +1 -1
  82. package/web/dist/assets/{workspace-tools-DG99Pw_m.js → workspace-tools-KELtYCoO.js} +1 -1
  83. package/web/dist/assets/{worktrees-section-BtDBsA-d.js → worktrees-section-DhPBqflI.js} +1 -1
  84. package/web/dist/index.html +16 -16
  85. package/web/dist/live-worker.js +2 -2
  86. package/web/dist/assets/attention-CvHM4cjG.js +0 -1
  87. package/web/dist/assets/useQuery-CzVHT8UE.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{t as a}from"./arrow-right-Dh_Lx3um.js";import{A as o,B as s,C as c,E as l,F as u,G as d,H as f,I as p,K as m,L as h,N as g,Q as _,T as v,U as y,V as b,W as x,X as S,Y as C,Z as w,a as T,c as E,g as D,i as O,m as k,n as A,o as j,r as M,s as N,t as P,w as F,z as I}from"./activity-motion-D3CzGjrR.js";import{t as L}from"./button-BQ2y4XRB.js";import{s as R}from"./project-router-CDPfL2Jz.js";import{t as z}from"./status-dot-DtAOFiIi.js";import{st as B}from"./index-CHIFhfha.js";var V=e(t(),1),H=n(),U=`rounded-xl border border-border bg-card px-3.5 py-3`,W=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function G({request:e,index:t,now:n,motion:r}){let{kind:o,relation:s}=h(e,t),c=k(e,n),l=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,H.jsxs)(`li`,{"data-slot":r===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":r===`fold`||void 0,className:i(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,r===`enter`&&`activity-row-enter`,r===`fold`&&`activity-row-fold`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:d(t,e)}),(0,H.jsx)(a,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:f(t,e)}),(0,H.jsx)(`span`,{className:i(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,l),children:o})]}),(0,H.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,H.jsxs)(`span`,{children:[s,` · open `,S(w(e.createdAt,n))]}),e.deadline?(0,H.jsx)(`span`,{className:`ml-auto`,children:y(e.deadline,n)}):null]}),c===void 0?null:(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,H.jsx)(`span`,{className:i(`block h-full bg-current`,l),style:{width:`${Math.round(c*100)}%`}})})]})}function K({className:e}){return(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 5`,className:e})})}function q(){return(0,H.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,H.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,H.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]})}function J(){let e=`flex items-center gap-2`;return(0,H.jsxs)(`div`,{"data-slot":`activity-legend`,className:i(U,`grid gap-1.5 text-[11.5px] text-muted-foreground`),children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Legend`}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(z,{tone:`running`,"aria-hidden":`true`}),`Filled: working now`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(z,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),`Ring: waiting for something outside`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(z,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),`Robot: waiting for its own workers`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(o,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),`Heartbeat: tool calls, last 30 s`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-peer-accent`}),`Open request, task to task`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(q,{}),`Waits for a peer to write`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-inbound-accent`}),`Open question, worker to parent`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`circle`,{cx:`17`,cy:`5`,r:`4`,className:`fill-foreground`})}),`Comet: a message is travelling`]})]})}var Y={...g,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function X({feed:e,now:t,watchingSince:n}){return(0,H.jsxs)(`section`,{"data-slot":`activity-just-now`,className:U,children:[(0,H.jsx)(`h2`,{className:W,children:`Just now`}),e.length>0?(0,H.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,H.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:i(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:i(`size-[7px] -translate-y-px rounded-full`,Y[e.tone])}),(0,H.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,H.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:N(t-e.at)})]},e.id))}):null,(0,H.jsxs)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:[`Watching since `,C(n)]})]})}function Z({requests:e,closing:t=[],index:n,now:r,watchingSince:i,feed:a=[],motion:o=u}){return(0,H.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-4`,children:[(0,H.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:U,children:[(0,H.jsxs)(`h2`,{className:W,children:[`Open requests `,(0,H.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),e.length===0&&t.length===0?(0,H.jsx)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:`No task waits for a reply.`}):(0,H.jsxs)(`ul`,{children:[e.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:`fold`},e.requestId))]})]}),(0,H.jsx)(X,{feed:a,now:r,watchingSince:i}),(0,H.jsx)(J,{})]})}function Q(e){let[t,n]=V.useState(0);return V.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>n(t.clientWidth);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function $(e,t,n){let[r,i]=V.useState(void 0),a=F(r,e,t,n);return v(r,a)||i(a),a}function ee(e,t,n=s(e.tasks)){let r=new Set(e.tasks.map(e=>e.runId)),i=new Set(e.requests.map(e=>e.requestId)),a=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!i.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!r.has(t.task.runId)).map(e=>e.task),requests:a.map(e=>e.request),waits:p(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}function te({project:e,now:t,watchingSince:n,motion:r=u,feed:i,still:a=!1,paused:o=!1}){let d=V.useRef(null),f=c(Q(d)),p=V.useMemo(()=>x(e),[e]),m=V.useMemo(()=>s(e.tasks),[e.tasks]),h=V.useMemo(()=>ee(e,r,m),[e,r,m]),g=V.useMemo(()=>[...e.requests,...h.requests],[e.requests,h.requests]),_=V.useMemo(()=>[...m,...h.waits],[m,h.waits]),v=j(m),y=new Map([...h.cards,...e.tasks].map(e=>[e.runId,e])),b=new Set(h.cards.map(e=>e.runId)),S=e=>1+.35*(y.get(e)?.workers.length??0),C=$([...y.keys()],f,S),w=f===1,T=e.tasks.length>12,O={now:t,titleOf:e=>I(p,e)},k=C.map(e=>e.join(`,`)).join(`|`),A=`${e.tasks.length}:${f}:${T}:${k}:${g.map(e=>e.requestId).join(`,`)}:${_.map(e=>e.id).join(`,`)}`;return D(d,`data-flip`,k,!a&&!o),(0,H.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 pl-5`,children:[e.tasks.length===0?(0,H.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No active work in this project.`}):null,(0,H.jsxs)(`div`,{ref:d,"data-slot":`activity-graph`,"data-columns":f,"data-dense":T?`true`:void 0,className:`relative grid items-start`,style:{gridTemplateColumns:`repeat(${f}, minmax(0, 1fr))`,columnGap:w?0:96},children:[C.map((t,n)=>(0,H.jsx)(`div`,{"data-slot":`activity-column`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-[30px] max-md:gap-4`,children:t.map(t=>{let n=y.get(t);return n?(0,H.jsx)(l,{task:n,requests:e.requests,waits:m,index:p,ctx:O,dense:T,narrow:w,motion:r,ghost:b.has(t),linked:v.linked.has(t),onHover:v.onHover},t):null})},n)),(0,H.jsx)(E,{requests:g,waits:_,active:v.active,index:p,peers:!w,layoutKey:A,now:t,motion:r,paused:o||a})]})]}),(0,H.jsx)(Z,{requests:e.requests,closing:h.folding,index:p,now:t,watchingSince:n,feed:i,motion:r})]})}function ne(){let e=r(),t=_({kind:`project`,projectId:e}),n=R(),[i]=V.useState(()=>new Date().toISOString()),a=P(t.data?.generatedAt,t.dataUpdatedAt),{motion:o,feed:s,reduced:c,paused:l}=A(t.data,e),u=t.data?.projects[0];if(t.isPending)return(0,H.jsx)(B,{});let d=u?b(u):void 0;return u?(0,H.jsxs)(`div`,{"data-route":`activity`,"data-activity-paused":l?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(M,{name:u.name,now:a,stale:t.isError,children:(0,H.jsx)(O,{scope:`project`,projectId:n??u.projectId})}),(0,H.jsx)(T,{summary:m([u]),tasksTo:`/`,bumps:o.bumps}),d?(0,H.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`py-6 text-[13px] text-muted-foreground`,children:d}):(0,H.jsx)(te,{project:u,now:a,watchingSince:i,motion:o,feed:s,still:c,paused:l})]}):(0,H.jsxs)(`div`,{"data-route":`activity`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(M,{name:n??`project`,children:(0,H.jsx)(O,{scope:`project`,projectId:n})}),(0,H.jsxs)(`div`,{role:`alert`,className:`mt-6 flex items-center gap-3 text-[13px] text-muted-foreground`,children:[t.error?`Could not load activity: ${t.error.message}`:`This project has no activity snapshot.`,(0,H.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})]})}export{ne as ProjectActivityRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{t as a}from"./arrow-right-Dh_Lx3um.js";import{A as o,B as s,C as c,E as l,F as u,G as d,H as f,I as p,K as m,L as h,N as g,Q as _,T as v,U as y,V as b,W as x,X as S,Y as C,Z as w,a as T,c as E,g as D,i as O,m as k,n as A,o as j,r as M,s as N,t as P,w as F,z as I}from"./activity-motion--OtBLAG2.js";import{t as L}from"./button-BQ2y4XRB.js";import{s as R}from"./project-router-GVIIqwXL.js";import{t as z}from"./status-dot-DtAOFiIi.js";import{st as B}from"./index-DCIRYVqB.js";var V=e(t(),1),H=n(),U=`rounded-xl border border-border bg-card px-3.5 py-3`,W=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function G({request:e,index:t,now:n,motion:r}){let{kind:o,relation:s}=h(e,t),c=k(e,n),l=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,H.jsxs)(`li`,{"data-slot":r===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":r===`fold`||void 0,className:i(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,r===`enter`&&`activity-row-enter`,r===`fold`&&`activity-row-fold`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:d(t,e)}),(0,H.jsx)(a,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:f(t,e)}),(0,H.jsx)(`span`,{className:i(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,l),children:o})]}),(0,H.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,H.jsxs)(`span`,{children:[s,` · open `,S(w(e.createdAt,n))]}),e.deadline?(0,H.jsx)(`span`,{className:`ml-auto`,children:y(e.deadline,n)}):null]}),c===void 0?null:(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,H.jsx)(`span`,{className:i(`block h-full bg-current`,l),style:{width:`${Math.round(c*100)}%`}})})]})}function K({className:e}){return(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 5`,className:e})})}function q(){return(0,H.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,H.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,H.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]})}function J(){let e=`flex items-center gap-2`;return(0,H.jsxs)(`div`,{"data-slot":`activity-legend`,className:i(U,`grid gap-1.5 text-[11.5px] text-muted-foreground`),children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Legend`}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(z,{tone:`running`,"aria-hidden":`true`}),`Filled: working now`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(z,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),`Ring: waiting for something outside`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(z,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),`Robot: waiting for its own workers`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(o,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),`Heartbeat: tool calls, last 30 s`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-peer-accent`}),`Open request, task to task`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(q,{}),`Waits for a peer to write`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-inbound-accent`}),`Open question, worker to parent`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`circle`,{cx:`17`,cy:`5`,r:`4`,className:`fill-foreground`})}),`Comet: a message is travelling`]})]})}var Y={...g,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function X({feed:e,now:t,watchingSince:n}){return(0,H.jsxs)(`section`,{"data-slot":`activity-just-now`,className:U,children:[(0,H.jsx)(`h2`,{className:W,children:`Just now`}),e.length>0?(0,H.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,H.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:i(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:i(`size-[7px] -translate-y-px rounded-full`,Y[e.tone])}),(0,H.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,H.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:N(t-e.at)})]},e.id))}):null,(0,H.jsxs)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:[`Watching since `,C(n)]})]})}function Z({requests:e,closing:t=[],index:n,now:r,watchingSince:i,feed:a=[],motion:o=u}){return(0,H.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-4`,children:[(0,H.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:U,children:[(0,H.jsxs)(`h2`,{className:W,children:[`Open requests `,(0,H.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),e.length===0&&t.length===0?(0,H.jsx)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:`No task waits for a reply.`}):(0,H.jsxs)(`ul`,{children:[e.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:`fold`},e.requestId))]})]}),(0,H.jsx)(X,{feed:a,now:r,watchingSince:i}),(0,H.jsx)(J,{})]})}function Q(e){let[t,n]=V.useState(0);return V.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>n(t.clientWidth);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function $(e,t,n){let[r,i]=V.useState(void 0),a=F(r,e,t,n);return v(r,a)||i(a),a}function ee(e,t,n=s(e.tasks)){let r=new Set(e.tasks.map(e=>e.runId)),i=new Set(e.requests.map(e=>e.requestId)),a=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!i.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!r.has(t.task.runId)).map(e=>e.task),requests:a.map(e=>e.request),waits:p(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}function te({project:e,now:t,watchingSince:n,motion:r=u,feed:i,still:a=!1,paused:o=!1}){let d=V.useRef(null),f=c(Q(d)),p=V.useMemo(()=>x(e),[e]),m=V.useMemo(()=>s(e.tasks),[e.tasks]),h=V.useMemo(()=>ee(e,r,m),[e,r,m]),g=V.useMemo(()=>[...e.requests,...h.requests],[e.requests,h.requests]),_=V.useMemo(()=>[...m,...h.waits],[m,h.waits]),v=j(m),y=new Map([...h.cards,...e.tasks].map(e=>[e.runId,e])),b=new Set(h.cards.map(e=>e.runId)),S=e=>1+.35*(y.get(e)?.workers.length??0),C=$([...y.keys()],f,S),w=f===1,T=e.tasks.length>12,O={now:t,titleOf:e=>I(p,e)},k=C.map(e=>e.join(`,`)).join(`|`),A=`${e.tasks.length}:${f}:${T}:${k}:${g.map(e=>e.requestId).join(`,`)}:${_.map(e=>e.id).join(`,`)}`;return D(d,`data-flip`,k,!a&&!o),(0,H.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 pl-5`,children:[e.tasks.length===0?(0,H.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No active work in this project.`}):null,(0,H.jsxs)(`div`,{ref:d,"data-slot":`activity-graph`,"data-columns":f,"data-dense":T?`true`:void 0,className:`relative grid items-start`,style:{gridTemplateColumns:`repeat(${f}, minmax(0, 1fr))`,columnGap:w?0:96},children:[C.map((t,n)=>(0,H.jsx)(`div`,{"data-slot":`activity-column`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-[30px] max-md:gap-4`,children:t.map(t=>{let n=y.get(t);return n?(0,H.jsx)(l,{task:n,requests:e.requests,waits:m,index:p,ctx:O,dense:T,narrow:w,motion:r,ghost:b.has(t),linked:v.linked.has(t),onHover:v.onHover},t):null})},n)),(0,H.jsx)(E,{requests:g,waits:_,active:v.active,index:p,peers:!w,layoutKey:A,now:t,motion:r,paused:o||a})]})]}),(0,H.jsx)(Z,{requests:e.requests,closing:h.folding,index:p,now:t,watchingSince:n,feed:i,motion:r})]})}function ne(){let e=r(),t=_({kind:`project`,projectId:e}),n=R(),[i]=V.useState(()=>new Date().toISOString()),a=P(t.data?.generatedAt,t.dataUpdatedAt),{motion:o,feed:s,reduced:c,paused:l}=A(t.data,e),u=t.data?.projects[0];if(t.isPending)return(0,H.jsx)(B,{});let d=u?b(u):void 0;return u?(0,H.jsxs)(`div`,{"data-route":`activity`,"data-activity-paused":l?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(M,{name:u.name,now:a,stale:t.isError,children:(0,H.jsx)(O,{scope:`project`,projectId:n??u.projectId})}),(0,H.jsx)(T,{summary:m([u]),tasksTo:`/`,bumps:o.bumps}),d?(0,H.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`py-6 text-[13px] text-muted-foreground`,children:d}):(0,H.jsx)(te,{project:u,now:a,watchingSince:i,motion:o,feed:s,still:c,paused:l})]}):(0,H.jsxs)(`div`,{"data-route":`activity`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(M,{name:n??`project`,children:(0,H.jsx)(O,{scope:`project`,projectId:n})}),(0,H.jsxs)(`div`,{role:`alert`,className:`mt-6 flex items-center gap-3 text-[13px] text-muted-foreground`,children:[t.error?`Could not load activity: ${t.error.message}`:`This project has no activity snapshot.`,(0,H.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})]})}export{ne as ProjectActivityRoute};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{An as i,ci as a}from"./project-scope-context-D9axDY18.js";import{Kt as o,Lt as s,Wt as c,Xt as l,g as u,h as d,ht as f,x as p}from"./queries-DzwCG927.js";import{n as m}from"./toaster-Bo5vCbz-.js";import{t as h}from"./button-BQ2y4XRB.js";import{t as g}from"./badge-D9JrXe0o.js";import{t as _}from"./centered-state-V15AR_qo.js";import{A as v,_n as y,er as b}from"./index-CHIFhfha.js";import{i as x,n as S,r as C}from"./highlighter-DvLzHjjY.js";import{n as w,r as T,t as E}from"./remote-settings-notice-Drbpb7K4.js";var D=e(t(),1),O=n(),k=1500;function A(e,t){let n=(0,D.useMemo)(()=>e.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{An as i,ci as a}from"./project-scope-context-blU6DPq1.js";import{Kt as o,Lt as s,Wt as c,Xt as l,g as u,h as d,ht as f,x as p}from"./queries-CihFAzQA.js";import{n as m}from"./toaster-Bo5vCbz-.js";import{t as h}from"./button-BQ2y4XRB.js";import{t as g}from"./badge-D9JrXe0o.js";import{t as _}from"./centered-state-V15AR_qo.js";import{A as v,_n as y,er as b}from"./index-DCIRYVqB.js";import{i as x,n as S,r as C}from"./highlighter-DvLzHjjY.js";import{n as w,r as T,t as E}from"./remote-settings-notice-BEn0VAfk.js";var D=e(t(),1),O=n(),k=1500;function A(e,t){let n=(0,D.useMemo)(()=>e.split(`
2
2
  `).map(e=>[{content:e}]),[e]),r=(0,D.useMemo)(()=>S(t),[t]),i=n.length>k,[a,o]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(r===null||i)return;let t=!1;return C(e,r).then(n=>{t||o({key:e,tokens:n.tokens})}),()=>{t=!0}},[e,r,i]),r===null||i?n:a?.key===e?a.tokens:x(e,r)?.tokens??n}var j=`code-editor-surface m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function M({value:e,onChange:t,language:n,readOnly:i,className:a,...o}){let s=A(e,n),c=(0,D.useRef)(null),l=(0,D.useRef)(null),u=()=>{let e=l.current,t=c.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,D.useLayoutEffect)(u,[e]),(0,O.jsxs)(`div`,{"data-slot":`code-editor`,className:r(`relative overflow-hidden rounded-md border border-input bg-card`,a),children:[(0,O.jsx)(`pre`,{ref:c,"aria-hidden":`true`,className:r(j,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:s.map((e,t)=>(0,O.jsx)(`span`,{className:`block`,children:e.length===0?`
3
3
  `:(0,O.jsxs)(O.Fragment,{children:[e.map((e,t)=>(0,O.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
4
4
  `]})},t))}),(0,O.jsx)(`textarea`,{ref:l,"data-slot":`code-editor-input`,value:e,readOnly:i,onChange:e=>t?.(e.target.value),onScroll:u,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:r(j,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-hidden`,`selection:bg-accent-strong/30 focus-visible:ring-0`,i&&`cursor-default`),...o})]})}function N(e){return t=>t.runners.includes(e)}function P(e,t){let n=N(e);return t===`mcp`?e=>n(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>n(e)&&e.kind===t}function F(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:P(e.id,t)}))}}function I(e){return c(e).map(F)}function L(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function R(){let e=d();T();let t=f(),n=l(),r=n.data,i=(0,D.useMemo)(()=>I(r),[r]),a=(0,D.useMemo)(()=>t.data?v(t.data.checks,r):o(r),[t.data,r]);return n.isError?(0,O.jsx)(_,{icon:(0,O.jsx)(b,{}),tone:`danger`,title:`Runners did not load`,subtitle:n.error.message,heading:`h2`}):e.isError?(0,O.jsx)(_,{icon:(0,O.jsx)(b,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||r===void 0?(0,O.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,O.jsx)(z,{listing:e.data,descriptors:i,installed:a})}function z({listing:e,descriptors:t,installed:n}){let[i,a]=(0,D.useState)(`claude`),[o,s]=(0,D.useState)(null),c=t.find(e=>e.id===i)??t[0];if(c===void 0)return null;let l=e.files.find(e=>e.id===o)??null,u=e=>{a(e),s(null)};return(0,O.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,O.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit agent instructions and MCP configuration for this project.`}),!e.editable&&(0,O.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-soft-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,O.jsx)(`code`,{children:E}),`.`]}),(0,O.jsx)(w,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,O.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,O.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===c.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===c.id,onClick:()=>u(e.id),className:r(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===c.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,O.jsx)(g,{variant:`outline`,className:`text-[12px] text-soft-foreground`,children:`not installed`})]},e.id))}),c.note&&(0,O.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:c.note}),(0,O.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,O.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,O.jsx)(B,{agent:c,listing:e,selectedId:o,onSelect:s})}),(0,O.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:l?(0,O.jsx)(H,{file:l},l.id):(0,O.jsx)(`div`,{className:`flex h-full min-h-40 items-center justify-center rounded-md border border-dashed border-border text-[13px] text-soft-foreground`,children:`Select a config file to view or edit it.`})})]})]})}function B({agent:e,listing:t,selectedId:n,onSelect:i}){return(0,O.jsx)(O.Fragment,{children:e.groups.map(a=>{let o=t.files.filter(a.files),s=a.showsUserMcp?t.userMcp:void 0;return o.length===0&&!s&&!a.empty?null:(0,O.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":a.id,"data-agent":e.id,children:[(0,O.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:a.label}),a.note&&(0,O.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:a.note}),o.length===0&&a.empty&&(0,O.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-[12px] text-soft-foreground`,children:a.empty}),(0,O.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,O.jsx)(`li`,{children:(0,O.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>i(e.id),className:r(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,O.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,O.jsx)(g,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`seeded`}),!e.exists&&(0,O.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),s&&(0,O.jsx)(V,{userMcp:s})]},a.id)})})}function V({userMcp:e}){return(0,O.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,O.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,O.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,O.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,O.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,O.jsx)(`li`,{children:(0,O.jsx)(g,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,O.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,O.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function H({file:e}){let t=u(e.id),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)(!1),[o,s]=(0,D.useState)(null),c=t.data?.version??null,l=n??t.data?.content??``,d=t.data?l!==t.data.content:!1,f=e.writable,p=e.kind===`mcp`||e.holdsMcp;y(f&&d);let{save:m,isSaving:_}=G({file:e,content:l,loadedVersion:c,setDraft:r,setConflict:a,setFormatError:s});return(0,D.useEffect)(()=>{t.data&&(r(t.data.content),a(!1),s(null))},[t.data?.version,t.data]),(0,O.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,O.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,O.jsxs)(`p`,{"data-slot":`agent-config-scope`,title:e.path,className:`text-[12px] text-muted-foreground break-words`,children:[e.scope.charAt(0).toUpperCase()+e.scope.slice(1),` scope · `,e.path]}),(0,O.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,O.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,O.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,O.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,O.jsx)(`h3`,{children:p?`MCP configuration`:`File contents`}),p&&(0,O.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),t.isPending?(0,O.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,O.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,O.jsx)(M,{value:l,language:e.format,readOnly:!f,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),(0,O.jsx)(U,{formatError:o,conflict:i,onReload:()=>void t.refetch()}),f&&(0,O.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,O.jsx)(h,{size:`sm`,onClick:m,disabled:!d||_,children:e.exists?`Save file`:`Create file`}),(0,O.jsx)(h,{size:`sm`,variant:`outline`,onClick:()=>r(null),disabled:!d||_,children:`Reset`}),d&&(0,O.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]}),(0,O.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,O.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,O.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[L(e),e.hotReload?` ${e.hotReload}`:``]}),(0,O.jsx)(W,{reason:e.readOnlyReason})]})]})}function U({formatError:e,conflict:t,onReload:n}){return(0,O.jsxs)(O.Fragment,{children:[e&&(0,O.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:e}),t&&(0,O.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,O.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,O.jsx)(h,{size:`sm`,variant:`outline`,onClick:n,children:`Reload from disk`})]})]})}function W({reason:e}){return e&&(0,O.jsx)(`p`,{children:e})}function G({file:e,content:t,loadedVersion:n,setDraft:r,setConflict:o,setFormatError:c}){let l=p(e.id),u=a(),d=T();return{save:()=>{c(null),o(!1),l.mutate({content:t,version:n},{onSuccess:()=>{r(null),m(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof i&&e.status===409?d().then(()=>{u.getQueryData(s.health)?.capabilities.settingsAdmin===!1?m(e.message,{tone:`danger`}):o(!0)}):e instanceof i&&e.status===400?c(e.message):m(e.message,{tone:`danger`})}})},isSaving:l.isPending}}export{R as AgentConfigSection};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,An as i,Ut as a,br as o,ci as s,r as c,un as l}from"./project-scope-context-D9axDY18.js";import{$t as u,Dt as d,Et as f,Kt as p,Lt as m,Qt as h,Rt as g,S as _,Ut as v,Wt as y,Xt as b,_ as x,in as S,st as C,vt as w,xt as T,yt as E}from"./queries-DzwCG927.js";import{n as D}from"./toaster-Bo5vCbz-.js";import{s as O}from"./design-icons-CzEoMH9c.js";import{t as k}from"./button-BQ2y4XRB.js";import{t as A}from"./switch-Bv2Zf1uU.js";import{t as j}from"./status-dot-DtAOFiIi.js";import{t as M}from"./centered-state-V15AR_qo.js";import{N,_n as P,bn as F,j as I}from"./index-CHIFhfha.js";import{t as L}from"./textarea-vJt9undk.js";import{a as R,i as z,n as B,r as V,t as H}from"./settings-agent-picker-i4wCYEex.js";import{n as U}from"./saved-draft-BwzBc-_Y.js";var W=e(t(),1),G=n(),K={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function q(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function J(e,t){return e?K[e]:t?{label:`Checking…`,tone:`neutral`}:K.unknown}function Y(e,t){return e===`unknown`||t&&!e}function X({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,G.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,G.jsx)(`code`,{children:e.loginCommand}),`.`]}):Y(t,r)?(0,G.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,G.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function ee({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,G.jsx)(A,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t)}),l?(0,G.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>D(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,G.jsx)(B,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>D(`${e.displayName} can be tried again.`),onError:e=>D(e.message,{tone:`danger`})}),children:`Try again`})]})}function te({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,G.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,G.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ne(){let e=b(),t=E(),n=T(),r=f(),c=s(),[u,d]=(0,W.useState)(null),p=(0,W.useRef)(Promise.resolve()),m=(0,W.useRef)({}),_=(0,W.useRef)({}),x=(0,W.useRef)(t.data);(0,W.useEffect)(()=>{u&&o(t.data,u.provider)?.status===`connected`&&d(null)},[u,t.data]),(0,W.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!x.current){x.current=t.data;return}x.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?o(x.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let C=(0,W.useCallback)((e,t)=>{let n=g.providerStatus,r=c.getQueryData(n);if(!r)return;x.current||=r;let i=q(r,e,t);_.current[e]=(_.current[e]??0)+1,c.setQueryData(n,i);let a=(m.current[e]??0)+1;m.current[e]=a,p.current=p.current.then(async()=>{try{let r=await l(e,t),i=o(r,e)?.enabled;if(i===void 0)return;if(x.current=q(x.current??r,e,i),a===m.current[e]){let t=c.getQueryData(n);c.setQueryData(n,t?q(t,e,i):r)}}catch(t){if(a===m.current[e]){let r=o(x.current,e)?.enabled,i=c.getQueryData(n);i&&r!==void 0?c.setQueryData(n,q(i,e,r)):x.current?c.setQueryData(n,x.current):c.removeQueries({queryKey:n,exact:!0}),D(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[c]),w=S({mutationFn:e=>a(e),onSuccess:async(e,t)=>{d(null),D(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await c.invalidateQueries({queryKey:g.providerStatus}),await h(c,t,`none`)},onError:(t,n)=>{if(t instanceof i&&t.command){let r=v(e.data,n);d({provider:n,label:r,message:t.message,command:t.command});return}D(t.message,{tone:`danger`})}}),O=async e=>{try{await navigator.clipboard.writeText(e),D(`Command copied`)}catch{D(`Could not copy the command`,{tone:`danger`})}};return(0,G.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,G.jsxs)(`div`,{className:`mb-2`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,G.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,G.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:y(e.data).map(e=>{let i=o(t.data,e.id),a=i?.status,s=J(a,t.isPending),c=w.isPending&&w.variables===e.id,l=i?.authFailureId;return(0,G.jsxs)(W.Fragment,{children:[(0,G.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(j,{tone:s.tone,pulse:t.isPending}),(0,G.jsx)(`span`,{children:s.label}),i?.enabled===!1?(0,G.jsx)(`span`,{children:`Disabled`}):null]}),(0,G.jsx)(X,{provider:e,state:a,current:i,statusIsError:t.isError})]}),(0,G.jsx)(ee,{provider:e,state:a,current:i,isConnecting:c,incidentId:l,refresh:n,connect:w,retry:r,queueToggle:C})]}),l===void 0?null:(0,G.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,G.jsx)(te,{manual:u,provider:e.id,connected:a===`connected`,onCopy:O})]},e.id)})})]})}var Z=2e4;function re(){let e=x(),t=b(),n=u(p(t.data)),r=E();return e.isPending?(0,G.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,G.jsx)(M,{icon:(0,G.jsx)(O,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,G.jsx)(ie,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function ie({config:e,catalogs:t,providerStatus:n,runners:i}){let a=_(),o=s(),c=S({mutationFn:e=>r(e),onSuccess:e=>{o.setQueryData(m.config,e),o.invalidateQueries({queryKey:m.health}),o.invalidateQueries({queryKey:m.repo})},onError:e=>D(e.message,{tone:`danger`})}),[l,u]=U(e.systemPrompt??``),d=l.trim(),f=d===(e.systemPrompt??``),p=d.length>Z;return P(!f),(0,G.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,G.jsx)(ae,{defaultRunner:e.defaultRunner,providerStatus:n,saving:c.isPending,onPick:e=>c.mutate({defaultRunner:e})}),(0,G.jsx)(Q,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:y(i).map(r=>{let{providerConnected:a,providerReason:o}=R(n,r.id),s=t[r.id],l=I(r.id,i,s),u=N(r.id,i,s?.data,[e.defaultModels[r.id]]),d=e.defaultModels[r.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,G.jsxs)(`label`,{className:`settings-option-row`,children:[(0,G.jsx)(`div`,{children:(0,G.jsx)(`h3`,{children:r.pickerLabel})}),e.modelsLocked?(0,G.jsx)(`output`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,G.jsxs)(`select`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,value:d,title:o??r.pickerDescription,disabled:c.isPending||!a,onChange:e=>c.mutate({defaultModels:{[r.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,G.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,G.jsxs)(Q,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,G.jsx)(L,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:l,onChange:e=>u(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,G.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,G.jsx)(k,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:f||p||c.isPending,onClick:()=>c.mutate({systemPrompt:d===``?null:d},{onSuccess:()=>D(d===``?`System prompt cleared`:`System prompt saved`)}),children:`Save prompt`}),p?(0,G.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[d.length.toLocaleString(),` characters — the limit is`,` `,Z.toLocaleString(),`.`]}):(0,G.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,G.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,G.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,G.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,G.jsx)(A,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:c.isPending,onCheckedChange:e=>c.mutate({liveTitleUpdates:e},{onSuccess:()=>D(e?`Live title updates on`:`Live title updates off`)})}),(0,G.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,G.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,G.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,G.jsx)(A,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:c.isPending,onCheckedChange:e=>c.mutate({reviewGate:e},{onSuccess:()=>D(e?`Review gate on`:`Review gate off`)})}),(0,G.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,G.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:a.data?.info?(0,G.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:c.isPending,onChange:e=>c.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,G.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),a.data.branches.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}):(0,G.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:a.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,G.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,G.jsx)(`summary`,{children:`Provider connections`}),(0,G.jsx)(ne,{})]})]})}function ae({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=C(),a=w(),s=c(),l=_(),u=d(),f=s.projectId??`default`,p=l.data?.info?.root,m=F(i.data,s.projectId,p),h=b().data,g=V(i.data?.profiles??[],h),v=z(g,h);return(0,G.jsxs)(Q,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,G.jsx)(H,{rows:g,runner:e,accountFor:e=>m?.[e]??null,providerStatus:t,disabled:n,accountDisabled:u.isPending||a.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&u.mutate({projectId:f,provider:t,profileId:n},{onError:e=>D(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&o(t.data,e)?.enabled===!1?(0,G.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,v?(0,G.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Q({title:e,hint:t,reportsDirty:n,children:r}){return(0,G.jsxs)(`section`,{"data-reports-dirty":n?``:void 0,className:`settings-field flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,G.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),r]})}function $({title:e,hint:t,children:n}){return(0,G.jsxs)(`section`,{className:`settings-option-row`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{children:e}),(0,G.jsx)(`p`,{children:t})]}),n]})}export{re as AgentDefaultsSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,An as i,Ut as a,br as o,ci as s,r as c,un as l}from"./project-scope-context-blU6DPq1.js";import{$t as u,Dt as d,Et as f,Kt as p,Lt as m,Qt as h,Rt as g,S as _,Ut as v,Wt as y,Xt as b,_ as x,in as S,st as C,vt as w,xt as T,yt as E}from"./queries-CihFAzQA.js";import{n as D}from"./toaster-Bo5vCbz-.js";import{s as O}from"./design-icons-CzEoMH9c.js";import{t as k}from"./button-BQ2y4XRB.js";import{t as A}from"./switch-Bv2Zf1uU.js";import{t as j}from"./status-dot-DtAOFiIi.js";import{t as M}from"./centered-state-V15AR_qo.js";import{N,_n as P,bn as F,j as I}from"./index-DCIRYVqB.js";import{t as L}from"./textarea-vJt9undk.js";import{a as R,i as z,n as B,r as V,t as H}from"./settings-agent-picker-rNyNJEU2.js";import{n as U}from"./saved-draft-BwzBc-_Y.js";var W=e(t(),1),G=n(),K={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function q(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function J(e,t){return e?K[e]:t?{label:`Checking…`,tone:`neutral`}:K.unknown}function Y(e,t){return e===`unknown`||t&&!e}function X({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,G.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,G.jsx)(`code`,{children:e.loginCommand}),`.`]}):Y(t,r)?(0,G.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,G.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function ee({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,G.jsx)(A,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t)}),l?(0,G.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>D(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,G.jsx)(B,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>D(`${e.displayName} can be tried again.`),onError:e=>D(e.message,{tone:`danger`})}),children:`Try again`})]})}function te({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,G.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,G.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ne(){let e=b(),t=E(),n=T(),r=f(),c=s(),[u,d]=(0,W.useState)(null),p=(0,W.useRef)(Promise.resolve()),m=(0,W.useRef)({}),_=(0,W.useRef)({}),x=(0,W.useRef)(t.data);(0,W.useEffect)(()=>{u&&o(t.data,u.provider)?.status===`connected`&&d(null)},[u,t.data]),(0,W.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!x.current){x.current=t.data;return}x.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?o(x.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let C=(0,W.useCallback)((e,t)=>{let n=g.providerStatus,r=c.getQueryData(n);if(!r)return;x.current||=r;let i=q(r,e,t);_.current[e]=(_.current[e]??0)+1,c.setQueryData(n,i);let a=(m.current[e]??0)+1;m.current[e]=a,p.current=p.current.then(async()=>{try{let r=await l(e,t),i=o(r,e)?.enabled;if(i===void 0)return;if(x.current=q(x.current??r,e,i),a===m.current[e]){let t=c.getQueryData(n);c.setQueryData(n,t?q(t,e,i):r)}}catch(t){if(a===m.current[e]){let r=o(x.current,e)?.enabled,i=c.getQueryData(n);i&&r!==void 0?c.setQueryData(n,q(i,e,r)):x.current?c.setQueryData(n,x.current):c.removeQueries({queryKey:n,exact:!0}),D(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[c]),w=S({mutationFn:e=>a(e),onSuccess:async(e,t)=>{d(null),D(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await c.invalidateQueries({queryKey:g.providerStatus}),await h(c,t,`none`)},onError:(t,n)=>{if(t instanceof i&&t.command){let r=v(e.data,n);d({provider:n,label:r,message:t.message,command:t.command});return}D(t.message,{tone:`danger`})}}),O=async e=>{try{await navigator.clipboard.writeText(e),D(`Command copied`)}catch{D(`Could not copy the command`,{tone:`danger`})}};return(0,G.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,G.jsxs)(`div`,{className:`mb-2`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,G.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,G.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:y(e.data).map(e=>{let i=o(t.data,e.id),a=i?.status,s=J(a,t.isPending),c=w.isPending&&w.variables===e.id,l=i?.authFailureId;return(0,G.jsxs)(W.Fragment,{children:[(0,G.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(j,{tone:s.tone,pulse:t.isPending}),(0,G.jsx)(`span`,{children:s.label}),i?.enabled===!1?(0,G.jsx)(`span`,{children:`Disabled`}):null]}),(0,G.jsx)(X,{provider:e,state:a,current:i,statusIsError:t.isError})]}),(0,G.jsx)(ee,{provider:e,state:a,current:i,isConnecting:c,incidentId:l,refresh:n,connect:w,retry:r,queueToggle:C})]}),l===void 0?null:(0,G.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,G.jsx)(te,{manual:u,provider:e.id,connected:a===`connected`,onCopy:O})]},e.id)})})]})}var Z=2e4;function re(){let e=x(),t=b(),n=u(p(t.data)),r=E();return e.isPending?(0,G.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,G.jsx)(M,{icon:(0,G.jsx)(O,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,G.jsx)(ie,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function ie({config:e,catalogs:t,providerStatus:n,runners:i}){let a=_(),o=s(),c=S({mutationFn:e=>r(e),onSuccess:e=>{o.setQueryData(m.config,e),o.invalidateQueries({queryKey:m.health}),o.invalidateQueries({queryKey:m.repo})},onError:e=>D(e.message,{tone:`danger`})}),[l,u]=U(e.systemPrompt??``),d=l.trim(),f=d===(e.systemPrompt??``),p=d.length>Z;return P(!f),(0,G.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,G.jsx)(ae,{defaultRunner:e.defaultRunner,providerStatus:n,saving:c.isPending,onPick:e=>c.mutate({defaultRunner:e})}),(0,G.jsx)(Q,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:y(i).map(r=>{let{providerConnected:a,providerReason:o}=R(n,r.id),s=t[r.id],l=I(r.id,i,s),u=N(r.id,i,s?.data,[e.defaultModels[r.id]]),d=e.defaultModels[r.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,G.jsxs)(`label`,{className:`settings-option-row`,children:[(0,G.jsx)(`div`,{children:(0,G.jsx)(`h3`,{children:r.pickerLabel})}),e.modelsLocked?(0,G.jsx)(`output`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,G.jsxs)(`select`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,value:d,title:o??r.pickerDescription,disabled:c.isPending||!a,onChange:e=>c.mutate({defaultModels:{[r.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,G.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,G.jsxs)(Q,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,G.jsx)(L,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:l,onChange:e=>u(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,G.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,G.jsx)(k,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:f||p||c.isPending,onClick:()=>c.mutate({systemPrompt:d===``?null:d},{onSuccess:()=>D(d===``?`System prompt cleared`:`System prompt saved`)}),children:`Save prompt`}),p?(0,G.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[d.length.toLocaleString(),` characters — the limit is`,` `,Z.toLocaleString(),`.`]}):(0,G.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,G.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,G.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,G.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,G.jsx)(A,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:c.isPending,onCheckedChange:e=>c.mutate({liveTitleUpdates:e},{onSuccess:()=>D(e?`Live title updates on`:`Live title updates off`)})}),(0,G.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,G.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,G.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,G.jsx)(A,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:c.isPending,onCheckedChange:e=>c.mutate({reviewGate:e},{onSuccess:()=>D(e?`Review gate on`:`Review gate off`)})}),(0,G.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,G.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:a.data?.info?(0,G.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:c.isPending,onChange:e=>c.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,G.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),a.data.branches.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}):(0,G.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:a.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,G.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,G.jsx)(`summary`,{children:`Provider connections`}),(0,G.jsx)(ne,{})]})]})}function ae({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=C(),a=w(),s=c(),l=_(),u=d(),f=s.projectId??`default`,p=l.data?.info?.root,m=F(i.data,s.projectId,p),h=b().data,g=V(i.data?.profiles??[],h),v=z(g,h);return(0,G.jsxs)(Q,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,G.jsx)(H,{rows:g,runner:e,accountFor:e=>m?.[e]??null,providerStatus:t,disabled:n,accountDisabled:u.isPending||a.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&u.mutate({projectId:f,provider:t,profileId:n},{onError:e=>D(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&o(t.data,e)?.enabled===!1?(0,G.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,v?(0,G.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Q({title:e,hint:t,reportsDirty:n,children:r}){return(0,G.jsxs)(`section`,{"data-reports-dirty":n?``:void 0,className:`settings-field flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,G.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),r]})}function $({title:e,hint:t,children:n}){return(0,G.jsxs)(`section`,{className:`settings-option-row`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{children:e}),(0,G.jsx)(`p`,{children:t})]}),n]})}export{re as AgentDefaultsSection};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{vt as n}from"./queries-DzwCG927.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-BQ2y4XRB.js";import{Bn as s,Cn as c,ut as l}from"./index-CHIFhfha.js";var u=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),d=e(),f=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:u},{value:`dark`,label:`Dark`,icon:a}],p=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],m=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],h=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function g({slot:e,label:n,value:r,options:i,onChange:a}){return(0,d.jsx)(`div`,{role:`radiogroup`,"aria-label":n,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let n=e.value===r;return(0,d.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-value":e.value,onClick:()=>a(e.value),className:t(`flex min-h-11 items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,n?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,d.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function _({title:e,hint:t,children:n}){return(0,d.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,d.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function v(){let e=n(),{order:t,canReorder:r,reset:i}=c();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,d.jsx)(_,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,d.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function y(){let{theme:e,setTheme:t}=s(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:c}=l();return(0,d.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,d.jsx)(_,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,d.jsx)(g,{slot:`appearance-theme`,label:`Theme`,value:e,options:f,onChange:t})}),p.length>1?(0,d.jsx)(_,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,d.jsx)(g,{slot:`appearance-accent`,label:`Accent`,value:n,options:p,onChange:a})}):null,(0,d.jsx)(_,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,d.jsx)(g,{slot:`appearance-density`,label:`Density`,value:r,options:m,onChange:o})}),(0,d.jsx)(_,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,d.jsx)(g,{slot:`appearance-width`,label:`Reading width`,value:i,options:h,onChange:c})}),(0,d.jsx)(v,{}),(0,d.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,d.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,d.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,d.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-accent-strong/30 bg-accent-strong/10 px-4 py-3 text-xs text-accent-text`,children:`Open task`})]}),(0,d.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{y as AppearanceSection};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{vt as n}from"./queries-CihFAzQA.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-BQ2y4XRB.js";import{Bn as s,Cn as c,ut as l}from"./index-DCIRYVqB.js";var u=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),d=e(),f=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:u},{value:`dark`,label:`Dark`,icon:a}],p=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],m=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],h=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function g({slot:e,label:n,value:r,options:i,onChange:a}){return(0,d.jsx)(`div`,{role:`radiogroup`,"aria-label":n,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let n=e.value===r;return(0,d.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-value":e.value,onClick:()=>a(e.value),className:t(`flex min-h-11 items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,n?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,d.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function _({title:e,hint:t,children:n}){return(0,d.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,d.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function v(){let e=n(),{order:t,canReorder:r,reset:i}=c();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,d.jsx)(_,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,d.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function y(){let{theme:e,setTheme:t}=s(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:c}=l();return(0,d.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,d.jsx)(_,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,d.jsx)(g,{slot:`appearance-theme`,label:`Theme`,value:e,options:f,onChange:t})}),p.length>1?(0,d.jsx)(_,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,d.jsx)(g,{slot:`appearance-accent`,label:`Accent`,value:n,options:p,onChange:a})}):null,(0,d.jsx)(_,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,d.jsx)(g,{slot:`appearance-density`,label:`Density`,value:r,options:m,onChange:o})}),(0,d.jsx)(_,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,d.jsx)(g,{slot:`appearance-width`,label:`Reading width`,value:i,options:h,onChange:c})}),(0,d.jsx)(v,{}),(0,d.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,d.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,d.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,d.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-accent-strong/30 bg-accent-strong/10 px-4 py-3 text-xs text-accent-text`,children:`Open task`})]}),(0,d.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{y as AppearanceSection};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,ci as i,nn as a}from"./project-scope-context-D9axDY18.js";import{Lt as o,Mt as s,Rt as c,_ as l,in as u}from"./queries-DzwCG927.js";var d=e(t(),1),f=n();function p(){let e=l();return e.isPending?(0,f.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,f.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,f.jsx)(h,{config:e.data,scope:`project`})}function m(){let e=s();return e.isPending?(0,f.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Loading task settings…`}):e.isError?(0,f.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,f.jsx)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:(0,f.jsx)(h,{config:e.data,scope:`global`})})}function h({config:e,scope:t}){let n=(0,d.useId)(),s=i(),l=u({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?r({archiveOnMerge:e},n[0]):a({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?s.setQueryData(n,e):(s.setQueryData(c.config,e),s.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==c.config}))}});return(0,f.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`flex min-w-0 flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,f.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,f.jsx)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived.`})]}),(0,f.jsxs)(`select`,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-2 focus-visible:outline-ring active:bg-muted disabled:opacity-50`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:l.isPending,onChange:e=>l.mutate({archiveOnMerge:e.target.value===`inherit`?null:e.target.value===`enabled`,projectKey:o.config}),children:[(0,f.jsx)(`option`,{value:`inherit`,children:t===`project`?`Inherit global setting`:`Use default`}),(0,f.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,f.jsx)(`option`,{value:`disabled`,children:`Disabled`})]}),(0,f.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,f.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),l.isPending?(0,f.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,l.isError?(0,f.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,l.error.message]}):null]})}export{p as ArchiveOnMergeField,m as TasksSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,ci as i,nn as a}from"./project-scope-context-blU6DPq1.js";import{Lt as o,Mt as s,Rt as c,_ as l,in as u}from"./queries-CihFAzQA.js";var d=e(t(),1),f=n();function p(){let e=l();return e.isPending?(0,f.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,f.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,f.jsx)(h,{config:e.data,scope:`project`})}function m(){let e=s();return e.isPending?(0,f.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Loading task settings…`}):e.isError?(0,f.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,f.jsx)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:(0,f.jsx)(h,{config:e.data,scope:`global`})})}function h({config:e,scope:t}){let n=(0,d.useId)(),s=i(),l=u({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?r({archiveOnMerge:e},n[0]):a({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?s.setQueryData(n,e):(s.setQueryData(c.config,e),s.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==c.config}))}});return(0,f.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`flex min-w-0 flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,f.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,f.jsx)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived.`})]}),(0,f.jsxs)(`select`,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-2 focus-visible:outline-ring active:bg-muted disabled:opacity-50`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:l.isPending,onChange:e=>l.mutate({archiveOnMerge:e.target.value===`inherit`?null:e.target.value===`enabled`,projectKey:o.config}),children:[(0,f.jsx)(`option`,{value:`inherit`,children:t===`project`?`Inherit global setting`:`Use default`}),(0,f.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,f.jsx)(`option`,{value:`disabled`,children:`Disabled`})]}),(0,f.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,f.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),l.isPending?(0,f.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,l.isError?(0,f.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,l.error.message]}):null]})}export{p as ArchiveOnMergeField,m as TasksSection};
@@ -0,0 +1 @@
1
+ import{Tn as e,bn as t}from"./project-scope-context-blU6DPq1.js";function n(n){return t[e(n).bucket]<=t.waiting}export{n as t};
@@ -1 +1 @@
1
- import{B as e,G as t,I as n,W as r,j as i,z as a}from"./live-protocol-DteqtbyN.js";var o=new Map;function s(e){let t=o.get(e);return t||(t=new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),o.set(e,t)),t}function c(e,t){try{let n=s(t).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value),i=r(`year`),a=r(`month`),o=r(`day`);return{year:i,month:a,day:o,hour:r(`hour`)%24,minute:r(`minute`),second:r(`second`),weekday:l(i,a,o)}}catch{return null}}function l(e,t,n){return(new Date(Date.UTC(e,t-1,n)).getUTCDay()+6)%7+1}function u(e,t){let n=c(t,e);return n?Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-t:null}function d(e,t,n,r,i,a){let o=Date.UTC(e,t-1,n,r,i,0,0),s=o;for(let e=0;e<3;e+=1){let e=u(a,s);if(e===null)return null;let t=o-e;if(Math.abs(t-s)<1e3)return t;s=t}return s}function f(e){if(!e)return!1;try{return s(e).format(new Date(0)),!0}catch{return!1}}var p=[`daily`,`weekdays`,`weekly`,`hours`,`once`],m=[1,2,3,4,6,8,12],h=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],g=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],_=43200,v=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/,y=[`hour`,`minute`,`day`,`every`],b=[`at`,`timeZone`,`latestStartMinutes`],x=`the due time has passed; choose a later time or use Run now`,S=i([`paused`,`waiting`,`failed`,`missed`,`archived`]);function C(e){return`unknown time zone "${e}"; use an IANA name such as Europe/Warsaw`}var w=e({type:i(p),hour:a().int().min(0).max(23).optional(),minute:a().int().min(0).max(59).optional(),day:a().int().min(1).max(7).optional(),every:t([n(1),n(2),n(3),n(4),n(6),n(8),n(12)]).optional(),at:r().regex(v,`at must be YYYY-MM-DDTHH:MM`).optional(),timeZone:r().optional(),latestStartMinutes:a().int().min(10).max(_).optional()}).superRefine((e,t)=>{let n=t=>e[t]!==void 0,r=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type!==`once`){for(let e of b)n(e)&&r(e,`${e} applies only to a once schedule`);return}for(let e of y)n(e)&&r(e,`${e} does not apply to a once schedule`);e.at===void 0?r(`at`,`a once schedule needs at (YYYY-MM-DDTHH:MM)`):v.test(e.at)&&!O(e.at)&&r(`at`,`at is not a real date and time`),e.timeZone===void 0?r(`timeZone`,`a once schedule needs a timeZone`):f(e.timeZone)||r(`timeZone`,C(e.timeZone))});function T(e){return{type:e.type,hour:e.hour??4,minute:e.minute??0,day:e.day??1,every:e.every??6,...e.at===void 0?{}:{at:e.at},...e.timeZone===void 0?{}:{timeZone:e.timeZone},...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}function E(e){if(e.type!==`once`||!e.at||!e.timeZone)return null;let t=D(e.at);return t&&d(t.year,t.month,t.day,t.hour,t.minute,e.timeZone)}function D(e){let t=v.exec(e);if(!t)return null;let[n,r,i,a,o]=t.slice(1).map(Number),s=new Date(Date.UTC(n,r,0)).getUTCDate();return r<1||r>12||i<1||i>s||a>23||o>59?null:{year:n,month:r,day:i,hour:a,minute:o}}var O=e=>D(e)!==null,k=e=>String(e).padStart(2,`0`);function A(e,t=0){return`${k(e)}:${k(t)}`}function j(e){let t=T(e);switch(t.type){case`once`:return M(t);case`daily`:return`every day at ${A(t.hour,t.minute)}`;case`weekdays`:return`weekdays at ${A(t.hour,t.minute)}`;case`hours`:return t.every===1?`every hour`:`every ${t.every} hours`;case`weekly`:return`${g[t.day-1]}s at ${A(t.hour,t.minute)}`}}function M(e){let t=e.at?D(e.at):null;if(!t)return`once`;let{year:n,month:r,day:i,hour:a,minute:o}=t;return`once on ${h[l(n,r,i)-1]} ${i} ${N[r-1]} ${n} at ${A(a,o)} (${e.timeZone??`UTC`})`}var N=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function P(e){let t=T(e);switch(t.type){case`once`:throw Error(`a once schedule has no cron form`);case`daily`:return`${t.minute} ${t.hour} * * *`;case`weekdays`:return`${t.minute} ${t.hour} * * 1-5`;case`hours`:return`0 */${t.every} * * *`;case`weekly`:return`${t.minute} ${t.hour} * * ${t.day%7}`}}function F(e,t){switch(e.type){case`once`:return[];case`daily`:return[[e.hour,e.minute]];case`weekdays`:return t<=5?[[e.hour,e.minute]]:[];case`weekly`:return t===e.day?[[e.hour,e.minute]]:[];case`hours`:{let t=[];for(let n=0;n<24;n+=e.every)t.push([n,0]);return t}}}function I(e,t,n,r,i=1e3){if(e.type===`once`){let r=E(e);return r!==null&&r>=t&&r<n&&i>0?[r]:[]}let a=T(e),o=c(t,r);if(!o||n<=t)return[];let s=[],u=Math.ceil((n-t)/864e5)+2;for(let e=-1;e<=u;e+=1){let c=new Date(Date.UTC(o.year,o.month-1,o.day+e)),u=c.getUTCFullYear(),f=c.getUTCMonth()+1,p=c.getUTCDate();for(let[e,o]of F(a,l(u,f,p))){let a=d(u,f,p,e,o,r);if(a===null||a!==s.at(-1)&&a>=t&&a<n&&(s.push(a),s.length>=i))return s}}return s}function L(e,t){let n=t-e;if(n<=0)return`now`;let r=Math.floor(n/6e4);if(r<1)return`in <1m`;if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}var R=new Map;function z(e,t){if(!Number.isFinite(e))return null;let n=R.get(t);try{n??=new Intl.DateTimeFormat(`en-GB`,{timeZone:t,weekday:`short`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}catch{return null}R.set(t,n);let r={};for(let t of n.formatToParts(e))r[t.type]=t.value;let i=new Date(`${r.month} 1, ${r.year} UTC`).getUTCMonth();return{weekday:r.weekday,day:r.day,month:r.month,hour:r.hour,minute:r.minute,key:`${r.year}-${i}-${r.day}`,dayNumber:Math.floor(Date.UTC(Number(r.year),i,Number(r.day))/864e5)}}function B(e,t){let n=z(Date.parse(e),t);return n?`${n.weekday} ${n.hour}:${n.minute}`:e}function V(e,t,n){let r=z(Date.parse(e),t),i=z(n,t);if(!r||!i)return e;let a=`${r.hour}:${r.minute}`,o=i.dayNumber-r.dayNumber;return o===0?`Today ${a}`:o===1?`Yesterday ${a}`:o>1&&o<7?`${r.weekday} ${a}`:`${r.day} ${r.month} ${a}`}var H=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],U=e=>String(e).padStart(2,`0`);function W(e){let t=e?D(e):null;if(!t)return null;let{year:n,month:r,day:i,hour:a,minute:o}=t;return{date:`${h[l(n,r,i)-1]} ${i} ${H[r-1]} ${n}`,time:`${U(a)}:${U(o)}`}}var G=36e5;function K(e){let t=E(e),n=e.timeZone,r=W(e.at),i=t===null||!n?null:c(t,n);if(t===null||!n||!r||!i)return null;let a={date:`${h[l(i.year,i.month,i.day)-1]} ${i.day} ${H[i.month-1]} ${i.year}`,time:`${U(i.hour)}:${U(i.minute)}`};if(a.date!==r.date||a.time!==r.time)return{...a,note:`${r.time} does not exist on ${r.date} in ${n}.`};let o=e=>{let t=c(e,n);return!!t&&t.day===i.day&&t.hour===i.hour&&t.minute===i.minute},s=(u(n,t-12*G)??0)-(u(n,t+12*G)??0);if(s<=0)return a;let d=o(t+s);if(!d&&!o(t-s))return a;let f=(u(n,t)??0)/6e4,p=`UTC${f<0?`-`:`+`}${U(Math.floor(Math.abs(f)/60))}:${U(Math.abs(f)%60)}`;return{...a,note:`${r.time} happens twice that day; it runs at ${d?`the first`:`the second`} (${p}).`}}export{f as _,x as a,w as c,I as d,E as f,C as g,j as h,L as i,P as l,D as m,V as n,m as o,S as p,K as r,h as s,B as t,T as u,c as v};
1
+ import{B as e,G as t,I as n,W as r,j as i,z as a}from"./live-protocol-DMhTnCmf.js";var o=new Map;function s(e){let t=o.get(e);return t||(t=new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),o.set(e,t)),t}function c(e,t){try{let n=s(t).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value),i=r(`year`),a=r(`month`),o=r(`day`);return{year:i,month:a,day:o,hour:r(`hour`)%24,minute:r(`minute`),second:r(`second`),weekday:l(i,a,o)}}catch{return null}}function l(e,t,n){return(new Date(Date.UTC(e,t-1,n)).getUTCDay()+6)%7+1}function u(e,t){let n=c(t,e);return n?Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-t:null}function d(e,t,n,r,i,a){let o=Date.UTC(e,t-1,n,r,i,0,0),s=o;for(let e=0;e<3;e+=1){let e=u(a,s);if(e===null)return null;let t=o-e;if(Math.abs(t-s)<1e3)return t;s=t}return s}function f(e){if(!e)return!1;try{return s(e).format(new Date(0)),!0}catch{return!1}}var p=[`daily`,`weekdays`,`weekly`,`hours`,`once`],m=[1,2,3,4,6,8,12],h=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],g=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],_=43200,v=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/,y=[`hour`,`minute`,`day`,`every`],b=[`at`,`timeZone`,`latestStartMinutes`],x=`the due time has passed; choose a later time or use Run now`,S=i([`paused`,`waiting`,`failed`,`missed`,`archived`]);function C(e){return`unknown time zone "${e}"; use an IANA name such as Europe/Warsaw`}var w=e({type:i(p),hour:a().int().min(0).max(23).optional(),minute:a().int().min(0).max(59).optional(),day:a().int().min(1).max(7).optional(),every:t([n(1),n(2),n(3),n(4),n(6),n(8),n(12)]).optional(),at:r().regex(v,`at must be YYYY-MM-DDTHH:MM`).optional(),timeZone:r().optional(),latestStartMinutes:a().int().min(10).max(_).optional()}).superRefine((e,t)=>{let n=t=>e[t]!==void 0,r=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type!==`once`){for(let e of b)n(e)&&r(e,`${e} applies only to a once schedule`);return}for(let e of y)n(e)&&r(e,`${e} does not apply to a once schedule`);e.at===void 0?r(`at`,`a once schedule needs at (YYYY-MM-DDTHH:MM)`):v.test(e.at)&&!O(e.at)&&r(`at`,`at is not a real date and time`),e.timeZone===void 0?r(`timeZone`,`a once schedule needs a timeZone`):f(e.timeZone)||r(`timeZone`,C(e.timeZone))});function T(e){return{type:e.type,hour:e.hour??4,minute:e.minute??0,day:e.day??1,every:e.every??6,...e.at===void 0?{}:{at:e.at},...e.timeZone===void 0?{}:{timeZone:e.timeZone},...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}function E(e){if(e.type!==`once`||!e.at||!e.timeZone)return null;let t=D(e.at);return t&&d(t.year,t.month,t.day,t.hour,t.minute,e.timeZone)}function D(e){let t=v.exec(e);if(!t)return null;let[n,r,i,a,o]=t.slice(1).map(Number),s=new Date(Date.UTC(n,r,0)).getUTCDate();return r<1||r>12||i<1||i>s||a>23||o>59?null:{year:n,month:r,day:i,hour:a,minute:o}}var O=e=>D(e)!==null,k=e=>String(e).padStart(2,`0`);function A(e,t=0){return`${k(e)}:${k(t)}`}function j(e){let t=T(e);switch(t.type){case`once`:return M(t);case`daily`:return`every day at ${A(t.hour,t.minute)}`;case`weekdays`:return`weekdays at ${A(t.hour,t.minute)}`;case`hours`:return t.every===1?`every hour`:`every ${t.every} hours`;case`weekly`:return`${g[t.day-1]}s at ${A(t.hour,t.minute)}`}}function M(e){let t=e.at?D(e.at):null;if(!t)return`once`;let{year:n,month:r,day:i,hour:a,minute:o}=t;return`once on ${h[l(n,r,i)-1]} ${i} ${N[r-1]} ${n} at ${A(a,o)} (${e.timeZone??`UTC`})`}var N=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function P(e){let t=T(e);switch(t.type){case`once`:throw Error(`a once schedule has no cron form`);case`daily`:return`${t.minute} ${t.hour} * * *`;case`weekdays`:return`${t.minute} ${t.hour} * * 1-5`;case`hours`:return`0 */${t.every} * * *`;case`weekly`:return`${t.minute} ${t.hour} * * ${t.day%7}`}}function F(e,t){switch(e.type){case`once`:return[];case`daily`:return[[e.hour,e.minute]];case`weekdays`:return t<=5?[[e.hour,e.minute]]:[];case`weekly`:return t===e.day?[[e.hour,e.minute]]:[];case`hours`:{let t=[];for(let n=0;n<24;n+=e.every)t.push([n,0]);return t}}}function I(e,t,n,r,i=1e3){if(e.type===`once`){let r=E(e);return r!==null&&r>=t&&r<n&&i>0?[r]:[]}let a=T(e),o=c(t,r);if(!o||n<=t)return[];let s=[],u=Math.ceil((n-t)/864e5)+2;for(let e=-1;e<=u;e+=1){let c=new Date(Date.UTC(o.year,o.month-1,o.day+e)),u=c.getUTCFullYear(),f=c.getUTCMonth()+1,p=c.getUTCDate();for(let[e,o]of F(a,l(u,f,p))){let a=d(u,f,p,e,o,r);if(a===null||a!==s.at(-1)&&a>=t&&a<n&&(s.push(a),s.length>=i))return s}}return s}function L(e,t){let n=t-e;if(n<=0)return`now`;let r=Math.floor(n/6e4);if(r<1)return`in <1m`;if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}var R=new Map;function z(e,t){if(!Number.isFinite(e))return null;let n=R.get(t);try{n??=new Intl.DateTimeFormat(`en-GB`,{timeZone:t,weekday:`short`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}catch{return null}R.set(t,n);let r={};for(let t of n.formatToParts(e))r[t.type]=t.value;let i=new Date(`${r.month} 1, ${r.year} UTC`).getUTCMonth();return{weekday:r.weekday,day:r.day,month:r.month,hour:r.hour,minute:r.minute,key:`${r.year}-${i}-${r.day}`,dayNumber:Math.floor(Date.UTC(Number(r.year),i,Number(r.day))/864e5)}}function B(e,t){let n=z(Date.parse(e),t);return n?`${n.weekday} ${n.hour}:${n.minute}`:e}function V(e,t,n){let r=z(Date.parse(e),t),i=z(n,t);if(!r||!i)return e;let a=`${r.hour}:${r.minute}`,o=i.dayNumber-r.dayNumber;return o===0?`Today ${a}`:o===1?`Yesterday ${a}`:o>1&&o<7?`${r.weekday} ${a}`:`${r.day} ${r.month} ${a}`}var H=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],U=e=>String(e).padStart(2,`0`);function W(e){let t=e?D(e):null;if(!t)return null;let{year:n,month:r,day:i,hour:a,minute:o}=t;return{date:`${h[l(n,r,i)-1]} ${i} ${H[r-1]} ${n}`,time:`${U(a)}:${U(o)}`}}var G=36e5;function K(e){let t=E(e),n=e.timeZone,r=W(e.at),i=t===null||!n?null:c(t,n);if(t===null||!n||!r||!i)return null;let a={date:`${h[l(i.year,i.month,i.day)-1]} ${i.day} ${H[i.month-1]} ${i.year}`,time:`${U(i.hour)}:${U(i.minute)}`};if(a.date!==r.date||a.time!==r.time)return{...a,note:`${r.time} does not exist on ${r.date} in ${n}.`};let o=e=>{let t=c(e,n);return!!t&&t.day===i.day&&t.hour===i.hour&&t.minute===i.minute},s=(u(n,t-12*G)??0)-(u(n,t+12*G)??0);if(s<=0)return a;let d=o(t+s);if(!d&&!o(t-s))return a;let f=(u(n,t)??0)/6e4,p=`UTC${f<0?`-`:`+`}${U(Math.floor(Math.abs(f)/60))}:${U(Math.abs(f)%60)}`;return{...a,note:`${r.time} happens twice that day; it runs at ${d?`the first`:`the second`} (${p}).`}}export{f as _,x as a,w as c,I as d,E as f,C as g,j as h,L as i,P as l,D as m,V as n,m as o,S as p,K as r,h as s,B as t,T as u,c as v};