@kubitnodes/stellaris 0.3.24 → 0.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +99 -553
- package/dist/server/index.js +318 -581
- package/package.json +4 -4
- package/web/dist/assets/BackLink-UTiLF1J4.js +1 -0
- package/web/dist/assets/Button-Cp4cNRUX.js +1 -0
- package/web/dist/assets/ChannelForms-DD2B0tey.js +1 -0
- package/web/dist/assets/{ChannelView-BIXouQMX.js → ChannelView-CY3oG9hZ.js} +2 -2
- package/web/dist/assets/CitizenView-BNK5ro-6.js +2 -0
- package/web/dist/assets/{CitizensView-CYFS3f9U.js → CitizensView-WPQ6Jhl3.js} +1 -1
- package/web/dist/assets/{CliIcon-DVX5iLhG.js → CliIcon-C7bwChMP.js} +1 -1
- package/web/dist/assets/CronsView-_pdgwX1I.js +1 -0
- package/web/dist/assets/FileTree-jyDUSu7g.js +1 -0
- package/web/dist/assets/FileView-DcQvlc8V.js +4 -0
- package/web/dist/assets/KnowledgeView-DDl0HQPG.js +1 -0
- package/web/dist/assets/{Markdown--whKJBYV.js → Markdown-DT3V-EVe.js} +7 -7
- package/web/dist/assets/{MessageItem-BvDOeJci.js → MessageItem-agtEugfG.js} +1 -1
- package/web/dist/assets/MetricsView-DiXyYeWP.js +1 -0
- package/web/dist/assets/NeedsYouView-CKmuYan_.js +1 -0
- package/web/dist/assets/Overview-CKcTqsMM.js +1 -0
- package/web/dist/assets/{Pane-DTmByqgA.js → Pane-BaM0TdE6.js} +1 -1
- package/web/dist/assets/{Picker-DsHm4f7s.js → Picker-C2ig-0dT.js} +1 -1
- package/web/dist/assets/ProjectView-T2OHTh5j.js +1 -0
- package/web/dist/assets/ProposalView-B5yjTAcn.js +1 -0
- package/web/dist/assets/ProposalsView-p4KjwV9p.js +1 -0
- package/web/dist/assets/{Quota-D8WDWp5H.js → Quota-CfFGIql9.js} +1 -1
- package/web/dist/assets/RunnersView-DdvwoOur.js +1 -0
- package/web/dist/assets/{SkillFileList-DhdEcFQA.js → SkillFileList-CgrCnuaC.js} +1 -1
- package/web/dist/assets/SkillView-Di5Z9h2L.js +1 -0
- package/web/dist/assets/SocietyView-BDiVxUC5.js +1 -0
- package/web/dist/assets/StickyList-BaV_KZ8x.js +1 -0
- package/web/dist/assets/{SubjectThread-BEXt-tub.js → SubjectThread-DD_ZCCnr.js} +1 -1
- package/web/dist/assets/TaskView-CKcs-MOC.js +3 -0
- package/web/dist/assets/TasksView-oZMjncOU.js +1 -0
- package/web/dist/assets/{ThreadForms-DzoRDeBh.js → ThreadForms-CG5Y926b.js} +1 -1
- package/web/dist/assets/{ThreadItem-CDVppcOZ.js → ThreadItem-D-n2arFA.js} +1 -1
- package/web/dist/assets/{ThreadView-B4F10_j1.js → ThreadView-CT9vd0P4.js} +1 -1
- package/web/dist/assets/{citizen-BPIJzKdn.js → citizen-BiHfph2A.js} +1 -1
- package/web/dist/assets/{compose-BUhbVoI-.js → compose-DY1WL8zB.js} +1 -1
- package/web/dist/assets/format-CENiwkJC.js +55 -0
- package/web/dist/assets/governance-C6ez5MLh.js +1 -0
- package/web/dist/assets/index-CPXALUV6.js +23 -0
- package/web/dist/assets/{index-Bj8MlyAn.css → index-DIa8Dlav.css} +1 -1
- package/web/dist/assets/mentions-BEL5U6ra.js +3 -0
- package/web/dist/assets/{tasks-CTaxXtGL.js → tasks-CAI8Eci7.js} +1 -1
- package/web/dist/assets/useMatch-CINzyDWa.js +1 -0
- package/web/dist/index.html +9 -9
- package/web/dist/assets/BackLink-DKMw_rHu.js +0 -1
- package/web/dist/assets/Button-BYJGqZ3Q.js +0 -1
- package/web/dist/assets/ChannelForms-CkYupEL2.js +0 -1
- package/web/dist/assets/CitizenView-C3AMFixP.js +0 -2
- package/web/dist/assets/CronsView-BGCcO7bH.js +0 -1
- package/web/dist/assets/KnowledgeView-DLLYjd1G.js +0 -1
- package/web/dist/assets/MetricsView-B-KUNOZm.js +0 -1
- package/web/dist/assets/NeedsYouView-Dee_bOKj.js +0 -1
- package/web/dist/assets/Overview-DFiHDFnA.js +0 -1
- package/web/dist/assets/ProjectView-DsRXW-qk.js +0 -1
- package/web/dist/assets/ProposalView-B-4P1S-s.js +0 -1
- package/web/dist/assets/ProposalsView-uEuj-ooV.js +0 -1
- package/web/dist/assets/RunnersView-BB3q65rG.js +0 -1
- package/web/dist/assets/SkillView-vAv7zvtJ.js +0 -1
- package/web/dist/assets/SocietyView-Dv4phSkz.js +0 -1
- package/web/dist/assets/StickyList-C4fC_KJv.js +0 -1
- package/web/dist/assets/TaskFileView-B9sex0tS.js +0 -4
- package/web/dist/assets/TaskView-BCT388kb.js +0 -3
- package/web/dist/assets/TasksView-CuPay34-.js +0 -1
- package/web/dist/assets/format-CvfmDNoY.js +0 -55
- package/web/dist/assets/governance-Bba0OHvJ.js +0 -1
- package/web/dist/assets/index-DD3J11PT.js +0 -23
- package/web/dist/assets/mentions-D838wlfQ.js +0 -3
- package/web/dist/assets/useMatch-B8j0hm1q.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{A as e,D as t,E as n,Gn as r,Ht as i,Jn as a,K as o,O as s,U as c,Un as l,Ut as u,W as d,Wn as f,X as p,Yt as m,_ as h,a as g,b as _,bt as v,f as y,l as b,m as x,o as S,p as C,t as w,v as T,x as ee,z as E}from"./format-CvfmDNoY.js";import{n as D,t as O}from"./Button-BYJGqZ3Q.js";import{t as te}from"./CliIcon-DVX5iLhG.js";import{A as k,_ as A,c as j,d as M,f as N,h as P,i as F,k as I,l as L,m as ne,p as re,u as ie,v as ae}from"./index-DD3J11PT.js";import{t as R}from"./Markdown--whKJBYV.js";import{n as oe,r as z}from"./ThreadForms-DzoRDeBh.js";import{n as B,t as se}from"./Pane-DTmByqgA.js";import{t as ce}from"./StickyList-C4fC_KJv.js";import{a as V,c as H,d as le,f as U,i as ue,l as de,n as fe,s as W,t as pe}from"./citizen-BPIJzKdn.js";import{n as G}from"./Picker-DsHm4f7s.js";import{t as me}from"./Quota-D8WDWp5H.js";var K=a(r(),1),q=f(),he={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`was interrupted`,blocked:`was blocked`,stopped:`was stopped by you`};function J(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function ge({label:e,tone:t,children:n}){return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`px-0.5 pb-0.5 text-[10px] tracking-wider text-fg-muted uppercase`,children:e}),(0,q.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 _e({step:e,open:t}){if(e.kind===`say`)return(0,q.jsx)(`li`,{className:`py-1.5 text-sm`,title:J(e.at),children:(0,q.jsx)(R,{text:e.text})});if(e.kind===`error`)return(0,q.jsx)(`li`,{className:`py-1 font-mono text-xs break-words text-red-400`,title:J(e.at),children:e.message});if(e.kind===`steer`)return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,q.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,q.jsx)(`span`,{"aria-hidden":`true`,className:`grid w-3 shrink-0 place-items-center text-sky-300`,children:`↳`}),(0,q.jsxs)(`span`,{className:`shrink-0 text-fg-tertiary`,children:[`Took `,M(e.posts.length)]}),(0,q.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,q.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:J(e.at)})]}),(0,q.jsx)(`ul`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:e.posts.map(e=>(0,q.jsxs)(`li`,{className:`rounded-md bg-surface-0/40 px-2.5 py-2`,children:[(0,q.jsxs)(`p`,{className:`flex gap-1.5 text-meta`,children:[(0,q.jsx)(`span`,{className:`text-fg-secondary`,children:e.author}),(0,q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`in `,e.where]}),e.at===``?null:(0,q.jsx)(`span`,{className:`ml-auto shrink-0 font-mono`,children:J(e.at)})]}),(0,q.jsx)(`div`,{className:`mt-1 text-sm`,children:(0,q.jsx)(R,{text:e.body})})]},`${e.at}-${e.author}`))})]})});let n=e.ok===null?(0,q.jsx)(`span`,{"aria-label":`running`,className:`size-1.5 animate-pulse rounded-full bg-amber-300`}):e.ok?(0,q.jsx)(`span`,{"aria-label":`succeeded`,className:`text-[11px] text-emerald-400`,children:`✓`}):(0,q.jsx)(`span`,{"aria-label":`failed`,className:`text-[11px] text-red-400`,children:`✕`});return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,q.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,q.jsx)(`span`,{className:`grid w-3 shrink-0 place-items-center`,children:n}),(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-fg-tertiary`,children:N(e.name)}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-fg-secondary`,children:e.summary}),(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:J(e.at)})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:[(0,q.jsx)(ge,{label:`Input`,tone:`text-fg-secondary`,children:e.detail}),e.output===null?null:(0,q.jsx)(ge,{label:e.ok===!1?`Returned an error`:`Returned`,tone:e.ok===!1?`text-red-300`:`text-fg-tertiary`,children:e.output})]})]})})}function ve({steps:e}){let[t,n]=(0,K.useState)(!1),r=e.filter(e=>e.kind===`tool`).length;return e.length===0?(0,q.jsx)(`p`,{className:`mt-2 text-meta`,children:`No steps yet.`}):(0,q.jsxs)(q.Fragment,{children:[r===0?null:(0,q.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-meta`,children:[r===1?`1 tool call`:`${r} tool calls`,(0,q.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,q.jsx)(`ol`,{className:`mt-1 space-y-0.5`,children:e.map(e=>(0,q.jsx)(_e,{step:e,open:t},e.seq))})]})}function ye({turn:e,running:t,now:n}){return e.end===null?t?(0,q.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-meta`,"aria-live":`polite`,children:[(0,q.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}),`Working · last step `,w(e.lastAt,n)]}):(0,q.jsx)(`p`,{className:`mt-3 text-meta`,children:`The turn ended without a report.`}):(0,q.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,q.jsxs)(`p`,{className:`text-caps`,children:[`The turn `,he[e.end.exitReason],` `,w(e.end.at,n),e.fromStart?` · ${L(e.startedAt,Date.parse(e.end.at))}`:``]}),e.end.summary===null?null:(0,q.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:e.end.summary})]})}var be=30,xe={turn:`turn`,board:`board`,merge:`both kept`},Se={turn:`Changed by a turn`,board:`Written by the board`,merge:`Both versions kept`};function Ce(e){return e.status===`added`?`new`:e.status===`deleted`?`deleted`:e.added===null||e.removed===null?`binary`:`+${e.added} −${e.removed}`}function we(e){return e.files.map(e=>`${e.path} ${Ce(e)}`).join(`, `)}function Te(e){return e.startsWith(`@@`)||e.startsWith(`\\`)?`text-fg-muted`:e.startsWith(`+`)?`text-emerald-300`:e.startsWith(`-`)?`text-red-300`:`text-fg-tertiary`}function Ee({file:e}){return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[e.path,e.status===`modified`?``:(0,q.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,e.status]})]}),e.patch===null?(0,q.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown.`}):e.patch===``?(0,q.jsx)(`p`,{className:`mt-1 text-meta`,children:`Empty.`}):(0,q.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,q.jsx)(`span`,{className:`block whitespace-pre-wrap break-words ${Te(e)}`,children:e===``?` `:e},t))}),e.truncated?(0,q.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}function De({name:e,change:t}){let n=y(e,t.commit,!0);return(0,q.jsxs)(`div`,{className:`space-y-3 px-4 pt-1 pb-3`,children:[(0,q.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,q.jsx)(m,{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,q.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,J(t.at)]})]}),n.data===void 0?(0,q.jsx)(`p`,{className:`text-meta`,children:n.isError?`Could not read the change.`:`Reading the change…`}):n.data.map(e=>(0,q.jsx)(Ee,{file:e},e.path))]})}function Oe({name:e,change:t,now:n}){let[r,i]=(0,K.useState)(!1),a=t.files.length===0?t.subject:we(t);return(0,q.jsx)(`li`,{className:`border-b border-line/60 last:border-b-0`,children:(0,q.jsxs)(`details`,{className:`group`,onToggle:e=>i(e.currentTarget.open),children:[(0,q.jsx)(`summary`,{"aria-label":`${Se[t.kind]} ${w(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,q.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:xe[t.kind]}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:a}),(0,q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:w(t.at,n)}),(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]})}),r?(0,q.jsx)(De,{name:e,change:t}):null]})})}function ke({name:e}){let[t,n]=(0,K.useState)(be),r=x(e,t),i=_(3e4);if(r.data===void 0)return(0,q.jsx)(B,{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,q.jsxs)(B,{children:[e,`'s home has no history yet; it starts with the citizen's first turn.`]}):(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,q.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,q.jsx)(`ol`,{children:a.map(t=>(0,q.jsx)(Oe,{name:e,change:t,now:i},t.commit))}),o?(0,q.jsx)(`button`,{type:`button`,onClick:()=>n(t+be),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:`Show earlier changes`}):null]})}function Y({title:e,children:t}){return(0,q.jsxs)(`section`,{className:`border-t border-line pt-4 first:border-t-0 first:pt-0`,children:[(0,q.jsx)(`h3`,{className:`text-section`,children:e}),(0,q.jsx)(`div`,{className:`mt-2`,children:t})]})}function Ae({member:e,charter:t}){let n=T(e.name),r=S(e.name),i=C(e.name),a=_(3e4);return(0,q.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,q.jsxs)(Y,{title:`Edits to reconcile`,children:[(0,q.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,q.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:i.data.map(e=>(0,q.jsxs)(`li`,{className:`text-sm`,children:[(0,q.jsx)(`span`,{className:`text-fg-primary`,children:e.file}),(0,q.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.path.slice(e.path.lastIndexOf(`/`)+1),` · left`,` `,w(e.since,a)]})]},e.path))})]}),(0,q.jsx)(Y,{title:`Profile`,children:e.profile.trim()===``?(0,q.jsx)(`p`,{className:`text-meta`,children:`No profile yet. The citizen writes its own profile.md.`}):(0,q.jsx)(R,{text:U(e.profile,`Profile`)})}),(0,q.jsx)(Y,{title:`Core memory`,children:n.data===void 0?(0,q.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):n.data.body.trim()===``?(0,q.jsx)(`p`,{className:`text-meta`,children:`Empty. Every turn loads this file in full.`}):(0,q.jsx)(R,{text:U(n.data.body,`Core memory`)})}),(0,q.jsx)(Y,{title:`Own skills`,children:r.data===void 0?(0,q.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):r.data.length===0?(0,q.jsx)(`p`,{className:`text-meta`,children:`None yet.`}):(0,q.jsx)(`ul`,{className:`space-y-1.5`,children:r.data.map(e=>(0,q.jsxs)(`li`,{className:`text-sm`,children:[(0,q.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,q.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]},e.name))})}),t===void 0?null:(0,q.jsxs)(Y,{title:`Charter of ${t.name}`,children:[(0,q.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:t.purpose}),(0,q.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,q.jsx)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:t.verbs.map(e=>(0,q.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 je(e,t){let n=c(e,t?.turnId??null);return{turn:(0,K.useMemo)(()=>t===void 0||n.data===void 0?void 0:re(n.data,e,t.project,t),[t,n.data,e]),loading:t?.turnId!==void 0&&n.isPending,missing:t!==void 0&&(t.turnId===void 0||n.isError)}}var X=50;function Me({name:e,entry:t,now:n,opened:r}){let[i,a]=(0,K.useState)(r),o=(0,K.useRef)(null);(0,K.useEffect)(()=>{r&&o.current?.scrollIntoView({block:`start`})},[r]);let s=ae(),c=de(t),l=t.thread===void 0?t.channel===void 0?t.place===void 0?null:`${t.place}'s channels`:`#${t.channel}`:s.get(t.thread)?.title??`a thread`,u=t.error??t.summary??``,d=t.error===null?`text-fg-secondary`:`text-red-300`;return(0,q.jsx)(`li`,{ref:o,className:`border-b border-line/60 last:border-b-0`,children:(0,q.jsxs)(`details`,{className:`group`,open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,q.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,q.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:[V(t.project),l===null?``:` · ${l}`]}),(0,q.jsx)(`span`,{className:`text-fg-muted`,children:t.trigger}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-fg-muted`,children:[pe(t),` `,w(t.ts,n)]}),(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,title:t.usage===void 0?void 0:W(t.usage),children:[c,t.toolCalls===void 0?null:`${t.toolCalls} tools`,t.usage===void 0?null:H(t.usage)].filter(e=>e!==null).join(` · `)}),(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]}),u.trim()===``?null:(0,q.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-xs leading-relaxed group-open:hidden ${d}`,children:(0,q.jsx)(A,{text:u,links:!1})})]}),i?(0,q.jsx)(Ne,{name:e,entry:t,text:u,tone:d}):null]})})}function Ne({name:e,entry:t,text:n,tone:r}){let i=je(e,t);return(0,q.jsxs)(`div`,{className:`px-4 pt-1 pb-3`,children:[n.trim()===``?null:(0,q.jsx)(`p`,{className:`text-xs leading-relaxed whitespace-pre-wrap ${r}`,children:(0,q.jsx)(A,{text:n})}),(0,q.jsx)(`div`,{className:`mt-2`,children:t.turnId===void 0?(0,q.jsx)(`p`,{className:`text-meta`,children:`This turn ran before turns kept their steps.`}):i.loading?(0,q.jsx)(`p`,{className:`text-meta`,children:`Reading the steps…`}):i.turn===void 0?(0,q.jsx)(`p`,{className:`text-meta`,children:`No steps were kept for this turn.`}):(0,q.jsxs)(q.Fragment,{children:[t.startedAt===void 0?null:(0,q.jsxs)(`p`,{className:`text-caps`,children:[`Started `,J(t.startedAt)]}),(0,q.jsx)(ve,{steps:i.turn.steps})]})})]})}function Pe({name:e,opened:t}){let[n,r]=(0,K.useState)(X),i=d(e,n),a=_(3e4);if(i.data===void 0)return(0,q.jsx)(B,{children:`Reading the turns…`});let o=i.data.toReversed();if(o.length===0)return(0,q.jsxs)(B,{children:[e,` has not finished a turn yet.`]});let s=fe(o),c=s.usage===null?``:` · ${H(s.usage)}${s.withUsage<s.turns?` over ${s.withUsage} of them`:``}`;return(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,q.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,title:s.usage===null?void 0:W(s.usage),children:[s.turns===1?`1 turn`:`${s.turns} turns`,s.failed===0?``:`, ${s.failed} not completed`,c]}),t!==null&&!o.some(e=>e.turnId===t)?(0,q.jsx)(`p`,{className:`px-4 pb-1 text-meta`,children:i.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,q.jsx)(`ol`,{children:o.map(n=>(0,q.jsx)(Me,{name:e,entry:n,now:a,opened:t!==null&&n.turnId===t},n.id))}),i.data.length===n?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>r(n+X),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show `,X,` earlier turns`]}):null]})}var Z=``,Q=``;function Fe(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 Ie(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 Le({member:t,onDone:n}){let{api:r}=e(),i=l(),a=g(t.name),s=t.model??Z,c=t.effort??Q,[u,d]=(0,K.useState)(s),[f,p]=(0,K.useState)(c),m=D({mutationFn:async()=>{u!==s&&await r.setModel(t.name,u===Z?null:u),f!==c&&await r.setEffort(t.name,f===Q?null:f)},onSettled:()=>void i.invalidateQueries({queryKey:[`members`]}),onSuccess:n}),h=a.data?.models??[],_=t.model!==void 0&&!h.some(e=>e.id===t.model)?t.model:null,v=e=>h.find(t=>e===Z?t.isDefault:t.id===e),y=v(u)?.efforts??[],b=f!==Q&&!y.some(e=>e.id===f)?f:null,x=e=>{d(e);let t=v(e)?.efforts??[];f!==Q&&!t.some(e=>e.id===f)&&p(Q)},S=u!==s||f!==c;return(0,q.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(),m.mutate()},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.isPending?(0,q.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Asking `,t.cli,` for its models…`]}):a.error===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(G,{label:`Model`,choices:Fe(h,_),value:u,onChange:x}),y.length===0&&b===null?null:(0,q.jsx)(`div`,{className:`flex w-32 shrink-0`,children:(0,q.jsx)(G,{label:`Effort`,choices:Ie(v(u),b),value:f,onChange:p,listClassName:`right-0 w-64`})})]}):(0,q.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,q.jsx)(O,{onClick:n,children:`Cancel`}),(0,q.jsx)(O,{variant:`primary`,type:`submit`,disabled:m.isPending||!S||a.error!==null,children:m.isPending?`Saving…`:`Save`})]}),a.data===void 0?null:(0,q.jsxs)(`p`,{className:`text-meta`,children:[`As `,a.data.cli,` on `,a.data.runner,` lists them, where this citizen's turns run.`]}),(0,q.jsx)(z,{error:m.error})]})}var $=``;function Re(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 ze(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:Re(e,t)}))]}function Be({member:n,onDone:r}){let{api:i}=e(),a=l(),o=t(),s=n.homeRunner??$,[c,u]=(0,K.useState)(s),d=D({mutationFn:()=>i.setRunner(n.name,c===$?null:c),onSuccess:()=>{a.invalidateQueries({queryKey:[`members`]}),r()}});return(0,q.jsxs)(`form`,{"aria-label":`Runner of ${n.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o.data===void 0?(0,q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`Reading the runners…`}):(0,q.jsx)(G,{label:`Runner`,choices:ze(o.data,n),value:c,onChange:u}),(0,q.jsx)(O,{onClick:r,children:`Cancel`}),(0,q.jsx)(O,{variant:`primary`,type:`submit`,disabled:d.isPending||c===s,children:d.isPending?`Saving…`:`Run here`})]}),(0,q.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,q.jsx)(z,{error:d.error})]})}function Ve(e){if(e.thread!==void 0)return{threadId:e.thread};let t=e.scope===`society`?null:e.scope;return e.channel===void 0?e.place===void 0?{channel:e.askedIn??i(t,`general`)}:{channel:e.askedIn!==void 0&&u(e.askedIn).project===e.place?e.askedIn:i(e.place,`general`)}:{channel:i(t,e.channel)}}function He({name:t,turn:n}){let{api:r}=e(),i=l(),[a,o]=(0,K.useState)(!1),s=D({mutationFn:()=>r.stopTurn(n.turnId),onSuccess:()=>{o(!1),i.invalidateQueries({queryKey:[`scheduler`]})}});return(0,q.jsxs)(`div`,{className:`border-t border-line`,children:[(0,q.jsx)(F,{target:Ve(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,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-3`,children:[(0,q.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,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(O,{onClick:()=>{o(!1),s.reset()},children:`Keep it running`}),(0,q.jsx)(O,{variant:`primary`,disabled:s.isPending,onClick:()=>{s.mutate()},children:s.isPending?`Stopping…`:`Stop the turn`})]}):(0,q.jsx)(O,{onClick:()=>o(!0),children:`Stop…`})]}):null,s.error===null?null:(0,q.jsx)(`div`,{className:`px-3 pb-3`,children:(0,q.jsx)(z,{error:s.error})})]})}function Ue({member:t,scopes:n,preferred:r,running:i,paused:a,onDone:o}){let{api:s}=e(),c=l(),[u,d]=(0,K.useState)(`manual`),[f,p]=(0,K.useState)(r!==null&&n.includes(r)?r:n[0]??``),[m,h]=(0,K.useState)(``),g=(0,K.useRef)(null);(0,K.useEffect)(()=>g.current?.focus(),[]);let _=D({mutationFn:()=>s.wake({agent:t.name,project:f,kind:u,...m.trim()===``?{}:{reason:m.trim()}}),onSuccess:()=>{c.invalidateQueries({queryKey:[`scheduler`]}),o()}}),v=V(f),y=u===`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,q.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,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,q.jsx)(`legend`,{className:`sr-only`,children:`Kind of turn`}),[`manual`,`reflection`].map(e=>(0,q.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 ${u===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,q.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:u===e,onChange:()=>d(e),className:`sr-only`}),e===`manual`?`A turn`:`A reflection`]},e))]}),(0,q.jsxs)(`div`,{className:`ml-auto flex w-52 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-tertiary`,children:`at`}),(0,q.jsx)(G,{label:`Where`,choices:ue(n),value:f,onChange:p})]})]}),(0,q.jsx)(`textarea`,{ref:g,value:m,rows:2,placeholder:u===`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,q.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[y,b,` Each turn costs money.`]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,q.jsx)(O,{onClick:o,children:`Cancel`}),(0,q.jsx)(O,{variant:`primary`,type:`submit`,disabled:_.isPending||f===``,children:_.isPending?`Waking…`:u===`reflection`?`Ask for a reflection`:`Wake ${t.name}`})]}),(0,q.jsx)(z,{error:_.error})]})}var We={working:`bg-emerald-500/15 text-emerald-300`,queued:`bg-amber-500/15 text-amber-300`,idle:`bg-surface-2 text-fg-tertiary`};function Ge({project:e,name:t}){let n=(E(e).data??[]).filter(e=>e.status===`claimed`&&e.claimedBy===t);return n.length===0?null:(0,q.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:n.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(m,{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,q.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,q.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate font-mono text-[11px] text-fg-muted`,children:v(e)?.name??e.stage})]})},e.id))})}function Ke(){let{name:e}=k({from:`/citizen/$name`}),{scope:t,tab:n,turn:r}=I({from:`/citizen/$name`});return(0,q.jsx)(Je,{name:e,chosen:t??null,tab:n??`now`,turn:r??null},e)}var qe=[{tab:`now`,label:`Now`},{tab:`turns`,label:`Turns`},{tab:`memory`,label:`Memory`},{tab:`history`,label:`History`}];function Je({name:e,chosen:r,tab:i,turn:a}){let o=h(),c=n(),l=s(),u=P(),d=b(),f=t(),g=ee(),v=_(3e4),[y,x]=(0,K.useState)(null),S=o.data?.find(t=>t.name===e);if(S===void 0)return(0,q.jsx)(B,{children:o.data===void 0?`Reading the roster…`:`There is no citizen ${e}.`});let C=p(l.data?.running??[]).filter(t=>t.agent===e),w=[...new Set(C.map(e=>e.scope))],T=C.map(e=>ie(e.agent,e.scope,e)),E=p(l.data?.pending??[]).find(t=>t.agent===e),D=w.length>0?`working`:E===void 0?`idle`:`queued`,k=ne(u,e)[0],A=k?.model??S.lastModel,j=A??S.model??`CLI default`,M=S.model!==void 0&&S.model!==A?S.model:null,N=c.data?.find(e=>e.name===S.role),F=le(S),I=S.status===`active`&&S.cli!==null,L=(d.data??[]).filter(t=>t.agent===e&&t.ended===void 0).length;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(se,{leading:S.cli===null?null:(0,q.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2/70`,children:(0,q.jsx)(te,{cli:S.cli,size:20})}),title:e,subtitle:(0,q.jsxs)(q.Fragment,{children:[S.role,` · `,j,M===null?``:` · set to ${M}`,S.effort===void 0?``:` · ${S.effort} effort`,S.homeRunner===void 0?``:` · on ${S.homeRunner}`,S.status===`retired`?` · retired`:``]}),trailing:(0,q.jsxs)(q.Fragment,{children:[L===0?null:(0,q.jsx)(m,{to:`/crons`,search:{agent:e},className:`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 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:L===1?`1 cron`:`${L} crons`}),I&&y===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(O,{onClick:()=>x(`model`),children:`Model…`}),(0,q.jsx)(O,{onClick:()=>x(`runner`),children:`Runner…`}),(0,q.jsx)(O,{onClick:()=>x(`wake`),children:`Wake…`})]}):null,(0,q.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${We[D]}`,children:D})]})}),(0,q.jsx)(me,{member:S,runners:f.data??[],placed:new Map((g.data??[]).flatMap(e=>e.runner===void 0?[]:[[e.slug,e.runner]])),now:v}),y===`wake`?(0,q.jsx)(Ue,{member:S,scopes:F,preferred:r?.split(`/`)[0]??k?.scope??null,running:w,paused:l.data?.paused??!1,onDone:()=>x(null)}):y===`model`?(0,q.jsx)(Le,{member:S,onDone:()=>x(null)}):y===`runner`?(0,q.jsx)(Be,{member:S,onDone:()=>x(null)}):null,(0,q.jsx)(`nav`,{"aria-label":`Citizen views`,className:`flex gap-1 border-b border-line px-3 py-2`,children:qe.map(t=>(0,q.jsx)(m,{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,q.jsx)(Pe,{name:e,opened:a},a):i===`memory`?(0,q.jsx)(Ae,{member:S,charter:N}):i===`history`?(0,q.jsx)(ke,{name:e}):(0,q.jsx)(Xe,{name:e,chosen:r,lastTurnAt:S.lastTurnAt,state:D,runningScopes:w,runningKeys:T,runningTurns:(l.data?.turns??[]).filter(t=>t.agent===e),queuedScope:E?.scope??null})]})}function Ye(e){return e.toSorted((e,t)=>e.startedAt.localeCompare(t.startedAt))[0]}function Xe({name:e,chosen:t,lastTurnAt:n,state:r,runningScopes:i,runningKeys:a,runningTurns:o,queuedScope:s}){let c=P(),l=_(5e3),u=ne(c,e),f=d(e,1),p=je(e,u.length===0?f.data?.at(-1):void 0),h=ae(),g=e=>e.end===null&&a.includes(ie(e.agent,e.scope,e)),v=t?.split(`/`)[0]??null,y=(t?.includes(`/`)===!0?u.find(e=>j(e)===t):void 0)??Ye(u.filter(e=>e.scope===v&&g(e)))??u.find(e=>j(e)===t)??Ye(u.filter(g))??u[0]??p.turn,b=e=>e.thread===void 0?e.channel===void 0?e.place===void 0?V(e.scope):`${V(e.scope)} · ${e.place}'s channels`:`${V(e.scope)} · #${e.channel}`:`${V(e.scope)} · ${h.get(e.thread)?.title??`a thread`}`,x=y!==void 0&&g(y),S=y?.scope??i[0]??s,C=(y===void 0?void 0:o.find(e=>e.scope===y.scope&&e.thread===y.thread&&e.channel===y.channel&&e.place===y.place))??(x?void 0:o[0]);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{className:`border-b border-line px-4 py-3 text-xs text-fg-tertiary`,children:[(0,q.jsx)(`p`,{children:x?`In a turn at ${V(y.scope)} for ${y.fromStart?``:`at least `}${L(y.startedAt,l)}`:i.length>0?`In a turn at ${i.map(V).join(` and `)}`:s===null?n===void 0?`No turns yet`:`Last turn ${w(n,l)}`:`Queued for a turn at ${V(s)}`}),S===null||S===`society`?null:(0,q.jsx)(Ge,{project:S,name:e})]}),(0,q.jsx)(ce,{className:`px-4 py-3`,children:y===void 0?(0,q.jsx)(B,{children:r===`working`?`The turn has not reported a step yet.`:p.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,q.jsxs)(q.Fragment,{children:[u.length>1?(0,q.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,"aria-label":`Turns by conversation`,children:u.toSorted((e,t)=>j(e).localeCompare(j(t))).map(t=>(0,q.jsxs)(m,{to:`/citizen/$name`,params:{name:e},search:{scope:j(t)},replace:!0,"aria-current":t===y?`true`:void 0,className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[11px] transition-colors ${t===y?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[g(t)?(0,q.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}):null,b(t)]},j(t)))}):null,(0,q.jsxs)(`p`,{className:`text-caps`,children:[x?`This turn`:`Last turn`,` · `,b(y),` · started`,` `,y.fromStart?J(y.startedAt):`before the earliest step shown`]}),y.fromStart?null:(0,q.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`Earlier steps of this turn are no longer in the server's live buffer`,x?``:`; Turns has the whole turn`,`.`]}),(0,q.jsx)(ve,{steps:y.steps}),(0,q.jsx)(ye,{turn:y,running:x,now:l})]})}),C===void 0?null:(0,q.jsx)(He,{name:e,turn:C})]})}export{Ke as CitizenView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,Ft as t,Gn as n,Jn as r,P as i,Un as a,V as o,Wn as s,Yt as c,_ as l,_t as u,b as d,l as f,t as p,x as m}from"./format-CvfmDNoY.js";import{n as h,t as g}from"./Button-BYJGqZ3Q.js";import{t as _}from"./CliIcon-DVX5iLhG.js";import{D as v,E as y,T as b,k as x,w as S}from"./index-DD3J11PT.js";import{t as C}from"./Markdown--whKJBYV.js";import{a as w,o as T,r as E}from"./ThreadForms-DzoRDeBh.js";import{n as D,t as O}from"./Pane-DTmByqgA.js";import{a as k,d as A,i as j}from"./citizen-BPIJzKdn.js";import{n as M,r as N,t as P}from"./Picker-DsHm4f7s.js";var F=r(n(),1),I=s(),L=[`UTC`,...Intl.supportedValuesOf(`timeZone`).filter(e=>e!==`UTC`)],R=50;function z(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).formatToParts(t).find(e=>e.type===`timeZoneName`)?.value??``;return n===`GMT`?`UTC`:n.replace(`GMT`,`UTC`)}function B({value:e,onChange:t,label:n,placeholder:r}){let[i,a]=(0,F.useState)(!1),[o,s]=(0,F.useState)(0),c=(0,F.useRef)(null),l=(0,F.useRef)([]),u=e.trim().toLowerCase(),d=(0,F.useMemo)(()=>(u===``?L:L.filter(e=>e.toLowerCase().includes(u))).slice(0,R),[u]),f=(0,F.useMemo)(()=>new Date,[]);(0,F.useEffect)(()=>{i&&l.current[o]?.scrollIntoView({block:`nearest`})},[i,o]),(0,F.useEffect)(()=>{if(!i)return;let e=e=>{e.target instanceof Node&&c.current?.contains(e.target)===!0||a(!1)};return window.addEventListener(`click`,e),()=>window.removeEventListener(`click`,e)},[i]);let p=e=>{t(e),a(!1)};return(0,I.jsxs)(`div`,{ref:c,className:`relative min-w-0 flex-1`,children:[(0,I.jsx)(`input`,{"aria-label":n,value:e,spellCheck:!1,autoComplete:`off`,placeholder:r,onChange:e=>{t(e.target.value),s(0),a(!0)},onClick:()=>a(!0),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!i){a(!0);return}let t=e.key===`ArrowDown`?1:-1;s(e=>(e+t+d.length)%Math.max(d.length,1));return}if(e.key===`Enter`&&i&&d[o]!==void 0){e.preventDefault(),p(d[o]);return}if(e.key===`Tab`){a(!1);return}e.key===`Escape`&&i&&(e.preventDefault(),e.stopPropagation(),a(!1))},className:T}),i&&d.length>0&&(d.length!==1||d[0]!==e)?(0,I.jsx)(`div`,{className:`max-h-48 ${P}`,children:d.map((e,t)=>(0,I.jsxs)(`button`,{ref:e=>{l.current[t]=e},type:`button`,tabIndex:-1,"aria-current":t===o?`true`:void 0,onPointerDown:e=>e.preventDefault(),onPointerEnter:()=>s(t),onClick:()=>p(e),className:N(t===o),children:[(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-secondary`,children:e}),(0,I.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-muted`,children:z(e,f)})]},e))}):null]})}function V({word:e,children:t}){return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,I.jsx)(`span`,{className:`shrink-0 text-xs text-fg-tertiary`,children:e}),t]})}function H(e,n){return t(typeof e==`string`?new Date(e):e,n)}function U({cron:e}){let t=o(),n=b(e);if(n.kind===`thread`){let e=t.data?.find(e=>e.id===n.id)?.title??n.id;return(0,I.jsxs)(c,{to:`/thread/$threadId`,params:{threadId:n.id},className:`truncate hover:text-fg-primary`,children:[`thread “`,e,`”`]})}return n.kind===`channel`?(0,I.jsxs)(c,{to:`/c/$`,params:{_splat:n.ref},className:`hover:text-fg-primary`,children:[`#`,n.ref]}):n.kind===`place`?(0,I.jsxs)(c,{to:`/p/$slug`,params:{slug:n.project},className:`hover:text-fg-primary`,children:[n.project,`'s channels`]}):(0,I.jsxs)(`span`,{children:[`home at `,k(n.scope)]})}function W({cron:t,next:n,member:r,zone:i,now:o,focused:s}){let l=(0,F.useRef)(null);(0,F.useEffect)(()=>{s&&l.current!==null&&(l.current.open=!0,l.current.scrollIntoView({block:`nearest`}))},[s]);let{api:u}=e(),d=a(),[f,m]=(0,F.useState)(!1),[v,b]=(0,F.useState)(``),x=()=>void d.invalidateQueries({queryKey:[`crons`]}),S=h({mutationFn:e=>u.pauseCron(t.id,e),onSuccess:x}),w=h({mutationFn:()=>u.removeCron(t.id,v.trim()),onSuccess:x}),D=`at`in t.schedule?`once, ${H(t.schedule.at,i)}`:`${t.schedule.cron} · ${t.schedule.timezone??i}`,O=t.ended===void 0?t.paused===void 0?n===null?`no time to come`:n.getTime()<=o?`due, waiting for its turn`:p(n.toISOString(),o):`paused`:`ended ${p(t.ended.at,o)}`,k=y(t);return(0,I.jsx)(`li`,{className:`rounded-lg ${s?`bg-surface-2/30`:``}`,children:(0,I.jsxs)(`details`,{ref:l,className:`group`,children:[(0,I.jsxs)(`summary`,{className:`cursor-pointer list-none rounded-lg px-2 py-2 hover:bg-surface-2/40 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2 text-sm`,children:[r?.cli===void 0||r.cli===null?null:(0,I.jsx)(_,{cli:r.cli,size:13}),(0,I.jsx)(`span`,{className:`shrink-0 text-fg-secondary`,children:t.agent}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-primary`,children:t.title}),(0,I.jsx)(`span`,{className:`shrink-0 text-xs ${t.paused===void 0?`text-fg-muted`:`text-amber-300`}`,title:n===null?void 0:`${H(n,i)}, ${i}`,children:O})]}),(0,I.jsxs)(`p`,{className:`mt-0.5 flex items-baseline gap-1.5 truncate text-meta`,children:[(0,I.jsx)(`span`,{children:D}),(0,I.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,I.jsx)(U,{cron:t}),t.lastRun===void 0?null:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,I.jsxs)(`span`,{children:[`last turn `,t.lastRun.outcome,` `,p(t.lastRun.at,o)]})]}),k?(0,I.jsxs)(`span`,{className:`text-amber-300`,children:[`· `,t.failures,` failed in a row`]}):null]})]}),(0,I.jsxs)(`div`,{className:`space-y-3 px-2 pt-1 pb-3`,children:[(0,I.jsx)(`div`,{className:`rounded-lg bg-surface-2/30 px-3 py-2`,children:(0,I.jsx)(C,{text:t.note})}),(0,I.jsxs)(`p`,{className:`text-meta`,children:[`Set by `,t.createdBy,` `,p(t.createdAt,o),t.lastFiredAt===void 0?``:` · fired last ${H(t.lastFiredAt,i)}`,t.ended===void 0?``:` · ended by ${t.ended.by}: ${t.ended.reason}`]}),n===null?null:(0,I.jsxs)(`p`,{className:`text-meta`,children:[`Next `,H(n,i),` (`,i,`)`]}),t.lastRun===void 0?null:(0,I.jsx)(c,{to:`/citizen/$name`,params:{name:t.agent},search:{tab:`turns`,turn:t.lastRun.turnId},className:`text-meta underline-offset-2 hover:text-fg-primary hover:underline`,children:`Open its last turn`}),t.ended===void 0?f?(0,I.jsxs)(`form`,{"aria-label":`Remove ${t.title}`,className:`space-y-2`,onSubmit:e=>{e.preventDefault(),w.mutate()},children:[(0,I.jsx)(`input`,{value:v,"aria-label":`Why it ends`,placeholder:`Why it ends, which the cron keeps`,onChange:e=>b(e.target.value),className:T}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:()=>m(!1),children:`Cancel`}),(0,I.jsx)(g,{variant:`primary`,type:`submit`,disabled:w.isPending||v.trim()===``,children:w.isPending?`Removing…`:`Remove cron`})]}),(0,I.jsx)(E,{error:w.error})]}):(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:()=>S.mutate(t.paused===void 0),disabled:S.isPending,children:t.paused===void 0?`Pause`:`Resume`}),(0,I.jsx)(g,{onClick:()=>m(!0),children:`Remove…`}),(0,I.jsx)(E,{error:S.error})]}):null]})]})})}function G({zone:t,onDone:n}){let{api:r}=e(),i=a(),[o,s]=(0,F.useState)(t),c=new Intl.DateTimeFormat().resolvedOptions().timeZone,l=h({mutationFn:()=>r.setTimezone(o.trim()),onSuccess:()=>{i.invalidateQueries({queryKey:[`society`]}),i.invalidateQueries({queryKey:[`crons`]}),n()}});return(0,I.jsxs)(`form`,{"aria-label":`Time zone`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),l.mutate()},children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(B,{value:o,onChange:s,label:`Society time zone`}),c===o?null:(0,I.jsxs)(g,{onClick:()=>s(c),children:[`Use `,c]})]}),(0,I.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:`Crons that name no zone are read in it, so their times move with it, and every turn's prompt tells the time in it.`}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:n,children:`Cancel`}),(0,I.jsx)(g,{variant:`primary`,type:`submit`,disabled:l.isPending||o.trim()===``||o.trim()===t,children:l.isPending?`Saving…`:`Save`})]}),(0,I.jsx)(E,{error:l.error})]})}function K({members:t,preferred:n,zone:r,onDone:o}){let{api:s}=e(),c=a(),l=m(),f=i(),[p,_]=(0,F.useState)(t.find(e=>e.name===n)?.name??t[0]?.name??``),y=t.find(e=>e.name===p),b=y===void 0?[]:A(y),[x,S]=(0,F.useState)(b[0]??`society`),[C,D]=(0,F.useState)(``),[O,k]=(0,F.useState)(`repeats`),[N,P]=(0,F.useState)(`0 9 * * 1-5`),[L,R]=(0,F.useState)(``),[z,U]=(0,F.useState)(``),[W,G]=(0,F.useState)(``),[K,q]=(0,F.useState)(``),J=(0,F.useRef)(null);(0,F.useEffect)(()=>J.current?.focus(),[]);let Y=d(3e4),ee=(x===`society`?f.data?.channels??[]:l.data?.find(e=>e.slug===x)?.channels??[]).filter(e=>e!==`general`),X=O===`repeats`?{cron:N,...L.trim()===``?{}:{timezone:L.trim()}}:{at:z===``?``:new Date(z).toISOString()},Z=v(O===`once`&&z===``?{at:`invalid`}:X,r,new Date(Y)),Q=O===`repeats`?L.trim()===``?r:L.trim():r,$=h({mutationFn:()=>s.createCron({agent:p,title:W.trim(),note:K.trim(),project:x,...C===``?{}:{channel:C},...X}),onSuccess:()=>{c.invalidateQueries({queryKey:[`crons`]}),o()}});return(0,I.jsxs)(`form`,{"aria-label":`New cron`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),$.mutate()},children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(V,{word:`wakes`,children:(0,I.jsx)(M,{label:`Citizen`,choices:t.map(e=>({value:e.name,name:e.name,id:e.role,description:e.memberships.length===0?`in no project`:`in ${e.memberships.join(`, `)}`})),value:p,onChange:e=>{let n=t.find(t=>t.name===e);_(e),S(n===void 0?u:A(n)[0]??`society`),D(``)}})}),(0,I.jsx)(V,{word:`at`,children:(0,I.jsx)(M,{label:`Where`,choices:j(b),value:x,onChange:e=>{S(e),D(``)}})}),(0,I.jsx)(V,{word:`in`,children:(0,I.jsx)(M,{label:`Conversation`,choices:[{value:``,name:`its home`,id:null,description:`general, and work tied to no other channel`},...ee.map(e=>({value:e,name:`#${e}`,id:null,description:`a workstream's own conversation`}))],value:C,onChange:D})})]}),(0,I.jsx)(`input`,{ref:J,value:W,maxLength:120,"aria-label":`Title`,placeholder:`Title, such as Morning report`,onChange:e=>G(e.target.value),className:T}),(0,I.jsx)(`textarea`,{value:K,rows:3,"aria-label":`Note`,placeholder:`What to do when it fires; the citizen reads this in every turn it starts.`,onChange:e=>q(e.target.value),className:w}),(0,I.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,I.jsx)(`legend`,{className:`sr-only`,children:`How often`}),[`repeats`,`once`].map(e=>(0,I.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 ${O===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:O===e,onChange:()=>k(e),className:`sr-only`}),e===`repeats`?`Repeats`:`Once`]},e))]}),O===`repeats`?(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,I.jsx)(`input`,{value:N,spellCheck:!1,"aria-label":`Cron expression`,placeholder:`minute hour day month weekday`,onChange:e=>P(e.target.value),className:T})}),(0,I.jsx)(B,{value:L,onChange:R,label:`Its time zone`,placeholder:`${r}, the society's`})]}):(0,I.jsx)(`input`,{type:`datetime-local`,value:z,"aria-label":`When, in this browser's time`,onChange:e=>U(e.target.value),className:T}),(0,I.jsxs)(`p`,{"aria-live":`polite`,className:`text-xs leading-relaxed text-fg-muted`,children:[`error`in Z?(0,I.jsx)(`span`,{className:`text-amber-300`,children:Z.error}):(0,I.jsxs)(I.Fragment,{children:[Z.times.length===1?`Fires `:`Fires next `,Z.times.map(e=>H(e,Q)).join(`, `),` (`,Q,`).`]}),` `,`Each fire is a turn for `,p===``?`the citizen`:p,`, which costs money.`]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:o,children:`Cancel`}),(0,I.jsx)(g,{variant:`primary`,type:`submit`,disabled:$.isPending||p===``||W.trim()===``||K.trim()===``||`error`in Z,children:$.isPending?`Setting…`:`Set cron`})]}),(0,I.jsx)(E,{error:$.error})]})}function q(){let{agent:e,cron:t}=x({from:`/crons`}),n=f(),r=l(),a=i(),o=d(3e4),[s,u]=(0,F.useState)(null),p=a.data?.timezone??`UTC`,m=(n.data??[]).filter(t=>e===void 0||t.agent===e),h=S(m,p),_=m.filter(y).length,v=(r.data??[]).filter(e=>e.status===`active`&&e.cli!==null),b=e=>r.data?.find(t=>t.name===e);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(O,{title:e===void 0?`Crons`:`Crons of ${e}`,subtitle:[`${h.active.length} running`,...h.paused.length===0?[]:[`${h.paused.length} paused`],..._===0?[]:[`${_} failing`],`times in ${p}`].join(` · `),trailing:s===null?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g,{onClick:()=>u(`zone`),children:`Time zone…`}),(0,I.jsx)(g,{onClick:()=>u(`new`),disabled:v.length===0,children:`New cron…`})]}):null}),s===`new`?(0,I.jsx)(K,{members:v,preferred:e,zone:p,onDone:()=>u(null)}):s===`zone`?(0,I.jsx)(G,{zone:p,onDone:()=>u(null)}):null,(0,I.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e===void 0?null:(0,I.jsx)(c,{to:`/crons`,className:`block px-2 pb-2 text-meta hover:text-fg-primary`,children:`Show every citizen's crons`}),n.error!==null&&n.data===void 0?(0,I.jsxs)(D,{children:[`The board server did not list its crons (`,n.error.message,`); one older than this interface has none.`]}):n.data===void 0?(0,I.jsx)(D,{children:`Reading the crons…`}):h.active.length+h.paused.length+h.ended.length===0?(0,I.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No crons yet. A citizen sets one with create_cron when it needs to come back to something later; you can set one for any citizen here.`}):null,h.active.length===0?null:(0,I.jsx)(`ul`,{"aria-label":`Running`,className:`space-y-0.5`,children:h.active.map(({cron:e,next:n})=>(0,I.jsx)(W,{cron:e,next:n,member:b(e.agent),zone:p,now:o,focused:e.id===t},e.id))}),h.paused.length===0?null:(0,I.jsxs)(`section`,{"aria-label":`Paused`,className:`mt-3`,children:[(0,I.jsx)(`h3`,{className:`px-2 pb-1 text-section`,children:`Paused`}),(0,I.jsx)(`ul`,{className:`space-y-0.5`,children:h.paused.map(e=>(0,I.jsx)(W,{cron:e,next:null,member:b(e.agent),zone:p,now:o,focused:e.id===t},e.id))})]}),h.ended.length===0?null:(0,I.jsxs)(`details`,{className:`mt-3`,open:h.ended.some(e=>e.id===t),children:[(0,I.jsxs)(`summary`,{className:`cursor-pointer px-2 pb-1 text-section`,children:[`Ended (`,h.ended.length,`)`]}),(0,I.jsx)(`ul`,{"aria-label":`Ended`,className:`space-y-0.5`,children:h.ended.map(e=>(0,I.jsx)(W,{cron:e,next:null,member:b(e.agent),zone:p,now:o,focused:e.id===t},e.id))})]})]})]})}export{q as CronsView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,Gn as t,Jn as n,Un as r,Wn as i,Yt as a,_t as o,b as s,h as c,t as l,x as u}from"./format-CvfmDNoY.js";import{n as d,t as f}from"./Button-BYJGqZ3Q.js";import{i as p}from"./compose-BUhbVoI-.js";import{A as m}from"./index-DD3J11PT.js";import{t as h}from"./BackLink-DKMw_rHu.js";import{t as g}from"./Markdown--whKJBYV.js";import{r as _}from"./ThreadForms-DzoRDeBh.js";import{n as v,t as y}from"./Pane-DTmByqgA.js";var b=n(t(),1),x=i(),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:t,topic:n}=m({from:`/knowledge/$scope/$topic`}),{api:i}=e(),C=r(),w=p(),T=c(t),E=u(),D=s(3e4),[O,k]=(0,b.useState)(!1),A=t===o,j=A?`the society`:E.data?.find(e=>e.slug===t)?.name??t,M=T.data?.find(e=>e.topic===n),N=d({mutationFn:()=>i.removeKnowledge({project:A?null:t,topic:n}),onSuccess:async()=>{await C.invalidateQueries({queryKey:[`knowledge`,t]}),await w(A?{to:`/society`}:{to:`/p/$slug`,params:{slug:t}})}}),P=A?(0,x.jsx)(a,{to:`/society`,"aria-label":`Back to the society`,className:S,children:`←`}):(0,x.jsx)(a,{to:`/p/$slug`,params:{slug:t},"aria-label":`Back to ${j}`,className:S,children:`←`});return M===void 0?(0,x.jsx)(v,{children:T.data===void 0?`Reading…`:`${j} has no topic ${n}.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(y,{leading:(0,x.jsx)(h,{fallback:P}),title:M.topic,subtitle:`Knowledge of ${j} · written by ${M.updatedBy} ${l(M.updatedAt,D)}`,trailing:O?null:(0,x.jsx)(f,{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`:`#${t}/general`,` says so without waking anyone. The server keeps its text aside.`]}),(0,x.jsx)(f,{onClick:()=>k(!1),children:`Cancel`}),(0,x.jsx)(f,{variant:`primary`,type:`submit`,disabled:N.isPending,children:N.isPending?`Removing…`:`Remove topic`})]}),(0,x.jsx)(_,{error:N.error})]}):null,(0,x.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:(0,x.jsx)(g,{text:M.body})})]})}export{C as KnowledgeView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e,Wn as t,Yt as n,b as r,r as i,t as a,y as o}from"./format-CvfmDNoY.js";import{g as s,k as c,s as l}from"./index-DD3J11PT.js";import{n as u,t as d}from"./Pane-DTmByqgA.js";import{n as f}from"./Overview-DFiHDFnA.js";var p=t(),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}){let t=l();return e===`user`?(0,p.jsx)(`span`,{children:t(e)}):(0,p.jsx)(n,{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:t=`7d`}=c({from:`/metrics`}),l=o(t),T=r(6e4),E=(0,p.jsx)(`nav`,{"aria-label":`Window`,className:`flex shrink-0 gap-1`,children:m.map(e=>(0,p.jsx)(n,{to:`/metrics`,search:{window:e.window},"aria-current":e.window===t?`page`:void 0,className:`rounded-md px-2 py-1 text-xs transition-colors ${e.window===t?`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(l.data===void 0)return(0,p.jsxs)(p.Fragment,{children:[D,(0,p.jsx)(u,{children:l.error instanceof e?l.error.message:`Counting the event log…`})]});let{idle:O,sentBack:k,messages:A,latency:j,decisions:M,blocked:N}=l.data,P=w(l.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{Wn as e,Yt as t,b as n,n as r,t as i,x as a}from"./format-CvfmDNoY.js";import{o}from"./governance-Bba0OHvJ.js";import{S as s,_ as c,s as l}from"./index-DD3J11PT.js";import{n as u,t as d}from"./Pane-DTmByqgA.js";var f=e(),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 e=s(),g=a(),_=n(3e4),v=l(),y=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:e.length===0?`Nothing waits on you`:`${e.length} waiting on you, oldest first`}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:e.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 s=e.filter(e=>e.kind===n);return s.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,` · `,s.length]}),(0,f.jsx)(`ul`,{children:s.map(e=>{if(e.kind===`proposal`)return(0,f.jsx)(`li`,{children:(0,f.jsx)(t,{to:`/proposal/$proposalId`,params:{proposalId:e.proposal.id},className:m,children:(0,f.jsx)(h,{title:o(e.proposal),meta:`proposed by ${v(e.proposal.proposedBy)} ${i(e.since,_)}`})})},e.proposal.id);if(e.kind===`stage`)return(0,f.jsx)(`li`,{children:(0,f.jsx)(t,{to:`/task/$taskId`,params:{taskId:e.task.id},className:m,children:(0,f.jsx)(h,{title:e.task.title,meta:`${e.stage.name}${e.stage.gate?` (gate)`:``} in ${y(e.task.project)} · waiting since ${i(e.since,_)}`})})},e.task.id);let n=`${v(e.message.author)} in ${e.thread===null?`#${e.message.channel}`:e.thread.title} ${i(e.since,_)}`,a=(0,f.jsx)(h,{title:(0,f.jsx)(c,{text:r(e.message.body,160),links:!1}),meta:n}),s=e.thread?.subject;return(0,f.jsx)(`li`,{children:s?.kind===`task`?(0,f.jsx)(t,{to:`/task/$taskId`,params:{taskId:s.id},className:m,children:a}):s?.kind===`proposal`?(0,f.jsx)(t,{to:`/proposal/$proposalId`,params:{proposalId:s.id},className:m,children:a}):e.thread===null?(0,f.jsx)(t,{to:`/c/$`,params:{_splat:e.message.channel},className:m,children:a}):(0,f.jsx)(t,{to:`/thread/$threadId`,params:{threadId:e.thread.id},className:m,children:a})},e.message.id)})})]},n)})})]})}export{g as NeedsYouView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as e,Wn as t,X as n,Yt as r,n as i,t as a}from"./format-CvfmDNoY.js";import{t as o}from"./CliIcon-DVX5iLhG.js";import{_ as s}from"./index-DD3J11PT.js";import{a as c}from"./citizen-BPIJzKdn.js";var l=t();function u({title:e,aside:t,children:n}){return(0,l.jsxs)(`section`,{className:`border-t border-line pt-4 first:border-t-0 first:pt-0`,children:[(0,l.jsxs)(`h3`,{className:`flex items-baseline justify-between gap-2`,children:[(0,l.jsx)(`span`,{className:`text-section`,children:e}),t]}),(0,l.jsx)(`div`,{className:`mt-2`,children:n})]})}function d({members:t,scope:i}){let a=e(),s=n(a.data?.running??[]),u=n(a.data?.pending??[]);return t.length===0?(0,l.jsx)(`p`,{className:`text-meta`,children:`Nobody yet.`}):(0,l.jsx)(`ul`,{className:`-mx-2`,children:t.map(e=>{let t=s.filter(t=>t.agent===e.name).map(e=>e.scope),n=t.includes(i),a=u.some(t=>t.agent===e.name),d=n?`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)(r,{to:`/citizen/$name`,params:{name:e.name},search:n&&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:n}){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)(r,{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,n)]})]}),(0,l.jsx)(`span`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:(0,l.jsx)(s,{text:i(t.body,240),links:!1})})]})},t.topic))})}export{u as n,f as r,d as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,Gn as t,Jn as n,Un as r,Wn as i,Yt as a,_ as o,b as s,c,h as l,t as u,u as d,x as f,z as p}from"./format-CvfmDNoY.js";import{n as m,t as h}from"./Button-BYJGqZ3Q.js";import{i as g,t as _}from"./tasks-CTaxXtGL.js";import{A as v}from"./index-DD3J11PT.js";import{t as y}from"./Markdown--whKJBYV.js";import{n as b,r as x}from"./ThreadForms-DzoRDeBh.js";import{n as S,r as C}from"./ChannelForms-CkYupEL2.js";import{n as w,t as T}from"./Pane-DTmByqgA.js";import{n as E,r as D,t as O}from"./Overview-DFiHDFnA.js";var k=n(t(),1),A=i();function j({project:t,onDone:n}){let{api:i}=e(),a=r(),[o,s]=(0,k.useState)(t.name),[c,l]=(0,k.useState)(t.defaultBranch),u={...o.trim()===t.name?{}:{name:o.trim()},...c.trim()===t.defaultBranch?{}:{default_branch:c.trim()}},d=m({mutationFn:()=>i.configureProject(t.slug,u),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`projects`]}),n()}}),f=Object.keys(u).length===0||o.trim()===``||c.trim()===``;return(0,A.jsxs)(`form`,{"aria-label":`Edit ${t.slug}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`input`,{value:o,maxLength:120,"aria-label":`Project name`,onChange:e=>s(e.target.value),className:`${b} min-w-0 flex-1`}),(0,A.jsx)(`div`,{className:`w-36 shrink-0`,children:(0,A.jsx)(`input`,{value:c,maxLength:100,spellCheck:!1,"aria-label":`Default branch`,onChange:e=>l(e.target.value),className:`${b} font-mono`})}),(0,A.jsx)(h,{onClick:n,children:`Cancel`}),(0,A.jsx)(h,{variant:`primary`,type:`submit`,disabled:d.isPending||f,children:d.isPending?`Saving…`:`Save`})]}),(0,A.jsxs)(`p`,{className:`text-meta`,children:[t.slug,` stays in its addresses, channels, and branches. A new default branch is where tasks start and land from now; its runner makes it from the project's remote, or from where the repository stands, before the next turn.`]}),(0,A.jsx)(x,{error:d.error})]})}function M(){let{slug:e}=v({from:`/p/$slug`}),t=f(),n=c(),r=o(),i=p(e),m=d(e),b=l(e),x=s(3e4),[M,N]=(0,k.useState)(!1),[P,F]=(0,k.useState)(!1),I=t.data?.find(t=>t.slug===e);if(I===void 0)return(0,A.jsx)(w,{children:t.data===void 0?`Reading the project…`:`There is no project ${e}.`});let L=(r.data??[]).filter(e=>e.status===`active`&&I.members.includes(e.name)),R=g(i.data??[]),z=m.data?.body.trim()??``;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(T,{title:I.name,subtitle:`${e} · ${I.repo??`a local repository`} · ${I.defaultBranch}`,trailing:(0,A.jsxs)(A.Fragment,{children:[M||I.archived!==void 0?null:(0,A.jsx)(h,{onClick:()=>N(!0),children:`Edit…`}),(0,A.jsx)(a,{to:`/p/$slug/tasks`,params:{slug:e},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Tasks →`})]})}),M?(0,A.jsx)(j,{project:I,onDone:()=>N(!1)}):null,P?(0,A.jsx)(C,{project:e,onDone:()=>F(!1)}):null,(0,A.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[I.archived===void 0?null:(0,A.jsxs)(`p`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-sm text-fg-secondary`,children:[`Archived `,u(I.archived.at,x),` by `,I.archived.by,`:`,` `,I.archived.reason,`. Its channels, tasks, and history stay readable here; nothing more is posted, filed, or joined.`]}),(0,A.jsx)(E,{title:`Channels`,aside:I.archived===void 0&&!P?(0,A.jsx)(h,{onClick:()=>F(!0),children:`New channel…`}):null,children:(0,A.jsx)(S,{channels:(n.data??[]).filter(t=>t.project===e),now:x})}),(0,A.jsx)(E,{title:`Members`,children:(0,A.jsx)(O,{members:L,scope:e})}),(0,A.jsx)(E,{title:`Tasks`,children:i.data===void 0?(0,A.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):R.length===0?(0,A.jsx)(`p`,{className:`text-meta`,children:`No tasks yet.`}):(0,A.jsx)(a,{to:`/p/$slug/tasks`,params:{slug:e},className:`flex flex-wrap gap-1.5`,children:R.map(e=>(0,A.jsxs)(`span`,{className:`rounded-md bg-surface-2/60 px-2 py-0.5 text-xs text-fg-secondary`,children:[e.tasks.length,` `,_.find(t=>t.phase===e.phase)?.label.toLowerCase()]},e.phase))})}),(0,A.jsx)(E,{title:`How a task ends`,children:(0,A.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:I.onDone===`merge`?`When its last stage is done, the board merges task/<id> onto ${I.defaultBranch}.`:I.onDone===`ghpr`?`When its last stage is done, the board merges the pull request linked to it into ${I.defaultBranch} on GitHub.`:`When its last stage is done, it is done; nothing is merged.`})}),(0,A.jsx)(E,{title:`Dashboard`,aside:m.data?.updatedBy===void 0?void 0:(0,A.jsxs)(`span`,{className:`text-meta`,children:[`by `,m.data.updatedBy,m.data.updatedAt===void 0?``:` ${u(m.data.updatedAt,x)}`]}),children:m.data===void 0?(0,A.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):z===``?(0,A.jsx)(`p`,{className:`text-meta`,children:`Empty. The project's members fill it in with update_dashboard.`}):(0,A.jsx)(y,{text:z})}),(0,A.jsx)(E,{title:`Knowledge`,children:(0,A.jsx)(D,{scope:e,topics:b.data,now:x})})]})]})}export{M as ProjectView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,B as t,C as n,E as r,Gn as i,Gt as a,Ht as o,Jn as s,Jt as c,K as l,Kt as u,N as d,S as f,Un as p,V as m,Wn as h,Wt as g,Yt as _,_ as v,b as y,dt as b,ft as x,gt as S,ht as C,mt as ee,pt as w,t as T,vt as te,x as ne,yt as re,z as ie}from"./format-CvfmDNoY.js";import{n as ae,t as E}from"./Button-BYJGqZ3Q.js";import{t as oe}from"./CliIcon-DVX5iLhG.js";import{a as se}from"./tasks-CTaxXtGL.js";import{c as ce,d as D,l as O,n as k,o as A,r as j,s as M}from"./governance-Bba0OHvJ.js";import{A as N,i as P,o as F,s as I}from"./index-DD3J11PT.js";import{t as L}from"./BackLink-DKMw_rHu.js";import{t as R}from"./Markdown--whKJBYV.js";import{n as z,r as B}from"./ThreadForms-DzoRDeBh.js";import{n as V,t as H}from"./Pane-DTmByqgA.js";import{t as le}from"./StickyList-C4fC_KJv.js";import{t as U}from"./SkillFileList-DhdEcFQA.js";import{StatusChip as W}from"./ProposalsView-uEuj-ooV.js";import{t as ue}from"./SubjectThread-BEXt-tub.js";var G=s(i(),1),K=h();function de({proposal:t,consequence:n}){let{api:r}=e(),i=p(),a=v(),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(``),u=(0,G.useRef)(null);(0,G.useEffect)(()=>{o!==null&&u.current?.focus()},[o]);let d=ae({mutationFn:()=>{let e=c.trim();return o===`reject`?r.reject({proposal_id:t.id,reason:e}):r.approve({proposal_id:t.id,...e===``?{}:{reason:e}})},onSuccess:()=>{let e=[[`proposals`],[`proposal`,t.id],[`threads`],[`thread`,t.id]];for(let t of e)i.invalidateQueries({queryKey:t});s(null),l(``)}}),f=(a.data??[]).find(e=>e.name===t.proposedBy&&e.status===`active`&&e.cli!==null),m=f===void 0?`Your decision is posted in the proposal's thread, which closes.`:`Your decision is posted in the proposal's thread, which closes, and wakes ${f.name}, who proposed it.`;if(o===null)return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-line px-4 py-3`,children:[(0,K.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`This proposal waits on you.`}),(0,K.jsx)(E,{onClick:()=>s(`reject`),children:`Reject`}),(0,K.jsx)(E,{variant:`primary`,onClick:()=>s(`approve`),children:`Approve`})]});let h=o===`approve`;return(0,K.jsxs)(`form`,{"aria-label":h?`Approve the proposal`:`Reject the proposal`,className:`space-y-2 border-t border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,K.jsx)(`textarea`,{ref:u,value:c,rows:2,placeholder:h?`Why approve? Optional.`:`Why not? It is posted with the decision.`,"aria-label":h?`Reason for approving`:`Reason for rejecting`,onChange:e=>l(e.target.value),className:`${z} resize-none`}),(0,K.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[h?n:`Nothing is created, and the proposal's thread closes.`,` `,m]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,K.jsx)(E,{onClick:()=>{s(null),d.reset()},children:`Cancel`}),(0,K.jsx)(E,{variant:`primary`,type:`submit`,disabled:d.isPending||!h&&c.trim()===``,children:d.isPending?`Deciding…`:h?`Confirm approval`:`Confirm rejection`})]}),(0,K.jsx)(B,{error:d.error})]})}function q({children:e}){return(0,K.jsx)(`dl`,{className:`mt-2 space-y-1.5`,children:e})}function J({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`grid grid-cols-[9rem_1fr] gap-3 text-sm`,children:[(0,K.jsx)(`dt`,{className:`text-meta`,children:e}),(0,K.jsx)(`dd`,{className:`min-w-0 break-words text-fg-secondary`,children:t})]})}function Y(e){return e.length===0?`none`:e.join(`, `)}function X({name:e,change:t}){return(0,K.jsxs)(`span`,{className:`inline-block rounded-md px-1.5 py-px font-mono text-[11px] ${t===`added`?`bg-emerald-500/15 text-emerald-300`:t===`removed`?`bg-red-500/15 text-red-300 line-through`:`bg-surface-2/70 text-fg-tertiary`}`,children:[t===`added`?`+ `:t===`removed`?`− `:``,e]})}function Z({children:e}){return(0,K.jsx)(`div`,{className:`mt-2 rounded-xl bg-surface-2/30 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:e})}function Q({next:e,current:t,compare:n}){let r=t===void 0?null:ce(t,e),i=r!==null&&r.verbsAdded.length===0&&r.verbsRemoved.length===0&&r.changes.length===0&&!r.purposeChanged;return(0,K.jsxs)(K.Fragment,{children:[n?r===null?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:`A new role: no charter by this name exists yet.`}):i?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:`The same as the charter the role has now.`}):(0,K.jsxs)(Z,{children:[(0,K.jsx)(`p`,{className:`text-caps`,children:`Against the charter it has now`}),r.verbsAdded.length+r.verbsRemoved.length===0?null:(0,K.jsxs)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:[r.verbsAdded.map(e=>(0,K.jsx)(X,{name:e,change:`added`},e)),r.verbsRemoved.map(e=>(0,K.jsx)(X,{name:e,change:`removed`},e))]}),r.changes.length===0?null:(0,K.jsx)(q,{children:r.changes.map(e=>(0,K.jsxs)(J,{label:e.field,children:[e.from,` → `,(0,K.jsx)(`span`,{className:`text-fg-primary`,children:e.to})]},e.field))}),r.purposeChanged?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-secondary`,children:`The purpose is rewritten.`}):null]}):null,(0,K.jsxs)(q,{children:[(0,K.jsx)(J,{label:`Role`,children:e.name}),(0,K.jsx)(J,{label:`Purpose`,children:e.purpose}),(0,K.jsx)(J,{label:`Verbs`,children:(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.verbs.map(e=>(0,K.jsx)(X,{name:e},e))})}),(0,K.jsx)(J,{label:`Wake triggers`,children:Y(e.wakeTriggers)}),(0,K.jsx)(J,{label:`Replicas per project`,children:e.maxReplicas}),(0,K.jsx)(J,{label:`Warm session`,children:e.resident?`yes`:`no`}),(0,K.jsx)(J,{label:`Society role`,children:e.societyScope?`yes, in no project`:`no`}),(0,K.jsx)(J,{label:`Reflects`,children:e.reflects?`yes`:`no`})]})]})}function fe({proposal:e,reallocation:t,current:n,compare:r}){let{role:i,changes:a,description:o}=t,s=e.provision?.changed,c=Array.isArray(s)?s.filter(e=>typeof e==`string`):null;return r&&n!=null?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Q,{next:re(n,a),current:n,compare:!0}),(0,K.jsx)(q,{children:(0,K.jsx)(J,{label:`Why`,children:o})})]}):(0,K.jsxs)(q,{children:[(0,K.jsx)(J,{label:`Role`,children:i}),r&&n===null?(0,K.jsx)(J,{label:`Role now`,children:`none by this name; approving it will fail`}):null,c===null?(0,K.jsxs)(K.Fragment,{children:[a.maxReplicas===void 0?null:(0,K.jsx)(J,{label:`Replicas per project`,children:a.maxReplicas}),a.backlogThreshold===void 0?null:(0,K.jsx)(J,{label:`Backlog per member`,children:a.backlogThreshold}),a.wakeTriggers===void 0?null:(0,K.jsx)(J,{label:`Wake triggers`,children:Y(a.wakeTriggers)}),a.verbs===void 0?null:(0,K.jsx)(J,{label:`Verbs`,children:(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:a.verbs.map(e=>(0,K.jsx)(X,{name:e},e))})})]}):(0,K.jsx)(J,{label:`Changed`,children:c.map(e=>(0,K.jsx)(`span`,{className:`block`,children:e},e))}),(0,K.jsx)(J,{label:`Why`,children:o})]})}function pe({proposal:e,slug:t,reason:n,members:r}){let i=ne(),a=ie(t),o=i.data?.find(e=>e.slug===t),s=e.status===`proposed`,c=s?(r??[]).filter(e=>e.status===`active`&&e.memberships.includes(t)).map(e=>e.name):e.provision?.members??[],l=(a.data??[]).filter(se).length;return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Project`,children:[(0,K.jsx)(_,{to:`/p/$slug`,params:{slug:t},className:`hover:text-fg-primary`,children:o?.name??t}),o?.name===void 0||o.name===t?null:` · ${t}`]}),(0,K.jsx)(J,{label:s?`Members who leave`:`Members who left`,children:Array.isArray(c)?Y(c.filter(e=>typeof e==`string`)):`none`}),s?(0,K.jsx)(J,{label:`Tasks in play`,children:a.data===void 0?`reading…`:l===0?`none`:`${l}: approval is refused until they are done, abandoned, or filed elsewhere`}):null,(0,K.jsx)(J,{label:`Reason`,children:n}),(0,K.jsx)(J,{label:`After`,children:`Its open threads close and nothing more is posted, filed, or joined there; its channels, tasks, repository, and history stay readable.`})]})}function me({proposal:e,name:t}){let r=e.skillFiles,i=n(e.id,r!==void 0);if(r===void 0)return(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-secondary`,children:e.status===`proposed`?`The board takes skills/${t}/ from ${e.proposedBy}'s home when the turn that proposed it ends.`:`The board took no files for it.`});if(i.data===void 0)return(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:i.isError?`Could not read its files.`:`Loading…`});let a=i.data.find(e=>e.path===`SKILL.md`),o=i.data.filter(e=>e.path!==`SKILL.md`);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(q,{children:(0,K.jsxs)(J,{label:`Taken from`,children:[e.proposedBy,`'s home at`,` `,(0,K.jsx)(`span`,{className:`font-mono`,children:r.commit.slice(0,7)})]})}),a===void 0||a.text===null?null:(0,K.jsx)(Z,{children:(0,K.jsx)(R,{text:O(a.text)})}),o.length===0?null:(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(U,{files:o})})]})}function he({proposal:e,roles:t,members:n}){let r=e.status===`proposed`,{charter:i}=e;switch(e.kind){case`member`:{let e=ee.safeParse(i);if(!e.success)break;let t=e.data;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(q,{children:[(0,K.jsx)(J,{label:`Citizen`,children:(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(oe,{cli:t.cli,size:13}),t.name]})}),(0,K.jsx)(J,{label:`Role`,children:t.role}),(0,K.jsxs)(J,{label:`CLI and model`,children:[t.cli,` · `,t.model??`cli default`]}),(0,K.jsx)(J,{label:`Projects`,children:Y(t.memberships)}),(0,K.jsx)(J,{label:`Also follows`,children:Y(t.subscriptions)}),t.homeRunner===void 0?null:(0,K.jsx)(J,{label:`Runs on`,children:t.homeRunner})]}),t.seedInstructions===void 0?null:(0,K.jsxs)(Z,{children:[(0,K.jsx)(`p`,{className:`text-caps`,children:`Seed instructions`}),(0,K.jsx)(`div`,{className:`mt-1.5`,children:(0,K.jsx)(R,{text:t.seedInstructions})})]})]})}case`role`:{let n=M(e);if(n===null)break;return(0,K.jsx)(Q,{next:n,current:t?.find(e=>e.name===n.name),compare:r})}case`skill`:{let t=te.safeParse(i);if(!t.success)break;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(q,{children:[(0,K.jsx)(J,{label:`Skill`,children:t.data.name}),(0,K.jsx)(J,{label:`Summary`,children:t.data.summary})]}),t.data.body===void 0?(0,K.jsx)(me,{proposal:e,name:t.data.name}):(0,K.jsx)(Z,{children:(0,K.jsx)(R,{text:O(t.data.body)})})]})}case`channel`:{let e=x.safeParse(i);if(!e.success)break;return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Channel`,children:[`#`,o(e.data.project,e.data.name)]}),(0,K.jsx)(J,{label:`Purpose`,children:e.data.purpose})]})}case`retirement`:{let e=S.safeParse(i);if(!e.success)break;let t=n?.find(t=>t.name===e.data.agent);return(0,K.jsxs)(q,{children:[(0,K.jsxs)(J,{label:`Citizen`,children:[(0,K.jsx)(F,{name:e.data.agent,members:n}),t===void 0?null:` · ${t.role}`]}),(0,K.jsx)(J,{label:`Holds now`,children:t===void 0?`unknown`:t.claimsHeld===1?`1 stage`:`${t.claimsHeld} stages`}),(0,K.jsx)(J,{label:`Reason`,children:e.data.reason})]})}case`archive`:{let t=b.safeParse(i);if(!t.success)break;return(0,K.jsx)(pe,{proposal:e,slug:t.data.project,reason:t.data.reason,members:n})}case`reallocation`:{let n=C.safeParse(i);if(!n.success){let e=w.safeParse(i);if(!e.success)break;return(0,K.jsx)(q,{children:(0,K.jsx)(J,{label:`Reallocation`,children:e.data.description})})}return(0,K.jsx)(fe,{proposal:e,reallocation:n.data,current:t===void 0?void 0:t.find(e=>e.name===n.data.role)??null,compare:r})}}return(0,K.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-lg bg-surface-2/40 p-3 font-mono text-[11px] text-fg-tertiary`,children:JSON.stringify(i,null,2)})}var ge=u({agent:c().optional(),channel:c().optional(),role:c().optional(),skill:c().optional(),replaced:a().optional(),releasedTasks:g(c()).optional(),project:c().optional()});function $({proposal:e}){let t=ge.safeParse(e.provision??{});if(e.provision===void 0||!t.success)return null;let n=t.data,r=`text-fg-primary underline decoration-fg-muted underline-offset-2`;if(e.kind===`member`&&n.agent!==void 0)return(0,K.jsxs)(`p`,{className:`mt-1`,children:[`Created`,` `,(0,K.jsx)(_,{to:`/citizen/$name`,params:{name:n.agent},className:r,children:n.agent}),`.`]});if(e.kind===`channel`&&n.channel!==void 0)return(0,K.jsxs)(`p`,{className:`mt-1`,children:[`Created`,` `,(0,K.jsxs)(_,{to:`/c/$`,params:{_splat:n.channel},className:r,children:[`#`,n.channel]}),`.`]});if(e.kind===`retirement`&&n.agent!==void 0){let e=n.releasedTasks?.length??0;return(0,K.jsxs)(`p`,{className:`mt-1`,children:[`Retired `,n.agent,`; `,e===1?`1 stage went`:`${e} stages went`,` back to open.`]})}return e.kind===`archive`&&n.project!==void 0?(0,K.jsxs)(`p`,{className:`mt-1`,children:[`Archived`,` `,(0,K.jsx)(_,{to:`/p/$slug`,params:{slug:n.project},className:r,children:n.project}),`; its members left and its threads closed.`]}):n.role===void 0?n.skill===void 0?null:(0,K.jsxs)(`p`,{className:`mt-1`,children:[n.replaced===!0?`Replaced`:`Published`,` the society's skill `,n.skill,`.`]}):(0,K.jsxs)(`p`,{className:`mt-1`,children:[n.replaced===!0?`Rewrote`:`Added`,` the role `,n.role,`.`]})}function _e(){let{proposalId:e}=N({from:`/proposal/$proposalId`}),n=f(e),i=v(),a=r(),o=d(),s=m(),c=y(3e4),u=I(),p=t(s.data?.some(t=>t.id===e)===!0?e:null);if(n.data===void 0)return(0,K.jsx)(V,{children:n.error instanceof l&&n.error.status===404?`There is no proposal ${e}.`:`Reading the proposal…`});let h=n.data,g=h.status===`proposed`,b=i.data?.find(e=>e.name===h.proposedBy)?.role,x=s.data?.find(e=>e.id===h.id),S=h.status===`rejected`?`Rejected`:`Approved`,C=k(h,{members:i.data??[],roles:a.data??[],skills:o.data??[]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(H,{leading:(0,K.jsx)(L,{fallback:(0,K.jsx)(_,{to:`/proposals`,"aria-label":`Back to the proposals`,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`←`})}),title:A(h),subtitle:`${h.kind} proposal by ${u(h.proposedBy)} ${T(h.createdAt,c)}${g?` · for ${j(h,b)} to decide`:``}`,trailing:(0,K.jsx)(W,{status:h.status})}),(0,K.jsxs)(le,{stick:!1,follow:!1,ids:p.data?.messages.map(e=>e.id),className:`px-4 py-4`,children:[g?(0,K.jsxs)(`p`,{className:`rounded-lg bg-sky-400/10 px-3 py-2 text-xs leading-relaxed text-sky-200`,children:[`If approved: `,C]}):(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-xs leading-relaxed text-fg-secondary`,children:[(0,K.jsxs)(`p`,{children:[S,` by `,u(h.decidedBy??`someone`),h.decidedAt===void 0?``:` ${T(h.decidedAt,c)}`,h.reason===void 0?`.`:`: ${h.reason}`]}),(0,K.jsx)($,{proposal:h})]}),h.body.trim()===``||x!==void 0?null:(0,K.jsxs)(`section`,{className:`mt-5`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:`Why`}),(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(R,{text:h.body})})]}),(0,K.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:g?`What it would make`:h.status===`provisioned`?`What it made`:`What it proposed`}),(0,K.jsx)(he,{proposal:h,roles:a.data,members:i.data})]}),(0,K.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:`Thread`}),x===void 0?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:s.data===void 0?`Reading the thread…`:`This proposal is older than proposal threads; its thread opens when it is decided.`}):(0,K.jsx)(ue,{thread:x,now:c,empty:`Nothing said yet. The pitch and the decision are posted here.`})]})]},h.id),x?.state===`open`?(0,K.jsx)(P,{target:{threadId:h.id},placeholder:`Write in the proposal's thread`}):null,D(h)?(0,K.jsx)(de,{proposal:h,consequence:C}):null]})}export{_e as ProposalView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Gn as e,Jn as t,Wn as n,Yt as r,b as i,t as a,w as o}from"./format-CvfmDNoY.js";import{i as s,o as c,t as l}from"./governance-Bba0OHvJ.js";import{s as u}from"./index-DD3J11PT.js";import{n as d,t as f}from"./Pane-DTmByqgA.js";var p=t(e(),1),m=n(),h=8,g={proposed:`bg-amber-500/15 text-amber-300`,approved:`bg-emerald-500/15 text-emerald-300`,provisioned:`bg-emerald-500/15 text-emerald-300`,rejected:`bg-red-500/15 text-red-300`,retired:`bg-surface-2 text-fg-muted`};function _({status:e}){return(0,m.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${g[e]}`,children:e===`provisioned`?`approved`:e})}function v({proposal:e,now:t}){let n=u(),i=e.decidedBy===void 0||e.decidedAt===void 0?``:` · ${e.status===`rejected`?`rejected`:`approved`} by ${n(e.decidedBy)} ${a(e.decidedAt,t)}`;return(0,m.jsx)(`li`,{children:(0,m.jsxs)(r,{to:`/proposal/$proposalId`,params:{proposalId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:c(e)}),(0,m.jsx)(_,{status:e.status})]}),(0,m.jsxs)(`p`,{className:`mt-1 truncate text-meta`,children:[`proposed by `,n(e.proposedBy),` `,a(e.createdAt,t),i]})]})})}function y(){let e=o(),t=i(3e4),[n,r]=(0,p.useState)(!1),a=s(e.data??[]),c=a.find(e=>e.group===`yours`)?.proposals.length??0;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f,{title:`Proposals`,subtitle:`${c===0?`nothing`:c} waiting on you · ${e.data?.length??0} in all`}),(0,m.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:e.data===void 0?(0,m.jsx)(d,{children:`Reading the proposals…`}):a.length===0?(0,m.jsx)(d,{children:`No proposals yet. Citizens propose roles, members, channels, and skills.`}):a.map(e=>{let i=e.group===`decided`&&!n?e.proposals.slice(0,h):e.proposals;return(0,m.jsxs)(`section`,{className:`mb-3`,children:[(0,m.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[l.find(t=>t.group===e.group)?.label,` ·`,` `,e.proposals.length]}),(0,m.jsx)(`ul`,{children:i.map(e=>(0,m.jsx)(v,{proposal:e,now:t},e.id))}),i.length<e.proposals.length?(0,m.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`px-3 pt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show all `,e.proposals.length]}):null]},e.group)})})]})}export{y as ProposalsView,_ as StatusChip};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,D as t,Gn as n,Jn as r,Un as i,Wn as a,b as o,d as s,k as c,t as l,x as u}from"./format-CvfmDNoY.js";import{n as d,t as f}from"./Button-BYJGqZ3Q.js";import{t as p}from"./CliIcon-DVX5iLhG.js";import{k as m}from"./index-DD3J11PT.js";import{n as h,r as g}from"./ThreadForms-DzoRDeBh.js";import{n as _,t as v}from"./Pane-DTmByqgA.js";import{n as y}from"./Quota-D8WDWp5H.js";var b=r(n(),1);function x(e){return e.toUpperCase().replaceAll(/[^A-Z0-9]/g,``)}function S(e,t){return t!==void 0&&e.version!==void 0&&e.version!==t}function C(e){let t=e.gitIdentityMissing??[];if(t.length===0)return null;let n=t.map(e=>`user.${e}`),r=t.includes(`name`)?`git refuses the commits citizens make themselves on it`:`the commits citizens make themselves on it carry an empty address or one git made up`;return{label:t.length===1?`no git ${n.join(``)}`:`no git identity`,detail:`Its account has no git ${n.join(` or `)}, so ${r}. Set ${t.length===1?`it`:`them`} with git config --global there; the mark goes once the runner connects with ${t.length===1?`it`:`them`} set.`}}function w(e,t){return x(e)===x(t)}function T(e,t){let n=(e.split(`.`)[0]??``).toLowerCase().replaceAll(/[^a-z0-9-]+/g,`-`).replaceAll(/-+/g,`-`).replace(/^-+/,``).slice(0,32).replace(/-+$/,``)||`runner`;if(!t.includes(n))return n;for(let e=2;;e+=1){let r=`-${e}`,i=`${n.slice(0,32-r.length)}${r}`;if(!t.includes(i))return i}}var E=a();function D(e,t){return Number(e.status!==`connected`)-Number(t.status!==`connected`)||e.name.localeCompare(t.name)}function O(e,t){return[e.length===0?`no CLI`:e.join(`, `),...t].join(` · `)}function k({enrollment:t,taken:n,followed:r,now:a}){let{api:o}=e(),s=i(),[c,u]=(0,b.useState)(null),p=c??T(t.hostname,n),m=()=>{s.invalidateQueries({queryKey:[`enrollments`]}),s.invalidateQueries({queryKey:[`runners`]})},_=d({mutationFn:()=>o.approveEnrollment(t.userCode,p.trim()),onSuccess:m}),v=d({mutationFn:()=>o.denyEnrollment(t.userCode),onSuccess:m}),y=_.isPending||v.isPending;return(0,E.jsxs)(`li`,{className:`rounded-xl border px-3 py-3 ${r?`border-amber-500/40 bg-amber-500/5`:`border-line`}`,children:[(0,E.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary`,children:t.hostname}),(0,E.jsx)(`code`,{className:`shrink-0 font-mono text-sm text-fg-primary`,children:t.userCode})]}),(0,E.jsxs)(`p`,{className:`mt-0.5 truncate text-meta`,children:[t.os,` · `,O(t.clis,t.capabilities),` · runner`,` `,t.version,` · asked `,l(t.requestedAt,a)]}),(0,E.jsxs)(`form`,{"aria-label":`Approve ${t.hostname}`,className:`mt-2.5 flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,E.jsx)(`input`,{value:p,maxLength:32,spellCheck:!1,"aria-label":`Runner name`,onChange:e=>u(e.target.value),className:`${h} min-w-0 flex-1 font-mono`}),(0,E.jsx)(f,{onClick:()=>v.mutate(),disabled:y,children:`Deny`}),(0,E.jsx)(f,{variant:`primary`,type:`submit`,disabled:y||p.trim()===``,children:_.isPending?`Approving…`:`Approve`})]}),(0,E.jsx)(`div`,{className:`mt-1.5`,children:(0,E.jsx)(g,{error:_.error??v.error})})]})}function A(){let{code:e}=m({from:`/runners`}),n=s(),r=t(),i=u(),a=c().data,d=o(3e4),f=n.data??[],h=(r.data??[]).map(e=>e.name),g=(r.data??[]).toSorted(D),b=g.filter(e=>e.status===`connected`).length,x=g.length-b,T=g.filter(e=>S(e,a)).length,O=g.filter(e=>C(e)!==null).length,A=e===void 0?void 0:f.find(t=>w(t.userCode,e)),j=A===void 0?f:[A,...f.filter(e=>e!==A)],M=e=>(i.data??[]).filter(t=>t.runner===e.name&&t.archived===void 0).map(e=>e.slug);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v,{title:`Runners`,subtitle:[`${b} connected`,...x===0?[]:[`${x} away`],...f.length===0?[]:[`${f.length} waiting for approval`],...a===void 0?[]:[`server v${a}`],...T===0?[]:[`${T} on another version`],...O===0?[]:[`${O} without a git identity`]].join(` · `)}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e!==void 0&&n.data!==void 0&&A===void 0?(0,E.jsxs)(`output`,{className:`block px-2 pb-2 text-meta`,children:[`No runner waits with the code `,e,`. It may have been approved, denied, or expired; a runner whose code expired asks again with a new one.`]}):null,j.length===0?null:(0,E.jsx)(`ul`,{"aria-label":`Waiting for approval`,className:`space-y-2 px-2 pb-3`,children:j.map(e=>(0,E.jsx)(k,{enrollment:e,taken:h,followed:e===A,now:d},e.userCode))}),r.data===void 0?(0,E.jsx)(_,{children:`Reading the runners…`}):g.length===0?(0,E.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No runners yet.`}):null,(0,E.jsx)(`ul`,{"aria-label":`Registered`,className:`grid grid-cols-[auto_auto_auto_auto_minmax(0,max-content)_minmax(3rem,1fr)_auto] gap-x-3`,children:g.map(e=>{let t=e.clis.length===0?`no CLI`:e.clis.join(`, `),n=M(e),r=n.length===0?`no projects`:n.join(`, `),i=C(e),o=e.status===`connected`?{label:`connected`,detail:`connected`,tone:`text-fg-muted`}:{label:`away`,detail:`away${e.lastSeen===void 0?``:`, last seen ${l(e.lastSeen,d)}`}`,tone:`text-amber-300`};return(0,E.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm`,children:[(0,E.jsxs)(`span`,{className:`flex items-center gap-1`,title:t,children:[e.clis.map(e=>(0,E.jsx)(p,{cli:e,size:13},e)),(0,E.jsx)(`span`,{className:`sr-only`,children:t})]}),(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`span`,{className:`block text-fg-primary`,children:e.name}),i===null?null:(0,E.jsx)(`span`,{className:`block text-xs text-amber-300`,title:i.detail,children:i.label})]}),(0,E.jsx)(`span`,{className:`text-fg-secondary`,children:e.os}),S(e,a)?(0,E.jsxs)(`span`,{className:`text-xs text-amber-300`,title:`the server runs v${a}`,children:[`v`,e.version,(0,E.jsxs)(`span`,{className:`sr-only`,children:[`, not the server's v`,a]})]}):(0,E.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version===void 0?``:`v${e.version}`}),(0,E.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:e.capabilities.join(`, `),children:e.capabilities.join(`, `)}),(0,E.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,E.jsx)(`span`,{className:`text-right text-xs ${o.tone}`,title:o.detail,children:o.label})]},e.name)})}),(0,E.jsx)(y,{runners:g,now:d})]})]})}export{A as RunnersView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,Gn as t,Jn as n,M as r,N as i,Un as a,Wn as o,Yt as s}from"./format-CvfmDNoY.js";import{n as c,t as l}from"./Button-BYJGqZ3Q.js";import{i as u}from"./compose-BUhbVoI-.js";import{l as d}from"./governance-Bba0OHvJ.js";import{A as f}from"./index-DD3J11PT.js";import{t as p}from"./BackLink-DKMw_rHu.js";import{t as m}from"./Markdown--whKJBYV.js";import{n as h,r as g}from"./ThreadForms-DzoRDeBh.js";import{n as _,t as v}from"./Pane-DTmByqgA.js";import{n as y}from"./Overview-DFiHDFnA.js";import{t as b}from"./SkillFileList-DhdEcFQA.js";var x=n(t(),1),S=o(),C=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function w(){let{name:e}=f({from:`/skills/$name`}),t=i(),n=r(e),[a,o]=(0,x.useState)(!1),c=t.data?.find(t=>t.name===e);if(c===void 0)return(0,S.jsx)(_,{children:t.data===void 0?`Reading…`:`The society has no skill ${e}.`});let u=n.data?.find(e=>e.path===`SKILL.md`),h=n.data?.filter(e=>e.path!==`SKILL.md`)??[];return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(v,{leading:(0,S.jsx)(p,{fallback:(0,S.jsx)(s,{to:`/society`,"aria-label":`Back to the society`,className:C,children:`←`})}),title:(0,S.jsx)(`span`,{title:c.name,children:c.name}),subtitle:c.summary===``?void 0:(0,S.jsx)(`span`,{title:c.summary,children:c.summary}),trailing:a?null:(0,S.jsx)(l,{onClick:()=>o(!0),children:`Remove…`})}),a?(0,S.jsx)(T,{name:c.name,onCancel:()=>o(!1)}):null,(0,S.jsx)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:n.data===void 0?(0,S.jsx)(`p`,{className:`text-meta`,children:n.isError?`Could not read its files.`:`Reading…`}):(0,S.jsxs)(S.Fragment,{children:[u===void 0||u.text===null?null:(0,S.jsx)(m,{text:d(u.text)}),h.length===0?null:(0,S.jsx)(y,{title:`Files`,children:(0,S.jsx)(b,{files:h})})]})})]})}function T({name:t,onCancel:n}){let{api:r}=e(),i=a(),o=u(),[s,d]=(0,x.useState)(``),f=(0,x.useRef)(null);(0,x.useEffect)(()=>f.current?.focus(),[]);let p=c({mutationFn:()=>r.removeSkill({name:t,reason:s.trim()}),onSuccess:async()=>{await o({to:`/society`}),await i.invalidateQueries({queryKey:[`skills`]})}});return(0,S.jsxs)(`form`,{"aria-label":`Remove ${t}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),p.mutate()},children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`input`,{ref:f,value:s,"aria-label":`Reason`,placeholder:`Why it is wrong, superseded, or unused`,onChange:e=>d(e.target.value),className:`${h} min-w-0 flex-1`}),(0,S.jsx)(l,{onClick:n,children:`Cancel`}),(0,S.jsx)(l,{variant:`primary`,type:`submit`,disabled:p.isPending||s.trim()===``,children:p.isPending?`Removing…`:`Remove skill`})]}),(0,S.jsxs)(`p`,{className:`text-meta`,children:[`No citizen's skills index lists `,t,` from its next turn, and a notice in #general says so with your reason, waking nobody. Its proposer keeps its own copy, and the server keeps the text aside.`]}),(0,S.jsx)(g,{error:p.error})]})}export{w as SkillView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Bt as e,E as t,Gn as n,Jn as r,N as i,P as a,Wn as o,Yt as s,_ as c,_t as l,b as u,c as d,h as f,x as p}from"./format-CvfmDNoY.js";import{t as m}from"./Button-BYJGqZ3Q.js";import{n as h,r as g}from"./ChannelForms-CkYupEL2.js";import{n as _,t as v}from"./Pane-DTmByqgA.js";import{n as y,r as b,t as x}from"./Overview-DFiHDFnA.js";var S=r(n(),1),C=o();function w(){let n=a(),r=c(),o=p(),s=t(),w=i(),E=f(l),D=d(),O=u(3e4),[k,A]=(0,S.useState)(!1);if(n.data===void 0||r.data===void 0)return(0,C.jsx)(_,{children:`Reading the society…`});let j=r.data.filter(e=>e.cli!==null),M=j.filter(e=>e.status===`active`),N=j.filter(e=>e.status===`retired`),P=(s.data??[]).filter(t=>t.name!==e);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(v,{title:n.data.name,subtitle:`${M.length} citizens · ${o.data?.length??0} projects · ${P.length} roles`}),k?(0,C.jsx)(g,{project:null,onDone:()=>A(!1)}):null,(0,C.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,C.jsxs)(y,{title:`Citizens`,children:[(0,C.jsx)(x,{members:M,scope:l}),N.length===0?null:(0,C.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Retired: `,N.map(e=>e.name).join(`, `)]})]}),(0,C.jsx)(y,{title:`Channels`,aside:k?null:(0,C.jsx)(m,{onClick:()=>A(!0),children:`New channel…`}),children:(0,C.jsx)(h,{channels:(D.data??[]).filter(e=>e.project===null),now:O})}),(0,C.jsx)(y,{title:`Roles`,children:(0,C.jsx)(`ul`,{className:`space-y-2.5`,children:P.map(e=>{let t=M.filter(t=>t.role===e.name).length;return(0,C.jsxs)(`li`,{children:[(0,C.jsxs)(`p`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,C.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,C.jsxs)(`span`,{className:`text-meta`,children:[t===1?`1 member`:`${t} members`,e.resident?` · warm session`:``,e.societyScope?` · society role`:``]})]}),(0,C.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:e.purpose})]},e.name)})})}),(0,C.jsx)(y,{title:`Knowledge`,children:(0,C.jsx)(b,{scope:l,topics:E.data,now:O})}),(0,C.jsx)(y,{title:`Skills`,children:w.data===void 0?(0,C.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):w.data.length===0?(0,C.jsx)(`p`,{className:`text-meta`,children:`None yet. A citizen's skill joins the society by proposal.`}):(0,C.jsx)(T,{skills:w.data})})]})]})}function T({skills:e}){return(0,C.jsx)(`ul`,{className:`-mx-2`,children:e.map(e=>(0,C.jsx)(`li`,{children:(0,C.jsxs)(s,{to:`/skills/$name`,params:{name:e.name},className:`block rounded-lg px-2 py-1.5 transition-colors hover:bg-surface-2/50`,children:[(0,C.jsx)(`span`,{className:`block text-sm text-fg-primary`,children:e.name}),e.summary===``?null:(0,C.jsx)(`span`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:e.summary})]})},e.name))})}export{w as SocietyView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Gn as e,Jn as t,Wn as n}from"./format-CvfmDNoY.js";var r=t(e(),1),i=80;function a(e){return e.scrollHeight-e.scrollTop-e.clientHeight}function o({stick:e=!0,follow:t=!0,ids:n=[]}={}){let o=(0,r.useRef)(null),c=(0,r.useRef)(e&&t),l=(0,r.useRef)(null),u=(0,r.useRef)(0),[d,f]=(0,r.useState)(!1),p=n.at(-1)??null,[m,h]=(0,r.useState)(null);(0,r.useLayoutEffect)(()=>{(!e||!t)&&(c.current=!1)},[e,t]),(0,r.useLayoutEffect)(()=>{let e=o.current;e!==null&&c.current&&(l.current===null?t&&(e.scrollTop=e.scrollHeight):l.current!==e.scrollHeight&&(l.current=e.scrollHeight,e.scrollTo({top:e.scrollHeight,behavior:s()})))}),(0,r.useLayoutEffect)(()=>{let e=o.current;if(e===null)return;let t=l.current===null&&a(e)>=i;f(t),h(e=>t&&e!==null?e:p)},[p]);let g=()=>{let e=o.current;if(e===null)return;let t=a(e)<i;(t||e.scrollTop<u.current)&&(l.current=null),u.current=e.scrollTop,c.current=t||l.current!==null,f(!c.current),c.current&&h(p)},_=({focus:e=!1}={})=>{let t=o.current;if(t===null)return;c.current=!0,l.current=t.scrollHeight,f(!1),h(p);let n=s(),r=t.scrollHeight-2*t.clientHeight;n===`smooth`&&t.scrollTop<r&&(t.scrollTop=r),u.current=t.scrollTop,t.scrollTo({top:t.scrollHeight,behavior:n});let i=[...t.querySelectorAll(`article`)].at(-1)??t.lastElementChild;e&&i instanceof HTMLElement&&(i.hasAttribute(`tabindex`)||i.setAttribute(`tabindex`,`-1`),i.focus({preventScroll:!0}))},v=m===null?0:n.filter(e=>e>m).length;return{ref:o,onScroll:g,away:d,unseen:d?v:0,jump:_}}function s(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`}var c=n();function l({stick:e,follow:t,ids:n,className:i,children:a}){let{ref:s,onScroll:l,away:u,unseen:d,jump:f}=o({stick:e,follow:t,ids:n}),p=(0,r.useRef)(null);return(0,c.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,c.jsx)(`div`,{ref:s,onScroll:l,className:`flex-1 overflow-y-auto ${i}`,children:a}),u?(0,c.jsxs)(`button`,{ref:p,type:`button`,onClick:()=>f({focus:document.activeElement===p.current}),"aria-label":d>0?`Jump to latest, ${d} new`:`Jump to latest`,title:`Jump to latest`,className:`absolute bottom-3 left-1/2 grid size-8 -translate-x-1/2 place-items-center rounded-full bg-surface-2 text-fg-secondary shadow-[inset_0_0_0_1px_rgba(255,255,255,0.08),0_8px_20px_-6px_rgba(0,0,0,0.9)] transition-colors hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,c.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`size-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,c.jsx)(`path`,{d:`M8 3v10M3.5 8.5 8 13l4.5-4.5`})}),d>0?(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 -right-1.5 min-w-4 rounded-full bg-fg-primary px-1 text-center text-[10px] leading-4 font-medium text-surface-0 tabular-nums`,children:d>99?`99+`:d}):null]}):null]})}export{l as t};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{F as e,Gn as t,Jn as n,K as r,R as i,Wn as a,Yt as o,b as s,it as c,t as l,x as u}from"./format-CvfmDNoY.js";import{A as d,k as f}from"./index-DD3J11PT.js";import{t as p}from"./BackLink-DKMw_rHu.js";import{c as m,d as h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,t as C}from"./Markdown--whKJBYV.js";import{n as w,t as T}from"./Pane-DTmByqgA.js";var E=n(t(),1),D=a(),O=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,k=`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs text-fg-tertiary transition-colors hover:bg-surface-2/70 hover:text-fg-primary`,A=1e3,j=2e4;function M({taskId:e,path:t}){let n=t===``?[]:t.split(`/`),r=`text-fg-tertiary hover:text-fg-primary`;return(0,D.jsxs)(`nav`,{"aria-label":`Path`,className:`flex flex-wrap items-center gap-x-1 text-meta`,children:[n.length===0?(0,D.jsx)(`span`,{children:`Files`}):(0,D.jsx)(y,{taskId:e,path:``,className:r,children:`Files`}),n.map((t,i)=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i===n.length-1?(0,D.jsx)(`span`,{className:`text-fg-secondary`,children:t}):(0,D.jsx)(y,{taskId:e,path:n.slice(0,i+1).join(`/`),className:r,children:t})]},n.slice(0,i+1).join(`/`)))]})}function N({taskId:e,file:t}){let n=t.entries.toSorted((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`dir`?-1:1);return(0,D.jsx)(`ul`,{className:`mt-3 space-y-1`,children:n.map(n=>(0,D.jsxs)(`li`,{className:`flex items-baseline gap-2`,children:[(0,D.jsx)(y,{taskId:e,path:t.path===``?n.name:`${t.path}/${n.name}`,className:`text-sm text-fg-secondary hover:text-fg-primary`,children:n.kind===`dir`?`${n.name}/`:n.name}),n.size===null?null:(0,D.jsx)(`span`,{className:`text-meta`,children:x(n.size)})]},n.name))})}function P({rows:e}){let[t,...n]=e;if(t===void 0)return(0,D.jsx)(`p`,{className:`mt-3 text-meta`,children:`The table is empty.`});let r=n.slice(0,A),i=`border border-line px-2 py-1 text-left align-top whitespace-pre-wrap`;return(0,D.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,children:[(0,D.jsxs)(`table`,{className:`text-xs text-fg-secondary`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsx)(`tr`,{children:t.map((e,t)=>(0,D.jsx)(`th`,{scope:`col`,className:`${i} font-medium text-fg-primary`,children:e},t))})}),(0,D.jsx)(`tbody`,{children:r.map((e,t)=>(0,D.jsx)(`tr`,{children:e.map((e,t)=>(0,D.jsx)(`td`,{className:i,children:e},t))},t))})]}),n.length>r.length?(0,D.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,A,` of `,n.length,` rows; download the file for the rest.`]}):null]})}function F({text:e,line:t}){let n=e.endsWith(`
|
|
2
|
-
`)?e.slice(0,-1).split(`
|
|
3
|
-
`):e.split(`
|
|
4
|
-
`),r=`mt-3 overflow-x-auto rounded-lg bg-surface-0/80 p-3 font-mono text-[12px] leading-relaxed text-fg-secondary shadow-[inset_0_0_0_1px_rgba(255,255,255,0.05)]`;return n.length>j?(0,D.jsx)(`pre`,{className:r,children:e}):(0,D.jsx)(`pre`,{className:r,children:n.map((e,n)=>(0,D.jsxs)(`span`,{className:`flex ${n+1===t?`line-target`:``}`,children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`w-10 shrink-0 pr-3 text-right text-fg-muted select-none`,children:n+1}),(0,D.jsx)(`span`,{className:`whitespace-pre`,children:e===``?` `:e})]},n))})}function I({taskId:e,file:t,url:n,line:r}){let i=(0,E.useMemo)(()=>t.content===null?null:v(t.path,g(t.content)),[t.path,t.content]),a=t.path.split(`/`).at(-1)??t.path;return i===null?(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[a,` is `,x(t.size),`, more than the `,x(c),` the board shows. Its runner still has it on the task's branch.`]}):i.kind===`markdown`?(0,D.jsx)(`div`,{className:`mt-3`,children:(0,D.jsx)(C,{text:i.text,base:{taskId:e,dir:h(t.path)},line:r})}):i.kind===`image`?n===null?null:(0,D.jsx)(`img`,{src:n,alt:a,className:`mt-3 max-w-full rounded-lg`}):i.kind===`table`?(0,D.jsx)(P,{rows:i.rows}):i.kind===`text`?(0,D.jsx)(F,{text:i.text,line:r}):(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[a,` is not text (`,x(t.size),`). Download it to open it.`]})}function L(){let{taskId:t,_splat:n}=d({from:`/task/$taskId/files/$`}),a=f({from:`/task/$taskId/files/$`}),c=b(_(n??``)??``),h=c.path,g=a.line??c.line,v=e(t),y=u(),x=i(t,h),C=s(3e4),A=x.data,j=A?.kind===`file`?A.content:null,P=S(j,m(h)??`application/octet-stream`),F=h===``?`Files`:h.split(`/`).at(-1)??h,L=v.data?.title??t,R=(0,E.useRef)(null);(0,E.useEffect)(()=>{g!==void 0&&A!==void 0&&R.current?.querySelector(`.line-target`)?.scrollIntoView({block:`center`})},[g,A]);let z;if(A!==void 0)z=A.kind===`dir`?(0,D.jsx)(N,{taskId:t,file:A}):(0,D.jsx)(I,{taskId:t,file:A,url:P,line:g});else if(x.error instanceof r&&x.error.status===404)z=(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[h===``?`Nothing`:h,` is not on task/`,t,` yet. What a turn writes reaches the branch when the turn ends.`]});else if(x.error instanceof r&&x.error.status===503){let e=y.data?.find(e=>e.slug===v.data?.project);z=(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[e?.runner===void 0?`The runner`:`${e.runner}, the runner`,` `,e?.name??`the project`,` lives on, is not connected, so the task's files cannot be read now.`]})}else z=x.error===null?(0,D.jsxs)(w,{children:[`Reading `,F,` from the task's runner…`]}):(0,D.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:x.error.message});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(T,{leading:(0,D.jsx)(p,{fallback:(0,D.jsx)(o,{to:`/task/$taskId`,params:{taskId:t},"aria-label":`Back to the task ${L}`,className:O,children:`←`})}),title:F,subtitle:A===void 0?L:`${L}${g===void 0?``:` · line ${g}`} · committed by ${A.commit.author} ${l(A.commit.at,C)} · ${A.commit.id.slice(0,7)}`,trailing:P===null?null:(0,D.jsx)(`a`,{href:P,download:F,className:k,children:`Download`})}),(0,D.jsxs)(`div`,{ref:R,className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,D.jsx)(M,{taskId:t,path:h}),z]})]})}export{L as TaskFileView};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{A as e,B as t,F as n,Gn as r,I as i,Jn as a,K as o,L as s,Un as c,V as l,Wn as u,Yt as d,_ as f,b as p,t as m,x as h}from"./format-CvfmDNoY.js";import{n as g,t as _}from"./Button-BYJGqZ3Q.js";import{a as v,c as y,l as b,n as x,o as S,r as C,s as w,t as T}from"./tasks-CTaxXtGL.js";import{u as E}from"./governance-Bba0OHvJ.js";import{A as D,_ as O,i as k,o as A,s as j}from"./index-DD3J11PT.js";import{t as M}from"./BackLink-DKMw_rHu.js";import{a as N,f as P,n as F,s as I,t as L,u as R}from"./Markdown--whKJBYV.js";import{n as z,r as B}from"./ThreadForms-DzoRDeBh.js";import{n as V,t as H}from"./Pane-DTmByqgA.js";import{t as ee}from"./StickyList-C4fC_KJv.js";import{t as U}from"./SubjectThread-BEXt-tub.js";var W=a(r(),1),G=u(),K={hunk:`text-fg-muted`,note:`text-fg-muted`,added:`bg-emerald-400/10 text-emerald-300`,removed:`bg-red-400/10 text-red-300`,context:`text-fg-tertiary`};function q({last:e,now:t}){return e===void 0?null:(0,G.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-meta`,children:[e.author,` `,m(e.at,t)]})}function J({taskId:e,path:t,patch:n}){let r=(0,W.useMemo)(()=>P(n),[n]);return(0,G.jsx)(`div`,{className:`mt-1 max-h-96 overflow-auto rounded-md bg-surface-0/60 py-1.5 font-mono text-[11px] leading-relaxed`,children:r.map((n,r)=>(0,G.jsxs)(`div`,{className:`flex ${K[n.kind]}`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`w-10 shrink-0 pr-2 text-right text-fg-muted select-none`,children:n.line===void 0?null:(0,G.jsx)(d,{to:`/task/$taskId/files/$`,params:{taskId:e,_splat:t},search:{line:n.line},tabIndex:-1,title:`Open ${t} at line ${n.line}`,className:`hover:text-fg-primary`,children:n.line})}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 pr-2 break-words whitespace-pre-wrap`,children:n.text===``?` `:n.text})]},r))})}function Y({taskId:e,change:t}){let n=s(e,t.path),r;if(n.data!==void 0){let{patch:i,truncated:a}=n.data;r=i===null?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown here.`}):i===``?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`No lines changed.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(J,{taskId:e,path:t.path,patch:i}),a?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}else r=n.error instanceof o&&n.error.status===503?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`The task's runner is not connected, so the change cannot be read now.`}):n.error===null?(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:`Reading the change…`}):(0,G.jsx)(`p`,{className:`mt-1 text-meta`,children:n.error.message});return(0,G.jsxs)(`div`,{className:`mb-2 ml-[18px]`,children:[t.status===`deleted`?null:(0,G.jsx)(F,{taskId:e,path:t.path,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Open the whole file`}),r]})}function X({taskId:e,nodes:t,nested:n,openings:r,now:i}){let{isOpen:a,toggle:o,shown:s,toggleFile:c}=r;return(0,G.jsx)(`ul`,{className:n?`ml-[5px] border-l border-line-strong pl-2`:`mt-2`,children:t.map(t=>{if(t.kind===`dir`){let n=a(t);return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>o(t),className:`flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block w-2.5 shrink-0 text-[10px] text-fg-muted transition-transform ${n?`rotate-90`:``}`,children:`▸`}),(0,G.jsxs)(`span`,{className:`min-w-0 truncate text-fg-primary`,children:[t.name,`/`]}),(0,G.jsx)(`span`,{className:`shrink-0 text-meta`,children:t.files===1?`1 file`:`${t.files} files`}),(0,G.jsx)(q,{last:t.lastChange,now:i})]}),n?(0,G.jsx)(X,{taskId:e,nodes:t.children,nested:!0,openings:r,now:i}):null]},`dir:${t.path}`)}let{change:n}=t,l=s.has(n.path),u=n.status===`deleted`?`text-fg-tertiary line-through`:l?`text-fg-primary`:`text-fg-secondary group-hover:text-fg-primary`;return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":l,title:n.path,onClick:()=>c(n.path),className:`group flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40 ${l?`bg-surface-2/30`:``}`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`w-2.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate ${u}`,children:t.name}),(0,G.jsx)(`span`,{className:`shrink-0 text-meta`,children:N(n)}),(0,G.jsx)(q,{last:n.lastChange,now:i})]}),l?(0,G.jsx)(Y,{taskId:e,change:n}):null]},n.path)})})}function Z({taskId:e,changes:t,now:n}){let r=(0,W.useMemo)(()=>I(t),[t]),i=(0,W.useMemo)(()=>R(r),[r]),[a,o]=(0,W.useState)(new Map),s=e=>a.get(e.path)??i.has(e.path),c=e=>{o(t=>new Map(t).set(e.path,!(t.get(e.path)??i.has(e.path))))},[l,u]=(0,W.useState)(new Set);return(0,G.jsx)(X,{taskId:e,nodes:r.children,nested:!1,openings:{isOpen:s,toggle:c,shown:l,toggleFile:e=>{u(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})}},now:n})}function Q({task:e,now:t}){let n=i(e.id),r=h(),a=`task/${e.id}`,s;if(n.data!==void 0){let{files:r,total:i,head:o}=n.data;s=r.length===0?(0,G.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing changed on `,a,` yet. What a turn writes reaches the branch when the turn ends.`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`mt-2 text-meta`,children:[i===1?`1 file`:`${i} files`,` changed · newest commit by `,o.author,` `,m(o.at,t)]}),(0,G.jsx)(Z,{taskId:e.id,changes:r,now:t}),i>r.length?(0,G.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,r.length,` of `,i,`; browse the branch for the rest.`]}):null]})}else if(n.error instanceof o&&n.error.status===404)s=(0,G.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing on `,a,` yet. What a turn writes reaches the branch when the turn ends.`]});else if(n.error instanceof o&&n.error.status===503){let t=r.data?.find(t=>t.slug===e.project);s=(0,G.jsxs)(`p`,{className:`mt-2 text-meta`,children:[t?.runner===void 0?`The runner`:`${t.runner}, the runner`,` `,t?.name??e.project,` lives on, is not connected, so the task's files cannot be listed now.`]})}else s=n.error===null?(0,G.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the task's branch…`}):(0,G.jsx)(`p`,{className:`mt-2 text-meta`,children:n.error.message});return(0,G.jsxs)(`section`,{"aria-label":`Files`,className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Files`}),(0,G.jsx)(F,{taskId:e.id,path:``,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Browse the branch`})]}),s]})}function $({stage:e,index:t,task:n,members:r,now:i}){let a=e.completedBy!==void 0,o=S(n,e),s=t===n.stages.length-1,c=o&&n.status===`claimed`?n.claimedBy:void 0,l=e.holders.filter(t=>t!==c&&t!==e.completedBy),u=n.returned?.from===e.id?n.returned:void 0;return(0,G.jsxs)(`li`,{className:`relative flex gap-3 pb-4`,children:[s?null:(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-6 bottom-0 left-2.5 w-px bg-line`}),(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`relative z-10 grid size-5 shrink-0 place-items-center rounded-full text-[10px] ${a?`bg-emerald-400/20 text-emerald-300`:o?`bg-fg-primary text-surface-0`:`bg-surface-2 text-fg-muted`}`,children:a?`✓`:t+1}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`text-sm ${o?`font-medium text-fg-primary`:`text-fg-secondary`}`,children:[e.name,e.gate?(0,G.jsx)(`span`,{className:`ml-2 rounded-md bg-sky-400/10 px-1.5 py-px text-[11px] text-sky-300`,children:`gate`}):null]}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[`for `,C(e),c===void 0?null:(0,G.jsxs)(G.Fragment,{children:[` · held by `,(0,G.jsx)(A,{name:c,members:r})]}),e.completedBy!==void 0&&e.completedAt!==void 0?` · done by ${e.completedBy} ${m(e.completedAt,i)}`:o&&n.status===`open`?` · waiting since ${m(n.stageSince,i)}`:``,l.length>0?` · held before by ${l.join(`, `)}`:``,u===void 0?``:` · sent back by ${u.by} ${m(u.at,i)}`]})]})]})}function te(e){return e.onDone===`ghpr`?e.pullRequest===void 0?`It lands through a pull request, and none is linked yet, so the board refuses to finish it.`:`Approving lands it: the board merges pull request #${e.pullRequest.number} on GitHub.`:e.onDone===`merge`?`Approving lands it: the board merges task/${e.id}.`:`Approving finishes the task.`}function ne({task:t,stage:n}){let{api:r}=e(),i=c(),[a,o]=(0,W.useState)(``),s=t.stages.findIndex(e=>e.id===n.id),l=t.stages[s+1],u=g({mutationFn:()=>r.advanceTask({task_id:t.id,...a.trim()===``?{}:{note:a.trim()}}),onSuccess:async()=>{o(``),await i.invalidateQueries({queryKey:[`task`,t.id]}),await i.invalidateQueries({queryKey:[`tasks`]})}});return(0,G.jsxs)(`form`,{"aria-label":`Approve ${n.name}`,className:`mt-1 mb-4 space-y-2 rounded-lg bg-surface-2/40 p-3`,onSubmit:e=>{e.preventDefault(),u.mutate()},children:[(0,G.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[n.name,` waits on you.`,` `,l===void 0?te(t):`Approving moves the task on to ${l.name}.`]}),(0,G.jsx)(`textarea`,{value:a,rows:2,"aria-label":`Note for the task's thread`,placeholder:`A note for the thread, if any`,onChange:e=>o(e.target.value),className:z}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(_,{variant:`primary`,type:`submit`,disabled:u.isPending,children:u.isPending?`Approving…`:`Approve`})}),(0,G.jsx)(B,{error:u.error})]})}function re({task:e,now:t}){let n=e.pullRequest;if(n===void 0)return null;let r=[n.subject??`The pull request's title`,n.body??``].filter(e=>e!==``).join(`
|
|
2
|
-
|
|
3
|
-
`);return(0,G.jsxs)(`section`,{"aria-label":`Pull request`,className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Pull request`}),(0,G.jsxs)(`p`,{className:`mt-2 text-sm`,children:[(0,G.jsxs)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`,className:`text-fg-primary underline decoration-line underline-offset-2 hover:decoration-fg-tertiary`,children:[`#`,n.number,` on GitHub`]}),(0,G.jsxs)(`span`,{className:`text-meta`,children:[` `,`· linked by `,n.linkedBy,` `,m(n.linkedAt,t)]})]}),e.status===`abandoned`&&e.onDone===`ghpr`?(0,G.jsxs)(`p`,{className:`mt-2 text-sm text-fg-secondary`,children:[n.closed===void 0?`The task was abandoned, so the board closes the pull request on GitHub.`:n.closed.ok?`The task was abandoned: ${n.closed.detail}.`:`The task was abandoned, and the board could not close the pull request: ${n.closed.detail}.`,n.closed===void 0?null:(0,G.jsxs)(`span`,{className:`text-meta`,children:[` · `,m(n.closed.at,t)]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`mt-3 text-caps text-fg-muted`,children:`Merges as`}),(0,G.jsx)(`pre`,{className:`mt-1 rounded-lg bg-surface-2/40 p-3 font-mono text-xs whitespace-pre-wrap text-fg-secondary`,children:r})]})]})}function ie({taskId:t}){let{api:n}=e(),r=c(),i=g({mutationFn:()=>n.openThread({task_id:t}),onSuccess:()=>{r.invalidateQueries({queryKey:[`threads`]})}});return(0,G.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,G.jsx)(_,{variant:`primary`,disabled:i.isPending,onClick:()=>i.mutate(),children:i.isPending?`Opening…`:`Open its thread`}),(0,G.jsx)(`p`,{className:`text-meta`,children:i.error===null?`This task is older than task threads. It closes when the task ends.`:i.error.message})]})}function ae(){let{taskId:e}=D({from:`/task/$taskId`}),r=n(e),i=l(),a=h(),s=f(),c=p(3e4),u=j(),g=t(i.data?.some(t=>t.id===e)===!0?e:null);if(r.data===void 0)return(0,G.jsx)(V,{children:r.error instanceof o&&r.error.status===404?`There is no task ${e}.`:`Reading the task…`});let _=r.data,S=w(_),C=E(_),A=a.data?.find(e=>e.slug===_.project),N=i.data?.find(e=>e.id===_.id);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(H,{leading:(0,G.jsx)(M,{fallback:(0,G.jsx)(d,{to:`/p/$slug/tasks`,params:{slug:_.project},"aria-label":`Back to the tasks of ${A?.name??_.project}`,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`←`})}),title:_.title,subtitle:`${A?.name??_.project}${_.channel===`general`?``:` #${_.channel}`} · ${y(_)} · created by ${u(_.createdBy)} ${m(_.createdAt,c)}`,trailing:(0,G.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${x[S]}`,children:T.find(e=>e.phase===S)?.label.toLowerCase()})}),(0,G.jsxs)(ee,{stick:!1,follow:!1,ids:g.data?.messages.map(e=>e.id),className:`px-4 py-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Plan`}),_.returned===void 0?null:(0,G.jsxs)(`p`,{className:`mt-2 rounded-lg bg-orange-500/10 px-3 py-2 text-xs leading-relaxed text-orange-200`,children:[`Sent back from `,b(_,_.returned.from),` by `,_.returned.by,` `,m(_.returned.at,c),`. The work is redone from`,` `,b(_,_.stage),` until it reaches that stage again.`]}),(0,G.jsx)(`ol`,{className:`mt-3`,children:_.stages.map((e,t)=>(0,G.jsx)($,{stage:e,index:t,task:_,members:s.data,now:c},e.id))}),C===null?null:(0,G.jsx)(ne,{task:_,stage:C}),(0,G.jsxs)(`p`,{className:`text-meta`,children:[`When the last stage is done:`,` `,_.onDone===`merge`?`task/${_.id} merges onto the default branch`:_.onDone===`ghpr`?_.pullRequest===void 0?`its pull request merges on GitHub, once one is linked`:`pull request #${_.pullRequest.number} merges on GitHub`:`nothing more`,_.blockedBy.length>0?(0,G.jsxs)(G.Fragment,{children:[` · blocked by `,(0,G.jsx)(O,{text:_.blockedBy.join(`, `)})]}):null]}),_.body.trim()===``?null:(0,G.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Brief`}),(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(L,{text:_.body})})]}),(0,G.jsx)(re,{task:_,now:c}),(0,G.jsx)(Q,{task:_,now:c}),(0,G.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,G.jsx)(`h3`,{className:`text-section`,children:`Thread`}),i.data===void 0?null:N===void 0?v(_)?(0,G.jsx)(ie,{taskId:_.id}):(0,G.jsx)(`p`,{className:`mt-2 text-meta`,children:`No thread on this task.`}):(0,G.jsx)(U,{thread:N,now:c,task:_,empty:`Nothing said yet. Each stage's handover lands here, and so does anything written below.`})]})]},_.id),N?.state===`open`?(0,G.jsx)(k,{target:{threadId:_.id},placeholder:`Write in the task's thread`}):null]})}export{ae as TaskView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Gn as e,Jn as t,Wn as n,Yt as r,_ as i,b as a,bt as o,t as s,x as c,z as l}from"./format-CvfmDNoY.js";import{c as u,i as d,l as f,o as p,r as m,s as h,t as g}from"./tasks-CTaxXtGL.js";import{A as _,o as v}from"./index-DD3J11PT.js";import{n as y,t as b}from"./Pane-DTmByqgA.js";var x=t(e(),1),S=n();function C({task:e}){let t=h(e);return(0,S.jsx)(`ol`,{className:`flex gap-1`,"aria-hidden":`true`,children:e.stages.map((n,r)=>{let i=n.completedBy!==void 0,a=p(e,n),o=i?`bg-emerald-400/60`:a?e.status===`claimed`?`bg-fg-primary/90`:`bg-amber-300/80`:t===`abandoned`?`bg-surface-2/50`:`bg-surface-2`;return(0,S.jsx)(`li`,{title:`${r+1}. ${n.name} · ${m(n)}${n.gate?` · gate`:``}`,className:`h-1.5 min-w-3 flex-1 rounded-full ${o} ${n.gate?`ring-1 ring-sky-300/70 ring-offset-1 ring-offset-surface-1`:``}`},n.id)})})}var w=5;function T({task:e,members:t,now:n}){let i=h(e),a=o(e);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(r,{to:`/task/$taskId`,params:{taskId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:e.title}),(0,S.jsx)(`span`,{className:`shrink-0 text-meta`,children:u(e)})]}),(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(C,{task:e})}),e.returned===void 0?null:(0,S.jsxs)(`p`,{className:`mt-1.5 truncate text-xs text-orange-300/90`,children:[`Sent back from `,f(e,e.returned.from),` by `,e.returned.by,` `,s(e.returned.at,n)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:e.status===`claimed`&&i!==`landing`&&a!==void 0?(0,S.jsxs)(S.Fragment,{children:[a.name,` · held by `,(0,S.jsx)(v,{name:e.claimedBy??``,members:t})]}):e.status===`open`&&i!==`landing`&&a!==void 0?`${a.name} · waiting for ${m(a)} since ${s(e.stageSince,n)}`:i===`landing`?`landing task/${e.id} on the default branch`:`${i} ${s(e.updatedAt,n)}`})]})})}function E(){let{slug:e}=_({from:`/p/$slug/tasks`}),t=l(e),n=c(),r=i(),o=a(3e4),[s,u]=(0,x.useState)(new Set),f=n.data?.find(t=>t.slug===e),p=d(t.data??[]),m=p.filter(e=>e.phase!==`done`&&e.phase!==`abandoned`).reduce((e,t)=>e+t.tasks.length,0);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(b,{title:`Tasks`,subtitle:`${f?.name??e} · ${m} in play · ${t.data?.length??0} in all`}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:t.data===void 0?(0,S.jsx)(y,{children:`Reading the tasks…`}):p.length===0?(0,S.jsx)(y,{children:`No tasks in this project yet.`}):p.map(e=>{let t=e.phase!==`done`&&e.phase!==`abandoned`||s.has(e.phase)?e.tasks:e.tasks.slice(0,w);return(0,S.jsxs)(`section`,{className:`mb-3`,children:[(0,S.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[g.find(t=>t.phase===e.phase)?.label,` · `,e.tasks.length]}),(0,S.jsx)(`ul`,{children:t.map(e=>(0,S.jsx)(T,{task:e,members:r.data,now:o},e.id))}),t.length<e.tasks.length?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>u(new Set([...s,e.phase])),className:`px-3 pt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show all `,e.tasks.length]}):null]},e.phase)})})]})}export{E as TasksView};
|