@kubitnodes/stellaris 0.3.19 → 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/cli/index.js +394 -160
  2. package/dist/server/index.js +481 -147
  3. package/package.json +1 -1
  4. package/web/dist/assets/BackLink-23Q1JvmZ.js +1 -0
  5. package/web/dist/assets/{ChannelForms-BjD5Lp_u.js → ChannelForms-0Cwh59E7.js} +1 -1
  6. package/web/dist/assets/ChannelView-CqWV1zza.js +2 -0
  7. package/web/dist/assets/{CitizenView-tvC6dNUB.js → CitizenView-s5OdjXmB.js} +2 -2
  8. package/web/dist/assets/{CitizensView-DsUhIYtl.js → CitizensView-r6SZLnVl.js} +1 -1
  9. package/web/dist/assets/{CliIcon-TlyIqh7V.js → CliIcon-BOSygXeI.js} +1 -1
  10. package/web/dist/assets/CronsView-Y-bAE0l2.js +1 -0
  11. package/web/dist/assets/{KnowledgeView-CgRGZrOK.js → KnowledgeView-CI4PJWwm.js} +1 -1
  12. package/web/dist/assets/{Markdown-CePsfcUS.js → Markdown-DyckB74r.js} +4 -4
  13. package/web/dist/assets/MessageItem-DI05jbrI.js +1 -0
  14. package/web/dist/assets/MetricsView-DKh-lEW5.js +1 -0
  15. package/web/dist/assets/NeedsYouView-C6FfiTsg.js +1 -0
  16. package/web/dist/assets/Overview-D5RvWBg5.js +1 -0
  17. package/web/dist/assets/{Pane-DGtHsANK.js → Pane-BendOaje.js} +1 -1
  18. package/web/dist/assets/{Picker-Dq5Vvxod.js → Picker-BuVnakvi.js} +1 -1
  19. package/web/dist/assets/ProjectView-blBEh70W.js +1 -0
  20. package/web/dist/assets/ProposalView-CMntpKTc.js +2 -0
  21. package/web/dist/assets/{ProposalsView-BjEfHBtx.js → ProposalsView-CVUAV2Mm.js} +1 -1
  22. package/web/dist/assets/{RunnersView-CM-q_AX9.js → RunnersView-B-wuWVgB.js} +1 -1
  23. package/web/dist/assets/SocietyView-CaVbfJWz.js +1 -0
  24. package/web/dist/assets/SubjectThread-Bd_-sDhJ.js +1 -0
  25. package/web/dist/assets/{TaskFileView-BMAkbh-e.js → TaskFileView-CO4Y97OT.js} +2 -2
  26. package/web/dist/assets/{TaskView-HDwqXuYy.js → TaskView-DRZoHALo.js} +2 -2
  27. package/web/dist/assets/{TasksView-Dt8M_z96.js → TasksView-CQVQo3zF.js} +1 -1
  28. package/web/dist/assets/{ThreadForms-DbV3kPCi.js → ThreadForms-CUSeWu0c.js} +1 -1
  29. package/web/dist/assets/ThreadItem-BPYYXh3V.js +1 -0
  30. package/web/dist/assets/ThreadView-BcI2i6FI.js +1 -0
  31. package/web/dist/assets/{citizen-DQ0Bmk-r.js → citizen-Eff1h9rA.js} +1 -1
  32. package/web/dist/assets/{compose-Cx9c9k90.js → compose-D73Agshx.js} +1 -1
  33. package/web/dist/assets/{format-SP8GnzAX.js → format-fw0G_Vff.js} +1 -1
  34. package/web/dist/assets/governance-sRsfOw52.js +1 -0
  35. package/web/dist/assets/index-BkOq4PSU.css +2 -0
  36. package/web/dist/assets/index-CYiok0pT.js +23 -0
  37. package/web/dist/assets/link-Cl7vKbOz.js +1 -0
  38. package/web/dist/assets/{tasks-BeWF0Xy2.js → tasks-CyXIxoAy.js} +1 -1
  39. package/web/dist/assets/useMatch-D-tEHQEw.js +1 -0
  40. package/web/dist/assets/useStickyScroll-Bn4YyEXL.js +1 -0
  41. package/web/dist/index.html +9 -9
  42. package/web/dist/assets/BackLink-CDrsO9Ls.js +0 -1
  43. package/web/dist/assets/ChannelView-dI5EHpof.js +0 -2
  44. package/web/dist/assets/CronsView-BPlSyoAe.js +0 -1
  45. package/web/dist/assets/MessageItem-kg5zWMDe.js +0 -1
  46. package/web/dist/assets/MetricsView-cJeDTfBE.js +0 -1
  47. package/web/dist/assets/NeedsYouView-Cd1TnY7W.js +0 -1
  48. package/web/dist/assets/Overview-B6aBmove.js +0 -1
  49. package/web/dist/assets/ProjectView-uskZHP8l.js +0 -1
  50. package/web/dist/assets/ProposalView-DmjIL53_.js +0 -2
  51. package/web/dist/assets/SocietyView-DZuGEqIl.js +0 -1
  52. package/web/dist/assets/SubjectThread-pCRDn42X.js +0 -1
  53. package/web/dist/assets/ThreadItem-BVlz2w6q.js +0 -1
  54. package/web/dist/assets/ThreadView-CpBytSH7.js +0 -1
  55. package/web/dist/assets/governance-DX2ph-qr.js +0 -1
  56. package/web/dist/assets/index-BDKI0Rje.js +0 -23
  57. package/web/dist/assets/index-BPVeX6tV.css +0 -2
  58. package/web/dist/assets/link-DxSeFzFf.js +0 -1
  59. package/web/dist/assets/useMatch-HNekgJrF.js +0 -1
  60. package/web/dist/assets/useStickyScroll-BmqddNx5.js +0 -1
@@ -0,0 +1 @@
1
+ import{$t as e,Gt as t,Jt as n,On as r,Rt as i,Tn as a,Zt as o,qt as s,wn as c,zt as l}from"./format-fw0G_Vff.js";function u(e){return e.replace(/\/{2,}/g,`/`)}function d(e){return e===`/`?e:e.replace(/^\/+/,``)}function f(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function p(e){return f(d(e))}function m(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function h(t,n,r=`never`,i){if(n.includes(`//`)&&(n=u(n)),n.startsWith(`/`))return n.length===1||r===`preserve`?n:r===`always`?n.endsWith(`/`)?n:`${n}/`:n.endsWith(`/`)?n.slice(0,-1):n;let a=n===`.`,o;if(i){o=a?t:t+`\0`+n;let e=i.get(o);if(e)return e}let s;if(a)s=t.split(`/`);else{for(t.includes(`//`)&&(t=u(t)),s=t.split(`/`);s.length>1&&e(s)===``;)s.pop();let r=n.split(`/`);for(let e=0,t=r.length;e<t;e++){let n=r[e];n===``?e?e===t-1&&s.push(n):s=[n]:n===`..`?s.length>1?s.pop():s=[``]:n===`.`||s.push(n)}}s.length>1&&(e(s)===``?r===`never`&&s.pop():r===`always`&&s.push(``));let c=s.join(`/`),l=(a?u(c):c)||`/`;return o&&i&&i.set(o,l),l}function g(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function _(e){return e==null||e===``}function v(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function y(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&_(f)){if(c===`/`&&!d)continue;f=``}o+=c+v(s,f,r)+(d||``)}}return o+a||`/`}var b=`Error preloading route! ☝️`,x=r(a(),1),S=c(),C=()=>!0,w=()=>!1;function T({children:e,fallback:t=null}){return(0,S.jsx)(x.Fragment,{children:E()?e:t})}function E(e=!0){return x.useSyncExternalStore(D,C,e?w:C)}function D(){return()=>{}}function O(...e){let n=x.useRef(e),r=n.current;return e.forEach((e,n)=>{t(r[n],e,!1,!0)||(r[n]=e)}),n.current}function k(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(b)})}var A={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function ee(e,t){let r=typeof e==`string`&&n(e);if(r)return t.has(r)?e:null}function te(e,n,r,i,a){let o=m(e.pathname,i),s=m(n.pathname,i);return(r?.exact?o!==s:!o.startsWith(s)||o.length!==s.length&&o[s.length]!==`/`)||(r?.includeSearch??!0)&&!t(e.search,n.search,!r?.exact,r?.explicitUndefined)?!1:!r?.includeHash||a&&e.hash===n.hash}function j(e,t,r){let a=l(),o=x.useRef(null),s=x.useCallback(e=>{if(o.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:c,to:u,preload:d,preloadDelay:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,ignoreBlocker:v,disabled:y,target:b,onClick:S,onBlur:C,onFocus:w,onMouseEnter:T,onMouseLeave:D,onTouchStart:j}=e,M=E(!!c?.includeHash),[N,P,V]=O(e.search,e.params,c),[H,U]=x.useMemo(()=>[e,{...e}],[a,e.from,e._fromLocation,e.hash,e.to,N,P,e.state,e.mask,e.unsafeRelative]),ne=x.useCallback(e=>{let t=ee(u,a.protocolAllowlist);if(t!==void 0)return[t??void 0];H._fromLocation||(U._fromLocation=e);let r=a.buildLocation(U),i=B(r,a,y);return[i,!y&&(!i||n(i))?void 0:te(e,r,V,a.basepath,M)]},[V,y,M,H,U,a,u]),[W,G]=i(a.stores.location,ne,A),K=G===void 0?W:void 0,q=y||W===void 0,J=x.useRef(!1),Y=e.reloadDocument||K||q?!1:d??a.options.defaultPreload,X=f??a.options.defaultPreloadDelay??0,Z=x.useCallback(e=>{let t=e?.isIntersecting;if(!(t??Y===`intent`)){t===!1&&R(o);return}if(!X){k(a,H);return}L.has(o)||L.set(o,setTimeout(()=>{L.delete(o),k(a,H)},X))},[a,H,o,Y,X]);x.useEffect(()=>{if(!Y)return;Y===`render`&&!J.current&&(J.current=!0,k(a,H));let e=!0,t;return Y===`viewport`&&o.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&Z(t.pop())},{rootMargin:`100px`}),t.observe(o.current)),()=>{e=!1,t?.disconnect(),R(o)}},[a,H,Y,Z,o]);let Q=F(e,r);if(Q.ref=t?s:o,K)return Q.href=K,Q;let re=e=>{let t=b??e.currentTarget.getAttribute(`target`);!q&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),a.navigate({...H,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:v}))},ie=()=>{Y===`intent`&&k(a,H)},$=()=>{Y===`intent`&&R(o)};return Q.onClick=z(S,re),Q.onBlur=z(C,$),Q.onFocus=z(w,Z),Q.onMouseEnter=z(T,Z),Q.onMouseLeave=z(D,$),Q.onTouchStart=z(j,ie),I(Q,e,G,W,q,r)}var M={},N={className:`active`},P=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`_fromLocation`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function F(e,t){let n={};for(let r in e)P.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function I(e,t,n,r,i,a){let{activeProps:o,inactiveProps:c,className:l,style:u,target:d}=t,f=s(n?o:c,{})??(n?N:M);Object.assign(e,f),e.href=r,a!==`a`&&(e.disabled=i),e.target=d;let p=f.style;(u||p)&&(e.style=u&&p?{...u,...p}:u||p);let m=f.className;return(l||m)&&(e.className=l?m?`${l} ${m}`:l:m),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var L=new WeakMap,R=e=>{clearTimeout(L.get(e)),L.delete(e)},z=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function B(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!o(i,t.protocolAllowlist))return i}var V=x.memo(x.forwardRef((e,t)=>{let n=e._asChild||`a`,r=j(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return x.createElement(n,r,i)}),H);function H(e,n){let r=0;for(let i in n)if(r++,e[i]!==n[i]&&(!P.has(i)||!t(e[i],n[i],!1,!0)))return!1;for(let t in e)r--;return r===0}export{y as a,d as c,g as i,f as l,T as n,h as o,u as r,p as s,V as t};
@@ -1 +1 @@
1
- import{_t as e,gt as t}from"./format-SP8GnzAX.js";var n=[{phase:`returned`,label:`Sent back`},{phase:`waiting`,label:`Waiting for a holder`},{phase:`working`,label:`Being worked`},{phase:`landing`,label:`Landing`},{phase:`done`,label:`Done`},{phase:`abandoned`,label:`Abandoned`}],r={returned:`bg-orange-500/15 text-orange-300`,waiting:`bg-amber-500/15 text-amber-300`,working:`bg-emerald-500/15 text-emerald-300`,landing:`bg-sky-500/15 text-sky-300`,done:`bg-surface-2 text-fg-secondary`,abandoned:`bg-surface-2 text-fg-muted`};function i(e){return e.status===`done`||e.status===`abandoned`?e.status:e.completing?`landing`:e.returned===void 0?e.status===`claimed`?`working`:`waiting`:`returned`}function a(e,t){let n=i(e);return t.id===e.stage&&n!==`landing`&&n!==`done`&&n!==`abandoned`}function o(e){let t=i(e);return t!==`done`&&t!==`abandoned`}function s(e,t){return e.stages.find(e=>e.id===t)?.name??t}function c(e,n){if(!t(e))return e.action===`approved`?{text:`approved`,tone:r.working}:{text:`rejected`,tone:`bg-red-500/15 text-red-300`};let i=e=>n===void 0?e:s(n,e);if(e.action===`advanced`)return{text:e.to===null?`finished ${i(e.stage)}`:`finished ${i(e.stage)} → ${i(e.to)}`,tone:r.working};if(e.action===`returned`){let t=e.to===null?`an earlier stage`:i(e.to);return{text:`sent back from ${i(e.stage)} to ${t}`,tone:r.returned}}return e.action===`abandoned`?{text:`abandoned`,tone:r.abandoned}:e.action===`landed`?{text:`landed`,tone:r.landing}:{text:`landing failed · back at ${i(e.stage)}`,tone:`bg-red-500/15 text-red-300`}}function l(e){return e.agent===void 0?e.role===void 0?`anyone in the project`:`any ${e.role}`:e.agent}function u(e){return n.map(({phase:t})=>({phase:t,tasks:e.filter(e=>i(e)===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))})).filter(e=>e.tasks.length>0)}function d(t){let n=i(t);return n===`done`?`All ${t.stages.length} stages done`:n===`abandoned`?`Abandoned`:`Stage ${e(t,t.stage)+1} of ${t.stages.length}`}export{o as a,d as c,u as i,s as l,r as n,a as o,l as r,i as s,n as t,c as u};
1
+ import{_t as e,bt as t}from"./format-fw0G_Vff.js";var n=[{phase:`returned`,label:`Sent back`},{phase:`waiting`,label:`Waiting for a holder`},{phase:`working`,label:`Being worked`},{phase:`landing`,label:`Landing`},{phase:`done`,label:`Done`},{phase:`abandoned`,label:`Abandoned`}],r={returned:`bg-orange-500/15 text-orange-300`,waiting:`bg-amber-500/15 text-amber-300`,working:`bg-emerald-500/15 text-emerald-300`,landing:`bg-sky-500/15 text-sky-300`,done:`bg-surface-2 text-fg-secondary`,abandoned:`bg-surface-2 text-fg-muted`};function i(e){return e.status===`done`||e.status===`abandoned`?e.status:e.completing?`landing`:e.returned===void 0?e.status===`claimed`?`working`:`waiting`:`returned`}function a(e,t){let n=i(e);return t.id===e.stage&&n!==`landing`&&n!==`done`&&n!==`abandoned`}function o(e){let t=i(e);return t!==`done`&&t!==`abandoned`}function s(e,t){return e.stages.find(e=>e.id===t)?.name??t}function c(t,n){if(!e(t))return t.action===`approved`?{text:`approved`,tone:r.working}:{text:`rejected`,tone:`bg-red-500/15 text-red-300`};let i=e=>n===void 0?e:s(n,e);if(t.action===`advanced`)return{text:t.to===null?`finished ${i(t.stage)}`:`finished ${i(t.stage)} → ${i(t.to)}`,tone:r.working};if(t.action===`returned`){let e=t.to===null?`an earlier stage`:i(t.to);return{text:`sent back from ${i(t.stage)} to ${e}`,tone:r.returned}}return t.action===`abandoned`?{text:`abandoned`,tone:r.abandoned}:t.action===`landed`?{text:`landed`,tone:r.landing}:{text:`landing failed · back at ${i(t.stage)}`,tone:`bg-red-500/15 text-red-300`}}function l(e){return e.agent===void 0?e.role===void 0?`anyone in the project`:`any ${e.role}`:e.agent}function u(e){return n.map(({phase:t})=>({phase:t,tasks:e.filter(e=>i(e)===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))})).filter(e=>e.tasks.length>0)}function d(e){let n=i(e);return n===`done`?`All ${e.stages.length} stages done`:n===`abandoned`?`Abandoned`:`Stage ${t(e,e.stage)+1} of ${e.stages.length}`}export{o as a,d as c,u as i,s as l,r as n,a as o,l as r,i as s,n as t,c as u};
@@ -0,0 +1 @@
1
+ import{On as e,Rt as t,Tn as n,nn as r,zt as i}from"./format-fw0G_Vff.js";function a(){throw Error(`Invariant failed`)}var o=e(n(),1),s=o.createContext(void 0),c=o.createContext(void 0),l={};function u(e,t){let n=o.useRef();return i=>{let a=e?.select?e.select(i):i;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=r(n.current,a):a}}function d(e){let n=i(),r=o.useContext(e.from?c:s),d=e.from??r,f=n.stores.getMatchStore(d),p=u(e,n),m=t(f,e=>e?p(e):l);if(m!==l)return m;(e.shouldThrow??!0)&&a()}export{a as i,u as n,s as r,d as t};
@@ -0,0 +1 @@
1
+ import{On as e,Tn as t}from"./format-fw0G_Vff.js";var n=e(t(),1);function r(e=!0){let t=(0,n.useRef)(null),r=(0,n.useRef)(e);return(0,n.useLayoutEffect)(()=>{e||(r.current=!1)},[e]),(0,n.useLayoutEffect)(()=>{let e=t.current;e!==null&&r.current&&(e.scrollTop=e.scrollHeight)}),{ref:t,onScroll:()=>{let e=t.current;e!==null&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)}}}export{r as t};
@@ -6,16 +6,16 @@
6
6
  <meta name="color-scheme" content="dark" />
7
7
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
8
  <title>Stellaris</title>
9
- <script type="module" crossorigin src="/assets/index-BDKI0Rje.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/format-SP8GnzAX.js">
9
+ <script type="module" crossorigin src="/assets/index-CYiok0pT.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/format-fw0G_Vff.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/mentions-BCdV0bMK.js">
12
- <link rel="modulepreload" crossorigin href="/assets/compose-Cx9c9k90.js">
13
- <link rel="modulepreload" crossorigin href="/assets/useMatch-HNekgJrF.js">
14
- <link rel="modulepreload" crossorigin href="/assets/link-DxSeFzFf.js">
15
- <link rel="modulepreload" crossorigin href="/assets/CliIcon-TlyIqh7V.js">
16
- <link rel="modulepreload" crossorigin href="/assets/tasks-BeWF0Xy2.js">
17
- <link rel="modulepreload" crossorigin href="/assets/governance-DX2ph-qr.js">
18
- <link rel="stylesheet" crossorigin href="/assets/index-BPVeX6tV.css">
12
+ <link rel="modulepreload" crossorigin href="/assets/compose-D73Agshx.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/useMatch-D-tEHQEw.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/link-Cl7vKbOz.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/CliIcon-BOSygXeI.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/tasks-CyXIxoAy.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/governance-sRsfOw52.js">
18
+ <link rel="stylesheet" crossorigin href="/assets/index-BkOq4PSU.css">
19
19
  </head>
20
20
  <body class="antialiased">
21
21
  <div id="root"></div>
@@ -1 +0,0 @@
1
- import{Ft as e,bn as t,x as n}from"./format-SP8GnzAX.js";import{D as r,n as i,r as a,t as o,v as s}from"./index-BDKI0Rje.js";var c=t(),l=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function u({fallback:t}){let u=e(),d=r({select:e=>e.location.state.__TSR_index}),f=a(),p=s(),m=n(),h=i(f,d);if(h===null)return t;let g=o(h,{entity:e=>p.get(e)?.title,project:e=>m.data?.find(t=>t.slug===e)?.name});return(0,c.jsx)(`button`,{type:`button`,onClick:()=>u.history.back(),"aria-label":`Back to ${g}`,title:`Back to ${g}`,className:l,children:`←`})}export{u as t};
@@ -1,2 +0,0 @@
1
- import{$t as e,A as t,H as n,_ as r,b as i,bn as a,c as o,ht as s,t as c,wn as l,x as u,xn as d,z as f}from"./format-SP8GnzAX.js";import{a as p}from"./compose-Cx9c9k90.js";import{t as m}from"./link-DxSeFzFf.js";import{S as h,i as g,k as _,s as v}from"./index-BDKI0Rje.js";import{i as y}from"./ThreadForms-DbV3kPCi.js";import{t as b}from"./ChannelForms-BjD5Lp_u.js";import{t as x}from"./MessageItem-kg5zWMDe.js";import{n as S,t as C}from"./Pane-DGtHsANK.js";import{n as w}from"./ThreadItem-BVlz2w6q.js";import{t as T}from"./useStickyScroll-BmqddNx5.js";var E=l(d(),1);function D(e,t){let n=e.notices.at(-1);return n!==void 0&&n.kind===`knowledge`&&t.kind===`knowledge`&&n.action!==`removed`&&t.action===`updated`&&n.topic===t.topic&&n.project===t.project}function O(e,t){let n=[],r=null;for(let i of e){let e=t(i),a=e?.notice;e===void 0||a===void 0?(n.push({kind:`item`,item:i}),r=null):r!==null&&D(r,a)?(r.messages.push(e),r.notices.push(a)):(r={messages:[e],notices:[a]},n.push({kind:`notices`,run:r}))}return n}function k(e){let[t]=e,n=e.length-1;return t===void 0||t.action===`removed`?{did:`removed`,times:null}:t.action===`written`?{did:`wrote`,times:n===0?null:`then updated it ${n===1?`once`:`${n} times`}`}:{did:`updated`,times:n===0?null:`${e.length} times`}}function A(e){let t=[...new Set(e)];return t.length<=2?t.join(` and `):`${t.slice(0,-1).join(`, `)}, and ${t.at(-1)??``}`}var j=a();function M(){return(0,j.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`size-3.5`,children:(0,j.jsx)(`path`,{d:`M8 4.2C6.4 3 4.4 2.8 2.2 3.4v9.2c2.2-.6 4.2-.4 5.8.8m0-9.2c1.6-1.2 3.6-1.4 5.8-.8v9.2c-2.2-.6-4.2-.4-5.8.8m0-9.2v9.2`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinejoin:`round`})})}function N({notices:e}){let[t]=e;if(t===void 0)return null;let{did:n,times:r}=k(e);return(0,j.jsxs)(j.Fragment,{children:[n,` knowledge`,` `,t.action===`removed`?(0,j.jsx)(`span`,{className:`text-fg-secondary`,children:t.topic}):(0,j.jsx)(m,{to:`/knowledge/$scope/$topic`,params:{scope:t.project??`society`,topic:t.topic},className:`text-fg-secondary hover:text-fg-primary`,children:t.topic}),r===null?null:` · ${r}`]})}function P(e){let t=e.notices.filter(e=>e.kind===`knowledge`);return{mark:(0,j.jsx)(M,{}),text:(0,j.jsx)(N,{notices:t})}}function F({run:e,now:t}){let n=v(),r=e.messages.at(-1);if(r===void 0)return null;let{mark:i,text:a}=P(e);return(0,j.jsxs)(`div`,{className:`flex gap-3 px-4 py-1`,children:[(0,j.jsx)(`span`,{className:`grid h-5 w-7 shrink-0 place-items-center text-fg-muted`,children:i}),(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-3`,children:[(0,j.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-sm text-fg-tertiary`,children:[A(e.messages.map(e=>n(e.author))),` `,a]}),(0,j.jsx)(`time`,{dateTime:r.ts,title:e.messages.map(e=>`${n(e.author)} ${e.ts}`).join(`
2
- `),className:`shrink-0 text-meta`,children:c(r.ts,t)})]})]})}function I(){let{_splat:e=`general`}=_({from:`/c/$`});return(0,j.jsx)(L,{channel:e},e)}function L({channel:a}){let{api:l}=t(),d=e({queryKey:[`channel`,a],queryFn:()=>l.channel(a)}),m=f(),_=r(),v=u(),D=o(),k=i(3e4),[A,M]=(0,E.useState)(!1),[N,P]=(0,E.useState)(!1),I=(0,E.useMemo)(()=>{let e=(d.data??[]).map(e=>({kind:`message`,at:e.ts,id:e.id,message:e})),t=(m.data??[]).filter(e=>e.channel===a).map(e=>({kind:`thread`,at:e.openedAt,id:e.id,thread:e}));return[...e,...t].toSorted((e,t)=>e.at.localeCompare(t.at)||e.id.localeCompare(t.id))},[d.data,m.data,a]),L=(0,E.useMemo)(()=>O(I,e=>e.kind===`message`?e.message:void 0),[I]),R=d.data?.at(-1)?.id??null;(0,E.useEffect)(()=>h(a,R),[a,R]);let{ref:z,onScroll:B}=T(),[V,H]=a.split(`/`),U=H??V??a,W=H===void 0?void 0:v.data?.find(e=>e.slug===V),G=H===void 0?`society`:W?.name??V,K=D.data?.find(e=>e.ref===a)?.archived,q=W?.archived!==void 0||K!==void 0,J=!q&&!s(H===void 0?null:V??null,U),Y=I.filter(e=>e.kind===`thread`&&e.thread.state===`open`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(C,{title:`# ${U}`,subtitle:`${G} · ${d.data?.length??0} messages${Y.length>0?` · ${Y.length} open threads`:``}`,trailing:A||N||q?null:(0,j.jsxs)(j.Fragment,{children:[J?(0,j.jsx)(p,{onClick:()=>P(!0),children:`Archive…`}):null,(0,j.jsx)(p,{onClick:()=>M(!0),children:`New thread`})]})}),A?(0,j.jsx)(y,{channel:a,onDone:()=>M(!1)}):null,N?(0,j.jsx)(b,{channel:a,onDone:()=>P(!1)}):null,(0,j.jsx)(`div`,{ref:z,onScroll:B,className:`flex-1 overflow-y-auto py-2`,children:d.error instanceof n&&d.error.status===404?(0,j.jsxs)(S,{children:[`There is no channel `,a,`.`]}):d.data===void 0?(0,j.jsx)(S,{children:`Reading the channel…`}):I.length===0?(0,j.jsx)(S,{children:`Nothing has been said here yet.`}):L.map(e=>{if(e.kind===`notices`){let t=e.run.messages[0]?.id??``;return(0,j.jsx)(F,{run:e.run,now:k},t)}let{item:t}=e;return t.kind===`message`?(0,j.jsx)(x,{message:t.message,members:_.data,now:k},t.id):(0,j.jsx)(w,{thread:t.thread,now:k},t.id)})}),d.data===void 0?null:K===void 0?q?(0,j.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-meta`,children:[G,` is archived, so its channels are read-only.`]}):(0,j.jsx)(g,{target:{channel:a},placeholder:`Message #${U}`}):(0,j.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-meta`,children:[`Archived `,c(K.at,k),` by `,K.by,`: `,K.reason,`. Its posts, threads, and tasks stay readable; nothing more is posted or filed here.`]})]})}export{I as ChannelView};
@@ -1 +0,0 @@
1
- import{A as e,N as t,St as n,_ as r,b as i,bn as a,dt as o,l as s,t as c,wn as l,x as u,xn as d,yn as f,z as p}from"./format-SP8GnzAX.js";import{a as m,s as h}from"./compose-Cx9c9k90.js";import{t as g}from"./link-DxSeFzFf.js";import{t as _}from"./CliIcon-TlyIqh7V.js";import{C as v,E as y,O as b,T as x,w as S}from"./index-BDKI0Rje.js";import{a as C,o as w,r as T}from"./ThreadForms-DbV3kPCi.js";import{t as E}from"./Markdown-CePsfcUS.js";import{n as D,t as O}from"./Pane-DGtHsANK.js";import{a as k,i as A,l as j}from"./citizen-DQ0Bmk-r.js";import{n as M,r as N,t as P}from"./Picker-Dq5Vvxod.js";var F=l(d(),1),I=a(),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:w}),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,t){return n(typeof e==`string`?new Date(e):e,t)}function U({cron:e}){let t=p(),n=S(e);if(n.kind===`thread`){let e=t.data?.find(e=>e.id===n.id)?.title??n.id;return(0,I.jsxs)(g,{to:`/thread/$threadId`,params:{threadId:n.id},className:`truncate hover:text-fg-primary`,children:[`thread “`,e,`”`]})}return n.kind===`channel`?(0,I.jsxs)(g,{to:`/c/$`,params:{_splat:n.ref},className:`hover:text-fg-primary`,children:[`#`,n.ref]}):(0,I.jsxs)(`span`,{children:[`home at `,k(n.scope)]})}function W({cron:t,next:n,member:r,zone:i,now:a,focused:o}){let s=(0,F.useRef)(null);(0,F.useEffect)(()=>{o&&s.current!==null&&(s.current.open=!0,s.current.scrollIntoView({block:`nearest`}))},[o]);let{api:l}=e(),u=f(),[d,p]=(0,F.useState)(!1),[v,y]=(0,F.useState)(``),b=()=>void u.invalidateQueries({queryKey:[`crons`]}),S=h({mutationFn:e=>l.pauseCron(t.id,e),onSuccess:b}),C=h({mutationFn:()=>l.removeCron(t.id,v.trim()),onSuccess:b}),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()<=a?`due, waiting for its turn`:c(n.toISOString(),a):`paused`:`ended ${c(t.ended.at,a)}`,k=x(t);return(0,I.jsx)(`li`,{className:`rounded-lg ${o?`bg-surface-2/30`:``}`,children:(0,I.jsxs)(`details`,{ref:s,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,` `,c(t.lastRun.at,a)]})]}),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)(E,{text:t.note})}),(0,I.jsxs)(`p`,{className:`text-meta`,children:[`Set by `,t.createdBy,` `,c(t.createdAt,a),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)(g,{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?d?(0,I.jsxs)(`form`,{"aria-label":`Remove ${t.title}`,className:`space-y-2`,onSubmit:e=>{e.preventDefault(),C.mutate()},children:[(0,I.jsx)(`input`,{value:v,"aria-label":`Why it ends`,placeholder:`Why it ends, which the cron keeps`,onChange:e=>y(e.target.value),className:w}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(m,{onClick:()=>p(!1),children:`Cancel`}),(0,I.jsx)(m,{variant:`primary`,type:`submit`,disabled:C.isPending||v.trim()===``,children:C.isPending?`Removing…`:`Remove cron`})]}),(0,I.jsx)(T,{error:C.error})]}):(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(m,{onClick:()=>S.mutate(t.paused===void 0),disabled:S.isPending,children:t.paused===void 0?`Pause`:`Resume`}),(0,I.jsx)(m,{onClick:()=>p(!0),children:`Remove…`}),(0,I.jsx)(T,{error:S.error})]}):null]})]})})}function G({zone:t,onDone:n}){let{api:r}=e(),i=f(),[a,o]=(0,F.useState)(t),s=new Intl.DateTimeFormat().resolvedOptions().timeZone,c=h({mutationFn:()=>r.setTimezone(a.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(),c.mutate()},children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(B,{value:a,onChange:o,label:`Society time zone`}),s===a?null:(0,I.jsxs)(m,{onClick:()=>o(s),children:[`Use `,s]})]}),(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)(m,{onClick:n,children:`Cancel`}),(0,I.jsx)(m,{variant:`primary`,type:`submit`,disabled:c.isPending||a.trim()===``||a.trim()===t,children:c.isPending?`Saving…`:`Save`})]}),(0,I.jsx)(T,{error:c.error})]})}function K({members:n,preferred:r,zone:a,onDone:s}){let{api:c}=e(),l=f(),d=u(),p=t(),[g,_]=(0,F.useState)(n.find(e=>e.name===r)?.name??n[0]?.name??``),v=n.find(e=>e.name===g),b=v===void 0?[]:j(v),[x,S]=(0,F.useState)(b[0]??`society`),[E,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=i(3e4),ee=(x===`society`?p.data?.channels??[]:d.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=y(O===`once`&&z===``?{at:`invalid`}:X,a,new Date(Y)),Q=O===`repeats`?L.trim()===``?a:L.trim():a,$=h({mutationFn:()=>c.createCron({agent:g,title:W.trim(),note:K.trim(),project:x,...E===``?{}:{channel:E},...X}),onSuccess:()=>{l.invalidateQueries({queryKey:[`crons`]}),s()}});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:n.map(e=>({value:e.name,name:e.name,id:e.role,description:e.memberships.length===0?`in no project`:`in ${e.memberships.join(`, `)}`})),value:g,onChange:e=>{let t=n.find(t=>t.name===e);_(e),S(t===void 0?o:j(t)[0]??`society`),D(``)}})}),(0,I.jsx)(V,{word:`at`,children:(0,I.jsx)(M,{label:`Where`,choices:A(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:E,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:w}),(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:C}),(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:w})}),(0,I.jsx)(B,{value:L,onChange:R,label:`Its time zone`,placeholder:`${a}, 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:w}),(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 `,g===``?`the citizen`:g,`, which costs money.`]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(m,{onClick:s,children:`Cancel`}),(0,I.jsx)(m,{variant:`primary`,type:`submit`,disabled:$.isPending||g===``||W.trim()===``||K.trim()===``||`error`in Z,children:$.isPending?`Setting…`:`Set cron`})]}),(0,I.jsx)(T,{error:$.error})]})}function q(){let{agent:e,cron:n}=b({from:`/crons`}),a=s(),o=r(),c=t(),l=i(3e4),[u,d]=(0,F.useState)(null),f=c.data?.timezone??`UTC`,p=(a.data??[]).filter(t=>e===void 0||t.agent===e),h=v(p,f),_=p.filter(x).length,y=(o.data??[]).filter(e=>e.status===`active`&&e.cli!==null),S=e=>o.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 ${f}`].join(` · `),trailing:u===null?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(m,{onClick:()=>d(`zone`),children:`Time zone…`}),(0,I.jsx)(m,{onClick:()=>d(`new`),disabled:y.length===0,children:`New cron…`})]}):null}),u===`new`?(0,I.jsx)(K,{members:y,preferred:e,zone:f,onDone:()=>d(null)}):u===`zone`?(0,I.jsx)(G,{zone:f,onDone:()=>d(null)}):null,(0,I.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e===void 0?null:(0,I.jsx)(g,{to:`/crons`,className:`block px-2 pb-2 text-meta hover:text-fg-primary`,children:`Show every citizen's crons`}),a.error!==null&&a.data===void 0?(0,I.jsxs)(D,{children:[`The board server did not list its crons (`,a.error.message,`); one older than this interface has none.`]}):a.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:t})=>(0,I.jsx)(W,{cron:e,next:t,member:S(e.agent),zone:f,now:l,focused:e.id===n},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:S(e.agent),zone:f,now:l,focused:e.id===n},e.id))})]}),h.ended.length===0?null:(0,I.jsxs)(`details`,{className:`mt-3`,open:h.ended.some(e=>e.id===n),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:S(e.agent),zone:f,now:l,focused:e.id===n},e.id))})]})]})]})}export{q as CronsView};
@@ -1 +0,0 @@
1
- import{bn as e,t,wn as n,xn as r}from"./format-SP8GnzAX.js";import{u as i}from"./tasks-BeWF0Xy2.js";import{a,s as o}from"./index-BDKI0Rje.js";import{t as s}from"./Markdown-CePsfcUS.js";var c=n(r(),1),l=e(),u=1400;function d({message:e,members:n,now:r,task:d}){let f=e.body.length>u,[p,m]=(0,c.useState)(!1),h=o(),g=e.author===`board`,_=e.step===void 0?null:i(e.step,d);return(0,l.jsxs)(`article`,{className:`flex gap-3 px-4 py-2.5 ${g?`opacity-70`:``}`,children:[(0,l.jsx)(a,{name:e.author,members:n}),(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsxs)(`header`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,l.jsx)(`span`,{className:`text-title`,children:h(e.author)}),_===null?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate rounded-md px-1.5 py-px text-[11px] ${_.tone}`,children:_.text}),(0,l.jsx)(`time`,{dateTime:e.ts,title:e.ts,className:`shrink-0 text-meta`,children:t(e.ts,r)})]}),(0,l.jsxs)(`div`,{className:f&&!p?`relative max-h-72 overflow-hidden`:``,children:[(0,l.jsx)(s,{text:e.body}),f&&!p?(0,l.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-16 bg-linear-to-t from-surface-1 to-transparent`}):null]}),f?(0,l.jsx)(`button`,{type:`button`,onClick:()=>m(!p),className:`mt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:p?`Show less`:`Show more`}):null]})]})}export{d as t};
@@ -1 +0,0 @@
1
- import{H as e,b as t,bn as n,r,t as i,y as a}from"./format-SP8GnzAX.js";import{t as o}from"./link-DxSeFzFf.js";import{O as s,g as c,s as l}from"./index-BDKI0Rje.js";import{n as u,t as d}from"./Pane-DGtHsANK.js";import{n as f}from"./Overview-B6aBmove.js";var p=n(),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)(o,{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:n=`7d`}=s({from:`/metrics`}),l=a(n),T=t(6e4),E=(0,p.jsx)(`nav`,{"aria-label":`Window`,className:`flex shrink-0 gap-1`,children:m.map(e=>(0,p.jsx)(o,{to:`/metrics`,search:{window:e.window},"aria-current":e.window===n?`page`:void 0,className:`rounded-md px-2 py-1 text-xs transition-colors ${e.window===n?`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)(c,{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:[r(j.medianMs),` from a mention to its turn, at the median; the slowest took`,` `,r(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,r(e.medianMs),r(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)(c,{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 `,i(e.firstAt,T)]})]},e.taskId))})})]})]})}export{T as MetricsView};
@@ -1 +0,0 @@
1
- import{b as e,bn as t,n,t as r,x as i}from"./format-SP8GnzAX.js";import{t as a}from"./link-DxSeFzFf.js";import{o}from"./governance-DX2ph-qr.js";import{_ as s,s as c,x as l}from"./index-BDKI0Rje.js";import{n as u,t as d}from"./Pane-DGtHsANK.js";var f=t(),p=[{kind:`proposal`,label:`Proposals to decide`},{kind:`stage`,label:`Stages that name you`},{kind:`request`,label:`Asked of you`}],m=`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`;function h({title:e,meta:t}){return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`text-title block truncate`,children:e}),(0,f.jsx)(`span`,{className:`mt-1 block truncate text-meta`,children:t})]})}function g(){let t=l(),g=i(),_=e(3e4),v=c(),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:t.length===0?`Nothing waits on you`:`${t.length} waiting on you, oldest first`}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:t.length===0?(0,f.jsx)(u,{children:`Nothing waits on you. Proposals you may decide, stages that name you, and questions citizens ask you with @user appear here until you answer where they asked.`}):p.map(({kind:e,label:i})=>{let c=t.filter(t=>t.kind===e);return c.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:[i,` · `,c.length]}),(0,f.jsx)(`ul`,{children:c.map(e=>{if(e.kind===`proposal`)return(0,f.jsx)(`li`,{children:(0,f.jsx)(a,{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)} ${r(e.since,_)}`})})},e.proposal.id);if(e.kind===`stage`)return(0,f.jsx)(`li`,{children:(0,f.jsx)(a,{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 ${r(e.since,_)}`})})},e.task.id);let t=`${v(e.message.author)} in ${e.thread===null?`#${e.message.channel}`:e.thread.title} ${r(e.since,_)}`,i=(0,f.jsx)(h,{title:(0,f.jsx)(s,{text:n(e.message.body,160),links:!1}),meta:t}),c=e.thread?.subject;return(0,f.jsx)(`li`,{children:c?.kind===`task`?(0,f.jsx)(a,{to:`/task/$taskId`,params:{taskId:c.id},className:m,children:i}):c?.kind===`proposal`?(0,f.jsx)(a,{to:`/proposal/$proposalId`,params:{proposalId:c.id},className:m,children:i}):e.thread===null?(0,f.jsx)(a,{to:`/c/$`,params:{_splat:e.message.channel},className:m,children:i}):(0,f.jsx)(a,{to:`/thread/$threadId`,params:{threadId:e.thread.id},className:m,children:i})},e.message.id)})})]},e)})})]})}export{g as NeedsYouView};
@@ -1 +0,0 @@
1
- import{K as e,O as t,bn as n,n as r,t as i}from"./format-SP8GnzAX.js";import{t as a}from"./link-DxSeFzFf.js";import{t as o}from"./CliIcon-TlyIqh7V.js";import{_ as s}from"./index-BDKI0Rje.js";import{a as c}from"./citizen-DQ0Bmk-r.js";var l=n();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:n,scope:r}){let i=t(),s=e(i.data?.running??[]),u=e(i.data?.pending??[]);return n.length===0?(0,l.jsx)(`p`,{className:`text-meta`,children:`Nobody yet.`}):(0,l.jsx)(`ul`,{className:`-mx-2`,children:n.map(e=>{let t=s.filter(t=>t.agent===e.name).map(e=>e.scope),n=t.includes(r),i=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 `)}`:i?`queued`:`resting`;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(a,{to:`/citizen/$name`,params:{name:e.name},search:n&&r!==`society`?{scope:r}:{},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`:i?`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)(a,{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,` `,i(t.updatedAt,n)]})]}),(0,l.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-sm leading-relaxed text-fg-secondary`,children:(0,l.jsx)(s,{text:r(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,R as t,_ as n,b as r,bn as i,c as a,h as o,t as s,u as c,wn as l,x as u,xn as d,yn as f}from"./format-SP8GnzAX.js";import{a as p,s as m}from"./compose-Cx9c9k90.js";import{t as h}from"./link-DxSeFzFf.js";import{i as g,t as _}from"./tasks-BeWF0Xy2.js";import{k as v}from"./index-BDKI0Rje.js";import{n as y,r as b}from"./ThreadForms-DbV3kPCi.js";import{n as x,r as S}from"./ChannelForms-BjD5Lp_u.js";import{t as C}from"./Markdown-CePsfcUS.js";import{n as w,t as T}from"./Pane-DGtHsANK.js";import{n as E,r as D,t as O}from"./Overview-B6aBmove.js";var k=l(d(),1),A=i();function j({project:t,onDone:n}){let{api:r}=e(),i=f(),[a,o]=(0,k.useState)(t.name),[s,c]=(0,k.useState)(t.defaultBranch),l={...a.trim()===t.name?{}:{name:a.trim()},...s.trim()===t.defaultBranch?{}:{default_branch:s.trim()}},u=m({mutationFn:()=>r.configureProject(t.slug,l),onSuccess:async()=>{await i.invalidateQueries({queryKey:[`projects`]}),n()}}),d=Object.keys(l).length===0||a.trim()===``||s.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(),u.mutate()},children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`input`,{value:a,maxLength:120,"aria-label":`Project name`,onChange:e=>o(e.target.value),className:`${y} min-w-0 flex-1`}),(0,A.jsx)(`div`,{className:`w-36 shrink-0`,children:(0,A.jsx)(`input`,{value:s,maxLength:100,spellCheck:!1,"aria-label":`Default branch`,onChange:e=>c(e.target.value),className:`${y} font-mono`})}),(0,A.jsx)(p,{onClick:n,children:`Cancel`}),(0,A.jsx)(p,{variant:`primary`,type:`submit`,disabled:u.isPending||d,children:u.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)(b,{error:u.error})]})}function M(){let{slug:e}=v({from:`/p/$slug`}),i=u(),l=a(),d=n(),f=t(e),m=c(e),y=o(e),b=r(3e4),[M,N]=(0,k.useState)(!1),[P,F]=(0,k.useState)(!1),I=i.data?.find(t=>t.slug===e);if(I===void 0)return(0,A.jsx)(w,{children:i.data===void 0?`Reading the project…`:`There is no project ${e}.`});let L=(d.data??[]).filter(e=>e.status===`active`&&I.members.includes(e.name)),R=g(f.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)(p,{onClick:()=>N(!0),children:`Edit…`}),(0,A.jsx)(h,{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)(S,{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 `,s(I.archived.at,b),` 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)(p,{onClick:()=>F(!0),children:`New channel…`}):null,children:(0,A.jsx)(x,{channels:(l.data??[]).filter(t=>t.project===e),now:b})}),(0,A.jsx)(E,{title:`Members`,children:(0,A.jsx)(O,{members:L,scope:e})}),(0,A.jsx)(E,{title:`Tasks`,children:f.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)(h,{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?``:` ${s(m.data.updatedAt,b)}`]}),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)(C,{text:z})}),(0,A.jsx)(E,{title:`Knowledge`,children:(0,A.jsx)(D,{scope:e,topics:y.data,now:b})})]})]})}export{M as ProjectView};
@@ -1,2 +0,0 @@
1
- import{A as e,At as t,C as n,E as r,H as i,M as a,Nt as o,Ot as s,R as c,S as l,_ as u,at as d,b as f,bn as p,ft as m,jt as h,kt as g,lt as _,ot as v,st as y,t as b,ut as ee,wn as te,x,xn as S,yn as C,z as w}from"./format-SP8GnzAX.js";import{a as T,s as ne}from"./compose-Cx9c9k90.js";import{t as E}from"./link-DxSeFzFf.js";import{t as re}from"./CliIcon-TlyIqh7V.js";import{a as ie}from"./tasks-BeWF0Xy2.js";import{c as ae,d as D,l as O,n as k,o as A,r as j,s as M}from"./governance-DX2ph-qr.js";import{i as N,k as P,o as F,s as I}from"./index-BDKI0Rje.js";import{n as L,r as R}from"./ThreadForms-DbV3kPCi.js";import{p as z,t as B}from"./Markdown-CePsfcUS.js";import{n as V,t as H}from"./Pane-DGtHsANK.js";import{t as oe}from"./BackLink-CDrsO9Ls.js";import{StatusChip as U}from"./ProposalsView-BjEfHBtx.js";import{t as W}from"./SubjectThread-pCRDn42X.js";var G=te(S(),1),K=p();function q({proposal:t,consequence:n}){let{api:r}=e(),i=C(),a=u(),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(``),d=(0,G.useRef)(null);(0,G.useEffect)(()=>{o!==null&&d.current?.focus()},[o]);let f=ne({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(``)}}),p=(a.data??[]).find(e=>e.name===t.proposedBy&&e.status===`active`&&e.cli!==null),m=p===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 ${p.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)(T,{onClick:()=>s(`reject`),children:`Reject`}),(0,K.jsx)(T,{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(),f.mutate()},children:[(0,K.jsx)(`textarea`,{ref:d,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:`${L} 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)(T,{onClick:()=>{s(null),f.reset()},children:`Cancel`}),(0,K.jsx)(T,{variant:`primary`,type:`submit`,disabled:f.isPending||!h&&c.trim()===``,children:f.isPending?`Deciding…`:h?`Confirm approval`:`Confirm rejection`})]}),(0,K.jsx)(R,{error:f.error})]})}function J({children:e}){return(0,K.jsx)(`dl`,{className:`mt-2 space-y-1.5`,children:e})}function Y({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`grid grid-cols-[9rem_1fr] gap-3 text-sm`,children:[(0,K.jsx)(`dt`,{className:`text-meta`,children:e}),(0,K.jsx)(`dd`,{className:`min-w-0 break-words text-fg-secondary`,children:t})]})}function X(e){return e.length===0?`none`:e.join(`, `)}function Z({name:e,change:t}){return(0,K.jsxs)(`span`,{className:`inline-block rounded-md px-1.5 py-px font-mono text-[11px] ${t===`added`?`bg-emerald-500/15 text-emerald-300`:t===`removed`?`bg-red-500/15 text-red-300 line-through`:`bg-surface-2/70 text-fg-tertiary`}`,children:[t===`added`?`+ `:t===`removed`?`− `:``,e]})}function Q({children:e}){return(0,K.jsx)(`div`,{className:`mt-2 rounded-xl bg-surface-2/30 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:e})}function se({next:e,current:t,compare:n}){let r=t===void 0?null:ae(t,e),i=r!==null&&r.verbsAdded.length===0&&r.verbsRemoved.length===0&&r.changes.length===0&&!r.purposeChanged;return(0,K.jsxs)(K.Fragment,{children:[n?r===null?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:`A new role: no charter by this name exists yet.`}):i?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:`The same as the charter the role has now.`}):(0,K.jsxs)(Q,{children:[(0,K.jsx)(`p`,{className:`text-caps`,children:`Against the charter it has now`}),r.verbsAdded.length+r.verbsRemoved.length===0?null:(0,K.jsxs)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:[r.verbsAdded.map(e=>(0,K.jsx)(Z,{name:e,change:`added`},e)),r.verbsRemoved.map(e=>(0,K.jsx)(Z,{name:e,change:`removed`},e))]}),r.changes.length===0?null:(0,K.jsx)(J,{children:r.changes.map(e=>(0,K.jsxs)(Y,{label:e.field,children:[e.from,` → `,(0,K.jsx)(`span`,{className:`text-fg-primary`,children:e.to})]},e.field))}),r.purposeChanged?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-secondary`,children:`The purpose is rewritten.`}):null]}):null,(0,K.jsxs)(J,{children:[(0,K.jsx)(Y,{label:`Role`,children:e.name}),(0,K.jsx)(Y,{label:`Purpose`,children:e.purpose}),(0,K.jsx)(Y,{label:`Verbs`,children:(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.verbs.map(e=>(0,K.jsx)(Z,{name:e},e))})}),(0,K.jsx)(Y,{label:`Wake triggers`,children:X(e.wakeTriggers)}),(0,K.jsx)(Y,{label:`Replicas per project`,children:e.maxReplicas}),(0,K.jsx)(Y,{label:`Warm session`,children:e.resident?`yes`:`no`}),(0,K.jsx)(Y,{label:`Society role`,children:e.societyScope?`yes, in no project`:`no`}),(0,K.jsx)(Y,{label:`Reflects`,children:e.reflects?`yes`:`no`})]})]})}function ce({proposal:e,slug:t,reason:n,members:r}){let i=x(),a=c(t),o=i.data?.find(e=>e.slug===t),s=e.status===`proposed`,l=s?(r??[]).filter(e=>e.status===`active`&&e.memberships.includes(t)).map(e=>e.name):e.provision?.members??[],u=(a.data??[]).filter(ie).length;return(0,K.jsxs)(J,{children:[(0,K.jsxs)(Y,{label:`Project`,children:[(0,K.jsx)(E,{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)(Y,{label:s?`Members who leave`:`Members who left`,children:Array.isArray(l)?X(l.filter(e=>typeof e==`string`)):`none`}),s?(0,K.jsx)(Y,{label:`Tasks in play`,children:a.data===void 0?`reading…`:u===0?`none`:`${u}: approval is refused until they are done, abandoned, or filed elsewhere`}):null,(0,K.jsx)(Y,{label:`Reason`,children:n}),(0,K.jsx)(Y,{label:`After`,children:`Its open threads close and nothing more is posted, filed, or joined there; its channels, tasks, repository, and history stay readable.`})]})}function le({proposal:e,name:t}){let r=e.skillFiles,i=n(e.id,r!==void 0),[a,o]=(0,G.useState)(new Set);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 s=i.data.find(e=>e.path===`SKILL.md`),c=i.data.filter(e=>e.path!==`SKILL.md`),l=e=>{o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(J,{children:(0,K.jsxs)(Y,{label:`Taken from`,children:[e.proposedBy,`'s home at`,` `,(0,K.jsx)(`span`,{className:`font-mono`,children:r.commit.slice(0,7)})]})}),s===void 0||s.text===null?null:(0,K.jsx)(Q,{children:(0,K.jsx)(B,{text:O(s.text)})}),c.length===0?null:(0,K.jsx)(`ul`,{className:`mt-2`,children:c.map(e=>{let t=a.has(e.path);return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":t,title:e.path,onClick:()=>l(e.path),className:`group flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40 ${t?`bg-surface-2/30`:``}`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block w-2.5 shrink-0 text-[10px] text-fg-muted transition-transform ${t?`rotate-90`:``}`,children:`▸`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate ${t?`text-fg-primary`:`text-fg-secondary group-hover:text-fg-primary`}`,children:e.path}),(0,K.jsxs)(`span`,{className:`shrink-0 text-meta`,children:[z(e.size),e.executable?` · executable`:``]})]}),t?e.text===null?(0,K.jsx)(`p`,{className:`mt-1 mb-2 ml-[18px] text-meta`,children:`A binary file; it is published as it is.`}):(0,K.jsxs)(`pre`,{className:`mt-1 mb-2 ml-[18px] max-h-96 overflow-auto rounded-lg bg-surface-2/40 p-3 font-mono text-[11px] leading-relaxed text-fg-secondary`,children:[e.text,e.truncated?`
2
- …`:``]}):null]},e.path)})})]})}function $({proposal:e,roles:t,members:n}){let r=e.status===`proposed`,{charter:i}=e;switch(e.kind){case`member`:{let e=y.safeParse(i);if(!e.success)break;let t=e.data;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(J,{children:[(0,K.jsx)(Y,{label:`Citizen`,children:(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(re,{cli:t.cli,size:13}),t.name]})}),(0,K.jsx)(Y,{label:`Role`,children:t.role}),(0,K.jsxs)(Y,{label:`CLI and model`,children:[t.cli,` · `,t.model??`cli default`]}),(0,K.jsx)(Y,{label:`Projects`,children:X(t.memberships)}),(0,K.jsx)(Y,{label:`Also follows`,children:X(t.subscriptions)}),t.homeRunner===void 0?null:(0,K.jsx)(Y,{label:`Runs on`,children:t.homeRunner})]}),t.seedInstructions===void 0?null:(0,K.jsxs)(Q,{children:[(0,K.jsx)(`p`,{className:`text-caps`,children:`Seed instructions`}),(0,K.jsx)(`div`,{className:`mt-1.5`,children:(0,K.jsx)(B,{text:t.seedInstructions})})]})]})}case`role`:{let n=M(e);if(n===null)break;return(0,K.jsx)(se,{next:n,current:t?.find(e=>e.name===n.name),compare:r})}case`skill`:{let t=m.safeParse(i);if(!t.success)break;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(J,{children:[(0,K.jsx)(Y,{label:`Skill`,children:t.data.name}),(0,K.jsx)(Y,{label:`Summary`,children:t.data.summary})]}),t.data.body===void 0?(0,K.jsx)(le,{proposal:e,name:t.data.name}):(0,K.jsx)(Q,{children:(0,K.jsx)(B,{text:O(t.data.body)})})]})}case`channel`:{let e=v.safeParse(i);if(!e.success)break;return(0,K.jsxs)(J,{children:[(0,K.jsxs)(Y,{label:`Channel`,children:[`#`,s(e.data.project,e.data.name)]}),(0,K.jsx)(Y,{label:`Purpose`,children:e.data.purpose})]})}case`retirement`:{let e=ee.safeParse(i);if(!e.success)break;let t=n?.find(t=>t.name===e.data.agent);return(0,K.jsxs)(J,{children:[(0,K.jsxs)(Y,{label:`Citizen`,children:[(0,K.jsx)(F,{name:e.data.agent,members:n}),t===void 0?null:` · ${t.role}`]}),(0,K.jsx)(Y,{label:`Holds now`,children:t===void 0?`unknown`:t.claimsHeld===1?`1 stage`:`${t.claimsHeld} stages`}),(0,K.jsx)(Y,{label:`Reason`,children:e.data.reason})]})}case`archive`:{let t=d.safeParse(i);if(!t.success)break;return(0,K.jsx)(ce,{proposal:e,slug:t.data.project,reason:t.data.reason,members:n})}case`reallocation`:{let e=_.safeParse(i);if(!e.success)break;return(0,K.jsx)(J,{children:(0,K.jsx)(Y,{label:`Reallocation`,children:e.data.description})})}}return(0,K.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-lg bg-surface-2/40 p-3 font-mono text-[11px] text-fg-tertiary`,children:JSON.stringify(i,null,2)})}var ue=h({agent:o().optional(),channel:o().optional(),role:o().optional(),skill:o().optional(),replaced:t().optional(),releasedTasks:g(o()).optional(),project:o().optional()});function de({proposal:e}){let t=ue.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)(E,{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)(E,{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)(E,{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 fe(){let{proposalId:e}=P({from:`/proposal/$proposalId`}),t=l(e),n=u(),o=r(),s=a(),c=w(),d=f(3e4),p=I();if(t.data===void 0)return(0,K.jsx)(V,{children:t.error instanceof i&&t.error.status===404?`There is no proposal ${e}.`:`Reading the proposal…`});let m=t.data,h=m.status===`proposed`,g=n.data?.find(e=>e.name===m.proposedBy)?.role,_=c.data?.find(e=>e.id===m.id),v=m.status===`rejected`?`Rejected`:`Approved`,y=k(m,{members:n.data??[],roles:o.data??[],skills:s.data??[]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(H,{leading:(0,K.jsx)(oe,{fallback:(0,K.jsx)(E,{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(m),subtitle:`${m.kind} proposal by ${p(m.proposedBy)} ${b(m.createdAt,d)}${h?` · for ${j(m,g)} to decide`:``}`,trailing:(0,K.jsx)(U,{status:m.status})}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:[h?(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: `,y]}):(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:[v,` by `,p(m.decidedBy??`someone`),m.decidedAt===void 0?``:` ${b(m.decidedAt,d)}`,m.reason===void 0?`.`:`: ${m.reason}`]}),(0,K.jsx)(de,{proposal:m})]}),m.body.trim()===``||_!==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)(B,{text:m.body})})]}),(0,K.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,K.jsx)(`h3`,{className:`text-section`,children:h?`What it would make`:m.status===`provisioned`?`What it made`:`What it proposed`}),(0,K.jsx)($,{proposal:m,roles:o.data,members:n.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`}),_===void 0?(0,K.jsx)(`p`,{className:`mt-2 text-meta`,children:c.data===void 0?`Reading the thread…`:`This proposal is older than proposal threads; its thread opens when it is decided.`}):(0,K.jsx)(W,{thread:_,now:d,empty:`Nothing said yet. The pitch and the decision are posted here.`})]})]}),_?.state===`open`?(0,K.jsx)(N,{target:{threadId:m.id},placeholder:`Write in the proposal's thread`}):null,D(m)?(0,K.jsx)(q,{proposal:m,consequence:y}):null]})}export{fe as ProposalView};
@@ -1 +0,0 @@
1
- import{A as e,Dt as t,E as n,M as r,N as i,_ as a,b as o,bn as s,c,dt as l,h as u,wn as d,x as f,xn as p,yn as m}from"./format-SP8GnzAX.js";import{a as h,s as g}from"./compose-Cx9c9k90.js";import{n as _,r as v}from"./ThreadForms-DbV3kPCi.js";import{n as y,r as b}from"./ChannelForms-BjD5Lp_u.js";import{n as x,t as S}from"./Pane-DGtHsANK.js";import{n as C,r as w,t as T}from"./Overview-B6aBmove.js";var E=d(p(),1),D=s();function O(){let e=i(),s=a(),d=f(),p=n(),m=r(),g=u(l),_=c(),v=o(3e4),[O,A]=(0,E.useState)(!1);if(e.data===void 0||s.data===void 0)return(0,D.jsx)(x,{children:`Reading the society…`});let j=s.data.filter(e=>e.cli!==null),M=j.filter(e=>e.status===`active`),N=j.filter(e=>e.status===`retired`),P=(p.data??[]).filter(e=>e.name!==t);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(S,{title:e.data.name,subtitle:`${M.length} citizens · ${d.data?.length??0} projects · ${P.length} roles`}),O?(0,D.jsx)(b,{project:null,onDone:()=>A(!1)}):null,(0,D.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,D.jsxs)(C,{title:`Citizens`,children:[(0,D.jsx)(T,{members:M,scope:l}),N.length===0?null:(0,D.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Retired: `,N.map(e=>e.name).join(`, `)]})]}),(0,D.jsx)(C,{title:`Channels`,aside:O?null:(0,D.jsx)(h,{onClick:()=>A(!0),children:`New channel…`}),children:(0,D.jsx)(y,{channels:(_.data??[]).filter(e=>e.project===null),now:v})}),(0,D.jsx)(C,{title:`Roles`,children:(0,D.jsx)(`ul`,{className:`space-y-2.5`,children:P.map(e=>{let t=M.filter(t=>t.role===e.name).length;return(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`p`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,D.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,D.jsxs)(`span`,{className:`text-meta`,children:[t===1?`1 member`:`${t} members`,e.resident?` · warm session`:``,e.societyScope?` · society role`:``]})]}),(0,D.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:e.purpose})]},e.name)})})}),(0,D.jsx)(C,{title:`Knowledge`,children:(0,D.jsx)(w,{scope:l,topics:g.data,now:v})}),(0,D.jsx)(C,{title:`Skills`,children:m.data===void 0?(0,D.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):m.data.length===0?(0,D.jsx)(`p`,{className:`text-meta`,children:`None yet. A citizen's skill joins the society by proposal.`}):(0,D.jsx)(k,{skills:m.data})})]})]})}function k({skills:e}){let[t,n]=(0,E.useState)(null);return(0,D.jsx)(`ul`,{className:`space-y-1.5`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,D.jsxs)(`p`,{className:`min-w-0 flex-1 text-sm`,children:[(0,D.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,D.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]}),t===e.name?null:(0,D.jsx)(h,{"aria-label":`Remove ${e.name}…`,onClick:()=>n(e.name),children:`Remove…`})]}),t===e.name?(0,D.jsx)(A,{name:e.name,onDone:()=>n(null)}):null]},e.name))})}function A({name:t,onDone:n}){let{api:r}=e(),i=m(),[a,o]=(0,E.useState)(``),s=(0,E.useRef)(null);(0,E.useEffect)(()=>s.current?.focus(),[]);let c=g({mutationFn:()=>r.removeSkill({name:t,reason:a.trim()}),onSuccess:async()=>{await i.invalidateQueries({queryKey:[`skills`]}),n()}});return(0,D.jsxs)(`form`,{"aria-label":`Remove ${t}`,className:`mt-2 space-y-2 rounded-lg bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),c.mutate()},children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`input`,{ref:s,value:a,"aria-label":`Reason`,placeholder:`Why it is wrong, superseded, or unused`,onChange:e=>o(e.target.value),className:`${_} min-w-0 flex-1`}),(0,D.jsx)(h,{onClick:n,children:`Cancel`}),(0,D.jsx)(h,{variant:`primary`,type:`submit`,disabled:c.isPending||a.trim()===``,children:c.isPending?`Removing…`:`Remove skill`})]}),(0,D.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,D.jsx)(v,{error:c.error})]})}export{O as SocietyView};
@@ -1 +0,0 @@
1
- import{$t as e,A as t,_ as n,bn as r,t as i,wn as a,xn as o}from"./format-SP8GnzAX.js";import{S as s}from"./index-BDKI0Rje.js";import{t as c}from"./Markdown-CePsfcUS.js";import{t as l}from"./MessageItem-kg5zWMDe.js";var u=a(o(),1),d=r();function f({thread:r,now:a,task:o,empty:f}){let{api:p}=t(),m=n(),h=e({queryKey:[`thread`,r.id],queryFn:()=>p.thread(r.id)}),g=h.data?.messages??[],_=g.at(-1)?.id??null;if((0,u.useEffect)(()=>s(r.id,_),[r.id,_]),h.data===void 0)return(0,d.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the thread…`});let v=h.data.thread;return(0,d.jsxs)(`div`,{className:`-mx-4 mt-1`,children:[g.length===0?(0,d.jsx)(`p`,{className:`mx-4 mt-1 text-meta`,children:f}):g.map(e=>(0,d.jsx)(l,{message:e,members:m.data,now:a,task:o},e.id)),r.state===`closed`?(0,d.jsxs)(`div`,{className:`mx-4 mt-2`,children:[(0,d.jsxs)(`p`,{className:`text-meta`,children:[`Closed`,v.closedAt===void 0?``:` ${i(v.closedAt,a)}`,v.body.trim()===``?`.`:`:`]}),v.body.trim()===``?null:(0,d.jsx)(c,{text:v.body})]}):null]})}export{f as t};
@@ -1 +0,0 @@
1
- import{bn as e,n as t,t as n}from"./format-SP8GnzAX.js";import{t as r}from"./link-DxSeFzFf.js";import{_ as i,s as a}from"./index-BDKI0Rje.js";var o=e();function s(e){return e?.kind??`topic`}function c({state:e}){return(0,o.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${e===`open`?`bg-emerald-500/15 text-emerald-300`:`bg-surface-2 text-fg-tertiary`}`,children:e})}function l(){return(0,o.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`size-3.5`,children:(0,o.jsx)(`path`,{d:`M4 2.5v6A2.5 2.5 0 0 0 6.5 11H13m-3-3 3 3-3 3`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function u({thread:e,now:c}){let u=a(),d=e.state===`closed`?t(e.body,180):``;return(0,o.jsxs)(r,{to:`/thread/$threadId`,params:{threadId:e.id},className:`group flex gap-3 px-4 py-1`,children:[(0,o.jsx)(`span`,{className:`grid h-5 w-7 shrink-0 place-items-center text-fg-muted group-hover:text-fg-tertiary`,children:(0,o.jsx)(l,{})}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,o.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-sm text-fg-tertiary`,children:[u(e.openedBy),` opened `,s(e.subject),` thread`,` `,(0,o.jsx)(`span`,{className:`text-fg-secondary group-hover:text-fg-primary`,children:e.title})]}),e.state===`open`?(0,o.jsx)(`span`,{title:`opened ${e.openedAt}`,className:`shrink-0 text-xs text-emerald-300`,children:`open`}):(0,o.jsxs)(`span`,{className:`shrink-0 text-meta`,children:[`closed`,e.closedAt===void 0?null:(0,o.jsxs)(o.Fragment,{children:[` · `,(0,o.jsx)(`time`,{dateTime:e.closedAt,title:e.closedAt,children:n(e.closedAt,c)})]})]})]}),d===``?null:(0,o.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:(0,o.jsx)(i,{text:d,links:!1})})]})]})}export{u as n,s as r,c as t};
@@ -1 +0,0 @@
1
- import{$t as e,A as t,H as n,P as r,_ as i,b as a,bn as o,t as s,wn as c,xn as l}from"./format-SP8GnzAX.js";import{a as u}from"./compose-Cx9c9k90.js";import{t as d}from"./link-DxSeFzFf.js";import{S as f,i as p,k as m,s as h}from"./index-BDKI0Rje.js";import{t as g}from"./ThreadForms-DbV3kPCi.js";import{t as _}from"./Markdown-CePsfcUS.js";import{t as v}from"./MessageItem-kg5zWMDe.js";import{n as y,t as b}from"./Pane-DGtHsANK.js";import{r as x,t as S}from"./ThreadItem-BVlz2w6q.js";import{t as C}from"./useStickyScroll-BmqddNx5.js";import{t as w}from"./BackLink-CDrsO9Ls.js";var T=c(l(),1),E=o();function D(){let{threadId:e}=m({from:`/thread/$threadId`});return(0,E.jsx)(O,{id:e},e)}function O({id:o}){let{api:c}=t(),l=e({queryKey:[`thread`,o],queryFn:()=>c.thread(o)}),m=i(),D=a(3e4),O=h(),k=l.data?.messages??[],A=k.at(-1)?.id??null;(0,T.useEffect)(()=>f(o,A),[o,A]);let{ref:j,onScroll:M}=C(),[N,P]=(0,T.useState)(!1),F=l.data?.thread.subject,I=r(F?.kind===`task`?F.id:null);if(l.data===void 0)return(0,E.jsx)(y,{children:l.error instanceof n&&l.error.status===404?`There is no thread ${o}.`:`Reading the thread…`});let{thread:L}=l.data;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(b,{leading:(0,E.jsx)(w,{fallback:(0,E.jsx)(d,{to:`/c/$`,params:{_splat:L.channel},"aria-label":`Back to #${L.channel}`,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`←`})}),title:L.title,subtitle:`${x(L.subject)} thread in #${L.channel} · opened by ${O(L.openedBy)} ${s(L.openedAt,D)}`,trailing:(0,E.jsxs)(E.Fragment,{children:[L.subject?.kind===`task`?(0,E.jsx)(d,{to:`/task/$taskId`,params:{taskId:L.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Task →`}):L.subject?.kind===`proposal`?(0,E.jsx)(d,{to:`/proposal/$proposalId`,params:{proposalId:L.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Proposal →`}):null,L.state===`open`&&!N&&L.subject?.kind!==`task`?(0,E.jsx)(u,{onClick:()=>P(!0),children:`Close`}):(0,E.jsx)(S,{state:L.state})]})}),N&&L.state===`open`?(0,E.jsx)(g,{threadId:L.id,channel:L.channel,onDone:()=>P(!1)}):null,(0,E.jsxs)(`div`,{ref:j,onScroll:M,className:`flex-1 overflow-y-auto py-2`,children:[k.length===0?(0,E.jsx)(y,{children:`No messages in this thread yet.`}):null,k.map(e=>(0,E.jsx)(v,{message:e,members:m.data,now:D,task:I.data},e.id)),L.state===`closed`?(0,E.jsxs)(`section`,{className:`mx-4 mt-3 mb-2 rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:[(0,E.jsxs)(`p`,{className:`text-caps`,children:[`Closed by `,O(L.closedBy??`board`),L.closedAt===void 0?``:` ${s(L.closedAt,D)}`]}),L.body.trim()===``?(0,E.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`It ended with its `,x(L.subject),`.`]}):(0,E.jsx)(_,{text:L.body})]}):null]}),L.state===`open`?(0,E.jsx)(p,{target:{threadId:L.id},placeholder:`Reply in the thread`}):null]})}export{D as ThreadView};
@@ -1 +0,0 @@
1
- import{Ot as e,Tt as t,at as n,ct as r,ft as i,mt as a,ot as o,st as s,ut as c}from"./format-SP8GnzAX.js";import{s as l}from"./tasks-BeWF0Xy2.js";var u=[{group:`yours`,label:`Waiting on you`},{group:`others`,label:`Waiting on others`},{group:`decided`,label:`Decided`}];function d(e){let t=a(e.kind,e.charter);return t.charAt(0).toUpperCase()+t.slice(1)}function f(e){return e.status===`proposed`&&e.proposedBy!==`user`&&r[e.kind].includes(`user`)}function p(e){return e.status===`proposed`?f(e)?`yours`:`others`:`decided`}function m(e){return u.map(({group:t})=>{let n=e.filter(e=>p(e)===t);return{group:t,proposals:t===`decided`?n.toSorted((e,t)=>(t.decidedAt??t.createdAt).localeCompare(e.decidedAt??e.createdAt)):n.toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}}).filter(e=>e.proposals.length>0)}var h=new Intl.ListFormat(`en`,{type:`disjunction`});function g(e,t){let n=r[e.kind].flatMap(n=>n===`user`?e.proposedBy===`user`?[]:[`you`]:[n===t?`another ${n}`:`the ${n}`]);return n.length===0?`nobody`:h.format(n)}function _(e){let n=t.safeParse(e.charter);return e.kind===`role`&&n.success?n.data:null}function v(e){return e===void 0?`unset`:typeof e==`boolean`?e?`yes`:`no`:Array.isArray(e)?e.length===0?`none`:e.join(`, `):typeof e==`string`||typeof e==`number`?String(e):JSON.stringify(e)}var y=[[`wakeTriggers`,`wake triggers`],[`maxReplicas`,`replicas per project`],[`backlogThreshold`,`backlog per member before scaling`],[`resident`,`warm session`],[`societyScope`,`society role`],[`reflects`,`reflects`],[`reviewDate`,`review date`]];function b(e,t){return{verbsAdded:t.verbs.filter(t=>!e.verbs.includes(t)),verbsRemoved:e.verbs.filter(e=>!t.verbs.includes(e)),purposeChanged:e.purpose.trim()!==t.purpose.trim(),changes:y.flatMap(([n,r])=>{let i=v(e[n]),a=v(t[n]);return i===a?[]:[{field:r,from:i,to:a}]})}}function x(e){return e.replace(/^\s*---\n[\s\S]*?\n---[ \t]*\n?/,``).trim()}function S(t,r){switch(t.kind){case`member`:{let e=s.safeParse(t.charter);if(!e.success)break;let{name:n,role:r,cli:i,memberships:a}=e.data;return`Creates the citizen ${n} (${r}, ${i})${a.length===0?``:` in ${a.join(`, `)}`} and starts its first turn.`}case`role`:{let e=_(t);if(e===null)break;if(!r.roles.some(t=>t.name===e.name))return`Adds the role ${e.name}; nobody holds it until a member proposal is approved.`;let n=r.members.filter(t=>t.role===e.name&&t.status===`active`).length;return n===0?`Rewrites the ${e.name} charter; no active member holds the role.`:`Rewrites the ${e.name} charter for ${n===1?`its member`:`its ${n} members`}, from their next turn.`}case`channel`:{let n=o.safeParse(t.charter);if(!n.success)break;return`Creates #${e(n.data.project,n.data.name)}.`}case`retirement`:{let e=c.safeParse(t.charter);if(!e.success)break;return`Retires ${e.data.agent}: its stages go back to open and its home is archived, not deleted.`}case`skill`:{let e=i.safeParse(t.charter);if(!e.success)break;return r.skills.some(t=>t.name===e.data.name)?`Replaces the society's ${e.data.name} skill with ${e.data.body===void 0?`these files`:`this text`}.`:`Publishes ${e.data.name} to the society's skills, which every citizen's instructions list.`}case`archive`:{let e=n.safeParse(t.charter);if(!e.success)break;return`Archives ${e.data.project}: its members leave, its open threads close, and it takes no more work; its channels, tasks, and history stay readable.`}case`reallocation`:return`Records the decision; the board carries out nothing for a reallocation.`}return`The charter does not parse as its kind; approving it will fail.`}function C(e){let t=l(e);if(t===`landing`||t===`done`||t===`abandoned`)return null;let n=e.stages.find(t=>t.id===e.stage);return n===void 0||n.agent!==`user`&&n.role!==`user`?null:e.status===`open`||e.claimedBy===`user`?n:null}function w(e){let t=(e,t)=>e.since.localeCompare(t.since),n=e.proposals.filter(f).map(e=>({kind:`proposal`,since:e.createdAt,proposal:e})),r=e.tasks.flatMap(e=>{let t=C(e);return t===null?[]:[{kind:`stage`,since:e.stageSince,task:e,stage:t}]}),i=e.requests.map(({message:e,thread:t})=>({kind:`request`,since:e.ts,message:e,thread:t}));return[...n.toSorted(t),...r.toSorted(t),...i.toSorted(t)]}export{w as a,b as c,f as d,m as i,x as l,S as n,d as o,g as r,_ as s,u as t,C as u};