@kubitnodes/stellaris 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/cli/index.js +139 -15
  2. package/dist/server/index.js +210 -31
  3. package/package.json +1 -1
  4. package/web/dist/assets/BackLink-BW0sb-M0.js +1 -0
  5. package/web/dist/assets/ChannelView-DmTE9aUA.js +1 -0
  6. package/web/dist/assets/CitizenView-lrA6vZDK.js +2 -0
  7. package/web/dist/assets/CitizensView-MRVffBnU.js +1 -0
  8. package/web/dist/assets/KnowledgeView-C2N-x5yS.js +1 -0
  9. package/web/dist/assets/{Markdown-MZnGPfvk.js → Markdown-CS3NCze-.js} +4 -4
  10. package/web/dist/assets/MessageItem-CL3XDi7l.js +1 -0
  11. package/web/dist/assets/MetricsView-CR5u5k5n.js +1 -0
  12. package/web/dist/assets/NeedsYouView-BwUvwyVt.js +1 -0
  13. package/web/dist/assets/Overview-DxFOFviB.js +1 -0
  14. package/web/dist/assets/{Pane-B-pz52UC.js → Pane-voa6GU0F.js} +1 -1
  15. package/web/dist/assets/ProjectView-BkNG_qdh.js +1 -0
  16. package/web/dist/assets/ProposalView-G89UmLF5.js +1 -0
  17. package/web/dist/assets/ProposalsView-CzpL-POB.js +1 -0
  18. package/web/dist/assets/RunnersView-SKNIDsjR.js +1 -0
  19. package/web/dist/assets/{SocietyView-DA_65uyo.js → SocietyView-CCFXEYZW.js} +1 -1
  20. package/web/dist/assets/SubjectThread-JQG2FxkA.js +1 -0
  21. package/web/dist/assets/TaskFileView-BKoGmHGz.js +4 -0
  22. package/web/dist/assets/TaskView-BIYqIFU4.js +1 -0
  23. package/web/dist/assets/TasksView-n2ssgQOL.js +1 -0
  24. package/web/dist/assets/ThreadCard-CzQXJXSd.js +1 -0
  25. package/web/dist/assets/{ThreadForms-BipMby65.js → ThreadForms-0LpUc2jJ.js} +1 -1
  26. package/web/dist/assets/ThreadView-_LgGISSH.js +1 -0
  27. package/web/dist/assets/citizen-DvJr6Ibu.js +1 -0
  28. package/web/dist/assets/format-C7bqWt6N.js +55 -0
  29. package/web/dist/assets/index-D4oCtkuZ.css +2 -0
  30. package/web/dist/assets/index-DM00hlle.js +23 -0
  31. package/web/dist/assets/{tasks-DnJj3psB.js → tasks-B4bx7Gg3.js} +1 -1
  32. package/web/dist/assets/{useStickyScroll-D_7q2RKi.js → useStickyScroll-DCsF4GYJ.js} +1 -1
  33. package/web/dist/index.html +4 -4
  34. package/web/dist/assets/BackLink-DivaHiZ7.js +0 -1
  35. package/web/dist/assets/ChannelView-DgkkiZuY.js +0 -1
  36. package/web/dist/assets/CitizenView-BzhH1ycF.js +0 -2
  37. package/web/dist/assets/CitizensView-BzGNyC2f.js +0 -1
  38. package/web/dist/assets/KnowledgeView-DedLlEZd.js +0 -1
  39. package/web/dist/assets/MessageItem-Deq-ntT8.js +0 -1
  40. package/web/dist/assets/MetricsView-C-2j71rI.js +0 -1
  41. package/web/dist/assets/NeedsYouView-D4xqHNDU.js +0 -1
  42. package/web/dist/assets/Overview-DxCYcW_A.js +0 -1
  43. package/web/dist/assets/ProjectView-BhZYFv7f.js +0 -1
  44. package/web/dist/assets/ProposalView-DAc9lEHB.js +0 -1
  45. package/web/dist/assets/ProposalsView-CmwwJuop.js +0 -1
  46. package/web/dist/assets/RunnersView-Dqo_BEoK.js +0 -1
  47. package/web/dist/assets/SubjectThread-M4F1paqV.js +0 -1
  48. package/web/dist/assets/TaskFileView-CCNVrooP.js +0 -4
  49. package/web/dist/assets/TaskView-BTSDk1yL.js +0 -1
  50. package/web/dist/assets/TasksView-0IQm6u-_.js +0 -1
  51. package/web/dist/assets/ThreadCard-BTGP4fOT.js +0 -1
  52. package/web/dist/assets/ThreadView-D96DZAOM.js +0 -1
  53. package/web/dist/assets/citizen-CYBzbWt-.js +0 -1
  54. package/web/dist/assets/format-11lojpK1.js +0 -55
  55. package/web/dist/assets/index-BXq4t0NA.js +0 -23
  56. package/web/dist/assets/index-CKjqsZME.css +0 -2
@@ -1 +1 @@
1
- import{lt as e,ut as t}from"./format-11lojpK1.js";var n=[{phase:`returned`,label:`Sent back`},{phase:`waiting`,label:`Waiting for a holder`},{phase:`working`,label:`Being worked`},{phase:`landing`,label:`Landing`},{phase:`done`,label:`Done`},{phase:`abandoned`,label:`Abandoned`}],r={returned:`bg-orange-500/15 text-orange-300`,waiting:`bg-amber-500/15 text-amber-300`,working:`bg-emerald-500/15 text-emerald-300`,landing:`bg-sky-500/15 text-sky-300`,done:`bg-surface-2 text-fg-secondary`,abandoned:`bg-surface-2 text-fg-muted`};function i(e){return e.status===`done`||e.status===`abandoned`?e.status:e.completing?`landing`:e.returned===void 0?e.status===`claimed`?`working`:`waiting`:`returned`}function a(e,t){let n=i(e);return t.id===e.stage&&n!==`landing`&&n!==`done`&&n!==`abandoned`}function o(e){let t=i(e);return t!==`done`&&t!==`abandoned`}function s(e,t){return e.stages.find(e=>e.id===t)?.name??t}function c(t,n){if(!e(t))return t.action===`approved`?{text:`approved`,tone:r.working}:{text:`rejected`,tone:`bg-red-500/15 text-red-300`};let i=e=>n===void 0?e:s(n,e);if(t.action===`advanced`)return{text:t.to===null?`finished ${i(t.stage)}`:`finished ${i(t.stage)} → ${i(t.to)}`,tone:r.working};if(t.action===`returned`){let e=t.to===null?`an earlier stage`:i(t.to);return{text:`sent back from ${i(t.stage)} to ${e}`,tone:r.returned}}return t.action===`abandoned`?{text:`abandoned`,tone:r.abandoned}:t.action===`landed`?{text:`landed`,tone:r.landing}:{text:`landing failed · back at ${i(t.stage)}`,tone:`bg-red-500/15 text-red-300`}}function l(e){return e.agent===void 0?e.role===void 0?`anyone in the project`:`any ${e.role}`:e.agent}function u(e){return n.map(({phase:t})=>({phase:t,tasks:e.filter(e=>i(e)===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))})).filter(e=>e.tasks.length>0)}function d(e){let n=i(e);return n===`done`?`All ${e.stages.length} stages done`:n===`abandoned`?`Abandoned`:`Stage ${t(e,e.stage)+1} of ${e.stages.length}`}export{o as a,d as c,u as i,s as l,r as n,a as o,l as r,i as s,n as t,c as u};
1
+ import{dt as e,ut as t}from"./format-C7bqWt6N.js";var n=[{phase:`returned`,label:`Sent back`},{phase:`waiting`,label:`Waiting for a holder`},{phase:`working`,label:`Being worked`},{phase:`landing`,label:`Landing`},{phase:`done`,label:`Done`},{phase:`abandoned`,label:`Abandoned`}],r={returned:`bg-orange-500/15 text-orange-300`,waiting:`bg-amber-500/15 text-amber-300`,working:`bg-emerald-500/15 text-emerald-300`,landing:`bg-sky-500/15 text-sky-300`,done:`bg-surface-2 text-fg-secondary`,abandoned:`bg-surface-2 text-fg-muted`};function i(e){return e.status===`done`||e.status===`abandoned`?e.status:e.completing?`landing`:e.returned===void 0?e.status===`claimed`?`working`:`waiting`:`returned`}function a(e,t){let n=i(e);return t.id===e.stage&&n!==`landing`&&n!==`done`&&n!==`abandoned`}function o(e){let t=i(e);return t!==`done`&&t!==`abandoned`}function s(e,t){return e.stages.find(e=>e.id===t)?.name??t}function c(e,n){if(!t(e))return e.action===`approved`?{text:`approved`,tone:r.working}:{text:`rejected`,tone:`bg-red-500/15 text-red-300`};let i=e=>n===void 0?e:s(n,e);if(e.action===`advanced`)return{text:e.to===null?`finished ${i(e.stage)}`:`finished ${i(e.stage)} → ${i(e.to)}`,tone:r.working};if(e.action===`returned`){let t=e.to===null?`an earlier stage`:i(e.to);return{text:`sent back from ${i(e.stage)} to ${t}`,tone:r.returned}}return e.action===`abandoned`?{text:`abandoned`,tone:r.abandoned}:e.action===`landed`?{text:`landed`,tone:r.landing}:{text:`landing failed · back at ${i(e.stage)}`,tone:`bg-red-500/15 text-red-300`}}function l(e){return e.agent===void 0?e.role===void 0?`anyone in the project`:`any ${e.role}`:e.agent}function u(e){return n.map(({phase:t})=>({phase:t,tasks:e.filter(e=>i(e)===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))})).filter(e=>e.tasks.length>0)}function d(t){let n=i(t);return n===`done`?`All ${t.stages.length} stages done`:n===`abandoned`?`Abandoned`:`Stage ${e(t,t.stage)+1} of ${t.stages.length}`}export{o as a,d as c,u as i,s as l,r as n,a as o,l as r,i as s,n as t,c as u};
@@ -1 +1 @@
1
- import{vn as e,xn as t}from"./format-11lojpK1.js";var n=t(e(),1);function r(){let e=(0,n.useRef)(null),t=(0,n.useRef)(!0);return(0,n.useLayoutEffect)(()=>{let n=e.current;n!==null&&t.current&&(n.scrollTop=n.scrollHeight)}),{ref:e,onScroll:()=>{let n=e.current;n!==null&&(t.current=n.scrollHeight-n.scrollTop-n.clientHeight<80)}}}export{r as t};
1
+ import{pn as e,un as t}from"./format-C7bqWt6N.js";var n=e(t(),1);function r(){let e=(0,n.useRef)(null),t=(0,n.useRef)(!0);return(0,n.useLayoutEffect)(()=>{let n=e.current;n!==null&&t.current&&(n.scrollTop=n.scrollHeight)}),{ref:e,onScroll:()=>{let n=e.current;n!==null&&(t.current=n.scrollHeight-n.scrollTop-n.clientHeight<80)}}}export{r as t};
@@ -6,10 +6,10 @@
6
6
  <meta name="color-scheme" content="dark" />
7
7
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
8
  <title>Stellaris</title>
9
- <script type="module" crossorigin src="/assets/index-BXq4t0NA.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/format-11lojpK1.js">
11
- <link rel="modulepreload" crossorigin href="/assets/tasks-DnJj3psB.js">
12
- <link rel="stylesheet" crossorigin href="/assets/index-CKjqsZME.css">
9
+ <script type="module" crossorigin src="/assets/index-DM00hlle.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/format-C7bqWt6N.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/tasks-B4bx7Gg3.js">
12
+ <link rel="stylesheet" crossorigin href="/assets/index-D4oCtkuZ.css">
13
13
  </head>
14
14
  <body class="antialiased">
15
15
  <div id="root"></div>
@@ -1 +0,0 @@
1
- import{_n as e,b as t,wt as n}from"./format-11lojpK1.js";import{L as r,S as i,n as a,r as o,t as s}from"./index-BXq4t0NA.js";var c=e(),l=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function u({fallback:e}){let u=n(),d=r({select:e=>e.location.state.__TSR_index}),f=o(),p=i(),m=t(),h=a(f,d);if(h===null)return e;let g=s(h,{entity:e=>p.get(e)?.title,project:e=>m.data?.find(t=>t.slug===e)?.name});return(0,c.jsx)(`button`,{type:`button`,onClick:()=>u.history.back(),"aria-label":`Back to ${g}`,title:`Back to ${g}`,className:l,children:`←`})}export{u as t};
@@ -1 +0,0 @@
1
- import{D as e,F as t,R as n,Xt as r,_n as i,b as a,h as o,vn as s,xn as c,y as l}from"./format-11lojpK1.js";import{B as u,I as d,c as f,i as p}from"./index-BXq4t0NA.js";import{t as m}from"./MessageItem-Deq-ntT8.js";import{n as h,t as g}from"./Pane-B-pz52UC.js";import{n as _}from"./ThreadCard-BTGP4fOT.js";import{i as v}from"./ThreadForms-BipMby65.js";import{t as y}from"./useStickyScroll-D_7q2RKi.js";var b=c(s(),1),x=i();function S(){let{_splat:e=`general`}=u({from:`/c/$`});return(0,x.jsx)(C,{channel:e},e)}function C({channel:i}){let{api:s}=e(),c=r({queryKey:[`channel`,i],queryFn:()=>s.channel(i)}),u=t(),S=o(),C=a(),w=l(3e4),[T,E]=(0,b.useState)(!1),D=(0,b.useMemo)(()=>{let e=(c.data??[]).map(e=>({kind:`message`,at:e.ts,id:e.id,message:e})),t=(u.data??[]).filter(e=>e.channel===i).map(e=>({kind:`thread`,at:e.openedAt,id:e.id,thread:e}));return[...e,...t].toSorted((e,t)=>e.at.localeCompare(t.at)||e.id.localeCompare(t.id))},[c.data,u.data,i]),O=c.data?.at(-1)?.id??null;(0,b.useEffect)(()=>d(i,O),[i,O]);let{ref:k,onScroll:A}=y(),[j,M]=i.split(`/`),N=M??j??i,P=M===void 0?void 0:C.data?.find(e=>e.slug===j),F=M===void 0?`society`:P?.name??j,I=P?.archived!==void 0,L=D.filter(e=>e.kind===`thread`&&e.thread.state===`open`);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(g,{title:`# ${N}`,subtitle:`${F} · ${c.data?.length??0} messages${L.length>0?` · ${L.length} open threads`:``}`,trailing:T||I?null:(0,x.jsx)(f,{onClick:()=>E(!0),children:`New thread`})}),T?(0,x.jsx)(v,{channel:i,onDone:()=>E(!1)}):null,(0,x.jsx)(`div`,{ref:k,onScroll:A,className:`flex-1 overflow-y-auto py-2`,children:c.error instanceof n&&c.error.status===404?(0,x.jsxs)(h,{children:[`There is no channel `,i,`.`]}):c.data===void 0?(0,x.jsx)(h,{children:`Reading the channel…`}):D.length===0?(0,x.jsx)(h,{children:`Nothing has been said here yet.`}):D.map(e=>e.kind===`message`?(0,x.jsx)(m,{message:e.message,members:S.data,now:w},e.id):(0,x.jsx)(_,{thread:e.thread,now:w},e.id))}),c.data===void 0?null:I?(0,x.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-meta`,children:[F,` is archived, so its channels are read-only.`]}):(0,x.jsx)(p,{target:{channel:i},placeholder:`Message #${N}`})]})}export{S as ChannelView};
@@ -1,2 +0,0 @@
1
- import{D as e,E as t,H as n,I as r,L as i,P as a,R as o,St as s,T as c,_n as l,a as u,d,f,g as p,gn as m,h,st as g,t as _,u as v,v as y,vn as b,w as x,xn as S,y as C}from"./format-11lojpK1.js";import{B as w,S as T,T as E,V as D,_ as O,c as k,f as A,g as ee,h as te,i as ne,m as j,p as M,v as N,x as P,y as F,z as re}from"./index-BXq4t0NA.js";import{t as I}from"./Markdown-MZnGPfvk.js";import{n as L,t as ie}from"./Pane-B-pz52UC.js";import{n as ae,r as R}from"./ThreadForms-BipMby65.js";import{t as oe}from"./useStickyScroll-D_7q2RKi.js";import{a as z,c as B,n as se,o as ce,r as le,s as ue,t as de}from"./citizen-CYBzbWt-.js";var V=S(b(),1),H=l(),fe={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`was interrupted`,blocked:`was blocked`,stopped:`was stopped by you`};function U(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function W({label:e,tone:t,children:n}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`px-0.5 pb-0.5 text-[10px] tracking-wider text-fg-muted uppercase`,children:e}),(0,H.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-md bg-surface-0/60 p-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words ${t}`,children:n})]})}function pe({step:e,open:t}){if(e.kind===`say`)return(0,H.jsx)(`li`,{className:`py-1.5 text-sm`,title:U(e.at),children:(0,H.jsx)(I,{text:e.text})});if(e.kind===`error`)return(0,H.jsx)(`li`,{className:`py-1 font-mono text-xs break-words text-red-400`,title:U(e.at),children:e.message});if(e.kind===`steer`)return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md px-1.5 py-1 text-xs hover:bg-surface-2/40`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`grid w-3 shrink-0 place-items-center text-sky-300`,children:`↳`}),(0,H.jsxs)(`span`,{className:`shrink-0 text-fg-tertiary`,children:[`Took `,te(e.posts.length)]}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:e.from.length===0?``:`from ${e.from.join(`, `)}, delivered mid-turn`}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:U(e.at)})]}),(0,H.jsx)(`ul`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:e.posts.map(e=>(0,H.jsxs)(`li`,{className:`rounded-md bg-surface-0/40 px-2.5 py-2`,children:[(0,H.jsxs)(`p`,{className:`flex gap-1.5 text-meta`,children:[(0,H.jsx)(`span`,{className:`text-fg-secondary`,children:e.author}),(0,H.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`in `,e.where]}),e.at===``?null:(0,H.jsx)(`span`,{className:`ml-auto shrink-0 font-mono`,children:U(e.at)})]}),(0,H.jsx)(`div`,{className:`mt-1 text-sm`,children:(0,H.jsx)(I,{text:e.body})})]},`${e.at}-${e.author}`))})]})});let n=e.ok===null?(0,H.jsx)(`span`,{"aria-label":`running`,className:`size-1.5 animate-pulse rounded-full bg-amber-300`}):e.ok?(0,H.jsx)(`span`,{"aria-label":`succeeded`,className:`text-[11px] text-emerald-400`,children:`✓`}):(0,H.jsx)(`span`,{"aria-label":`failed`,className:`text-[11px] text-red-400`,children:`✕`});return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md px-1.5 py-1 text-xs hover:bg-surface-2/40`,children:[(0,H.jsx)(`span`,{className:`grid w-3 shrink-0 place-items-center`,children:n}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-fg-tertiary`,children:ee(e.name)}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-fg-secondary`,children:e.summary}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:U(e.at)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:[(0,H.jsx)(W,{label:`Input`,tone:`text-fg-secondary`,children:e.detail}),e.output===null?null:(0,H.jsx)(W,{label:e.ok===!1?`Returned an error`:`Returned`,tone:e.ok===!1?`text-red-300`:`text-fg-tertiary`,children:e.output})]})]})})}function G({steps:e}){let[t,n]=(0,V.useState)(!1),r=e.filter(e=>e.kind===`tool`).length;return e.length===0?(0,H.jsx)(`p`,{className:`mt-2 text-meta`,children:`No steps yet.`}):(0,H.jsxs)(H.Fragment,{children:[r===0?null:(0,H.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-meta`,children:[r===1?`1 tool call`:`${r} tool calls`,(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(!t),className:`rounded-md px-1.5 py-0.5 text-fg-tertiary transition-colors hover:bg-surface-2/60 hover:text-fg-primary`,children:t?`Collapse all`:`Expand all`})]}),(0,H.jsx)(`ol`,{className:`mt-1 space-y-0.5`,children:e.map(e=>(0,H.jsx)(pe,{step:e,open:t},e.seq))})]})}function me({turn:e,running:t,now:n}){if(e.end!==null){let t=e.end.costUsd>0?` · $${e.end.costUsd.toFixed(2)}`:``;return(0,H.jsxs)(`section`,{className:`mt-3 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,H.jsxs)(`p`,{className:`text-caps`,children:[`The turn `,fe[e.end.exitReason],` `,_(e.end.at,n),t,e.fromStart?` · ${M(e.startedAt,Date.parse(e.end.at))}`:``]}),e.end.summary===null?null:(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:e.end.summary})]})}return t?(0,H.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-meta`,"aria-live":`polite`,children:[(0,H.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}),`Working · last step `,_(e.lastAt,n)]}):(0,H.jsx)(`p`,{className:`mt-3 text-meta`,children:`The turn ended without a report.`})}var K=30,he={turn:`turn`,board:`board`,merge:`both kept`},ge={turn:`Changed by a turn`,board:`Written by the board`,merge:`Both versions kept`};function _e(e){return e.status===`added`?`new`:e.status===`deleted`?`deleted`:e.added===null||e.removed===null?`binary`:`+${e.added} −${e.removed}`}function ve(e){return e.files.map(e=>`${e.path} ${_e(e)}`).join(`, `)}function ye(e){return e.startsWith(`@@`)||e.startsWith(`\\`)?`text-fg-muted`:e.startsWith(`+`)?`text-emerald-300`:e.startsWith(`-`)?`text-red-300`:`text-fg-tertiary`}function be({file:e}){return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[e.path,e.status===`modified`?``:(0,H.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,e.status]})]}),e.patch===null?(0,H.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown.`}):e.patch===``?(0,H.jsx)(`p`,{className:`mt-1 text-meta`,children:`Empty.`}):(0,H.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto rounded-md bg-surface-0/60 p-2 font-mono text-[11px] leading-relaxed`,children:e.patch.split(`
2
- `).map((e,t)=>(0,H.jsx)(`span`,{className:`block whitespace-pre-wrap break-words ${ye(e)}`,children:e===``?` `:e},t))}),e.truncated?(0,H.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}function xe({name:e,change:t}){let n=v(e,t.commit,!0);return(0,H.jsxs)(`div`,{className:`space-y-3 px-4 pt-1 pb-3`,children:[(0,H.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[t.kind===`merge`?`Two turns on different runners changed the same lines at once. The file kept one turn's version, and this copy holds the other's until the citizen reconciles them.`:t.kind===`board`?`Written by the board: ${t.subject.replace(/^home: /,``)}.`:t.turnId===void 0?t.subject:(0,H.jsx)(s,{to:`/citizen/$name`,params:{name:e},search:{tab:`turns`,turn:t.turnId},className:`text-fg-secondary underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Open the turn that made it`}),(0,H.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,U(t.at)]})]}),n.data===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:n.isError?`Could not read the change.`:`Reading the change…`}):n.data.map(e=>(0,H.jsx)(be,{file:e},e.path))]})}function Se({name:e,change:t,now:n}){let[r,i]=(0,V.useState)(!1),a=t.files.length===0?t.subject:ve(t);return(0,H.jsx)(`li`,{className:`border-b border-line/60 last:border-b-0`,children:(0,H.jsxs)(`details`,{className:`group`,onToggle:e=>i(e.currentTarget.open),children:[(0,H.jsx)(`summary`,{"aria-label":`${ge[t.kind]} ${_(t.at,n)}: ${a}`,className:`block cursor-pointer list-none px-4 py-2.5 transition-colors hover:bg-surface-2/30 group-open:bg-surface-2/20`,children:(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:he[t.kind]}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:a}),(0,H.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:_(t.at,n)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]})}),r?(0,H.jsx)(xe,{name:e,change:t}):null]})})}function Ce({name:e}){let[t,n]=(0,V.useState)(K),r=f(e,t),i=C(3e4);if(r.data===void 0)return(0,H.jsx)(L,{children:r.isError?`Could not read the home's history.`:`Reading the history…`});let{changes:a,more:o}=r.data;return a.length===0?(0,H.jsxs)(L,{children:[e,`'s home has no history yet; it starts with the citizen's first turn.`]}):(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,H.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,children:[`What `,e,`'s turns changed in its memory, skills, and profile, newest first.`]}),(0,H.jsx)(`ol`,{children:a.map(t=>(0,H.jsx)(Se,{name:e,change:t,now:i},t.commit))}),o?(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(t+K),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:`Show earlier changes`}):null]})}function q({title:e,children:t}){return(0,H.jsxs)(`section`,{className:`border-t border-line pt-4 first:border-t-0 first:pt-0`,children:[(0,H.jsx)(`h3`,{className:`text-section`,children:e}),(0,H.jsx)(`div`,{className:`mt-2`,children:t})]})}function we({member:e,charter:t}){let n=p(e.name),r=u(e.name),i=d(e.name),a=C(3e4);return(0,H.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[i.data===void 0||i.data.length===0?null:(0,H.jsxs)(q,{title:`Edits to reconcile`,children:[(0,H.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`Two turns on different runners changed these files at once. Each file kept one version; the other waits beside it until `,e.name,` merges it in and deletes the copy.`]}),(0,H.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:i.data.map(e=>(0,H.jsxs)(`li`,{className:`text-sm`,children:[(0,H.jsx)(`span`,{className:`text-fg-primary`,children:e.file}),(0,H.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.path.slice(e.path.lastIndexOf(`/`)+1),` · left`,` `,_(e.since,a)]})]},e.path))})]}),(0,H.jsx)(q,{title:`Profile`,children:e.profile.trim()===``?(0,H.jsx)(`p`,{className:`text-meta`,children:`No profile yet. The citizen writes its own profile.md.`}):(0,H.jsx)(I,{text:B(e.profile,`Profile`)})}),(0,H.jsx)(q,{title:`Core memory`,children:n.data===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):n.data.body.trim()===``?(0,H.jsx)(`p`,{className:`text-meta`,children:`Empty. Every turn loads this file in full.`}):(0,H.jsx)(I,{text:B(n.data.body,`Core memory`)})}),(0,H.jsx)(q,{title:`Own skills`,children:r.data===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):r.data.length===0?(0,H.jsx)(`p`,{className:`text-meta`,children:`None yet.`}):(0,H.jsx)(`ul`,{className:`space-y-1.5`,children:r.data.map(e=>(0,H.jsxs)(`li`,{className:`text-sm`,children:[(0,H.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,H.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]},e.name))})}),t===void 0?null:(0,H.jsxs)(q,{title:`Charter of ${t.name}`,children:[(0,H.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:t.purpose}),(0,H.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Wakes on mentions, stages, and `,t.wakeTriggers.join(`, `)||`nothing else`,t.resident?` · keeps a warm session`:``,t.reflects?` · reflects`:``]}),(0,H.jsx)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:t.verbs.map(e=>(0,H.jsx)(`span`,{className:`rounded-md bg-surface-2/70 px-1.5 py-px font-mono text-[11px] text-fg-tertiary`,children:e},e))})]})]})}function J(e,t){let n=r(e,t?.turnId??null);return{turn:(0,V.useMemo)(()=>t===void 0||n.data===void 0?void 0:O(n.data,e,t.project,t.thread),[t,n.data,e]),loading:t?.turnId!==void 0&&n.isPending,missing:t!==void 0&&(t.turnId===void 0||n.isError)}}var Y=50;function Te({name:e,entry:t,cli:n,now:r,opened:i}){let[a,o]=(0,V.useState)(i),s=(0,V.useRef)(null);(0,V.useEffect)(()=>{i&&s.current?.scrollIntoView({block:`start`})},[i]);let c=T(),l=ce(t),u=t.thread===void 0?null:c.get(t.thread)?.title??`a thread`,d=t.error??t.summary??``,f=t.error===null?`text-fg-secondary`:`text-red-300`;return(0,H.jsx)(`li`,{ref:s,className:`border-b border-line/60 last:border-b-0`,children:(0,H.jsxs)(`details`,{className:`group`,open:a,onToggle:e=>o(e.currentTarget.open),children:[(0,H.jsxs)(`summary`,{className:`block cursor-pointer list-none px-4 py-2.5 transition-colors hover:bg-surface-2/30 group-open:bg-surface-2/20`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:[z(t.project),u===null?``:` · ${u}`]}),(0,H.jsx)(`span`,{className:`text-fg-muted`,children:t.trigger}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-fg-muted`,children:[se(t),` `,_(t.ts,r)]}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,children:[l,t.toolCalls===void 0?null:`${t.toolCalls} tools`,de(t,n)].filter(e=>e!==null).join(` · `)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]}),d.trim()===``?null:(0,H.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-xs leading-relaxed group-open:hidden ${f}`,children:(0,H.jsx)(P,{text:d,links:!1})})]}),a?(0,H.jsx)(Ee,{name:e,entry:t,text:d,tone:f}):null]})})}function Ee({name:e,entry:t,text:n,tone:r}){let i=J(e,t);return(0,H.jsxs)(`div`,{className:`px-4 pt-1 pb-3`,children:[n.trim()===``?null:(0,H.jsx)(`p`,{className:`text-xs leading-relaxed whitespace-pre-wrap ${r}`,children:(0,H.jsx)(P,{text:n})}),(0,H.jsx)(`div`,{className:`mt-2`,children:t.turnId===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`This turn ran before turns kept their steps.`}):i.loading?(0,H.jsx)(`p`,{className:`text-meta`,children:`Reading the steps…`}):i.turn===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`No steps were kept for this turn.`}):(0,H.jsxs)(H.Fragment,{children:[t.startedAt===void 0?null:(0,H.jsxs)(`p`,{className:`text-caps`,children:[`Started `,U(t.startedAt)]}),(0,H.jsx)(G,{steps:i.turn.steps})]})})]})}function De({name:e,cli:t,opened:n}){let[r,a]=(0,V.useState)(Y),o=i(e,r),s=C(3e4);if(o.data===void 0)return(0,H.jsx)(L,{children:`Reading the turns…`});let c=o.data.toReversed();if(c.length===0)return(0,H.jsxs)(L,{children:[e,` has not finished a turn yet.`]});let l=le(c),u=t===`codex`?`unmetered`:`$${l.costUsd.toFixed(2)}`;return(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,H.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,children:[l.turns===1?`1 turn`:`${l.turns} turns`,l.failed===0?``:`, ${l.failed} not completed`,` · `,u]}),n!==null&&!c.some(e=>e.turnId===n)?(0,H.jsx)(`p`,{className:`px-4 pb-1 text-meta`,children:o.data.length===r?`The turn this address opens is further back; show earlier turns to reach it.`:`The turn this address opens is not in this citizen's history.`}):null,(0,H.jsx)(`ol`,{children:c.map(r=>(0,H.jsx)(Te,{name:e,entry:r,cli:t,now:s,opened:n!==null&&r.turnId===n},r.id))}),o.data.length===r?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(r+Y),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show `,Y,` earlier turns`]}):null]})}function Oe(e){return e===void 0?``:`${e.name}${e.id===null?``:` · ${e.id}`}`}function X({label:e,choices:t,value:n,onChange:r}){let[i,a]=(0,V.useState)(!1),o=(0,V.useRef)(null),s=(0,V.useRef)(null),c=(0,V.useRef)([]),l=t.findIndex(e=>e.value===n);(0,V.useEffect)(()=>{if(!i)return;c.current[Math.max(l,0)]?.focus();let e=e=>{e.target instanceof Node&&o.current?.contains(e.target)===!0||a(!1)};return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[i,l]);let u=e=>{if(e.key===`Escape`){e.stopPropagation(),a(!1),s.current?.focus();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=(c.current.findIndex(e=>e===document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length;c.current[n]?.focus()},d=t[l];return(0,H.jsxs)(`div`,{ref:o,className:`relative min-w-0 flex-1`,children:[(0,H.jsxs)(`button`,{ref:s,type:`button`,"aria-label":`${e}: ${Oe(d)}`,"aria-expanded":i,onClick:()=>a(!i),onKeyDown:i?u: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,H.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:[d?.name,d?.id===null||d===void 0?null:(0,H.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,d.id]})]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] text-fg-muted transition-transform ${i?`rotate-180`:``}`,children:`▾`})]}),i?(0,H.jsx)(`div`,{className:`absolute inset-x-0 top-full z-20 mt-1 max-h-80 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`,children:t.map((e,t)=>{let i=e.value===n;return(0,H.jsxs)(`button`,{ref:e=>{c.current[t]=e},type:`button`,"aria-current":i?`true`:void 0,onKeyDown:u,onClick:()=>{r(e.value),a(!1),s.current?.focus()},className:`flex w-full items-start gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors focus-visible:outline-none ${i?`bg-surface-2/80`:`hover:bg-surface-2/50 focus-visible:bg-surface-2/50`}`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`block truncate text-xs text-fg-secondary`,children:[e.name,e.id===null?null:(0,H.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,e.id]})]}),e.description===``?null:(0,H.jsx)(`span`,{className:`block truncate text-[11px] text-fg-muted`,children:e.description})]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 shrink-0 pt-px text-[11px] text-fg-primary`,children:i?`✓`:``})]},e.value)})}):null]})}var Z=``;function ke(e,t){return[{value:Z,name:`CLI default`,id:e.find(e=>e.isDefault)?.name??null,description:`Whatever the CLI runs when no model is set.`},...e.map(e=>({value:e.id,name:e.name,id:e.name===e.id?null:e.id,description:e.description})),...t===null?[]:[{value:t,name:t,id:null,description:`Not in the CLI's list.`}]]}function Ae({member:t,onDone:n}){let{api:r}=e(),i=m(),a=y(t.cli),s=t.model??Z,[c,l]=(0,V.useState)(s),u=D({mutationFn:()=>r.setModel(t.name,c===Z?null:c),onSuccess:()=>{i.invalidateQueries({queryKey:[`members`]}),n()}}),d=a.data??[],f=t.model!==void 0&&!d.some(e=>e.id===t.model)?t.model:null;return(0,H.jsxs)(`form`,{"aria-label":`Model of ${t.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),u.mutate()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.isPending?(0,H.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Asking `,t.cli,` for its models…`]}):a.error===null?(0,H.jsx)(X,{label:`Model`,choices:ke(d,f),value:c,onChange:l}):(0,H.jsxs)(`p`,{role:`alert`,className:`min-w-0 flex-1 truncate text-xs text-red-400`,children:[t.cli,` did not list its models:`,` `,a.error instanceof o?a.error.message:`the board server did not answer`]}),(0,H.jsx)(k,{onClick:n,children:`Cancel`}),(0,H.jsx)(k,{variant:`primary`,type:`submit`,disabled:u.isPending||c===s||a.error!==null,children:u.isPending?`Saving…`:`Use this model`})]}),(0,H.jsx)(R,{error:u.error})]})}var Q=``;function je(e,t){let n=t.cli;return[e.status,e.clis.length===0?`offers no CLI yet`:e.clis.join(`, `),n!==null&&e.clis.length>0&&!e.clis.includes(n)?`has no ${n}`:``,e.capabilities.length===0?``:e.capabilities.join(`, `)].filter(e=>e!==``).join(` · `)}function Me(e,t){return[{value:Q,name:`Any runner`,id:null,description:`Pinned to the least busy runner on its next turn outside a project.`},...e.map(e=>({value:e.name,name:e.name,id:e.os,description:je(e,t)}))]}function Ne({member:t,onDone:n}){let{api:r}=e(),i=m(),a=c(),o=t.homeRunner??Q,[s,l]=(0,V.useState)(o),u=D({mutationFn:()=>r.setRunner(t.name,s===Q?null:s),onSuccess:()=>{i.invalidateQueries({queryKey:[`members`]}),n()}});return(0,H.jsxs)(`form`,{"aria-label":`Runner of ${t.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),u.mutate()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.data===void 0?(0,H.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`Reading the runners…`}):(0,H.jsx)(X,{label:`Runner`,choices:Me(a.data,t),value:s,onChange:l}),(0,H.jsx)(k,{onClick:n,children:`Cancel`}),(0,H.jsx)(k,{variant:`primary`,type:`submit`,disabled:u.isPending||s===o,children:u.isPending?`Saving…`:`Run here`})]}),(0,H.jsx)(`p`,{className:`text-meta`,children:`Its conversations outside projects start afresh there from its next turn; its memory and skills follow it. Project work runs where each project lives.`}),(0,H.jsx)(R,{error:u.error})]})}function Pe(e){return e.thread===void 0?{channel:e.channel??(e.scope===`society`?`general`:`${e.scope}/general`)}:{threadId:e.thread}}function Fe({name:t,turn:n}){let{api:r}=e(),i=m(),[a,o]=(0,V.useState)(!1),s=D({mutationFn:()=>r.stopTurn(n.turnId),onSuccess:()=>{o(!1),i.invalidateQueries({queryKey:[`scheduler`]})}});return(0,H.jsxs)(`div`,{className:`border-t border-line`,children:[(0,H.jsx)(ne,{target:Pe(n),initialText:`@${t} `,placeholder:n.steerable?`Message ${t} while it works`:`Message ${t} for its next turn`,className:`px-3 pt-3 pb-2`},n.turnId),n.stoppable?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-3`,children:[(0,H.jsx)(`p`,{className:`min-w-0 flex-1 text-[11px] leading-snug text-fg-muted`,children:a?`Ends the turn now. What it was shown counts as read; its stages stay held.`:n.steerable?`Posts reach the turn at its next step.`:`This runner delivers posts after the turn ends.`}),a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(k,{onClick:()=>{o(!1),s.reset()},children:`Keep it running`}),(0,H.jsx)(k,{variant:`primary`,disabled:s.isPending,onClick:()=>{s.mutate()},children:s.isPending?`Stopping…`:`Stop the turn`})]}):(0,H.jsx)(k,{onClick:()=>o(!0),children:`Stop…`})]}):null,s.error===null?null:(0,H.jsx)(`div`,{className:`px-3 pb-3`,children:(0,H.jsx)(R,{error:s.error})})]})}function Ie({member:t,scopes:n,preferred:r,running:i,paused:a,onDone:o}){let{api:s}=e(),c=m(),[l,u]=(0,V.useState)(`manual`),[d,f]=(0,V.useState)(r!==null&&n.includes(r)?r:n[0]??``),[p,h]=(0,V.useState)(``),g=(0,V.useRef)(null);(0,V.useEffect)(()=>g.current?.focus(),[]);let _=D({mutationFn:()=>s.wake({agent:t.name,project:d,kind:l,...p.trim()===``?{}:{reason:p.trim()}}),onSuccess:()=>{c.invalidateQueries({queryKey:[`scheduler`]}),o()}}),v=z(d),y=l===`reflection`?`Asks ${t.name} to reflect at ${v}: consolidate its memory, skills, and profile, and take no new work. It restarts the reflection clock.`:`Starts a turn for ${t.name} at ${v} as soon as the scheduler takes it.`,b=a?` The society is paused, so it waits until you resume.`:i.includes(d)?` ${t.name} is in a turn there now; this one follows it.`:``;return(0,H.jsxs)(`form`,{"aria-label":`Wake ${t.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,H.jsx)(`legend`,{className:`sr-only`,children:`Kind of turn`}),[`manual`,`reflection`].map(e=>(0,H.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${l===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:l===e,onChange:()=>u(e),className:`sr-only`}),e===`manual`?`A turn`:`A reflection`]},e))]}),(0,H.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-xs text-fg-tertiary`,children:[`at`,(0,H.jsx)(`select`,{value:d,onChange:e=>f(e.target.value),"aria-label":`Where`,className:`rounded-md bg-surface-2/60 px-2 py-1 text-xs text-fg-primary outline-none`,children:n.map(e=>(0,H.jsx)(`option`,{value:e,children:z(e)},e))})]})]}),(0,H.jsx)(`textarea`,{ref:g,value:p,rows:2,placeholder:l===`reflection`?`Anything to reflect on in particular? Optional.`:`What should it look at? It reads this as the reason it was woken.`,"aria-label":`Reason`,onChange:e=>h(e.target.value),className:`${ae} resize-none`}),(0,H.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[y,b,` Each turn costs money.`]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,H.jsx)(k,{onClick:o,children:`Cancel`}),(0,H.jsx)(k,{variant:`primary`,type:`submit`,disabled:_.isPending||d===``,children:_.isPending?`Waking…`:l===`reflection`?`Ask for a reflection`:`Wake ${t.name}`})]}),(0,H.jsx)(R,{error:_.error})]})}var Le={working:`bg-emerald-500/15 text-emerald-300`,queued:`bg-amber-500/15 text-amber-300`,idle:`bg-surface-2 text-fg-tertiary`};function Re({project:e,name:t}){let n=(a(e).data??[]).filter(e=>e.status===`claimed`&&e.claimedBy===t);return n.length===0?null:(0,H.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:n.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(s,{to:`/task/$taskId`,params:{taskId:e.id},className:`flex items-center gap-2 rounded-md text-xs text-fg-secondary hover:text-fg-primary`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,H.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate font-mono text-[11px] text-fg-muted`,children:g(e)?.name??e.stage})]})},e.id))})}function ze(){let{name:e}=w({from:`/citizen/$name`}),{scope:t,tab:n,turn:r}=re({from:`/citizen/$name`});return(0,H.jsx)(Ve,{name:e,chosen:t??null,tab:n??`now`,turn:r??null},e)}var Be=[{tab:`now`,label:`Now`},{tab:`turns`,label:`Turns`},{tab:`memory`,label:`Memory`},{tab:`history`,label:`History`}];function Ve({name:e,chosen:r,tab:i,turn:a}){let o=h(),c=x(),l=t(),u=F(),[d,f]=(0,V.useState)(null),p=o.data?.find(t=>t.name===e);if(p===void 0)return(0,H.jsx)(L,{children:o.data===void 0?`Reading the roster…`:`There is no citizen ${e}.`});let m=n(l.data?.running??[]).filter(t=>t.agent===e),g=[...new Set(m.map(e=>e.scope))],_=m.map(e=>j(e.agent,e.scope,e.thread)),v=n(l.data?.pending??[]).find(t=>t.agent===e),y=g.length>0?`working`:v===void 0?`idle`:`queued`,b=N(u,e)[0],S=b?.model??p.lastModel,C=S??p.model??`CLI default`,w=p.model!==void 0&&p.model!==S?p.model:null,T=c.data?.find(e=>e.name===p.role),D=ue(p),O=p.status===`active`&&p.cli!==null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ie,{leading:p.cli===null?null:(0,H.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2/70`,children:(0,H.jsx)(E,{cli:p.cli,size:20})}),title:e,subtitle:(0,H.jsxs)(H.Fragment,{children:[p.role,` · `,C,w===null?``:` · set to ${w}`,p.homeRunner===void 0?``:` · on ${p.homeRunner}`,p.status===`retired`?` · retired`:``]}),trailing:(0,H.jsxs)(H.Fragment,{children:[O&&d===null?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(k,{onClick:()=>f(`model`),children:`Model…`}),(0,H.jsx)(k,{onClick:()=>f(`runner`),children:`Runner…`}),(0,H.jsx)(k,{onClick:()=>f(`wake`),children:`Wake…`})]}):null,(0,H.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${Le[y]}`,children:y})]})}),d===`wake`?(0,H.jsx)(Ie,{member:p,scopes:D,preferred:r?.split(`/`)[0]??b?.scope??null,running:g,paused:l.data?.paused??!1,onDone:()=>f(null)}):d===`model`?(0,H.jsx)(Ae,{member:p,onDone:()=>f(null)}):d===`runner`?(0,H.jsx)(Ne,{member:p,onDone:()=>f(null)}):null,(0,H.jsx)(`nav`,{"aria-label":`Citizen views`,className:`flex gap-1 border-b border-line px-3 py-2`,children:Be.map(t=>(0,H.jsx)(s,{to:`/citizen/$name`,params:{name:e},search:{...r===null?{}:{scope:r},...t.tab===`now`?{}:{tab:t.tab}},replace:!0,"aria-current":t.tab===i?`page`:void 0,className:`rounded-md px-2.5 py-1 text-xs transition-colors ${t.tab===i?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:t.label},t.tab))}),i===`turns`?(0,H.jsx)(De,{name:e,cli:p.cli,opened:a},a):i===`memory`?(0,H.jsx)(we,{member:p,charter:T}):i===`history`?(0,H.jsx)(Ce,{name:e}):(0,H.jsx)(He,{name:e,chosen:r,lastTurnAt:p.lastTurnAt,state:y,runningScopes:g,runningKeys:_,runningTurns:(l.data?.turns??[]).filter(t=>t.agent===e),queuedScope:v?.scope??null})]})}function $(e){return e.toSorted((e,t)=>e.startedAt.localeCompare(t.startedAt))[0]}function He({name:e,chosen:t,lastTurnAt:n,state:r,runningScopes:a,runningKeys:o,runningTurns:c,queuedScope:l}){let u=F(),d=C(5e3),{ref:f,onScroll:p}=oe(),m=N(u,e),h=i(e,1),g=J(e,m.length===0?h.data?.at(-1):void 0),v=T(),y=e=>e.end===null&&o.includes(j(e.agent,e.scope,e.thread)),b=t?.split(`/`)[0]??null,x=(t?.includes(`/`)===!0?m.find(e=>A(e)===t):void 0)??$(m.filter(e=>e.scope===b&&y(e)))??m.find(e=>A(e)===t)??$(m.filter(y))??m[0]??g.turn,S=e=>e.thread===void 0?z(e.scope):`${z(e.scope)} · ${v.get(e.thread)?.title??`a thread`}`,w=x!==void 0&&y(x),E=x?.scope??a[0]??l,D=(x===void 0?void 0:c.find(e=>e.scope===x.scope&&e.thread===x.thread))??(w?void 0:c[0]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`border-b border-line px-4 py-3 text-xs text-fg-tertiary`,children:[(0,H.jsx)(`p`,{children:w?`In a turn at ${z(x.scope)} for ${x.fromStart?``:`at least `}${M(x.startedAt,d)}`:a.length>0?`In a turn at ${a.map(z).join(` and `)}`:l===null?n===void 0?`No turns yet`:`Last turn ${_(n,d)}`:`Queued for a turn at ${z(l)}`}),E===null||E===`society`?null:(0,H.jsx)(Re,{project:E,name:e})]}),(0,H.jsx)(`div`,{ref:f,onScroll:p,className:`flex-1 overflow-y-auto px-4 py-3`,children:x===void 0?(0,H.jsx)(L,{children:r===`working`?`The turn has not reported a step yet.`:g.loading?`Reading the last turn…`:n===void 0?`${e} has not taken a turn yet.`:`${e}'s last turn kept no steps; Turns lists every finished one.`}):(0,H.jsxs)(H.Fragment,{children:[m.length>1?(0,H.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,"aria-label":`Turns by conversation`,children:m.toSorted((e,t)=>A(e).localeCompare(A(t))).map(t=>(0,H.jsxs)(s,{to:`/citizen/$name`,params:{name:e},search:{scope:A(t)},replace:!0,"aria-current":t===x?`true`:void 0,className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[11px] transition-colors ${t===x?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[y(t)?(0,H.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}):null,S(t)]},A(t)))}):null,(0,H.jsxs)(`p`,{className:`text-caps`,children:[w?`This turn`:`Last turn`,` · `,S(x),` · started`,` `,x.fromStart?U(x.startedAt):`before the earliest step shown`]}),x.fromStart?null:(0,H.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`Earlier steps of this turn are no longer in the server's live buffer`,w?``:`; Turns has the whole turn`,`.`]}),(0,H.jsx)(G,{steps:x.steps}),(0,H.jsx)(me,{turn:x,running:w,now:d})]})}),D===void 0?null:(0,H.jsx)(Fe,{name:e,turn:D})]})}export{ze as CitizenView};
@@ -1 +0,0 @@
1
- import{E as e,H as t,St as n,_n as r,b as i,h as a}from"./format-11lojpK1.js";import{T as o}from"./index-BXq4t0NA.js";import{n as s,t as c}from"./Pane-B-pz52UC.js";import{a as l,i as u}from"./citizen-CYBzbWt-.js";var d=r();function f(e){let t=e.lastModel??e.model??`CLI default`;return e.model!==void 0&&e.model!==t?`${t} · set to ${e.model}`:t}function p(e,t){return e.name.localeCompare(t.name)}function m(e,t){return e.role.localeCompare(t.role)||p(e,t)}function h(){let r=a(),h=e(),g=i();if(r.data===void 0)return(0,d.jsx)(s,{children:`Reading the roster…`});let _=r.data.filter(e=>e.cli!==null),v=_.filter(e=>e.status===`active`).toSorted(m),y=_.filter(e=>e.status!==`active`).toSorted(p),b=new Set(v.map(e=>e.role)).size,x=t(h.data?.running??[]),S=t(h.data?.pending??[]),C=new Map((g.data??[]).flatMap(e=>e.runner===void 0?[]:[[e.slug,e.runner]])),w=e=>{let t=[...new Set(x.filter(t=>t.agent===e.name).map(e=>e.scope))];return t.length>0?{label:`working`,detail:`in a turn at ${t.map(l).join(` and `)}`,tone:`text-emerald-300`}:S.some(t=>t.agent===e.name)?{label:`queued`,detail:`queued for a turn`,tone:`text-amber-300`}:{label:`resting`,detail:`resting`,tone:`text-fg-muted`}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c,{title:`Citizens`,subtitle:`${v.length} active in ${b===1?`1 role`:`${b} roles`}${y.length===0?``:` · ${y.length} retired`}`}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[v.length===0?(0,d.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No citizens yet. Ask the concierge for one.`}):null,(0,d.jsx)(`ul`,{className:`grid grid-cols-[auto_auto_auto_minmax(0,max-content)_auto_minmax(3rem,1fr)_auto] gap-x-3`,children:v.map(e=>{let t=w(e),r=f(e),i=e.memberships.length===0?`no projects`:e.memberships.join(`, `),a=u(e,C);return(0,d.jsx)(`li`,{className:`col-span-full grid grid-cols-subgrid`,children:(0,d.jsxs)(n,{to:`/citizen/$name`,params:{name:e.name},className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-surface-2/50`,children:[(0,d.jsx)(`span`,{className:`grid size-4 place-items-center`,children:e.cli===null?null:(0,d.jsx)(o,{cli:e.cli,size:13})}),(0,d.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,d.jsx)(`span`,{className:`text-fg-secondary`,children:e.role}),(0,d.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,d.jsx)(`span`,{className:`text-xs text-fg-muted`,title:a.detail,children:a.label}),(0,d.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:i,children:i}),(0,d.jsx)(`span`,{className:`text-right text-xs ${t.tone}`,title:t.detail,children:t.label})]})},e.name)})}),y.length===0?null:(0,d.jsxs)(`p`,{className:`mt-2 border-t border-line px-2 pt-2 text-meta`,children:[`Retired: `,y.map(e=>`${e.name} (${e.role})`).join(`, `)]})]})]})}export{h as CitizensView};
@@ -1 +0,0 @@
1
- import{St as e,_n as t,at as n,b as r,p as i,t as a,y as o}from"./format-11lojpK1.js";import{B as s}from"./index-BXq4t0NA.js";import{t as c}from"./Markdown-MZnGPfvk.js";import{n as l,t as u}from"./Pane-B-pz52UC.js";import{t as d}from"./BackLink-DivaHiZ7.js";var f=t(),p=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function m(){let{scope:t,topic:m}=s({from:`/knowledge/$scope/$topic`}),h=i(t),g=r(),_=o(3e4),v=t===n,y=v?`the society`:g.data?.find(e=>e.slug===t)?.name??t,b=h.data?.find(e=>e.topic===m),x=v?(0,f.jsx)(e,{to:`/society`,"aria-label":`Back to the society`,className:p,children:`←`}):(0,f.jsx)(e,{to:`/p/$slug`,params:{slug:t},"aria-label":`Back to ${y}`,className:p,children:`←`});return b===void 0?(0,f.jsx)(l,{children:h.data===void 0?`Reading…`:`${y} has no topic ${m}.`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u,{leading:(0,f.jsx)(d,{fallback:x}),title:b.topic,subtitle:`Knowledge of ${y} · written by ${b.updatedBy} ${a(b.updatedAt,_)}`}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:(0,f.jsx)(c,{text:b.body})})]})}export{m as KnowledgeView};
@@ -1 +0,0 @@
1
- import{_n as e,t,vn as n,xn as r}from"./format-11lojpK1.js";import{u as i}from"./tasks-DnJj3psB.js";import{d as a,l as o}from"./index-BXq4t0NA.js";import{t as s}from"./Markdown-MZnGPfvk.js";var c=r(n(),1),l=e(),u=1400;function d({message:e,members:n,now:r,task:d}){let f=e.body.length>u,[p,m]=(0,c.useState)(!1),h=e.author===`board`,g=e.step===void 0?null:i(e.step,d);return(0,l.jsxs)(`article`,{className:`flex gap-3 px-4 py-2.5 ${h?`opacity-70`:``}`,children:[(0,l.jsx)(o,{name:e.author,members:n}),(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsxs)(`header`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,l.jsx)(`span`,{className:`text-title`,children:a(e.author)}),g===null?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate rounded-md px-1.5 py-px text-[11px] ${g.tone}`,children:g.text}),(0,l.jsx)(`time`,{dateTime:e.ts,title:e.ts,className:`shrink-0 text-meta`,children:t(e.ts,r)})]}),(0,l.jsxs)(`div`,{className:f&&!p?`relative max-h-72 overflow-hidden`:``,children:[(0,l.jsx)(s,{text:e.body}),f&&!p?(0,l.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-16 bg-linear-to-t from-surface-1 to-transparent`}):null]}),f?(0,l.jsx)(`button`,{type:`button`,onClick:()=>m(!p),className:`mt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:p?`Show less`:`Show more`}):null]})]})}export{d as t};
@@ -1 +0,0 @@
1
- import{R as e,St as t,_ as n,_n as r,r as i,t as a,y as o}from"./format-11lojpK1.js";import{b as s,d as c,z as l}from"./index-BXq4t0NA.js";import{n as u,t as d}from"./Pane-B-pz52UC.js";import{n as f}from"./Overview-DxCYcW_A.js";var p=r(),m=[{window:`24h`,label:`24 hours`},{window:`7d`,label:`7 days`},{window:`all`,label:`All time`}],h={stage:`a stage to take`,mention:`a mention`,user_post:`your post`,heartbeat:`a heartbeat`,task_done:`a finished task`,proposal_decided:`a decided proposal`,ops_event:`a signal`,onboarding:`joining`,manual:`your wake`},g=new Intl.DateTimeFormat(`en`,{month:`short`,day:`numeric`,timeZone:`UTC`});function _(e,t){return t===0?``:`${Math.round(e/t*100)}%`}function v(e){return e.toFixed(1).replace(/\.0$/,``)}function y({part:e,whole:t}){return(0,p.jsxs)(p.Fragment,{children:[e,(0,p.jsx)(`span`,{className:`ml-1.5 inline-block w-9 text-right text-fg-muted`,children:e===0?``:_(e,t)})]})}function b({children:e}){return(0,p.jsx)(`p`,{className:`text-sm text-fg-primary`,children:e})}function x({children:e}){return(0,p.jsx)(`p`,{className:`mt-1 text-meta`,children:e})}function S({label:e,columns:t,rows:n}){return n.length===0?null:(0,p.jsxs)(`table`,{"aria-label":e,className:`mt-3 w-full table-fixed text-sm`,children:[(0,p.jsxs)(`colgroup`,{children:[(0,p.jsx)(`col`,{}),t.slice(1).map(e=>(0,p.jsx)(`col`,{className:`w-24`},e))]}),(0,p.jsx)(`thead`,{children:(0,p.jsx)(`tr`,{children:t.map((e,t)=>(0,p.jsx)(`th`,{scope:`col`,className:`text-caps pb-1 font-normal ${t===0?`text-left`:`text-right`}`,children:e},e))})}),(0,p.jsx)(`tbody`,{children:n.map((e,t)=>(0,p.jsx)(`tr`,{className:`border-t border-line/50`,children:e.map((e,t)=>(0,p.jsx)(`td`,{className:`py-1.5 ${t===0?`pr-3 text-fg-primary`:`text-right text-fg-secondary tabular-nums`}`,children:e},t))},t))})]})}function C({name:e}){return e===`user`?(0,p.jsx)(`span`,{children:c(e)}):(0,p.jsx)(t,{to:`/citizen/$name`,params:{name:e},className:`hover:underline`,children:e})}function w(e){return e.window===`24h`?1:e.window===`7d`?7:Math.max(1,e.decisions.byDay.length)}function T(){let{window:r=`7d`}=l({from:`/metrics`}),c=n(r),T=o(6e4),E=(0,p.jsx)(`nav`,{"aria-label":`Window`,className:`flex shrink-0 gap-1`,children:m.map(e=>(0,p.jsx)(t,{to:`/metrics`,search:{window:e.window},"aria-current":e.window===r?`page`:void 0,className:`rounded-md px-2 py-1 text-xs transition-colors ${e.window===r?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`}`,children:e.label},e.window))}),D=(0,p.jsx)(d,{title:`Metrics`,subtitle:`How the society works, counted from its event log`,trailing:E});if(c.data===void 0)return(0,p.jsxs)(p.Fragment,{children:[D,(0,p.jsx)(u,{children:c.error instanceof e?c.error.message:`Counting the event log…`})]});let{idle:O,sentBack:k,messages:A,latency:j,decisions:M,blocked:N}=c.data,P=w(c.data);return(0,p.jsxs)(p.Fragment,{children:[D,(0,p.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,p.jsxs)(f,{title:`Turns that did nothing`,children:[O.turns===0?(0,p.jsx)(x,{children:`No finished turns in this window.`}):(0,p.jsxs)(b,{children:[O.idle,` of `,O.turns,` turns changed nothing on the board`,` `,(0,p.jsx)(`span`,{className:`text-fg-muted`,children:_(O.idle,O.turns)})]}),(0,p.jsxs)(x,{children:[`A turn that took no board action: no post, claim, handover, plan, proposal, decision, or knowledge. Reflections are left out, since they write memory.`,O.unknown>0?` ${O.unknown} ${O.unknown===1?`turn`:`turns`} kept no transcript and could not be counted.`:``]}),(0,p.jsx)(S,{label:`By what woke them`,columns:[`Woken by`,`Turns`,`Did nothing`],rows:O.byTrigger.map(e=>[h[e.trigger]??e.trigger,e.turns,(0,p.jsx)(y,{part:e.idle,whole:e.turns},`idle`)])}),(0,p.jsx)(S,{label:`By citizen`,columns:[`Citizen`,`Turns`,`Did nothing`],rows:O.byAgent.map(e=>[(0,p.jsxs)(`span`,{children:[(0,p.jsx)(C,{name:e.agent}),e.role===null?null:(0,p.jsxs)(`span`,{className:`text-meta`,children:[` · `,e.role]})]},`who`),e.turns,(0,p.jsx)(y,{part:e.idle,whole:e.turns},`idle`)])})]}),(0,p.jsxs)(f,{title:`Work sent back`,children:[k.finished===0?(0,p.jsx)(x,{children:`No task finished in this window.`}):(0,p.jsxs)(b,{children:[k.tasksSentBack,` of `,k.finished,` finished tasks were sent back,`,` `,k.sendBacks,` `,k.sendBacks===1?`time`:`times`,` in all`]}),(0,p.jsx)(S,{label:`Where work came back from`,columns:[`Came back from`,`Times`],rows:k.byStage.map(e=>[`${e.project} · ${e.stage}`,e.count])}),(0,p.jsx)(S,{label:`Who sent work back`,columns:[`Sent back by`,`Times`],rows:k.bySender.map(e=>[(0,p.jsx)(C,{name:e.agent},`who`),e.count])})]}),(0,p.jsxs)(f,{title:`Messages per finished task`,children:[A.finished===0?(0,p.jsx)(x,{children:`No task finished in this window.`}):(0,p.jsxs)(b,{children:[v(A.messages/A.finished),` posts a task, across`,` `,A.finished,` finished `,A.finished===1?`task`:`tasks`]}),(0,p.jsx)(x,{children:`Posts in each finished task's thread, handovers included, the board's own left out.`}),(0,p.jsx)(S,{label:`By project`,columns:[`Project`,`Tasks`,`Posts a task`],rows:A.byProject.map(e=>[e.project,e.finished,v(e.messages/e.finished)])}),(0,p.jsx)(S,{label:`Most talked-over tasks`,columns:[`Task`,`Posts`],rows:A.busiest.map(e=>[(0,p.jsx)(s,{kind:`task`,id:e.taskId,children:e.title},`task`),e.messages])})]}),(0,p.jsxs)(f,{title:`Wake latency`,children:[j.medianMs===null||j.slowestMs===null?(0,p.jsx)(x,{children:`No mention led to a turn in this window.`}):(0,p.jsxs)(b,{children:[i(j.medianMs),` from a mention to its turn, at the median; the slowest took`,` `,i(j.slowestMs)]}),(0,p.jsxs)(x,{children:[`From a post that mentions a citizen to the start of its turn in the same conversation, debounce included.`,j.unanswered>0?` ${j.unanswered} ${j.unanswered===1?`mention has`:`mentions have`} no turn yet.`:``]}),(0,p.jsx)(S,{label:`By citizen`,columns:[`Citizen`,`Mentions`,`Median`,`Slowest`],rows:j.byAgent.map(e=>[(0,p.jsx)(C,{name:e.agent},`who`),e.mentions,i(e.medianMs),i(e.slowestMs)])})]}),(0,p.jsxs)(f,{title:`Your decisions`,children:[M.total===0?(0,p.jsx)(x,{children:`You decided nothing in this window.`}):(0,p.jsxs)(b,{children:[M.total,` `,M.total===1?`decision`:`decisions`,`, about`,` `,v(M.total/P),` a day`]}),(0,p.jsx)(x,{children:`Proposals you decided, questions to you that you answered, and stages you passed or sent back.`}),(0,p.jsx)(S,{label:`By day`,columns:[`Day`,`Proposals`,`Answers`,`Stages`],rows:M.byDay.map(e=>[g.format(new Date(`${e.day}T00:00:00Z`)),e.proposals,e.answers,e.stages])})]}),(0,p.jsx)(f,{title:`Blocked on a capability`,children:N.length===0?(0,p.jsx)(x,{children:`No task waited for a capability no runner offers.`}):(0,p.jsx)(`ul`,{className:`space-y-2`,children:N.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsxs)(`p`,{className:`text-sm text-fg-primary`,children:[(0,p.jsx)(s,{kind:`task`,id:e.taskId,children:e.title??e.taskId}),(0,p.jsx)(`span`,{className:e.holds?`text-amber-300`:`text-fg-muted`,children:e.holds?` · blocked now`:` · cleared`})]}),(0,p.jsxs)(`p`,{className:`text-meta`,children:[e.summary,` · since `,a(e.firstAt,T)]})]},e.taskId))})})]})]})}export{T as MetricsView};
@@ -1 +0,0 @@
1
- import{St as e,_n as t,b as n,n as r,t as i,y as a}from"./format-11lojpK1.js";import{E as o,d as s,j as c,x as l}from"./index-BXq4t0NA.js";import{n as u,t as d}from"./Pane-B-pz52UC.js";var f=t(),p=[{kind:`proposal`,label:`Proposals to decide`},{kind:`stage`,label:`Stages that name you`},{kind:`request`,label:`Asked of you`}],m=`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`;function h({title:e,meta:t}){return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`text-title block truncate`,children:e}),(0,f.jsx)(`span`,{className:`mt-1 block truncate text-meta`,children:t})]})}function g(){let t=o(),g=n(),_=a(3e4),v=e=>g.data?.find(t=>t.slug===e)?.name??e;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d,{title:`Needs you`,subtitle:t.length===0?`Nothing waits on you`:`${t.length} waiting on you, oldest first`}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:t.length===0?(0,f.jsx)(u,{children:`Nothing waits on you. Proposals you may decide, stages that name you, and questions citizens ask you with @user appear here until you answer where they asked.`}):p.map(({kind:n,label:a})=>{let o=t.filter(e=>e.kind===n);return o.length===0?null:(0,f.jsxs)(`section`,{className:`mb-3`,children:[(0,f.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[a,` · `,o.length]}),(0,f.jsx)(`ul`,{children:o.map(t=>{if(t.kind===`proposal`)return(0,f.jsx)(`li`,{children:(0,f.jsx)(e,{to:`/proposal/$proposalId`,params:{proposalId:t.proposal.id},className:m,children:(0,f.jsx)(h,{title:c(t.proposal),meta:`proposed by ${s(t.proposal.proposedBy)} ${i(t.since,_)}`})})},t.proposal.id);if(t.kind===`stage`)return(0,f.jsx)(`li`,{children:(0,f.jsx)(e,{to:`/task/$taskId`,params:{taskId:t.task.id},className:m,children:(0,f.jsx)(h,{title:t.task.title,meta:`${t.stage.name}${t.stage.gate?` (gate)`:``} in ${v(t.task.project)} · waiting since ${i(t.since,_)}`})})},t.task.id);let n=`${s(t.message.author)} in ${t.thread===null?`#${t.message.channel}`:t.thread.title} ${i(t.since,_)}`,a=(0,f.jsx)(h,{title:(0,f.jsx)(l,{text:r(t.message.body,160),links:!1}),meta:n}),o=t.thread?.subject;return(0,f.jsx)(`li`,{children:o?.kind===`task`?(0,f.jsx)(e,{to:`/task/$taskId`,params:{taskId:o.id},className:m,children:a}):o?.kind===`proposal`?(0,f.jsx)(e,{to:`/proposal/$proposalId`,params:{proposalId:o.id},className:m,children:a}):t.thread===null?(0,f.jsx)(e,{to:`/c/$`,params:{_splat:t.message.channel},className:m,children:a}):(0,f.jsx)(e,{to:`/thread/$threadId`,params:{threadId:t.thread.id},className:m,children:a})},t.message.id)})})]},n)})})]})}export{g as NeedsYouView};
@@ -1 +0,0 @@
1
- import{E as e,H as t,St as n,_n as r,n as i,t as a}from"./format-11lojpK1.js";import{T as o,x as s}from"./index-BXq4t0NA.js";import{a as c}from"./citizen-CYBzbWt-.js";var l=r();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:r,scope:i}){let a=e(),s=t(a.data?.running??[]),u=t(a.data?.pending??[]);return r.length===0?(0,l.jsx)(`p`,{className:`text-meta`,children:`Nobody yet.`}):(0,l.jsx)(`ul`,{className:`-mx-2`,children:r.map(e=>{let t=s.filter(t=>t.agent===e.name).map(e=>e.scope),r=t.includes(i),a=u.some(t=>t.agent===e.name),d=r?`in a turn here`:t.length>0?`in a turn at ${t.map(c).join(` and `)}`:a?`queued`:`resting`;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(n,{to:`/citizen/$name`,params:{name:e.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:e.cli===null?null:(0,l.jsx)(o,{cli:e.cli,size:13})}),(0,l.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:e.role}),(0,l.jsx)(`span`,{className:`shrink-0 text-xs ${t.length>0?`text-emerald-300`:a?`text-amber-300`:`text-fg-muted`}`,children:d})]})},e.name)})})}function f({scope:e,topics:t,now:r}){return t===void 0?(0,l.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):t.length===0?(0,l.jsxs)(`p`,{className:`text-meta`,children:[`No knowledge yet. `,e===`society`?`The steward and you`:`Members`,` write it with write_knowledge.`]}):(0,l.jsx)(`ul`,{className:`-mx-2`,children:t.toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(t=>(0,l.jsx)(`li`,{children:(0,l.jsxs)(n,{to:`/knowledge/$scope/$topic`,params:{scope:e,topic:t.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:t.topic}),(0,l.jsxs)(`span`,{className:`text-meta`,children:[`by `,t.updatedBy,` `,a(t.updatedAt,r)]})]}),(0,l.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-sm leading-relaxed text-fg-secondary`,children:(0,l.jsx)(s,{text:i(t.body,240),links:!1})})]})},t.topic))})}export{u as n,f as r,d as t};
@@ -1 +0,0 @@
1
- import{P as e,St as t,_n as n,b as r,c as i,h as a,p as o,s,t as c,y as l}from"./format-11lojpK1.js";import{i as u,t as d}from"./tasks-DnJj3psB.js";import{B as f}from"./index-BXq4t0NA.js";import{t as p}from"./Markdown-MZnGPfvk.js";import{n as m,t as h}from"./Pane-B-pz52UC.js";import{n as g,r as _,t as v}from"./Overview-DxCYcW_A.js";var y=n();function b(){let{slug:n}=f({from:`/p/$slug`}),b=r(),x=s(),S=a(),C=e(n),w=i(n),T=o(n),E=l(3e4),D=b.data?.find(e=>e.slug===n);if(D===void 0)return(0,y.jsx)(m,{children:b.data===void 0?`Reading the project…`:`There is no project ${n}.`});let O=(S.data??[]).filter(e=>e.status===`active`&&D.members.includes(e.name)),k=u(C.data??[]),A=w.data?.body.trim()??``;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h,{title:D.name,subtitle:`${n} · ${D.repo??`a local repository`} · ${D.defaultBranch}`,trailing:(0,y.jsx)(t,{to:`/p/$slug/tasks`,params:{slug:n},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,y.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[D.archived===void 0?null:(0,y.jsxs)(`p`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-sm text-fg-secondary`,children:[`Archived `,c(D.archived.at,E),` by `,D.archived.by,`:`,` `,D.archived.reason,`. Its channels, tasks, and history stay readable here; nothing more is posted, filed, or joined.`]}),D.archived===void 0?null:(0,y.jsx)(g,{title:`Channels`,children:(0,y.jsx)(`ul`,{className:`space-y-1`,children:(x.data??[]).filter(e=>e.project===n).map(e=>(0,y.jsxs)(`li`,{children:[(0,y.jsxs)(t,{to:`/c/$`,params:{_splat:e.ref},className:`text-sm text-fg-secondary hover:text-fg-primary`,children:[`# `,e.name]}),(0,y.jsxs)(`span`,{className:`text-meta`,children:[` · `,e.messages,` messages`]})]},e.ref))})}),(0,y.jsx)(g,{title:`Members`,children:(0,y.jsx)(v,{members:O,scope:n})}),(0,y.jsx)(g,{title:`Tasks`,children:C.data===void 0?(0,y.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):k.length===0?(0,y.jsx)(`p`,{className:`text-meta`,children:`No tasks yet.`}):(0,y.jsx)(t,{to:`/p/$slug/tasks`,params:{slug:n},className:`flex flex-wrap gap-1.5`,children:k.map(e=>(0,y.jsxs)(`span`,{className:`rounded-md bg-surface-2/60 px-2 py-0.5 text-xs text-fg-secondary`,children:[e.tasks.length,` `,d.find(t=>t.phase===e.phase)?.label.toLowerCase()]},e.phase))})}),(0,y.jsx)(g,{title:`How a task ends`,children:(0,y.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:D.onDone===`merge`?`When its last stage is done, the board merges task/<id> onto ${D.defaultBranch}.`:`When its last stage is done, it is done; nothing is merged.`})}),(0,y.jsx)(g,{title:`Dashboard`,children:w.data===void 0?(0,y.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):A===``?(0,y.jsx)(`p`,{className:`text-meta`,children:`Empty. Agents on the server's machine may edit it.`}):(0,y.jsx)(p,{text:A})}),(0,y.jsx)(g,{title:`Knowledge`,children:(0,y.jsx)(_,{scope:n,topics:T.data,now:E})})]})]})}export{b as ProjectView};
@@ -1 +0,0 @@
1
- import{$ as e,D as t,F as n,P as r,R as i,St as a,_n as o,_t as s,b as c,et as l,gn as u,h as d,ht as f,it as p,k as m,ot as h,rt as g,t as _,tt as v,vn as y,vt as b,w as x,x as S,xn as C,xt as w,y as T,yt as E}from"./format-11lojpK1.js";import{a as ee}from"./tasks-DnJj3psB.js";import{B as te,F as ne,M as re,N as D,O,P as k,T as A,V as j,c as M,d as N,i as P,j as F,k as I,u as L}from"./index-BXq4t0NA.js";import{t as R}from"./Markdown-MZnGPfvk.js";import{n as z,t as B}from"./Pane-B-pz52UC.js";import{n as V,r as H}from"./ThreadForms-BipMby65.js";import{t as ie}from"./BackLink-DivaHiZ7.js";import{StatusChip as U}from"./ProposalsView-CmwwJuop.js";import{t as W}from"./SubjectThread-M4F1paqV.js";var G=C(y(),1),K=o();function q({proposal:e,consequence:n}){let{api:r}=t(),i=u(),a=d(),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(``),f=(0,G.useRef)(null);(0,G.useEffect)(()=>{o!==null&&f.current?.focus()},[o]);let p=j({mutationFn:()=>{let t=c.trim();return o===`reject`?r.reject({proposal_id:e.id,reason:t}):r.approve({proposal_id:e.id,...t===``?{}:{reason:t}})},onSuccess:()=>{let t=[[`proposals`],[`proposal`,e.id],[`threads`],[`thread`,e.id]];for(let e of t)i.invalidateQueries({queryKey:e});s(null),l(``)}}),m=(a.data??[]).find(t=>t.name===e.proposedBy&&t.status===`active`&&t.cli!==null),h=m===void 0?`Your decision is posted in the proposal's thread, which closes.`:`Your decision is posted in the proposal's thread, which closes, and wakes ${m.name}, who proposed it.`;if(o===null)return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-line px-4 py-3`,children:[(0,K.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`This proposal waits on you.`}),(0,K.jsx)(M,{onClick:()=>s(`reject`),children:`Reject`}),(0,K.jsx)(M,{variant:`primary`,onClick:()=>s(`approve`),children:`Approve`})]});let g=o===`approve`;return(0,K.jsxs)(`form`,{"aria-label":g?`Approve the proposal`:`Reject the proposal`,className:`space-y-2 border-t border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),p.mutate()},children:[(0,K.jsx)(`textarea`,{ref:f,value:c,rows:2,placeholder:g?`Why approve? Optional.`:`Why not? It is posted with the decision.`,"aria-label":g?`Reason for approving`:`Reason for rejecting`,onChange:e=>l(e.target.value),className:`${V} resize-none`}),(0,K.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[g?n:`Nothing is created, and the proposal's thread closes.`,` `,h]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,K.jsx)(M,{onClick:()=>{s(null),p.reset()},children:`Cancel`}),(0,K.jsx)(M,{variant:`primary`,type:`submit`,disabled:p.isPending||!g&&c.trim()===``,children:p.isPending?`Deciding…`:g?`Confirm approval`:`Confirm rejection`})]}),(0,K.jsx)(H,{error:p.error})]})}function J({children:e}){return(0,K.jsx)(`dl`,{className:`mt-2 space-y-1.5`,children:e})}function Y({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 X(e){return e.length===0?`none`:e.join(`, `)}function Z({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 Q({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 ae({next:e,current:t,compare:n}){let r=t===void 0?null:D(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)(Q,{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)(Z,{name:e,change:`added`},e)),r.verbsRemoved.map(e=>(0,K.jsx)(Z,{name:e,change:`removed`},e))]}),r.changes.length===0?null:(0,K.jsx)(J,{children:r.changes.map(e=>(0,K.jsxs)(Y,{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)(J,{children:[(0,K.jsx)(Y,{label:`Role`,children:e.name}),(0,K.jsx)(Y,{label:`Purpose`,children:e.purpose}),(0,K.jsx)(Y,{label:`Verbs`,children:(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.verbs.map(e=>(0,K.jsx)(Z,{name:e},e))})}),(0,K.jsx)(Y,{label:`Wake triggers`,children:X(e.wakeTriggers)}),(0,K.jsx)(Y,{label:`Replicas per project`,children:e.maxReplicas}),(0,K.jsx)(Y,{label:`Warm session`,children:e.resident?`yes`:`no`}),(0,K.jsx)(Y,{label:`Society role`,children:e.societyScope?`yes, in no project`:`no`}),(0,K.jsx)(Y,{label:`Reflects`,children:e.reflects?`yes`:`no`})]})]})}function oe({proposal:e,slug:t,reason:n,members:i}){let o=c(),s=r(t),l=o.data?.find(e=>e.slug===t),u=e.status===`proposed`,d=u?(i??[]).filter(e=>e.status===`active`&&e.memberships.includes(t)).map(e=>e.name):e.provision?.members??[],f=(s.data??[]).filter(ee).length;return(0,K.jsxs)(J,{children:[(0,K.jsxs)(Y,{label:`Project`,children:[(0,K.jsx)(a,{to:`/p/$slug`,params:{slug:t},className:`hover:text-fg-primary`,children:l?.name??t}),l?.name===void 0||l.name===t?null:` · ${t}`]}),(0,K.jsx)(Y,{label:u?`Members who leave`:`Members who left`,children:Array.isArray(d)?X(d.filter(e=>typeof e==`string`)):`none`}),u?(0,K.jsx)(Y,{label:`Tasks in play`,children:s.data===void 0?`reading…`:f===0?`none`:`${f}: approval is refused until they are done, abandoned, or filed elsewhere`}):null,(0,K.jsx)(Y,{label:`Reason`,children:n}),(0,K.jsx)(Y,{label:`After`,children:`Its open threads close and nothing more is posted, filed, or joined there; its channels, tasks, repository, and history stay readable.`})]})}function se({proposal:t,roles:n,members:r}){let i=t.status===`proposed`,{charter:a}=t;switch(t.kind){case`member`:{let e=v.safeParse(a);if(!e.success)break;let t=e.data;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(J,{children:[(0,K.jsx)(Y,{label:`Citizen`,children:(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(A,{cli:t.cli,size:13}),t.name]})}),(0,K.jsx)(Y,{label:`Role`,children:t.role}),(0,K.jsxs)(Y,{label:`CLI and model`,children:[t.cli,` · `,t.model??`cli default`]}),(0,K.jsx)(Y,{label:`Projects`,children:X(t.memberships)}),(0,K.jsx)(Y,{label:`Also follows`,children:X(t.subscriptions)}),t.homeRunner===void 0?null:(0,K.jsx)(Y,{label:`Runs on`,children:t.homeRunner})]}),t.seedInstructions===void 0?null:(0,K.jsxs)(Q,{children:[(0,K.jsx)(`p`,{className:`text-caps`,children:`Seed instructions`}),(0,K.jsx)(`div`,{className:`mt-1.5`,children:(0,K.jsx)(R,{text:t.seedInstructions})})]})]})}case`role`:{let e=re(t);if(e===null)break;return(0,K.jsx)(ae,{next:e,current:n?.find(t=>t.name===e.name),compare:i})}case`skill`:{let e=h.safeParse(a);if(!e.success)break;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(J,{children:[(0,K.jsx)(Y,{label:`Skill`,children:e.data.name}),(0,K.jsx)(Y,{label:`Summary`,children:e.data.summary})]}),(0,K.jsx)(Q,{children:(0,K.jsx)(R,{text:k(e.data.body)})})]})}case`channel`:{let e=l.safeParse(a);if(!e.success)break;return(0,K.jsxs)(J,{children:[(0,K.jsxs)(Y,{label:`Channel`,children:[`#`,f(e.data.project,e.data.name)]}),(0,K.jsx)(Y,{label:`Purpose`,children:e.data.purpose})]})}case`retirement`:{let e=p.safeParse(a);if(!e.success)break;let t=r?.find(t=>t.name===e.data.agent);return(0,K.jsxs)(J,{children:[(0,K.jsxs)(Y,{label:`Citizen`,children:[(0,K.jsx)(L,{name:e.data.agent,members:r}),t===void 0?null:` · ${t.role}`]}),(0,K.jsx)(Y,{label:`Holds now`,children:t===void 0?`unknown`:t.claimsHeld===1?`1 stage`:`${t.claimsHeld} stages`}),(0,K.jsx)(Y,{label:`Reason`,children:e.data.reason})]})}case`archive`:{let n=e.safeParse(a);if(!n.success)break;return(0,K.jsx)(oe,{proposal:t,slug:n.data.project,reason:n.data.reason,members:r})}case`reallocation`:{let e=g.safeParse(a);if(!e.success)break;return(0,K.jsx)(J,{children:(0,K.jsx)(Y,{label:`Reallocation`,children:e.data.description})})}}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(a,null,2)})}var ce=E({agent:w().optional(),channel:w().optional(),role:w().optional(),skill:w().optional(),replaced:b().optional(),releasedTasks:s(w()).optional(),project:w().optional()});function le({proposal:e}){let t=ce.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 $(){let{proposalId:e}=te({from:`/proposal/$proposalId`}),t=S(e),r=d(),o=x(),s=m(),c=n(),l=T(3e4);if(t.data===void 0)return(0,K.jsx)(z,{children:t.error instanceof i&&t.error.status===404?`There is no proposal ${e}.`:`Reading the proposal…`});let u=t.data,f=u.status===`proposed`,p=r.data?.find(e=>e.name===u.proposedBy)?.role,h=c.data?.find(e=>e.id===u.id),g=u.status===`rejected`?`Rejected`:`Approved`,v=O(u,{members:r.data??[],roles:o.data??[],skills:s.data??[]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{leading:(0,K.jsx)(ie,{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:F(u),subtitle:`${u.kind} proposal by ${N(u.proposedBy)} ${_(u.createdAt,l)}${f?` · for ${I(u,p)} to decide`:``}`,trailing:(0,K.jsx)(U,{status:u.status})}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:[f?(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: `,v]}):(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:[g,` by `,N(u.decidedBy??`someone`),u.decidedAt===void 0?``:` ${_(u.decidedAt,l)}`,u.reason===void 0?`.`:`: ${u.reason}`]}),(0,K.jsx)(le,{proposal:u})]}),u.body.trim()===``||h!==void 0?null:(0,K.jsxs)(`section`,{className:`mt-5`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:`Why`}),(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(R,{text:u.body})})]}),(0,K.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:f?`What it would make`:u.status===`provisioned`?`What it made`:`What it proposed`}),(0,K.jsx)(se,{proposal:u,roles:o.data,members:r.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`}),h===void 0?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:c.data===void 0?`Reading the thread…`:`This proposal is older than proposal threads; its thread opens when it is decided.`}):(0,K.jsx)(W,{thread:h,now:l,empty:`Nothing said yet. The pitch and the decision are posted here.`})]})]}),h?.state===`open`?(0,K.jsx)(P,{target:{threadId:u.id},placeholder:`Write in the proposal's thread`}):null,ne(u)?(0,K.jsx)(q,{proposal:u,consequence:v}):null]})}export{$ as ProposalView};
@@ -1 +0,0 @@
1
- import{S as e,St as t,_n as n,t as r,vn as i,xn as a,y as o}from"./format-11lojpK1.js";import{A as s,D as c,d as l,j as u}from"./index-BXq4t0NA.js";import{n as d,t as f}from"./Pane-B-pz52UC.js";var p=a(i(),1),m=n(),h=8,g={proposed:`bg-amber-500/15 text-amber-300`,approved:`bg-emerald-500/15 text-emerald-300`,provisioned:`bg-emerald-500/15 text-emerald-300`,rejected:`bg-red-500/15 text-red-300`,retired:`bg-surface-2 text-fg-muted`};function _({status:e}){return(0,m.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${g[e]}`,children:e===`provisioned`?`approved`:e})}function v({proposal:e,now:n}){let i=e.decidedBy===void 0||e.decidedAt===void 0?``:` · ${e.status===`rejected`?`rejected`:`approved`} by ${l(e.decidedBy)} ${r(e.decidedAt,n)}`;return(0,m.jsx)(`li`,{children:(0,m.jsxs)(t,{to:`/proposal/$proposalId`,params:{proposalId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:u(e)}),(0,m.jsx)(_,{status:e.status})]}),(0,m.jsxs)(`p`,{className:`mt-1 truncate text-meta`,children:[`proposed by `,l(e.proposedBy),` `,r(e.createdAt,n),i]})]})})}function y(){let t=e(),n=o(3e4),[r,i]=(0,p.useState)(!1),a=s(t.data??[]),l=a.find(e=>e.group===`yours`)?.proposals.length??0;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f,{title:`Proposals`,subtitle:`${l===0?`nothing`:l} waiting on you · ${t.data?.length??0} in all`}),(0,m.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:t.data===void 0?(0,m.jsx)(d,{children:`Reading the proposals…`}):a.length===0?(0,m.jsx)(d,{children:`No proposals yet. Citizens propose roles, members, channels, and skills.`}):a.map(e=>{let 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:[c.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 +0,0 @@
1
- import{D as e,T as t,_n as n,b as r,gn as i,l as a,t as o,vn as s,xn as c,y as l}from"./format-11lojpK1.js";import{V as u,c as d,z as f}from"./index-BXq4t0NA.js";import{n as p,t as m}from"./Pane-B-pz52UC.js";import{n as h,r as g}from"./ThreadForms-BipMby65.js";import{n as _}from"./Overview-DxCYcW_A.js";var v=c(s(),1);function y(e){return e.toUpperCase().replaceAll(/[^A-Z0-9]/g,``)}function b(e,t){return y(e)===y(t)}function x(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 S=n();function C(e,t){return[e.length===0?`no CLI`:e.join(`, `),...t].join(` · `)}function w({enrollment:t,taken:n,followed:r,now:a}){let{api:s}=e(),c=i(),[l,f]=(0,v.useState)(()=>x(t.hostname,n)),p=()=>{c.invalidateQueries({queryKey:[`enrollments`]}),c.invalidateQueries({queryKey:[`runners`]})},m=u({mutationFn:()=>s.approveEnrollment(t.userCode,l.trim()),onSuccess:p}),_=u({mutationFn:()=>s.denyEnrollment(t.userCode),onSuccess:p}),y=m.isPending||_.isPending;return(0,S.jsxs)(`li`,{className:`rounded-xl border px-3 py-3 ${r?`border-amber-500/40 bg-amber-500/5`:`border-line`}`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary`,children:t.hostname}),(0,S.jsx)(`code`,{className:`shrink-0 font-mono text-sm text-fg-primary`,children:t.userCode})]}),(0,S.jsxs)(`p`,{className:`mt-0.5 truncate text-meta`,children:[t.os,` · `,C(t.clis,t.capabilities),` · runner`,` `,t.version,` · asked `,o(t.requestedAt,a)]}),(0,S.jsxs)(`form`,{"aria-label":`Approve ${t.hostname}`,className:`mt-2.5 flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,S.jsx)(`input`,{value:l,maxLength:32,spellCheck:!1,"aria-label":`Runner name`,onChange:e=>f(e.target.value),className:`${h} min-w-0 flex-1 font-mono`}),(0,S.jsx)(d,{onClick:()=>_.mutate(),disabled:y,children:`Deny`}),(0,S.jsx)(d,{variant:`primary`,type:`submit`,disabled:y||l.trim()===``,children:m.isPending?`Approving…`:`Approve`})]}),(0,S.jsx)(`div`,{className:`mt-1.5`,children:(0,S.jsx)(g,{error:m.error??_.error})})]})}function T({runner:e,projects:t,now:n}){let r=t.filter(t=>t.runner===e.name&&t.archived===void 0).map(e=>e.slug);return(0,S.jsxs)(`li`,{className:`py-1.5`,children:[(0,S.jsxs)(`p`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:e.status===`connected`?`text-emerald-400`:`text-fg-muted`,children:`●`}),(0,S.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-meta`,children:[e.status===`connected`?`connected`:`away${e.lastSeen===void 0?``:`, last seen ${o(e.lastSeen,n)}`}`,` `,`· `,e.os,` · `,C(e.clis,e.capabilities)]})]}),r.length===0?null:(0,S.jsxs)(`p`,{className:`ml-5 truncate text-meta`,children:[`projects: `,r.join(`, `)]})]})}function E(){let{code:e}=f({from:`/runners`}),n=a(),i=t(),o=r(),s=l(3e4),c=n.data??[],u=(i.data??[]).map(e=>e.name),d=(i.data??[]).filter(e=>e.status===`connected`).length,h=e===void 0?void 0:c.find(t=>b(t.userCode,e)),g=h===void 0?c:[h,...c.filter(e=>e!==h)];return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m,{title:`Runners`,subtitle:`${d} connected · ${c.length===0?`none`:c.length} waiting for approval`}),(0,S.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,S.jsxs)(_,{title:`Waiting for approval`,children:[e!==void 0&&n.data!==void 0&&h===void 0?(0,S.jsxs)(`output`,{className:`mb-2 block text-meta`,children:[`No runner waits with the code `,e,`. It may have been approved, denied, or expired; a runner whose code expired asks again with a new one.`]}):null,n.data===void 0?(0,S.jsx)(`p`,{className:`text-meta`,children:`Reading the runners that wait…`}):c.length===0?(0,S.jsx)(`p`,{className:`text-meta`,children:`None. A runner started with STELLARIS_SERVER_URL set to this board and no token prints a code to approve here.`}):(0,S.jsx)(`ul`,{className:`space-y-2`,children:g.map(e=>(0,S.jsx)(w,{enrollment:e,taken:u,followed:e===h,now:s},e.userCode))})]}),(0,S.jsx)(_,{title:`Registered`,children:i.data===void 0?(0,S.jsx)(p,{children:`Reading the runners…`}):i.data.length===0?(0,S.jsx)(`p`,{className:`text-meta`,children:`No runners yet.`}):(0,S.jsx)(`ul`,{children:i.data.map(e=>(0,S.jsx)(T,{runner:e,projects:o.data??[],now:s},e.name))})})]})]})}export{E as RunnersView};
@@ -1 +0,0 @@
1
- import{D as e,Xt as t,_n as n,h as r,t as i,vn as a,xn as o}from"./format-11lojpK1.js";import{I as s}from"./index-BXq4t0NA.js";import{t as c}from"./Markdown-MZnGPfvk.js";import{t as l}from"./MessageItem-Deq-ntT8.js";var u=o(a(),1),d=n();function f({thread:n,now:a,task:o,empty:f}){let{api:p}=e(),m=r(),h=t({queryKey:[`thread`,n.id],queryFn:()=>p.thread(n.id)}),g=h.data?.messages??[],_=g.at(-1)?.id??null;if((0,u.useEffect)(()=>s(n.id,_),[n.id,_]),h.data===void 0)return(0,d.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the thread…`});let v=h.data.thread;return(0,d.jsxs)(`div`,{className:`-mx-4 mt-1`,children:[g.length===0?(0,d.jsx)(`p`,{className:`mx-4 mt-1 text-meta`,children:f}):g.map(e=>(0,d.jsx)(l,{message:e,members:m.data,now:a,task:o},e.id)),n.state===`closed`?(0,d.jsxs)(`div`,{className:`mx-4 mt-2`,children:[(0,d.jsxs)(`p`,{className:`text-meta`,children:[`Closed`,v.closedAt===void 0?``:` ${i(v.closedAt,a)}`,v.body.trim()===``?`.`:`:`]}),v.body.trim()===``?null:(0,d.jsx)(c,{text:v.body})]}):null]})}export{f as t};
@@ -1,4 +0,0 @@
1
- import{N as e,R as t,St as n,Y as r,_n as i,b as a,j as o,t as s,vn as c,xn as l,y as u}from"./format-11lojpK1.js";import{B as d,z as f}from"./index-BXq4t0NA.js";import{c as p,d as m,f as h,i as g,l as _,n as v,o as y,p as b,r as x,t as S}from"./Markdown-MZnGPfvk.js";import{n as C,t as w}from"./Pane-B-pz52UC.js";import{t as T}from"./BackLink-DivaHiZ7.js";var E=l(c(),1),D=i(),O=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,k=`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs text-fg-tertiary transition-colors hover:bg-surface-2/70 hover:text-fg-primary`,A=1e3,j=2e4;function M({taskId:e,path:t}){let n=t===``?[]:t.split(`/`),r=`text-fg-tertiary hover:text-fg-primary`;return(0,D.jsxs)(`nav`,{"aria-label":`Path`,className:`flex flex-wrap items-center gap-x-1 text-meta`,children:[n.length===0?(0,D.jsx)(`span`,{children:`Files`}):(0,D.jsx)(v,{taskId:e,path:``,className:r,children:`Files`}),n.map((t,i)=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i===n.length-1?(0,D.jsx)(`span`,{className:`text-fg-secondary`,children:t}):(0,D.jsx)(v,{taskId:e,path:n.slice(0,i+1).join(`/`),className:r,children:t})]},n.slice(0,i+1).join(`/`)))]})}function N({taskId:e,file:t}){let n=t.entries.toSorted((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`dir`?-1:1);return(0,D.jsx)(`ul`,{className:`mt-3 space-y-1`,children:n.map(n=>(0,D.jsxs)(`li`,{className:`flex items-baseline gap-2`,children:[(0,D.jsx)(v,{taskId:e,path:t.path===``?n.name:`${t.path}/${n.name}`,className:`text-sm text-fg-secondary hover:text-fg-primary`,children:n.kind===`dir`?`${n.name}/`:n.name}),n.size===null?null:(0,D.jsx)(`span`,{className:`text-meta`,children:h(n.size)})]},n.name))})}function P({rows:e}){let[t,...n]=e;if(t===void 0)return(0,D.jsx)(`p`,{className:`mt-3 text-meta`,children:`The table is empty.`});let r=n.slice(0,A),i=`border border-line px-2 py-1 text-left align-top whitespace-pre-wrap`;return(0,D.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,children:[(0,D.jsxs)(`table`,{className:`text-xs text-fg-secondary`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsx)(`tr`,{children:t.map((e,t)=>(0,D.jsx)(`th`,{scope:`col`,className:`${i} font-medium text-fg-primary`,children:e},t))})}),(0,D.jsx)(`tbody`,{children:r.map((e,t)=>(0,D.jsx)(`tr`,{children:e.map((e,t)=>(0,D.jsx)(`td`,{className:i,children:e},t))},t))})]}),n.length>r.length?(0,D.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,A,` of `,n.length,` rows; download the file for the rest.`]}):null]})}function F({text:e,line:t}){let n=e.endsWith(`
2
- `)?e.slice(0,-1).split(`
3
- `):e.split(`
4
- `),r=`mt-3 overflow-x-auto rounded-lg bg-surface-0/80 p-3 font-mono text-[12px] leading-relaxed text-fg-secondary shadow-[inset_0_0_0_1px_rgba(255,255,255,0.05)]`;return n.length>j?(0,D.jsx)(`pre`,{className:r,children:e}):(0,D.jsx)(`pre`,{className:r,children:n.map((e,n)=>(0,D.jsxs)(`span`,{className:`flex ${n+1===t?`line-target`:``}`,children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`w-10 shrink-0 pr-3 text-right text-fg-muted select-none`,children:n+1}),(0,D.jsx)(`span`,{className:`whitespace-pre`,children:e===``?` `:e})]},n))})}function I({taskId:e,file:t,url:n,line:i}){let a=(0,E.useMemo)(()=>t.content===null?null:b(t.path,g(t.content)),[t.path,t.content]),o=t.path.split(`/`).at(-1)??t.path;return a===null?(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[o,` is `,h(t.size),`, more than the `,h(r),` the board shows. Its runner still has it on the task's branch.`]}):a.kind===`markdown`?(0,D.jsx)(`div`,{className:`mt-3`,children:(0,D.jsx)(S,{text:a.text,base:{taskId:e,dir:m(t.path)},line:i})}):a.kind===`image`?n===null?null:(0,D.jsx)(`img`,{src:n,alt:o,className:`mt-3 max-w-full rounded-lg`}):a.kind===`table`?(0,D.jsx)(P,{rows:a.rows}):a.kind===`text`?(0,D.jsx)(F,{text:a.text,line:i}):(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[o,` is not text (`,h(t.size),`). Download it to open it.`]})}function L(){let{taskId:r,_splat:i}=d({from:`/task/$taskId/files/$`}),c=f({from:`/task/$taskId/files/$`}),l=y(_(i??``)??``),m=l.path,h=c.line??l.line,g=o(r),v=a(),b=e(r,m),S=u(3e4),A=b.data,j=A?.kind===`file`?A.content:null,P=x(j,p(m)??`application/octet-stream`),F=m===``?`Files`:m.split(`/`).at(-1)??m,L=g.data?.title??r,R=(0,E.useRef)(null);(0,E.useEffect)(()=>{h!==void 0&&A!==void 0&&R.current?.querySelector(`.line-target`)?.scrollIntoView({block:`center`})},[h,A]);let z;if(A!==void 0)z=A.kind===`dir`?(0,D.jsx)(N,{taskId:r,file:A}):(0,D.jsx)(I,{taskId:r,file:A,url:P,line:h});else if(b.error instanceof t&&b.error.status===404)z=(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[m===``?`Nothing`:m,` is not on task/`,r,` yet. What a turn writes reaches the branch when the turn ends.`]});else if(b.error instanceof t&&b.error.status===503){let e=v.data?.find(e=>e.slug===g.data?.project);z=(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[e?.runner===void 0?`The runner`:`${e.runner}, the runner`,` `,e?.name??`the project`,` lives on, is not connected, so the task's files cannot be read now.`]})}else z=b.error===null?(0,D.jsxs)(C,{children:[`Reading `,F,` from the task's runner…`]}):(0,D.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:b.error.message});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(w,{leading:(0,D.jsx)(T,{fallback:(0,D.jsx)(n,{to:`/task/$taskId`,params:{taskId:r},"aria-label":`Back to the task ${L}`,className:O,children:`←`})}),title:F,subtitle:A===void 0?L:`${L}${h===void 0?``:` · line ${h}`} · committed by ${A.commit.author} ${s(A.commit.at,S)} · ${A.commit.id.slice(0,7)}`,trailing:P===null?null:(0,D.jsx)(`a`,{href:P,download:F,className:k,children:`Download`})}),(0,D.jsxs)(`div`,{ref:R,className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,D.jsx)(M,{taskId:r,path:m}),z]})]})}export{L as TaskFileView};
@@ -1 +0,0 @@
1
- import{D as e,F as t,M as n,R as r,St as i,_n as a,b as o,gn as s,h as c,j as l,t as u,vn as d,xn as f,y as p}from"./format-11lojpK1.js";import{a as m,c as h,l as g,n as _,o as v,r as y,s as b,t as x}from"./tasks-DnJj3psB.js";import{B as S,V as C,c as w,d as T,i as E,u as D,x as O}from"./index-BXq4t0NA.js";import{a as k,n as A,s as j,t as M,u as N}from"./Markdown-MZnGPfvk.js";import{n as P,t as F}from"./Pane-B-pz52UC.js";import{t as I}from"./BackLink-DivaHiZ7.js";import{t as L}from"./SubjectThread-M4F1paqV.js";var R=f(d(),1),z=a();function B({last:e,now:t}){return e===void 0?null:(0,z.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-meta`,children:[e.author,` `,u(e.at,t)]})}function V({taskId:e,nodes:t,nested:n,isOpen:r,toggle:i,now:a}){return(0,z.jsx)(`ul`,{className:n?`ml-[5px] border-l border-line-strong pl-2`:`mt-2`,children:t.map(t=>{if(t.kind===`dir`){let n=r(t);return(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>i(t),className:`flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40`,children:[(0,z.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,z.jsxs)(`span`,{className:`min-w-0 truncate text-fg-primary`,children:[t.name,`/`]}),(0,z.jsx)(`span`,{className:`shrink-0 text-meta`,children:t.files===1?`1 file`:`${t.files} files`}),(0,z.jsx)(B,{last:t.lastChange,now:a})]}),n?(0,z.jsx)(V,{taskId:e,nodes:t.children,nested:!0,isOpen:r,toggle:i,now:a}):null]},`dir:${t.path}`)}let{change:n}=t;return(0,z.jsxs)(`li`,{className:`flex items-baseline gap-2 py-0.5 text-sm`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`w-2.5 shrink-0`}),n.status===`deleted`?(0,z.jsx)(`span`,{className:`min-w-0 truncate text-fg-tertiary line-through`,title:n.path,children:t.name}):(0,z.jsx)(A,{taskId:e,path:n.path,className:`min-w-0 truncate text-fg-secondary hover:text-fg-primary`,children:t.name}),(0,z.jsx)(`span`,{className:`shrink-0 text-meta`,children:k(n)}),(0,z.jsx)(B,{last:n.lastChange,now:a})]},n.path)})})}function H({taskId:e,changes:t,now:n}){let r=(0,R.useMemo)(()=>j(t),[t]),i=(0,R.useMemo)(()=>N(r),[r]),[a,o]=(0,R.useState)(new Map);return(0,z.jsx)(V,{taskId:e,nodes:r.children,nested:!1,isOpen:e=>a.get(e.path)??i.has(e.path),toggle:e=>{o(t=>new Map(t).set(e.path,!(t.get(e.path)??i.has(e.path))))},now:n})}function U({task:e,now:t}){let i=n(e.id),a=o(),s=`task/${e.id}`,c;if(i.data!==void 0){let{files:n,total:r,head:a}=i.data;c=n.length===0?(0,z.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing changed on `,s,` yet. What a turn writes reaches the branch when the turn ends.`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`mt-2 text-meta`,children:[r===1?`1 file`:`${r} files`,` changed · newest commit by `,a.author,` `,u(a.at,t)]}),(0,z.jsx)(H,{taskId:e.id,changes:n,now:t}),r>n.length?(0,z.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,n.length,` of `,r,`; browse the branch for the rest.`]}):null]})}else if(i.error instanceof r&&i.error.status===404)c=(0,z.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing on `,s,` yet. What a turn writes reaches the branch when the turn ends.`]});else if(i.error instanceof r&&i.error.status===503){let t=a.data?.find(t=>t.slug===e.project);c=(0,z.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=i.error===null?(0,z.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the task's branch…`}):(0,z.jsx)(`p`,{className:`mt-2 text-meta`,children:i.error.message});return(0,z.jsxs)(`section`,{"aria-label":`Files`,className:`mt-5 border-t border-line pt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-section`,children:`Files`}),(0,z.jsx)(A,{taskId:e.id,path:``,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Browse the branch`})]}),c]})}function W({stage:e,index:t,task:n,members:r,now:i}){let a=e.completedBy!==void 0,o=v(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),d=n.returned?.from===e.id?n.returned:void 0;return(0,z.jsxs)(`li`,{className:`relative flex gap-3 pb-4`,children:[s?null:(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-6 bottom-0 left-2.5 w-px bg-line`}),(0,z.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,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`p`,{className:`text-sm ${o?`font-medium text-fg-primary`:`text-fg-secondary`}`,children:[e.name,e.gate?(0,z.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,z.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[`for `,y(e),c===void 0?null:(0,z.jsxs)(z.Fragment,{children:[` · held by `,(0,z.jsx)(D,{name:c,members:r})]}),e.completedBy!==void 0&&e.completedAt!==void 0?` · done by ${e.completedBy} ${u(e.completedAt,i)}`:o&&n.status===`open`?` · waiting since ${u(n.stageSince,i)}`:``,l.length>0?` · held before by ${l.join(`, `)}`:``,d===void 0?``:` · sent back by ${d.by} ${u(d.at,i)}`]})]})]})}function G({taskId:t}){let{api:n}=e(),r=s(),i=C({mutationFn:()=>n.openThread({task_id:t}),onSuccess:()=>{r.invalidateQueries({queryKey:[`threads`]})}});return(0,z.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,z.jsx)(w,{variant:`primary`,disabled:i.isPending,onClick:()=>i.mutate(),children:i.isPending?`Opening…`:`Open its thread`}),(0,z.jsx)(`p`,{className:`text-meta`,children:i.error===null?`This task is older than task threads. It closes when the task ends.`:i.error.message})]})}function K(){let{taskId:e}=S({from:`/task/$taskId`}),n=l(e),a=t(),s=o(),d=c(),f=p(3e4);if(n.data===void 0)return(0,z.jsx)(P,{children:n.error instanceof r&&n.error.status===404?`There is no task ${e}.`:`Reading the task…`});let v=n.data,y=b(v),C=s.data?.find(e=>e.slug===v.project),w=a.data?.find(e=>e.id===v.id);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(F,{leading:(0,z.jsx)(I,{fallback:(0,z.jsx)(i,{to:`/p/$slug/tasks`,params:{slug:v.project},"aria-label":`Back to the tasks of ${C?.name??v.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:v.title,subtitle:`${C?.name??v.project} · ${h(v)} · created by ${T(v.createdBy)} ${u(v.createdAt,f)}`,trailing:(0,z.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${_[y]}`,children:x.find(e=>e.phase===y)?.label.toLowerCase()})}),(0,z.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,z.jsx)(`h3`,{className:`text-section`,children:`Plan`}),v.returned===void 0?null:(0,z.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 `,g(v,v.returned.from),` by `,v.returned.by,` `,u(v.returned.at,f),`. The work is redone from`,` `,g(v,v.stage),` until it reaches that stage again.`]}),(0,z.jsx)(`ol`,{className:`mt-3`,children:v.stages.map((e,t)=>(0,z.jsx)(W,{stage:e,index:t,task:v,members:d.data,now:f},e.id))}),(0,z.jsxs)(`p`,{className:`text-meta`,children:[`When the last stage is done:`,` `,v.onDone===`merge`?`task/${v.id} merges onto the default branch`:`nothing more`,v.blockedBy.length>0?(0,z.jsxs)(z.Fragment,{children:[` · blocked by `,(0,z.jsx)(O,{text:v.blockedBy.join(`, `)})]}):null]}),v.body.trim()===``?null:(0,z.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,z.jsx)(`h3`,{className:`text-section`,children:`Brief`}),(0,z.jsx)(`div`,{className:`mt-2`,children:(0,z.jsx)(M,{text:v.body})})]}),(0,z.jsx)(U,{task:v,now:f}),(0,z.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,z.jsx)(`h3`,{className:`text-section`,children:`Thread`}),a.data===void 0?null:w===void 0?m(v)?(0,z.jsx)(G,{taskId:v.id}):(0,z.jsx)(`p`,{className:`mt-2 text-meta`,children:`No thread on this task.`}):(0,z.jsx)(L,{thread:w,now:f,task:v,empty:`Nothing said yet. Each stage's handover lands here, and so does anything written below.`})]})]}),w?.state===`open`?(0,z.jsx)(E,{target:{threadId:v.id},placeholder:`Write in the task's thread`}):null]})}export{K as TaskView};
@@ -1 +0,0 @@
1
- import{P as e,St as t,_n as n,b as r,h as i,st as a,t as o,vn as s,xn as c,y as l}from"./format-11lojpK1.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-DnJj3psB.js";import{B as _,u as v}from"./index-BXq4t0NA.js";import{n as y,t as b}from"./Pane-B-pz52UC.js";var x=c(s(),1),S=n();function C({task:e}){let t=h(e);return(0,S.jsx)(`ol`,{className:`flex gap-1`,"aria-hidden":`true`,children:e.stages.map((n,r)=>{let i=n.completedBy!==void 0,a=p(e,n),o=i?`bg-emerald-400/60`:a?e.status===`claimed`?`bg-fg-primary/90`:`bg-amber-300/80`:t===`abandoned`?`bg-surface-2/50`:`bg-surface-2`;return(0,S.jsx)(`li`,{title:`${r+1}. ${n.name} · ${m(n)}${n.gate?` · gate`:``}`,className:`h-1.5 min-w-3 flex-1 rounded-full ${o} ${n.gate?`ring-1 ring-sky-300/70 ring-offset-1 ring-offset-surface-1`:``}`},n.id)})})}var w=5;function T({task:e,members:n,now:r}){let i=h(e),s=a(e);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(t,{to:`/task/$taskId`,params:{taskId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:e.title}),(0,S.jsx)(`span`,{className:`shrink-0 text-meta`,children:u(e)})]}),(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(C,{task:e})}),e.returned===void 0?null:(0,S.jsxs)(`p`,{className:`mt-1.5 truncate text-xs text-orange-300/90`,children:[`Sent back from `,f(e,e.returned.from),` by `,e.returned.by,` `,o(e.returned.at,r)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:e.status===`claimed`&&i!==`landing`&&s!==void 0?(0,S.jsxs)(S.Fragment,{children:[s.name,` · held by `,(0,S.jsx)(v,{name:e.claimedBy??``,members:n})]}):e.status===`open`&&i!==`landing`&&s!==void 0?`${s.name} · waiting for ${m(s)} since ${o(e.stageSince,r)}`:i===`landing`?`landing task/${e.id} on the default branch`:`${i} ${o(e.updatedAt,r)}`})]})})}function E(){let{slug:t}=_({from:`/p/$slug/tasks`}),n=e(t),a=r(),o=i(),s=l(3e4),[c,u]=(0,x.useState)(new Set),f=a.data?.find(e=>e.slug===t),p=d(n.data??[]),m=p.filter(e=>e.phase!==`done`&&e.phase!==`abandoned`).reduce((e,t)=>e+t.tasks.length,0);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(b,{title:`Tasks`,subtitle:`${f?.name??t} · ${m} in play · ${n.data?.length??0} in all`}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:n.data===void 0?(0,S.jsx)(y,{children:`Reading the tasks…`}):p.length===0?(0,S.jsx)(y,{children:`No tasks in this project yet.`}):p.map(e=>{let t=e.phase!==`done`&&e.phase!==`abandoned`||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:o.data,now:s},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 +0,0 @@
1
- import{St as e,_n as t,n,t as r}from"./format-11lojpK1.js";import{x as i}from"./index-BXq4t0NA.js";var a=t();function o(e){return e?.kind??`topic`}function s({state:e}){return(0,a.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${e===`open`?`bg-emerald-500/15 text-emerald-300`:`bg-surface-2 text-fg-tertiary`}`,children:e})}function c({thread:t,now:c}){let l=t.state===`closed`?n(t.body,180):``,u=t.messages===1?`1 message`:`${t.messages} messages`;return(0,a.jsxs)(e,{to:`/thread/$threadId`,params:{threadId:t.id},className:`mx-4 my-2 block rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:bg-surface-2/70`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`↳`}),(0,a.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:t.title}),(0,a.jsx)(s,{state:t.state})]}),(0,a.jsxs)(`p`,{className:`mt-1 text-meta`,children:[o(t.subject),` thread by `,t.openedBy,` · `,u,` · opened`,` `,r(t.openedAt,c)]}),l===``?null:(0,a.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-secondary`,children:(0,a.jsx)(i,{text:l,links:!1})})]})}export{c as n,o as r,s as t};
@@ -1 +0,0 @@
1
- import{D as e,R as t,St as n,Xt as r,_n as i,h as a,j as o,t as s,vn as c,xn as l,y as u}from"./format-11lojpK1.js";import{B as d,I as f,c as p,d as m,i as h}from"./index-BXq4t0NA.js";import{t as g}from"./Markdown-MZnGPfvk.js";import{t as _}from"./MessageItem-Deq-ntT8.js";import{n as v,t as y}from"./Pane-B-pz52UC.js";import{r as b,t as x}from"./ThreadCard-BTGP4fOT.js";import{t as S}from"./ThreadForms-BipMby65.js";import{t as C}from"./useStickyScroll-D_7q2RKi.js";import{t as w}from"./BackLink-DivaHiZ7.js";var T=l(c(),1),E=i();function D(){let{threadId:e}=d({from:`/thread/$threadId`});return(0,E.jsx)(O,{id:e},e)}function O({id:i}){let{api:c}=e(),l=r({queryKey:[`thread`,i],queryFn:()=>c.thread(i)}),d=a(),D=u(3e4),O=l.data?.messages??[],k=O.at(-1)?.id??null;(0,T.useEffect)(()=>f(i,k),[i,k]);let{ref:A,onScroll:j}=C(),[M,N]=(0,T.useState)(!1),P=l.data?.thread.subject,F=o(P?.kind===`task`?P.id:null);if(l.data===void 0)return(0,E.jsx)(v,{children:l.error instanceof t&&l.error.status===404?`There is no thread ${i}.`:`Reading the thread…`});let{thread:I}=l.data;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y,{leading:(0,E.jsx)(w,{fallback:(0,E.jsx)(n,{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:`${b(I.subject)} thread in #${I.channel} · opened by ${m(I.openedBy)} ${s(I.openedAt,D)}`,trailing:(0,E.jsxs)(E.Fragment,{children:[I.subject?.kind===`task`?(0,E.jsx)(n,{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,E.jsx)(n,{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,E.jsx)(p,{onClick:()=>N(!0),children:`Close`}):(0,E.jsx)(x,{state:I.state})]})}),M&&I.state===`open`?(0,E.jsx)(S,{threadId:I.id,channel:I.channel,onDone:()=>N(!1)}):null,(0,E.jsxs)(`div`,{ref:A,onScroll:j,className:`flex-1 overflow-y-auto py-2`,children:[O.length===0?(0,E.jsx)(v,{children:`No messages in this thread yet.`}):null,O.map(e=>(0,E.jsx)(_,{message:e,members:d.data,now:D,task:F.data},e.id)),I.state===`closed`?(0,E.jsxs)(`section`,{className:`mx-4 mt-3 mb-2 rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:[(0,E.jsxs)(`p`,{className:`text-caps`,children:[`Closed by `,m(I.closedBy??`board`),I.closedAt===void 0?``:` ${s(I.closedAt,D)}`]}),I.body.trim()===``?(0,E.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`It ended with its `,b(I.subject),`.`]}):(0,E.jsx)(g,{text:I.body})]}):null]}),I.state===`open`?(0,E.jsx)(h,{target:{threadId:I.id},placeholder:`Reply in the thread`}):null]})}export{D as ThreadView};
@@ -1 +0,0 @@
1
- import{at as e}from"./format-11lojpK1.js";import{p as t}from"./index-BXq4t0NA.js";function n(e){return e===`society`?`the society`:e}function r(t){return[...t.memberships,e]}function i(e){return e.startedAt===void 0?null:t(e.startedAt,Date.parse(e.ts))}var a={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`interrupted`,blocked:`blocked`,stopped:`stopped by you`};function o(e){return e.exitReason===null?e.outcome===`failed`?`failed`:`completed`:a[e.exitReason]??e.exitReason}function s(e){return e.outcome===`failed`||e.exitReason!==null&&e.exitReason!==`completed`&&e.exitReason!==`stopped`}function c(e,t){return t===`codex`&&e.costUsd===0?`unmetered`:`$${e.costUsd.toFixed(2)}`}function l(e){return{turns:e.length,failed:e.filter(s).length,costUsd:e.reduce((e,t)=>e+t.costUsd,0)}}function u(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 d(e,t){let n=[...e.homeRunner===void 0?[]:[{what:`outside projects`,runner:e.homeRunner}],...e.memberships.map(e=>({what:e,runner:t.get(e)}))],r=[...new Set(n.flatMap(e=>e.runner===void 0?[]:[e.runner]))],i=n.map(e=>`${e.what}: ${e.runner??`placed on its first turn`}`).join(`; `);return{label:r.length===0?`no runner yet`:`on ${r.join(`, `)}`,detail:i===``?`pinned to a runner on its first turn`:i}}export{n as a,u as c,d as i,o as n,i as o,l as r,r as s,c as t};