@kubitnodes/stellaris 0.3.10 → 0.3.11

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 (46) hide show
  1. package/dist/cli/index.js +533 -117
  2. package/dist/server/index.js +900 -197
  3. package/package.json +1 -1
  4. package/web/dist/assets/BackLink-C-vad6K2.js +1 -0
  5. package/web/dist/assets/ChannelForms-jNbbNnIC.js +1 -0
  6. package/web/dist/assets/ChannelView-kLoegYUQ.js +1 -0
  7. package/web/dist/assets/CitizenView-Cb8f2mB7.js +2 -0
  8. package/web/dist/assets/{CitizensView-DttP5FqR.js → CitizensView-Ds2rojfa.js} +1 -1
  9. package/web/dist/assets/KnowledgeView-k10TU0jc.js +1 -0
  10. package/web/dist/assets/{Markdown-4W4xjIq7.js → Markdown-J2pAPfCa.js} +3 -3
  11. package/web/dist/assets/{MessageItem-Bfpve1_Y.js → MessageItem-BjM8BdpK.js} +1 -1
  12. package/web/dist/assets/{MetricsView-Bp486U0v.js → MetricsView-D9N54rV7.js} +1 -1
  13. package/web/dist/assets/{NeedsYouView-CJ4COcNn.js → NeedsYouView-ML8i7Pl7.js} +1 -1
  14. package/web/dist/assets/{Overview-BnO1K52h.js → Overview-BBXvRhfR.js} +1 -1
  15. package/web/dist/assets/{Pane-xzIpwnBD.js → Pane-caYWCiyo.js} +1 -1
  16. package/web/dist/assets/ProjectView-sDpFNjcW.js +1 -0
  17. package/web/dist/assets/ProposalView-Bc91NjKC.js +1 -0
  18. package/web/dist/assets/{ProposalsView-XrraDhwt.js → ProposalsView-Dg_bEryX.js} +1 -1
  19. package/web/dist/assets/{RunnersView-H3kCdSQB.js → RunnersView-Dv5nbwYv.js} +1 -1
  20. package/web/dist/assets/SocietyView-ClaEWgOq.js +1 -0
  21. package/web/dist/assets/SubjectThread-D_L3vB-A.js +1 -0
  22. package/web/dist/assets/{TaskFileView-CRwwL5K8.js → TaskFileView-B19YtrtW.js} +2 -2
  23. package/web/dist/assets/{TaskView-A9IgTxQ0.js → TaskView-FYSoCb3T.js} +1 -1
  24. package/web/dist/assets/{TasksView-CnhTIldG.js → TasksView-CniXTU3R.js} +1 -1
  25. package/web/dist/assets/{ThreadCard-fvf8cY_l.js → ThreadCard-DCpvhSlc.js} +1 -1
  26. package/web/dist/assets/{ThreadForms-D09Ykgj9.js → ThreadForms-DUGkAwTp.js} +1 -1
  27. package/web/dist/assets/ThreadView-D8eXlVbC.js +1 -0
  28. package/web/dist/assets/citizen-BtOZq62_.js +1 -0
  29. package/web/dist/assets/{format-lz-5NQWT.js → format-EfoceZkm.js} +1 -1
  30. package/web/dist/assets/index-BeOGtAz0.css +2 -0
  31. package/web/dist/assets/index-D75IxLme.js +23 -0
  32. package/web/dist/assets/{tasks-DK1cnXqs.js → tasks-Duke4U7N.js} +1 -1
  33. package/web/dist/assets/{useStickyScroll-CfP3Yl_4.js → useStickyScroll-n5d7sdPZ.js} +1 -1
  34. package/web/dist/index.html +4 -4
  35. package/web/dist/assets/BackLink-B3tz8OFm.js +0 -1
  36. package/web/dist/assets/ChannelView-Dkzr1zkF.js +0 -1
  37. package/web/dist/assets/CitizenView-BLgyEvYz.js +0 -2
  38. package/web/dist/assets/KnowledgeView-DFAC95aF.js +0 -1
  39. package/web/dist/assets/ProjectView-w0mcF0KW.js +0 -1
  40. package/web/dist/assets/ProposalView-CyJCwUYK.js +0 -1
  41. package/web/dist/assets/SocietyView-Cf8ENDAw.js +0 -1
  42. package/web/dist/assets/SubjectThread-ClMmgVVd.js +0 -1
  43. package/web/dist/assets/ThreadView-BqNSssCf.js +0 -1
  44. package/web/dist/assets/citizen-C27Wvimj.js +0 -1
  45. package/web/dist/assets/index-CoKyPk79.js +0 -23
  46. package/web/dist/assets/index-t2fXHB5Y.css +0 -2
@@ -1 +1 @@
1
- import{dt as e,ut as t}from"./format-lz-5NQWT.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
+ import{mt as e,pt as t}from"./format-EfoceZkm.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{pn as e,un as t}from"./format-lz-5NQWT.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};
1
+ import{gn as e,pn as t}from"./format-EfoceZkm.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-CoKyPk79.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/format-lz-5NQWT.js">
11
- <link rel="modulepreload" crossorigin href="/assets/tasks-DK1cnXqs.js">
12
- <link rel="stylesheet" crossorigin href="/assets/index-t2fXHB5Y.css">
9
+ <script type="module" crossorigin src="/assets/index-D75IxLme.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/format-EfoceZkm.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/tasks-Duke4U7N.js">
12
+ <link rel="stylesheet" crossorigin href="/assets/index-BeOGtAz0.css">
13
13
  </head>
14
14
  <body class="antialiased">
15
15
  <div id="root"></div>
@@ -1 +0,0 @@
1
- import{b as e,ln as t,wt as n}from"./format-lz-5NQWT.js";import{L as r,S as i,n as a,r as o,t as s}from"./index-CoKyPk79.js";var c=t(),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:t}){let u=n(),d=r({select:e=>e.location.state.__TSR_index}),f=o(),p=i(),m=e(),h=a(f,d);if(h===null)return t;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,Ht as n,R as r,b as i,g as a,ln as o,pn as s,un as c,y as l}from"./format-lz-5NQWT.js";import{I as u,V as d,c as f,i as p}from"./index-CoKyPk79.js";import{t as m}from"./MessageItem-Bfpve1_Y.js";import{n as h,t as g}from"./Pane-xzIpwnBD.js";import{n as _}from"./ThreadCard-fvf8cY_l.js";import{i as v}from"./ThreadForms-D09Ykgj9.js";import{t as y}from"./useStickyScroll-CfP3Yl_4.js";var b=s(c(),1),x=o();function S(){let{_splat:e=`general`}=d({from:`/c/$`});return(0,x.jsx)(C,{channel:e},e)}function C({channel:o}){let{api:s}=e(),c=n({queryKey:[`channel`,o],queryFn:()=>s.channel(o)}),d=t(),S=a(),C=i(),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=(d.data??[]).filter(e=>e.channel===o).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,d.data,o]),O=c.data?.at(-1)?.id??null;(0,b.useEffect)(()=>u(o,O),[o,O]);let{ref:k,onScroll:A}=y(),[j,M]=o.split(`/`),N=M??j??o,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:o,onDone:()=>E(!1)}):null,(0,x.jsx)(`div`,{ref:k,onScroll:A,className:`flex-1 overflow-y-auto py-2`,children:c.error instanceof r&&c.error.status===404?(0,x.jsxs)(h,{children:[`There is no channel `,o,`.`]}):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:o},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,T as s,_ as c,a as l,cn as u,ct as d,d as f,f as p,g as m,ln as h,o as g,p as _,pn as v,t as y,un as b,w as x,y as S}from"./format-lz-5NQWT.js";import{B as C,H as w,R as T,S as E,T as D,V as ee,_ as te,c as O,f as k,g as ne,h as re,i as ie,m as A,p as j,v as M,x as N,y as P}from"./index-CoKyPk79.js";import{t as F}from"./Markdown-4W4xjIq7.js";import{n as I,t as ae}from"./Pane-xzIpwnBD.js";import{n as oe,r as L}from"./ThreadForms-D09Ykgj9.js";import{t as se}from"./useStickyScroll-CfP3Yl_4.js";import{a as R,c as ce,i as z,l as B,n as le,o as V,s as ue,t as de}from"./citizen-C27Wvimj.js";var H=v(b(),1),U=h(),fe={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`was interrupted`,blocked:`was blocked`,stopped:`was stopped by you`};function W(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function G({label:e,tone:t,children:n}){return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`px-0.5 pb-0.5 text-[10px] tracking-wider text-fg-muted uppercase`,children:e}),(0,U.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,U.jsx)(`li`,{className:`py-1.5 text-sm`,title:W(e.at),children:(0,U.jsx)(F,{text:e.text})});if(e.kind===`error`)return(0,U.jsx)(`li`,{className:`py-1 font-mono text-xs break-words text-red-400`,title:W(e.at),children:e.message});if(e.kind===`steer`)return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,U.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,U.jsx)(`span`,{"aria-hidden":`true`,className:`grid w-3 shrink-0 place-items-center text-sky-300`,children:`↳`}),(0,U.jsxs)(`span`,{className:`shrink-0 text-fg-tertiary`,children:[`Took `,re(e.posts.length)]}),(0,U.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,U.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:W(e.at)})]}),(0,U.jsx)(`ul`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:e.posts.map(e=>(0,U.jsxs)(`li`,{className:`rounded-md bg-surface-0/40 px-2.5 py-2`,children:[(0,U.jsxs)(`p`,{className:`flex gap-1.5 text-meta`,children:[(0,U.jsx)(`span`,{className:`text-fg-secondary`,children:e.author}),(0,U.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`in `,e.where]}),e.at===``?null:(0,U.jsx)(`span`,{className:`ml-auto shrink-0 font-mono`,children:W(e.at)})]}),(0,U.jsx)(`div`,{className:`mt-1 text-sm`,children:(0,U.jsx)(F,{text:e.body})})]},`${e.at}-${e.author}`))})]})});let n=e.ok===null?(0,U.jsx)(`span`,{"aria-label":`running`,className:`size-1.5 animate-pulse rounded-full bg-amber-300`}):e.ok?(0,U.jsx)(`span`,{"aria-label":`succeeded`,className:`text-[11px] text-emerald-400`,children:`✓`}):(0,U.jsx)(`span`,{"aria-label":`failed`,className:`text-[11px] text-red-400`,children:`✕`});return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,U.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,U.jsx)(`span`,{className:`grid w-3 shrink-0 place-items-center`,children:n}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-fg-tertiary`,children:ne(e.name)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-fg-secondary`,children:e.summary}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:W(e.at)})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:[(0,U.jsx)(G,{label:`Input`,tone:`text-fg-secondary`,children:e.detail}),e.output===null?null:(0,U.jsx)(G,{label:e.ok===!1?`Returned an error`:`Returned`,tone:e.ok===!1?`text-red-300`:`text-fg-tertiary`,children:e.output})]})]})})}function K({steps:e}){let[t,n]=(0,H.useState)(!1),r=e.filter(e=>e.kind===`tool`).length;return e.length===0?(0,U.jsx)(`p`,{className:`mt-2 text-meta`,children:`No steps yet.`}):(0,U.jsxs)(U.Fragment,{children:[r===0?null:(0,U.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-meta`,children:[r===1?`1 tool call`:`${r} tool calls`,(0,U.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,U.jsx)(`ol`,{className:`mt-1 space-y-0.5`,children:e.map(e=>(0,U.jsx)(pe,{step:e,open:t},e.seq))})]})}function me({turn:e,running:t,now:n}){return e.end===null?t?(0,U.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-meta`,"aria-live":`polite`,children:[(0,U.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}),`Working · last step `,y(e.lastAt,n)]}):(0,U.jsx)(`p`,{className:`mt-3 text-meta`,children:`The turn ended without a report.`}):(0,U.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,U.jsxs)(`p`,{className:`text-caps`,children:[`The turn `,fe[e.end.exitReason],` `,y(e.end.at,n),e.fromStart?` · ${j(e.startedAt,Date.parse(e.end.at))}`:``]}),e.end.summary===null?null:(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:e.end.summary})]})}var q=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,U.jsxs)(`div`,{children:[(0,U.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[e.path,e.status===`modified`?``:(0,U.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,e.status]})]}),e.patch===null?(0,U.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown.`}):e.patch===``?(0,U.jsx)(`p`,{className:`mt-1 text-meta`,children:`Empty.`}):(0,U.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,U.jsx)(`span`,{className:`block whitespace-pre-wrap break-words ${ye(e)}`,children:e===``?` `:e},t))}),e.truncated?(0,U.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=f(e,t.commit,!0);return(0,U.jsxs)(`div`,{className:`space-y-3 px-4 pt-1 pb-3`,children:[(0,U.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,U.jsx)(T,{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,U.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,W(t.at)]})]}),n.data===void 0?(0,U.jsx)(`p`,{className:`text-meta`,children:n.isError?`Could not read the change.`:`Reading the change…`}):n.data.map(e=>(0,U.jsx)(be,{file:e},e.path))]})}function Se({name:e,change:t,now:n}){let[r,i]=(0,H.useState)(!1),a=t.files.length===0?t.subject:ve(t);return(0,U.jsx)(`li`,{className:`border-b border-line/60 last:border-b-0`,children:(0,U.jsxs)(`details`,{className:`group`,onToggle:e=>i(e.currentTarget.open),children:[(0,U.jsx)(`summary`,{"aria-label":`${ge[t.kind]} ${y(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,U.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:he[t.kind]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:a}),(0,U.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:y(t.at,n)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]})}),r?(0,U.jsx)(xe,{name:e,change:t}):null]})})}function Ce({name:e}){let[t,n]=(0,H.useState)(q),r=_(e,t),i=S(3e4);if(r.data===void 0)return(0,U.jsx)(I,{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,U.jsxs)(I,{children:[e,`'s home has no history yet; it starts with the citizen's first turn.`]}):(0,U.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,U.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,U.jsx)(`ol`,{children:a.map(t=>(0,U.jsx)(Se,{name:e,change:t,now:i},t.commit))}),o?(0,U.jsx)(`button`,{type:`button`,onClick:()=>n(t+q),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:`Show earlier changes`}):null]})}function J({title:e,children:t}){return(0,U.jsxs)(`section`,{className:`border-t border-line pt-4 first:border-t-0 first:pt-0`,children:[(0,U.jsx)(`h3`,{className:`text-section`,children:e}),(0,U.jsx)(`div`,{className:`mt-2`,children:t})]})}function we({member:e,charter:t}){let n=c(e.name),r=g(e.name),i=p(e.name),a=S(3e4);return(0,U.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,U.jsxs)(J,{title:`Edits to reconcile`,children:[(0,U.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,U.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:i.data.map(e=>(0,U.jsxs)(`li`,{className:`text-sm`,children:[(0,U.jsx)(`span`,{className:`text-fg-primary`,children:e.file}),(0,U.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.path.slice(e.path.lastIndexOf(`/`)+1),` · left`,` `,y(e.since,a)]})]},e.path))})]}),(0,U.jsx)(J,{title:`Profile`,children:e.profile.trim()===``?(0,U.jsx)(`p`,{className:`text-meta`,children:`No profile yet. The citizen writes its own profile.md.`}):(0,U.jsx)(F,{text:B(e.profile,`Profile`)})}),(0,U.jsx)(J,{title:`Core memory`,children:n.data===void 0?(0,U.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):n.data.body.trim()===``?(0,U.jsx)(`p`,{className:`text-meta`,children:`Empty. Every turn loads this file in full.`}):(0,U.jsx)(F,{text:B(n.data.body,`Core memory`)})}),(0,U.jsx)(J,{title:`Own skills`,children:r.data===void 0?(0,U.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):r.data.length===0?(0,U.jsx)(`p`,{className:`text-meta`,children:`None yet.`}):(0,U.jsx)(`ul`,{className:`space-y-1.5`,children:r.data.map(e=>(0,U.jsxs)(`li`,{className:`text-sm`,children:[(0,U.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,U.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]},e.name))})}),t===void 0?null:(0,U.jsxs)(J,{title:`Charter of ${t.name}`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:t.purpose}),(0,U.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,U.jsx)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:t.verbs.map(e=>(0,U.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 Te(e,t){let n=r(e,t?.turnId??null);return{turn:(0,H.useMemo)(()=>t===void 0||n.data===void 0?void 0:te(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 Ee({name:e,entry:t,now:n,opened:r}){let[i,a]=(0,H.useState)(r),o=(0,H.useRef)(null);(0,H.useEffect)(()=>{r&&o.current?.scrollIntoView({block:`start`})},[r]);let s=E(),c=ue(t),l=t.thread===void 0?null:s.get(t.thread)?.title??`a thread`,u=t.error??t.summary??``,d=t.error===null?`text-fg-secondary`:`text-red-300`;return(0,U.jsx)(`li`,{ref:o,className:`border-b border-line/60 last:border-b-0`,children:(0,U.jsxs)(`details`,{className:`group`,open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,U.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,U.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:[z(t.project),l===null?``:` · ${l}`]}),(0,U.jsx)(`span`,{className:`text-fg-muted`,children:t.trigger}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-fg-muted`,children:[de(t),` `,y(t.ts,n)]}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,title:t.usage===void 0?void 0:R(t.usage),children:[c,t.toolCalls===void 0?null:`${t.toolCalls} tools`,t.usage===void 0?null:V(t.usage)].filter(e=>e!==null).join(` · `)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]}),u.trim()===``?null:(0,U.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-xs leading-relaxed group-open:hidden ${d}`,children:(0,U.jsx)(N,{text:u,links:!1})})]}),i?(0,U.jsx)(De,{name:e,entry:t,text:u,tone:d}):null]})})}function De({name:e,entry:t,text:n,tone:r}){let i=Te(e,t);return(0,U.jsxs)(`div`,{className:`px-4 pt-1 pb-3`,children:[n.trim()===``?null:(0,U.jsx)(`p`,{className:`text-xs leading-relaxed whitespace-pre-wrap ${r}`,children:(0,U.jsx)(N,{text:n})}),(0,U.jsx)(`div`,{className:`mt-2`,children:t.turnId===void 0?(0,U.jsx)(`p`,{className:`text-meta`,children:`This turn ran before turns kept their steps.`}):i.loading?(0,U.jsx)(`p`,{className:`text-meta`,children:`Reading the steps…`}):i.turn===void 0?(0,U.jsx)(`p`,{className:`text-meta`,children:`No steps were kept for this turn.`}):(0,U.jsxs)(U.Fragment,{children:[t.startedAt===void 0?null:(0,U.jsxs)(`p`,{className:`text-caps`,children:[`Started `,W(t.startedAt)]}),(0,U.jsx)(K,{steps:i.turn.steps})]})})]})}function Oe({name:e,opened:t}){let[n,r]=(0,H.useState)(Y),a=i(e,n),o=S(3e4);if(a.data===void 0)return(0,U.jsx)(I,{children:`Reading the turns…`});let s=a.data.toReversed();if(s.length===0)return(0,U.jsxs)(I,{children:[e,` has not finished a turn yet.`]});let c=le(s),l=c.usage===null?``:` · ${V(c.usage)}${c.withUsage<c.turns?` over ${c.withUsage} of them`:``}`;return(0,U.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,U.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,title:c.usage===null?void 0:R(c.usage),children:[c.turns===1?`1 turn`:`${c.turns} turns`,c.failed===0?``:`, ${c.failed} not completed`,l]}),t!==null&&!s.some(e=>e.turnId===t)?(0,U.jsx)(`p`,{className:`px-4 pb-1 text-meta`,children:a.data.length===n?`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,U.jsx)(`ol`,{children:s.map(n=>(0,U.jsx)(Ee,{name:e,entry:n,now:o,opened:t!==null&&n.turnId===t},n.id))}),a.data.length===n?(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(n+Y),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show `,Y,` earlier turns`]}):null]})}function ke(e){return e===void 0?``:`${e.name}${e.id===null?``:` · ${e.id}`}`}function X({label:e,choices:t,value:n,onChange:r,listClassName:i=`inset-x-0`}){let[a,o]=(0,H.useState)(!1),s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=(0,H.useRef)([]),u=t.findIndex(e=>e.value===n);(0,H.useEffect)(()=>{if(!a)return;l.current[Math.max(u,0)]?.focus();let e=e=>{e.target instanceof Node&&s.current?.contains(e.target)===!0||o(!1)};return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[a,u]);let d=e=>{if(e.key===`Escape`){e.stopPropagation(),o(!1),c.current?.focus();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=(l.current.findIndex(e=>e===document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length;l.current[n]?.focus()},f=t[u];return(0,U.jsxs)(`div`,{ref:s,className:`relative min-w-0 flex-1`,children:[(0,U.jsxs)(`button`,{ref:c,type:`button`,"aria-label":`${e}: ${ke(f)}`,"aria-expanded":a,onClick:()=>o(!a),onKeyDown:a?d: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,U.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:[f?.name,f?.id===null||f===void 0?null:(0,U.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,f.id]})]}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] text-fg-muted transition-transform ${a?`rotate-180`:``}`,children:`▾`})]}),a?(0,U.jsx)(`div`,{className:`absolute ${i} 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,U.jsxs)(`button`,{ref:e=>{l.current[t]=e},type:`button`,"aria-current":i?`true`:void 0,onKeyDown:d,onClick:()=>{r(e.value),o(!1),c.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,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`block truncate text-xs text-fg-secondary`,children:[e.name,e.id===null?null:(0,U.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,e.id]})]}),e.description===``?null:(0,U.jsx)(`span`,{className:`block truncate text-[11px] text-fg-muted`,children:e.description})]}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 shrink-0 pt-px text-[11px] text-fg-primary`,children:i?`✓`:``})]},e.value)})}):null]})}var Z=``,Q=``;function Ae(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 je(e,t){return[{value:Q,name:`Default`,id:e?.defaultEffort??null,description:`Whatever the model runs unset.`},...(e?.efforts??[]).map(e=>({value:e.id,name:e.id,id:null,description:e.description})),...t===null?[]:[{value:t,name:t,id:null,description:`Not in the model's list.`}]]}function Me({member:t,onDone:n}){let{api:r}=e(),i=u(),a=l(t.name),s=t.model??Z,c=t.effort??Q,[d,f]=(0,H.useState)(s),[p,m]=(0,H.useState)(c),h=w({mutationFn:async()=>{d!==s&&await r.setModel(t.name,d===Z?null:d),p!==c&&await r.setEffort(t.name,p===Q?null:p)},onSettled:()=>void i.invalidateQueries({queryKey:[`members`]}),onSuccess:n}),g=a.data?.models??[],_=t.model!==void 0&&!g.some(e=>e.id===t.model)?t.model:null,v=e=>g.find(t=>e===Z?t.isDefault:t.id===e),y=v(d)?.efforts??[],b=p!==Q&&!y.some(e=>e.id===p)?p:null,x=e=>{f(e);let t=v(e)?.efforts??[];p!==Q&&!t.some(e=>e.id===p)&&m(Q)},S=d!==s||p!==c;return(0,U.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(),h.mutate()},children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.isPending?(0,U.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Asking `,t.cli,` for its models…`]}):a.error===null?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{label:`Model`,choices:Ae(g,_),value:d,onChange:x}),y.length===0&&b===null?null:(0,U.jsx)(`div`,{className:`flex w-32 shrink-0`,children:(0,U.jsx)(X,{label:`Effort`,choices:je(v(d),b),value:p,onChange:m,listClassName:`right-0 w-64`})})]}):(0,U.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,U.jsx)(O,{onClick:n,children:`Cancel`}),(0,U.jsx)(O,{variant:`primary`,type:`submit`,disabled:h.isPending||!S||a.error!==null,children:h.isPending?`Saving…`:`Save`})]}),a.data===void 0?null:(0,U.jsxs)(`p`,{className:`text-meta`,children:[`As `,a.data.cli,` on `,a.data.runner,` lists them, where this citizen's turns run.`]}),(0,U.jsx)(L,{error:h.error})]})}var $=``;function Ne(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 Pe(e,t){return[{value:$,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:Ne(e,t)}))]}function Fe({member:t,onDone:n}){let{api:r}=e(),i=u(),a=s(),o=t.homeRunner??$,[c,l]=(0,H.useState)(o),d=w({mutationFn:()=>r.setRunner(t.name,c===$?null:c),onSuccess:()=>{i.invalidateQueries({queryKey:[`members`]}),n()}});return(0,U.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(),d.mutate()},children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.data===void 0?(0,U.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`Reading the runners…`}):(0,U.jsx)(X,{label:`Runner`,choices:Pe(a.data,t),value:c,onChange:l}),(0,U.jsx)(O,{onClick:n,children:`Cancel`}),(0,U.jsx)(O,{variant:`primary`,type:`submit`,disabled:d.isPending||c===o,children:d.isPending?`Saving…`:`Run here`})]}),(0,U.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,U.jsx)(L,{error:d.error})]})}function Ie(e){return e.thread===void 0?{channel:e.channel??(e.scope===`society`?`general`:`${e.scope}/general`)}:{threadId:e.thread}}function Le({name:t,turn:n}){let{api:r}=e(),i=u(),[a,o]=(0,H.useState)(!1),s=w({mutationFn:()=>r.stopTurn(n.turnId),onSuccess:()=>{o(!1),i.invalidateQueries({queryKey:[`scheduler`]})}});return(0,U.jsxs)(`div`,{className:`border-t border-line`,children:[(0,U.jsx)(ie,{target:Ie(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,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-3`,children:[(0,U.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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(O,{onClick:()=>{o(!1),s.reset()},children:`Keep it running`}),(0,U.jsx)(O,{variant:`primary`,disabled:s.isPending,onClick:()=>{s.mutate()},children:s.isPending?`Stopping…`:`Stop the turn`})]}):(0,U.jsx)(O,{onClick:()=>o(!0),children:`Stop…`})]}):null,s.error===null?null:(0,U.jsx)(`div`,{className:`px-3 pb-3`,children:(0,U.jsx)(L,{error:s.error})})]})}function Re({member:t,scopes:n,preferred:r,running:i,paused:a,onDone:o}){let{api:s}=e(),c=u(),[l,d]=(0,H.useState)(`manual`),[f,p]=(0,H.useState)(r!==null&&n.includes(r)?r:n[0]??``),[m,h]=(0,H.useState)(``),g=(0,H.useRef)(null);(0,H.useEffect)(()=>g.current?.focus(),[]);let _=w({mutationFn:()=>s.wake({agent:t.name,project:f,kind:l,...m.trim()===``?{}:{reason:m.trim()}}),onSuccess:()=>{c.invalidateQueries({queryKey:[`scheduler`]}),o()}}),v=z(f),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(f)?` ${t.name} is in a turn there now; this one follows it.`:``;return(0,U.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,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,U.jsx)(`legend`,{className:`sr-only`,children:`Kind of turn`}),[`manual`,`reflection`].map(e=>(0,U.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,U.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:l===e,onChange:()=>d(e),className:`sr-only`}),e===`manual`?`A turn`:`A reflection`]},e))]}),(0,U.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-xs text-fg-tertiary`,children:[`at`,(0,U.jsx)(`select`,{value:f,onChange:e=>p(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,U.jsx)(`option`,{value:e,children:z(e)},e))})]})]}),(0,U.jsx)(`textarea`,{ref:g,value:m,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:`${oe} resize-none`}),(0,U.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[y,b,` Each turn costs money.`]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,U.jsx)(O,{onClick:o,children:`Cancel`}),(0,U.jsx)(O,{variant:`primary`,type:`submit`,disabled:_.isPending||f===``,children:_.isPending?`Waking…`:l===`reflection`?`Ask for a reflection`:`Wake ${t.name}`})]}),(0,U.jsx)(L,{error:_.error})]})}var ze={working:`bg-emerald-500/15 text-emerald-300`,queued:`bg-amber-500/15 text-amber-300`,idle:`bg-surface-2 text-fg-tertiary`};function Be({project:e,name:t}){let n=(a(e).data??[]).filter(e=>e.status===`claimed`&&e.claimedBy===t);return n.length===0?null:(0,U.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:n.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(T,{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,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,U.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate font-mono text-[11px] text-fg-muted`,children:d(e)?.name??e.stage})]})},e.id))})}function Ve(){let{name:e}=ee({from:`/citizen/$name`}),{scope:t,tab:n,turn:r}=C({from:`/citizen/$name`});return(0,U.jsx)(Ue,{name:e,chosen:t??null,tab:n??`now`,turn:r??null},e)}var He=[{tab:`now`,label:`Now`},{tab:`turns`,label:`Turns`},{tab:`memory`,label:`Memory`},{tab:`history`,label:`History`}];function Ue({name:e,chosen:r,tab:i,turn:a}){let o=m(),s=x(),c=t(),l=P(),[u,d]=(0,H.useState)(null),f=o.data?.find(t=>t.name===e);if(f===void 0)return(0,U.jsx)(I,{children:o.data===void 0?`Reading the roster…`:`There is no citizen ${e}.`});let p=n(c.data?.running??[]).filter(t=>t.agent===e),h=[...new Set(p.map(e=>e.scope))],g=p.map(e=>A(e.agent,e.scope,e.thread)),_=n(c.data?.pending??[]).find(t=>t.agent===e),v=h.length>0?`working`:_===void 0?`idle`:`queued`,y=M(l,e)[0],b=y?.model??f.lastModel,S=b??f.model??`CLI default`,C=f.model!==void 0&&f.model!==b?f.model:null,w=s.data?.find(e=>e.name===f.role),E=ce(f),ee=f.status===`active`&&f.cli!==null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ae,{leading:f.cli===null?null:(0,U.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2/70`,children:(0,U.jsx)(D,{cli:f.cli,size:20})}),title:e,subtitle:(0,U.jsxs)(U.Fragment,{children:[f.role,` · `,S,C===null?``:` · set to ${C}`,f.effort===void 0?``:` · ${f.effort} effort`,f.homeRunner===void 0?``:` · on ${f.homeRunner}`,f.status===`retired`?` · retired`:``]}),trailing:(0,U.jsxs)(U.Fragment,{children:[ee&&u===null?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(O,{onClick:()=>d(`model`),children:`Model…`}),(0,U.jsx)(O,{onClick:()=>d(`runner`),children:`Runner…`}),(0,U.jsx)(O,{onClick:()=>d(`wake`),children:`Wake…`})]}):null,(0,U.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${ze[v]}`,children:v})]})}),u===`wake`?(0,U.jsx)(Re,{member:f,scopes:E,preferred:r?.split(`/`)[0]??y?.scope??null,running:h,paused:c.data?.paused??!1,onDone:()=>d(null)}):u===`model`?(0,U.jsx)(Me,{member:f,onDone:()=>d(null)}):u===`runner`?(0,U.jsx)(Fe,{member:f,onDone:()=>d(null)}):null,(0,U.jsx)(`nav`,{"aria-label":`Citizen views`,className:`flex gap-1 border-b border-line px-3 py-2`,children:He.map(t=>(0,U.jsx)(T,{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,U.jsx)(Oe,{name:e,opened:a},a):i===`memory`?(0,U.jsx)(we,{member:f,charter:w}):i===`history`?(0,U.jsx)(Ce,{name:e}):(0,U.jsx)(Ge,{name:e,chosen:r,lastTurnAt:f.lastTurnAt,state:v,runningScopes:h,runningKeys:g,runningTurns:(c.data?.turns??[]).filter(t=>t.agent===e),queuedScope:_?.scope??null})]})}function We(e){return e.toSorted((e,t)=>e.startedAt.localeCompare(t.startedAt))[0]}function Ge({name:e,chosen:t,lastTurnAt:n,state:r,runningScopes:a,runningKeys:o,runningTurns:s,queuedScope:c}){let l=P(),u=S(5e3),{ref:d,onScroll:f}=se(),p=M(l,e),m=i(e,1),h=Te(e,p.length===0?m.data?.at(-1):void 0),g=E(),_=e=>e.end===null&&o.includes(A(e.agent,e.scope,e.thread)),v=t?.split(`/`)[0]??null,b=(t?.includes(`/`)===!0?p.find(e=>k(e)===t):void 0)??We(p.filter(e=>e.scope===v&&_(e)))??p.find(e=>k(e)===t)??We(p.filter(_))??p[0]??h.turn,x=e=>e.thread===void 0?z(e.scope):`${z(e.scope)} · ${g.get(e.thread)?.title??`a thread`}`,C=b!==void 0&&_(b),w=b?.scope??a[0]??c,D=(b===void 0?void 0:s.find(e=>e.scope===b.scope&&e.thread===b.thread))??(C?void 0:s[0]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`section`,{className:`border-b border-line px-4 py-3 text-xs text-fg-tertiary`,children:[(0,U.jsx)(`p`,{children:C?`In a turn at ${z(b.scope)} for ${b.fromStart?``:`at least `}${j(b.startedAt,u)}`:a.length>0?`In a turn at ${a.map(z).join(` and `)}`:c===null?n===void 0?`No turns yet`:`Last turn ${y(n,u)}`:`Queued for a turn at ${z(c)}`}),w===null||w===`society`?null:(0,U.jsx)(Be,{project:w,name:e})]}),(0,U.jsx)(`div`,{ref:d,onScroll:f,className:`flex-1 overflow-y-auto px-4 py-3`,children:b===void 0?(0,U.jsx)(I,{children:r===`working`?`The turn has not reported a step yet.`:h.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,U.jsxs)(U.Fragment,{children:[p.length>1?(0,U.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,"aria-label":`Turns by conversation`,children:p.toSorted((e,t)=>k(e).localeCompare(k(t))).map(t=>(0,U.jsxs)(T,{to:`/citizen/$name`,params:{name:e},search:{scope:k(t)},replace:!0,"aria-current":t===b?`true`:void 0,className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[11px] transition-colors ${t===b?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[_(t)?(0,U.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}):null,x(t)]},k(t)))}):null,(0,U.jsxs)(`p`,{className:`text-caps`,children:[C?`This turn`:`Last turn`,` · `,x(b),` · started`,` `,b.fromStart?W(b.startedAt):`before the earliest step shown`]}),b.fromStart?null:(0,U.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`Earlier steps of this turn are no longer in the server's live buffer`,C?``:`; Turns has the whole turn`,`.`]}),(0,U.jsx)(K,{steps:b.steps}),(0,U.jsx)(me,{turn:b,running:C,now:u})]})}),D===void 0?null:(0,U.jsx)(Le,{name:e,turn:D})]})}export{Ve as CitizenView};
@@ -1 +0,0 @@
1
- import{D as e,b as t,cn as n,ln as r,m as i,ot as a,pn as o,t as s,un as c,y as l}from"./format-lz-5NQWT.js";import{H as u,R as d,V as f,c as p,z as m}from"./index-CoKyPk79.js";import{t as h}from"./Markdown-4W4xjIq7.js";import{n as g,t as _}from"./Pane-xzIpwnBD.js";import{r as v}from"./ThreadForms-D09Ykgj9.js";import{t as y}from"./BackLink-B3tz8OFm.js";var b=o(c(),1),x=r(),S=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function C(){let{scope:r,topic:o}=f({from:`/knowledge/$scope/$topic`}),{api:c}=e(),C=n(),w=m(),T=i(r),E=t(),D=l(3e4),[O,k]=(0,b.useState)(!1),A=r===a,j=A?`the society`:E.data?.find(e=>e.slug===r)?.name??r,M=T.data?.find(e=>e.topic===o),N=u({mutationFn:()=>c.removeKnowledge({project:A?null:r,topic:o}),onSuccess:async()=>{await C.invalidateQueries({queryKey:[`knowledge`,r]}),await w(A?{to:`/society`}:{to:`/p/$slug`,params:{slug:r}})}}),P=A?(0,x.jsx)(d,{to:`/society`,"aria-label":`Back to the society`,className:S,children:`←`}):(0,x.jsx)(d,{to:`/p/$slug`,params:{slug:r},"aria-label":`Back to ${j}`,className:S,children:`←`});return M===void 0?(0,x.jsx)(g,{children:T.data===void 0?`Reading…`:`${j} has no topic ${o}.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(_,{leading:(0,x.jsx)(y,{fallback:P}),title:M.topic,subtitle:`Knowledge of ${j} · written by ${M.updatedBy} ${s(M.updatedAt,D)}`,trailing:O?null:(0,x.jsx)(p,{onClick:()=>k(!0),children:`Remove…`})}),O?(0,x.jsxs)(`form`,{"aria-label":`Remove the topic`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),N.mutate()},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(`p`,{className:`min-w-0 flex-1 text-meta`,children:[`No turn or search finds `,M.topic,` again, and a note in`,` `,A?`#general`:`#${r}/general`,` says so without waking anyone. The server keeps its text aside.`]}),(0,x.jsx)(p,{onClick:()=>k(!1),children:`Cancel`}),(0,x.jsx)(p,{variant:`primary`,type:`submit`,disabled:N.isPending,children:N.isPending?`Removing…`:`Remove topic`})]}),(0,x.jsx)(v,{error:N.error})]}):null,(0,x.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:(0,x.jsx)(h,{text:M.body})})]})}export{C as KnowledgeView};
@@ -1 +0,0 @@
1
- import{D as e,P as t,b as n,c as r,cn as i,g as a,l as o,ln as s,m as c,pn as l,t as u,un as d,y as f}from"./format-lz-5NQWT.js";import{i as p,t as m}from"./tasks-DK1cnXqs.js";import{H as h,R as g,V as _,c as v}from"./index-CoKyPk79.js";import{t as y}from"./Markdown-4W4xjIq7.js";import{n as b,t as x}from"./Pane-xzIpwnBD.js";import{n as S,r as C}from"./ThreadForms-D09Ykgj9.js";import{n as w,r as T,t as E}from"./Overview-BnO1K52h.js";var D=l(d(),1),O=s();function k({project:t,onDone:n}){let{api:r}=e(),a=i(),[o,s]=(0,D.useState)(t.name),[c,l]=(0,D.useState)(t.defaultBranch),u={...o.trim()===t.name?{}:{name:o.trim()},...c.trim()===t.defaultBranch?{}:{default_branch:c.trim()}},d=h({mutationFn:()=>r.configureProject(t.slug,u),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`projects`]}),n()}}),f=Object.keys(u).length===0||o.trim()===``||c.trim()===``;return(0,O.jsxs)(`form`,{"aria-label":`Edit ${t.slug}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`input`,{value:o,maxLength:120,"aria-label":`Project name`,onChange:e=>s(e.target.value),className:`${S} min-w-0 flex-1`}),(0,O.jsx)(`div`,{className:`w-36 shrink-0`,children:(0,O.jsx)(`input`,{value:c,maxLength:100,spellCheck:!1,"aria-label":`Default branch`,onChange:e=>l(e.target.value),className:`${S} font-mono`})}),(0,O.jsx)(v,{onClick:n,children:`Cancel`}),(0,O.jsx)(v,{variant:`primary`,type:`submit`,disabled:d.isPending||f,children:d.isPending?`Saving…`:`Save`})]}),(0,O.jsxs)(`p`,{className:`text-meta`,children:[t.slug,` stays in its addresses, channels, and branches. A new default branch is where tasks start and land from now; its runner makes it from the project's remote, or from where the repository stands, before the next turn.`]}),(0,O.jsx)(C,{error:d.error})]})}function A(){let{slug:e}=_({from:`/p/$slug`}),i=n(),s=r(),l=a(),d=t(e),h=o(e),S=c(e),C=f(3e4),[A,j]=(0,D.useState)(!1),M=i.data?.find(t=>t.slug===e);if(M===void 0)return(0,O.jsx)(b,{children:i.data===void 0?`Reading the project…`:`There is no project ${e}.`});let N=(l.data??[]).filter(e=>e.status===`active`&&M.members.includes(e.name)),P=p(d.data??[]),F=h.data?.body.trim()??``;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(x,{title:M.name,subtitle:`${e} · ${M.repo??`a local repository`} · ${M.defaultBranch}`,trailing:(0,O.jsxs)(O.Fragment,{children:[A||M.archived!==void 0?null:(0,O.jsx)(v,{onClick:()=>j(!0),children:`Edit…`}),(0,O.jsx)(g,{to:`/p/$slug/tasks`,params:{slug:e},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Tasks →`})]})}),A?(0,O.jsx)(k,{project:M,onDone:()=>j(!1)}):null,(0,O.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[M.archived===void 0?null:(0,O.jsxs)(`p`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-sm text-fg-secondary`,children:[`Archived `,u(M.archived.at,C),` by `,M.archived.by,`:`,` `,M.archived.reason,`. Its channels, tasks, and history stay readable here; nothing more is posted, filed, or joined.`]}),M.archived===void 0?null:(0,O.jsx)(w,{title:`Channels`,children:(0,O.jsx)(`ul`,{className:`space-y-1`,children:(s.data??[]).filter(t=>t.project===e).map(e=>(0,O.jsxs)(`li`,{children:[(0,O.jsxs)(g,{to:`/c/$`,params:{_splat:e.ref},className:`text-sm text-fg-secondary hover:text-fg-primary`,children:[`# `,e.name]}),(0,O.jsxs)(`span`,{className:`text-meta`,children:[` · `,e.messages,` messages`]})]},e.ref))})}),(0,O.jsx)(w,{title:`Members`,children:(0,O.jsx)(E,{members:N,scope:e})}),(0,O.jsx)(w,{title:`Tasks`,children:d.data===void 0?(0,O.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):P.length===0?(0,O.jsx)(`p`,{className:`text-meta`,children:`No tasks yet.`}):(0,O.jsx)(g,{to:`/p/$slug/tasks`,params:{slug:e},className:`flex flex-wrap gap-1.5`,children:P.map(e=>(0,O.jsxs)(`span`,{className:`rounded-md bg-surface-2/60 px-2 py-0.5 text-xs text-fg-secondary`,children:[e.tasks.length,` `,m.find(t=>t.phase===e.phase)?.label.toLowerCase()]},e.phase))})}),(0,O.jsx)(w,{title:`How a task ends`,children:(0,O.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:M.onDone===`merge`?`When its last stage is done, the board merges task/<id> onto ${M.defaultBranch}.`:`When its last stage is done, it is done; nothing is merged.`})}),(0,O.jsx)(w,{title:`Dashboard`,children:h.data===void 0?(0,O.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):F===``?(0,O.jsx)(`p`,{className:`text-meta`,children:`Empty. Agents on the server's machine may edit it.`}):(0,O.jsx)(y,{text:F})}),(0,O.jsx)(w,{title:`Knowledge`,children:(0,O.jsx)(T,{scope:e,topics:S.data,now:C})})]})]})}export{A as ProjectView};
@@ -1 +0,0 @@
1
- import{D as e,F as t,P as n,R as r,St as i,at as a,b as o,bt as s,cn as c,et as l,g as u,gt as d,it as f,k as p,ln as m,nt as h,pn as g,st as _,t as v,tt as y,un as b,vt as x,w as S,x as C,y as w,yt as T}from"./format-lz-5NQWT.js";import{a as ee}from"./tasks-DK1cnXqs.js";import{F as te,H as ne,M as re,N as E,O as D,P as O,R 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-CoKyPk79.js";import{t as R}from"./Markdown-4W4xjIq7.js";import{n as z,t as B}from"./Pane-xzIpwnBD.js";import{n as V,r as ie}from"./ThreadForms-D09Ykgj9.js";import{t as H}from"./BackLink-B3tz8OFm.js";import{StatusChip as U}from"./ProposalsView-XrraDhwt.js";import{t as W}from"./SubjectThread-ClMmgVVd.js";var G=g(b(),1),K=m();function q({proposal:t,consequence:n}){let{api:r}=e(),i=c(),a=u(),[o,s]=(0,G.useState)(null),[l,d]=(0,G.useState)(``),f=(0,G.useRef)(null);(0,G.useEffect)(()=>{o!==null&&f.current?.focus()},[o]);let p=ne({mutationFn:()=>{let e=l.trim();return o===`reject`?r.reject({proposal_id:t.id,reason:e}):r.approve({proposal_id:t.id,...e===``?{}:{reason:e}})},onSuccess:()=>{let e=[[`proposals`],[`proposal`,t.id],[`threads`],[`thread`,t.id]];for(let t of e)i.invalidateQueries({queryKey:t});s(null),d(``)}}),m=(a.data??[]).find(e=>e.name===t.proposedBy&&e.status===`active`&&e.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:l,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=>d(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&&l.trim()===``,children:p.isPending?`Deciding…`:g?`Confirm approval`:`Confirm rejection`})]}),(0,K.jsx)(ie,{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:E(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:r,members:i}){let a=o(),s=n(t),c=a.data?.find(e=>e.slug===t),l=e.status===`proposed`,u=l?(i??[]).filter(e=>e.status===`active`&&e.memberships.includes(t)).map(e=>e.name):e.provision?.members??[],d=(s.data??[]).filter(ee).length;return(0,K.jsxs)(J,{children:[(0,K.jsxs)(Y,{label:`Project`,children:[(0,K.jsx)(k,{to:`/p/$slug`,params:{slug:t},className:`hover:text-fg-primary`,children:c?.name??t}),c?.name===void 0||c.name===t?null:` · ${t}`]}),(0,K.jsx)(Y,{label:l?`Members who leave`:`Members who left`,children:Array.isArray(u)?X(u.filter(e=>typeof e==`string`)):`none`}),l?(0,K.jsx)(Y,{label:`Tasks in play`,children:s.data===void 0?`reading…`:d===0?`none`:`${d}: approval is refused until they are done, abandoned, or filed elsewhere`}):null,(0,K.jsx)(Y,{label:`Reason`,children:r}),(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:e,roles:t,members:n}){let r=e.status===`proposed`,{charter:i}=e;switch(e.kind){case`member`:{let e=h.safeParse(i);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 n=re(e);if(n===null)break;return(0,K.jsx)(ae,{next:n,current:t?.find(e=>e.name===n.name),compare:r})}case`skill`:{let e=_.safeParse(i);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:O(e.data.body)})})]})}case`channel`:{let e=y.safeParse(i);if(!e.success)break;return(0,K.jsxs)(J,{children:[(0,K.jsxs)(Y,{label:`Channel`,children:[`#`,d(e.data.project,e.data.name)]}),(0,K.jsx)(Y,{label:`Purpose`,children:e.data.purpose})]})}case`retirement`:{let e=a.safeParse(i);if(!e.success)break;let t=n?.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:n}),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 t=l.safeParse(i);if(!t.success)break;return(0,K.jsx)(oe,{proposal:e,slug:t.data.project,reason:t.data.reason,members:n})}case`reallocation`:{let e=f.safeParse(i);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(i,null,2)})}var ce=s({agent:i().optional(),channel:i().optional(),role:i().optional(),skill:i().optional(),replaced:T().optional(),releasedTasks:x(i()).optional(),project:i().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)(k,{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)(k,{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)(k,{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}=j({from:`/proposal/$proposalId`}),n=C(e),i=u(),a=S(),o=p(),s=t(),c=w(3e4),l=N();if(n.data===void 0)return(0,K.jsx)(z,{children:n.error instanceof r&&n.error.status===404?`There is no proposal ${e}.`:`Reading the proposal…`});let d=n.data,f=d.status===`proposed`,m=i.data?.find(e=>e.name===d.proposedBy)?.role,h=s.data?.find(e=>e.id===d.id),g=d.status===`rejected`?`Rejected`:`Approved`,_=D(d,{members:i.data??[],roles:a.data??[],skills:o.data??[]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{leading:(0,K.jsx)(H,{fallback:(0,K.jsx)(k,{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(d),subtitle:`${d.kind} proposal by ${l(d.proposedBy)} ${v(d.createdAt,c)}${f?` · for ${I(d,m)} to decide`:``}`,trailing:(0,K.jsx)(U,{status:d.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: `,_]}):(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 `,l(d.decidedBy??`someone`),d.decidedAt===void 0?``:` ${v(d.decidedAt,c)}`,d.reason===void 0?`.`:`: ${d.reason}`]}),(0,K.jsx)(le,{proposal:d})]}),d.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:d.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`:d.status===`provisioned`?`What it made`:`What it proposed`}),(0,K.jsx)(se,{proposal:d,roles:a.data,members:i.data})]}),(0,K.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:`Thread`}),h===void 0?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:s.data===void 0?`Reading the thread…`:`This proposal is older than proposal threads; its thread opens when it is decided.`}):(0,K.jsx)(W,{thread:h,now:c,empty:`Nothing said yet. The pitch and the decision are posted here.`})]})]}),h?.state===`open`?(0,K.jsx)(P,{target:{threadId:d.id},placeholder:`Write in the proposal's thread`}):null,te(d)?(0,K.jsx)(q,{proposal:d,consequence:_}):null]})}export{$ as ProposalView};
@@ -1 +0,0 @@
1
- import{A as e,b as t,g as n,ht as r,k as i,ln as a,m as o,ot as s,w as c,y as l}from"./format-lz-5NQWT.js";import{n as u,t as d}from"./Pane-xzIpwnBD.js";import{n as f,r as p,t as m}from"./Overview-BnO1K52h.js";var h=a();function g(){let a=e(),g=n(),_=t(),v=c(),y=i(),b=o(s),x=l(3e4);if(a.data===void 0||g.data===void 0)return(0,h.jsx)(u,{children:`Reading the society…`});let S=g.data.filter(e=>e.cli!==null),C=S.filter(e=>e.status===`active`),w=S.filter(e=>e.status===`retired`),T=(v.data??[]).filter(e=>e.name!==r);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(d,{title:a.data.name,subtitle:`${C.length} citizens · ${_.data?.length??0} projects · ${T.length} roles`}),(0,h.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,h.jsxs)(f,{title:`Citizens`,children:[(0,h.jsx)(m,{members:C,scope:s}),w.length===0?null:(0,h.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Retired: `,w.map(e=>e.name).join(`, `)]})]}),(0,h.jsx)(f,{title:`Roles`,children:(0,h.jsx)(`ul`,{className:`space-y-2.5`,children:T.map(e=>{let t=C.filter(t=>t.role===e.name).length;return(0,h.jsxs)(`li`,{children:[(0,h.jsxs)(`p`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,h.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,h.jsxs)(`span`,{className:`text-meta`,children:[t===1?`1 member`:`${t} members`,e.resident?` · warm session`:``,e.societyScope?` · society role`:``]})]}),(0,h.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:e.purpose})]},e.name)})})}),(0,h.jsx)(f,{title:`Knowledge`,children:(0,h.jsx)(p,{scope:s,topics:b.data,now:x})}),(0,h.jsx)(f,{title:`Skills`,children:y.data===void 0?(0,h.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):y.data.length===0?(0,h.jsx)(`p`,{className:`text-meta`,children:`None yet. A citizen's skill joins the society by proposal.`}):(0,h.jsx)(`ul`,{className:`space-y-1.5`,children:y.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))})})]})]})}export{g as SocietyView};
@@ -1 +0,0 @@
1
- import{D as e,Ht as t,g as n,ln as r,pn as i,t as a,un as o}from"./format-lz-5NQWT.js";import{I as s}from"./index-CoKyPk79.js";import{t as c}from"./Markdown-4W4xjIq7.js";import{t as l}from"./MessageItem-Bfpve1_Y.js";var u=i(o(),1),d=r();function f({thread:r,now:i,task:o,empty:f}){let{api:p}=e(),m=n(),h=t({queryKey:[`thread`,r.id],queryFn:()=>p.thread(r.id)}),g=h.data?.messages??[],_=g.at(-1)?.id??null;if((0,u.useEffect)(()=>s(r.id,_),[r.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:i,task:o},e.id)),r.state===`closed`?(0,d.jsxs)(`div`,{className:`mx-4 mt-2`,children:[(0,d.jsxs)(`p`,{className:`text-meta`,children:[`Closed`,v.closedAt===void 0?``:` ${a(v.closedAt,i)}`,v.body.trim()===``?`.`:`:`]}),v.body.trim()===``?null:(0,d.jsx)(c,{text:v.body})]}):null]})}export{f as t};
@@ -1 +0,0 @@
1
- import{D as e,Ht as t,R as n,g as r,j as i,ln as a,pn as o,t as s,un as c,y as l}from"./format-lz-5NQWT.js";import{I as u,R as d,V as f,c as p,d as m,i as h}from"./index-CoKyPk79.js";import{t as g}from"./Markdown-4W4xjIq7.js";import{t as _}from"./MessageItem-Bfpve1_Y.js";import{n as v,t as y}from"./Pane-xzIpwnBD.js";import{r as b,t as x}from"./ThreadCard-fvf8cY_l.js";import{t as S}from"./ThreadForms-D09Ykgj9.js";import{t as C}from"./useStickyScroll-CfP3Yl_4.js";import{t as w}from"./BackLink-B3tz8OFm.js";var T=o(c(),1),E=a();function D(){let{threadId:e}=f({from:`/thread/$threadId`});return(0,E.jsx)(O,{id:e},e)}function O({id:a}){let{api:o}=e(),c=t({queryKey:[`thread`,a],queryFn:()=>o.thread(a)}),f=r(),D=l(3e4),O=m(),k=c.data?.messages??[],A=k.at(-1)?.id??null;(0,T.useEffect)(()=>u(a,A),[a,A]);let{ref:j,onScroll:M}=C(),[N,P]=(0,T.useState)(!1),F=c.data?.thread.subject,I=i(F?.kind===`task`?F.id:null);if(c.data===void 0)return(0,E.jsx)(v,{children:c.error instanceof n&&c.error.status===404?`There is no thread ${a}.`:`Reading the thread…`});let{thread:L}=c.data;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y,{leading:(0,E.jsx)(w,{fallback:(0,E.jsx)(d,{to:`/c/$`,params:{_splat:L.channel},"aria-label":`Back to #${L.channel}`,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`←`})}),title:L.title,subtitle:`${b(L.subject)} thread in #${L.channel} · opened by ${O(L.openedBy)} ${s(L.openedAt,D)}`,trailing:(0,E.jsxs)(E.Fragment,{children:[L.subject?.kind===`task`?(0,E.jsx)(d,{to:`/task/$taskId`,params:{taskId:L.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Task →`}):L.subject?.kind===`proposal`?(0,E.jsx)(d,{to:`/proposal/$proposalId`,params:{proposalId:L.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Proposal →`}):null,L.state===`open`&&!N&&L.subject?.kind!==`task`?(0,E.jsx)(p,{onClick:()=>P(!0),children:`Close`}):(0,E.jsx)(x,{state:L.state})]})}),N&&L.state===`open`?(0,E.jsx)(S,{threadId:L.id,channel:L.channel,onDone:()=>P(!1)}):null,(0,E.jsxs)(`div`,{ref:j,onScroll:M,className:`flex-1 overflow-y-auto py-2`,children:[k.length===0?(0,E.jsx)(v,{children:`No messages in this thread yet.`}):null,k.map(e=>(0,E.jsx)(_,{message:e,members:f.data,now:D,task:I.data},e.id)),L.state===`closed`?(0,E.jsxs)(`section`,{className:`mx-4 mt-3 mb-2 rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:[(0,E.jsxs)(`p`,{className:`text-caps`,children:[`Closed by `,O(L.closedBy??`board`),L.closedAt===void 0?``:` ${s(L.closedAt,D)}`]}),L.body.trim()===``?(0,E.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`It ended with its `,b(L.subject),`.`]}):(0,E.jsx)(g,{text:L.body})]}):null]}),L.state===`open`?(0,E.jsx)(h,{target:{threadId:L.id},placeholder:`Reply in the thread`}):null]})}export{D as ThreadView};
@@ -1 +0,0 @@
1
- import{Q as e,ot as t}from"./format-lz-5NQWT.js";import{p as n}from"./index-CoKyPk79.js";function r(e){return e===`society`?`the society`:e}function i(e){return[...e.memberships,t]}function a(e){return e.startedAt===void 0?null:n(e.startedAt,Date.parse(e.ts))}var o={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`interrupted`,blocked:`blocked`,stopped:`stopped by you`};function s(e){return e.exitReason===null?e.outcome===`failed`?`failed`:`completed`:o[e.exitReason]??e.exitReason}function c(e){return e.outcome===`failed`||e.exitReason!==null&&e.exitReason!==`completed`&&e.exitReason!==`stopped`}var l=new Intl.NumberFormat(`en`,{notation:`compact`}),u=new Intl.NumberFormat(`en`);function d(e){return e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens}function f(e){return`${l.format(d(e))} in · ${l.format(e.outputTokens)} out`}function p(e){return[`${u.format(d(e))} input tokens: ${u.format(e.cacheReadTokens)} read from the cache,`,`${u.format(e.cacheWriteTokens)} written to it, ${u.format(e.inputTokens)} neither;`,`${u.format(e.outputTokens)} output tokens`].join(` `)}function m(t){let n=t.flatMap(e=>e.usage===void 0?[]:[e.usage]);return{turns:t.length,failed:t.filter(c).length,usage:n.length===0?null:n.reduce(e),withUsage:n.length}}function h(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 g(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{p as a,i as c,r as i,h as l,m as n,f as o,g as r,a as s,s as t};