@kubitnodes/stellaris 0.3.22 → 0.3.24

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 (67) hide show
  1. package/README.md +4 -4
  2. package/dist/cli/index.js +1029 -571
  3. package/dist/server/index.js +1256 -656
  4. package/package.json +1 -1
  5. package/web/dist/assets/BackLink-DKMw_rHu.js +1 -0
  6. package/web/dist/assets/{Button-Yoe21NQ2.js → Button-BYJGqZ3Q.js} +1 -1
  7. package/web/dist/assets/{ChannelForms-55otlg-m.js → ChannelForms-CkYupEL2.js} +1 -1
  8. package/web/dist/assets/ChannelView-BIXouQMX.js +2 -0
  9. package/web/dist/assets/CitizenView-C3AMFixP.js +2 -0
  10. package/web/dist/assets/CitizensView-CYFS3f9U.js +1 -0
  11. package/web/dist/assets/{CliIcon-DbMYJdlU.js → CliIcon-DVX5iLhG.js} +1 -1
  12. package/web/dist/assets/CronsView-BGCcO7bH.js +1 -0
  13. package/web/dist/assets/KnowledgeView-DLLYjd1G.js +1 -0
  14. package/web/dist/assets/Markdown--whKJBYV.js +30 -0
  15. package/web/dist/assets/MessageItem-BvDOeJci.js +1 -0
  16. package/web/dist/assets/MetricsView-B-KUNOZm.js +1 -0
  17. package/web/dist/assets/NeedsYouView-Dee_bOKj.js +1 -0
  18. package/web/dist/assets/{Overview-BveU1yJj.js → Overview-DFiHDFnA.js} +1 -1
  19. package/web/dist/assets/{Pane-CLjdfBMM.js → Pane-DTmByqgA.js} +1 -1
  20. package/web/dist/assets/{Picker-CXOe5Xdu.js → Picker-DsHm4f7s.js} +1 -1
  21. package/web/dist/assets/{ProjectView-oa4Z46ED.js → ProjectView-DsRXW-qk.js} +1 -1
  22. package/web/dist/assets/ProposalView-B-4P1S-s.js +1 -0
  23. package/web/dist/assets/{ProposalsView-BZHivSEm.js → ProposalsView-uEuj-ooV.js} +1 -1
  24. package/web/dist/assets/Quota-D8WDWp5H.js +1 -0
  25. package/web/dist/assets/{RunnersView-BrJF-aLU.js → RunnersView-BB3q65rG.js} +1 -1
  26. package/web/dist/assets/SkillFileList-DhdEcFQA.js +2 -0
  27. package/web/dist/assets/SkillView-vAv7zvtJ.js +1 -0
  28. package/web/dist/assets/SocietyView-Dv4phSkz.js +1 -0
  29. package/web/dist/assets/{StickyList-7tAlUDCN.js → StickyList-C4fC_KJv.js} +1 -1
  30. package/web/dist/assets/SubjectThread-BEXt-tub.js +1 -0
  31. package/web/dist/assets/{TaskFileView-BEXQJQQ6.js → TaskFileView-B9sex0tS.js} +2 -2
  32. package/web/dist/assets/{TaskView-Cfhb7NuO.js → TaskView-BCT388kb.js} +2 -2
  33. package/web/dist/assets/{TasksView-3XljXcoi.js → TasksView-CuPay34-.js} +1 -1
  34. package/web/dist/assets/{ThreadForms-D2y5dXSC.js → ThreadForms-DzoRDeBh.js} +1 -1
  35. package/web/dist/assets/ThreadItem-CDVppcOZ.js +1 -0
  36. package/web/dist/assets/ThreadView-B4F10_j1.js +1 -0
  37. package/web/dist/assets/citizen-BPIJzKdn.js +1 -0
  38. package/web/dist/assets/{compose-DNc3_c5x.js → compose-BUhbVoI-.js} +1 -1
  39. package/web/dist/assets/format-CvfmDNoY.js +55 -0
  40. package/web/dist/assets/{governance-RBQ4Lam0.js → governance-Bba0OHvJ.js} +1 -1
  41. package/web/dist/assets/index-Bj8MlyAn.css +2 -0
  42. package/web/dist/assets/index-DD3J11PT.js +23 -0
  43. package/web/dist/assets/{mentions-B2Qchd_6.js → mentions-D838wlfQ.js} +1 -1
  44. package/web/dist/assets/{tasks-DCUj5w_d.js → tasks-CTaxXtGL.js} +1 -1
  45. package/web/dist/assets/useMatch-B8j0hm1q.js +1 -0
  46. package/web/dist/index.html +9 -9
  47. package/web/dist/assets/BackLink-CD-iuy-h.js +0 -1
  48. package/web/dist/assets/ChannelView-DJvLzg0N.js +0 -2
  49. package/web/dist/assets/CitizenView-m1K2aTvK.js +0 -2
  50. package/web/dist/assets/CitizensView-BeTgmrKE.js +0 -1
  51. package/web/dist/assets/CronsView-B4kXk5Ld.js +0 -1
  52. package/web/dist/assets/KnowledgeView-aSGxDDKy.js +0 -1
  53. package/web/dist/assets/Markdown-c9bCCLHg.js +0 -30
  54. package/web/dist/assets/MessageItem-DKJKMqs-.js +0 -1
  55. package/web/dist/assets/MetricsView-D2TTry5O.js +0 -1
  56. package/web/dist/assets/NeedsYouView-C3celRei.js +0 -1
  57. package/web/dist/assets/ProposalView-B4T-EoX9.js +0 -2
  58. package/web/dist/assets/Quota-BC7dpnwd.js +0 -1
  59. package/web/dist/assets/SocietyView-C1yosPuf.js +0 -1
  60. package/web/dist/assets/SubjectThread-CCq6ZAnR.js +0 -1
  61. package/web/dist/assets/ThreadItem-DeIhhmyu.js +0 -1
  62. package/web/dist/assets/ThreadView-CbUnt9WL.js +0 -1
  63. package/web/dist/assets/citizen--bqux6i_.js +0 -1
  64. package/web/dist/assets/format-B6fjC0_a.js +0 -55
  65. package/web/dist/assets/index-CyCty7a2.js +0 -23
  66. package/web/dist/assets/index-GRqxKN35.css +0 -2
  67. package/web/dist/assets/useMatch-CfbBQirn.js +0 -1
@@ -1 +1 @@
1
- import{Bn as e,Un as t,zn as n}from"./format-B6fjC0_a.js";var r=t(e(),1),i=n(),a=`mt-1 overflow-y-auto rounded-xl bg-surface-1/95 p-1 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.08),0_16px_32px_-12px_rgba(0,0,0,0.8)] backdrop-blur-xl`;function o(e){return`flex w-full items-start gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors focus-visible:outline-none ${e?`bg-surface-2/80`:`hover:bg-surface-2/50 focus-visible:bg-surface-2/50`}`}function s(e){return e===void 0?``:`${e.name}${e.id===null?``:` · ${e.id}`}`}function c({label:e,choices:t,value:n,onChange:c,listClassName:l=`inset-x-0`}){let[u,d]=(0,r.useState)(!1),f=(0,r.useRef)(null),p=(0,r.useRef)(null),m=(0,r.useRef)([]),h=t.findIndex(e=>e.value===n);(0,r.useEffect)(()=>{if(!u)return;m.current[Math.max(h,0)]?.focus();let e=e=>{e.target instanceof Node&&f.current?.contains(e.target)===!0||d(!1)};return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[u,h]);let g=e=>{if(e.key===`Escape`){e.stopPropagation(),d(!1),p.current?.focus();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=(m.current.findIndex(e=>e===document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length;m.current[n]?.focus()},_=t[h];return(0,i.jsxs)(`div`,{ref:f,className:`relative min-w-0 flex-1`,children:[(0,i.jsxs)(`button`,{ref:p,type:`button`,"aria-label":`${e}: ${s(_)}`,"aria-expanded":u,onClick:()=>d(!u),onKeyDown:u?g:void 0,className:`flex h-7 w-full items-center gap-1.5 rounded-md bg-surface-2/60 px-2.5 text-xs text-fg-secondary transition-colors hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,i.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:[_?.name,_?.id===null||_===void 0?null:(0,i.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,_.id]})]}),(0,i.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] text-fg-muted transition-transform ${u?`rotate-180`:``}`,children:`▾`})]}),u?(0,i.jsx)(`div`,{className:`absolute top-full z-20 max-h-80 ${a} ${l}`,children:t.map((e,t)=>{let r=e.value===n;return(0,i.jsxs)(`button`,{ref:e=>{m.current[t]=e},type:`button`,"aria-current":r?`true`:void 0,onKeyDown:g,onClick:()=>{c(e.value),d(!1),p.current?.focus()},className:o(r),children:[(0,i.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,i.jsxs)(`span`,{className:`block truncate text-xs text-fg-secondary`,children:[e.name,e.id===null?null:(0,i.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,e.id]})]}),e.description===``?null:(0,i.jsx)(`span`,{className:`block truncate text-[11px] text-fg-muted`,children:e.description})]}),(0,i.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 shrink-0 pt-px text-[11px] text-fg-primary`,children:r?`✓`:``})]},e.value)})}):null]})}export{c as n,o as r,a as t};
1
+ import{Gn as e,Jn as t,Wn as n}from"./format-CvfmDNoY.js";var r=t(e(),1),i=n(),a=`mt-1 overflow-y-auto rounded-xl bg-surface-1/95 p-1 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.08),0_16px_32px_-12px_rgba(0,0,0,0.8)] backdrop-blur-xl`;function o(e){return`flex w-full items-start gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors focus-visible:outline-none ${e?`bg-surface-2/80`:`hover:bg-surface-2/50 focus-visible:bg-surface-2/50`}`}function s(e){return e===void 0?``:`${e.name}${e.id===null?``:` · ${e.id}`}`}function c({label:e,choices:t,value:n,onChange:c,listClassName:l=`inset-x-0`}){let[u,d]=(0,r.useState)(!1),f=(0,r.useRef)(null),p=(0,r.useRef)(null),m=(0,r.useRef)([]),h=t.findIndex(e=>e.value===n);(0,r.useEffect)(()=>{if(!u)return;m.current[Math.max(h,0)]?.focus();let e=e=>{e.target instanceof Node&&f.current?.contains(e.target)===!0||d(!1)};return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[u,h]);let g=e=>{if(e.key===`Escape`){e.stopPropagation(),d(!1),p.current?.focus();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=(m.current.findIndex(e=>e===document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length;m.current[n]?.focus()},_=t[h];return(0,i.jsxs)(`div`,{ref:f,className:`relative min-w-0 flex-1`,children:[(0,i.jsxs)(`button`,{ref:p,type:`button`,"aria-label":`${e}: ${s(_)}`,"aria-expanded":u,onClick:()=>d(!u),onKeyDown:u?g:void 0,className:`flex h-7 w-full items-center gap-1.5 rounded-md bg-surface-2/60 px-2.5 text-xs text-fg-secondary transition-colors hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,i.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:[_?.name,_?.id===null||_===void 0?null:(0,i.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,_.id]})]}),(0,i.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] text-fg-muted transition-transform ${u?`rotate-180`:``}`,children:`▾`})]}),u?(0,i.jsx)(`div`,{className:`absolute top-full z-20 max-h-80 ${a} ${l}`,children:t.map((e,t)=>{let r=e.value===n;return(0,i.jsxs)(`button`,{ref:e=>{m.current[t]=e},type:`button`,"aria-current":r?`true`:void 0,onKeyDown:g,onClick:()=>{c(e.value),d(!1),p.current?.focus()},className:o(r),children:[(0,i.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,i.jsxs)(`span`,{className:`block truncate text-xs text-fg-secondary`,children:[e.name,e.id===null?null:(0,i.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,e.id]})]}),e.description===``?null:(0,i.jsx)(`span`,{className:`block truncate text-[11px] text-fg-muted`,children:e.description})]}),(0,i.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 shrink-0 pt-px text-[11px] text-fg-primary`,children:r?`✓`:``})]},e.value)})}):null]})}export{c as n,o as r,a as t};
@@ -1 +1 @@
1
- import{A as e,Bn as t,R as n,Rn as r,Un as i,Wt as a,_ as o,b as s,c,h as l,t as u,u as d,x as f,zn as p}from"./format-B6fjC0_a.js";import{n as m,t as h}from"./Button-Yoe21NQ2.js";import{i as g,t as _}from"./tasks-DCUj5w_d.js";import{A as v}from"./index-CyCty7a2.js";import{t as y}from"./Markdown-c9bCCLHg.js";import{n as b,r as x}from"./ThreadForms-D2y5dXSC.js";import{n as S,r as C}from"./ChannelForms-55otlg-m.js";import{n as w,t as T}from"./Pane-CLjdfBMM.js";import{n as E,r as D,t as O}from"./Overview-BveU1yJj.js";var k=i(t(),1),A=p();function j({project:t,onDone:n}){let{api:i}=e(),a=r(),[o,s]=(0,k.useState)(t.name),[c,l]=(0,k.useState)(t.defaultBranch),u={...o.trim()===t.name?{}:{name:o.trim()},...c.trim()===t.defaultBranch?{}:{default_branch:c.trim()}},d=m({mutationFn:()=>i.configureProject(t.slug,u),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`projects`]}),n()}}),f=Object.keys(u).length===0||o.trim()===``||c.trim()===``;return(0,A.jsxs)(`form`,{"aria-label":`Edit ${t.slug}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`input`,{value:o,maxLength:120,"aria-label":`Project name`,onChange:e=>s(e.target.value),className:`${b} min-w-0 flex-1`}),(0,A.jsx)(`div`,{className:`w-36 shrink-0`,children:(0,A.jsx)(`input`,{value:c,maxLength:100,spellCheck:!1,"aria-label":`Default branch`,onChange:e=>l(e.target.value),className:`${b} font-mono`})}),(0,A.jsx)(h,{onClick:n,children:`Cancel`}),(0,A.jsx)(h,{variant:`primary`,type:`submit`,disabled:d.isPending||f,children:d.isPending?`Saving…`:`Save`})]}),(0,A.jsxs)(`p`,{className:`text-meta`,children:[t.slug,` stays in its addresses, channels, and branches. A new default branch is where tasks start and land from now; its runner makes it from the project's remote, or from where the repository stands, before the next turn.`]}),(0,A.jsx)(x,{error:d.error})]})}function M(){let{slug:e}=v({from:`/p/$slug`}),t=f(),r=c(),i=o(),p=n(e),m=d(e),b=l(e),x=s(3e4),[M,N]=(0,k.useState)(!1),[P,F]=(0,k.useState)(!1),I=t.data?.find(t=>t.slug===e);if(I===void 0)return(0,A.jsx)(w,{children:t.data===void 0?`Reading the project…`:`There is no project ${e}.`});let L=(i.data??[]).filter(e=>e.status===`active`&&I.members.includes(e.name)),R=g(p.data??[]),z=m.data?.body.trim()??``;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(T,{title:I.name,subtitle:`${e} · ${I.repo??`a local repository`} · ${I.defaultBranch}`,trailing:(0,A.jsxs)(A.Fragment,{children:[M||I.archived!==void 0?null:(0,A.jsx)(h,{onClick:()=>N(!0),children:`Edit…`}),(0,A.jsx)(a,{to:`/p/$slug/tasks`,params:{slug:e},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Tasks →`})]})}),M?(0,A.jsx)(j,{project:I,onDone:()=>N(!1)}):null,P?(0,A.jsx)(C,{project:e,onDone:()=>F(!1)}):null,(0,A.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[I.archived===void 0?null:(0,A.jsxs)(`p`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-sm text-fg-secondary`,children:[`Archived `,u(I.archived.at,x),` by `,I.archived.by,`:`,` `,I.archived.reason,`. Its channels, tasks, and history stay readable here; nothing more is posted, filed, or joined.`]}),(0,A.jsx)(E,{title:`Channels`,aside:I.archived===void 0&&!P?(0,A.jsx)(h,{onClick:()=>F(!0),children:`New channel…`}):null,children:(0,A.jsx)(S,{channels:(r.data??[]).filter(t=>t.project===e),now:x})}),(0,A.jsx)(E,{title:`Members`,children:(0,A.jsx)(O,{members:L,scope:e})}),(0,A.jsx)(E,{title:`Tasks`,children:p.data===void 0?(0,A.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):R.length===0?(0,A.jsx)(`p`,{className:`text-meta`,children:`No tasks yet.`}):(0,A.jsx)(a,{to:`/p/$slug/tasks`,params:{slug:e},className:`flex flex-wrap gap-1.5`,children:R.map(e=>(0,A.jsxs)(`span`,{className:`rounded-md bg-surface-2/60 px-2 py-0.5 text-xs text-fg-secondary`,children:[e.tasks.length,` `,_.find(t=>t.phase===e.phase)?.label.toLowerCase()]},e.phase))})}),(0,A.jsx)(E,{title:`How a task ends`,children:(0,A.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:I.onDone===`merge`?`When its last stage is done, the board merges task/<id> onto ${I.defaultBranch}.`:I.onDone===`ghpr`?`When its last stage is done, the board merges the pull request linked to it into ${I.defaultBranch} on GitHub.`:`When its last stage is done, it is done; nothing is merged.`})}),(0,A.jsx)(E,{title:`Dashboard`,aside:m.data?.updatedBy===void 0?void 0:(0,A.jsxs)(`span`,{className:`text-meta`,children:[`by `,m.data.updatedBy,m.data.updatedAt===void 0?``:` ${u(m.data.updatedAt,x)}`]}),children:m.data===void 0?(0,A.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):z===``?(0,A.jsx)(`p`,{className:`text-meta`,children:`Empty. The project's members fill it in with update_dashboard.`}):(0,A.jsx)(y,{text:z})}),(0,A.jsx)(E,{title:`Knowledge`,children:(0,A.jsx)(D,{scope:e,topics:b.data,now:x})})]})]})}export{M as ProjectView};
1
+ import{A as e,Gn as t,Jn as n,Un as r,Wn as i,Yt as a,_ as o,b as s,c,h as l,t as u,u as d,x as f,z as p}from"./format-CvfmDNoY.js";import{n as m,t as h}from"./Button-BYJGqZ3Q.js";import{i as g,t as _}from"./tasks-CTaxXtGL.js";import{A as v}from"./index-DD3J11PT.js";import{t as y}from"./Markdown--whKJBYV.js";import{n as b,r as x}from"./ThreadForms-DzoRDeBh.js";import{n as S,r as C}from"./ChannelForms-CkYupEL2.js";import{n as w,t as T}from"./Pane-DTmByqgA.js";import{n as E,r as D,t as O}from"./Overview-DFiHDFnA.js";var k=n(t(),1),A=i();function j({project:t,onDone:n}){let{api:i}=e(),a=r(),[o,s]=(0,k.useState)(t.name),[c,l]=(0,k.useState)(t.defaultBranch),u={...o.trim()===t.name?{}:{name:o.trim()},...c.trim()===t.defaultBranch?{}:{default_branch:c.trim()}},d=m({mutationFn:()=>i.configureProject(t.slug,u),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`projects`]}),n()}}),f=Object.keys(u).length===0||o.trim()===``||c.trim()===``;return(0,A.jsxs)(`form`,{"aria-label":`Edit ${t.slug}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`input`,{value:o,maxLength:120,"aria-label":`Project name`,onChange:e=>s(e.target.value),className:`${b} min-w-0 flex-1`}),(0,A.jsx)(`div`,{className:`w-36 shrink-0`,children:(0,A.jsx)(`input`,{value:c,maxLength:100,spellCheck:!1,"aria-label":`Default branch`,onChange:e=>l(e.target.value),className:`${b} font-mono`})}),(0,A.jsx)(h,{onClick:n,children:`Cancel`}),(0,A.jsx)(h,{variant:`primary`,type:`submit`,disabled:d.isPending||f,children:d.isPending?`Saving…`:`Save`})]}),(0,A.jsxs)(`p`,{className:`text-meta`,children:[t.slug,` stays in its addresses, channels, and branches. A new default branch is where tasks start and land from now; its runner makes it from the project's remote, or from where the repository stands, before the next turn.`]}),(0,A.jsx)(x,{error:d.error})]})}function M(){let{slug:e}=v({from:`/p/$slug`}),t=f(),n=c(),r=o(),i=p(e),m=d(e),b=l(e),x=s(3e4),[M,N]=(0,k.useState)(!1),[P,F]=(0,k.useState)(!1),I=t.data?.find(t=>t.slug===e);if(I===void 0)return(0,A.jsx)(w,{children:t.data===void 0?`Reading the project…`:`There is no project ${e}.`});let L=(r.data??[]).filter(e=>e.status===`active`&&I.members.includes(e.name)),R=g(i.data??[]),z=m.data?.body.trim()??``;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(T,{title:I.name,subtitle:`${e} · ${I.repo??`a local repository`} · ${I.defaultBranch}`,trailing:(0,A.jsxs)(A.Fragment,{children:[M||I.archived!==void 0?null:(0,A.jsx)(h,{onClick:()=>N(!0),children:`Edit…`}),(0,A.jsx)(a,{to:`/p/$slug/tasks`,params:{slug:e},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Tasks →`})]})}),M?(0,A.jsx)(j,{project:I,onDone:()=>N(!1)}):null,P?(0,A.jsx)(C,{project:e,onDone:()=>F(!1)}):null,(0,A.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[I.archived===void 0?null:(0,A.jsxs)(`p`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-sm text-fg-secondary`,children:[`Archived `,u(I.archived.at,x),` by `,I.archived.by,`:`,` `,I.archived.reason,`. Its channels, tasks, and history stay readable here; nothing more is posted, filed, or joined.`]}),(0,A.jsx)(E,{title:`Channels`,aside:I.archived===void 0&&!P?(0,A.jsx)(h,{onClick:()=>F(!0),children:`New channel…`}):null,children:(0,A.jsx)(S,{channels:(n.data??[]).filter(t=>t.project===e),now:x})}),(0,A.jsx)(E,{title:`Members`,children:(0,A.jsx)(O,{members:L,scope:e})}),(0,A.jsx)(E,{title:`Tasks`,children:i.data===void 0?(0,A.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):R.length===0?(0,A.jsx)(`p`,{className:`text-meta`,children:`No tasks yet.`}):(0,A.jsx)(a,{to:`/p/$slug/tasks`,params:{slug:e},className:`flex flex-wrap gap-1.5`,children:R.map(e=>(0,A.jsxs)(`span`,{className:`rounded-md bg-surface-2/60 px-2 py-0.5 text-xs text-fg-secondary`,children:[e.tasks.length,` `,_.find(t=>t.phase===e.phase)?.label.toLowerCase()]},e.phase))})}),(0,A.jsx)(E,{title:`How a task ends`,children:(0,A.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:I.onDone===`merge`?`When its last stage is done, the board merges task/<id> onto ${I.defaultBranch}.`:I.onDone===`ghpr`?`When its last stage is done, the board merges the pull request linked to it into ${I.defaultBranch} on GitHub.`:`When its last stage is done, it is done; nothing is merged.`})}),(0,A.jsx)(E,{title:`Dashboard`,aside:m.data?.updatedBy===void 0?void 0:(0,A.jsxs)(`span`,{className:`text-meta`,children:[`by `,m.data.updatedBy,m.data.updatedAt===void 0?``:` ${u(m.data.updatedAt,x)}`]}),children:m.data===void 0?(0,A.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):z===``?(0,A.jsx)(`p`,{className:`text-meta`,children:`Empty. The project's members fill it in with update_dashboard.`}):(0,A.jsx)(y,{text:z})}),(0,A.jsx)(E,{title:`Knowledge`,children:(0,A.jsx)(D,{scope:e,topics:b.data,now:x})})]})]})}export{M as ProjectView};
@@ -0,0 +1 @@
1
+ import{A as e,B as t,C as n,E as r,Gn as i,Gt as a,Ht as o,Jn as s,Jt as c,K as l,Kt as u,N as d,S as f,Un as p,V as m,Wn as h,Wt as g,Yt as _,_ as v,b as y,dt as b,ft as x,gt as S,ht as C,mt as ee,pt as w,t as T,vt as te,x as ne,yt as re,z as ie}from"./format-CvfmDNoY.js";import{n as ae,t as E}from"./Button-BYJGqZ3Q.js";import{t as oe}from"./CliIcon-DVX5iLhG.js";import{a as se}from"./tasks-CTaxXtGL.js";import{c as ce,d as D,l as O,n as k,o as A,r as j,s as M}from"./governance-Bba0OHvJ.js";import{A as N,i as P,o as F,s as I}from"./index-DD3J11PT.js";import{t as L}from"./BackLink-DKMw_rHu.js";import{t as R}from"./Markdown--whKJBYV.js";import{n as z,r as B}from"./ThreadForms-DzoRDeBh.js";import{n as V,t as H}from"./Pane-DTmByqgA.js";import{t as le}from"./StickyList-C4fC_KJv.js";import{t as U}from"./SkillFileList-DhdEcFQA.js";import{StatusChip as W}from"./ProposalsView-uEuj-ooV.js";import{t as ue}from"./SubjectThread-BEXt-tub.js";var G=s(i(),1),K=h();function de({proposal:t,consequence:n}){let{api:r}=e(),i=p(),a=v(),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(``),u=(0,G.useRef)(null);(0,G.useEffect)(()=>{o!==null&&u.current?.focus()},[o]);let d=ae({mutationFn:()=>{let e=c.trim();return o===`reject`?r.reject({proposal_id:t.id,reason:e}):r.approve({proposal_id:t.id,...e===``?{}:{reason:e}})},onSuccess:()=>{let e=[[`proposals`],[`proposal`,t.id],[`threads`],[`thread`,t.id]];for(let t of e)i.invalidateQueries({queryKey:t});s(null),l(``)}}),f=(a.data??[]).find(e=>e.name===t.proposedBy&&e.status===`active`&&e.cli!==null),m=f===void 0?`Your decision is posted in the proposal's thread, which closes.`:`Your decision is posted in the proposal's thread, which closes, and wakes ${f.name}, who proposed it.`;if(o===null)return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-line px-4 py-3`,children:[(0,K.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`This proposal waits on you.`}),(0,K.jsx)(E,{onClick:()=>s(`reject`),children:`Reject`}),(0,K.jsx)(E,{variant:`primary`,onClick:()=>s(`approve`),children:`Approve`})]});let h=o===`approve`;return(0,K.jsxs)(`form`,{"aria-label":h?`Approve the proposal`:`Reject the proposal`,className:`space-y-2 border-t border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,K.jsx)(`textarea`,{ref:u,value:c,rows:2,placeholder:h?`Why approve? Optional.`:`Why not? It is posted with the decision.`,"aria-label":h?`Reason for approving`:`Reason for rejecting`,onChange:e=>l(e.target.value),className:`${z} resize-none`}),(0,K.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[h?n:`Nothing is created, and the proposal's thread closes.`,` `,m]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,K.jsx)(E,{onClick:()=>{s(null),d.reset()},children:`Cancel`}),(0,K.jsx)(E,{variant:`primary`,type:`submit`,disabled:d.isPending||!h&&c.trim()===``,children:d.isPending?`Deciding…`:h?`Confirm approval`:`Confirm rejection`})]}),(0,K.jsx)(B,{error:d.error})]})}function q({children:e}){return(0,K.jsx)(`dl`,{className:`mt-2 space-y-1.5`,children:e})}function J({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`grid grid-cols-[9rem_1fr] gap-3 text-sm`,children:[(0,K.jsx)(`dt`,{className:`text-meta`,children:e}),(0,K.jsx)(`dd`,{className:`min-w-0 break-words text-fg-secondary`,children:t})]})}function Y(e){return e.length===0?`none`:e.join(`, `)}function X({name:e,change:t}){return(0,K.jsxs)(`span`,{className:`inline-block rounded-md px-1.5 py-px font-mono text-[11px] ${t===`added`?`bg-emerald-500/15 text-emerald-300`:t===`removed`?`bg-red-500/15 text-red-300 line-through`:`bg-surface-2/70 text-fg-tertiary`}`,children:[t===`added`?`+ `:t===`removed`?`− `:``,e]})}function Z({children:e}){return(0,K.jsx)(`div`,{className:`mt-2 rounded-xl bg-surface-2/30 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:e})}function Q({next:e,current:t,compare:n}){let r=t===void 0?null:ce(t,e),i=r!==null&&r.verbsAdded.length===0&&r.verbsRemoved.length===0&&r.changes.length===0&&!r.purposeChanged;return(0,K.jsxs)(K.Fragment,{children:[n?r===null?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:`A new role: no charter by this name exists yet.`}):i?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:`The same as the charter the role has now.`}):(0,K.jsxs)(Z,{children:[(0,K.jsx)(`p`,{className:`text-caps`,children:`Against the charter it has now`}),r.verbsAdded.length+r.verbsRemoved.length===0?null:(0,K.jsxs)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:[r.verbsAdded.map(e=>(0,K.jsx)(X,{name:e,change:`added`},e)),r.verbsRemoved.map(e=>(0,K.jsx)(X,{name:e,change:`removed`},e))]}),r.changes.length===0?null:(0,K.jsx)(q,{children:r.changes.map(e=>(0,K.jsxs)(J,{label:e.field,children:[e.from,` → `,(0,K.jsx)(`span`,{className:`text-fg-primary`,children:e.to})]},e.field))}),r.purposeChanged?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-secondary`,children:`The purpose is rewritten.`}):null]}):null,(0,K.jsxs)(q,{children:[(0,K.jsx)(J,{label:`Role`,children:e.name}),(0,K.jsx)(J,{label:`Purpose`,children:e.purpose}),(0,K.jsx)(J,{label:`Verbs`,children:(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.verbs.map(e=>(0,K.jsx)(X,{name:e},e))})}),(0,K.jsx)(J,{label:`Wake triggers`,children:Y(e.wakeTriggers)}),(0,K.jsx)(J,{label:`Replicas per project`,children:e.maxReplicas}),(0,K.jsx)(J,{label:`Warm session`,children:e.resident?`yes`:`no`}),(0,K.jsx)(J,{label:`Society role`,children:e.societyScope?`yes, in no project`:`no`}),(0,K.jsx)(J,{label:`Reflects`,children:e.reflects?`yes`:`no`})]})]})}function fe({proposal:e,reallocation:t,current:n,compare:r}){let{role:i,changes:a,description:o}=t,s=e.provision?.changed,c=Array.isArray(s)?s.filter(e=>typeof e==`string`):null;return r&&n!=null?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Q,{next:re(n,a),current:n,compare:!0}),(0,K.jsx)(q,{children:(0,K.jsx)(J,{label:`Why`,children:o})})]}):(0,K.jsxs)(q,{children:[(0,K.jsx)(J,{label:`Role`,children:i}),r&&n===null?(0,K.jsx)(J,{label:`Role now`,children:`none by this name; approving it will fail`}):null,c===null?(0,K.jsxs)(K.Fragment,{children:[a.maxReplicas===void 0?null:(0,K.jsx)(J,{label:`Replicas per project`,children:a.maxReplicas}),a.backlogThreshold===void 0?null:(0,K.jsx)(J,{label:`Backlog per member`,children:a.backlogThreshold}),a.wakeTriggers===void 0?null:(0,K.jsx)(J,{label:`Wake triggers`,children:Y(a.wakeTriggers)}),a.verbs===void 0?null:(0,K.jsx)(J,{label:`Verbs`,children:(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:a.verbs.map(e=>(0,K.jsx)(X,{name:e},e))})})]}):(0,K.jsx)(J,{label:`Changed`,children:c.map(e=>(0,K.jsx)(`span`,{className:`block`,children:e},e))}),(0,K.jsx)(J,{label:`Why`,children:o})]})}function pe({proposal:e,slug:t,reason:n,members:r}){let i=ne(),a=ie(t),o=i.data?.find(e=>e.slug===t),s=e.status===`proposed`,c=s?(r??[]).filter(e=>e.status===`active`&&e.memberships.includes(t)).map(e=>e.name):e.provision?.members??[],l=(a.data??[]).filter(se).length;return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Project`,children:[(0,K.jsx)(_,{to:`/p/$slug`,params:{slug:t},className:`hover:text-fg-primary`,children:o?.name??t}),o?.name===void 0||o.name===t?null:` · ${t}`]}),(0,K.jsx)(J,{label:s?`Members who leave`:`Members who left`,children:Array.isArray(c)?Y(c.filter(e=>typeof e==`string`)):`none`}),s?(0,K.jsx)(J,{label:`Tasks in play`,children:a.data===void 0?`reading…`:l===0?`none`:`${l}: approval is refused until they are done, abandoned, or filed elsewhere`}):null,(0,K.jsx)(J,{label:`Reason`,children:n}),(0,K.jsx)(J,{label:`After`,children:`Its open threads close and nothing more is posted, filed, or joined there; its channels, tasks, repository, and history stay readable.`})]})}function me({proposal:e,name:t}){let r=e.skillFiles,i=n(e.id,r!==void 0);if(r===void 0)return(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-secondary`,children:e.status===`proposed`?`The board takes skills/${t}/ from ${e.proposedBy}'s home when the turn that proposed it ends.`:`The board took no files for it.`});if(i.data===void 0)return(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:i.isError?`Could not read its files.`:`Loading…`});let a=i.data.find(e=>e.path===`SKILL.md`),o=i.data.filter(e=>e.path!==`SKILL.md`);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(q,{children:(0,K.jsxs)(J,{label:`Taken from`,children:[e.proposedBy,`'s home at`,` `,(0,K.jsx)(`span`,{className:`font-mono`,children:r.commit.slice(0,7)})]})}),a===void 0||a.text===null?null:(0,K.jsx)(Z,{children:(0,K.jsx)(R,{text:O(a.text)})}),o.length===0?null:(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(U,{files:o})})]})}function he({proposal:e,roles:t,members:n}){let r=e.status===`proposed`,{charter:i}=e;switch(e.kind){case`member`:{let e=ee.safeParse(i);if(!e.success)break;let t=e.data;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(q,{children:[(0,K.jsx)(J,{label:`Citizen`,children:(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(oe,{cli:t.cli,size:13}),t.name]})}),(0,K.jsx)(J,{label:`Role`,children:t.role}),(0,K.jsxs)(J,{label:`CLI and model`,children:[t.cli,` · `,t.model??`cli default`]}),(0,K.jsx)(J,{label:`Projects`,children:Y(t.memberships)}),(0,K.jsx)(J,{label:`Also follows`,children:Y(t.subscriptions)}),t.homeRunner===void 0?null:(0,K.jsx)(J,{label:`Runs on`,children:t.homeRunner})]}),t.seedInstructions===void 0?null:(0,K.jsxs)(Z,{children:[(0,K.jsx)(`p`,{className:`text-caps`,children:`Seed instructions`}),(0,K.jsx)(`div`,{className:`mt-1.5`,children:(0,K.jsx)(R,{text:t.seedInstructions})})]})]})}case`role`:{let n=M(e);if(n===null)break;return(0,K.jsx)(Q,{next:n,current:t?.find(e=>e.name===n.name),compare:r})}case`skill`:{let t=te.safeParse(i);if(!t.success)break;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(q,{children:[(0,K.jsx)(J,{label:`Skill`,children:t.data.name}),(0,K.jsx)(J,{label:`Summary`,children:t.data.summary})]}),t.data.body===void 0?(0,K.jsx)(me,{proposal:e,name:t.data.name}):(0,K.jsx)(Z,{children:(0,K.jsx)(R,{text:O(t.data.body)})})]})}case`channel`:{let e=x.safeParse(i);if(!e.success)break;return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Channel`,children:[`#`,o(e.data.project,e.data.name)]}),(0,K.jsx)(J,{label:`Purpose`,children:e.data.purpose})]})}case`retirement`:{let e=S.safeParse(i);if(!e.success)break;let t=n?.find(t=>t.name===e.data.agent);return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Citizen`,children:[(0,K.jsx)(F,{name:e.data.agent,members:n}),t===void 0?null:` · ${t.role}`]}),(0,K.jsx)(J,{label:`Holds now`,children:t===void 0?`unknown`:t.claimsHeld===1?`1 stage`:`${t.claimsHeld} stages`}),(0,K.jsx)(J,{label:`Reason`,children:e.data.reason})]})}case`archive`:{let t=b.safeParse(i);if(!t.success)break;return(0,K.jsx)(pe,{proposal:e,slug:t.data.project,reason:t.data.reason,members:n})}case`reallocation`:{let n=C.safeParse(i);if(!n.success){let e=w.safeParse(i);if(!e.success)break;return(0,K.jsx)(q,{children:(0,K.jsx)(J,{label:`Reallocation`,children:e.data.description})})}return(0,K.jsx)(fe,{proposal:e,reallocation:n.data,current:t===void 0?void 0:t.find(e=>e.name===n.data.role)??null,compare:r})}}return(0,K.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-lg bg-surface-2/40 p-3 font-mono text-[11px] text-fg-tertiary`,children:JSON.stringify(i,null,2)})}var ge=u({agent:c().optional(),channel:c().optional(),role:c().optional(),skill:c().optional(),replaced:a().optional(),releasedTasks:g(c()).optional(),project:c().optional()});function $({proposal:e}){let t=ge.safeParse(e.provision??{});if(e.provision===void 0||!t.success)return null;let n=t.data,r=`text-fg-primary underline decoration-fg-muted underline-offset-2`;if(e.kind===`member`&&n.agent!==void 0)return(0,K.jsxs)(`p`,{className:`mt-1`,children:[`Created`,` `,(0,K.jsx)(_,{to:`/citizen/$name`,params:{name:n.agent},className:r,children:n.agent}),`.`]});if(e.kind===`channel`&&n.channel!==void 0)return(0,K.jsxs)(`p`,{className:`mt-1`,children:[`Created`,` `,(0,K.jsxs)(_,{to:`/c/$`,params:{_splat:n.channel},className:r,children:[`#`,n.channel]}),`.`]});if(e.kind===`retirement`&&n.agent!==void 0){let e=n.releasedTasks?.length??0;return(0,K.jsxs)(`p`,{className:`mt-1`,children:[`Retired `,n.agent,`; `,e===1?`1 stage went`:`${e} stages went`,` back to open.`]})}return e.kind===`archive`&&n.project!==void 0?(0,K.jsxs)(`p`,{className:`mt-1`,children:[`Archived`,` `,(0,K.jsx)(_,{to:`/p/$slug`,params:{slug:n.project},className:r,children:n.project}),`; its members left and its threads closed.`]}):n.role===void 0?n.skill===void 0?null:(0,K.jsxs)(`p`,{className:`mt-1`,children:[n.replaced===!0?`Replaced`:`Published`,` the society's skill `,n.skill,`.`]}):(0,K.jsxs)(`p`,{className:`mt-1`,children:[n.replaced===!0?`Rewrote`:`Added`,` the role `,n.role,`.`]})}function _e(){let{proposalId:e}=N({from:`/proposal/$proposalId`}),n=f(e),i=v(),a=r(),o=d(),s=m(),c=y(3e4),u=I(),p=t(s.data?.some(t=>t.id===e)===!0?e:null);if(n.data===void 0)return(0,K.jsx)(V,{children:n.error instanceof l&&n.error.status===404?`There is no proposal ${e}.`:`Reading the proposal…`});let h=n.data,g=h.status===`proposed`,b=i.data?.find(e=>e.name===h.proposedBy)?.role,x=s.data?.find(e=>e.id===h.id),S=h.status===`rejected`?`Rejected`:`Approved`,C=k(h,{members:i.data??[],roles:a.data??[],skills:o.data??[]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(H,{leading:(0,K.jsx)(L,{fallback:(0,K.jsx)(_,{to:`/proposals`,"aria-label":`Back to the proposals`,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:A(h),subtitle:`${h.kind} proposal by ${u(h.proposedBy)} ${T(h.createdAt,c)}${g?` · for ${j(h,b)} to decide`:``}`,trailing:(0,K.jsx)(W,{status:h.status})}),(0,K.jsxs)(le,{stick:!1,follow:!1,ids:p.data?.messages.map(e=>e.id),className:`px-4 py-4`,children:[g?(0,K.jsxs)(`p`,{className:`rounded-lg bg-sky-400/10 px-3 py-2 text-xs leading-relaxed text-sky-200`,children:[`If approved: `,C]}):(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-xs leading-relaxed text-fg-secondary`,children:[(0,K.jsxs)(`p`,{children:[S,` by `,u(h.decidedBy??`someone`),h.decidedAt===void 0?``:` ${T(h.decidedAt,c)}`,h.reason===void 0?`.`:`: ${h.reason}`]}),(0,K.jsx)($,{proposal:h})]}),h.body.trim()===``||x!==void 0?null:(0,K.jsxs)(`section`,{className:`mt-5`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:`Why`}),(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(R,{text:h.body})})]}),(0,K.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:g?`What it would make`:h.status===`provisioned`?`What it made`:`What it proposed`}),(0,K.jsx)(he,{proposal:h,roles:a.data,members:i.data})]}),(0,K.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:`Thread`}),x===void 0?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:s.data===void 0?`Reading the thread…`:`This proposal is older than proposal threads; its thread opens when it is decided.`}):(0,K.jsx)(ue,{thread:x,now:c,empty:`Nothing said yet. The pitch and the decision are posted here.`})]})]},h.id),x?.state===`open`?(0,K.jsx)(P,{target:{threadId:h.id},placeholder:`Write in the proposal's thread`}):null,D(h)?(0,K.jsx)(de,{proposal:h,consequence:C}):null]})}export{_e as ProposalView};
@@ -1 +1 @@
1
- import{Bn as e,Un as t,Wt as n,b as r,t as i,w as a,zn as o}from"./format-B6fjC0_a.js";import{i as s,o as c,t as l}from"./governance-RBQ4Lam0.js";import{s as u}from"./index-CyCty7a2.js";import{n as d,t as f}from"./Pane-CLjdfBMM.js";var p=t(e(),1),m=o(),h=8,g={proposed:`bg-amber-500/15 text-amber-300`,approved:`bg-emerald-500/15 text-emerald-300`,provisioned:`bg-emerald-500/15 text-emerald-300`,rejected:`bg-red-500/15 text-red-300`,retired:`bg-surface-2 text-fg-muted`};function _({status:e}){return(0,m.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${g[e]}`,children:e===`provisioned`?`approved`:e})}function v({proposal:e,now:t}){let r=u(),a=e.decidedBy===void 0||e.decidedAt===void 0?``:` · ${e.status===`rejected`?`rejected`:`approved`} by ${r(e.decidedBy)} ${i(e.decidedAt,t)}`;return(0,m.jsx)(`li`,{children:(0,m.jsxs)(n,{to:`/proposal/$proposalId`,params:{proposalId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:c(e)}),(0,m.jsx)(_,{status:e.status})]}),(0,m.jsxs)(`p`,{className:`mt-1 truncate text-meta`,children:[`proposed by `,r(e.proposedBy),` `,i(e.createdAt,t),a]})]})})}function y(){let e=a(),t=r(3e4),[n,i]=(0,p.useState)(!1),o=s(e.data??[]),c=o.find(e=>e.group===`yours`)?.proposals.length??0;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f,{title:`Proposals`,subtitle:`${c===0?`nothing`:c} waiting on you · ${e.data?.length??0} in all`}),(0,m.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:e.data===void 0?(0,m.jsx)(d,{children:`Reading the proposals…`}):o.length===0?(0,m.jsx)(d,{children:`No proposals yet. Citizens propose roles, members, channels, and skills.`}):o.map(e=>{let r=e.group===`decided`&&!n?e.proposals.slice(0,h):e.proposals;return(0,m.jsxs)(`section`,{className:`mb-3`,children:[(0,m.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[l.find(t=>t.group===e.group)?.label,` ·`,` `,e.proposals.length]}),(0,m.jsx)(`ul`,{children:r.map(e=>(0,m.jsx)(v,{proposal:e,now:t},e.id))}),r.length<e.proposals.length?(0,m.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`px-3 pt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show all `,e.proposals.length]}):null]},e.group)})})]})}export{y as ProposalsView,_ as StatusChip};
1
+ import{Gn as e,Jn as t,Wn as n,Yt as r,b as i,t as a,w as o}from"./format-CvfmDNoY.js";import{i as s,o as c,t as l}from"./governance-Bba0OHvJ.js";import{s as u}from"./index-DD3J11PT.js";import{n as d,t as f}from"./Pane-DTmByqgA.js";var p=t(e(),1),m=n(),h=8,g={proposed:`bg-amber-500/15 text-amber-300`,approved:`bg-emerald-500/15 text-emerald-300`,provisioned:`bg-emerald-500/15 text-emerald-300`,rejected:`bg-red-500/15 text-red-300`,retired:`bg-surface-2 text-fg-muted`};function _({status:e}){return(0,m.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${g[e]}`,children:e===`provisioned`?`approved`:e})}function v({proposal:e,now:t}){let n=u(),i=e.decidedBy===void 0||e.decidedAt===void 0?``:` · ${e.status===`rejected`?`rejected`:`approved`} by ${n(e.decidedBy)} ${a(e.decidedAt,t)}`;return(0,m.jsx)(`li`,{children:(0,m.jsxs)(r,{to:`/proposal/$proposalId`,params:{proposalId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:c(e)}),(0,m.jsx)(_,{status:e.status})]}),(0,m.jsxs)(`p`,{className:`mt-1 truncate text-meta`,children:[`proposed by `,n(e.proposedBy),` `,a(e.createdAt,t),i]})]})})}function y(){let e=o(),t=i(3e4),[n,r]=(0,p.useState)(!1),a=s(e.data??[]),c=a.find(e=>e.group===`yours`)?.proposals.length??0;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f,{title:`Proposals`,subtitle:`${c===0?`nothing`:c} waiting on you · ${e.data?.length??0} in all`}),(0,m.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:e.data===void 0?(0,m.jsx)(d,{children:`Reading the proposals…`}):a.length===0?(0,m.jsx)(d,{children:`No proposals yet. Citizens propose roles, members, channels, and skills.`}):a.map(e=>{let i=e.group===`decided`&&!n?e.proposals.slice(0,h):e.proposals;return(0,m.jsxs)(`section`,{className:`mb-3`,children:[(0,m.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[l.find(t=>t.group===e.group)?.label,` ·`,` `,e.proposals.length]}),(0,m.jsx)(`ul`,{children:i.map(e=>(0,m.jsx)(v,{proposal:e,now:t},e.id))}),i.length<e.proposals.length?(0,m.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`px-3 pt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show all `,e.proposals.length]}):null]},e.group)})})]})}export{y as ProposalsView,_ as StatusChip};
@@ -0,0 +1 @@
1
+ import{A as e,At as t,Dt as n,Gn as r,Jn as i,Ot as a,Un as o,Wn as s,Yt as c,kt as l,t as u}from"./format-CvfmDNoY.js";import{n as d,t as f}from"./Button-BYJGqZ3Q.js";import{t as p}from"./CliIcon-DVX5iLhG.js";import{u as m}from"./citizen-BPIJzKdn.js";var h=i(r(),1);function g(e,t){return e===void 0||t-Date.parse(e.observedAt)>=9e5}function _(e){let t=[];for(let n of e)for(let e of n.clis){let r=n.quotas?.[e],i=r===void 0?void 0:t.find(t=>t.cli===e&&t.quota!==void 0&&a(t.quota,r));i===void 0?t.push({cli:e,runners:[n.name],quota:r,connected:n.status===`connected`}):i.runners.push(n.name)}return t}function v(e){let t=Math.max(1,Math.round(e/6e4));if(t<60)return`${t}m`;let n=Math.floor(t/60);return n<24?`${n}h ${t%60}m`:`${Math.floor(n/24)}d ${n%24}h`}function y(e,n){let r=t(e);if(!l(e,new Date(n)))return{name:r,percent:null,label:`reset`,reset:`reset since read`,high:!1};let i=e.usedPercent;return{name:r,percent:i===null?null:Math.min(100,i),label:i===null?`?`:`${Math.floor(i)}%`,reset:e.resetsAt===null?``:`resets in ${v(Date.parse(e.resetsAt)-n)}`,high:i!==null&&i>=80}}function b(e,t){let r=n(e,new Date(t));return r===`limited`?{level:r,words:e.limitedUntil===null?`limited`:`limited for ${v(Date.parse(e.limitedUntil)-t)}`,tone:`text-red-300`}:r===`warning`?{level:r,words:`near a limit`,tone:`text-amber-300`}:{level:r,words:r===`none`?`no plan limits reported`:``,tone:`text-fg-muted`}}function x(e,t){if(e===void 0)return`unknown`;let{level:n,words:r}=b(e,t);return n===`limited`||n===`none`?r:[...e.windows.map(e=>y(e,t)).map(e=>`${e.name} ${e.label}`),...r===``?[]:[r]].join(` · `)||`no windows reported`}var S=s(),C={claude:`bg-claude`,codex:`bg-codex`};function w(e){if(e.credits!==null){if(e.credits.unlimited)return`unlimited credits`;let t=Number(e.credits.balance);return e.credits.balance===null||Number.isNaN(t)?null:`credits ${t.toLocaleString(`en`)}`}let t=e.extraUsage;if(t===null||!t.enabled||t.usedCredits===null)return null;let n=e=>`${(e/100).toFixed(2)}${t.currency===null?``:` ${t.currency}`}`;return`extra usage ${n(t.usedCredits)}${t.monthlyLimit===null?``:` of ${n(t.monthlyLimit)}`}`}function T({cli:e,quota:t,now:n}){let r=b(t,n).level===`limited`?t.limitedBy:null;return(0,S.jsx)(`ul`,{className:`col-span-full mt-1 grid grid-cols-subgrid gap-y-0.5 pl-6`,children:t.windows.map(t=>{let i=y(t,n),a=t.key===r||(i.percent??0)>=100?`bg-red-400`:i.high?`bg-amber-400`:C[e];return(0,S.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid items-center text-xs`,children:[(0,S.jsx)(`span`,{className:`text-fg-secondary`,children:i.name}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 overflow-hidden rounded-full bg-surface-2`,children:(0,S.jsx)(`span`,{className:`block h-full rounded-full ${a}`,style:{width:`${i.percent??0}%`}})}),(0,S.jsx)(`span`,{className:`text-right text-fg-secondary tabular-nums`,children:i.label}),(0,S.jsx)(`span`,{className:`truncate text-fg-muted`,title:t.resetsAt===null?void 0:t.resetsAt,children:i.reset})]},t.key)})})}function E(e,t,n,r){if(n)return{words:`reading…`,detail:`asking the CLI on the runner`,tone:`text-fg-muted`};let i=e.quota;if(r!==void 0&&i===void 0)return{words:r.includes(`upgrade it`)?`runner too old to read`:`read failed`,detail:r,tone:`text-amber-300`};if(i===void 0)return e.connected?{words:`unknown`,detail:`nothing reported yet`,tone:`text-fg-muted`}:{words:`unknown`,detail:`nothing reported yet, and the runner is away`,tone:`text-fg-muted`};let{words:a,tone:o}=b(i,t),s=`as of ${u(i.observedAt,t)}`,c=i.source===`read`?`read on request`:`reported by a turn`;return{words:a===``?s:`${a} · ${s}`,detail:`${c} at ${i.observedAt}${r===void 0?``:`; the last read failed: ${r}`}`,tone:g(i,t)&&a===``?`text-fg-muted`:o}}function D({runners:t,now:n}){let{api:r}=e(),i=o(),[a,s]=(0,h.useState)(new Set),[c,l]=(0,h.useState)(new Map),u=(0,h.useRef)(new Set),{mutate:m}=d({mutationFn:({runner:e,cli:t})=>r.readQuota(e,t),onMutate:({runner:e,cli:t})=>{s(n=>new Set(n).add(`${e}/${t}`))},onSuccess:(e,{runner:t,cli:n})=>{l(e=>{let r=new Map(e);return r.delete(`${t}/${n}`),r})},onError:(e,{runner:t,cli:n})=>{l(r=>new Map(r).set(`${t}/${n}`,e.message))},onSettled:(e,t,{runner:n,cli:r})=>{s(e=>{let t=new Set(e);return t.delete(`${n}/${r}`),t}),i.invalidateQueries({queryKey:[`runners`]})}});(0,h.useEffect)(()=>{for(let e of t)if(e.status===`connected`)for(let t of e.clis){let n=`${e.name}/${t}`;!u.current.has(n)&&g(e.quotas?.[t],Date.now())&&(u.current.add(n),m({runner:e.name,cli:t}))}},[t,m]);let v=t.filter(e=>e.status===`connected`),y=_(t);return y.length===0?null:(0,S.jsxs)(`section`,{"aria-label":`Plan quota`,className:`mt-3 border-t border-line pt-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 px-2`,children:[(0,S.jsx)(`h2`,{className:`flex-1 text-section text-fg-primary`,children:`Plan quota`}),(0,S.jsx)(f,{className:`-mr-3`,disabled:v.length===0||a.size>0,onClick:()=>{for(let e of v)for(let t of e.clis)m({runner:e.name,cli:t})},children:a.size>0?`Reading…`:`Read again`})]}),(0,S.jsx)(`ul`,{"aria-label":`Quota by runner`,className:`mt-1.5 grid grid-cols-[auto_minmax(3rem,7rem)_auto_minmax(0,1fr)] gap-x-2 gap-y-1`,children:y.map(e=>{let t=e.runners[0]??``,r=`${t}/${e.cli}`,i=E(e,n,a.has(r),c.get(r)),o=e.quota?.plan,s=e.quota===void 0?null:w(e.quota);return(0,S.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid rounded-lg px-2 py-1.5`,children:[(0,S.jsxs)(`div`,{className:`col-span-full flex items-center gap-2 text-sm`,children:[(0,S.jsx)(p,{cli:e.cli,size:13}),(0,S.jsx)(`span`,{className:`text-fg-primary`,children:e.runners.join(` · `)}),(0,S.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e.cli,o==null?``:` · ${o}`,s===null?``:` · ${s}`]}),(0,S.jsxs)(`span`,{className:`ml-auto text-right text-xs ${i.tone}`,title:i.detail,children:[i.words,(0,S.jsxs)(`span`,{className:`sr-only`,children:[`, `,i.detail]})]})]}),e.quota===void 0||e.quota.windows.length===0?null:(0,S.jsx)(T,{cli:e.cli,quota:e.quota,now:n}),e.runners.length>1?(0,S.jsxs)(`p`,{className:`col-span-full pt-0.5 pl-6 text-meta`,children:[`Same numbers on `,e.runners.join(` and `),`, so most likely one login.`]}):null]},`${e.cli}/${t}`)})})]})}function O({member:e,runners:t,placed:n,now:r}){let i=e.cli,a=m(e,n);return i===null||a.length===0?null:(0,S.jsxs)(`p`,{className:`border-b border-line px-4 py-1.5 text-meta`,children:[(0,S.jsxs)(c,{to:`/runners`,className:`hover:text-fg-primary`,children:[i,` quota`]}),a.map(e=>{let n=t.find(t=>t.name===e)?.quotas?.[i],a=n===void 0?``:b(n,r).tone;return(0,S.jsxs)(`span`,{children:[` · `,e,` `,(0,S.jsx)(`span`,{className:a,title:n===void 0?`nothing reported yet`:`as of ${n.observedAt}`,children:x(n,r)})]},e)})]})}function k({member:e,runners:t,placed:n,now:r}){let i=e.cli;if(i===null)return null;let a=m(e,n).flatMap(e=>{let n=t.find(t=>t.name===e)?.quotas?.[i];if(n===void 0)return[];let{level:a,words:o}=b(n,r);return a===`limited`||a===`warning`?[{name:e,level:a,words:o}]:[]});if(a.length===0)return null;let o=a.some(e=>e.level===`limited`),s=a.map(e=>`${i} ${e.words} on ${e.name}`).join(`; `);return(0,S.jsx)(`span`,{title:s,className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full ${o?`bg-red-400`:`bg-amber-400`}`,children:(0,S.jsxs)(`span`,{className:`sr-only`,children:[`, `,s]})})}export{D as n,k as r,O as t};
@@ -1 +1 @@
1
- import{A as e,Bn as t,D as n,Rn as r,Un as i,b as a,d as o,k as s,t as c,x as l,zn as u}from"./format-B6fjC0_a.js";import{n as d,t as f}from"./Button-Yoe21NQ2.js";import{t as p}from"./CliIcon-DbMYJdlU.js";import{k as m}from"./index-CyCty7a2.js";import{n as h,r as g}from"./ThreadForms-D2y5dXSC.js";import{n as _,t as v}from"./Pane-CLjdfBMM.js";import{n as y}from"./Quota-BC7dpnwd.js";var b=i(t(),1);function x(e){return e.toUpperCase().replaceAll(/[^A-Z0-9]/g,``)}function S(e,t){return t!==void 0&&e.version!==void 0&&e.version!==t}function C(e){let t=e.gitIdentityMissing??[];if(t.length===0)return null;let n=t.map(e=>`user.${e}`),r=t.includes(`name`)?`git refuses the commits citizens make themselves on it`:`the commits citizens make themselves on it carry an empty address or one git made up`;return{label:t.length===1?`no git ${n.join(``)}`:`no git identity`,detail:`Its account has no git ${n.join(` or `)}, so ${r}. Set ${t.length===1?`it`:`them`} with git config --global there; the mark goes once the runner connects with ${t.length===1?`it`:`them`} set.`}}function w(e,t){return x(e)===x(t)}function T(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 E=u();function D(e,t){return Number(e.status!==`connected`)-Number(t.status!==`connected`)||e.name.localeCompare(t.name)}function O(e,t){return[e.length===0?`no CLI`:e.join(`, `),...t].join(` · `)}function k({enrollment:t,taken:n,followed:i,now:a}){let{api:o}=e(),s=r(),[l,u]=(0,b.useState)(null),p=l??T(t.hostname,n),m=()=>{s.invalidateQueries({queryKey:[`enrollments`]}),s.invalidateQueries({queryKey:[`runners`]})},_=d({mutationFn:()=>o.approveEnrollment(t.userCode,p.trim()),onSuccess:m}),v=d({mutationFn:()=>o.denyEnrollment(t.userCode),onSuccess:m}),y=_.isPending||v.isPending;return(0,E.jsxs)(`li`,{className:`rounded-xl border px-3 py-3 ${i?`border-amber-500/40 bg-amber-500/5`:`border-line`}`,children:[(0,E.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary`,children:t.hostname}),(0,E.jsx)(`code`,{className:`shrink-0 font-mono text-sm text-fg-primary`,children:t.userCode})]}),(0,E.jsxs)(`p`,{className:`mt-0.5 truncate text-meta`,children:[t.os,` · `,O(t.clis,t.capabilities),` · runner`,` `,t.version,` · asked `,c(t.requestedAt,a)]}),(0,E.jsxs)(`form`,{"aria-label":`Approve ${t.hostname}`,className:`mt-2.5 flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,E.jsx)(`input`,{value:p,maxLength:32,spellCheck:!1,"aria-label":`Runner name`,onChange:e=>u(e.target.value),className:`${h} min-w-0 flex-1 font-mono`}),(0,E.jsx)(f,{onClick:()=>v.mutate(),disabled:y,children:`Deny`}),(0,E.jsx)(f,{variant:`primary`,type:`submit`,disabled:y||p.trim()===``,children:_.isPending?`Approving…`:`Approve`})]}),(0,E.jsx)(`div`,{className:`mt-1.5`,children:(0,E.jsx)(g,{error:_.error??v.error})})]})}function A(){let{code:e}=m({from:`/runners`}),t=o(),r=n(),i=l(),u=s().data,d=a(3e4),f=t.data??[],h=(r.data??[]).map(e=>e.name),g=(r.data??[]).toSorted(D),b=g.filter(e=>e.status===`connected`).length,x=g.length-b,T=g.filter(e=>S(e,u)).length,O=g.filter(e=>C(e)!==null).length,A=e===void 0?void 0:f.find(t=>w(t.userCode,e)),j=A===void 0?f:[A,...f.filter(e=>e!==A)],M=e=>(i.data??[]).filter(t=>t.runner===e.name&&t.archived===void 0).map(e=>e.slug);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v,{title:`Runners`,subtitle:[`${b} connected`,...x===0?[]:[`${x} away`],...f.length===0?[]:[`${f.length} waiting for approval`],...u===void 0?[]:[`server v${u}`],...T===0?[]:[`${T} on another version`],...O===0?[]:[`${O} without a git identity`]].join(` · `)}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e!==void 0&&t.data!==void 0&&A===void 0?(0,E.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,j.length===0?null:(0,E.jsx)(`ul`,{"aria-label":`Waiting for approval`,className:`space-y-2 px-2 pb-3`,children:j.map(e=>(0,E.jsx)(k,{enrollment:e,taken:h,followed:e===A,now:d},e.userCode))}),r.data===void 0?(0,E.jsx)(_,{children:`Reading the runners…`}):g.length===0?(0,E.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No runners yet.`}):null,(0,E.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=M(e),r=n.length===0?`no projects`:n.join(`, `),i=C(e),a=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,E.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm`,children:[(0,E.jsxs)(`span`,{className:`flex items-center gap-1`,title:t,children:[e.clis.map(e=>(0,E.jsx)(p,{cli:e,size:13},e)),(0,E.jsx)(`span`,{className:`sr-only`,children:t})]}),(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`span`,{className:`block text-fg-primary`,children:e.name}),i===null?null:(0,E.jsx)(`span`,{className:`block text-xs text-amber-300`,title:i.detail,children:i.label})]}),(0,E.jsx)(`span`,{className:`text-fg-secondary`,children:e.os}),S(e,u)?(0,E.jsxs)(`span`,{className:`text-xs text-amber-300`,title:`the server runs v${u}`,children:[`v`,e.version,(0,E.jsxs)(`span`,{className:`sr-only`,children:[`, not the server's v`,u]})]}):(0,E.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version===void 0?``:`v${e.version}`}),(0,E.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:e.capabilities.join(`, `),children:e.capabilities.join(`, `)}),(0,E.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,E.jsx)(`span`,{className:`text-right text-xs ${a.tone}`,title:a.detail,children:a.label})]},e.name)})}),(0,E.jsx)(y,{runners:g,now:d})]})]})}export{A as RunnersView};
1
+ import{A as e,D as t,Gn as n,Jn as r,Un as i,Wn as a,b as o,d as s,k as c,t as l,x as u}from"./format-CvfmDNoY.js";import{n as d,t as f}from"./Button-BYJGqZ3Q.js";import{t as p}from"./CliIcon-DVX5iLhG.js";import{k as m}from"./index-DD3J11PT.js";import{n as h,r as g}from"./ThreadForms-DzoRDeBh.js";import{n as _,t as v}from"./Pane-DTmByqgA.js";import{n as y}from"./Quota-D8WDWp5H.js";var b=r(n(),1);function x(e){return e.toUpperCase().replaceAll(/[^A-Z0-9]/g,``)}function S(e,t){return t!==void 0&&e.version!==void 0&&e.version!==t}function C(e){let t=e.gitIdentityMissing??[];if(t.length===0)return null;let n=t.map(e=>`user.${e}`),r=t.includes(`name`)?`git refuses the commits citizens make themselves on it`:`the commits citizens make themselves on it carry an empty address or one git made up`;return{label:t.length===1?`no git ${n.join(``)}`:`no git identity`,detail:`Its account has no git ${n.join(` or `)}, so ${r}. Set ${t.length===1?`it`:`them`} with git config --global there; the mark goes once the runner connects with ${t.length===1?`it`:`them`} set.`}}function w(e,t){return x(e)===x(t)}function T(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 E=a();function D(e,t){return Number(e.status!==`connected`)-Number(t.status!==`connected`)||e.name.localeCompare(t.name)}function O(e,t){return[e.length===0?`no CLI`:e.join(`, `),...t].join(` · `)}function k({enrollment:t,taken:n,followed:r,now:a}){let{api:o}=e(),s=i(),[c,u]=(0,b.useState)(null),p=c??T(t.hostname,n),m=()=>{s.invalidateQueries({queryKey:[`enrollments`]}),s.invalidateQueries({queryKey:[`runners`]})},_=d({mutationFn:()=>o.approveEnrollment(t.userCode,p.trim()),onSuccess:m}),v=d({mutationFn:()=>o.denyEnrollment(t.userCode),onSuccess:m}),y=_.isPending||v.isPending;return(0,E.jsxs)(`li`,{className:`rounded-xl border px-3 py-3 ${r?`border-amber-500/40 bg-amber-500/5`:`border-line`}`,children:[(0,E.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary`,children:t.hostname}),(0,E.jsx)(`code`,{className:`shrink-0 font-mono text-sm text-fg-primary`,children:t.userCode})]}),(0,E.jsxs)(`p`,{className:`mt-0.5 truncate text-meta`,children:[t.os,` · `,O(t.clis,t.capabilities),` · runner`,` `,t.version,` · asked `,l(t.requestedAt,a)]}),(0,E.jsxs)(`form`,{"aria-label":`Approve ${t.hostname}`,className:`mt-2.5 flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,E.jsx)(`input`,{value:p,maxLength:32,spellCheck:!1,"aria-label":`Runner name`,onChange:e=>u(e.target.value),className:`${h} min-w-0 flex-1 font-mono`}),(0,E.jsx)(f,{onClick:()=>v.mutate(),disabled:y,children:`Deny`}),(0,E.jsx)(f,{variant:`primary`,type:`submit`,disabled:y||p.trim()===``,children:_.isPending?`Approving…`:`Approve`})]}),(0,E.jsx)(`div`,{className:`mt-1.5`,children:(0,E.jsx)(g,{error:_.error??v.error})})]})}function A(){let{code:e}=m({from:`/runners`}),n=s(),r=t(),i=u(),a=c().data,d=o(3e4),f=n.data??[],h=(r.data??[]).map(e=>e.name),g=(r.data??[]).toSorted(D),b=g.filter(e=>e.status===`connected`).length,x=g.length-b,T=g.filter(e=>S(e,a)).length,O=g.filter(e=>C(e)!==null).length,A=e===void 0?void 0:f.find(t=>w(t.userCode,e)),j=A===void 0?f:[A,...f.filter(e=>e!==A)],M=e=>(i.data??[]).filter(t=>t.runner===e.name&&t.archived===void 0).map(e=>e.slug);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v,{title:`Runners`,subtitle:[`${b} connected`,...x===0?[]:[`${x} away`],...f.length===0?[]:[`${f.length} waiting for approval`],...a===void 0?[]:[`server v${a}`],...T===0?[]:[`${T} on another version`],...O===0?[]:[`${O} without a git identity`]].join(` · `)}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e!==void 0&&n.data!==void 0&&A===void 0?(0,E.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,j.length===0?null:(0,E.jsx)(`ul`,{"aria-label":`Waiting for approval`,className:`space-y-2 px-2 pb-3`,children:j.map(e=>(0,E.jsx)(k,{enrollment:e,taken:h,followed:e===A,now:d},e.userCode))}),r.data===void 0?(0,E.jsx)(_,{children:`Reading the runners…`}):g.length===0?(0,E.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No runners yet.`}):null,(0,E.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=M(e),r=n.length===0?`no projects`:n.join(`, `),i=C(e),o=e.status===`connected`?{label:`connected`,detail:`connected`,tone:`text-fg-muted`}:{label:`away`,detail:`away${e.lastSeen===void 0?``:`, last seen ${l(e.lastSeen,d)}`}`,tone:`text-amber-300`};return(0,E.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm`,children:[(0,E.jsxs)(`span`,{className:`flex items-center gap-1`,title:t,children:[e.clis.map(e=>(0,E.jsx)(p,{cli:e,size:13},e)),(0,E.jsx)(`span`,{className:`sr-only`,children:t})]}),(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`span`,{className:`block text-fg-primary`,children:e.name}),i===null?null:(0,E.jsx)(`span`,{className:`block text-xs text-amber-300`,title:i.detail,children:i.label})]}),(0,E.jsx)(`span`,{className:`text-fg-secondary`,children:e.os}),S(e,a)?(0,E.jsxs)(`span`,{className:`text-xs text-amber-300`,title:`the server runs v${a}`,children:[`v`,e.version,(0,E.jsxs)(`span`,{className:`sr-only`,children:[`, not the server's v`,a]})]}):(0,E.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version===void 0?``:`v${e.version}`}),(0,E.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:e.capabilities.join(`, `),children:e.capabilities.join(`, `)}),(0,E.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,E.jsx)(`span`,{className:`text-right text-xs ${o.tone}`,title:o.detail,children:o.label})]},e.name)})}),(0,E.jsx)(y,{runners:g,now:d})]})]})}export{A as RunnersView};
@@ -0,0 +1,2 @@
1
+ import{Gn as e,Jn as t,Wn as n}from"./format-CvfmDNoY.js";import{p as r}from"./Markdown--whKJBYV.js";var i=t(e(),1),a=n();function o({files:e}){let[t,n]=(0,i.useState)(new Set),o=e=>{n(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})};return(0,a.jsx)(`ul`,{children:e.map(e=>{let n=t.has(e.path);return(0,a.jsxs)(`li`,{children:[(0,a.jsxs)(`button`,{type:`button`,"aria-expanded":n,title:e.path,onClick:()=>o(e.path),className:`group flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40 ${n?`bg-surface-2/30`:``}`,children:[(0,a.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,a.jsx)(`span`,{className:`min-w-0 truncate ${n?`text-fg-primary`:`text-fg-secondary group-hover:text-fg-primary`}`,children:e.path}),(0,a.jsxs)(`span`,{className:`shrink-0 text-meta`,children:[r(e.size),e.executable?` · executable`:``]})]}),n?e.text===null?(0,a.jsx)(`p`,{className:`mt-1 mb-2 ml-[18px] text-meta`,children:`A binary file; it is published as it is.`}):(0,a.jsxs)(`pre`,{className:`mt-1 mb-2 ml-[18px] max-h-96 overflow-auto rounded-lg bg-surface-2/40 p-3 font-mono text-[11px] leading-relaxed text-fg-secondary`,children:[e.text,e.truncated?`
2
+ …`:``]}):null]},e.path)})})}export{o as t};
@@ -0,0 +1 @@
1
+ import{A as e,Gn as t,Jn as n,M as r,N as i,Un as a,Wn as o,Yt as s}from"./format-CvfmDNoY.js";import{n as c,t as l}from"./Button-BYJGqZ3Q.js";import{i as u}from"./compose-BUhbVoI-.js";import{l as d}from"./governance-Bba0OHvJ.js";import{A as f}from"./index-DD3J11PT.js";import{t as p}from"./BackLink-DKMw_rHu.js";import{t as m}from"./Markdown--whKJBYV.js";import{n as h,r as g}from"./ThreadForms-DzoRDeBh.js";import{n as _,t as v}from"./Pane-DTmByqgA.js";import{n as y}from"./Overview-DFiHDFnA.js";import{t as b}from"./SkillFileList-DhdEcFQA.js";var x=n(t(),1),S=o(),C=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function w(){let{name:e}=f({from:`/skills/$name`}),t=i(),n=r(e),[a,o]=(0,x.useState)(!1),c=t.data?.find(t=>t.name===e);if(c===void 0)return(0,S.jsx)(_,{children:t.data===void 0?`Reading…`:`The society has no skill ${e}.`});let u=n.data?.find(e=>e.path===`SKILL.md`),h=n.data?.filter(e=>e.path!==`SKILL.md`)??[];return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(v,{leading:(0,S.jsx)(p,{fallback:(0,S.jsx)(s,{to:`/society`,"aria-label":`Back to the society`,className:C,children:`←`})}),title:(0,S.jsx)(`span`,{title:c.name,children:c.name}),subtitle:c.summary===``?void 0:(0,S.jsx)(`span`,{title:c.summary,children:c.summary}),trailing:a?null:(0,S.jsx)(l,{onClick:()=>o(!0),children:`Remove…`})}),a?(0,S.jsx)(T,{name:c.name,onCancel:()=>o(!1)}):null,(0,S.jsx)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:n.data===void 0?(0,S.jsx)(`p`,{className:`text-meta`,children:n.isError?`Could not read its files.`:`Reading…`}):(0,S.jsxs)(S.Fragment,{children:[u===void 0||u.text===null?null:(0,S.jsx)(m,{text:d(u.text)}),h.length===0?null:(0,S.jsx)(y,{title:`Files`,children:(0,S.jsx)(b,{files:h})})]})})]})}function T({name:t,onCancel:n}){let{api:r}=e(),i=a(),o=u(),[s,d]=(0,x.useState)(``),f=(0,x.useRef)(null);(0,x.useEffect)(()=>f.current?.focus(),[]);let p=c({mutationFn:()=>r.removeSkill({name:t,reason:s.trim()}),onSuccess:async()=>{await o({to:`/society`}),await i.invalidateQueries({queryKey:[`skills`]})}});return(0,S.jsxs)(`form`,{"aria-label":`Remove ${t}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),p.mutate()},children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`input`,{ref:f,value:s,"aria-label":`Reason`,placeholder:`Why it is wrong, superseded, or unused`,onChange:e=>d(e.target.value),className:`${h} min-w-0 flex-1`}),(0,S.jsx)(l,{onClick:n,children:`Cancel`}),(0,S.jsx)(l,{variant:`primary`,type:`submit`,disabled:p.isPending||s.trim()===``,children:p.isPending?`Removing…`:`Remove skill`})]}),(0,S.jsxs)(`p`,{className:`text-meta`,children:[`No citizen's skills index lists `,t,` from its next turn, and a notice in #general says so with your reason, waking nobody. Its proposer keeps its own copy, and the server keeps the text aside.`]}),(0,S.jsx)(g,{error:p.error})]})}export{w as SkillView};
@@ -0,0 +1 @@
1
+ import{Bt as e,E as t,Gn as n,Jn as r,N as i,P as a,Wn as o,Yt as s,_ as c,_t as l,b as u,c as d,h as f,x as p}from"./format-CvfmDNoY.js";import{t as m}from"./Button-BYJGqZ3Q.js";import{n as h,r as g}from"./ChannelForms-CkYupEL2.js";import{n as _,t as v}from"./Pane-DTmByqgA.js";import{n as y,r as b,t as x}from"./Overview-DFiHDFnA.js";var S=r(n(),1),C=o();function w(){let n=a(),r=c(),o=p(),s=t(),w=i(),E=f(l),D=d(),O=u(3e4),[k,A]=(0,S.useState)(!1);if(n.data===void 0||r.data===void 0)return(0,C.jsx)(_,{children:`Reading the society…`});let j=r.data.filter(e=>e.cli!==null),M=j.filter(e=>e.status===`active`),N=j.filter(e=>e.status===`retired`),P=(s.data??[]).filter(t=>t.name!==e);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(v,{title:n.data.name,subtitle:`${M.length} citizens · ${o.data?.length??0} projects · ${P.length} roles`}),k?(0,C.jsx)(g,{project:null,onDone:()=>A(!1)}):null,(0,C.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,C.jsxs)(y,{title:`Citizens`,children:[(0,C.jsx)(x,{members:M,scope:l}),N.length===0?null:(0,C.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Retired: `,N.map(e=>e.name).join(`, `)]})]}),(0,C.jsx)(y,{title:`Channels`,aside:k?null:(0,C.jsx)(m,{onClick:()=>A(!0),children:`New channel…`}),children:(0,C.jsx)(h,{channels:(D.data??[]).filter(e=>e.project===null),now:O})}),(0,C.jsx)(y,{title:`Roles`,children:(0,C.jsx)(`ul`,{className:`space-y-2.5`,children:P.map(e=>{let t=M.filter(t=>t.role===e.name).length;return(0,C.jsxs)(`li`,{children:[(0,C.jsxs)(`p`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,C.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,C.jsxs)(`span`,{className:`text-meta`,children:[t===1?`1 member`:`${t} members`,e.resident?` · warm session`:``,e.societyScope?` · society role`:``]})]}),(0,C.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:e.purpose})]},e.name)})})}),(0,C.jsx)(y,{title:`Knowledge`,children:(0,C.jsx)(b,{scope:l,topics:E.data,now:O})}),(0,C.jsx)(y,{title:`Skills`,children:w.data===void 0?(0,C.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):w.data.length===0?(0,C.jsx)(`p`,{className:`text-meta`,children:`None yet. A citizen's skill joins the society by proposal.`}):(0,C.jsx)(T,{skills:w.data})})]})]})}function T({skills:e}){return(0,C.jsx)(`ul`,{className:`-mx-2`,children:e.map(e=>(0,C.jsx)(`li`,{children:(0,C.jsxs)(s,{to:`/skills/$name`,params:{name:e.name},className:`block rounded-lg px-2 py-1.5 transition-colors hover:bg-surface-2/50`,children:[(0,C.jsx)(`span`,{className:`block text-sm text-fg-primary`,children:e.name}),e.summary===``?null:(0,C.jsx)(`span`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:e.summary})]})},e.name))})}export{w as SocietyView};
@@ -1 +1 @@
1
- import{Bn as e,Un as t,zn as n}from"./format-B6fjC0_a.js";var r=t(e(),1),i=80;function a(e){return e.scrollHeight-e.scrollTop-e.clientHeight}function o({stick:e=!0,follow:t=!0,ids:n=[]}={}){let o=(0,r.useRef)(null),c=(0,r.useRef)(e&&t),l=(0,r.useRef)(null),u=(0,r.useRef)(0),[d,f]=(0,r.useState)(!1),p=n.at(-1)??null,[m,h]=(0,r.useState)(null);(0,r.useLayoutEffect)(()=>{(!e||!t)&&(c.current=!1)},[e,t]),(0,r.useLayoutEffect)(()=>{let e=o.current;e!==null&&c.current&&(l.current===null?t&&(e.scrollTop=e.scrollHeight):l.current!==e.scrollHeight&&(l.current=e.scrollHeight,e.scrollTo({top:e.scrollHeight,behavior:s()})))}),(0,r.useLayoutEffect)(()=>{let e=o.current;if(e===null)return;let t=l.current===null&&a(e)>=i;f(t),h(e=>t&&e!==null?e:p)},[p]);let g=()=>{let e=o.current;if(e===null)return;let t=a(e)<i;(t||e.scrollTop<u.current)&&(l.current=null),u.current=e.scrollTop,c.current=t||l.current!==null,f(!c.current),c.current&&h(p)},_=({focus:e=!1}={})=>{let t=o.current;if(t===null)return;c.current=!0,l.current=t.scrollHeight,f(!1),h(p);let n=s(),r=t.scrollHeight-2*t.clientHeight;n===`smooth`&&t.scrollTop<r&&(t.scrollTop=r),u.current=t.scrollTop,t.scrollTo({top:t.scrollHeight,behavior:n});let i=[...t.querySelectorAll(`article`)].at(-1)??t.lastElementChild;e&&i instanceof HTMLElement&&(i.hasAttribute(`tabindex`)||i.setAttribute(`tabindex`,`-1`),i.focus({preventScroll:!0}))},v=m===null?0:n.filter(e=>e>m).length;return{ref:o,onScroll:g,away:d,unseen:d?v:0,jump:_}}function s(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`}var c=n();function l({stick:e,follow:t,ids:n,className:i,children:a}){let{ref:s,onScroll:l,away:u,unseen:d,jump:f}=o({stick:e,follow:t,ids:n}),p=(0,r.useRef)(null);return(0,c.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,c.jsx)(`div`,{ref:s,onScroll:l,className:`flex-1 overflow-y-auto ${i}`,children:a}),u?(0,c.jsxs)(`button`,{ref:p,type:`button`,onClick:()=>f({focus:document.activeElement===p.current}),"aria-label":d>0?`Jump to latest, ${d} new`:`Jump to latest`,title:`Jump to latest`,className:`absolute bottom-3 left-1/2 grid size-8 -translate-x-1/2 place-items-center rounded-full bg-surface-2 text-fg-secondary shadow-[inset_0_0_0_1px_rgba(255,255,255,0.08),0_8px_20px_-6px_rgba(0,0,0,0.9)] transition-colors hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,c.jsx)(`path`,{d:`M8 3v10M3.5 8.5 8 13l4.5-4.5`})}),d>0?(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 -right-1.5 min-w-4 rounded-full bg-fg-primary px-1 text-center text-[10px] leading-4 font-medium text-surface-0 tabular-nums`,children:d>99?`99+`:d}):null]}):null]})}export{l as t};
1
+ import{Gn as e,Jn as t,Wn as n}from"./format-CvfmDNoY.js";var r=t(e(),1),i=80;function a(e){return e.scrollHeight-e.scrollTop-e.clientHeight}function o({stick:e=!0,follow:t=!0,ids:n=[]}={}){let o=(0,r.useRef)(null),c=(0,r.useRef)(e&&t),l=(0,r.useRef)(null),u=(0,r.useRef)(0),[d,f]=(0,r.useState)(!1),p=n.at(-1)??null,[m,h]=(0,r.useState)(null);(0,r.useLayoutEffect)(()=>{(!e||!t)&&(c.current=!1)},[e,t]),(0,r.useLayoutEffect)(()=>{let e=o.current;e!==null&&c.current&&(l.current===null?t&&(e.scrollTop=e.scrollHeight):l.current!==e.scrollHeight&&(l.current=e.scrollHeight,e.scrollTo({top:e.scrollHeight,behavior:s()})))}),(0,r.useLayoutEffect)(()=>{let e=o.current;if(e===null)return;let t=l.current===null&&a(e)>=i;f(t),h(e=>t&&e!==null?e:p)},[p]);let g=()=>{let e=o.current;if(e===null)return;let t=a(e)<i;(t||e.scrollTop<u.current)&&(l.current=null),u.current=e.scrollTop,c.current=t||l.current!==null,f(!c.current),c.current&&h(p)},_=({focus:e=!1}={})=>{let t=o.current;if(t===null)return;c.current=!0,l.current=t.scrollHeight,f(!1),h(p);let n=s(),r=t.scrollHeight-2*t.clientHeight;n===`smooth`&&t.scrollTop<r&&(t.scrollTop=r),u.current=t.scrollTop,t.scrollTo({top:t.scrollHeight,behavior:n});let i=[...t.querySelectorAll(`article`)].at(-1)??t.lastElementChild;e&&i instanceof HTMLElement&&(i.hasAttribute(`tabindex`)||i.setAttribute(`tabindex`,`-1`),i.focus({preventScroll:!0}))},v=m===null?0:n.filter(e=>e>m).length;return{ref:o,onScroll:g,away:d,unseen:d?v:0,jump:_}}function s(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`}var c=n();function l({stick:e,follow:t,ids:n,className:i,children:a}){let{ref:s,onScroll:l,away:u,unseen:d,jump:f}=o({stick:e,follow:t,ids:n}),p=(0,r.useRef)(null);return(0,c.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,c.jsx)(`div`,{ref:s,onScroll:l,className:`flex-1 overflow-y-auto ${i}`,children:a}),u?(0,c.jsxs)(`button`,{ref:p,type:`button`,onClick:()=>f({focus:document.activeElement===p.current}),"aria-label":d>0?`Jump to latest, ${d} new`:`Jump to latest`,title:`Jump to latest`,className:`absolute bottom-3 left-1/2 grid size-8 -translate-x-1/2 place-items-center rounded-full bg-surface-2 text-fg-secondary shadow-[inset_0_0_0_1px_rgba(255,255,255,0.08),0_8px_20px_-6px_rgba(0,0,0,0.9)] transition-colors hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,c.jsx)(`path`,{d:`M8 3v10M3.5 8.5 8 13l4.5-4.5`})}),d>0?(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 -right-1.5 min-w-4 rounded-full bg-fg-primary px-1 text-center text-[10px] leading-4 font-medium text-surface-0 tabular-nums`,children:d>99?`99+`:d}):null]}):null]})}export{l as t};
@@ -0,0 +1 @@
1
+ import{B as e,Gn as t,Jn as n,Wn as r,_ as i,t as a}from"./format-CvfmDNoY.js";import{C as o}from"./index-DD3J11PT.js";import{t as s}from"./Markdown--whKJBYV.js";import{t as c}from"./MessageItem-BvDOeJci.js";var l=n(t(),1),u=r();function d({thread:t,now:n,task:r,empty:d}){let f=i(),p=e(t.id),m=p.data?.messages??[],h=m.at(-1)?.id??null;if((0,l.useEffect)(()=>o(t.id,h),[t.id,h]),p.data===void 0)return(0,u.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the thread…`});let g=p.data.thread;return(0,u.jsxs)(`div`,{className:`-mx-4 mt-1`,children:[m.length===0?(0,u.jsx)(`p`,{className:`mx-4 mt-1 text-meta`,children:d}):m.map(e=>(0,u.jsx)(c,{message:e,members:f.data,now:n,task:r},e.id)),t.state===`closed`?(0,u.jsxs)(`div`,{className:`mx-4 mt-2`,children:[(0,u.jsxs)(`p`,{className:`text-meta`,children:[`Closed`,g.closedAt===void 0?``:` ${a(g.closedAt,n)}`,g.body.trim()===``?`.`:`:`]}),g.body.trim()===``?null:(0,u.jsx)(s,{text:g.body})]}):null]})}export{d as t};
@@ -1,4 +1,4 @@
1
- import{Bn as e,L as t,P as n,Un as r,W as i,Wt as a,b as o,nt as s,t as c,x as l,zn as u}from"./format-B6fjC0_a.js";import{A as d,k as f}from"./index-CyCty7a2.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-c9bCCLHg.js";import{n as C,t as w}from"./Pane-CLjdfBMM.js";import{t as T}from"./BackLink-CD-iuy-h.js";var E=r(e(),1),D=u(),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(`
1
+ import{F as e,Gn as t,Jn as n,K as r,R as i,Wn as a,Yt as o,b as s,it as c,t as l,x as u}from"./format-CvfmDNoY.js";import{A as d,k as f}from"./index-DD3J11PT.js";import{t as p}from"./BackLink-DKMw_rHu.js";import{c as m,d as h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,t as C}from"./Markdown--whKJBYV.js";import{n as w,t as T}from"./Pane-DTmByqgA.js";var E=n(t(),1),D=a(),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)(y,{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)(y,{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)(y,{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:x(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
2
  `)?e.slice(0,-1).split(`
3
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(s),` 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:r}=d({from:`/task/$taskId/files/$`}),s=f({from:`/task/$taskId/files/$`}),u=y(g(r??``)??``),m=u.path,h=s.line??u.line,_=n(e),v=l(),b=t(e,m),S=o(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)(a,{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} ${c(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};
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:v(t.path,g(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 `,x(t.size),`, more than the `,x(c),` 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)(C,{text:i.text,base:{taskId:e,dir:h(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 (`,x(t.size),`). Download it to open it.`]})}function L(){let{taskId:t,_splat:n}=d({from:`/task/$taskId/files/$`}),a=f({from:`/task/$taskId/files/$`}),c=b(_(n??``)??``),h=c.path,g=a.line??c.line,v=e(t),y=u(),x=i(t,h),C=s(3e4),A=x.data,j=A?.kind===`file`?A.content:null,P=S(j,m(h)??`application/octet-stream`),F=h===``?`Files`:h.split(`/`).at(-1)??h,L=v.data?.title??t,R=(0,E.useRef)(null);(0,E.useEffect)(()=>{g!==void 0&&A!==void 0&&R.current?.querySelector(`.line-target`)?.scrollIntoView({block:`center`})},[g,A]);let z;if(A!==void 0)z=A.kind===`dir`?(0,D.jsx)(N,{taskId:t,file:A}):(0,D.jsx)(I,{taskId:t,file:A,url:P,line:g});else if(x.error instanceof r&&x.error.status===404)z=(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[h===``?`Nothing`:h,` is not on task/`,t,` yet. What a turn writes reaches the branch when the turn ends.`]});else if(x.error instanceof r&&x.error.status===503){let e=y.data?.find(e=>e.slug===v.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=x.error===null?(0,D.jsxs)(w,{children:[`Reading `,F,` from the task's runner…`]}):(0,D.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:x.error.message});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(T,{leading:(0,D.jsx)(p,{fallback:(0,D.jsx)(o,{to:`/task/$taskId`,params:{taskId:t},"aria-label":`Back to the task ${L}`,className:O,children:`←`})}),title:F,subtitle:A===void 0?L:`${L}${g===void 0?``:` · line ${g}`} · committed by ${A.commit.author} ${l(A.commit.at,C)} · ${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:t,path:h}),z]})]})}export{L as TaskFileView};
@@ -1,3 +1,3 @@
1
- import{A as e,B as t,Bn as n,F as r,I as i,P as a,Rn as o,Un as s,W as c,Wt as l,_ as u,b as d,t as f,x as p,z as m,zn as h}from"./format-B6fjC0_a.js";import{n as g,t as _}from"./Button-Yoe21NQ2.js";import{a as v,c as y,l as b,n as x,o as S,r as C,s as w,t as T}from"./tasks-DCUj5w_d.js";import{u as E}from"./governance-RBQ4Lam0.js";import{A as D,_ as O,i as k,o as A,s as j}from"./index-CyCty7a2.js";import{a as M,f as N,n as P,s as F,t as I,u as L}from"./Markdown-c9bCCLHg.js";import{n as R,r as z}from"./ThreadForms-D2y5dXSC.js";import{n as B,t as V}from"./Pane-CLjdfBMM.js";import{t as H}from"./StickyList-7tAlUDCN.js";import{t as ee}from"./BackLink-CD-iuy-h.js";import{t as U}from"./SubjectThread-CCq6ZAnR.js";var W=s(n(),1),G=h(),K={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 q({last:e,now:t}){return e===void 0?null:(0,G.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-meta`,children:[e.author,` `,f(e.at,t)]})}function J({taskId:e,path:t,patch:n}){let r=(0,W.useMemo)(()=>N(n),[n]);return(0,G.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,G.jsxs)(`div`,{className:`flex ${K[n.kind]}`,children:[(0,G.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,G.jsx)(l,{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,G.jsx)(`span`,{className:`min-w-0 flex-1 pr-2 break-words whitespace-pre-wrap`,children:n.text===``?` `:n.text})]},r))})}function Y({taskId:e,change:t}){let n=i(e,t.path),r;if(n.data!==void 0){let{patch:i,truncated:a}=n.data;r=i===null?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown here.`}):i===``?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`No lines changed.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(J,{taskId:e,path:t.path,patch:i}),a?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}else r=n.error instanceof c&&n.error.status===503?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`The task's runner is not connected, so the change cannot be read now.`}):n.error===null?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`Reading the change…`}):(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:n.error.message});return(0,G.jsxs)(`div`,{className:`mb-2 ml-[18px]`,children:[t.status===`deleted`?null:(0,G.jsx)(P,{taskId:e,path:t.path,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Open the whole file`}),r]})}function X({taskId:e,nodes:t,nested:n,openings:r,now:i}){let{isOpen:a,toggle:o,shown:s,toggleFile:c}=r;return(0,G.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,G.jsxs)(`li`,{children:[(0,G.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,G.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,G.jsxs)(`span`,{className:`min-w-0 truncate text-fg-primary`,children:[t.name,`/`]}),(0,G.jsx)(`span`,{className:`shrink-0 text-meta`,children:t.files===1?`1 file`:`${t.files} files`}),(0,G.jsx)(q,{last:t.lastChange,now:i})]}),n?(0,G.jsx)(X,{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,G.jsxs)(`li`,{children:[(0,G.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,G.jsx)(`span`,{"aria-hidden":`true`,className:`w-2.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate ${u}`,children:t.name}),(0,G.jsx)(`span`,{className:`shrink-0 text-meta`,children:M(n)}),(0,G.jsx)(q,{last:n.lastChange,now:i})]}),l?(0,G.jsx)(Y,{taskId:e,change:n}):null]},n.path)})})}function Z({taskId:e,changes:t,now:n}){let r=(0,W.useMemo)(()=>F(t),[t]),i=(0,W.useMemo)(()=>L(r),[r]),[a,o]=(0,W.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,W.useState)(new Set);return(0,G.jsx)(X,{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 Q({task:e,now:t}){let n=r(e.id),i=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,G.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,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`mt-2 text-meta`,children:[i===1?`1 file`:`${i} files`,` changed · newest commit by `,s.author,` `,f(s.at,t)]}),(0,G.jsx)(Z,{taskId:e.id,changes:r,now:t}),i>r.length?(0,G.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 c&&n.error.status===404)o=(0,G.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 c&&n.error.status===503){let t=i.data?.find(t=>t.slug===e.project);o=(0,G.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,G.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the task's branch…`}):(0,G.jsx)(`p`,{className:`mt-2 text-meta`,children:n.error.message});return(0,G.jsxs)(`section`,{"aria-label":`Files`,className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Files`}),(0,G.jsx)(P,{taskId:e.id,path:``,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Browse the branch`})]}),o]})}function $({stage:e,index:t,task:n,members:r,now:i}){let a=e.completedBy!==void 0,o=S(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,G.jsxs)(`li`,{className:`relative flex gap-3 pb-4`,children:[s?null:(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-6 bottom-0 left-2.5 w-px bg-line`}),(0,G.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,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`text-sm ${o?`font-medium text-fg-primary`:`text-fg-secondary`}`,children:[e.name,e.gate?(0,G.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,G.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[`for `,C(e),c===void 0?null:(0,G.jsxs)(G.Fragment,{children:[` · held by `,(0,G.jsx)(A,{name:c,members:r})]}),e.completedBy!==void 0&&e.completedAt!==void 0?` · done by ${e.completedBy} ${f(e.completedAt,i)}`:o&&n.status===`open`?` · waiting since ${f(n.stageSince,i)}`:``,l.length>0?` · held before by ${l.join(`, `)}`:``,u===void 0?``:` · sent back by ${u.by} ${f(u.at,i)}`]})]})]})}function te(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 ne({task:t,stage:n}){let{api:r}=e(),i=o(),[a,s]=(0,W.useState)(``),c=t.stages.findIndex(e=>e.id===n.id),l=t.stages[c+1],u=g({mutationFn:()=>r.advanceTask({task_id:t.id,...a.trim()===``?{}:{note:a.trim()}}),onSuccess:async()=>{s(``),await i.invalidateQueries({queryKey:[`task`,t.id]}),await i.invalidateQueries({queryKey:[`tasks`]})}});return(0,G.jsxs)(`form`,{"aria-label":`Approve ${n.name}`,className:`mt-1 mb-4 space-y-2 rounded-lg bg-surface-2/40 p-3`,onSubmit:e=>{e.preventDefault(),u.mutate()},children:[(0,G.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[n.name,` waits on you.`,` `,l===void 0?te(t):`Approving moves the task on to ${l.name}.`]}),(0,G.jsx)(`textarea`,{value:a,rows:2,"aria-label":`Note for the task's thread`,placeholder:`A note for the thread, if any`,onChange:e=>s(e.target.value),className:R}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(_,{variant:`primary`,type:`submit`,disabled:u.isPending,children:u.isPending?`Approving…`:`Approve`})}),(0,G.jsx)(z,{error:u.error})]})}function re({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(`
1
+ import{A as e,B as t,F as n,Gn as r,I as i,Jn as a,K as o,L as s,Un as c,V as l,Wn as u,Yt as d,_ as f,b as p,t as m,x as h}from"./format-CvfmDNoY.js";import{n as g,t as _}from"./Button-BYJGqZ3Q.js";import{a as v,c as y,l as b,n as x,o as S,r as C,s as w,t as T}from"./tasks-CTaxXtGL.js";import{u as E}from"./governance-Bba0OHvJ.js";import{A as D,_ as O,i as k,o as A,s as j}from"./index-DD3J11PT.js";import{t as M}from"./BackLink-DKMw_rHu.js";import{a as N,f as P,n as F,s as I,t as L,u as R}from"./Markdown--whKJBYV.js";import{n as z,r as B}from"./ThreadForms-DzoRDeBh.js";import{n as V,t as H}from"./Pane-DTmByqgA.js";import{t as ee}from"./StickyList-C4fC_KJv.js";import{t as U}from"./SubjectThread-BEXt-tub.js";var W=a(r(),1),G=u(),K={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 q({last:e,now:t}){return e===void 0?null:(0,G.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-meta`,children:[e.author,` `,m(e.at,t)]})}function J({taskId:e,path:t,patch:n}){let r=(0,W.useMemo)(()=>P(n),[n]);return(0,G.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,G.jsxs)(`div`,{className:`flex ${K[n.kind]}`,children:[(0,G.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,G.jsx)(d,{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,G.jsx)(`span`,{className:`min-w-0 flex-1 pr-2 break-words whitespace-pre-wrap`,children:n.text===``?` `:n.text})]},r))})}function Y({taskId:e,change:t}){let n=s(e,t.path),r;if(n.data!==void 0){let{patch:i,truncated:a}=n.data;r=i===null?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown here.`}):i===``?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`No lines changed.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(J,{taskId:e,path:t.path,patch:i}),a?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}else r=n.error instanceof o&&n.error.status===503?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`The task's runner is not connected, so the change cannot be read now.`}):n.error===null?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`Reading the change…`}):(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:n.error.message});return(0,G.jsxs)(`div`,{className:`mb-2 ml-[18px]`,children:[t.status===`deleted`?null:(0,G.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`}),r]})}function X({taskId:e,nodes:t,nested:n,openings:r,now:i}){let{isOpen:a,toggle:o,shown:s,toggleFile:c}=r;return(0,G.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,G.jsxs)(`li`,{children:[(0,G.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,G.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,G.jsxs)(`span`,{className:`min-w-0 truncate text-fg-primary`,children:[t.name,`/`]}),(0,G.jsx)(`span`,{className:`shrink-0 text-meta`,children:t.files===1?`1 file`:`${t.files} files`}),(0,G.jsx)(q,{last:t.lastChange,now:i})]}),n?(0,G.jsx)(X,{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,G.jsxs)(`li`,{children:[(0,G.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,G.jsx)(`span`,{"aria-hidden":`true`,className:`w-2.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate ${u}`,children:t.name}),(0,G.jsx)(`span`,{className:`shrink-0 text-meta`,children:N(n)}),(0,G.jsx)(q,{last:n.lastChange,now:i})]}),l?(0,G.jsx)(Y,{taskId:e,change:n}):null]},n.path)})})}function Z({taskId:e,changes:t,now:n}){let r=(0,W.useMemo)(()=>I(t),[t]),i=(0,W.useMemo)(()=>R(r),[r]),[a,o]=(0,W.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,W.useState)(new Set);return(0,G.jsx)(X,{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 Q({task:e,now:t}){let n=i(e.id),r=h(),a=`task/${e.id}`,s;if(n.data!==void 0){let{files:r,total:i,head:o}=n.data;s=r.length===0?(0,G.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,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`mt-2 text-meta`,children:[i===1?`1 file`:`${i} files`,` changed · newest commit by `,o.author,` `,m(o.at,t)]}),(0,G.jsx)(Z,{taskId:e.id,changes:r,now:t}),i>r.length?(0,G.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 o&&n.error.status===404)s=(0,G.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 o&&n.error.status===503){let t=r.data?.find(t=>t.slug===e.project);s=(0,G.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 s=n.error===null?(0,G.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the task's branch…`}):(0,G.jsx)(`p`,{className:`mt-2 text-meta`,children:n.error.message});return(0,G.jsxs)(`section`,{"aria-label":`Files`,className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Files`}),(0,G.jsx)(F,{taskId:e.id,path:``,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Browse the branch`})]}),s]})}function $({stage:e,index:t,task:n,members:r,now:i}){let a=e.completedBy!==void 0,o=S(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,G.jsxs)(`li`,{className:`relative flex gap-3 pb-4`,children:[s?null:(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-6 bottom-0 left-2.5 w-px bg-line`}),(0,G.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,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`text-sm ${o?`font-medium text-fg-primary`:`text-fg-secondary`}`,children:[e.name,e.gate?(0,G.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,G.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[`for `,C(e),c===void 0?null:(0,G.jsxs)(G.Fragment,{children:[` · held by `,(0,G.jsx)(A,{name:c,members:r})]}),e.completedBy!==void 0&&e.completedAt!==void 0?` · done by ${e.completedBy} ${m(e.completedAt,i)}`:o&&n.status===`open`?` · waiting since ${m(n.stageSince,i)}`:``,l.length>0?` · held before by ${l.join(`, `)}`:``,u===void 0?``:` · sent back by ${u.by} ${m(u.at,i)}`]})]})]})}function te(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 ne({task:t,stage:n}){let{api:r}=e(),i=c(),[a,o]=(0,W.useState)(``),s=t.stages.findIndex(e=>e.id===n.id),l=t.stages[s+1],u=g({mutationFn:()=>r.advanceTask({task_id:t.id,...a.trim()===``?{}:{note:a.trim()}}),onSuccess:async()=>{o(``),await i.invalidateQueries({queryKey:[`task`,t.id]}),await i.invalidateQueries({queryKey:[`tasks`]})}});return(0,G.jsxs)(`form`,{"aria-label":`Approve ${n.name}`,className:`mt-1 mb-4 space-y-2 rounded-lg bg-surface-2/40 p-3`,onSubmit:e=>{e.preventDefault(),u.mutate()},children:[(0,G.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[n.name,` waits on you.`,` `,l===void 0?te(t):`Approving moves the task on to ${l.name}.`]}),(0,G.jsx)(`textarea`,{value:a,rows:2,"aria-label":`Note for the task's thread`,placeholder:`A note for the thread, if any`,onChange:e=>o(e.target.value),className:z}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(_,{variant:`primary`,type:`submit`,disabled:u.isPending,children:u.isPending?`Approving…`:`Approve`})}),(0,G.jsx)(B,{error:u.error})]})}function re({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
2
 
3
- `);return(0,G.jsxs)(`section`,{"aria-label":`Pull request`,className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Pull request`}),(0,G.jsxs)(`p`,{className:`mt-2 text-sm`,children:[(0,G.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,G.jsxs)(`span`,{className:`text-meta`,children:[` `,`· linked by `,n.linkedBy,` `,f(n.linkedAt,t)]})]}),e.status===`abandoned`&&e.onDone===`ghpr`?(0,G.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,G.jsxs)(`span`,{className:`text-meta`,children:[` · `,f(n.closed.at,t)]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`mt-3 text-caps text-fg-muted`,children:`Merges as`}),(0,G.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 ie({taskId:t}){let{api:n}=e(),r=o(),i=g({mutationFn:()=>n.openThread({task_id:t}),onSuccess:()=>{r.invalidateQueries({queryKey:[`threads`]})}});return(0,G.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,G.jsx)(_,{variant:`primary`,disabled:i.isPending,onClick:()=>i.mutate(),children:i.isPending?`Opening…`:`Open its thread`}),(0,G.jsx)(`p`,{className:`text-meta`,children:i.error===null?`This task is older than task threads. It closes when the task ends.`:i.error.message})]})}function ae(){let{taskId:e}=D({from:`/task/$taskId`}),n=a(e),r=t(),i=p(),o=u(),s=d(3e4),h=j(),g=m(r.data?.some(t=>t.id===e)===!0?e:null);if(n.data===void 0)return(0,G.jsx)(B,{children:n.error instanceof c&&n.error.status===404?`There is no task ${e}.`:`Reading the task…`});let _=n.data,S=w(_),C=E(_),A=i.data?.find(e=>e.slug===_.project),M=r.data?.find(e=>e.id===_.id);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(V,{leading:(0,G.jsx)(ee,{fallback:(0,G.jsx)(l,{to:`/p/$slug/tasks`,params:{slug:_.project},"aria-label":`Back to the tasks of ${A?.name??_.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:_.title,subtitle:`${A?.name??_.project}${_.channel===`general`?``:` #${_.channel}`} · ${y(_)} · created by ${h(_.createdBy)} ${f(_.createdAt,s)}`,trailing:(0,G.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${x[S]}`,children:T.find(e=>e.phase===S)?.label.toLowerCase()})}),(0,G.jsxs)(H,{stick:!1,follow:!1,ids:g.data?.messages.map(e=>e.id),className:`px-4 py-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Plan`}),_.returned===void 0?null:(0,G.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 `,b(_,_.returned.from),` by `,_.returned.by,` `,f(_.returned.at,s),`. The work is redone from`,` `,b(_,_.stage),` until it reaches that stage again.`]}),(0,G.jsx)(`ol`,{className:`mt-3`,children:_.stages.map((e,t)=>(0,G.jsx)($,{stage:e,index:t,task:_,members:o.data,now:s},e.id))}),C===null?null:(0,G.jsx)(ne,{task:_,stage:C}),(0,G.jsxs)(`p`,{className:`text-meta`,children:[`When the last stage is done:`,` `,_.onDone===`merge`?`task/${_.id} merges onto the default branch`:_.onDone===`ghpr`?_.pullRequest===void 0?`its pull request merges on GitHub, once one is linked`:`pull request #${_.pullRequest.number} merges on GitHub`:`nothing more`,_.blockedBy.length>0?(0,G.jsxs)(G.Fragment,{children:[` · blocked by `,(0,G.jsx)(O,{text:_.blockedBy.join(`, `)})]}):null]}),_.body.trim()===``?null:(0,G.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Brief`}),(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(I,{text:_.body})})]}),(0,G.jsx)(re,{task:_,now:s}),(0,G.jsx)(Q,{task:_,now:s}),(0,G.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Thread`}),r.data===void 0?null:M===void 0?v(_)?(0,G.jsx)(ie,{taskId:_.id}):(0,G.jsx)(`p`,{className:`mt-2 text-meta`,children:`No thread on this task.`}):(0,G.jsx)(U,{thread:M,now:s,task:_,empty:`Nothing said yet. Each stage's handover lands here, and so does anything written below.`})]})]},_.id),M?.state===`open`?(0,G.jsx)(k,{target:{threadId:_.id},placeholder:`Write in the task's thread`}):null]})}export{ae as TaskView};
3
+ `);return(0,G.jsxs)(`section`,{"aria-label":`Pull request`,className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Pull request`}),(0,G.jsxs)(`p`,{className:`mt-2 text-sm`,children:[(0,G.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,G.jsxs)(`span`,{className:`text-meta`,children:[` `,`· linked by `,n.linkedBy,` `,m(n.linkedAt,t)]})]}),e.status===`abandoned`&&e.onDone===`ghpr`?(0,G.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,G.jsxs)(`span`,{className:`text-meta`,children:[` · `,m(n.closed.at,t)]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`mt-3 text-caps text-fg-muted`,children:`Merges as`}),(0,G.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 ie({taskId:t}){let{api:n}=e(),r=c(),i=g({mutationFn:()=>n.openThread({task_id:t}),onSuccess:()=>{r.invalidateQueries({queryKey:[`threads`]})}});return(0,G.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,G.jsx)(_,{variant:`primary`,disabled:i.isPending,onClick:()=>i.mutate(),children:i.isPending?`Opening…`:`Open its thread`}),(0,G.jsx)(`p`,{className:`text-meta`,children:i.error===null?`This task is older than task threads. It closes when the task ends.`:i.error.message})]})}function ae(){let{taskId:e}=D({from:`/task/$taskId`}),r=n(e),i=l(),a=h(),s=f(),c=p(3e4),u=j(),g=t(i.data?.some(t=>t.id===e)===!0?e:null);if(r.data===void 0)return(0,G.jsx)(V,{children:r.error instanceof o&&r.error.status===404?`There is no task ${e}.`:`Reading the task…`});let _=r.data,S=w(_),C=E(_),A=a.data?.find(e=>e.slug===_.project),N=i.data?.find(e=>e.id===_.id);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(H,{leading:(0,G.jsx)(M,{fallback:(0,G.jsx)(d,{to:`/p/$slug/tasks`,params:{slug:_.project},"aria-label":`Back to the tasks of ${A?.name??_.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:_.title,subtitle:`${A?.name??_.project}${_.channel===`general`?``:` #${_.channel}`} · ${y(_)} · created by ${u(_.createdBy)} ${m(_.createdAt,c)}`,trailing:(0,G.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${x[S]}`,children:T.find(e=>e.phase===S)?.label.toLowerCase()})}),(0,G.jsxs)(ee,{stick:!1,follow:!1,ids:g.data?.messages.map(e=>e.id),className:`px-4 py-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Plan`}),_.returned===void 0?null:(0,G.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 `,b(_,_.returned.from),` by `,_.returned.by,` `,m(_.returned.at,c),`. The work is redone from`,` `,b(_,_.stage),` until it reaches that stage again.`]}),(0,G.jsx)(`ol`,{className:`mt-3`,children:_.stages.map((e,t)=>(0,G.jsx)($,{stage:e,index:t,task:_,members:s.data,now:c},e.id))}),C===null?null:(0,G.jsx)(ne,{task:_,stage:C}),(0,G.jsxs)(`p`,{className:`text-meta`,children:[`When the last stage is done:`,` `,_.onDone===`merge`?`task/${_.id} merges onto the default branch`:_.onDone===`ghpr`?_.pullRequest===void 0?`its pull request merges on GitHub, once one is linked`:`pull request #${_.pullRequest.number} merges on GitHub`:`nothing more`,_.blockedBy.length>0?(0,G.jsxs)(G.Fragment,{children:[` · blocked by `,(0,G.jsx)(O,{text:_.blockedBy.join(`, `)})]}):null]}),_.body.trim()===``?null:(0,G.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Brief`}),(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(L,{text:_.body})})]}),(0,G.jsx)(re,{task:_,now:c}),(0,G.jsx)(Q,{task:_,now:c}),(0,G.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Thread`}),i.data===void 0?null:N===void 0?v(_)?(0,G.jsx)(ie,{taskId:_.id}):(0,G.jsx)(`p`,{className:`mt-2 text-meta`,children:`No thread on this task.`}):(0,G.jsx)(U,{thread:N,now:c,task:_,empty:`Nothing said yet. Each stage's handover lands here, and so does anything written below.`})]})]},_.id),N?.state===`open`?(0,G.jsx)(k,{target:{threadId:_.id},placeholder:`Write in the task's thread`}):null]})}export{ae as TaskView};
@@ -1 +1 @@
1
- import{Bn as e,R as t,Un as n,Wt as r,_ as i,b as a,gt as o,t as s,x as c,zn as l}from"./format-B6fjC0_a.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-DCUj5w_d.js";import{A as _,o as v}from"./index-CyCty7a2.js";import{n as y,t as b}from"./Pane-CLjdfBMM.js";var x=n(e(),1),S=l();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 i=h(e),a=o(e);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(r,{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,` `,s(e.returned.at,n)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:e.status===`claimed`&&i!==`landing`&&a!==void 0?(0,S.jsxs)(S.Fragment,{children:[a.name,` · held by `,(0,S.jsx)(v,{name:e.claimedBy??``,members:t})]}):e.status===`open`&&i!==`landing`&&a!==void 0?`${a.name} · waiting for ${m(a)} since ${s(e.stageSince,n)}`:i===`landing`?`landing task/${e.id} on the default branch`:`${i} ${s(e.updatedAt,n)}`})]})})}function E(){let{slug:e}=_({from:`/p/$slug/tasks`}),n=t(e),r=c(),o=i(),s=a(3e4),[l,u]=(0,x.useState)(new Set),f=r.data?.find(t=>t.slug===e),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??e} · ${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: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};
1
+ import{Gn as e,Jn as t,Wn as n,Yt as r,_ as i,b as a,bt as o,t as s,x as c,z as l}from"./format-CvfmDNoY.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-CTaxXtGL.js";import{A as _,o as v}from"./index-DD3J11PT.js";import{n as y,t as b}from"./Pane-DTmByqgA.js";var x=t(e(),1),S=n();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 i=h(e),a=o(e);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(r,{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,` `,s(e.returned.at,n)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:e.status===`claimed`&&i!==`landing`&&a!==void 0?(0,S.jsxs)(S.Fragment,{children:[a.name,` · held by `,(0,S.jsx)(v,{name:e.claimedBy??``,members:t})]}):e.status===`open`&&i!==`landing`&&a!==void 0?`${a.name} · waiting for ${m(a)} since ${s(e.stageSince,n)}`:i===`landing`?`landing task/${e.id} on the default branch`:`${i} ${s(e.updatedAt,n)}`})]})})}function E(){let{slug:e}=_({from:`/p/$slug/tasks`}),t=l(e),n=c(),r=i(),o=a(3e4),[s,u]=(0,x.useState)(new Set),f=n.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`||s.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:r.data,now:o},e.id))}),t.length<e.tasks.length?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>u(new Set([...s,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 +1 @@
1
- import{A as e,Bn as t,E as n,Rn as r,Un as i,W as a,_ as o,zn as s}from"./format-B6fjC0_a.js";import{n as c,t as l}from"./Button-Yoe21NQ2.js";import{i as u,n as d}from"./compose-DNc3_c5x.js";import{n as f}from"./mentions-B2Qchd_6.js";var p=i(t(),1);function m(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=f(e).filter(e=>r.some(t=>t.name===e));return[...new Set([...i,...a])]}var h=s(),g=`block h-7 w-full rounded-md bg-surface-2/60 px-2.5 text-xs text-fg-primary outline-none placeholder:text-fg-muted focus-visible:ring-2 focus-visible:ring-fg-primary/30`,_=`block w-full resize-none rounded-md bg-surface-2/60 px-2.5 py-1.5 text-xs leading-relaxed text-fg-primary outline-none placeholder:text-fg-muted focus-visible:ring-2 focus-visible:ring-fg-primary/30`,v=`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 y({error:e}){return e===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-xs text-red-400`,children:e instanceof a?e.message:`The board did not take it.`})}function b({channel:t,onDone:i}){let{api:a}=e(),s=r(),f=u(),g=o(),_=n(),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null);(0,p.useEffect)(()=>w.current?.focus(),[]);let T=S.trim(),E=c({mutationFn:async()=>{let e=await a.openThread({channel:t,title:b.trim()});return T!==``&&await a.sendMessage({thread_id:e.id,body:T}),e},onSuccess:e=>{s.invalidateQueries({queryKey:[`threads`]}),i(),f({to:`/thread/$threadId`,params:{threadId:e.id}})}}),D=T===``?[]:m(T,g.data??[],_.data??[]);return(0,h.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),E.mutate()},children:[(0,h.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:v}),(0,h.jsx)(`textarea`,{value:S,rows:3,placeholder:`First message, optional`,"aria-label":`First message`,onChange:e=>C(e.target.value),className:`${v} resize-none`}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:D.length>0?`The first message wakes ${d(D)}.`:`Only its participants and anyone mentioned will read it.`}),(0,h.jsx)(l,{onClick:i,children:`Cancel`}),(0,h.jsx)(l,{variant:`primary`,type:`submit`,disabled:b.trim()===``||E.isPending,children:E.isPending?`Opening…`:`Open thread`})]}),(0,h.jsx)(y,{error:E.error})]})}function x({threadId:t,channel:n,onDone:i}){let{api:a}=e(),o=r(),[s,u]=(0,p.useState)(``),d=(0,p.useRef)(null);(0,p.useEffect)(()=>d.current?.focus(),[]);let f=c({mutationFn:()=>a.closeThread({thread_id:t,summary:s.trim()}),onSuccess:()=>{for(let e of[[`thread`,t],[`threads`],[`channel`,n]])o.invalidateQueries({queryKey:e});i()}});return(0,h.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),f.mutate()},children:[(0,h.jsx)(`textarea`,{ref:d,value:s,rows:3,placeholder:`What did it settle? The summary is posted to #${n}.`,"aria-label":`Closing summary`,onChange:e=>u(e.target.value),className:`${v} resize-none`}),(0,h.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,h.jsx)(l,{onClick:i,children:`Cancel`}),(0,h.jsx)(l,{variant:`primary`,type:`submit`,disabled:s.trim()===``||f.isPending,children:f.isPending?`Closing…`:`Close thread`})]}),(0,h.jsx)(y,{error:f.error})]})}export{_ as a,b as i,v as n,g as o,y as r,x as t};
1
+ import{A as e,E as t,Gn as n,Jn as r,K as i,Un as a,Wn as o,_ as s}from"./format-CvfmDNoY.js";import{n as c,t as l}from"./Button-BYJGqZ3Q.js";import{i as u,n as d}from"./compose-BUhbVoI-.js";import{n as f}from"./mentions-D838wlfQ.js";var p=r(n(),1);function m(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=f(e).filter(e=>r.some(t=>t.name===e));return[...new Set([...i,...a])]}var h=o(),g=`block h-7 w-full rounded-md bg-surface-2/60 px-2.5 text-xs text-fg-primary outline-none placeholder:text-fg-muted focus-visible:ring-2 focus-visible:ring-fg-primary/30`,_=`block w-full resize-none rounded-md bg-surface-2/60 px-2.5 py-1.5 text-xs leading-relaxed text-fg-primary outline-none placeholder:text-fg-muted focus-visible:ring-2 focus-visible:ring-fg-primary/30`,v=`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 y({error:e}){return e===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`text-xs text-red-400`,children:e instanceof i?e.message:`The board did not take it.`})}function b({channel:n,onDone:r}){let{api:i}=e(),o=a(),f=u(),g=s(),_=t(),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null);(0,p.useEffect)(()=>w.current?.focus(),[]);let T=S.trim(),E=c({mutationFn:async()=>{let e=await i.openThread({channel:n,title:b.trim()});return T!==``&&await i.sendMessage({thread_id:e.id,body:T}),e},onSuccess:e=>{o.invalidateQueries({queryKey:[`threads`]}),r(),f({to:`/thread/$threadId`,params:{threadId:e.id}})}}),D=T===``?[]:m(T,g.data??[],_.data??[]);return(0,h.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),E.mutate()},children:[(0,h.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:v}),(0,h.jsx)(`textarea`,{value:S,rows:3,placeholder:`First message, optional`,"aria-label":`First message`,onChange:e=>C(e.target.value),className:`${v} resize-none`}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:D.length>0?`The first message wakes ${d(D)}.`:`Only its participants and anyone mentioned will read it.`}),(0,h.jsx)(l,{onClick:r,children:`Cancel`}),(0,h.jsx)(l,{variant:`primary`,type:`submit`,disabled:b.trim()===``||E.isPending,children:E.isPending?`Opening…`:`Open thread`})]}),(0,h.jsx)(y,{error:E.error})]})}function x({threadId:t,channel:n,onDone:r}){let{api:i}=e(),o=a(),[s,u]=(0,p.useState)(``),d=(0,p.useRef)(null);(0,p.useEffect)(()=>d.current?.focus(),[]);let f=c({mutationFn:()=>i.closeThread({thread_id:t,summary:s.trim()}),onSuccess:()=>{for(let e of[[`thread`,t],[`threads`],[`channel`,n]])o.invalidateQueries({queryKey:e});r()}});return(0,h.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),f.mutate()},children:[(0,h.jsx)(`textarea`,{ref:d,value:s,rows:3,placeholder:`What did it settle? The summary is posted to #${n}.`,"aria-label":`Closing summary`,onChange:e=>u(e.target.value),className:`${v} resize-none`}),(0,h.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,h.jsx)(l,{onClick:r,children:`Cancel`}),(0,h.jsx)(l,{variant:`primary`,type:`submit`,disabled:s.trim()===``||f.isPending,children:f.isPending?`Closing…`:`Close thread`})]}),(0,h.jsx)(y,{error:f.error})]})}export{_ as a,b as i,v as n,g as o,y as r,x as t};
@@ -0,0 +1 @@
1
+ import{Wn as e,Yt as t,n,t as r}from"./format-CvfmDNoY.js";import{_ as i,s as a}from"./index-DD3J11PT.js";var o=e();function s(e){return e?.kind??`topic`}function c({state:e}){return(0,o.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 l(){return(0,o.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`size-3.5`,children:(0,o.jsx)(`path`,{d:`M4 2.5v6A2.5 2.5 0 0 0 6.5 11H13m-3-3 3 3-3 3`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function u({thread:e,now:c}){let u=a(),d=e.state===`open`,f=d?``:n(e.body,180),p=d?void 0:e.closedAt,m=p??e.openedAt;return(0,o.jsxs)(t,{to:`/thread/$threadId`,params:{threadId:e.id},className:`group flex gap-3 px-4 py-1`,children:[(0,o.jsx)(`span`,{title:e.state,className:`grid h-5 w-7 shrink-0 place-items-center ${d?`text-emerald-400 group-hover:text-emerald-300`:`text-fg-muted group-hover:text-fg-tertiary`}`,children:(0,o.jsx)(l,{})}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,o.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-sm text-fg-tertiary`,children:[u(e.openedBy),` opened `,s(e.subject),` thread`,` `,(0,o.jsx)(`span`,{className:`text-fg-secondary group-hover:text-fg-primary`,children:e.title}),(0,o.jsxs)(`span`,{className:`sr-only`,children:[`, `,e.state]})]}),(0,o.jsx)(`time`,{dateTime:m,title:`${p===void 0?`opened`:`closed`} ${m}`,className:`shrink-0 text-meta`,children:r(m,c)})]}),f===``?null:(0,o.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:(0,o.jsx)(i,{text:f,links:!1})})]})]})}export{u as n,s as r,c as t};
@@ -0,0 +1 @@
1
+ import{A as e,Cn as t,F as n,Gn as r,Jn as i,K as a,Wn as o,Yt as s,_ as c,b as l,t as u}from"./format-CvfmDNoY.js";import{t as d}from"./Button-BYJGqZ3Q.js";import{A as f,C as p,i as m,k as h,s as g}from"./index-DD3J11PT.js";import{t as _}from"./BackLink-DKMw_rHu.js";import{t as v}from"./Markdown--whKJBYV.js";import{t as y}from"./ThreadForms-DzoRDeBh.js";import{t as b}from"./MessageItem-BvDOeJci.js";import{n as x,t as S}from"./Pane-DTmByqgA.js";import{t as C}from"./StickyList-C4fC_KJv.js";import{r as w,t as T}from"./ThreadItem-CDVppcOZ.js";var E=i(r(),1),D=o();function O(){let{threadId:e}=f({from:`/thread/$threadId`}),{message:t}=h({from:`/thread/$threadId`});return(0,D.jsx)(k,{id:e,target:t},e)}function k({id:r,target:i}){let{api:o}=e(),f=t({queryKey:[`thread`,r],queryFn:()=>o.thread(r)}),h=c(),O=l(3e4),k=g(),A=f.data?.messages??[],j=A.at(-1)?.id??null;(0,E.useEffect)(()=>p(r,j),[r,j]);let[M,N]=(0,E.useState)(!1),P=f.data?.thread.subject,F=n(P?.kind===`task`?P.id:null);if(f.data===void 0)return(0,D.jsx)(x,{children:f.error instanceof a&&f.error.status===404?`There is no thread ${r}.`:`Reading the thread…`});let{thread:I}=f.data;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(S,{leading:(0,D.jsx)(_,{fallback:(0,D.jsx)(s,{to:`/c/$`,params:{_splat:I.channel},"aria-label":`Back to #${I.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:I.title,subtitle:`${w(I.subject)} thread in #${I.channel} · opened by ${k(I.openedBy)} ${u(I.openedAt,O)}`,trailing:(0,D.jsxs)(D.Fragment,{children:[I.subject?.kind===`task`?(0,D.jsx)(s,{to:`/task/$taskId`,params:{taskId:I.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 →`}):I.subject?.kind===`proposal`?(0,D.jsx)(s,{to:`/proposal/$proposalId`,params:{proposalId:I.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,I.state===`open`&&!M&&I.subject?.kind!==`task`?(0,D.jsx)(d,{onClick:()=>N(!0),children:`Close`}):(0,D.jsx)(T,{state:I.state})]})}),M&&I.state===`open`?(0,D.jsx)(y,{threadId:I.id,channel:I.channel,onDone:()=>N(!1)}):null,(0,D.jsxs)(C,{stick:i===void 0,ids:A.map(e=>e.id),className:`py-2`,children:[A.length===0?(0,D.jsx)(x,{children:`No messages in this thread yet.`}):null,A.map(e=>(0,D.jsx)(b,{message:e,members:h.data,now:O,task:F.data,target:e.id===i},e.id)),I.state===`closed`?(0,D.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,D.jsxs)(`p`,{className:`text-caps`,children:[`Closed by `,k(I.closedBy??`board`),I.closedAt===void 0?``:` ${u(I.closedAt,O)}`]}),I.body.trim()===``?(0,D.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`It ended with its `,w(I.subject),`.`]}):(0,D.jsx)(v,{text:I.body})]}):null]}),I.state===`open`?(0,D.jsx)(m,{target:{threadId:I.id},placeholder:`Reply in the thread`}):null]})}export{O as ThreadView};
@@ -0,0 +1 @@
1
+ import{_t as e,st as t}from"./format-CvfmDNoY.js";import{l as n}from"./index-DD3J11PT.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{input:`${u.format(f(e))} in`,output:`${u.format(e.outputTokens)} out`}}function m(e){let{input:t,output:n}=p(e);return`${t} · ${n}`}function h(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 g(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}}var _={"24h":`in the last 24 hours`,"7d":`in the last 7 days`,all:`in all`};function v(e){return e===1?`1 finished turn`:`${e} finished turns`}function y(e,t){let n=_[t];if(e===void 0||e.turns===0)return{label:`no turns`,counts:null,detail:`no finished turn ${n}`,spoken:null};let r=e.turns-e.withUsage,i=`logged before turns counted tokens, or ended without their runner's report`;if(e.usage===null)return{label:`tokens unknown`,counts:null,detail:`${v(e.turns)} ${n}, none with a token count: ${i}`,spoken:`${v(e.turns)} ${n}, none counted`};let a={label:m(e.usage),counts:p(e.usage)};if(r===0)return{...a,detail:`${h(e.usage)}; over ${v(e.turns)} ${n}`,spoken:null};let o=`over ${e.withUsage} of ${v(e.turns)} ${n}`;return{...a,detail:[`${h(e.usage)}; ${o}.`,`The other ${r===1?`one has`:`${r} have`} no count: ${i}.`].join(` `),spoken:o}}function b(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 x(e,t){return[...new Set([e.homeRunner,...e.memberships.map(e=>t.get(e))].filter(e=>e!==void 0))]}function S(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=x(e,t),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,m as c,i as d,b as f,a as i,o as l,g as n,y as o,S as r,h as s,c as t,x as u};
@@ -1 +1 @@
1
- import{Bn as e,Kt as t,Un as n}from"./format-B6fjC0_a.js";var r=n(e(),1);function i(e){let n=t();return r.useCallback(t=>n.navigate({...t,from:t.from??e?.from}),[e?.from,n])}function a(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 o(e,t,n,r){let i=`@${r} `;return{text:e.slice(0,n)+i+e.slice(t),caret:n+i.length}}var s=new Intl.ListFormat(`en`,{type:`conjunction`});function c(e){return s.format(e)}export{i,c as n,a as r,o as t};
1
+ import{Gn as e,Jn as t,Zt as n}from"./format-CvfmDNoY.js";var r=t(e(),1);function i(e){let t=n();return r.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function a(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 o(e,t,n,r){let i=`@${r} `;return{text:e.slice(0,n)+i+e.slice(t),caret:n+i.length}}var s=new Intl.ListFormat(`en`,{type:`conjunction`});function c(e){return s.format(e)}export{i,c as n,a as r,o as t};