@kubitnodes/stellaris 0.3.15 → 0.3.16

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 (57) hide show
  1. package/dist/cli/index.js +47 -18
  2. package/dist/server/index.js +66 -18
  3. package/package.json +1 -1
  4. package/web/dist/assets/BackLink-B5n6YQVF.js +1 -0
  5. package/web/dist/assets/{ChannelForms-b6eKogvP.js → ChannelForms-mdOuU6eZ.js} +1 -1
  6. package/web/dist/assets/ChannelView-CeoMScnt.js +2 -0
  7. package/web/dist/assets/CitizenView-B_AL8Fnt.js +2 -0
  8. package/web/dist/assets/{CitizensView-Dq3V4mpg.js → CitizensView--LjujB8k.js} +1 -1
  9. package/web/dist/assets/{CliIcon-DxDvRRcX.js → CliIcon-Cyv7ef-2.js} +1 -1
  10. package/web/dist/assets/CronsView-DGGDT8e-.js +1 -0
  11. package/web/dist/assets/{KnowledgeView-ndWDlRoP.js → KnowledgeView-CMYgeq6t.js} +1 -1
  12. package/web/dist/assets/Markdown-CI8CWgHq.js +32 -0
  13. package/web/dist/assets/{MessageItem-Dk1m5NaR.js → MessageItem-Dtpufq_V.js} +1 -1
  14. package/web/dist/assets/MetricsView-CDtVttH_.js +1 -0
  15. package/web/dist/assets/NeedsYouView-DuVBOLn4.js +1 -0
  16. package/web/dist/assets/Overview-BMatmD0p.js +1 -0
  17. package/web/dist/assets/{Pane-CODhA5zE.js → Pane-L4GJKBiw.js} +1 -1
  18. package/web/dist/assets/{Picker-DB-wxloY.js → Picker-h6akABv6.js} +1 -1
  19. package/web/dist/assets/{ProjectView-CH-nqrAo.js → ProjectView-t3cOK3AT.js} +1 -1
  20. package/web/dist/assets/ProposalView-BRr85RPY.js +1 -0
  21. package/web/dist/assets/{ProposalsView-Bmuq8Qnh.js → ProposalsView-ffQA37Wa.js} +1 -1
  22. package/web/dist/assets/{RunnersView-N4iUU4FM.js → RunnersView-BD0XRmGY.js} +1 -1
  23. package/web/dist/assets/{SocietyView-fSkmFC3z.js → SocietyView-CsbeXgkb.js} +1 -1
  24. package/web/dist/assets/{SubjectThread-akZdGCfo.js → SubjectThread-DnQJDgcK.js} +1 -1
  25. package/web/dist/assets/TaskFileView-uJ9xM8Y0.js +4 -0
  26. package/web/dist/assets/TaskView-CkMhrkxY.js +3 -0
  27. package/web/dist/assets/{TasksView-CncU8UNJ.js → TasksView-BuAqdPIa.js} +1 -1
  28. package/web/dist/assets/ThreadCard-CkqMOMDh.js +1 -0
  29. package/web/dist/assets/{ThreadForms-RnrV7V5X.js → ThreadForms-Bciw71n3.js} +1 -1
  30. package/web/dist/assets/{ThreadView-DrwqggME.js → ThreadView-CpdtYhHa.js} +1 -1
  31. package/web/dist/assets/{citizen-BRSvyK2X.js → citizen-Cyd1haJO.js} +1 -1
  32. package/web/dist/assets/{compose-D7DOz6kC.js → compose-BCqmtrsZ.js} +1 -1
  33. package/web/dist/assets/{format-BORdp4w-.js → format-qPQgH1PF.js} +1 -1
  34. package/web/dist/assets/{governance-WrDQawLN.js → governance-D5tD2NOI.js} +1 -1
  35. package/web/dist/assets/index-BfZnvrmA.js +23 -0
  36. package/web/dist/assets/index-BoTts74M.css +2 -0
  37. package/web/dist/assets/link-DF__7B1f.js +1 -0
  38. package/web/dist/assets/{tasks-C-9dAYQV.js → tasks-DcovWYAU.js} +1 -1
  39. package/web/dist/assets/useMatch-AToHy-wD.js +1 -0
  40. package/web/dist/assets/{useStickyScroll-CE7dyz0Q.js → useStickyScroll-BFNyJYps.js} +1 -1
  41. package/web/dist/index.html +9 -9
  42. package/web/dist/assets/BackLink-hLg9AYSp.js +0 -1
  43. package/web/dist/assets/ChannelView-CHvr0c9I.js +0 -1
  44. package/web/dist/assets/CitizenView-DlqilbFH.js +0 -2
  45. package/web/dist/assets/CronsView-CBiPaq-C.js +0 -1
  46. package/web/dist/assets/Markdown-BMm7unnl.js +0 -31
  47. package/web/dist/assets/MetricsView-B31t_Q2z.js +0 -1
  48. package/web/dist/assets/NeedsYouView-d8_ydJI9.js +0 -1
  49. package/web/dist/assets/Overview-D-6YP-tf.js +0 -1
  50. package/web/dist/assets/ProposalView-D-E0Hzdr.js +0 -1
  51. package/web/dist/assets/TaskFileView-DM_JjQQx.js +0 -4
  52. package/web/dist/assets/TaskView-JLLJKQ0_.js +0 -3
  53. package/web/dist/assets/ThreadCard-8OB70j9B.js +0 -1
  54. package/web/dist/assets/index-Dw96wkep.css +0 -2
  55. package/web/dist/assets/index-ww_EHgVF.js +0 -23
  56. package/web/dist/assets/link-1v5lugnf.js +0 -1
  57. package/web/dist/assets/useMatch-CyeFfbcR.js +0 -1
@@ -1 +1 @@
1
- import{E as e,O as t,Sn as n,Tn as r,b as i,bn as a,d as o,k as s,t as c,x as l,xn as u}from"./format-BORdp4w-.js";import{l as d,s as f}from"./compose-D7DOz6kC.js";import{t as p}from"./CliIcon-DxDvRRcX.js";import{O as m}from"./index-ww_EHgVF.js";import{n as h,r as g}from"./ThreadForms-RnrV7V5X.js";import{n as _,t as v}from"./Pane-CODhA5zE.js";var y=r(n(),1);function b(e){return e.toUpperCase().replaceAll(/[^A-Z0-9]/g,``)}function x(e,t){return t!==void 0&&e.version!==void 0&&e.version!==t}function S(e,t){return b(e)===b(t)}function C(e,t){let n=(e.split(`.`)[0]??``).toLowerCase().replaceAll(/[^a-z0-9-]+/g,`-`).replaceAll(/-+/g,`-`).replace(/^-+/,``).slice(0,32).replace(/-+$/,``)||`runner`;if(!t.includes(n))return n;for(let e=2;;e+=1){let r=`-${e}`,i=`${n.slice(0,32-r.length)}${r}`;if(!t.includes(i))return i}}var w=u();function T(e,t){return Number(e.status!==`connected`)-Number(t.status!==`connected`)||e.name.localeCompare(t.name)}function E(e,t){return[e.length===0?`no CLI`:e.join(`, `),...t].join(` · `)}function D({enrollment:e,taken:t,followed:n,now:r}){let{api:i}=s(),o=a(),[l,u]=(0,y.useState)(()=>C(e.hostname,t)),p=()=>{o.invalidateQueries({queryKey:[`enrollments`]}),o.invalidateQueries({queryKey:[`runners`]})},m=d({mutationFn:()=>i.approveEnrollment(e.userCode,l.trim()),onSuccess:p}),_=d({mutationFn:()=>i.denyEnrollment(e.userCode),onSuccess:p}),v=m.isPending||_.isPending;return(0,w.jsxs)(`li`,{className:`rounded-xl border px-3 py-3 ${n?`border-amber-500/40 bg-amber-500/5`:`border-line`}`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,w.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary`,children:e.hostname}),(0,w.jsx)(`code`,{className:`shrink-0 font-mono text-sm text-fg-primary`,children:e.userCode})]}),(0,w.jsxs)(`p`,{className:`mt-0.5 truncate text-meta`,children:[e.os,` · `,E(e.clis,e.capabilities),` · runner`,` `,e.version,` · asked `,c(e.requestedAt,r)]}),(0,w.jsxs)(`form`,{"aria-label":`Approve ${e.hostname}`,className:`mt-2.5 flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,w.jsx)(`input`,{value:l,maxLength:32,spellCheck:!1,"aria-label":`Runner name`,onChange:e=>u(e.target.value),className:`${h} min-w-0 flex-1 font-mono`}),(0,w.jsx)(f,{onClick:()=>_.mutate(),disabled:v,children:`Deny`}),(0,w.jsx)(f,{variant:`primary`,type:`submit`,disabled:v||l.trim()===``,children:m.isPending?`Approving…`:`Approve`})]}),(0,w.jsx)(`div`,{className:`mt-1.5`,children:(0,w.jsx)(g,{error:m.error??_.error})})]})}function O(){let{code:n}=m({from:`/runners`}),r=o(),a=e(),s=l(),u=t().data,d=i(3e4),f=r.data??[],h=(a.data??[]).map(e=>e.name),g=(a.data??[]).toSorted(T),y=g.filter(e=>e.status===`connected`).length,b=g.length-y,C=g.filter(e=>x(e,u)).length,E=n===void 0?void 0:f.find(e=>S(e.userCode,n)),O=E===void 0?f:[E,...f.filter(e=>e!==E)],k=e=>(s.data??[]).filter(t=>t.runner===e.name&&t.archived===void 0).map(e=>e.slug);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(v,{title:`Runners`,subtitle:[`${y} connected`,...b===0?[]:[`${b} away`],...f.length===0?[]:[`${f.length} waiting for approval`],...u===void 0?[]:[`server v${u}`],...C===0?[]:[`${C} on another version`]].join(` · `)}),(0,w.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[n!==void 0&&r.data!==void 0&&E===void 0?(0,w.jsxs)(`output`,{className:`block px-2 pb-2 text-meta`,children:[`No runner waits with the code `,n,`. It may have been approved, denied, or expired; a runner whose code expired asks again with a new one.`]}):null,O.length===0?null:(0,w.jsx)(`ul`,{"aria-label":`Waiting for approval`,className:`space-y-2 px-2 pb-3`,children:O.map(e=>(0,w.jsx)(D,{enrollment:e,taken:h,followed:e===E,now:d},e.userCode))}),a.data===void 0?(0,w.jsx)(_,{children:`Reading the runners…`}):g.length===0?(0,w.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No runners yet.`}):null,(0,w.jsx)(`ul`,{"aria-label":`Registered`,className:`grid grid-cols-[auto_auto_auto_auto_minmax(0,max-content)_minmax(3rem,1fr)_auto] gap-x-3`,children:g.map(e=>{let t=e.clis.length===0?`no CLI`:e.clis.join(`, `),n=k(e),r=n.length===0?`no projects`:n.join(`, `),i=e.status===`connected`?{label:`connected`,detail:`connected`,tone:`text-fg-muted`}:{label:`away`,detail:`away${e.lastSeen===void 0?``:`, last seen ${c(e.lastSeen,d)}`}`,tone:`text-amber-300`};return(0,w.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm`,children:[(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,title:t,children:[e.clis.map(e=>(0,w.jsx)(p,{cli:e,size:13},e)),(0,w.jsx)(`span`,{className:`sr-only`,children:t})]}),(0,w.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,w.jsx)(`span`,{className:`text-fg-secondary`,children:e.os}),x(e,u)?(0,w.jsxs)(`span`,{className:`text-xs text-amber-300`,title:`the server runs v${u}`,children:[`v`,e.version,(0,w.jsxs)(`span`,{className:`sr-only`,children:[`, not the server's v`,u]})]}):(0,w.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version===void 0?``:`v${e.version}`}),(0,w.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:e.capabilities.join(`, `),children:e.capabilities.join(`, `)}),(0,w.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,w.jsx)(`span`,{className:`text-right text-xs ${i.tone}`,title:i.detail,children:i.label})]},e.name)})}),r.data===void 0||f.length>0?null:(0,w.jsx)(`p`,{className:`mt-2 border-t border-line px-2 pt-2 text-meta`,children:`A runner started with STELLARIS_SERVER_URL set to this board and no token asks to join here, with a code to approve.`})]})]})}export{O as RunnersView};
1
+ import{Cn as e,Dn as t,E as n,O as r,Sn as i,b as a,d as o,k as s,t as c,wn as l,x as u}from"./format-qPQgH1PF.js";import{l as d,s as f}from"./compose-BCqmtrsZ.js";import{t as p}from"./CliIcon-Cyv7ef-2.js";import{O as m}from"./index-BfZnvrmA.js";import{n as h,r as g}from"./ThreadForms-Bciw71n3.js";import{n as _,t as v}from"./Pane-L4GJKBiw.js";var y=t(l(),1);function b(e){return e.toUpperCase().replaceAll(/[^A-Z0-9]/g,``)}function x(e,t){return t!==void 0&&e.version!==void 0&&e.version!==t}function S(e,t){return b(e)===b(t)}function C(e,t){let n=(e.split(`.`)[0]??``).toLowerCase().replaceAll(/[^a-z0-9-]+/g,`-`).replaceAll(/-+/g,`-`).replace(/^-+/,``).slice(0,32).replace(/-+$/,``)||`runner`;if(!t.includes(n))return n;for(let e=2;;e+=1){let r=`-${e}`,i=`${n.slice(0,32-r.length)}${r}`;if(!t.includes(i))return i}}var w=e();function T(e,t){return Number(e.status!==`connected`)-Number(t.status!==`connected`)||e.name.localeCompare(t.name)}function E(e,t){return[e.length===0?`no CLI`:e.join(`, `),...t].join(` · `)}function D({enrollment:e,taken:t,followed:n,now:r}){let{api:a}=s(),o=i(),[l,u]=(0,y.useState)(()=>C(e.hostname,t)),p=()=>{o.invalidateQueries({queryKey:[`enrollments`]}),o.invalidateQueries({queryKey:[`runners`]})},m=d({mutationFn:()=>a.approveEnrollment(e.userCode,l.trim()),onSuccess:p}),_=d({mutationFn:()=>a.denyEnrollment(e.userCode),onSuccess:p}),v=m.isPending||_.isPending;return(0,w.jsxs)(`li`,{className:`rounded-xl border px-3 py-3 ${n?`border-amber-500/40 bg-amber-500/5`:`border-line`}`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,w.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary`,children:e.hostname}),(0,w.jsx)(`code`,{className:`shrink-0 font-mono text-sm text-fg-primary`,children:e.userCode})]}),(0,w.jsxs)(`p`,{className:`mt-0.5 truncate text-meta`,children:[e.os,` · `,E(e.clis,e.capabilities),` · runner`,` `,e.version,` · asked `,c(e.requestedAt,r)]}),(0,w.jsxs)(`form`,{"aria-label":`Approve ${e.hostname}`,className:`mt-2.5 flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,w.jsx)(`input`,{value:l,maxLength:32,spellCheck:!1,"aria-label":`Runner name`,onChange:e=>u(e.target.value),className:`${h} min-w-0 flex-1 font-mono`}),(0,w.jsx)(f,{onClick:()=>_.mutate(),disabled:v,children:`Deny`}),(0,w.jsx)(f,{variant:`primary`,type:`submit`,disabled:v||l.trim()===``,children:m.isPending?`Approving…`:`Approve`})]}),(0,w.jsx)(`div`,{className:`mt-1.5`,children:(0,w.jsx)(g,{error:m.error??_.error})})]})}function O(){let{code:e}=m({from:`/runners`}),t=o(),i=n(),s=u(),l=r().data,d=a(3e4),f=t.data??[],h=(i.data??[]).map(e=>e.name),g=(i.data??[]).toSorted(T),y=g.filter(e=>e.status===`connected`).length,b=g.length-y,C=g.filter(e=>x(e,l)).length,E=e===void 0?void 0:f.find(t=>S(t.userCode,e)),O=E===void 0?f:[E,...f.filter(e=>e!==E)],k=e=>(s.data??[]).filter(t=>t.runner===e.name&&t.archived===void 0).map(e=>e.slug);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(v,{title:`Runners`,subtitle:[`${y} connected`,...b===0?[]:[`${b} away`],...f.length===0?[]:[`${f.length} waiting for approval`],...l===void 0?[]:[`server v${l}`],...C===0?[]:[`${C} on another version`]].join(` · `)}),(0,w.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e!==void 0&&t.data!==void 0&&E===void 0?(0,w.jsxs)(`output`,{className:`block px-2 pb-2 text-meta`,children:[`No runner waits with the code `,e,`. It may have been approved, denied, or expired; a runner whose code expired asks again with a new one.`]}):null,O.length===0?null:(0,w.jsx)(`ul`,{"aria-label":`Waiting for approval`,className:`space-y-2 px-2 pb-3`,children:O.map(e=>(0,w.jsx)(D,{enrollment:e,taken:h,followed:e===E,now:d},e.userCode))}),i.data===void 0?(0,w.jsx)(_,{children:`Reading the runners…`}):g.length===0?(0,w.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No runners yet.`}):null,(0,w.jsx)(`ul`,{"aria-label":`Registered`,className:`grid grid-cols-[auto_auto_auto_auto_minmax(0,max-content)_minmax(3rem,1fr)_auto] gap-x-3`,children:g.map(e=>{let t=e.clis.length===0?`no CLI`:e.clis.join(`, `),n=k(e),r=n.length===0?`no projects`:n.join(`, `),i=e.status===`connected`?{label:`connected`,detail:`connected`,tone:`text-fg-muted`}:{label:`away`,detail:`away${e.lastSeen===void 0?``:`, last seen ${c(e.lastSeen,d)}`}`,tone:`text-amber-300`};return(0,w.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm`,children:[(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,title:t,children:[e.clis.map(e=>(0,w.jsx)(p,{cli:e,size:13},e)),(0,w.jsx)(`span`,{className:`sr-only`,children:t})]}),(0,w.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,w.jsx)(`span`,{className:`text-fg-secondary`,children:e.os}),x(e,l)?(0,w.jsxs)(`span`,{className:`text-xs text-amber-300`,title:`the server runs v${l}`,children:[`v`,e.version,(0,w.jsxs)(`span`,{className:`sr-only`,children:[`, not the server's v`,l]})]}):(0,w.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version===void 0?``:`v${e.version}`}),(0,w.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:e.capabilities.join(`, `),children:e.capabilities.join(`, `)}),(0,w.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,w.jsx)(`span`,{className:`text-right text-xs ${i.tone}`,title:i.detail,children:i.label})]},e.name)})}),t.data===void 0||f.length>0?null:(0,w.jsx)(`p`,{className:`mt-2 border-t border-line px-2 pt-2 text-meta`,children:`A runner started with STELLARIS_SERVER_URL set to this board and no token asks to join here, with a code to approve.`})]})]})}export{O as RunnersView};
@@ -1 +1 @@
1
- import{Dt as e,M as t,Sn as n,T as r,Tn as i,_ as a,b as o,c as s,h as c,j as l,ut as u,x as d,xn as f}from"./format-BORdp4w-.js";import{s as p}from"./compose-D7DOz6kC.js";import{n as m,r as h}from"./ChannelForms-b6eKogvP.js";import{n as g,t as _}from"./Pane-CODhA5zE.js";import{n as v,r as y,t as b}from"./Overview-D-6YP-tf.js";var x=i(n(),1),S=f();function C(){let n=t(),i=a(),f=d(),C=r(),w=l(),T=c(u),E=s(),D=o(3e4),[O,k]=(0,x.useState)(!1);if(n.data===void 0||i.data===void 0)return(0,S.jsx)(g,{children:`Reading the society…`});let A=i.data.filter(e=>e.cli!==null),j=A.filter(e=>e.status===`active`),M=A.filter(e=>e.status===`retired`),N=(C.data??[]).filter(t=>t.name!==e);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_,{title:n.data.name,subtitle:`${j.length} citizens · ${f.data?.length??0} projects · ${N.length} roles`}),O?(0,S.jsx)(h,{project:null,onDone:()=>k(!1)}):null,(0,S.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,S.jsxs)(v,{title:`Citizens`,children:[(0,S.jsx)(b,{members:j,scope:u}),M.length===0?null:(0,S.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Retired: `,M.map(e=>e.name).join(`, `)]})]}),(0,S.jsx)(v,{title:`Channels`,aside:O?null:(0,S.jsx)(p,{onClick:()=>k(!0),children:`New channel…`}),children:(0,S.jsx)(m,{channels:(E.data??[]).filter(e=>e.project===null),now:D})}),(0,S.jsx)(v,{title:`Roles`,children:(0,S.jsx)(`ul`,{className:`space-y-2.5`,children:N.map(e=>{let t=j.filter(t=>t.role===e.name).length;return(0,S.jsxs)(`li`,{children:[(0,S.jsxs)(`p`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,S.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,S.jsxs)(`span`,{className:`text-meta`,children:[t===1?`1 member`:`${t} members`,e.resident?` · warm session`:``,e.societyScope?` · society role`:``]})]}),(0,S.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:e.purpose})]},e.name)})})}),(0,S.jsx)(v,{title:`Knowledge`,children:(0,S.jsx)(y,{scope:u,topics:T.data,now:D})}),(0,S.jsx)(v,{title:`Skills`,children:w.data===void 0?(0,S.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):w.data.length===0?(0,S.jsx)(`p`,{className:`text-meta`,children:`None yet. A citizen's skill joins the society by proposal.`}):(0,S.jsx)(`ul`,{className:`space-y-1.5`,children:w.data.map(e=>(0,S.jsxs)(`li`,{className:`text-sm`,children:[(0,S.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,S.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]},e.name))})})]})]})}export{C as SocietyView};
1
+ import{Cn as e,Dn as t,M as n,T as r,_ as i,b as a,c as o,ft as s,h as c,j as l,kt as u,wn as d,x as f}from"./format-qPQgH1PF.js";import{s as p}from"./compose-BCqmtrsZ.js";import{n as m,r as h}from"./ChannelForms-mdOuU6eZ.js";import{n as g,t as _}from"./Pane-L4GJKBiw.js";import{n as v,r as y,t as b}from"./Overview-BMatmD0p.js";var x=t(d(),1),S=e();function C(){let e=n(),t=i(),d=f(),C=r(),w=l(),T=c(s),E=o(),D=a(3e4),[O,k]=(0,x.useState)(!1);if(e.data===void 0||t.data===void 0)return(0,S.jsx)(g,{children:`Reading the society…`});let A=t.data.filter(e=>e.cli!==null),j=A.filter(e=>e.status===`active`),M=A.filter(e=>e.status===`retired`),N=(C.data??[]).filter(e=>e.name!==u);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_,{title:e.data.name,subtitle:`${j.length} citizens · ${d.data?.length??0} projects · ${N.length} roles`}),O?(0,S.jsx)(h,{project:null,onDone:()=>k(!1)}):null,(0,S.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,S.jsxs)(v,{title:`Citizens`,children:[(0,S.jsx)(b,{members:j,scope:s}),M.length===0?null:(0,S.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Retired: `,M.map(e=>e.name).join(`, `)]})]}),(0,S.jsx)(v,{title:`Channels`,aside:O?null:(0,S.jsx)(p,{onClick:()=>k(!0),children:`New channel…`}),children:(0,S.jsx)(m,{channels:(E.data??[]).filter(e=>e.project===null),now:D})}),(0,S.jsx)(v,{title:`Roles`,children:(0,S.jsx)(`ul`,{className:`space-y-2.5`,children:N.map(e=>{let t=j.filter(t=>t.role===e.name).length;return(0,S.jsxs)(`li`,{children:[(0,S.jsxs)(`p`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,S.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,S.jsxs)(`span`,{className:`text-meta`,children:[t===1?`1 member`:`${t} members`,e.resident?` · warm session`:``,e.societyScope?` · society role`:``]})]}),(0,S.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:e.purpose})]},e.name)})})}),(0,S.jsx)(v,{title:`Knowledge`,children:(0,S.jsx)(y,{scope:s,topics:T.data,now:D})}),(0,S.jsx)(v,{title:`Skills`,children:w.data===void 0?(0,S.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):w.data.length===0?(0,S.jsx)(`p`,{className:`text-meta`,children:`None yet. A citizen's skill joins the society by proposal.`}):(0,S.jsx)(`ul`,{className:`space-y-1.5`,children:w.data.map(e=>(0,S.jsxs)(`li`,{className:`text-sm`,children:[(0,S.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,S.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]},e.name))})})]})]})}export{C as SocietyView};
@@ -1 +1 @@
1
- import{Sn as e,Tn as t,_ as n,en as r,k as i,t as a,xn as o}from"./format-BORdp4w-.js";import{S as s}from"./index-ww_EHgVF.js";import{t as c}from"./Markdown-BMm7unnl.js";import{t as l}from"./MessageItem-Dk1m5NaR.js";var u=t(e(),1),d=o();function f({thread:e,now:t,task:o,empty:f}){let{api:p}=i(),m=n(),h=r({queryKey:[`thread`,e.id],queryFn:()=>p.thread(e.id)}),g=h.data?.messages??[],_=g.at(-1)?.id??null;if((0,u.useEffect)(()=>s(e.id,_),[e.id,_]),h.data===void 0)return(0,d.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the thread…`});let v=h.data.thread;return(0,d.jsxs)(`div`,{className:`-mx-4 mt-1`,children:[g.length===0?(0,d.jsx)(`p`,{className:`mx-4 mt-1 text-meta`,children:f}):g.map(e=>(0,d.jsx)(l,{message:e,members:m.data,now:t,task:o},e.id)),e.state===`closed`?(0,d.jsxs)(`div`,{className:`mx-4 mt-2`,children:[(0,d.jsxs)(`p`,{className:`text-meta`,children:[`Closed`,v.closedAt===void 0?``:` ${a(v.closedAt,t)}`,v.body.trim()===``?`.`:`:`]}),v.body.trim()===``?null:(0,d.jsx)(c,{text:v.body})]}):null]})}export{f as t};
1
+ import{Cn as e,Dn as t,_ as n,k as r,nn as i,t as a,wn as o}from"./format-qPQgH1PF.js";import{S as s}from"./index-BfZnvrmA.js";import{t as c}from"./Markdown-CI8CWgHq.js";import{t as l}from"./MessageItem-Dtpufq_V.js";var u=t(o(),1),d=e();function f({thread:e,now:t,task:o,empty:f}){let{api:p}=r(),m=n(),h=i({queryKey:[`thread`,e.id],queryFn:()=>p.thread(e.id)}),g=h.data?.messages??[],_=g.at(-1)?.id??null;if((0,u.useEffect)(()=>s(e.id,_),[e.id,_]),h.data===void 0)return(0,d.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the thread…`});let v=h.data.thread;return(0,d.jsxs)(`div`,{className:`-mx-4 mt-1`,children:[g.length===0?(0,d.jsx)(`p`,{className:`mx-4 mt-1 text-meta`,children:f}):g.map(e=>(0,d.jsx)(l,{message:e,members:m.data,now:t,task:o},e.id)),e.state===`closed`?(0,d.jsxs)(`div`,{className:`mx-4 mt-2`,children:[(0,d.jsxs)(`p`,{className:`text-meta`,children:[`Closed`,v.closedAt===void 0?``:` ${a(v.closedAt,t)}`,v.body.trim()===``?`.`:`:`]}),v.body.trim()===``?null:(0,d.jsx)(c,{text:v.body})]}):null]})}export{f as t};
@@ -0,0 +1,4 @@
1
+ import{Cn as e,Dn as t,I as n,N as r,V as i,b as a,et as o,t as s,wn as c,x as l}from"./format-qPQgH1PF.js";import{t as u}from"./link-DF__7B1f.js";import{O as d,k as f}from"./index-BfZnvrmA.js";import{c as p,d as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,t as S}from"./Markdown-CI8CWgHq.js";import{n as C,t as w}from"./Pane-L4GJKBiw.js";import{t as T}from"./BackLink-B5n6YQVF.js";var E=t(c(),1),D=e(),O=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,k=`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs text-fg-tertiary transition-colors hover:bg-surface-2/70 hover:text-fg-primary`,A=1e3,j=2e4;function M({taskId:e,path:t}){let n=t===``?[]:t.split(`/`),r=`text-fg-tertiary hover:text-fg-primary`;return(0,D.jsxs)(`nav`,{"aria-label":`Path`,className:`flex flex-wrap items-center gap-x-1 text-meta`,children:[n.length===0?(0,D.jsx)(`span`,{children:`Files`}):(0,D.jsx)(v,{taskId:e,path:``,className:r,children:`Files`}),n.map((t,i)=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i===n.length-1?(0,D.jsx)(`span`,{className:`text-fg-secondary`,children:t}):(0,D.jsx)(v,{taskId:e,path:n.slice(0,i+1).join(`/`),className:r,children:t})]},n.slice(0,i+1).join(`/`)))]})}function N({taskId:e,file:t}){let n=t.entries.toSorted((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`dir`?-1:1);return(0,D.jsx)(`ul`,{className:`mt-3 space-y-1`,children:n.map(n=>(0,D.jsxs)(`li`,{className:`flex items-baseline gap-2`,children:[(0,D.jsx)(v,{taskId:e,path:t.path===``?n.name:`${t.path}/${n.name}`,className:`text-sm text-fg-secondary hover:text-fg-primary`,children:n.kind===`dir`?`${n.name}/`:n.name}),n.size===null?null:(0,D.jsx)(`span`,{className:`text-meta`,children:b(n.size)})]},n.name))})}function P({rows:e}){let[t,...n]=e;if(t===void 0)return(0,D.jsx)(`p`,{className:`mt-3 text-meta`,children:`The table is empty.`});let r=n.slice(0,A),i=`border border-line px-2 py-1 text-left align-top whitespace-pre-wrap`;return(0,D.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,children:[(0,D.jsxs)(`table`,{className:`text-xs text-fg-secondary`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsx)(`tr`,{children:t.map((e,t)=>(0,D.jsx)(`th`,{scope:`col`,className:`${i} font-medium text-fg-primary`,children:e},t))})}),(0,D.jsx)(`tbody`,{children:r.map((e,t)=>(0,D.jsx)(`tr`,{children:e.map((e,t)=>(0,D.jsx)(`td`,{className:i,children:e},t))},t))})]}),n.length>r.length?(0,D.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,A,` of `,n.length,` rows; download the file for the rest.`]}):null]})}function F({text:e,line:t}){let n=e.endsWith(`
2
+ `)?e.slice(0,-1).split(`
3
+ `):e.split(`
4
+ `),r=`mt-3 overflow-x-auto rounded-lg bg-surface-0/80 p-3 font-mono text-[12px] leading-relaxed text-fg-secondary shadow-[inset_0_0_0_1px_rgba(255,255,255,0.05)]`;return n.length>j?(0,D.jsx)(`pre`,{className:r,children:e}):(0,D.jsx)(`pre`,{className:r,children:n.map((e,n)=>(0,D.jsxs)(`span`,{className:`flex ${n+1===t?`line-target`:``}`,children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`w-10 shrink-0 pr-3 text-right text-fg-muted select-none`,children:n+1}),(0,D.jsx)(`span`,{className:`whitespace-pre`,children:e===``?` `:e})]},n))})}function I({taskId:e,file:t,url:n,line:r}){let i=(0,E.useMemo)(()=>t.content===null?null:_(t.path,h(t.content)),[t.path,t.content]),a=t.path.split(`/`).at(-1)??t.path;return i===null?(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[a,` is `,b(t.size),`, more than the `,b(o),` the board shows. Its runner still has it on the task's branch.`]}):i.kind===`markdown`?(0,D.jsx)(`div`,{className:`mt-3`,children:(0,D.jsx)(S,{text:i.text,base:{taskId:e,dir:m(t.path)},line:r})}):i.kind===`image`?n===null?null:(0,D.jsx)(`img`,{src:n,alt:a,className:`mt-3 max-w-full rounded-lg`}):i.kind===`table`?(0,D.jsx)(P,{rows:i.rows}):i.kind===`text`?(0,D.jsx)(F,{text:i.text,line:r}):(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[a,` is not text (`,b(t.size),`). Download it to open it.`]})}function L(){let{taskId:e,_splat:t}=f({from:`/task/$taskId/files/$`}),o=d({from:`/task/$taskId/files/$`}),c=y(g(t??``)??``),m=c.path,h=o.line??c.line,_=r(e),v=l(),b=n(e,m),S=a(3e4),A=b.data,j=A?.kind===`file`?A.content:null,P=x(j,p(m)??`application/octet-stream`),F=m===``?`Files`:m.split(`/`).at(-1)??m,L=_.data?.title??e,R=(0,E.useRef)(null);(0,E.useEffect)(()=>{h!==void 0&&A!==void 0&&R.current?.querySelector(`.line-target`)?.scrollIntoView({block:`center`})},[h,A]);let z;if(A!==void 0)z=A.kind===`dir`?(0,D.jsx)(N,{taskId:e,file:A}):(0,D.jsx)(I,{taskId:e,file:A,url:P,line:h});else if(b.error instanceof i&&b.error.status===404)z=(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[m===``?`Nothing`:m,` is not on task/`,e,` yet. What a turn writes reaches the branch when the turn ends.`]});else if(b.error instanceof i&&b.error.status===503){let e=v.data?.find(e=>e.slug===_.data?.project);z=(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[e?.runner===void 0?`The runner`:`${e.runner}, the runner`,` `,e?.name??`the project`,` lives on, is not connected, so the task's files cannot be read now.`]})}else z=b.error===null?(0,D.jsxs)(C,{children:[`Reading `,F,` from the task's runner…`]}):(0,D.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:b.error.message});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(w,{leading:(0,D.jsx)(T,{fallback:(0,D.jsx)(u,{to:`/task/$taskId`,params:{taskId:e},"aria-label":`Back to the task ${L}`,className:O,children:`←`})}),title:F,subtitle:A===void 0?L:`${L}${h===void 0?``:` · line ${h}`} · committed by ${A.commit.author} ${s(A.commit.at,S)} · ${A.commit.id.slice(0,7)}`,trailing:P===null?null:(0,D.jsx)(`a`,{href:P,download:F,className:k,children:`Download`})}),(0,D.jsxs)(`div`,{ref:R,className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,D.jsx)(M,{taskId:e,path:m}),z]})]})}export{L as TaskFileView};
@@ -0,0 +1,3 @@
1
+ import{Cn as e,Dn as t,F as n,N as r,P as i,R as a,Sn as o,V as s,_ as c,b as l,k as u,t as d,wn as f,x as p}from"./format-qPQgH1PF.js";import{l as m,s as h}from"./compose-BCqmtrsZ.js";import{t as g}from"./link-DF__7B1f.js";import{a as _,c as v,l as y,n as b,o as x,r as S,s as C,t as w}from"./tasks-DcovWYAU.js";import{u as T}from"./governance-D5tD2NOI.js";import{_ as E,i as D,k as O,o as k,s as A}from"./index-BfZnvrmA.js";import{n as j,r as M}from"./ThreadForms-Bciw71n3.js";import{a as N,f as P,n as F,s as I,t as L,u as R}from"./Markdown-CI8CWgHq.js";import{n as z,t as B}from"./Pane-L4GJKBiw.js";import{t as V}from"./BackLink-B5n6YQVF.js";import{t as H}from"./SubjectThread-DnQJDgcK.js";var U=t(f(),1),W=e(),G={hunk:`text-fg-muted`,note:`text-fg-muted`,added:`bg-emerald-400/10 text-emerald-300`,removed:`bg-red-400/10 text-red-300`,context:`text-fg-tertiary`};function K({last:e,now:t}){return e===void 0?null:(0,W.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-meta`,children:[e.author,` `,d(e.at,t)]})}function q({taskId:e,path:t,patch:n}){let r=(0,U.useMemo)(()=>P(n),[n]);return(0,W.jsx)(`div`,{className:`mt-1 max-h-96 overflow-auto rounded-md bg-surface-0/60 py-1.5 font-mono text-[11px] leading-relaxed`,children:r.map((n,r)=>(0,W.jsxs)(`div`,{className:`flex ${G[n.kind]}`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`w-10 shrink-0 pr-2 text-right text-fg-muted select-none`,children:n.line===void 0?null:(0,W.jsx)(g,{to:`/task/$taskId/files/$`,params:{taskId:e,_splat:t},search:{line:n.line},tabIndex:-1,title:`Open ${t} at line ${n.line}`,className:`hover:text-fg-primary`,children:n.line})}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 pr-2 break-words whitespace-pre-wrap`,children:n.text===``?` `:n.text})]},r))})}function J({taskId:e,change:t}){let r=n(e,t.path),i;if(r.data!==void 0){let{patch:n,truncated:a}=r.data;i=n===null?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown here.`}):n===``?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`No lines changed.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{taskId:e,path:t.path,patch:n}),a?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}else i=r.error instanceof s&&r.error.status===503?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`The task's runner is not connected, so the change cannot be read now.`}):r.error===null?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`Reading the change…`}):(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:r.error.message});return(0,W.jsxs)(`div`,{className:`mb-2 ml-[18px]`,children:[t.status===`deleted`?null:(0,W.jsx)(F,{taskId:e,path:t.path,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Open the whole file`}),i]})}function Y({taskId:e,nodes:t,nested:n,openings:r,now:i}){let{isOpen:a,toggle:o,shown:s,toggleFile:c}=r;return(0,W.jsx)(`ul`,{className:n?`ml-[5px] border-l border-line-strong pl-2`:`mt-2`,children:t.map(t=>{if(t.kind===`dir`){let n=a(t);return(0,W.jsxs)(`li`,{children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>o(t),className:`flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block w-2.5 shrink-0 text-[10px] text-fg-muted transition-transform ${n?`rotate-90`:``}`,children:`▸`}),(0,W.jsxs)(`span`,{className:`min-w-0 truncate text-fg-primary`,children:[t.name,`/`]}),(0,W.jsx)(`span`,{className:`shrink-0 text-meta`,children:t.files===1?`1 file`:`${t.files} files`}),(0,W.jsx)(K,{last:t.lastChange,now:i})]}),n?(0,W.jsx)(Y,{taskId:e,nodes:t.children,nested:!0,openings:r,now:i}):null]},`dir:${t.path}`)}let{change:n}=t,l=s.has(n.path),u=n.status===`deleted`?`text-fg-tertiary line-through`:l?`text-fg-primary`:`text-fg-secondary group-hover:text-fg-primary`;return(0,W.jsxs)(`li`,{children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":l,title:n.path,onClick:()=>c(n.path),className:`group flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40 ${l?`bg-surface-2/30`:``}`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`w-2.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate ${u}`,children:t.name}),(0,W.jsx)(`span`,{className:`shrink-0 text-meta`,children:N(n)}),(0,W.jsx)(K,{last:n.lastChange,now:i})]}),l?(0,W.jsx)(J,{taskId:e,change:n}):null]},n.path)})})}function X({taskId:e,changes:t,now:n}){let r=(0,U.useMemo)(()=>I(t),[t]),i=(0,U.useMemo)(()=>R(r),[r]),[a,o]=(0,U.useState)(new Map),s=e=>a.get(e.path)??i.has(e.path),c=e=>{o(t=>new Map(t).set(e.path,!(t.get(e.path)??i.has(e.path))))},[l,u]=(0,U.useState)(new Set);return(0,W.jsx)(Y,{taskId:e,nodes:r.children,nested:!1,openings:{isOpen:s,toggle:c,shown:l,toggleFile:e=>{u(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})}},now:n})}function Z({task:e,now:t}){let n=i(e.id),r=p(),a=`task/${e.id}`,o;if(n.data!==void 0){let{files:r,total:i,head:s}=n.data;o=r.length===0?(0,W.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing changed on `,a,` yet. What a turn writes reaches the branch when the turn ends.`]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`mt-2 text-meta`,children:[i===1?`1 file`:`${i} files`,` changed · newest commit by `,s.author,` `,d(s.at,t)]}),(0,W.jsx)(X,{taskId:e.id,changes:r,now:t}),i>r.length?(0,W.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,r.length,` of `,i,`; browse the branch for the rest.`]}):null]})}else if(n.error instanceof s&&n.error.status===404)o=(0,W.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing on `,a,` yet. What a turn writes reaches the branch when the turn ends.`]});else if(n.error instanceof s&&n.error.status===503){let t=r.data?.find(t=>t.slug===e.project);o=(0,W.jsxs)(`p`,{className:`mt-2 text-meta`,children:[t?.runner===void 0?`The runner`:`${t.runner}, the runner`,` `,t?.name??e.project,` lives on, is not connected, so the task's files cannot be listed now.`]})}else o=n.error===null?(0,W.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the task's branch…`}):(0,W.jsx)(`p`,{className:`mt-2 text-meta`,children:n.error.message});return(0,W.jsxs)(`section`,{"aria-label":`Files`,className:`mt-5 border-t border-line pt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,W.jsx)(`h3`,{className:`text-section`,children:`Files`}),(0,W.jsx)(F,{taskId:e.id,path:``,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Browse the branch`})]}),o]})}function Q({stage:e,index:t,task:n,members:r,now:i}){let a=e.completedBy!==void 0,o=x(n,e),s=t===n.stages.length-1,c=o&&n.status===`claimed`?n.claimedBy:void 0,l=e.holders.filter(t=>t!==c&&t!==e.completedBy),u=n.returned?.from===e.id?n.returned:void 0;return(0,W.jsxs)(`li`,{className:`relative flex gap-3 pb-4`,children:[s?null:(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-6 bottom-0 left-2.5 w-px bg-line`}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`relative z-10 grid size-5 shrink-0 place-items-center rounded-full text-[10px] ${a?`bg-emerald-400/20 text-emerald-300`:o?`bg-fg-primary text-surface-0`:`bg-surface-2 text-fg-muted`}`,children:a?`✓`:t+1}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`p`,{className:`text-sm ${o?`font-medium text-fg-primary`:`text-fg-secondary`}`,children:[e.name,e.gate?(0,W.jsx)(`span`,{className:`ml-2 rounded-md bg-sky-400/10 px-1.5 py-px text-[11px] text-sky-300`,children:`gate`}):null]}),(0,W.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[`for `,S(e),c===void 0?null:(0,W.jsxs)(W.Fragment,{children:[` · held by `,(0,W.jsx)(k,{name:c,members:r})]}),e.completedBy!==void 0&&e.completedAt!==void 0?` · done by ${e.completedBy} ${d(e.completedAt,i)}`:o&&n.status===`open`?` · waiting since ${d(n.stageSince,i)}`:``,l.length>0?` · held before by ${l.join(`, `)}`:``,u===void 0?``:` · sent back by ${u.by} ${d(u.at,i)}`]})]})]})}function $(e){return e.onDone===`ghpr`?e.pullRequest===void 0?`It lands through a pull request, and none is linked yet, so the board refuses to finish it.`:`Approving lands it: the board merges pull request #${e.pullRequest.number} on GitHub.`:e.onDone===`merge`?`Approving lands it: the board merges task/${e.id}.`:`Approving finishes the task.`}function ee({task:e,stage:t}){let{api:n}=u(),r=o(),[i,a]=(0,U.useState)(``),s=e.stages.findIndex(e=>e.id===t.id),c=e.stages[s+1],l=m({mutationFn:()=>n.advanceTask({task_id:e.id,...i.trim()===``?{}:{note:i.trim()}}),onSuccess:async()=>{a(``),await r.invalidateQueries({queryKey:[`task`,e.id]}),await r.invalidateQueries({queryKey:[`tasks`]})}});return(0,W.jsxs)(`form`,{"aria-label":`Approve ${t.name}`,className:`mt-1 mb-4 space-y-2 rounded-lg bg-surface-2/40 p-3`,onSubmit:e=>{e.preventDefault(),l.mutate()},children:[(0,W.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[t.name,` waits on you.`,` `,c===void 0?$(e):`Approving moves the task on to ${c.name}.`]}),(0,W.jsx)(`textarea`,{value:i,rows:2,"aria-label":`Note for the task's thread`,placeholder:`A note for the thread, if any`,onChange:e=>a(e.target.value),className:j}),(0,W.jsx)(`div`,{className:`flex justify-end`,children:(0,W.jsx)(h,{variant:`primary`,type:`submit`,disabled:l.isPending,children:l.isPending?`Approving…`:`Approve`})}),(0,W.jsx)(M,{error:l.error})]})}function te({task:e,now:t}){let n=e.pullRequest;if(n===void 0)return null;let r=[n.subject??`The pull request's title`,n.body??``].filter(e=>e!==``).join(`
2
+
3
+ `);return(0,W.jsxs)(`section`,{"aria-label":`Pull request`,className:`mt-5 border-t border-line pt-4`,children:[(0,W.jsx)(`h3`,{className:`text-section`,children:`Pull request`}),(0,W.jsxs)(`p`,{className:`mt-2 text-sm`,children:[(0,W.jsxs)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`,className:`text-fg-primary underline decoration-line underline-offset-2 hover:decoration-fg-tertiary`,children:[`#`,n.number,` on GitHub`]}),(0,W.jsxs)(`span`,{className:`text-meta`,children:[` `,`· linked by `,n.linkedBy,` `,d(n.linkedAt,t)]})]}),e.status===`abandoned`&&e.onDone===`ghpr`?(0,W.jsxs)(`p`,{className:`mt-2 text-sm text-fg-secondary`,children:[n.closed===void 0?`The task was abandoned, so the board closes the pull request on GitHub.`:n.closed.ok?`The task was abandoned: ${n.closed.detail}.`:`The task was abandoned, and the board could not close the pull request: ${n.closed.detail}.`,n.closed===void 0?null:(0,W.jsxs)(`span`,{className:`text-meta`,children:[` · `,d(n.closed.at,t)]})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`mt-3 text-caps text-fg-muted`,children:`Merges as`}),(0,W.jsx)(`pre`,{className:`mt-1 rounded-lg bg-surface-2/40 p-3 font-mono text-xs whitespace-pre-wrap text-fg-secondary`,children:r})]})]})}function ne({taskId:e}){let{api:t}=u(),n=o(),r=m({mutationFn:()=>t.openThread({task_id:e}),onSuccess:()=>{n.invalidateQueries({queryKey:[`threads`]})}});return(0,W.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,W.jsx)(h,{variant:`primary`,disabled:r.isPending,onClick:()=>r.mutate(),children:r.isPending?`Opening…`:`Open its thread`}),(0,W.jsx)(`p`,{className:`text-meta`,children:r.error===null?`This task is older than task threads. It closes when the task ends.`:r.error.message})]})}function re(){let{taskId:e}=O({from:`/task/$taskId`}),t=r(e),n=a(),i=p(),o=c(),u=l(3e4),f=A();if(t.data===void 0)return(0,W.jsx)(z,{children:t.error instanceof s&&t.error.status===404?`There is no task ${e}.`:`Reading the task…`});let m=t.data,h=C(m),x=T(m),S=i.data?.find(e=>e.slug===m.project),k=n.data?.find(e=>e.id===m.id);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B,{leading:(0,W.jsx)(V,{fallback:(0,W.jsx)(g,{to:`/p/$slug/tasks`,params:{slug:m.project},"aria-label":`Back to the tasks of ${S?.name??m.project}`,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`←`})}),title:m.title,subtitle:`${S?.name??m.project}${m.channel===`general`?``:` #${m.channel}`} · ${v(m)} · created by ${f(m.createdBy)} ${d(m.createdAt,u)}`,trailing:(0,W.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${b[h]}`,children:w.find(e=>e.phase===h)?.label.toLowerCase()})}),(0,W.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,W.jsx)(`h3`,{className:`text-section`,children:`Plan`}),m.returned===void 0?null:(0,W.jsxs)(`p`,{className:`mt-2 rounded-lg bg-orange-500/10 px-3 py-2 text-xs leading-relaxed text-orange-200`,children:[`Sent back from `,y(m,m.returned.from),` by `,m.returned.by,` `,d(m.returned.at,u),`. The work is redone from`,` `,y(m,m.stage),` until it reaches that stage again.`]}),(0,W.jsx)(`ol`,{className:`mt-3`,children:m.stages.map((e,t)=>(0,W.jsx)(Q,{stage:e,index:t,task:m,members:o.data,now:u},e.id))}),x===null?null:(0,W.jsx)(ee,{task:m,stage:x}),(0,W.jsxs)(`p`,{className:`text-meta`,children:[`When the last stage is done:`,` `,m.onDone===`merge`?`task/${m.id} merges onto the default branch`:m.onDone===`ghpr`?m.pullRequest===void 0?`its pull request merges on GitHub, once one is linked`:`pull request #${m.pullRequest.number} merges on GitHub`:`nothing more`,m.blockedBy.length>0?(0,W.jsxs)(W.Fragment,{children:[` · blocked by `,(0,W.jsx)(E,{text:m.blockedBy.join(`, `)})]}):null]}),m.body.trim()===``?null:(0,W.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,W.jsx)(`h3`,{className:`text-section`,children:`Brief`}),(0,W.jsx)(`div`,{className:`mt-2`,children:(0,W.jsx)(L,{text:m.body})})]}),(0,W.jsx)(te,{task:m,now:u}),(0,W.jsx)(Z,{task:m,now:u}),(0,W.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,W.jsx)(`h3`,{className:`text-section`,children:`Thread`}),n.data===void 0?null:k===void 0?_(m)?(0,W.jsx)(ne,{taskId:m.id}):(0,W.jsx)(`p`,{className:`mt-2 text-meta`,children:`No thread on this task.`}):(0,W.jsx)(H,{thread:k,now:u,task:m,empty:`Nothing said yet. Each stage's handover lands here, and so does anything written below.`})]})]}),k?.state===`open`?(0,W.jsx)(D,{target:{threadId:m.id},placeholder:`Write in the task's thread`}):null]})}export{re as TaskView};
@@ -1 +1 @@
1
- import{I as e,Sn as t,Tn as n,_ as r,b as i,ft as a,t as o,x as s,xn as c}from"./format-BORdp4w-.js";import{t as l}from"./link-1v5lugnf.js";import{c as u,i as d,l as f,o as p,r as m,s as h,t as g}from"./tasks-C-9dAYQV.js";import{k as _,o as v}from"./index-ww_EHgVF.js";import{n as y,t as b}from"./Pane-CODhA5zE.js";var x=n(t(),1),S=c();function C({task:e}){let t=h(e);return(0,S.jsx)(`ol`,{className:`flex gap-1`,"aria-hidden":`true`,children:e.stages.map((n,r)=>{let i=n.completedBy!==void 0,a=p(e,n),o=i?`bg-emerald-400/60`:a?e.status===`claimed`?`bg-fg-primary/90`:`bg-amber-300/80`:t===`abandoned`?`bg-surface-2/50`:`bg-surface-2`;return(0,S.jsx)(`li`,{title:`${r+1}. ${n.name} · ${m(n)}${n.gate?` · gate`:``}`,className:`h-1.5 min-w-3 flex-1 rounded-full ${o} ${n.gate?`ring-1 ring-sky-300/70 ring-offset-1 ring-offset-surface-1`:``}`},n.id)})})}var w=5;function T({task:e,members:t,now:n}){let r=h(e),i=a(e);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(l,{to:`/task/$taskId`,params:{taskId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:e.title}),(0,S.jsx)(`span`,{className:`shrink-0 text-meta`,children:u(e)})]}),(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(C,{task:e})}),e.returned===void 0?null:(0,S.jsxs)(`p`,{className:`mt-1.5 truncate text-xs text-orange-300/90`,children:[`Sent back from `,f(e,e.returned.from),` by `,e.returned.by,` `,o(e.returned.at,n)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:e.status===`claimed`&&r!==`landing`&&i!==void 0?(0,S.jsxs)(S.Fragment,{children:[i.name,` · held by `,(0,S.jsx)(v,{name:e.claimedBy??``,members:t})]}):e.status===`open`&&r!==`landing`&&i!==void 0?`${i.name} · waiting for ${m(i)} since ${o(e.stageSince,n)}`:r===`landing`?`landing task/${e.id} on the default branch`:`${r} ${o(e.updatedAt,n)}`})]})})}function E(){let{slug:t}=_({from:`/p/$slug/tasks`}),n=e(t),a=s(),o=r(),c=i(3e4),[l,u]=(0,x.useState)(new Set),f=a.data?.find(e=>e.slug===t),p=d(n.data??[]),m=p.filter(e=>e.phase!==`done`&&e.phase!==`abandoned`).reduce((e,t)=>e+t.tasks.length,0);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(b,{title:`Tasks`,subtitle:`${f?.name??t} · ${m} in play · ${n.data?.length??0} in all`}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:n.data===void 0?(0,S.jsx)(y,{children:`Reading the tasks…`}):p.length===0?(0,S.jsx)(y,{children:`No tasks in this project yet.`}):p.map(e=>{let t=e.phase!==`done`&&e.phase!==`abandoned`||l.has(e.phase)?e.tasks:e.tasks.slice(0,w);return(0,S.jsxs)(`section`,{className:`mb-3`,children:[(0,S.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[g.find(t=>t.phase===e.phase)?.label,` · `,e.tasks.length]}),(0,S.jsx)(`ul`,{children:t.map(e=>(0,S.jsx)(T,{task:e,members:o.data,now:c},e.id))}),t.length<e.tasks.length?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>u(new Set([...l,e.phase])),className:`px-3 pt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show all `,e.tasks.length]}):null]},e.phase)})})]})}export{E as TasksView};
1
+ import{Cn as e,Dn as t,L as n,_ as r,b as i,mt as a,t as o,wn as s,x as c}from"./format-qPQgH1PF.js";import{t as l}from"./link-DF__7B1f.js";import{c as u,i as d,l as f,o as p,r as m,s as h,t as g}from"./tasks-DcovWYAU.js";import{k as _,o as v}from"./index-BfZnvrmA.js";import{n as y,t as b}from"./Pane-L4GJKBiw.js";var x=t(s(),1),S=e();function C({task:e}){let t=h(e);return(0,S.jsx)(`ol`,{className:`flex gap-1`,"aria-hidden":`true`,children:e.stages.map((n,r)=>{let i=n.completedBy!==void 0,a=p(e,n),o=i?`bg-emerald-400/60`:a?e.status===`claimed`?`bg-fg-primary/90`:`bg-amber-300/80`:t===`abandoned`?`bg-surface-2/50`:`bg-surface-2`;return(0,S.jsx)(`li`,{title:`${r+1}. ${n.name} · ${m(n)}${n.gate?` · gate`:``}`,className:`h-1.5 min-w-3 flex-1 rounded-full ${o} ${n.gate?`ring-1 ring-sky-300/70 ring-offset-1 ring-offset-surface-1`:``}`},n.id)})})}var w=5;function T({task:e,members:t,now:n}){let r=h(e),i=a(e);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(l,{to:`/task/$taskId`,params:{taskId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:e.title}),(0,S.jsx)(`span`,{className:`shrink-0 text-meta`,children:u(e)})]}),(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(C,{task:e})}),e.returned===void 0?null:(0,S.jsxs)(`p`,{className:`mt-1.5 truncate text-xs text-orange-300/90`,children:[`Sent back from `,f(e,e.returned.from),` by `,e.returned.by,` `,o(e.returned.at,n)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:e.status===`claimed`&&r!==`landing`&&i!==void 0?(0,S.jsxs)(S.Fragment,{children:[i.name,` · held by `,(0,S.jsx)(v,{name:e.claimedBy??``,members:t})]}):e.status===`open`&&r!==`landing`&&i!==void 0?`${i.name} · waiting for ${m(i)} since ${o(e.stageSince,n)}`:r===`landing`?`landing task/${e.id} on the default branch`:`${r} ${o(e.updatedAt,n)}`})]})})}function E(){let{slug:e}=_({from:`/p/$slug/tasks`}),t=n(e),a=c(),o=r(),s=i(3e4),[l,u]=(0,x.useState)(new Set),f=a.data?.find(t=>t.slug===e),p=d(t.data??[]),m=p.filter(e=>e.phase!==`done`&&e.phase!==`abandoned`).reduce((e,t)=>e+t.tasks.length,0);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(b,{title:`Tasks`,subtitle:`${f?.name??e} · ${m} in play · ${t.data?.length??0} in all`}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:t.data===void 0?(0,S.jsx)(y,{children:`Reading the tasks…`}):p.length===0?(0,S.jsx)(y,{children:`No tasks in this project yet.`}):p.map(e=>{let t=e.phase!==`done`&&e.phase!==`abandoned`||l.has(e.phase)?e.tasks:e.tasks.slice(0,w);return(0,S.jsxs)(`section`,{className:`mb-3`,children:[(0,S.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[g.find(t=>t.phase===e.phase)?.label,` · `,e.tasks.length]}),(0,S.jsx)(`ul`,{children:t.map(e=>(0,S.jsx)(T,{task:e,members:o.data,now:s},e.id))}),t.length<e.tasks.length?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>u(new Set([...l,e.phase])),className:`px-3 pt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show all `,e.tasks.length]}):null]},e.phase)})})]})}export{E as TasksView};
@@ -0,0 +1 @@
1
+ import{Cn as e,n as t,t as n}from"./format-qPQgH1PF.js";import{t as r}from"./link-DF__7B1f.js";import{_ as i}from"./index-BfZnvrmA.js";var a=e();function o(e){return e?.kind??`topic`}function s({state:e}){return(0,a.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${e===`open`?`bg-emerald-500/15 text-emerald-300`:`bg-surface-2 text-fg-tertiary`}`,children:e})}function c({thread:e,now:c}){let l=e.state===`closed`?t(e.body,180):``,u=e.messages===1?`1 message`:`${e.messages} messages`;return(0,a.jsxs)(r,{to:`/thread/$threadId`,params:{threadId:e.id},className:`mx-4 my-2 block rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:bg-surface-2/70`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`↳`}),(0,a.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:e.title}),(0,a.jsx)(s,{state:e.state})]}),(0,a.jsxs)(`p`,{className:`mt-1 text-meta`,children:[o(e.subject),` thread by `,e.openedBy,` · `,u,` · opened`,` `,n(e.openedAt,c)]}),l===``?null:(0,a.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-secondary`,children:(0,a.jsx)(i,{text:l,links:!1})})]})}export{c as n,o as r,s as t};
@@ -1 +1 @@
1
- import{B as e,Sn as t,T as n,Tn as r,_ as i,bn as a,k as o,xn as s}from"./format-BORdp4w-.js";import{c,l,n as u,o as d,s as f}from"./compose-D7DOz6kC.js";var p=r(t(),1),m=s(),h=`block w-full rounded-lg bg-surface-2/50 px-3 py-2 text-sm text-fg-primary outline-none shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] placeholder:text-fg-muted focus:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.16)]`;function g({error:t}){return t===null?null:(0,m.jsx)(`p`,{role:`alert`,className:`text-xs text-red-400`,children:t instanceof e?t.message:`The board did not take it.`})}function _({channel:e,onDone:t}){let{api:r}=o(),s=a(),_=c(),v=i(),y=n(),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null);(0,p.useEffect)(()=>w.current?.focus(),[]);let T=l({mutationFn:async()=>{let t=await r.openThread({channel:e,title:b.trim()});return S.trim()!==``&&await r.sendMessage({thread_id:t.id,body:S.trim()}),t},onSuccess:e=>{s.invalidateQueries({queryKey:[`threads`]}),t(),_({to:`/thread/$threadId`,params:{threadId:e.id}})}}),E=S.trim()===``?[]:d(S,v.data??[],y.data??[]);return(0,m.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),T.mutate()},children:[(0,m.jsx)(`input`,{ref:w,value:b,maxLength:200,placeholder:`What is the thread about?`,"aria-label":`Thread title`,onChange:e=>x(e.target.value),className:h}),(0,m.jsx)(`textarea`,{value:S,rows:3,placeholder:`First message, optional`,"aria-label":`First message`,onChange:e=>C(e.target.value),className:`${h} resize-none`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:E.length>0?`The first message wakes ${u(E)}.`:`Only its participants and anyone mentioned will read it.`}),(0,m.jsx)(f,{onClick:t,children:`Cancel`}),(0,m.jsx)(f,{variant:`primary`,type:`submit`,disabled:b.trim()===``||T.isPending,children:T.isPending?`Opening…`:`Open thread`})]}),(0,m.jsx)(g,{error:T.error})]})}function v({threadId:e,channel:t,onDone:n}){let{api:r}=o(),i=a(),[s,c]=(0,p.useState)(``),u=(0,p.useRef)(null);(0,p.useEffect)(()=>u.current?.focus(),[]);let d=l({mutationFn:()=>r.closeThread({thread_id:e,summary:s.trim()}),onSuccess:()=>{for(let n of[[`thread`,e],[`threads`],[`channel`,t]])i.invalidateQueries({queryKey:n});n()}});return(0,m.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,m.jsx)(`textarea`,{ref:u,value:s,rows:3,placeholder:`What did it settle? The summary is posted to #${t}.`,"aria-label":`Closing summary`,onChange:e=>c(e.target.value),className:`${h} resize-none`}),(0,m.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,m.jsx)(f,{onClick:n,children:`Cancel`}),(0,m.jsx)(f,{variant:`primary`,type:`submit`,disabled:s.trim()===``||d.isPending,children:d.isPending?`Closing…`:`Close thread`})]}),(0,m.jsx)(g,{error:d.error})]})}export{_ as i,h as n,g as r,v as t};
1
+ import{Cn as e,Dn as t,Sn as n,T as r,V as i,_ as a,k as o,wn as s}from"./format-qPQgH1PF.js";import{c,l,n as u,o as d,s as f}from"./compose-BCqmtrsZ.js";var p=t(s(),1),m=e(),h=`block w-full rounded-lg bg-surface-2/50 px-3 py-2 text-sm text-fg-primary outline-none shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] placeholder:text-fg-muted focus:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.16)]`;function g({error:e}){return e===null?null:(0,m.jsx)(`p`,{role:`alert`,className:`text-xs text-red-400`,children:e instanceof i?e.message:`The board did not take it.`})}function _({channel:e,onDone:t}){let{api:i}=o(),s=n(),_=c(),v=a(),y=r(),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null);(0,p.useEffect)(()=>w.current?.focus(),[]);let T=l({mutationFn:async()=>{let t=await i.openThread({channel:e,title:b.trim()});return S.trim()!==``&&await i.sendMessage({thread_id:t.id,body:S.trim()}),t},onSuccess:e=>{s.invalidateQueries({queryKey:[`threads`]}),t(),_({to:`/thread/$threadId`,params:{threadId:e.id}})}}),E=S.trim()===``?[]:d(S,v.data??[],y.data??[]);return(0,m.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),T.mutate()},children:[(0,m.jsx)(`input`,{ref:w,value:b,maxLength:200,placeholder:`What is the thread about?`,"aria-label":`Thread title`,onChange:e=>x(e.target.value),className:h}),(0,m.jsx)(`textarea`,{value:S,rows:3,placeholder:`First message, optional`,"aria-label":`First message`,onChange:e=>C(e.target.value),className:`${h} resize-none`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:E.length>0?`The first message wakes ${u(E)}.`:`Only its participants and anyone mentioned will read it.`}),(0,m.jsx)(f,{onClick:t,children:`Cancel`}),(0,m.jsx)(f,{variant:`primary`,type:`submit`,disabled:b.trim()===``||T.isPending,children:T.isPending?`Opening…`:`Open thread`})]}),(0,m.jsx)(g,{error:T.error})]})}function v({threadId:e,channel:t,onDone:r}){let{api:i}=o(),a=n(),[s,c]=(0,p.useState)(``),u=(0,p.useRef)(null);(0,p.useEffect)(()=>u.current?.focus(),[]);let d=l({mutationFn:()=>i.closeThread({thread_id:e,summary:s.trim()}),onSuccess:()=>{for(let n of[[`thread`,e],[`threads`],[`channel`,t]])a.invalidateQueries({queryKey:n});r()}});return(0,m.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,m.jsx)(`textarea`,{ref:u,value:s,rows:3,placeholder:`What did it settle? The summary is posted to #${t}.`,"aria-label":`Closing summary`,onChange:e=>c(e.target.value),className:`${h} resize-none`}),(0,m.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,m.jsx)(f,{onClick:r,children:`Cancel`}),(0,m.jsx)(f,{variant:`primary`,type:`submit`,disabled:s.trim()===``||d.isPending,children:d.isPending?`Closing…`:`Close thread`})]}),(0,m.jsx)(g,{error:d.error})]})}export{_ as i,h as n,g as r,v as t};
@@ -1 +1 @@
1
- import{B as e,N as t,Sn as n,Tn as r,_ as i,b as a,en as o,k as s,t as c,xn as l}from"./format-BORdp4w-.js";import{s as u}from"./compose-D7DOz6kC.js";import{t as d}from"./link-1v5lugnf.js";import{S as f,i as p,k as m,s as h}from"./index-ww_EHgVF.js";import{t as g}from"./ThreadForms-RnrV7V5X.js";import{t as _}from"./Markdown-BMm7unnl.js";import{t as v}from"./MessageItem-Dk1m5NaR.js";import{n as y,t as b}from"./Pane-CODhA5zE.js";import{r as x,t as S}from"./ThreadCard-8OB70j9B.js";import{t as C}from"./useStickyScroll-CE7dyz0Q.js";import{t as w}from"./BackLink-hLg9AYSp.js";var T=r(n(),1),E=l();function D(){let{threadId:e}=m({from:`/thread/$threadId`});return(0,E.jsx)(O,{id:e},e)}function O({id:n}){let{api:r}=s(),l=o({queryKey:[`thread`,n],queryFn:()=>r.thread(n)}),m=i(),D=a(3e4),O=h(),k=l.data?.messages??[],A=k.at(-1)?.id??null;(0,T.useEffect)(()=>f(n,A),[n,A]);let{ref:j,onScroll:M}=C(),[N,P]=(0,T.useState)(!1),F=l.data?.thread.subject,I=t(F?.kind===`task`?F.id:null);if(l.data===void 0)return(0,E.jsx)(y,{children:l.error instanceof e&&l.error.status===404?`There is no thread ${n}.`:`Reading the thread…`});let{thread:L}=l.data;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(b,{leading:(0,E.jsx)(w,{fallback:(0,E.jsx)(d,{to:`/c/$`,params:{_splat:L.channel},"aria-label":`Back to #${L.channel}`,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`←`})}),title:L.title,subtitle:`${x(L.subject)} thread in #${L.channel} · opened by ${O(L.openedBy)} ${c(L.openedAt,D)}`,trailing:(0,E.jsxs)(E.Fragment,{children:[L.subject?.kind===`task`?(0,E.jsx)(d,{to:`/task/$taskId`,params:{taskId:L.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Task →`}):L.subject?.kind===`proposal`?(0,E.jsx)(d,{to:`/proposal/$proposalId`,params:{proposalId:L.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Proposal →`}):null,L.state===`open`&&!N&&L.subject?.kind!==`task`?(0,E.jsx)(u,{onClick:()=>P(!0),children:`Close`}):(0,E.jsx)(S,{state:L.state})]})}),N&&L.state===`open`?(0,E.jsx)(g,{threadId:L.id,channel:L.channel,onDone:()=>P(!1)}):null,(0,E.jsxs)(`div`,{ref:j,onScroll:M,className:`flex-1 overflow-y-auto py-2`,children:[k.length===0?(0,E.jsx)(y,{children:`No messages in this thread yet.`}):null,k.map(e=>(0,E.jsx)(v,{message:e,members:m.data,now:D,task:I.data},e.id)),L.state===`closed`?(0,E.jsxs)(`section`,{className:`mx-4 mt-3 mb-2 rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:[(0,E.jsxs)(`p`,{className:`text-caps`,children:[`Closed by `,O(L.closedBy??`board`),L.closedAt===void 0?``:` ${c(L.closedAt,D)}`]}),L.body.trim()===``?(0,E.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`It ended with its `,x(L.subject),`.`]}):(0,E.jsx)(_,{text:L.body})]}):null]}),L.state===`open`?(0,E.jsx)(p,{target:{threadId:L.id},placeholder:`Reply in the thread`}):null]})}export{D as ThreadView};
1
+ import{Cn as e,Dn as t,N as n,V as r,_ as i,b as a,k as o,nn as s,t as c,wn as l}from"./format-qPQgH1PF.js";import{s as u}from"./compose-BCqmtrsZ.js";import{t as d}from"./link-DF__7B1f.js";import{S as f,i as p,k as m,s as h}from"./index-BfZnvrmA.js";import{t as g}from"./ThreadForms-Bciw71n3.js";import{t as _}from"./Markdown-CI8CWgHq.js";import{t as v}from"./MessageItem-Dtpufq_V.js";import{n as y,t as b}from"./Pane-L4GJKBiw.js";import{r as x,t as S}from"./ThreadCard-CkqMOMDh.js";import{t as C}from"./useStickyScroll-BFNyJYps.js";import{t as w}from"./BackLink-B5n6YQVF.js";var T=t(l(),1),E=e();function D(){let{threadId:e}=m({from:`/thread/$threadId`});return(0,E.jsx)(O,{id:e},e)}function O({id:e}){let{api:t}=o(),l=s({queryKey:[`thread`,e],queryFn:()=>t.thread(e)}),m=i(),D=a(3e4),O=h(),k=l.data?.messages??[],A=k.at(-1)?.id??null;(0,T.useEffect)(()=>f(e,A),[e,A]);let{ref:j,onScroll:M}=C(),[N,P]=(0,T.useState)(!1),F=l.data?.thread.subject,I=n(F?.kind===`task`?F.id:null);if(l.data===void 0)return(0,E.jsx)(y,{children:l.error instanceof r&&l.error.status===404?`There is no thread ${e}.`:`Reading the thread…`});let{thread:L}=l.data;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(b,{leading:(0,E.jsx)(w,{fallback:(0,E.jsx)(d,{to:`/c/$`,params:{_splat:L.channel},"aria-label":`Back to #${L.channel}`,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`←`})}),title:L.title,subtitle:`${x(L.subject)} thread in #${L.channel} · opened by ${O(L.openedBy)} ${c(L.openedAt,D)}`,trailing:(0,E.jsxs)(E.Fragment,{children:[L.subject?.kind===`task`?(0,E.jsx)(d,{to:`/task/$taskId`,params:{taskId:L.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Task →`}):L.subject?.kind===`proposal`?(0,E.jsx)(d,{to:`/proposal/$proposalId`,params:{proposalId:L.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Proposal →`}):null,L.state===`open`&&!N&&L.subject?.kind!==`task`?(0,E.jsx)(u,{onClick:()=>P(!0),children:`Close`}):(0,E.jsx)(S,{state:L.state})]})}),N&&L.state===`open`?(0,E.jsx)(g,{threadId:L.id,channel:L.channel,onDone:()=>P(!1)}):null,(0,E.jsxs)(`div`,{ref:j,onScroll:M,className:`flex-1 overflow-y-auto py-2`,children:[k.length===0?(0,E.jsx)(y,{children:`No messages in this thread yet.`}):null,k.map(e=>(0,E.jsx)(v,{message:e,members:m.data,now:D,task:I.data},e.id)),L.state===`closed`?(0,E.jsxs)(`section`,{className:`mx-4 mt-3 mb-2 rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:[(0,E.jsxs)(`p`,{className:`text-caps`,children:[`Closed by `,O(L.closedBy??`board`),L.closedAt===void 0?``:` ${c(L.closedAt,D)}`]}),L.body.trim()===``?(0,E.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`It ended with its `,x(L.subject),`.`]}):(0,E.jsx)(_,{text:L.body})]}):null]}),L.state===`open`?(0,E.jsx)(p,{target:{threadId:L.id},placeholder:`Reply in the thread`}):null]})}export{D as ThreadView};
@@ -1 +1 @@
1
- import{nt as e,ut as t}from"./format-BORdp4w-.js";import{l as n}from"./index-ww_EHgVF.js";function r(e){return e===`society`?`the society`:e}function i(e){return[...e.memberships,t]}function a(e){return e.map(e=>({value:e,name:r(e),id:null,description:e===`society`?`outside any project`:`a project`}))}function o(e){return e.startedAt===void 0?null:n(e.startedAt,Date.parse(e.ts))}var s={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`interrupted`,blocked:`blocked`,stopped:`stopped by you`};function c(e){return e.exitReason===null?e.outcome===`failed`?`failed`:`completed`:s[e.exitReason]??e.exitReason}function l(e){return e.outcome===`failed`||e.exitReason!==null&&e.exitReason!==`completed`&&e.exitReason!==`stopped`}var u=new Intl.NumberFormat(`en`,{notation:`compact`}),d=new Intl.NumberFormat(`en`);function f(e){return e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens}function p(e){return`${u.format(f(e))} in · ${u.format(e.outputTokens)} out`}function m(e){return[`${d.format(f(e))} input tokens: ${d.format(e.cacheReadTokens)} read from the cache,`,`${d.format(e.cacheWriteTokens)} written to it, ${d.format(e.inputTokens)} neither;`,`${d.format(e.outputTokens)} output tokens`].join(` `)}function h(t){let n=t.flatMap(e=>e.usage===void 0?[]:[e.usage]);return{turns:t.length,failed:t.filter(l).length,usage:n.length===0?null:n.reduce(e),withUsage:n.length}}function g(e,t){let n=/^\s*#{1,6}\s+(.+?)\s*(?:\n|$)/.exec(e);return n?.[1]?.toLowerCase()===t.toLowerCase()?e.slice(n[0].length).trim():e}function _(e,t){let n=[...e.homeRunner===void 0?[]:[{what:`outside projects`,runner:e.homeRunner}],...e.memberships.map(e=>({what:e,runner:t.get(e)}))],r=[...new Set(n.flatMap(e=>e.runner===void 0?[]:[e.runner]))],i=n.map(e=>`${e.what}: ${e.runner??`placed on its first turn`}`).join(`; `);return{label:r.length===0?`no runner yet`:`on ${r.join(`, `)}`,detail:i===``?`pinned to a runner on its first turn`:i}}export{r as a,o as c,a as i,i as l,h as n,m as o,_ as r,p as s,c as t,g as u};
1
+ import{ft as e,rt as t}from"./format-qPQgH1PF.js";import{l as n}from"./index-BfZnvrmA.js";function r(e){return e===`society`?`the society`:e}function i(t){return[...t.memberships,e]}function a(e){return e.map(e=>({value:e,name:r(e),id:null,description:e===`society`?`outside any project`:`a project`}))}function o(e){return e.startedAt===void 0?null:n(e.startedAt,Date.parse(e.ts))}var s={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`interrupted`,blocked:`blocked`,stopped:`stopped by you`};function c(e){return e.exitReason===null?e.outcome===`failed`?`failed`:`completed`:s[e.exitReason]??e.exitReason}function l(e){return e.outcome===`failed`||e.exitReason!==null&&e.exitReason!==`completed`&&e.exitReason!==`stopped`}var u=new Intl.NumberFormat(`en`,{notation:`compact`}),d=new Intl.NumberFormat(`en`);function f(e){return e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens}function p(e){return`${u.format(f(e))} in · ${u.format(e.outputTokens)} out`}function m(e){return[`${d.format(f(e))} input tokens: ${d.format(e.cacheReadTokens)} read from the cache,`,`${d.format(e.cacheWriteTokens)} written to it, ${d.format(e.inputTokens)} neither;`,`${d.format(e.outputTokens)} output tokens`].join(` `)}function h(e){let n=e.flatMap(e=>e.usage===void 0?[]:[e.usage]);return{turns:e.length,failed:e.filter(l).length,usage:n.length===0?null:n.reduce(t),withUsage:n.length}}function g(e,t){let n=/^\s*#{1,6}\s+(.+?)\s*(?:\n|$)/.exec(e);return n?.[1]?.toLowerCase()===t.toLowerCase()?e.slice(n[0].length).trim():e}function _(e,t){let n=[...e.homeRunner===void 0?[]:[{what:`outside projects`,runner:e.homeRunner}],...e.memberships.map(e=>({what:e,runner:t.get(e)}))],r=[...new Set(n.flatMap(e=>e.runner===void 0?[]:[e.runner]))],i=n.map(e=>`${e.what}: ${e.runner??`placed on its first turn`}`).join(`; `);return{label:r.length===0?`no runner yet`:`on ${r.join(`, `)}`,detail:i===``?`pinned to a runner on its first turn`:i}}export{r as a,o as c,a as i,i as l,h as n,m as o,_ as r,p as s,c as t,g as u};
@@ -1 +1 @@
1
- import{It as e,Sn as t,Tn as n,Y as r,_n as i,_t as a,an as o,bn as s,gn as c,kt as l,ln as u,nn as d,pn as f,rn as p,sn as m,xn as h}from"./format-BORdp4w-.js";import{t as g}from"./mentions-BCdV0bMK.js";var _=class extends d{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||v(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=p({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),o.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function v(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var y=class extends m{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&u(t.mutationKey)!==u(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??v();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){o.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},b=n(t(),1);function x(e,t){let n=s(t),[r]=b.useState(()=>new y(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);let a=b.useSyncExternalStore(b.useCallback(e=>r.subscribe(o.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),c=b.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(f)},[r]);if(a.error&&i(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:c,mutateAsync:a.mutate}}function S(t){let n=e();return b.useCallback(e=>n.navigate({...e,from:e.from??t?.from}),[t?.from,n])}var C=h(),w={primary:`bg-fg-primary font-medium text-surface-0 hover:bg-white`,ghost:`text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`};function T({variant:e=`ghost`,className:t=``,...n}){return(0,C.jsx)(`button`,{type:`button`,...n,className:`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40 ${w[e]} ${t}`})}function E(e,t){let n=/(^|[^\w@])@([a-z0-9-]*)$/.exec(e.slice(0,t))?.[2];return n===void 0?null:{start:t-n.length-1,prefix:n}}function D(e,t,n,r){let i=`@${r} `;return{text:e.slice(0,n)+i+e.slice(t),caret:n+i.length}}function O(e,t,n){let r=t.filter(e=>e.status===`active`&&e.cli!==null),i=r.filter(e=>n.find(t=>t.name===e.role)?.wakeTriggers.includes(`user_post`)).map(e=>e.name),a=g(e).filter(e=>r.some(t=>t.name===e));return[...new Set([...i,...a])]}function k(e,t,n,i){return e.filter(e=>n.some(n=>{if(n.agent!==e||!n.steerable)return!1;if(`thread`in i)return n.thread===i.thread;let o=t.find(t=>t.name===e);if(o===void 0||n.thread!==void 0)return!1;let s=a(o,l(i.channel).project);return n.scope===s&&n.channel===r(s,i.channel)}))}function A(e,t){let n=e.length===0?null:`reaches ${M(e)} in the turn under way`,r=t.length===0?null:`wakes ${M(t)}: a turn each`;return n===null&&r===null?null:`Sending ${[n,r].filter(e=>e!==null).join(` and `)}.`}var j=new Intl.ListFormat(`en`,{type:`conjunction`});function M(e){return j.format(e)}export{A as a,S as c,k as i,x as l,M as n,O as o,E as r,T as s,D as t,_ as u};
1
+ import{Cn as e,Dn as t,Rt as n,Sn as r,X as i,an as a,dn as o,hn as s,in as c,jt as l,ln as u,sn as d,vn as f,wn as p,yn as m,yt as h}from"./format-qPQgH1PF.js";import{t as g}from"./mentions-BCdV0bMK.js";var _=class extends c{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||v(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=a({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,o=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:o})}let a=await r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),d.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function v(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var y=class extends u{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),f(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&o(t.mutationKey)!==o(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??v();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){d.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},b=t(p(),1);function x(e,t){let n=r(t),[i]=b.useState(()=>new y(n,e));b.useEffect(()=>{i.setOptions(e)},[i,e]);let a=b.useSyncExternalStore(b.useCallback(e=>i.subscribe(d.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=b.useCallback((...e)=>{i.mutate(e[0],e[1]).catch(s)},[i]);if(a.error&&m(i.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function S(e){let t=n();return b.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var C=e(),w={primary:`bg-fg-primary font-medium text-surface-0 hover:bg-white`,ghost:`text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`};function T({variant:e=`ghost`,className:t=``,...n}){return(0,C.jsx)(`button`,{type:`button`,...n,className:`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40 ${w[e]} ${t}`})}function E(e,t){let n=/(^|[^\w@])@([a-z0-9-]*)$/.exec(e.slice(0,t))?.[2];return n===void 0?null:{start:t-n.length-1,prefix:n}}function D(e,t,n,r){let i=`@${r} `;return{text:e.slice(0,n)+i+e.slice(t),caret:n+i.length}}function O(e,t,n){let r=t.filter(e=>e.status===`active`&&e.cli!==null),i=r.filter(e=>n.find(t=>t.name===e.role)?.wakeTriggers.includes(`user_post`)).map(e=>e.name),a=g(e).filter(e=>r.some(t=>t.name===e));return[...new Set([...i,...a])]}function k(e,t,n,r){return e.filter(e=>n.some(n=>{if(n.agent!==e||!n.steerable)return!1;if(`thread`in r)return n.thread===r.thread;let a=t.find(t=>t.name===e);if(a===void 0||n.thread!==void 0)return!1;let o=h(a,l(r.channel).project);return n.scope===o&&n.channel===i(o,r.channel)}))}function A(e,t){let n=e.length===0?null:`reaches ${M(e)} in the turn under way`,r=t.length===0?null:`wakes ${M(t)}: a turn each`;return n===null&&r===null?null:`Sending ${[n,r].filter(e=>e!==null).join(` and `)}.`}var j=new Intl.ListFormat(`en`,{type:`conjunction`});function M(e){return j.format(e)}export{A as a,S as c,k as i,x as l,M as n,O as o,E as r,T as s,D as t,_ as u};