@kubitnodes/stellaris 0.3.25 → 0.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +340 -131
- package/dist/server/index.js +818 -178
- package/package.json +1 -1
- package/web/dist/assets/{BackLink-UTiLF1J4.js → BackLink-qSxOMeEG.js} +1 -1
- package/web/dist/assets/{Button-Cp4cNRUX.js → Button-CxjWy598.js} +1 -1
- package/web/dist/assets/{ChannelForms-DD2B0tey.js → ChannelForms-BVidWMId.js} +1 -1
- package/web/dist/assets/{ChannelView-CY3oG9hZ.js → ChannelView-rqfk1Tyu.js} +1 -1
- package/web/dist/assets/{CitizenView-BNK5ro-6.js → CitizenView-xU99R8hS.js} +1 -1
- package/web/dist/assets/{CitizensView-WPQ6Jhl3.js → CitizensView-Bgw6PRSo.js} +1 -1
- package/web/dist/assets/{CliIcon-C7bwChMP.js → CliIcon-BB2NdLxN.js} +1 -1
- package/web/dist/assets/{CronsView-_pdgwX1I.js → CronsView-BrXrcfC6.js} +1 -1
- package/web/dist/assets/{FileTree-jyDUSu7g.js → FileTree-CHDmrOhY.js} +1 -1
- package/web/dist/assets/{FileView-DcQvlc8V.js → FileView-DUMfKYRW.js} +1 -1
- package/web/dist/assets/{KnowledgeView-DDl0HQPG.js → KnowledgeView-Qog6c92V.js} +1 -1
- package/web/dist/assets/{Markdown-DT3V-EVe.js → Markdown-C7RbUEZE.js} +1 -1
- package/web/dist/assets/{MessageItem-agtEugfG.js → MessageItem-DgWh5pJF.js} +1 -1
- package/web/dist/assets/{MetricsView-DiXyYeWP.js → MetricsView-DuOyISk1.js} +1 -1
- package/web/dist/assets/{NeedsYouView-CKmuYan_.js → NeedsYouView-CrmHXZAn.js} +1 -1
- package/web/dist/assets/{Overview-CKcTqsMM.js → Overview-xatORJK6.js} +1 -1
- package/web/dist/assets/{Pane-BaM0TdE6.js → Pane-BlIRwUtQ.js} +1 -1
- package/web/dist/assets/{Picker-C2ig-0dT.js → Picker-BSOB2JM_.js} +1 -1
- package/web/dist/assets/ProjectView-CVt28SoI.js +1 -0
- package/web/dist/assets/{ProposalView-B5yjTAcn.js → ProposalView-DJ0aJm7J.js} +1 -1
- package/web/dist/assets/{ProposalsView-p4KjwV9p.js → ProposalsView-C0r1ya8_.js} +1 -1
- package/web/dist/assets/{Quota-CfFGIql9.js → Quota-59QJZrPa.js} +1 -1
- package/web/dist/assets/{RunnersView-DdvwoOur.js → RunnersView-CcAAfw6y.js} +1 -1
- package/web/dist/assets/{SkillFileList-CgrCnuaC.js → SkillFileList-Cs_f3RPo.js} +1 -1
- package/web/dist/assets/{SkillView-Di5Z9h2L.js → SkillView-BvVx3LSL.js} +1 -1
- package/web/dist/assets/{SocietyView-BDiVxUC5.js → SocietyView-CJRrypjI.js} +1 -1
- package/web/dist/assets/{StickyList-BaV_KZ8x.js → StickyList-BbGq82Jj.js} +1 -1
- package/web/dist/assets/{SubjectThread-DD_ZCCnr.js → SubjectThread-DdkyhVqK.js} +1 -1
- package/web/dist/assets/{TaskView-CKcs-MOC.js → TaskView-CyEWpCvS.js} +1 -1
- package/web/dist/assets/{TasksView-oZMjncOU.js → TasksView-D10XP1uk.js} +1 -1
- package/web/dist/assets/{ThreadForms-CG5Y926b.js → ThreadForms-D94Jj0ES.js} +1 -1
- package/web/dist/assets/{ThreadItem-D-n2arFA.js → ThreadItem-CYmdCPOf.js} +1 -1
- package/web/dist/assets/{ThreadView-CT9vd0P4.js → ThreadView-D79G2zgF.js} +1 -1
- package/web/dist/assets/{citizen-BiHfph2A.js → citizen-CgA4vJjy.js} +1 -1
- package/web/dist/assets/{compose-DY1WL8zB.js → compose-3ksQaHF6.js} +1 -1
- package/web/dist/assets/format-DpQyO6r1.js +55 -0
- package/web/dist/assets/{governance-C6ez5MLh.js → governance-YialJVYK.js} +1 -1
- package/web/dist/assets/{index-CPXALUV6.js → index-DhuCp-VF.js} +3 -3
- package/web/dist/assets/{mentions-BEL5U6ra.js → mentions-Buc5vs-j.js} +1 -1
- package/web/dist/assets/{tasks-CAI8Eci7.js → tasks-DLTeaHys.js} +1 -1
- package/web/dist/assets/{useMatch-CINzyDWa.js → useMatch-DPEg8ohe.js} +1 -1
- package/web/dist/index.html +8 -8
- package/web/dist/assets/ProjectView-T2OHTh5j.js +0 -1
- package/web/dist/assets/format-CENiwkJC.js +0 -55
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Jt as e,Un as t,X as n,k as r,n as i,t as a}from"./format-
|
|
1
|
+
import{Jt as e,Un as t,X as n,k as r,n as i,t as a}from"./format-DpQyO6r1.js";import{t as o}from"./CliIcon-BB2NdLxN.js";import{_ as s}from"./index-DhuCp-VF.js";import{a as c}from"./citizen-CgA4vJjy.js";var l=t();function u({title:e,aside:t,children:n}){return(0,l.jsxs)(`section`,{className:`border-t border-line pt-4 first:border-t-0 first:pt-0`,children:[(0,l.jsxs)(`h3`,{className:`flex items-baseline justify-between gap-2`,children:[(0,l.jsx)(`span`,{className:`text-section`,children:e}),t]}),(0,l.jsx)(`div`,{className:`mt-2`,children:n})]})}function d({members:t,scope:i}){let a=r(),s=n(a.data?.running??[]),u=n(a.data?.pending??[]);return t.length===0?(0,l.jsx)(`p`,{className:`text-meta`,children:`Nobody yet.`}):(0,l.jsx)(`ul`,{className:`-mx-2`,children:t.map(t=>{let n=s.filter(e=>e.agent===t.name).map(e=>e.scope),r=n.includes(i),a=u.some(e=>e.agent===t.name),d=r?`in a turn here`:n.length>0?`in a turn at ${n.map(c).join(` and `)}`:a?`queued`:`resting`;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(e,{to:`/citizen/$name`,params:{name:t.name},search:r&&i!==`society`?{scope:i}:{},className:`flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-surface-2/50`,children:[(0,l.jsx)(`span`,{className:`grid size-4 shrink-0 place-items-center`,children:t.cli===null?null:(0,l.jsx)(o,{cli:t.cli,size:13})}),(0,l.jsx)(`span`,{className:`text-fg-primary`,children:t.name}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:t.role}),(0,l.jsx)(`span`,{className:`shrink-0 text-xs ${n.length>0?`text-emerald-300`:a?`text-amber-300`:`text-fg-muted`}`,children:d})]})},t.name)})})}function f({scope:t,topics:n,now:r}){return n===void 0?(0,l.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):n.length===0?(0,l.jsx)(`p`,{className:`text-meta`,children:`No knowledge yet.`}):(0,l.jsx)(`ul`,{className:`-mx-2`,children:n.toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(n=>(0,l.jsx)(`li`,{children:(0,l.jsxs)(e,{to:`/knowledge/$scope/$topic`,params:{scope:t,topic:n.topic},className:`block rounded-lg px-2 py-1.5 transition-colors hover:bg-surface-2/50`,children:[(0,l.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,l.jsx)(`span`,{className:`text-sm text-fg-primary`,children:n.topic}),(0,l.jsxs)(`span`,{className:`text-meta`,children:[`by `,n.updatedBy,` `,a(n.updatedAt,r)]})]}),(0,l.jsx)(`span`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:(0,l.jsx)(s,{text:i(n.body,240),links:!1})})]})},n.topic))})}export{u as n,f as r,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Un as e}from"./format-
|
|
1
|
+
import{Un as e}from"./format-DpQyO6r1.js";var t=e();function n({title:e,subtitle:n,leading:r,trailing:i}){return(0,t.jsxs)(`header`,{className:`flex items-center gap-3 border-b border-line px-4 py-3`,children:[r,(0,t.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,t.jsx)(`h2`,{className:`text-heading truncate`,children:e}),n===void 0?null:(0,t.jsx)(`p`,{className:`truncate text-meta`,children:n})]}),i]})}function r({children:e}){return(0,t.jsx)(`p`,{className:`px-4 py-10 text-center text-meta`,"aria-live":`polite`,children:e})}export{r as n,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Un as e,Wn as t,qn as n}from"./format-
|
|
1
|
+
import{Un as e,Wn as t,qn as n}from"./format-DpQyO6r1.js";var r=n(t(),1),i=e(),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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Hn as e,Jt as t,K as n,O as r,S as i,Un as a,Wn as o,c as s,d as c,g as l,j as u,l as d,qn as f,t as p,v as m,x as h,z as g}from"./format-DpQyO6r1.js";import{n as _,t as v}from"./Button-CxjWy598.js";import{i as y,t as b}from"./tasks-DLTeaHys.js";import{A as x}from"./index-DhuCp-VF.js";import{c as S,g as C,h as w,n as T,t as E}from"./Markdown-C7RbUEZE.js";import{n as D,r as O}from"./ThreadForms-D94Jj0ES.js";import{n as k,r as A}from"./ChannelForms-BVidWMId.js";import{n as j,t as M}from"./Pane-BlIRwUtQ.js";import{n as N}from"./Picker-BSOB2JM_.js";import{n as P,r as F,t as I}from"./Overview-xatORJK6.js";import{i as L,n as R,r as z,t as B}from"./FileTree-CHDmrOhY.js";var V=f(o(),1),H=a();function U({project:e,source:t,folder:n,nested:r,openings:i}){return(0,H.jsx)(L,{nested:r,children:S(n.entries).map(r=>{let a=n.path===``?r.name:`${n.path}/${r.name}`;if(r.kind===`dir`){let n=i.open.has(a);return(0,H.jsxs)(`li`,{children:[(0,H.jsx)(R,{name:r.name,open:n,onToggle:()=>i.toggle(a)}),n?(0,H.jsx)(W,{project:e,source:t,path:a,openings:i}):null]},`dir:${r.name}`)}return(0,H.jsx)(`li`,{children:(0,H.jsxs)(T,{source:t,path:a,className:`group ${z}`,children:[(0,H.jsx)(B,{}),(0,H.jsx)(`span`,{className:`min-w-0 truncate text-fg-secondary group-hover:text-fg-primary`,children:r.name}),r.size===null?null:(0,H.jsx)(`span`,{className:`shrink-0 text-meta whitespace-nowrap`,children:C(r.size)})]})},r.name)})})}function W({project:e,source:t,path:r,openings:i}){let a=s(t,r);if(a.data?.kind===`dir`)return(0,H.jsx)(U,{project:e,source:t,folder:a.data,nested:!0,openings:i});let o;return o=a.data?.kind===`file`||a.error instanceof n&&a.error.status===404?`Not on ${e.defaultBranch} now.`:a.error instanceof n&&a.error.status===503?`${w(e)}, is not connected.`:a.error===null?`Reading…`:a.error.message,(0,H.jsx)(L,{nested:!0,children:(0,H.jsx)(`li`,{className:`py-0.5 pl-[18px] text-meta`,children:o})})}function G({project:e,now:t}){let r={kind:`project`,slug:e.slug},i=s(r,``),a=e.defaultBranch,[o,c]=(0,V.useState)(new Set),l=e=>{c(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},u;if(i.data?.kind===`dir`){let{commit:n}=i.data;u=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`text-meta`,children:[a,` · committed by `,n.author,` `,p(n.at,t),` · `,n.id.slice(0,7)]}),i.data.entries.length===0?(0,H.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing on `,a,` yet.`]}):(0,H.jsx)(U,{project:e,source:r,folder:i.data,nested:!1,openings:{open:o,toggle:l}})]})}else u=i.error instanceof n&&i.error.status===404?(0,H.jsxs)(`p`,{className:`text-meta`,children:[`Nothing on `,a,` yet.`]}):i.error instanceof n&&i.error.status===503?(0,H.jsxs)(`p`,{className:`text-meta`,children:[w(e),`, is not connected, so the project's files cannot be listed now.`]}):i.error===null?(0,H.jsxs)(`p`,{className:`text-meta`,children:[`Reading `,a,`…`]}):(0,H.jsx)(`p`,{className:`text-meta`,children:i.error.message});return(0,H.jsx)(P,{title:`Files`,aside:(0,H.jsx)(T,{source:r,path:``,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Browse the branch`}),children:u})}function K(e,t,n){let r=n.filter(n=>n.status===`active`&&t.members.includes(n.name)&&n.cli!==null&&!e.clis.includes(n.cli)).map(e=>`has no ${e.cli} for ${e.name}`);for(let n of t.requiredCapabilities)e.capabilities.includes(n)||r.push(`lacks ${n}`);return r}function q(e,t,n){return e.map(e=>({value:e.name,name:e.name,id:e.os,description:[e.name===t.runner?`here now`:``,e.status,e.clis.length===0?`offers no CLI yet`:e.clis.join(`, `),e.capabilities.join(`, `),...K(e,t,n)].filter(e=>e!==``).join(` · `)}))}function J({project:t,onDone:i}){let{api:a}=u(),o=e(),s=r(),c=m(),l=t.runner??``,[d,f]=(0,V.useState)(l),[p,h]=(0,V.useState)(null),g=_({mutationFn:e=>a.moveProject(t.slug,d,e),onSuccess:async e=>{await o.invalidateQueries({queryKey:[`projects`]}),e.released?.ok===!1?h({runner:e.project.runner??d,detail:e.released.detail}):i()}}),y=g.error instanceof n&&g.error.code===`SOURCE_AWAY`;return p===null?(0,H.jsxs)(`form`,{"aria-label":`Runner of ${t.slug}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),g.mutate(!1)},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.data===void 0?(0,H.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`Reading the runners…`}):(0,H.jsx)(N,{label:`Runner`,choices:q(s.data,t,c.data??[]),value:d,onChange:e=>{f(e),g.reset()}}),(0,H.jsx)(v,{onClick:i,children:`Cancel`}),(0,H.jsx)(v,{variant:`primary`,type:`submit`,disabled:g.isPending||d===l||d===``,children:g.isPending?`Moving…`:`Move here`})]}),(0,H.jsx)(O,{error:g.error}),y&&!g.isPending?(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsx)(v,{onClick:()=>g.mutate(!0),children:`Move without them`})}):null]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line bg-surface-2/20 p-3`,children:[(0,H.jsxs)(`output`,{className:`block min-w-0 flex-1 text-sm text-fg-secondary`,children:[`On `,p.runner,`. `,p.detail,`.`]}),(0,H.jsx)(v,{onClick:i,children:`Done`})]})}function Y({project:t,onDone:n}){let{api:r}=u(),i=e(),[a,o]=(0,V.useState)(t.name),[s,c]=(0,V.useState)(t.defaultBranch),l={...a.trim()===t.name?{}:{name:a.trim()},...s.trim()===t.defaultBranch?{}:{default_branch:s.trim()}},d=_({mutationFn:()=>r.configureProject(t.slug,l),onSuccess:async()=>{await i.invalidateQueries({queryKey:[`projects`]}),n()}}),f=Object.keys(l).length===0||a.trim()===``||s.trim()===``;return(0,H.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,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{value:a,maxLength:120,"aria-label":`Project name`,onChange:e=>o(e.target.value),className:`${D} min-w-0 flex-1`}),(0,H.jsx)(`div`,{className:`w-36 shrink-0`,children:(0,H.jsx)(`input`,{value:s,maxLength:100,spellCheck:!1,"aria-label":`Default branch`,onChange:e=>c(e.target.value),className:`${D} font-mono`})}),(0,H.jsx)(v,{onClick:n,children:`Cancel`}),(0,H.jsx)(v,{variant:`primary`,type:`submit`,disabled:d.isPending||f,children:d.isPending?`Saving…`:`Save`})]}),(0,H.jsx)(O,{error:d.error})]})}function X(){let{slug:e}=x({from:`/p/$slug`}),n=i(),r=d(),a=m(),o=g(e),s=c(e),u=l(e),f=h(3e4),[_,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(!1),[T,D]=(0,V.useState)(!1),O=n.data?.find(t=>t.slug===e);if(O===void 0)return(0,H.jsx)(j,{children:n.data===void 0?`Reading the project…`:`There is no project ${e}.`});let N=(a.data??[]).filter(e=>e.status===`active`&&O.members.includes(e.name)),L=y(o.data??[]),R=s.data?.body.trim()??``;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M,{title:O.name,subtitle:`${e} · ${O.repo??`a local repository`} · ${O.defaultBranch}${O.runner===void 0?``:` · on ${O.runner}`}`,trailing:(0,H.jsxs)(H.Fragment,{children:[_||O.archived!==void 0?null:(0,H.jsx)(v,{onClick:()=>S(!0),children:`Edit…`}),C||O.archived!==void 0||O.runner===void 0?null:(0,H.jsx)(v,{onClick:()=>w(!0),children:`Runner…`}),(0,H.jsx)(t,{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 →`})]})}),_?(0,H.jsx)(Y,{project:O,onDone:()=>S(!1)}):null,C?(0,H.jsx)(J,{project:O,onDone:()=>w(!1)}):null,T?(0,H.jsx)(A,{project:e,onDone:()=>D(!1)}):null,(0,H.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[O.archived===void 0?null:(0,H.jsxs)(`p`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-sm text-fg-secondary`,children:[`Archived `,p(O.archived.at,f),` by `,O.archived.by,`:`,` `,O.archived.reason,`.`]}),(0,H.jsx)(P,{title:`Channels`,aside:O.archived===void 0&&!T?(0,H.jsx)(v,{onClick:()=>D(!0),children:`New channel…`}):null,children:(0,H.jsx)(k,{channels:(r.data??[]).filter(t=>t.project===e),now:f})}),(0,H.jsx)(P,{title:`Members`,children:(0,H.jsx)(I,{members:N,scope:e})}),(0,H.jsx)(P,{title:`Tasks`,children:o.data===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):L.length===0?(0,H.jsx)(`p`,{className:`text-meta`,children:`No tasks yet.`}):(0,H.jsx)(t,{to:`/p/$slug/tasks`,params:{slug:e},className:`flex flex-wrap gap-1.5`,children:L.map(e=>(0,H.jsxs)(`span`,{className:`rounded-md bg-surface-2/60 px-2 py-0.5 text-xs text-fg-secondary`,children:[e.tasks.length,` `,b.find(t=>t.phase===e.phase)?.label.toLowerCase()]},e.phase))})}),(0,H.jsx)(P,{title:`How a task ends`,children:(0,H.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:O.onDone===`merge`?`When its last stage is done, the board merges task/<id> onto ${O.defaultBranch}.`:O.onDone===`ghpr`?`When its last stage is done, the board merges the pull request linked to it into ${O.defaultBranch} on GitHub.`:`When its last stage is done, it is done; nothing is merged.`})}),(0,H.jsx)(P,{title:`Dashboard`,aside:s.data?.updatedBy===void 0?void 0:(0,H.jsxs)(`span`,{className:`text-meta`,children:[`by `,s.data.updatedBy,s.data.updatedAt===void 0?``:` ${p(s.data.updatedAt,f)}`]}),children:s.data===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):R===``?(0,H.jsx)(`p`,{className:`text-meta`,children:`Empty.`}):(0,H.jsx)(E,{text:R})}),(0,H.jsx)(P,{title:`Knowledge`,children:(0,H.jsx)(F,{scope:e,topics:u.data,now:f})}),(0,H.jsx)(G,{project:O,now:f},e)]})]})}export{X as ProjectView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,C as t,D as n,Gt as r,Hn as i,Jt as a,K as o,P as s,S as c,Un as l,Ut as u,V as d,Vt as f,Wn as p,Wt as m,_t as h,dt as g,ft as _,ht as v,j as y,mt as b,pt as x,qn as S,qt as C,t as w,v as ee,vt as te,w as ne,x as re,z as ie}from"./format-CENiwkJC.js";import{n as T,t as E}from"./Button-Cp4cNRUX.js";import{t as ae}from"./CliIcon-C7bwChMP.js";import{a as oe}from"./tasks-CAI8Eci7.js";import{c as se,d as ce,l as D,n as O,o as k,r as A,s as j}from"./governance-C6ez5MLh.js";import{A as M,i as N,o as P,s as F}from"./index-CPXALUV6.js";import{t as I}from"./BackLink-UTiLF1J4.js";import{t as L}from"./Markdown-DT3V-EVe.js";import{n as R,r as z}from"./ThreadForms-CG5Y926b.js";import{n as B,t as V}from"./Pane-BaM0TdE6.js";import{t as le}from"./StickyList-BaV_KZ8x.js";import{t as H}from"./SkillFileList-CgrCnuaC.js";import{StatusChip as U}from"./ProposalsView-p4KjwV9p.js";import{t as W}from"./SubjectThread-DD_ZCCnr.js";var G=S(p(),1),K=l();function ue({proposal:e}){let{api:t}=y(),n=i(),[r,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(``),c=(0,G.useRef)(null);(0,G.useEffect)(()=>{r!==null&&c.current?.focus()},[r]);let l=T({mutationFn:()=>{let n=o.trim();return r===`reject`?t.reject({proposal_id:e.id,reason:n}):t.approve({proposal_id:e.id,...n===``?{}:{reason:n}})},onSuccess:()=>{let t=[[`proposals`],[`proposal`,e.id],[`threads`],[`thread`,e.id]];for(let e of t)n.invalidateQueries({queryKey:e});a(null),s(``)}});if(r===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:()=>a(`reject`),children:`Reject`}),(0,K.jsx)(E,{variant:`primary`,onClick:()=>a(`approve`),children:`Approve`})]});let u=r===`approve`;return(0,K.jsxs)(`form`,{"aria-label":u?`Approve the proposal`:`Reject the proposal`,className:`space-y-2 border-t border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),l.mutate()},children:[(0,K.jsx)(`textarea`,{ref:c,value:o,rows:2,placeholder:u?`Why approve? Optional.`:`Why not?`,"aria-label":u?`Reason for approving`:`Reason for rejecting`,onChange:e=>s(e.target.value),className:`${R} resize-none`}),(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,K.jsx)(E,{onClick:()=>{a(null),l.reset()},children:`Cancel`}),(0,K.jsx)(E,{variant:`primary`,type:`submit`,disabled:l.isPending||!u&&o.trim()===``,children:l.isPending?`Deciding…`:u?`Confirm approval`:`Confirm rejection`})]}),(0,K.jsx)(z,{error:l.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:se(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 $({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:te(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 de({proposal:e,slug:t,reason:n,members:r}){let i=c(),o=ie(t),s=i.data?.find(e=>e.slug===t),l=e.status===`proposed`,u=l?(r??[]).filter(e=>e.status===`active`&&e.memberships.includes(t)).map(e=>e.name):e.provision?.members??[],d=(o.data??[]).filter(oe).length;return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Project`,children:[(0,K.jsx)(a,{to:`/p/$slug`,params:{slug:t},className:`hover:text-fg-primary`,children:s?.name??t}),s?.name===void 0||s.name===t?null:` · ${t}`]}),(0,K.jsx)(J,{label:l?`Members who leave`:`Members who left`,children:Array.isArray(u)?Y(u.filter(e=>typeof e==`string`)):`none`}),l?(0,K.jsx)(J,{label:`Tasks in play`,children:o.data===void 0?`reading…`:d===0?`none`:`${d}: approval is refused`}):null,(0,K.jsx)(J,{label:`Reason`,children:n})]})}function fe({proposal:e}){let t=e.skillFiles,n=ne(e.id,t!==void 0);if(t===void 0)return(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-secondary`,children:e.status===`proposed`?`Files not taken yet.`:`The board took no files for it.`});if(n.data===void 0)return(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:n.isError?`Could not read its files.`:`Loading…`});let r=n.data.find(e=>e.path===`SKILL.md`),i=n.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:t.commit.slice(0,7)})]})}),r===void 0||r.text===null?null:(0,K.jsx)(Z,{children:(0,K.jsx)(L,{text:D(r.text)})}),i.length===0?null:(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(H,{files:i})})]})}function pe({proposal:e,roles:t,members:n}){let r=e.status===`proposed`,{charter:i}=e;switch(e.kind){case`member`:{let e=x.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)(ae,{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)(L,{text:t.seedInstructions})})]})]})}case`role`:{let n=j(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=h.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})]}),(0,K.jsx)(fe,{proposal:e})]})}case`channel`:{let e=_.safeParse(i);if(!e.success)break;return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Channel`,children:[`#`,f(e.data.project,e.data.name)]}),(0,K.jsx)(J,{label:`Purpose`,children:e.data.purpose})]})}case`retirement`:{let e=v.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)(P,{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=g.safeParse(i);if(!t.success)break;return(0,K.jsx)(de,{proposal:e,slug:t.data.project,reason:t.data.reason,members:n})}case`reallocation`:{let n=b.safeParse(i);if(!n.success)break;return(0,K.jsx)($,{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 me=r({agent:C().optional(),channel:C().optional(),role:C().optional(),skill:C().optional(),replaced:m().optional(),releasedTasks:u(C()).optional(),project:C().optional()});function he({proposal:e}){let t=me.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)(a,{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)(a,{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)(a,{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 ge(){let{proposalId:r}=M({from:`/proposal/$proposalId`}),i=t(r),c=ee(),l=n(),u=s(),f=d(),p=re(3e4),m=F(),h=e(f.data?.some(e=>e.id===r)===!0?r:null);if(i.data===void 0)return(0,K.jsx)(B,{children:i.error instanceof o&&i.error.status===404?`There is no proposal ${r}.`:`Reading the proposal…`});let g=i.data,_=g.status===`proposed`,v=c.data?.find(e=>e.name===g.proposedBy)?.role,y=f.data?.find(e=>e.id===g.id),b=g.status===`rejected`?`Rejected`:`Approved`,x=O(g,{members:c.data??[],roles:l.data??[],skills:u.data??[]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(V,{leading:(0,K.jsx)(I,{fallback:(0,K.jsx)(a,{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:k(g),subtitle:`${g.kind} proposal by ${m(g.proposedBy)} ${w(g.createdAt,p)}${_?` · for ${A(g,v)} to decide`:``}`,trailing:(0,K.jsx)(U,{status:g.status})}),(0,K.jsxs)(le,{stick:!1,follow:!1,ids:h.data?.messages.map(e=>e.id),className:`px-4 py-4`,children:[_?(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: `,x]}):(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:[b,` by `,m(g.decidedBy??`someone`),g.decidedAt===void 0?``:` ${w(g.decidedAt,p)}`,g.reason===void 0?`.`:`: ${g.reason}`]}),(0,K.jsx)(he,{proposal:g})]}),g.body.trim()===``||y!==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)(L,{text:g.body})})]}),(0,K.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:_?`What it would make`:g.status===`provisioned`?`What it made`:`What it proposed`}),(0,K.jsx)(pe,{proposal:g,roles:l.data,members:c.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`}),y===void 0?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:f.data===void 0?`Reading the thread…`:`No thread on this proposal.`}):(0,K.jsx)(W,{thread:y,now:p,empty:`Nothing said yet.`})]})]},g.id),y?.state===`open`?(0,K.jsx)(N,{target:{threadId:g.id},placeholder:`Write in the proposal's thread`}):null,ce(g)?(0,K.jsx)(ue,{proposal:g}):null]})}export{ge as ProposalView};
|
|
1
|
+
import{B as e,C as t,D as n,Gt as r,Hn as i,Jt as a,K as o,P as s,S as c,Un as l,Ut as u,V as d,Vt as f,Wn as p,Wt as m,_t as h,dt as g,ft as _,ht as v,j as y,mt as b,pt as x,qn as S,qt as C,t as w,v as ee,vt as te,w as ne,x as re,z as ie}from"./format-DpQyO6r1.js";import{n as T,t as E}from"./Button-CxjWy598.js";import{t as ae}from"./CliIcon-BB2NdLxN.js";import{a as oe}from"./tasks-DLTeaHys.js";import{c as se,d as ce,l as D,n as O,o as k,r as A,s as j}from"./governance-YialJVYK.js";import{A as M,i as N,o as P,s as F}from"./index-DhuCp-VF.js";import{t as I}from"./BackLink-qSxOMeEG.js";import{t as L}from"./Markdown-C7RbUEZE.js";import{n as R,r as z}from"./ThreadForms-D94Jj0ES.js";import{n as B,t as V}from"./Pane-BlIRwUtQ.js";import{t as le}from"./StickyList-BbGq82Jj.js";import{t as H}from"./SkillFileList-Cs_f3RPo.js";import{StatusChip as U}from"./ProposalsView-C0r1ya8_.js";import{t as W}from"./SubjectThread-DdkyhVqK.js";var G=S(p(),1),K=l();function ue({proposal:e}){let{api:t}=y(),n=i(),[r,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(``),c=(0,G.useRef)(null);(0,G.useEffect)(()=>{r!==null&&c.current?.focus()},[r]);let l=T({mutationFn:()=>{let n=o.trim();return r===`reject`?t.reject({proposal_id:e.id,reason:n}):t.approve({proposal_id:e.id,...n===``?{}:{reason:n}})},onSuccess:()=>{let t=[[`proposals`],[`proposal`,e.id],[`threads`],[`thread`,e.id]];for(let e of t)n.invalidateQueries({queryKey:e});a(null),s(``)}});if(r===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:()=>a(`reject`),children:`Reject`}),(0,K.jsx)(E,{variant:`primary`,onClick:()=>a(`approve`),children:`Approve`})]});let u=r===`approve`;return(0,K.jsxs)(`form`,{"aria-label":u?`Approve the proposal`:`Reject the proposal`,className:`space-y-2 border-t border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),l.mutate()},children:[(0,K.jsx)(`textarea`,{ref:c,value:o,rows:2,placeholder:u?`Why approve? Optional.`:`Why not?`,"aria-label":u?`Reason for approving`:`Reason for rejecting`,onChange:e=>s(e.target.value),className:`${R} resize-none`}),(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,K.jsx)(E,{onClick:()=>{a(null),l.reset()},children:`Cancel`}),(0,K.jsx)(E,{variant:`primary`,type:`submit`,disabled:l.isPending||!u&&o.trim()===``,children:l.isPending?`Deciding…`:u?`Confirm approval`:`Confirm rejection`})]}),(0,K.jsx)(z,{error:l.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:se(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 $({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:te(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 de({proposal:e,slug:t,reason:n,members:r}){let i=c(),o=ie(t),s=i.data?.find(e=>e.slug===t),l=e.status===`proposed`,u=l?(r??[]).filter(e=>e.status===`active`&&e.memberships.includes(t)).map(e=>e.name):e.provision?.members??[],d=(o.data??[]).filter(oe).length;return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Project`,children:[(0,K.jsx)(a,{to:`/p/$slug`,params:{slug:t},className:`hover:text-fg-primary`,children:s?.name??t}),s?.name===void 0||s.name===t?null:` · ${t}`]}),(0,K.jsx)(J,{label:l?`Members who leave`:`Members who left`,children:Array.isArray(u)?Y(u.filter(e=>typeof e==`string`)):`none`}),l?(0,K.jsx)(J,{label:`Tasks in play`,children:o.data===void 0?`reading…`:d===0?`none`:`${d}: approval is refused`}):null,(0,K.jsx)(J,{label:`Reason`,children:n})]})}function fe({proposal:e}){let t=e.skillFiles,n=ne(e.id,t!==void 0);if(t===void 0)return(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-secondary`,children:e.status===`proposed`?`Files not taken yet.`:`The board took no files for it.`});if(n.data===void 0)return(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:n.isError?`Could not read its files.`:`Loading…`});let r=n.data.find(e=>e.path===`SKILL.md`),i=n.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:t.commit.slice(0,7)})]})}),r===void 0||r.text===null?null:(0,K.jsx)(Z,{children:(0,K.jsx)(L,{text:D(r.text)})}),i.length===0?null:(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(H,{files:i})})]})}function pe({proposal:e,roles:t,members:n}){let r=e.status===`proposed`,{charter:i}=e;switch(e.kind){case`member`:{let e=x.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)(ae,{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)(L,{text:t.seedInstructions})})]})]})}case`role`:{let n=j(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=h.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})]}),(0,K.jsx)(fe,{proposal:e})]})}case`channel`:{let e=_.safeParse(i);if(!e.success)break;return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Channel`,children:[`#`,f(e.data.project,e.data.name)]}),(0,K.jsx)(J,{label:`Purpose`,children:e.data.purpose})]})}case`retirement`:{let e=v.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)(P,{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=g.safeParse(i);if(!t.success)break;return(0,K.jsx)(de,{proposal:e,slug:t.data.project,reason:t.data.reason,members:n})}case`reallocation`:{let n=b.safeParse(i);if(!n.success)break;return(0,K.jsx)($,{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 me=r({agent:C().optional(),channel:C().optional(),role:C().optional(),skill:C().optional(),replaced:m().optional(),releasedTasks:u(C()).optional(),project:C().optional()});function he({proposal:e}){let t=me.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)(a,{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)(a,{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)(a,{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 ge(){let{proposalId:r}=M({from:`/proposal/$proposalId`}),i=t(r),c=ee(),l=n(),u=s(),f=d(),p=re(3e4),m=F(),h=e(f.data?.some(e=>e.id===r)===!0?r:null);if(i.data===void 0)return(0,K.jsx)(B,{children:i.error instanceof o&&i.error.status===404?`There is no proposal ${r}.`:`Reading the proposal…`});let g=i.data,_=g.status===`proposed`,v=c.data?.find(e=>e.name===g.proposedBy)?.role,y=f.data?.find(e=>e.id===g.id),b=g.status===`rejected`?`Rejected`:`Approved`,x=O(g,{members:c.data??[],roles:l.data??[],skills:u.data??[]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(V,{leading:(0,K.jsx)(I,{fallback:(0,K.jsx)(a,{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:k(g),subtitle:`${g.kind} proposal by ${m(g.proposedBy)} ${w(g.createdAt,p)}${_?` · for ${A(g,v)} to decide`:``}`,trailing:(0,K.jsx)(U,{status:g.status})}),(0,K.jsxs)(le,{stick:!1,follow:!1,ids:h.data?.messages.map(e=>e.id),className:`px-4 py-4`,children:[_?(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: `,x]}):(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:[b,` by `,m(g.decidedBy??`someone`),g.decidedAt===void 0?``:` ${w(g.decidedAt,p)}`,g.reason===void 0?`.`:`: ${g.reason}`]}),(0,K.jsx)(he,{proposal:g})]}),g.body.trim()===``||y!==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)(L,{text:g.body})})]}),(0,K.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:_?`What it would make`:g.status===`provisioned`?`What it made`:`What it proposed`}),(0,K.jsx)(pe,{proposal:g,roles:l.data,members:c.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`}),y===void 0?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:f.data===void 0?`Reading the thread…`:`No thread on this proposal.`}):(0,K.jsx)(W,{thread:y,now:p,empty:`Nothing said yet.`})]})]},g.id),y?.state===`open`?(0,K.jsx)(N,{target:{threadId:g.id},placeholder:`Write in the proposal's thread`}):null,ce(g)?(0,K.jsx)(ue,{proposal:g}):null]})}export{ge as ProposalView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Jt as e,T as t,Un as n,Wn as r,qn as i,t as a,x as o}from"./format-
|
|
1
|
+
import{Jt as e,T as t,Un as n,Wn as r,qn as i,t as a,x as o}from"./format-DpQyO6r1.js";import{i as s,o as c,t as l}from"./governance-YialJVYK.js";import{s as u}from"./index-DhuCp-VF.js";import{n as d,t as f}from"./Pane-BlIRwUtQ.js";var p=i(r(),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:t,now:n}){let r=u(),i=t.decidedBy===void 0||t.decidedAt===void 0?``:` · ${t.status===`rejected`?`rejected`:`approved`} by ${r(t.decidedBy)} ${a(t.decidedAt,n)}`;return(0,m.jsx)(`li`,{children:(0,m.jsxs)(e,{to:`/proposal/$proposalId`,params:{proposalId:t.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(t)}),(0,m.jsx)(_,{status:t.status})]}),(0,m.jsxs)(`p`,{className:`mt-1 truncate text-meta`,children:[`proposed by `,r(t.proposedBy),` `,a(t.createdAt,n),i]})]})})}function y(){let e=t(),n=o(3e4),[r,i]=(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.`}):a.map(e=>{let t=e.group===`decided`&&!r?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:t.map(e=>(0,m.jsx)(v,{proposal:e,now:n},e.id))}),t.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 +1 @@
|
|
|
1
|
-
import{Dt as e,Et as t,Hn as n,Jt as r,Ot as i,Un as a,Wn as o,j as s,kt as c,qn as l,t as u}from"./format-
|
|
1
|
+
import{Dt as e,Et as t,Hn as n,Jt as r,Ot as i,Un as a,Wn as o,j as s,kt as c,qn as l,t as u}from"./format-DpQyO6r1.js";import{n as d,t as f}from"./Button-CxjWy598.js";import{t as p}from"./CliIcon-BB2NdLxN.js";import{u as m}from"./citizen-CgA4vJjy.js";var h=l(o(),1);function g(e,t){return e===void 0||t-Date.parse(e.observedAt)>=9e5}function _(t){let n=[];for(let r of t)for(let t of r.clis){let i=r.quotas?.[t],a=i===void 0?void 0:n.find(n=>n.cli===t&&n.quota!==void 0&&e(n.quota,i));a===void 0?n.push({cli:t,runners:[r.name],quota:i,connected:r.status===`connected`}):a.runners.push(r.name)}return n}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,t){let n=c(e);if(!i(e,new Date(t)))return{name:n,percent:null,label:`reset`,reset:`reset since read`,high:!1};let r=e.usedPercent;return{name:n,percent:r===null?null:Math.min(100,r),label:r===null?`?`:`${Math.floor(r)}%`,reset:e.resetsAt===null?``:`resets in ${v(Date.parse(e.resetsAt)-t)}`,high:r!==null&&r>=80}}function b(e,n){let r=t(e,new Date(n));return r===`limited`?{level:r,words:e.limitedUntil===null?`limited`:`limited for ${v(Date.parse(e.limitedUntil)-n)}`,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=a(),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:e,now:t}){let{api:r}=s(),i=n(),[a,o]=(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})=>{o(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})=>{o(e=>{let t=new Set(e);return t.delete(`${n}/${r}`),t}),i.invalidateQueries({queryKey:[`runners`]})}});(0,h.useEffect)(()=>{for(let t of e)if(t.status===`connected`)for(let e of t.clis){let n=`${t.name}/${e}`;!u.current.has(n)&&g(t.quotas?.[e],Date.now())&&(u.current.add(n),m({runner:t.name,cli:e}))}},[e,m]);let v=e.filter(e=>e.status===`connected`),y=_(e);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 n=e.runners[0]??``,r=`${n}/${e.cli}`,i=E(e,t,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:t}),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 `)]}):null]},`${e.cli}/${n}`)})})]})}function O({member:e,runners:t,placed:n,now:i}){let a=e.cli,o=m(e,n);return a===null||o.length===0?null:(0,S.jsxs)(`p`,{className:`border-b border-line px-4 py-1.5 text-meta`,children:[(0,S.jsxs)(r,{to:`/runners`,className:`hover:text-fg-primary`,children:[a,` quota`]}),o.map(e=>{let n=t.find(t=>t.name===e)?.quotas?.[a],r=n===void 0?``:b(n,i).tone;return(0,S.jsxs)(`span`,{children:[` · `,e,` `,(0,S.jsx)(`span`,{className:r,title:n===void 0?`nothing reported yet`:`as of ${n.observedAt}`,children:x(n,i)})]},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,Hn as t,O as n,S as r,Un as i,Wn as a,f as o,j as s,qn as c,t as l,x as u}from"./format-
|
|
1
|
+
import{A as e,Hn as t,O as n,S as r,Un as i,Wn as a,f as o,j as s,qn as c,t as l,x as u}from"./format-DpQyO6r1.js";import{n as d,t as f}from"./Button-CxjWy598.js";import{t as p}from"./CliIcon-BB2NdLxN.js";import{k as m}from"./index-DhuCp-VF.js";import{n as h,r as g}from"./ThreadForms-D94Jj0ES.js";import{n as _,t as v}from"./Pane-BlIRwUtQ.js";import{n as y}from"./Quota-59QJZrPa.js";var b=c(a(),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}.`}}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=i();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:e,taken:n,followed:r,now:i}){let{api:a}=s(),o=t(),[c,u]=(0,b.useState)(null),p=c??T(e.hostname,n),m=()=>{o.invalidateQueries({queryKey:[`enrollments`]}),o.invalidateQueries({queryKey:[`runners`]})},_=d({mutationFn:()=>a.approveEnrollment(e.userCode,p.trim()),onSuccess:m}),v=d({mutationFn:()=>a.denyEnrollment(e.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:e.hostname}),(0,E.jsx)(`code`,{className:`shrink-0 font-mono text-sm text-fg-primary`,children:e.userCode})]}),(0,E.jsxs)(`p`,{className:`mt-0.5 truncate text-meta`,children:[e.os,` · `,O(e.clis,e.capabilities),` · runner`,` `,e.version,` · asked `,l(e.requestedAt,i)]}),(0,E.jsxs)(`form`,{"aria-label":`Approve ${e.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:t}=m({from:`/runners`}),i=o(),a=n(),s=r(),c=e().data,d=u(3e4),f=i.data??[],h=(a.data??[]).map(e=>e.name),g=(a.data??[]).toSorted(D),b=g.filter(e=>e.status===`connected`).length,x=g.length-b,T=g.filter(e=>S(e,c)).length,O=g.filter(e=>C(e)!==null).length,A=t===void 0?void 0:f.find(e=>w(e.userCode,t)),j=A===void 0?f:[A,...f.filter(e=>e!==A)],M=e=>(s.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`],...c===void 0?[]:[`server v${c}`],...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:[t!==void 0&&i.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 `,t,`.`]}):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))}),a.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 ${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,c)?(0,E.jsxs)(`span`,{className:`text-xs text-amber-300`,title:`the server runs v${c}`,children:[`v`,e.version,(0,E.jsxs)(`span`,{className:`sr-only`,children:[`, not the server's v`,c]})]}):(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,2 +1,2 @@
|
|
|
1
|
-
import{Un as e,Wn as t,qn as n}from"./format-
|
|
1
|
+
import{Un as e,Wn as t,qn as n}from"./format-DpQyO6r1.js";import{g as r}from"./Markdown-C7RbUEZE.js";var i=n(t(),1),a=e();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.`}):(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
2
|
…`:``]}):null]},e.path)})})}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Hn as e,Jt as t,N as n,P as r,Un as i,Wn as a,j as o,qn as s}from"./format-
|
|
1
|
+
import{Hn as e,Jt as t,N as n,P as r,Un as i,Wn as a,j as o,qn as s}from"./format-DpQyO6r1.js";import{n as c,t as l}from"./Button-CxjWy598.js";import{i as u}from"./compose-3ksQaHF6.js";import{l as d}from"./governance-YialJVYK.js";import{A as f}from"./index-DhuCp-VF.js";import{t as p}from"./BackLink-qSxOMeEG.js";import{t as m}from"./Markdown-C7RbUEZE.js";import{n as h,r as g}from"./ThreadForms-D94Jj0ES.js";import{n as _,t as v}from"./Pane-BlIRwUtQ.js";import{n as y}from"./Overview-xatORJK6.js";import{t as b}from"./SkillFileList-Cs_f3RPo.js";var x=s(a(),1),S=i(),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`}),i=r(),a=n(e),[o,s]=(0,x.useState)(!1),c=i.data?.find(t=>t.name===e);if(c===void 0)return(0,S.jsx)(_,{children:i.data===void 0?`Reading…`:`The society has no skill ${e}.`});let u=a.data?.find(e=>e.path===`SKILL.md`),h=a.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)(t,{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:o?null:(0,S.jsx)(l,{onClick:()=>s(!0),children:`Remove…`})}),o?(0,S.jsx)(T,{name:c.name,onCancel:()=>s(!1)}):null,(0,S.jsx)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:a.data===void 0?(0,S.jsx)(`p`,{className:`text-meta`,children:a.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}=o(),i=e(),a=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 a({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.jsx)(g,{error:p.error})]})}export{w as SkillView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e,F as t,Jt as n,P as r,S as i,Un as a,Wn as o,g as s,gt as c,l,qn as u,v as d,x as f,zt as p}from"./format-
|
|
1
|
+
import{D as e,F as t,Jt as n,P as r,S as i,Un as a,Wn as o,g as s,gt as c,l,qn as u,v as d,x as f,zt as p}from"./format-DpQyO6r1.js";import{t as m}from"./Button-CxjWy598.js";import{n as h,r as g}from"./ChannelForms-BVidWMId.js";import{n as _,t as v}from"./Pane-BlIRwUtQ.js";import{n as y,r as b,t as x}from"./Overview-xatORJK6.js";var S=u(o(),1),C=a();function w(){let n=t(),a=d(),o=i(),u=e(),w=r(),E=s(c),D=l(),O=f(3e4),[k,A]=(0,S.useState)(!1);if(n.data===void 0||a.data===void 0)return(0,C.jsx)(_,{children:`Reading the society…`});let j=a.data.filter(e=>e.cli!==null),M=j.filter(e=>e.status===`active`),N=j.filter(e=>e.status===`retired`),P=(u.data??[]).filter(e=>e.name!==p);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:c}),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:c,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.`}):(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)(n,{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{Un as e,Wn as t,qn as n}from"./format-
|
|
1
|
+
import{Un as e,Wn as t,qn as n}from"./format-DpQyO6r1.js";var r=n(t(),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=e();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 +1 @@
|
|
|
1
|
-
import{B as e,Un as t,Wn as n,qn as r,t as i,v as a}from"./format-
|
|
1
|
+
import{B as e,Un as t,Wn as n,qn as r,t as i,v as a}from"./format-DpQyO6r1.js";import{C as o}from"./index-DhuCp-VF.js";import{t as s}from"./Markdown-C7RbUEZE.js";import{t as c}from"./MessageItem-DgWh5pJF.js";var l=r(n(),1),u=t();function d({thread:t,now:n,task:r,empty:d}){let f=a(),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?``:` ${i(g.closedAt,n)}`,g.body.trim()===``?`.`:`:`]}),g.body.trim()===``?null:(0,u.jsx)(s,{text:g.body})]}):null]})}export{d as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{B as e,Hn as t,I as n,Jt as r,K as i,L as a,R as o,S as s,Un as c,V as l,Wn as u,j as d,qn as f,t as p,v as m,x as h}from"./format-
|
|
1
|
+
import{B as e,Hn as t,I as n,Jt as r,K as i,L as a,R as o,S as s,Un as c,V as l,Wn as u,j as d,qn as f,t as p,v as m,x as h}from"./format-DpQyO6r1.js";import{n as g,t as _}from"./Button-CxjWy598.js";import{c as v,l as y,n as b,o as x,r as S,s as C,t as w}from"./tasks-DLTeaHys.js";import{u as T}from"./governance-YialJVYK.js";import{A as E,_ as D,i as O,o as k,s as A}from"./index-DhuCp-VF.js";import{t as j}from"./BackLink-qSxOMeEG.js";import{f as M,l as N,m as P,n as F,o as I,t as L}from"./Markdown-C7RbUEZE.js";import{n as R,r as z}from"./ThreadForms-D94Jj0ES.js";import{n as B,t as V}from"./Pane-BlIRwUtQ.js";import{t as ee}from"./StickyList-BbGq82Jj.js";import{i as H,n as U,r as W,t as G}from"./FileTree-CHDmrOhY.js";import{t as K}from"./SubjectThread-DdkyhVqK.js";var q=f(u(),1),J=c(),Y={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 X({last:e,now:t}){return e===void 0?null:(0,J.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-meta`,children:[e.author,` `,p(e.at,t)]})}function Z({taskId:e,path:t,patch:n}){let i=(0,q.useMemo)(()=>P(n),[n]);return(0,J.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:i.map((n,i)=>(0,J.jsxs)(`div`,{className:`flex ${Y[n.kind]}`,children:[(0,J.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,J.jsx)(r,{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,J.jsx)(`span`,{className:`min-w-0 flex-1 pr-2 break-words whitespace-pre-wrap`,children:n.text===``?` `:n.text})]},i))})}function Q({taskId:e,change:t}){let n=o(e,t.path),r;if(n.data!==void 0){let{patch:i,truncated:a}=n.data;r=i===null?(0,J.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown here.`}):i===``?(0,J.jsx)(`p`,{className:`mt-1 text-meta`,children:`No lines changed.`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{taskId:e,path:t.path,patch:i}),a?(0,J.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}else r=n.error instanceof i&&n.error.status===503?(0,J.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,J.jsx)(`p`,{className:`mt-1 text-meta`,children:`Reading the change…`}):(0,J.jsx)(`p`,{className:`mt-1 text-meta`,children:n.error.message});return(0,J.jsxs)(`div`,{className:`mb-2 ml-[18px]`,children:[t.status===`deleted`?null:(0,J.jsx)(F,{source:{kind:`task`,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 $({taskId:e,nodes:t,nested:n,openings:r,now:i}){let{isOpen:a,toggle:o,shown:s,toggleFile:c}=r;return(0,J.jsx)(H,{nested:n,children:t.map(t=>{if(t.kind===`dir`){let n=a(t);return(0,J.jsxs)(`li`,{children:[(0,J.jsxs)(U,{name:t.name,open:n,onToggle:()=>o(t),children:[(0,J.jsx)(`span`,{className:`shrink-0 text-meta`,children:t.files===1?`1 file`:`${t.files} files`}),(0,J.jsx)(X,{last:t.lastChange,now:i})]}),n?(0,J.jsx)($,{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,J.jsxs)(`li`,{children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":l,title:n.path,onClick:()=>c(n.path),className:`group ${W} ${l?`bg-surface-2/30`:``}`,children:[(0,J.jsx)(G,{}),(0,J.jsx)(`span`,{className:`min-w-0 truncate ${u}`,children:t.name}),(0,J.jsx)(`span`,{className:`shrink-0 text-meta`,children:I(n)}),(0,J.jsx)(X,{last:n.lastChange,now:i})]}),l?(0,J.jsx)(Q,{taskId:e,change:n}):null]},n.path)})})}function te({taskId:e,changes:t,now:n}){let r=(0,q.useMemo)(()=>N(t),[t]),i=(0,q.useMemo)(()=>M(r),[r]),[a,o]=(0,q.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,q.useState)(new Set);return(0,J.jsx)($,{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 ne({task:e,now:t}){let n=a(e.id),r=s(),o=`task/${e.id}`,c;if(n.data!==void 0){let{files:r,total:i,head:a}=n.data;c=r.length===0?(0,J.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing changed on `,o,` yet.`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`mt-2 text-meta`,children:[i===1?`1 file`:`${i} files`,` changed · newest commit by `,a.author,` `,p(a.at,t)]}),(0,J.jsx)(te,{taskId:e.id,changes:r,now:t}),i>r.length?(0,J.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,r.length,` of `,i]}):null]})}else if(n.error instanceof i&&n.error.status===404)c=(0,J.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing on `,o,` yet.`]});else if(n.error instanceof i&&n.error.status===503){let t=r.data?.find(t=>t.slug===e.project);c=(0,J.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 c=n.error===null?(0,J.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the task's branch…`}):(0,J.jsx)(`p`,{className:`mt-2 text-meta`,children:n.error.message});return(0,J.jsxs)(`section`,{"aria-label":`Files`,className:`mt-5 border-t border-line pt-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,J.jsx)(`h3`,{className:`text-section`,children:`Files`}),(0,J.jsx)(F,{source:{kind:`task`,taskId:e.id},path:``,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Browse the branch`})]}),c]})}function re({stage:e,index:t,task:n,members:r,now:i}){let a=e.completedBy!==void 0,o=x(n,e),s=t===n.stages.length-1,c=o&&n.status===`claimed`?n.claimedBy:void 0,l=e.holders.filter(t=>t!==c&&t!==e.completedBy),u=n.returned?.from===e.id?n.returned:void 0;return(0,J.jsxs)(`li`,{className:`relative flex gap-3 pb-4`,children:[s?null:(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-6 bottom-0 left-2.5 w-px bg-line`}),(0,J.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,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`p`,{className:`text-sm ${o?`font-medium text-fg-primary`:`text-fg-secondary`}`,children:[e.name,e.gate?(0,J.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,J.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[`for `,S(e),c===void 0?null:(0,J.jsxs)(J.Fragment,{children:[` · held by `,(0,J.jsx)(k,{name:c,members:r})]}),e.completedBy!==void 0&&e.completedAt!==void 0?` · done by ${e.completedBy} ${p(e.completedAt,i)}`:o&&n.status===`open`?` · waiting since ${p(n.stageSince,i)}`:``,l.length>0?` · held before by ${l.join(`, `)}`:``,u===void 0?``:` · sent back by ${u.by} ${p(u.at,i)}`]})]})]})}function ie({task:e,stage:n}){let{api:r}=d(),i=t(),[a,o]=(0,q.useState)(``),s=e.stages.findIndex(e=>e.id===n.id),c=e.stages[s+1]===void 0&&e.onDone===`ghpr`&&e.pullRequest===void 0,l=g({mutationFn:()=>r.advanceTask({task_id:e.id,...a.trim()===``?{}:{note:a.trim()}}),onSuccess:async()=>{o(``),await i.invalidateQueries({queryKey:[`task`,e.id]}),await i.invalidateQueries({queryKey:[`tasks`]})}});return(0,J.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(),l.mutate()},children:[(0,J.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[n.name,` waits on you.`,c?` No pull request linked yet.`:``]}),(0,J.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:R}),(0,J.jsx)(`div`,{className:`flex justify-end`,children:(0,J.jsx)(_,{variant:`primary`,type:`submit`,disabled:l.isPending,children:l.isPending?`Approving…`:`Approve`})}),(0,J.jsx)(z,{error:l.error})]})}function ae({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
3
|
`);return(0,J.jsxs)(`section`,{"aria-label":`Pull request`,className:`mt-5 border-t border-line pt-4`,children:[(0,J.jsx)(`h3`,{className:`text-section`,children:`Pull request`}),(0,J.jsxs)(`p`,{className:`mt-2 text-sm`,children:[(0,J.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,J.jsxs)(`span`,{className:`text-meta`,children:[` `,`· linked by `,n.linkedBy,` `,p(n.linkedAt,t)]})]}),e.status===`abandoned`&&e.onDone===`ghpr`?(0,J.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,J.jsxs)(`span`,{className:`text-meta`,children:[` · `,p(n.closed.at,t)]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-3 text-caps text-fg-muted`,children:`Merges as`}),(0,J.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 oe(){let{taskId:t}=E({from:`/task/$taskId`}),a=n(t),o=l(),c=s(),u=m(),d=h(3e4),f=A(),g=e(o.data?.some(e=>e.id===t)===!0?t:null);if(a.data===void 0)return(0,J.jsx)(B,{children:a.error instanceof i&&a.error.status===404?`There is no task ${t}.`:`Reading the task…`});let _=a.data,x=C(_),S=T(_),k=c.data?.find(e=>e.slug===_.project),M=o.data?.find(e=>e.id===_.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(V,{leading:(0,J.jsx)(j,{fallback:(0,J.jsx)(r,{to:`/p/$slug/tasks`,params:{slug:_.project},"aria-label":`Back to the tasks of ${k?.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:`${k?.name??_.project}${_.channel===`general`?``:` #${_.channel}`} · ${v(_)} · created by ${f(_.createdBy)} ${p(_.createdAt,d)}`,trailing:(0,J.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${b[x]}`,children:w.find(e=>e.phase===x)?.label.toLowerCase()})}),(0,J.jsxs)(ee,{stick:!1,follow:!1,ids:g.data?.messages.map(e=>e.id),className:`px-4 py-4`,children:[(0,J.jsx)(`h3`,{className:`text-section`,children:`Plan`}),_.returned===void 0?null:(0,J.jsxs)(`p`,{className:`mt-2 rounded-lg bg-orange-500/10 px-3 py-2 text-xs leading-relaxed text-orange-200`,children:[`Sent back from `,y(_,_.returned.from),` by `,_.returned.by,` `,p(_.returned.at,d),`.`]}),(0,J.jsx)(`ol`,{className:`mt-3`,children:_.stages.map((e,t)=>(0,J.jsx)(re,{stage:e,index:t,task:_,members:u.data,now:d},e.id))}),S===null?null:(0,J.jsx)(ie,{task:_,stage:S}),(0,J.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,J.jsxs)(J.Fragment,{children:[` · blocked by `,(0,J.jsx)(D,{text:_.blockedBy.join(`, `)})]}):null]}),_.body.trim()===``?null:(0,J.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,J.jsx)(`h3`,{className:`text-section`,children:`Brief`}),(0,J.jsx)(`div`,{className:`mt-2`,children:(0,J.jsx)(L,{text:_.body})})]}),(0,J.jsx)(ae,{task:_,now:d}),(0,J.jsx)(ne,{task:_,now:d}),(0,J.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,J.jsx)(`h3`,{className:`text-section`,children:`Thread`}),o.data===void 0?null:M===void 0?(0,J.jsx)(`p`,{className:`mt-2 text-meta`,children:`No thread on this task.`}):(0,J.jsx)(K,{thread:M,now:d,task:_,empty:`Nothing said yet.`})]})]},_.id),M?.state===`open`?(0,J.jsx)(O,{target:{threadId:_.id},placeholder:`Write in the task's thread`}):null]})}export{oe as TaskView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Jt as e,S as t,Un as n,Wn as r,qn as i,t as a,v as o,x as s,yt as c,z as l}from"./format-
|
|
1
|
+
import{Jt as e,S as t,Un as n,Wn as r,qn as i,t as a,v as o,x as s,yt as c,z as l}from"./format-DpQyO6r1.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-DLTeaHys.js";import{A as _,o as v}from"./index-DhuCp-VF.js";import{n as y,t as b}from"./Pane-BlIRwUtQ.js";var x=i(r(),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:t,members:n,now:r}){let i=h(t),o=c(t);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(e,{to:`/task/$taskId`,params:{taskId:t.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:t.title}),(0,S.jsx)(`span`,{className:`shrink-0 text-meta`,children:u(t)})]}),(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(C,{task:t})}),t.returned===void 0?null:(0,S.jsxs)(`p`,{className:`mt-1.5 truncate text-xs text-orange-300/90`,children:[`Sent back from `,f(t,t.returned.from),` by `,t.returned.by,` `,a(t.returned.at,r)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:t.status===`claimed`&&i!==`landing`&&o!==void 0?(0,S.jsxs)(S.Fragment,{children:[o.name,` · held by `,(0,S.jsx)(v,{name:t.claimedBy??``,members:n})]}):t.status===`open`&&i!==`landing`&&o!==void 0?`${o.name} · waiting for ${m(o)} since ${a(t.stageSince,r)}`:i===`landing`?`landing task/${t.id} on the default branch`:`${i} ${a(t.updatedAt,r)}`})]})})}function E(){let{slug:e}=_({from:`/p/$slug/tasks`}),n=l(e),r=t(),i=o(),a=s(3e4),[c,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`||c.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:i.data,now:a},e.id))}),t.length<e.tasks.length?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>u(new Set([...c,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{D as e,Hn as t,K as n,Un as r,Wn as i,j as a,qn as o,v as s}from"./format-
|
|
1
|
+
import{D as e,Hn as t,K as n,Un as r,Wn as i,j as a,qn as o,v as s}from"./format-DpQyO6r1.js";import{n as c,t as l}from"./Button-CxjWy598.js";import{i as u,n as d}from"./compose-3ksQaHF6.js";import{n as f}from"./mentions-Buc5vs-j.js";var p=o(i(),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=r(),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 n?e.message:`The board did not take it.`})}function b({channel:n,onDone:r}){let{api:i}=a(),o=t(),f=u(),g=s(),_=e(),[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)}.`:null}),(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:e,channel:n,onDone:r}){let{api:i}=a(),o=t(),[s,u]=(0,p.useState)(``),d=(0,p.useRef)(null);(0,p.useEffect)(()=>d.current?.focus(),[]);let f=c({mutationFn:()=>i.closeThread({thread_id:e,summary:s.trim()}),onSuccess:()=>{for(let t of[[`thread`,e],[`threads`],[`channel`,n]])o.invalidateQueries({queryKey:t});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?`,"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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Jt as e,Un as t,n,t as r}from"./format-
|
|
1
|
+
import{Jt as e,Un as t,n,t as r}from"./format-DpQyO6r1.js";import{_ as i,s as a}from"./index-DhuCp-VF.js";var o=t();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:t,now:c}){let u=a(),d=t.state===`open`,f=d?``:n(t.body,180),p=d?void 0:t.closedAt,m=p??t.openedAt;return(0,o.jsxs)(e,{to:`/thread/$threadId`,params:{threadId:t.id},className:`group flex gap-3 px-4 py-1`,children:[(0,o.jsx)(`span`,{title:t.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(t.openedBy),` opened `,s(t.subject),` thread`,` `,(0,o.jsx)(`span`,{className:`text-fg-secondary group-hover:text-fg-primary`,children:t.title}),(0,o.jsxs)(`span`,{className:`sr-only`,children:[`, `,t.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as e,Jt as t,K as n,Sn as r,Un as i,Wn as a,j as o,qn as s,t as c,v as l,x as u}from"./format-
|
|
1
|
+
import{I as e,Jt as t,K as n,Sn as r,Un as i,Wn as a,j as o,qn as s,t as c,v as l,x as u}from"./format-DpQyO6r1.js";import{t as d}from"./Button-CxjWy598.js";import{A as f,C as p,i as m,k as h,s as g}from"./index-DhuCp-VF.js";import{t as _}from"./BackLink-qSxOMeEG.js";import{t as v}from"./Markdown-C7RbUEZE.js";import{t as y}from"./ThreadForms-D94Jj0ES.js";import{t as b}from"./MessageItem-DgWh5pJF.js";import{n as x,t as S}from"./Pane-BlIRwUtQ.js";import{t as C}from"./StickyList-BbGq82Jj.js";import{r as w,t as T}from"./ThreadItem-CYmdCPOf.js";var E=s(a(),1),D=i();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:i,target:a}){let{api:s}=o(),f=r({queryKey:[`thread`,i],queryFn:()=>s.thread(i)}),h=l(),O=u(3e4),k=g(),A=f.data?.messages??[],j=A.at(-1)?.id??null;(0,E.useEffect)(()=>p(i,j),[i,j]);let[M,N]=(0,E.useState)(!1),P=f.data?.thread.subject,F=e(P?.kind===`task`?P.id:null);if(f.data===void 0)return(0,D.jsx)(x,{children:f.error instanceof n&&f.error.status===404?`There is no thread ${i}.`:`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)(t,{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)} ${c(I.openedAt,O)}`,trailing:(0,D.jsxs)(D.Fragment,{children:[I.subject?.kind===`task`?(0,D.jsx)(t,{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)(t,{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:a===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===a},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?``:` ${c(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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{gt as e,st as t}from"./format-
|
|
1
|
+
import{gt as e,st as t}from"./format-DpQyO6r1.js";import{l as n}from"./index-DhuCp-VF.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{Wn as e,Xt as t,qn as n}from"./format-
|
|
1
|
+
import{Wn as e,Xt as t,qn as n}from"./format-DpQyO6r1.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};
|