@kubitnodes/stellaris 0.4.0 → 0.4.2

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 (59) hide show
  1. package/dist/cli/index.js +644 -36
  2. package/dist/server/index.js +901 -116
  3. package/package.json +1 -1
  4. package/web/dist/assets/{BackLink-BLiSCuKv.js → BackLink-DNHWkHmh.js} +1 -1
  5. package/web/dist/assets/{Button-D4-iu6aX.js → Button-B6EN7Lh7.js} +1 -1
  6. package/web/dist/assets/{ChannelForms-DjviQfVm.js → ChannelForms-BrcWrkej.js} +1 -1
  7. package/web/dist/assets/ChannelView-D7bT7d9q.js +2 -0
  8. package/web/dist/assets/CitizenView-D6d1KnS6.js +2 -0
  9. package/web/dist/assets/{CitizensView-DXD3qkq1.js → CitizensView-C55zOiYE.js} +1 -1
  10. package/web/dist/assets/{CliIcon-DL4ZwgZv.js → CliIcon-BRq1tnhu.js} +1 -1
  11. package/web/dist/assets/{CronsView-CX_G5D3h.js → CronsView-BTGiqn10.js} +1 -1
  12. package/web/dist/assets/{FileTree-BFa_KVI8.js → FileTree-BDhtTIzT.js} +1 -1
  13. package/web/dist/assets/{FileView-Cd9Ijarf.js → FileView-BkZPGEbO.js} +2 -2
  14. package/web/dist/assets/{KnowledgeView-D_a4pjGV.js → KnowledgeView-BiTS-lyE.js} +1 -1
  15. package/web/dist/assets/{Markdown-DPqvK--4.js → Markdown-DYk-gVwe.js} +4 -4
  16. package/web/dist/assets/{MessageItem-WBTzWwyj.js → MessageItem-WBBIzv48.js} +1 -1
  17. package/web/dist/assets/MetricsView-CYmnG6aQ.js +1 -0
  18. package/web/dist/assets/NeedsYouView-B-5olhZL.js +1 -0
  19. package/web/dist/assets/{Overview-BGUnf6K1.js → Overview-BO_lR1cu.js} +1 -1
  20. package/web/dist/assets/{Pane-C9TbEME4.js → Pane-DFJdAhv9.js} +1 -1
  21. package/web/dist/assets/{Picker-BK48MjLY.js → Picker-CAEREZF9.js} +1 -1
  22. package/web/dist/assets/{ProjectView-sL3aGAC6.js → ProjectView-LU59V2vh.js} +1 -1
  23. package/web/dist/assets/ProposalView-DHemTlkc.js +1 -0
  24. package/web/dist/assets/{ProposalsView-DTGx8NDn.js → ProposalsView-DBIOJAul.js} +1 -1
  25. package/web/dist/assets/{Quota-BkF7pa0u.js → Quota-D6_yyawu.js} +1 -1
  26. package/web/dist/assets/RunnersView-BNKgYuNw.js +1 -0
  27. package/web/dist/assets/{SkillFileList-BUpKUkaG.js → SkillFileList-Ntyv8noL.js} +1 -1
  28. package/web/dist/assets/SkillView-Dez1fvqU.js +1 -0
  29. package/web/dist/assets/{SocietyView-JSdVE50m.js → SocietyView-CbmbQXHi.js} +1 -1
  30. package/web/dist/assets/{StickyList-DafbJutb.js → StickyList-Q0KEWBUl.js} +1 -1
  31. package/web/dist/assets/{SubjectThread-Jyl5YCFL.js → SubjectThread-1PnxxtZc.js} +1 -1
  32. package/web/dist/assets/{TaskView-Jke2pVGT.js → TaskView-CcIlNHBh.js} +2 -2
  33. package/web/dist/assets/{TasksView-zJTIaqEA.js → TasksView-BkTU43PD.js} +1 -1
  34. package/web/dist/assets/{ThreadForms-DwUOktyP.js → ThreadForms-BlOEvY5E.js} +1 -1
  35. package/web/dist/assets/ThreadItem-D5N_Fw1K.js +1 -0
  36. package/web/dist/assets/{ThreadView-CdQpBb7M.js → ThreadView-BaYV77mQ.js} +1 -1
  37. package/web/dist/assets/{citizen-BOn5BBRL.js → citizen-BRg9UIgD.js} +1 -1
  38. package/web/dist/assets/{compose-D-X3BQgY.js → compose-BnOoMY1c.js} +1 -1
  39. package/web/dist/assets/format-hyYD8qd8.js +55 -0
  40. package/web/dist/assets/governance-D4hlG-xw.js +1 -0
  41. package/web/dist/assets/index-5CbC_NpF.js +24 -0
  42. package/web/dist/assets/{index-CA_njyMe.css → index-vxBI4BYp.css} +1 -1
  43. package/web/dist/assets/{mentions-S-r32HKM.js → mentions-Ckktc7nR.js} +1 -1
  44. package/web/dist/assets/{tasks-D_Fy7dtN.js → tasks-CFVtN9TK.js} +1 -1
  45. package/web/dist/assets/useMatch-BCaBBHc2.js +1 -0
  46. package/web/dist/favicon.svg +89 -4
  47. package/web/dist/index.html +9 -9
  48. package/web/dist/assets/ChannelView-B-0H7Ps8.js +0 -2
  49. package/web/dist/assets/CitizenView-gE5GgCBa.js +0 -2
  50. package/web/dist/assets/MetricsView-YUkYixqT.js +0 -1
  51. package/web/dist/assets/NeedsYouView-CE_B9bZQ.js +0 -1
  52. package/web/dist/assets/ProposalView-BhZR4MIR.js +0 -1
  53. package/web/dist/assets/RunnersView-Bl62pXNw.js +0 -1
  54. package/web/dist/assets/SkillView-BQJApSh7.js +0 -1
  55. package/web/dist/assets/ThreadItem-Blx8gSvO.js +0 -1
  56. package/web/dist/assets/format-Dhd2NUB3.js +0 -55
  57. package/web/dist/assets/governance-CWzi7hzX.js +0 -1
  58. package/web/dist/assets/index-iplooQqq.js +0 -24
  59. package/web/dist/assets/useMatch-DZXCHHaG.js +0 -1
@@ -1,5 +1,90 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
2
- <rect width="32" height="32" rx="7" fill="#0a0a0a"/>
3
- <circle cx="16" cy="16" r="9" fill="#f5f5f5" opacity="0.08"/>
4
- <path d="M16 6 L18 14 L26 16 L18 18 L16 26 L14 18 L6 16 L14 14 Z" fill="#f5f5f5"/>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
2
+ <defs>
3
+ <linearGradient id="ground" x1="50%" y1="0%" x2="50%" y2="100%">
4
+ <stop offset="0" stop-color="#242830"/>
5
+ <stop offset="1" stop-color="#11141a"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <rect width="1024" height="1024" rx="224" fill="url(#ground)"/>
9
+ <g id="03-meteor-right" opacity="0.65">
10
+ <defs>
11
+ <linearGradient id="color-03-meteor-right" gradientUnits="userSpaceOnUse" x1="890" y1="442" x2="640" y2="590">
12
+ <stop offset="0" stop-color="#bcb1f4" stop-opacity="0"/>
13
+ <stop offset="0.35" stop-color="#bcb1f4" stop-opacity="0.14"/>
14
+ <stop offset="0.7" stop-color="#b8d5f3" stop-opacity="0.55"/>
15
+ <stop offset="1" stop-color="#dffff8" stop-opacity="0.95"/>
16
+ </linearGradient>
17
+ </defs>
18
+ <path d="M890 442 L634.498211 580.706437 Q634.836909 593.05655 645.501789 599.293563 Z" fill="url(#color-03-meteor-right)" opacity="0.2"/>
19
+ <path d="M890 442 L638.013243 586.643991 Q634.836909 593.05655 641.986757 593.356009 Z" fill="url(#color-03-meteor-right)"/>
20
+ <circle cx="640" cy="590" r="6" fill="#c9eee9" opacity="0.5"/>
21
+ <circle cx="640" cy="590" r="2.7" fill="#f4fffc"/>
22
+ </g>
23
+ <g id="02-meteor-lower" opacity="0.75">
24
+ <defs>
25
+ <linearGradient id="color-02-meteor-lower" gradientUnits="userSpaceOnUse" x1="425" y1="650" x2="130" y2="865">
26
+ <stop offset="0" stop-color="#bcb1f4" stop-opacity="0"/>
27
+ <stop offset="0.35" stop-color="#bcb1f4" stop-opacity="0.14"/>
28
+ <stop offset="0.7" stop-color="#b8d5f3" stop-opacity="0.55"/>
29
+ <stop offset="1" stop-color="#dffff8" stop-opacity="0.95"/>
30
+ </linearGradient>
31
+ </defs>
32
+ <path d="M425 650 L122.578778 854.817394 Q124.342997 869.122901 137.421222 875.182606 Z" fill="url(#color-02-meteor-lower)" opacity="0.2"/>
33
+ <path d="M425 650 L127.320114 861.322948 Q124.342997 869.122901 132.679886 868.677052 Z" fill="url(#color-02-meteor-lower)"/>
34
+ <circle cx="130" cy="865" r="7" fill="#c9eee9" opacity="0.5"/>
35
+ <circle cx="130" cy="865" r="3.15" fill="#f4fffc"/>
36
+ </g>
37
+ <g id="01-meteor-upper" opacity="1">
38
+ <defs>
39
+ <linearGradient id="color-01-meteor-upper" gradientUnits="userSpaceOnUse" x1="580" y1="10" x2="200" y2="235">
40
+ <stop offset="0" stop-color="#bcb1f4" stop-opacity="0"/>
41
+ <stop offset="0.35" stop-color="#bcb1f4" stop-opacity="0.14"/>
42
+ <stop offset="0.7" stop-color="#b8d5f3" stop-opacity="0.55"/>
43
+ <stop offset="1" stop-color="#dffff8" stop-opacity="0.95"/>
44
+ </linearGradient>
45
+ </defs>
46
+ <path d="M580 10 L191.746229 221.060299 Q192.255721 239.585428 208.253771 248.939701 Z" fill="url(#color-01-meteor-upper)" opacity="0.2"/>
47
+ <path d="M580 10 L197.019472 229.966219 Q192.255721 239.585428 202.980528 240.033781 Z" fill="url(#color-01-meteor-upper)"/>
48
+ <circle cx="200" cy="235" r="9" fill="#c9eee9" opacity="0.5"/>
49
+ <circle cx="200" cy="235" r="4.05" fill="#f4fffc"/>
50
+ </g>
51
+ <g id="06-star-lower" opacity="1">
52
+ <defs>
53
+ <linearGradient id="color-06-star-lower" x1="10%" y1="0%" x2="90%" y2="100%">
54
+ <stop offset="0" stop-color="#e4fcff"/>
55
+ <stop offset="0.24" stop-color="#d0c5ff"/>
56
+ <stop offset="0.42" stop-color="#fff9ff"/>
57
+ <stop offset="0.58" stop-color="#f7c8e9"/>
58
+ <stop offset="0.8" stop-color="#c0efeb"/>
59
+ <stop offset="1" stop-color="#fff1c3"/>
60
+ </linearGradient>
61
+ </defs>
62
+ <path d="M0 -1 C.12 -.33 .2 -.17 1 0 C.2 .17 .12 .33 0 1 C-.12 .33 -.2 .17 -1 0 C-.2 -.17 -.12 -.33 0 -1Z" transform="translate(720 760) rotate(-20) scale(130 150)" fill="url(#color-06-star-lower)"/>
63
+ </g>
64
+ <g id="05-star-upper" opacity="1">
65
+ <defs>
66
+ <linearGradient id="color-05-star-upper" x1="10%" y1="0%" x2="90%" y2="100%">
67
+ <stop offset="0" stop-color="#e4fcff"/>
68
+ <stop offset="0.24" stop-color="#d0c5ff"/>
69
+ <stop offset="0.42" stop-color="#fff9ff"/>
70
+ <stop offset="0.58" stop-color="#f7c8e9"/>
71
+ <stop offset="0.8" stop-color="#c0efeb"/>
72
+ <stop offset="1" stop-color="#fff1c3"/>
73
+ </linearGradient>
74
+ </defs>
75
+ <path d="M0 -1 C.12 -.33 .2 -.17 1 0 C.2 .17 .12 .33 0 1 C-.12 .33 -.2 .17 -1 0 C-.2 -.17 -.12 -.33 0 -1Z" transform="translate(725 265) rotate(19) scale(153 177)" fill="url(#color-05-star-upper)"/>
76
+ </g>
77
+ <g id="04-star-large" opacity="1">
78
+ <defs>
79
+ <linearGradient id="color-04-star-large" x1="10%" y1="0%" x2="90%" y2="100%">
80
+ <stop offset="0" stop-color="#e4fcff"/>
81
+ <stop offset="0.24" stop-color="#d0c5ff"/>
82
+ <stop offset="0.42" stop-color="#fff9ff"/>
83
+ <stop offset="0.58" stop-color="#f7c8e9"/>
84
+ <stop offset="0.8" stop-color="#c0efeb"/>
85
+ <stop offset="1" stop-color="#fff1c3"/>
86
+ </linearGradient>
87
+ </defs>
88
+ <path d="M0 -1 C.12 -.33 .2 -.17 1 0 C.2 .17 .12 .33 0 1 C-.12 .33 -.2 .17 -1 0 C-.2 -.17 -.12 -.33 0 -1Z" transform="translate(355 500) rotate(-14) scale(240 275)" fill="url(#color-04-star-large)"/>
89
+ </g>
5
90
  </svg>
@@ -6,15 +6,15 @@
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-iplooQqq.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/format-Dhd2NUB3.js">
11
- <link rel="modulepreload" crossorigin href="/assets/Button-D4-iu6aX.js">
12
- <link rel="modulepreload" crossorigin href="/assets/useMatch-DZXCHHaG.js">
13
- <link rel="modulepreload" crossorigin href="/assets/compose-D-X3BQgY.js">
14
- <link rel="modulepreload" crossorigin href="/assets/CliIcon-DL4ZwgZv.js">
15
- <link rel="modulepreload" crossorigin href="/assets/tasks-D_Fy7dtN.js">
16
- <link rel="modulepreload" crossorigin href="/assets/governance-CWzi7hzX.js">
17
- <link rel="stylesheet" crossorigin href="/assets/index-CA_njyMe.css">
9
+ <script type="module" crossorigin src="/assets/index-5CbC_NpF.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/format-hyYD8qd8.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/Button-B6EN7Lh7.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/useMatch-BCaBBHc2.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/compose-BnOoMY1c.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/CliIcon-BRq1tnhu.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/tasks-CFVtN9TK.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/governance-D4hlG-xw.js">
17
+ <link rel="stylesheet" crossorigin href="/assets/index-vxBI4BYp.css">
18
18
  </head>
19
19
  <body class="antialiased">
20
20
  <div id="root"></div>
@@ -1,2 +0,0 @@
1
- import{K as e,Kn as t,S as n,Tn as r,V as i,Xn as a,Zt as o,j as s,l as c,qn as l,t as u,v as d,wt as f,x as p}from"./format-Dhd2NUB3.js";import{t as m}from"./Button-D4-iu6aX.js";import{A as h,C as g,i as _,k as v,s as y}from"./index-iplooQqq.js";import{t as b}from"./BackLink-BLiSCuKv.js";import{i as x}from"./ThreadForms-DwUOktyP.js";import{t as S}from"./ChannelForms-DjviQfVm.js";import{t as C}from"./MessageItem-WBTzWwyj.js";import{n as w,t as T}from"./Pane-C9TbEME4.js";import{t as E}from"./StickyList-DafbJutb.js";import{n as D}from"./ThreadItem-Blx8gSvO.js";var O=a(l(),1);function k(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 A(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&&k(r,a)?(r.messages.push(e),r.notices.push(a)):(r={messages:[e],notices:[a]},n.push({kind:`notices`,run:r}))}return n}function j(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 M(e){let t=[...new Set(e)];return t.length<=2?t.join(` and `):`${t.slice(0,-1).join(`, `)}, and ${t.at(-1)??``}`}var N=t();function P(){return(0,N.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`size-3.5`,children:(0,N.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 F({notices:e}){let[t]=e;if(t===void 0)return null;let{did:n,times:r}=j(e);return(0,N.jsxs)(N.Fragment,{children:[n,` knowledge`,` `,t.action===`removed`?(0,N.jsx)(`span`,{className:`text-fg-secondary`,children:t.topic}):(0,N.jsx)(o,{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 I(e){let t=e.notices.filter(e=>e.kind===`knowledge`);return{mark:(0,N.jsx)(P,{}),text:(0,N.jsx)(F,{notices:t})}}function L({run:e,now:t}){let n=y(),r=e.messages.at(-1);if(r===void 0)return null;let{mark:i,text:a}=I(e);return(0,N.jsxs)(`div`,{className:`flex gap-3 px-4 py-1`,children:[(0,N.jsx)(`span`,{className:`grid h-5 w-7 shrink-0 place-items-center text-fg-muted`,children:i}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-3`,children:[(0,N.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-sm text-fg-tertiary`,children:[M(e.messages.map(e=>n(e.author))),` `,a]}),(0,N.jsx)(`time`,{dateTime:r.ts,title:e.messages.map(e=>`${n(e.author)} ${e.ts}`).join(`
2
- `),className:`shrink-0 text-meta`,children:u(r.ts,t)})]})]})}var R=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function z(){let{_splat:e=`general`}=h({from:`/c/$`}),{message:t}=v({from:`/c/$`});return(0,N.jsx)(B,{channel:e,target:t},e)}function B({channel:t,target:a}){let{api:l}=s(),h=r({queryKey:[`channel`,t],queryFn:()=>l.channel(t)}),v=i(),y=d(),k=n(),j=c(),M=p(3e4),[P,F]=(0,O.useState)(!1),[I,z]=(0,O.useState)(!1),B=(0,O.useMemo)(()=>{let e=(h.data??[]).map(e=>({kind:`message`,at:e.ts,id:e.id,message:e})),n=(v.data??[]).filter(e=>e.channel===t).map(e=>({kind:`thread`,at:e.openedAt,id:e.id,thread:e}));return[...e,...n].toSorted((e,t)=>e.at.localeCompare(t.at)||e.id.localeCompare(t.id))},[h.data,v.data,t]),V=(0,O.useMemo)(()=>A(B,e=>e.kind===`message`?e.message:void 0),[B]),H=h.data?.at(-1)?.id??null;(0,O.useEffect)(()=>g(t,H),[t,H]);let[U,W]=t.split(`/`),G=W??U??t,K=W===void 0?void 0:k.data?.find(e=>e.slug===U),q=W===void 0?`society`:K?.name??U,J=j.data?.find(e=>e.ref===t)?.archived,Y=K?.archived!==void 0||J!==void 0,X=!Y&&!f(W===void 0?null:U??null,G),Z=B.filter(e=>e.kind===`thread`&&e.thread.state===`open`),Q=W===void 0||U===void 0?(0,N.jsx)(o,{to:`/society`,"aria-label":`Back to the society`,className:R,children:`←`}):(0,N.jsx)(o,{to:`/p/$slug`,params:{slug:U},"aria-label":`Back to ${q}`,className:R,children:`←`});return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(T,{leading:(0,N.jsx)(b,{fallback:Q}),title:`# ${G}`,subtitle:`${q} · ${h.data?.length??0} messages${Z.length>0?` · ${Z.length} open threads`:``}`,trailing:P||I||Y?null:(0,N.jsxs)(N.Fragment,{children:[X?(0,N.jsx)(m,{onClick:()=>z(!0),children:`Archive…`}):null,(0,N.jsx)(m,{onClick:()=>F(!0),children:`New thread`})]})}),P?(0,N.jsx)(x,{channel:t,onDone:()=>F(!1)}):null,I?(0,N.jsx)(S,{channel:t,onDone:()=>z(!1)}):null,(0,N.jsx)(E,{stick:a===void 0,ids:h.data?.map(e=>e.id),className:`py-2`,children:h.error instanceof e&&h.error.status===404?(0,N.jsxs)(w,{children:[`There is no channel `,t,`.`]}):h.data===void 0?(0,N.jsx)(w,{children:`Reading the channel…`}):B.length===0?(0,N.jsx)(w,{children:`Nothing has been said here yet.`}):V.map(e=>{if(e.kind===`notices`){let t=e.run.messages[0]?.id??``;return(0,N.jsx)(L,{run:e.run,now:M},t)}let{item:t}=e;return t.kind===`message`?(0,N.jsx)(C,{message:t.message,members:y.data,now:M,target:t.id===a},t.id):(0,N.jsx)(D,{thread:t.thread,now:M},t.id)})}),h.data===void 0?null:J===void 0?Y?(0,N.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-meta`,children:[q,` is archived, so its channels are read-only.`]}):(0,N.jsx)(_,{target:{channel:t},placeholder:`Message #${G}`}):(0,N.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-meta`,children:[`Archived `,u(J.at,M),` by `,J.by,`: `,J.reason,`.`]})]})}export{z as ChannelView};
@@ -1,2 +0,0 @@
1
- import{D as e,Gn as t,Gt as n,K as r,Kn as i,O as a,S as o,St as s,U as c,W as l,Wt as u,X as d,Xn as f,Zt as p,a as m,h,j as g,k as _,m as v,o as y,p as b,qn as x,t as S,u as C,v as ee,x as w,y as T,z as E}from"./format-Dhd2NUB3.js";import{n as D,t as O}from"./Button-D4-iu6aX.js";import{t as te}from"./CliIcon-DL4ZwgZv.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-iplooQqq.js";import{t as R}from"./Markdown-DPqvK--4.js";import{n as oe,r as z}from"./ThreadForms-DwUOktyP.js";import{n as B,t as se}from"./Pane-C9TbEME4.js";import{t as ce}from"./StickyList-DafbJutb.js";import{a as le,c as V,f as ue,l as H,m as de,n as fe,o as U,p as W,r as pe,u as me}from"./citizen-BOn5BBRL.js";import{n as G}from"./Picker-BK48MjLY.js";import{t as he}from"./Quota-BkF7pa0u.js";var K=f(x(),1),q=i(),ge={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 _e({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 ve({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)(_e,{label:`Input`,tone:`text-fg-secondary`,children:e.detail}),e.output===null?null:(0,q.jsx)(_e,{label:e.ok===!1?`Returned an error`:`Returned`,tone:e.ok===!1?`text-red-300`:`text-fg-tertiary`,children:e.output})]})]})})}function ye({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)(ve,{step:e,open:t},e.seq))})]})}function be({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 `,S(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 `,ge[e.end.exitReason],` `,S(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 xe=30,Se={turn:`turn`,board:`board`,merge:`both kept`},Ce={turn:`Changed by a turn`,board:`Written by the board`,merge:`Both versions kept`};function we(e){return e.status===`added`?`new`:e.status===`deleted`?`deleted`:e.added===null||e.removed===null?`binary`:`+${e.added} −${e.removed}`}function Te(e){return e.files.map(e=>`${e.path} ${we(e)}`).join(`, `)}function Ee(e){return e.startsWith(`@@`)||e.startsWith(`\\`)?`text-fg-muted`:e.startsWith(`+`)?`text-emerald-300`:e.startsWith(`-`)?`text-red-300`:`text-fg-tertiary`}function De({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 ${Ee(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 Oe({name:e,change:t}){let n=b(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`?Ce.merge:t.kind===`board`?`Written by the board: ${t.subject.replace(/^home: /,``)}.`:t.turnId===void 0?t.subject:(0,q.jsx)(p,{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)(De,{file:e},e.path))]})}function ke({name:e,change:t,now:n}){let[r,i]=(0,K.useState)(!1),a=t.files.length===0?t.subject:Te(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":`${Ce[t.kind]} ${S(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:Se[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:S(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)(Oe,{name:e,change:t}):null]})})}function Ae({name:e}){let[t,n]=(0,K.useState)(xe),r=h(e,t),i=w(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.jsx)(B,{children:`No history yet.`}):(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,q.jsx)(`ol`,{children:a.map(t=>(0,q.jsx)(ke,{name:e,change:t,now:i},t.commit))}),o?(0,q.jsx)(`button`,{type:`button`,onClick:()=>n(t+xe),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 je({member:e,charter:t}){let n=T(e.name),r=y(e.name),i=v(e.name),a=w(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.jsx)(Y,{title:`Edits to reconcile`,children:(0,q.jsx)(`ul`,{className:`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`,` `,S(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.`}):(0,q.jsx)(R,{text:W(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.`}):(0,q.jsx)(R,{text:W(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 Me(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 Ne({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=me(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.heartbeat===void 0?void 0:de(t),d=t.error??t.summary??``,f=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:[U(t.project),l===null?``:` · ${l}`]}),(0,q.jsx)(`span`,{className:`text-fg-muted`,children:t.trigger}),u===void 0?null:(0,q.jsxs)(`span`,{className:`-ml-1 shrink-0 text-fg-muted`,title:u,children:[`· `,t.heartbeat]}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-fg-muted`,children:[fe(t),` `,S(t.ts,n)]}),(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,title:t.usage===void 0?void 0:V(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:`▸`})]}),d.trim()===``?null:(0,q.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-xs leading-relaxed group-open:hidden ${f}`,children:(0,q.jsx)(A,{text:d,links:!1})})]}),i?(0,q.jsx)(Pe,{name:e,entry:t,text:d,tone:f}):null]})})}function Pe({name:e,entry:t,text:n,tone:r}){let i=Me(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)(ye,{steps:i.turn.steps})]})})]})}function Fe({name:e,opened:t}){let[n,r]=(0,K.useState)(X),i=l(e,n),a=w(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=pe(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:V(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.`:`The turn this address opens is not in this citizen's history.`}):null,(0,q.jsx)(`ol`,{children:o.map(n=>(0,q.jsx)(Ne,{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 Ie(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 Le(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 Re({member:e,onDone:n}){let{api:i}=g(),a=t(),o=m(e.name),s=e.model??Z,c=e.effort??Q,[l,u]=(0,K.useState)(s),[d,f]=(0,K.useState)(c),p=D({mutationFn:async()=>{l!==s&&await i.setModel(e.name,l===Z?null:l),d!==c&&await i.setEffort(e.name,d===Q?null:d)},onSettled:()=>void a.invalidateQueries({queryKey:[`members`]}),onSuccess:n}),h=o.data?.models??[],_=e.model!==void 0&&!h.some(t=>t.id===e.model)?e.model:null,v=e=>h.find(t=>e===Z?t.isDefault:t.id===e),y=v(l)?.efforts??[],b=d!==Q&&!y.some(e=>e.id===d)?d:null,x=e=>{u(e);let t=v(e)?.efforts??[];d!==Q&&!t.some(e=>e.id===d)&&f(Q)},S=l!==s||d!==c;return(0,q.jsxs)(`form`,{"aria-label":`Model of ${e.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),p.mutate()},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o.isPending?(0,q.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Asking `,e.cli,` for its models…`]}):o.error===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(G,{label:`Model`,choices:Ie(h,_),value:l,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:Le(v(l),b),value:d,onChange:f,listClassName:`right-0 w-64`})})]}):(0,q.jsxs)(`p`,{role:`alert`,className:`min-w-0 flex-1 truncate text-xs text-red-400`,children:[e.cli,` did not list its models:`,` `,o.error instanceof r?o.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:p.isPending||!S||o.error!==null,children:p.isPending?`Saving…`:`Save`})]}),o.data===void 0?null:(0,q.jsxs)(`p`,{className:`text-meta`,children:[`Listed by `,o.data.cli,` on `,o.data.runner]}),(0,q.jsx)(z,{error:p.error})]})}var $=``;function ze(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 Be(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:ze(e,t)}))]}function Ve({member:e,onDone:n}){let{api:r}=g(),i=t(),o=a(),s=e.homeRunner??$,[c,l]=(0,K.useState)(s),u=D({mutationFn:()=>r.setRunner(e.name,c===$?null:c),onSuccess:()=>{i.invalidateQueries({queryKey:[`members`]}),n()}});return(0,q.jsxs)(`form`,{"aria-label":`Runner of ${e.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),u.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:Be(o.data,e),value:c,onChange:l}),(0,q.jsx)(O,{onClick:n,children:`Cancel`}),(0,q.jsx)(O,{variant:`primary`,type:`submit`,disabled:u.isPending||c===s,children:u.isPending?`Saving…`:`Run here`})]}),(0,q.jsx)(z,{error:u.error})]})}function He(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??u(t,`general`)}:{channel:e.askedIn!==void 0&&n(e.askedIn).project===e.place?e.askedIn:u(e.place,`general`)}:{channel:u(t,e.channel)}}function Ue({name:e,turn:n}){let{api:r}=g(),i=t(),[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:He(n),initialText:`@${e} `,placeholder:n.steerable?`Message ${e} while it works`:`Message ${e} 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?`Stop ${e}'s turn?`: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 We({member:e,scopes:n,preferred:r,running:i,paused:a,onDone:o}){let{api:s}=g(),c=t(),[l,u]=(0,K.useState)(`manual`),[d,f]=(0,K.useState)(r!==null&&n.includes(r)?r:n[0]??``),[p,m]=(0,K.useState)(``),h=(0,K.useRef)(null);(0,K.useEffect)(()=>h.current?.focus(),[]);let _=D({mutationFn:()=>s.wake({agent:e.name,project:d,kind:l,...p.trim()===``?{}:{reason:p.trim()}}),onSuccess:()=>{c.invalidateQueries({queryKey:[`scheduler`]}),o()}}),v=a?`The society is paused.`:i.includes(d)?`${e.name} is in a turn there now.`:null;return(0,q.jsxs)(`form`,{"aria-label":`Wake ${e.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 ${l===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:l===e,onChange:()=>u(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:le(n),value:d,onChange:f})]})]}),(0,q.jsx)(`textarea`,{ref:h,value:p,rows:2,placeholder:l===`reflection`?`What to reflect on, optional`:`What it should look at`,"aria-label":`Reason`,onChange:e=>m(e.target.value),className:`${oe} resize-none`}),v===null?null:(0,q.jsx)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:v}),(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||d===``,children:_.isPending?`Waking…`:l===`reflection`?`Ask for a reflection`:`Wake ${e.name}`})]}),(0,q.jsx)(z,{error:_.error})]})}var Ge={working:`bg-emerald-500/15 text-emerald-300`,queued:`bg-amber-500/15 text-amber-300`,idle:`bg-surface-2 text-fg-tertiary`};function Ke({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)(p,{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:s(e)?.name??e.stage})]})},e.id))})}function qe(){let{name:e}=k({from:`/citizen/$name`}),{scope:t,tab:n,turn:r}=I({from:`/citizen/$name`});return(0,q.jsx)(Ye,{name:e,chosen:t??null,tab:n??`now`,turn:r??null},e)}var Je=[{tab:`now`,label:`Now`},{tab:`turns`,label:`Turns`},{tab:`memory`,label:`Memory`},{tab:`history`,label:`History`}];function Ye({name:t,chosen:n,tab:r,turn:i}){let s=ee(),c=e(),l=_(),u=P(),f=C(),m=a(),h=o(),g=w(3e4),[v,y]=(0,K.useState)(null),b=s.data?.find(e=>e.name===t);if(b===void 0)return(0,q.jsx)(B,{children:s.data===void 0?`Reading the roster…`:`There is no citizen ${t}.`});let x=d(l.data?.running??[]).filter(e=>e.agent===t),S=[...new Set(x.map(e=>e.scope))],T=x.map(e=>ie(e.agent,e.scope,e)),E=d(l.data?.pending??[]).find(e=>e.agent===t),D=S.length>0?`working`:E===void 0?`idle`:`queued`,k=ne(u,t)[0],A=k?.model??b.lastModel,j=A??b.model??`CLI default`,M=b.model!==void 0&&b.model!==A?b.model:null,N=c.data?.find(e=>e.name===b.role),F=ue(b),I=b.status===`active`&&b.cli!==null,L=(f.data??[]).filter(e=>e.agent===t&&e.ended===void 0).length;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(se,{leading:b.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:b.cli,size:20})}),title:t,subtitle:(0,q.jsxs)(q.Fragment,{children:[b.role,` · `,j,M===null?``:` · set to ${M}`,b.effort===void 0?``:` · ${b.effort} effort`,b.homeRunner===void 0?``:` · on ${b.homeRunner}`,b.status===`retired`?` · retired`:``]}),trailing:(0,q.jsxs)(q.Fragment,{children:[L===0?null:(0,q.jsx)(p,{to:`/crons`,search:{agent:t},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&&v===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(O,{onClick:()=>y(`model`),children:`Model…`}),(0,q.jsx)(O,{onClick:()=>y(`runner`),children:`Runner…`}),(0,q.jsx)(O,{onClick:()=>y(`wake`),children:`Wake…`})]}):null,(0,q.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${Ge[D]}`,children:D})]})}),(0,q.jsx)(he,{member:b,runners:m.data??[],placed:new Map((h.data??[]).flatMap(e=>e.runner===void 0?[]:[[e.slug,e.runner]])),now:g}),v===`wake`?(0,q.jsx)(We,{member:b,scopes:F,preferred:n?.split(`/`)[0]??k?.scope??null,running:S,paused:l.data?.paused??!1,onDone:()=>y(null)}):v===`model`?(0,q.jsx)(Re,{member:b,onDone:()=>y(null)}):v===`runner`?(0,q.jsx)(Ve,{member:b,onDone:()=>y(null)}):null,(0,q.jsx)(`nav`,{"aria-label":`Citizen views`,className:`flex gap-1 border-b border-line px-3 py-2`,children:Je.map(e=>(0,q.jsx)(p,{to:`/citizen/$name`,params:{name:t},search:{...n===null?{}:{scope:n},...e.tab===`now`?{}:{tab:e.tab}},replace:!0,"aria-current":e.tab===r?`page`:void 0,className:`rounded-md px-2.5 py-1 text-xs transition-colors ${e.tab===r?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:e.label},e.tab))}),r===`turns`?(0,q.jsx)(Fe,{name:t,opened:i},i):r===`memory`?(0,q.jsx)(je,{member:b,charter:N}):r===`history`?(0,q.jsx)(Ae,{name:t}):(0,q.jsx)(Ze,{name:t,chosen:n,lastTurnAt:b.lastTurnAt,state:D,runningScopes:S,runningKeys:T,runningTurns:(l.data?.turns??[]).filter(e=>e.agent===t),queuedScope:E?.scope??null})]})}function Xe(e){return e.toSorted((e,t)=>e.startedAt.localeCompare(t.startedAt))[0]}function Ze({name:e,chosen:t,lastTurnAt:n,state:r,runningScopes:i,runningKeys:a,runningTurns:o,queuedScope:s}){let c=P(),u=w(5e3),d=ne(c,e),f=l(e,1),m=Me(e,d.length===0?f.data?.at(-1):void 0),h=ae(),g=e=>e.end===null&&a.includes(ie(e.agent,e.scope,e)),_=t?.split(`/`)[0]??null,v=(t?.includes(`/`)===!0?d.find(e=>j(e)===t):void 0)??Xe(d.filter(e=>e.scope===_&&g(e)))??d.find(e=>j(e)===t)??Xe(d.filter(g))??d[0]??m.turn,y=e=>e.thread===void 0?e.channel===void 0?e.place===void 0?U(e.scope):`${U(e.scope)} · ${e.place}'s channels`:`${U(e.scope)} · #${e.channel}`:`${U(e.scope)} · ${h.get(e.thread)?.title??`a thread`}`,b=v!==void 0&&g(v),x=v?.scope??i[0]??s,C=(v===void 0?void 0:o.find(e=>e.scope===v.scope&&e.thread===v.thread&&e.channel===v.channel&&e.place===v.place))??(b?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:b?`In a turn at ${U(v.scope)} for ${v.fromStart?``:`at least `}${L(v.startedAt,u)}`:i.length>0?`In a turn at ${i.map(U).join(` and `)}`:s===null?n===void 0?`No turns yet`:`Last turn ${S(n,u)}`:`Queued for a turn at ${U(s)}`}),x===null||x===`society`?null:(0,q.jsx)(Ke,{project:x,name:e})]}),(0,q.jsx)(ce,{className:`px-4 py-3`,children:v===void 0?(0,q.jsx)(B,{children:r===`working`?`The turn has not reported a step yet.`:m.loading?`Reading the last turn…`:n===void 0?`${e} has not taken a turn yet.`:`${e}'s last turn kept no steps.`}):(0,q.jsxs)(q.Fragment,{children:[d.length>1?(0,q.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,"aria-label":`Turns by conversation`,children:d.toSorted((e,t)=>j(e).localeCompare(j(t))).map(t=>(0,q.jsxs)(p,{to:`/citizen/$name`,params:{name:e},search:{scope:j(t)},replace:!0,"aria-current":t===v?`true`:void 0,className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[11px] transition-colors ${t===v?`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,y(t)]},j(t)))}):null,(0,q.jsxs)(`p`,{className:`text-caps`,children:[b?`This turn`:`Last turn`,` · `,y(v),` · started`,` `,v.fromStart?J(v.startedAt):`before the earliest step shown`]}),(0,q.jsx)(ye,{steps:v.steps}),(0,q.jsx)(be,{turn:v,running:b,now:u})]})}),C===void 0?null:(0,q.jsx)(Ue,{name:e,turn:C})]})}export{qe as CitizenView};
@@ -1 +0,0 @@
1
- import{K as e,Kn as t,Zt as n,b as r,r as i,t as a,x as o}from"./format-Dhd2NUB3.js";import{g as s,k as c,s as l}from"./index-iplooQqq.js";import{n as u,t as d}from"./Pane-C9TbEME4.js";import{t as f}from"./citizen-BOn5BBRL.js";import{n as p}from"./Overview-BGUnf6K1.js";var m=t(),h=[{window:`24h`,label:`24 hours`},{window:`7d`,label:`7 days`},{window:`all`,label:`All time`}],g={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`},_=new Intl.DateTimeFormat(`en`,{month:`short`,day:`numeric`,timeZone:`UTC`});function v(e,t){return t===0?``:`${Math.round(e/t*100)}%`}function y(e){return e.toFixed(1).replace(/\.0$/,``)}function b({part:e,whole:t}){return(0,m.jsxs)(m.Fragment,{children:[e,(0,m.jsx)(`span`,{className:`ml-1.5 inline-block w-9 text-right text-fg-muted`,children:e===0?``:v(e,t)})]})}function x({children:e}){return(0,m.jsx)(`p`,{className:`text-sm text-fg-primary`,children:e})}function S({children:e}){return(0,m.jsx)(`p`,{className:`mt-1 text-meta`,children:e})}function C({label:e,columns:t,rows:n}){return n.length===0?null:(0,m.jsxs)(`table`,{"aria-label":e,className:`mt-3 w-full table-fixed text-sm`,children:[(0,m.jsxs)(`colgroup`,{children:[(0,m.jsx)(`col`,{}),t.slice(1).map(e=>(0,m.jsx)(`col`,{className:`w-24`},e))]}),(0,m.jsx)(`thead`,{children:(0,m.jsx)(`tr`,{children:t.map((e,t)=>(0,m.jsx)(`th`,{scope:`col`,className:`text-caps pb-1 font-normal ${t===0?`text-left`:`text-right`}`,children:e},e))})}),(0,m.jsx)(`tbody`,{children:n.map((e,t)=>(0,m.jsx)(`tr`,{className:`border-t border-line/50`,children:e.map((e,t)=>(0,m.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 w({name:e}){let t=l();return e===`user`?(0,m.jsx)(`span`,{children:t(e)}):(0,m.jsx)(n,{to:`/citizen/$name`,params:{name:e},className:`hover:underline`,children:e})}function T(e){return e.window===`24h`?1:e.window===`7d`?7:Math.max(1,e.decisions.byDay.length)}function E(){let{window:t=`7d`}=c({from:`/metrics`}),l=r(t),E=o(6e4),D=(0,m.jsx)(`nav`,{"aria-label":`Window`,className:`flex shrink-0 gap-1`,children:h.map(e=>(0,m.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))}),O=(0,m.jsx)(d,{title:`Metrics`,trailing:D});if(l.data===void 0)return(0,m.jsxs)(m.Fragment,{children:[O,(0,m.jsx)(u,{children:l.error instanceof e?l.error.message:`Counting the event log…`})]});let{idle:k,sentBack:A,messages:j,latency:M,decisions:N,blocked:P}=l.data,F=T(l.data);return(0,m.jsxs)(m.Fragment,{children:[O,(0,m.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,m.jsxs)(p,{title:`Turns that did nothing`,children:[k.turns===0?(0,m.jsx)(S,{children:`No finished turns in this window.`}):(0,m.jsxs)(x,{children:[k.idle,` of `,k.turns,` working turns changed nothing on the board`,` `,(0,m.jsx)(`span`,{className:`text-fg-muted`,children:v(k.idle,k.turns)})]}),k.unknown>0?(0,m.jsxs)(S,{children:[k.unknown,` `,k.unknown===1?`turn`:`turns`,` kept no transcript and could not be counted.`]}):null,(0,m.jsx)(C,{label:`By what woke them`,columns:[`Woken by`,`Turns`,`Did nothing`],rows:k.byTrigger.map(e=>[`${g[e.trigger]??e.trigger}${e.heartbeat===void 0?``:`, ${f[e.heartbeat]}`}`,e.turns,(0,m.jsx)(b,{part:e.idle,whole:e.turns},`idle`)])}),(0,m.jsx)(C,{label:`By citizen`,columns:[`Citizen`,`Turns`,`Did nothing`],rows:k.byAgent.map(e=>[(0,m.jsxs)(`span`,{children:[(0,m.jsx)(w,{name:e.agent}),e.role===null?null:(0,m.jsxs)(`span`,{className:`text-meta`,children:[` · `,e.role]})]},`who`),e.turns,(0,m.jsx)(b,{part:e.idle,whole:e.turns},`idle`)])})]}),(0,m.jsxs)(p,{title:`Work sent back`,children:[A.finished===0?(0,m.jsx)(S,{children:`No task finished in this window.`}):(0,m.jsxs)(x,{children:[A.tasksSentBack,` of `,A.finished,` finished tasks were sent back,`,` `,A.sendBacks,` `,A.sendBacks===1?`time`:`times`,` in all`]}),(0,m.jsx)(C,{label:`Where work came back from`,columns:[`Came back from`,`Times`],rows:A.byStage.map(e=>[`${e.project} · ${e.stage}`,e.count])}),(0,m.jsx)(C,{label:`Who sent work back`,columns:[`Sent back by`,`Times`],rows:A.bySender.map(e=>[(0,m.jsx)(w,{name:e.agent},`who`),e.count])})]}),(0,m.jsxs)(p,{title:`Messages per finished task`,children:[j.finished===0?(0,m.jsx)(S,{children:`No task finished in this window.`}):(0,m.jsxs)(x,{children:[y(j.messages/j.finished),` posts a task, across`,` `,j.finished,` finished `,j.finished===1?`task`:`tasks`]}),(0,m.jsx)(C,{label:`By project`,columns:[`Project`,`Tasks`,`Posts a task`],rows:j.byProject.map(e=>[e.project,e.finished,y(e.messages/e.finished)])}),(0,m.jsx)(C,{label:`Most talked-over tasks`,columns:[`Task`,`Posts`],rows:j.busiest.map(e=>[(0,m.jsx)(s,{kind:`task`,id:e.taskId,children:e.title},`task`),e.messages])})]}),(0,m.jsxs)(p,{title:`Wake latency`,children:[M.medianMs===null||M.slowestMs===null?(0,m.jsx)(S,{children:`No mention led to a turn in this window.`}):(0,m.jsxs)(x,{children:[i(M.medianMs),` from a mention to its turn, at the median; the slowest took`,` `,i(M.slowestMs)]}),M.unanswered>0?(0,m.jsxs)(S,{children:[M.unanswered,` `,M.unanswered===1?`mention has`:`mentions have`,` no turn yet.`]}):null,(0,m.jsx)(C,{label:`By citizen`,columns:[`Citizen`,`Mentions`,`Median`,`Slowest`],rows:M.byAgent.map(e=>[(0,m.jsx)(w,{name:e.agent},`who`),e.mentions,i(e.medianMs),i(e.slowestMs)])})]}),(0,m.jsxs)(p,{title:`Your decisions`,children:[N.total===0?(0,m.jsx)(S,{children:`You decided nothing in this window.`}):(0,m.jsxs)(x,{children:[N.total,` `,N.total===1?`decision`:`decisions`,`, about`,` `,y(N.total/F),` a day`]}),(0,m.jsx)(C,{label:`By day`,columns:[`Day`,`Proposals`,`Answers`,`Stages`],rows:N.byDay.map(e=>[_.format(new Date(`${e.day}T00:00:00Z`)),e.proposals,e.answers,e.stages])})]}),(0,m.jsx)(p,{title:`Blocked on a capability`,children:P.length===0?(0,m.jsx)(S,{children:`No task waited for a capability no runner offers.`}):(0,m.jsx)(`ul`,{className:`space-y-2`,children:P.map(e=>(0,m.jsxs)(`li`,{children:[(0,m.jsxs)(`p`,{className:`text-sm text-fg-primary`,children:[(0,m.jsx)(s,{kind:`task`,id:e.taskId,children:e.title??e.taskId}),(0,m.jsx)(`span`,{className:e.holds?`text-amber-300`:`text-fg-muted`,children:e.holds?` · blocked now`:` · cleared`})]}),(0,m.jsxs)(`p`,{className:`text-meta`,children:[e.summary,` · since `,a(e.firstAt,E)]})]},e.taskId))})})]})]})}export{E as MetricsView};
@@ -1 +0,0 @@
1
- import{Kn as e,S as t,Zt as n,n as r,t as i,x as a}from"./format-Dhd2NUB3.js";import{o}from"./governance-CWzi7hzX.js";import{S as s,_ as c,s as l}from"./index-iplooQqq.js";import{n as u,t as d}from"./Pane-C9TbEME4.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=t(),_=a(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.`}):p.map(({kind:t,label:a})=>{let s=e.filter(e=>e.kind===t);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)(n,{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)(n,{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 t=`${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:t}),s=e.thread?.subject;return(0,f.jsx)(`li`,{children:s?.kind===`task`?(0,f.jsx)(n,{to:`/task/$taskId`,params:{taskId:s.id},className:m,children:a}):s?.kind===`proposal`?(0,f.jsx)(n,{to:`/proposal/$proposalId`,params:{proposalId:s.id},className:m,children:a}):e.thread===null?(0,f.jsx)(n,{to:`/c/$`,params:{_splat:e.message.channel},className:m,children:a}):(0,f.jsx)(n,{to:`/thread/$threadId`,params:{threadId:e.thread.id},className:m,children:a})},e.message.id)})})]},t)})})]})}export{g as NeedsYouView};
@@ -1 +0,0 @@
1
- import{B as e,C as t,D as n,Gn as r,Jt as i,K as a,Kn as o,Kt as s,P as c,S as l,V as u,Wt as d,Xn as f,Xt as p,Zt as m,_t as h,bt as g,gt as _,ht as v,j as y,mt as b,qn as x,qt as ee,t as S,v as te,vt as ne,w as re,x as ie,xt as ae,z as C}from"./format-Dhd2NUB3.js";import{n as w,t as T}from"./Button-D4-iu6aX.js";import{t as oe}from"./CliIcon-DL4ZwgZv.js";import{a as se}from"./tasks-D_Fy7dtN.js";import{c as E,d as D,l as O,n as k,o as A,r as j,s as M}from"./governance-CWzi7hzX.js";import{A as N,i as P,o as F,s as I}from"./index-iplooQqq.js";import{t as L}from"./BackLink-BLiSCuKv.js";import{t as R}from"./Markdown-DPqvK--4.js";import{n as z,r as B}from"./ThreadForms-DwUOktyP.js";import{n as V,t as ce}from"./Pane-C9TbEME4.js";import{t as H}from"./StickyList-DafbJutb.js";import{t as U}from"./SkillFileList-BUpKUkaG.js";import{StatusChip as W}from"./ProposalsView-DTGx8NDn.js";import{t as G}from"./SubjectThread-Jyl5YCFL.js";var K=f(x(),1),q=o();function le({proposal:e}){let{api:t}=y(),n=r(),[i,a]=(0,K.useState)(null),[o,s]=(0,K.useState)(``),c=(0,K.useRef)(null);(0,K.useEffect)(()=>{i!==null&&c.current?.focus()},[i]);let l=w({mutationFn:()=>{let n=o.trim();return i===`reject`?t.reject({proposal_id:e.id,reason:n}):t.approve({proposal_id:e.id,...n===``?{}:{reason:n}})},onSuccess:()=>{let t=[[`proposals`],[`proposal`,e.id],[`threads`],[`thread`,e.id]];for(let e of t)n.invalidateQueries({queryKey:e});a(null),s(``)}});if(i===null)return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-line px-4 py-3`,children:[(0,q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`This proposal waits on you.`}),(0,q.jsx)(T,{onClick:()=>a(`reject`),children:`Reject`}),(0,q.jsx)(T,{variant:`primary`,onClick:()=>a(`approve`),children:`Approve`})]});let u=i===`approve`;return(0,q.jsxs)(`form`,{"aria-label":u?`Approve the proposal`:`Reject the proposal`,className:`space-y-2 border-t border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),l.mutate()},children:[(0,q.jsx)(`textarea`,{ref:c,value:o,rows:2,placeholder:u?`Why approve? Optional.`:`Why not?`,"aria-label":u?`Reason for approving`:`Reason for rejecting`,onChange:e=>s(e.target.value),className:`${z} resize-none`}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,q.jsx)(T,{onClick:()=>{a(null),l.reset()},children:`Cancel`}),(0,q.jsx)(T,{variant:`primary`,type:`submit`,disabled:l.isPending||!u&&o.trim()===``,children:l.isPending?`Deciding…`:u?`Confirm approval`:`Confirm rejection`})]}),(0,q.jsx)(B,{error:l.error})]})}function J({children:e}){return(0,q.jsx)(`dl`,{className:`mt-2 space-y-1.5`,children:e})}function Y({label:e,children:t}){return(0,q.jsxs)(`div`,{className:`grid grid-cols-[9rem_1fr] gap-3 text-sm`,children:[(0,q.jsx)(`dt`,{className:`text-meta`,children:e}),(0,q.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,q.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,q.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 $({next:e,current:t,compare:n}){let r=t===void 0?null:E(t,e),i=r!==null&&r.verbsAdded.length===0&&r.verbsRemoved.length===0&&r.changes.length===0&&!r.purposeChanged;return(0,q.jsxs)(q.Fragment,{children:[n?r===null?(0,q.jsx)(`p`,{className:`mt-2 text-meta`,children:`A new role: no charter by this name exists yet.`}):i?(0,q.jsx)(`p`,{className:`mt-2 text-meta`,children:`The same as the charter the role has now.`}):(0,q.jsxs)(Q,{children:[(0,q.jsx)(`p`,{className:`text-caps`,children:`Against the charter it has now`}),r.verbsAdded.length+r.verbsRemoved.length===0?null:(0,q.jsxs)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:[r.verbsAdded.map(e=>(0,q.jsx)(Z,{name:e,change:`added`},e)),r.verbsRemoved.map(e=>(0,q.jsx)(Z,{name:e,change:`removed`},e))]}),r.changes.length===0?null:(0,q.jsx)(J,{children:r.changes.map(e=>(0,q.jsxs)(Y,{label:e.field,children:[e.from,` → `,(0,q.jsx)(`span`,{className:`text-fg-primary`,children:e.to})]},e.field))}),r.purposeChanged?(0,q.jsx)(`p`,{className:`mt-2 text-xs text-fg-secondary`,children:`The purpose is rewritten.`}):null]}):null,(0,q.jsxs)(J,{children:[(0,q.jsx)(Y,{label:`Role`,children:e.name}),(0,q.jsx)(Y,{label:`Purpose`,children:e.purpose}),(0,q.jsx)(Y,{label:`Verbs`,children:(0,q.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.verbs.map(e=>(0,q.jsx)(Z,{name:e},e))})}),(0,q.jsx)(Y,{label:`Wake triggers`,children:X(e.wakeTriggers)}),(0,q.jsx)(Y,{label:`Replicas per project`,children:e.maxReplicas}),(0,q.jsx)(Y,{label:`Warm session`,children:e.resident?`yes`:`no`}),(0,q.jsx)(Y,{label:`Society role`,children:e.societyScope?`yes, in no project`:`no`}),(0,q.jsx)(Y,{label:`Reflects`,children:e.reflects?`yes`:`no`})]})]})}function ue({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,q.jsxs)(q.Fragment,{children:[(0,q.jsx)($,{next:ae(n,a),current:n,compare:!0}),(0,q.jsx)(J,{children:(0,q.jsx)(Y,{label:`Why`,children:o})})]}):(0,q.jsxs)(J,{children:[(0,q.jsx)(Y,{label:`Role`,children:i}),r&&n===null?(0,q.jsx)(Y,{label:`Role now`,children:`none by this name; approving it will fail`}):null,c===null?(0,q.jsxs)(q.Fragment,{children:[a.maxReplicas===void 0?null:(0,q.jsx)(Y,{label:`Replicas per project`,children:a.maxReplicas}),a.backlogThreshold===void 0?null:(0,q.jsx)(Y,{label:`Backlog per member`,children:a.backlogThreshold}),a.wakeTriggers===void 0?null:(0,q.jsx)(Y,{label:`Wake triggers`,children:X(a.wakeTriggers)}),a.verbs===void 0?null:(0,q.jsx)(Y,{label:`Verbs`,children:(0,q.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:a.verbs.map(e=>(0,q.jsx)(Z,{name:e},e))})})]}):(0,q.jsx)(Y,{label:`Changed`,children:c.map(e=>(0,q.jsx)(`span`,{className:`block`,children:e},e))}),(0,q.jsx)(Y,{label:`Why`,children:o})]})}function de({proposal:e,slug:t,reason:n,members:r}){let i=l(),a=C(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??[],u=(a.data??[]).filter(se).length;return(0,q.jsxs)(J,{children:[(0,q.jsxs)(Y,{label:`Project`,children:[(0,q.jsx)(m,{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,q.jsx)(Y,{label:s?`Members who leave`:`Members who left`,children:Array.isArray(c)?X(c.filter(e=>typeof e==`string`)):`none`}),s?(0,q.jsx)(Y,{label:`Tasks in play`,children:a.data===void 0?`reading…`:u===0?`none`:`${u}: approval is refused`}):null,(0,q.jsx)(Y,{label:`Reason`,children:n})]})}function fe({proposal:e}){let t=e.skillFiles,n=re(e.id,t!==void 0);if(t===void 0)return(0,q.jsx)(`p`,{className:`mt-2 text-sm text-fg-secondary`,children:e.status===`proposed`?`Files not taken yet.`:`The board took no files for it.`});if(n.data===void 0)return(0,q.jsx)(`p`,{className:`mt-2 text-meta`,children:n.isError?`Could not read its files.`:`Loading…`});let r=n.data.find(e=>e.path===`SKILL.md`),i=n.data.filter(e=>e.path!==`SKILL.md`);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(J,{children:(0,q.jsxs)(Y,{label:`Taken from`,children:[e.proposedBy,`'s home at`,` `,(0,q.jsx)(`span`,{className:`font-mono`,children:t.commit.slice(0,7)})]})}),r===void 0||r.text===null?null:(0,q.jsx)(Q,{children:(0,q.jsx)(R,{text:O(r.text)})}),i.length===0?null:(0,q.jsx)(`div`,{className:`mt-2`,children:(0,q.jsx)(U,{files:i})})]})}function pe({proposal:e,roles:t,members:n}){let r=e.status===`proposed`,{charter:i}=e;switch(e.kind){case`member`:{let e=_.safeParse(i);if(!e.success)break;let t=e.data;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(J,{children:[(0,q.jsx)(Y,{label:`Citizen`,children:(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,q.jsx)(oe,{cli:t.cli,size:13}),t.name]})}),(0,q.jsx)(Y,{label:`Role`,children:t.role}),(0,q.jsxs)(Y,{label:`CLI and model`,children:[t.cli,` · `,t.model??`cli default`]}),(0,q.jsx)(Y,{label:`Projects`,children:X(t.memberships)}),(0,q.jsx)(Y,{label:`Also follows`,children:X(t.subscriptions)}),t.homeRunner===void 0?null:(0,q.jsx)(Y,{label:`Runs on`,children:t.homeRunner})]}),t.seedInstructions===void 0?null:(0,q.jsxs)(Q,{children:[(0,q.jsx)(`p`,{className:`text-caps`,children:`Seed instructions`}),(0,q.jsx)(`div`,{className:`mt-1.5`,children:(0,q.jsx)(R,{text:t.seedInstructions})})]})]})}case`role`:{let n=M(e);if(n===null)break;return(0,q.jsx)($,{next:n,current:t?.find(e=>e.name===n.name),compare:r})}case`skill`:{let t=g.safeParse(i);if(!t.success)break;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(J,{children:[(0,q.jsx)(Y,{label:`Skill`,children:t.data.name}),(0,q.jsx)(Y,{label:`Summary`,children:t.data.summary})]}),(0,q.jsx)(fe,{proposal:e})]})}case`channel`:{let e=v.safeParse(i);if(!e.success)break;return(0,q.jsxs)(J,{children:[(0,q.jsxs)(Y,{label:`Channel`,children:[`#`,d(e.data.project,e.data.name)]}),(0,q.jsx)(Y,{label:`Purpose`,children:e.data.purpose})]})}case`retirement`:{let e=ne.safeParse(i);if(!e.success)break;let t=n?.find(t=>t.name===e.data.agent);return(0,q.jsxs)(J,{children:[(0,q.jsxs)(Y,{label:`Citizen`,children:[(0,q.jsx)(F,{name:e.data.agent,members:n}),t===void 0?null:` · ${t.role}`]}),(0,q.jsx)(Y,{label:`Holds now`,children:t===void 0?`unknown`:t.claimsHeld===1?`1 stage`:`${t.claimsHeld} stages`}),(0,q.jsx)(Y,{label:`Reason`,children:e.data.reason})]})}case`archive`:{let t=b.safeParse(i);if(!t.success)break;return(0,q.jsx)(de,{proposal:e,slug:t.data.project,reason:t.data.reason,members:n})}case`reallocation`:{let n=h.safeParse(i);if(!n.success)break;return(0,q.jsx)(ue,{proposal:e,reallocation:n.data,current:t===void 0?void 0:t.find(e=>e.name===n.data.role)??null,compare:r})}}return(0,q.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-lg bg-surface-2/40 p-3 font-mono text-[11px] text-fg-tertiary`,children:JSON.stringify(i,null,2)})}var me=i({agent:p().optional(),channel:p().optional(),role:p().optional(),skill:p().optional(),replaced:ee().optional(),releasedTasks:s(p()).optional(),project:p().optional()});function he({proposal:e}){let t=me.safeParse(e.provision??{});if(e.provision===void 0||!t.success)return null;let n=t.data,r=`text-fg-primary underline decoration-fg-muted underline-offset-2`;if(e.kind===`member`&&n.agent!==void 0)return(0,q.jsxs)(`p`,{className:`mt-1`,children:[`Created`,` `,(0,q.jsx)(m,{to:`/citizen/$name`,params:{name:n.agent},className:r,children:n.agent}),`.`]});if(e.kind===`channel`&&n.channel!==void 0)return(0,q.jsxs)(`p`,{className:`mt-1`,children:[`Created`,` `,(0,q.jsxs)(m,{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,q.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,q.jsxs)(`p`,{className:`mt-1`,children:[`Archived`,` `,(0,q.jsx)(m,{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,q.jsxs)(`p`,{className:`mt-1`,children:[n.replaced===!0?`Replaced`:`Published`,` the society's skill `,n.skill,`.`]}):(0,q.jsxs)(`p`,{className:`mt-1`,children:[n.replaced===!0?`Rewrote`:`Added`,` the role `,n.role,`.`]})}function ge(){let{proposalId:r}=N({from:`/proposal/$proposalId`}),i=t(r),o=te(),s=n(),l=c(),d=u(),f=ie(3e4),p=I(),h=e(d.data?.some(e=>e.id===r)===!0?r:null);if(i.data===void 0)return(0,q.jsx)(V,{children:i.error instanceof a&&i.error.status===404?`There is no proposal ${r}.`:`Reading the proposal…`});let g=i.data,_=g.status===`proposed`,v=o.data?.find(e=>e.name===g.proposedBy)?.role,y=d.data?.find(e=>e.id===g.id),b=g.status===`rejected`?`Rejected`:`Approved`,x=k(g,{members:o.data??[],roles:s.data??[],skills:l.data??[]});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ce,{leading:(0,q.jsx)(L,{fallback:(0,q.jsx)(m,{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(g),subtitle:`${g.kind} proposal by ${p(g.proposedBy)} ${S(g.createdAt,f)}${_?` · for ${j(g,v)} to decide`:``}`,trailing:(0,q.jsx)(W,{status:g.status})}),(0,q.jsxs)(H,{stick:!1,follow:!1,ids:h.data?.messages.map(e=>e.id),className:`px-4 py-4`,children:[_?(0,q.jsxs)(`p`,{className:`rounded-lg bg-sky-400/10 px-3 py-2 text-xs leading-relaxed text-sky-200`,children:[`If approved: `,x]}):(0,q.jsxs)(`div`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-xs leading-relaxed text-fg-secondary`,children:[(0,q.jsxs)(`p`,{children:[b,` by `,p(g.decidedBy??`someone`),g.decidedAt===void 0?``:` ${S(g.decidedAt,f)}`,g.reason===void 0?`.`:`: ${g.reason}`]}),(0,q.jsx)(he,{proposal:g})]}),g.body.trim()===``||y!==void 0?null:(0,q.jsxs)(`section`,{className:`mt-5`,children:[(0,q.jsx)(`h3`,{className:`text-section`,children:`Why`}),(0,q.jsx)(`div`,{className:`mt-2`,children:(0,q.jsx)(R,{text:g.body})})]}),(0,q.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,q.jsx)(`h3`,{className:`text-section`,children:_?`What it would make`:g.status===`provisioned`?`What it made`:`What it proposed`}),(0,q.jsx)(pe,{proposal:g,roles:s.data,members:o.data})]}),(0,q.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,q.jsx)(`h3`,{className:`text-section`,children:`Thread`}),y===void 0?(0,q.jsx)(`p`,{className:`mt-2 text-meta`,children:d.data===void 0?`Reading the thread…`:`No thread on this proposal.`}):(0,q.jsx)(G,{thread:y,now:f,empty:`Nothing said yet.`})]})]},g.id),y?.state===`open`?(0,q.jsx)(P,{target:{threadId:g.id},placeholder:`Write in the proposal's thread`}):null,D(g)?(0,q.jsx)(le,{proposal:g}):null]})}export{ge as ProposalView};
@@ -1 +0,0 @@
1
- import{A as e,Gn as t,Kn as n,O as r,S as i,Xn as a,f as o,j as s,qn as c,t as l,x as u}from"./format-Dhd2NUB3.js";import{n as d,t as f}from"./Button-D4-iu6aX.js";import{t as p}from"./CliIcon-DL4ZwgZv.js";import{k as m}from"./index-iplooQqq.js";import{n as h,r as g}from"./ThreadForms-DwUOktyP.js";import{n as _,t as v}from"./Pane-C9TbEME4.js";import{n as y}from"./Quota-BkF7pa0u.js";var b=a(c(),1);function x(e){return e.toUpperCase().replaceAll(/[^A-Z0-9]/g,``)}function S(e,t){return t!==void 0&&e.version!==void 0&&e.version!==t}function C(e){let t=e.gitIdentityMissing??[];if(t.length===0)return null;let n=t.map(e=>`user.${e}`),r=t.includes(`name`)?`git refuses the commits citizens make themselves on it`:`the commits citizens make themselves on it carry an empty address or one git made up`;return{label:t.length===1?`no git ${n.join(``)}`:`no git identity`,detail:`Its account has no git ${n.join(` or `)}, so ${r}.`}}function w(e,t){return x(e)===x(t)}function T(e,t){let n=(e.split(`.`)[0]??``).toLowerCase().replaceAll(/[^a-z0-9-]+/g,`-`).replaceAll(/-+/g,`-`).replace(/^-+/,``).slice(0,32).replace(/-+$/,``)||`runner`;if(!t.includes(n))return n;for(let e=2;;e+=1){let r=`-${e}`,i=`${n.slice(0,32-r.length)}${r}`;if(!t.includes(i))return i}}var E=n();function D(e,t){return Number(e.status!==`connected`)-Number(t.status!==`connected`)||e.name.localeCompare(t.name)}function O(e,t){return[e.length===0?`no CLI`:e.join(`, `),...t].join(` · `)}function k({enrollment:e,taken:n,followed:r,now:i}){let{api:a}=s(),o=t(),[c,u]=(0,b.useState)(null),p=c??T(e.hostname,n),m=()=>{o.invalidateQueries({queryKey:[`enrollments`]}),o.invalidateQueries({queryKey:[`runners`]})},_=d({mutationFn:()=>a.approveEnrollment(e.userCode,p.trim()),onSuccess:m}),v=d({mutationFn:()=>a.denyEnrollment(e.userCode),onSuccess:m}),y=_.isPending||v.isPending;return(0,E.jsxs)(`li`,{className:`rounded-xl border px-3 py-3 ${r?`border-amber-500/40 bg-amber-500/5`:`border-line`}`,children:[(0,E.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary`,children:e.hostname}),(0,E.jsx)(`code`,{className:`shrink-0 font-mono text-sm text-fg-primary`,children:e.userCode})]}),(0,E.jsxs)(`p`,{className:`mt-0.5 truncate text-meta`,children:[e.os,` · `,O(e.clis,e.capabilities),` · runner`,` `,e.version,` · asked `,l(e.requestedAt,i)]}),(0,E.jsxs)(`form`,{"aria-label":`Approve ${e.hostname}`,className:`mt-2.5 flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,E.jsx)(`input`,{value:p,maxLength:32,spellCheck:!1,"aria-label":`Runner name`,onChange:e=>u(e.target.value),className:`${h} min-w-0 flex-1 font-mono`}),(0,E.jsx)(f,{onClick:()=>v.mutate(),disabled:y,children:`Deny`}),(0,E.jsx)(f,{variant:`primary`,type:`submit`,disabled:y||p.trim()===``,children:_.isPending?`Approving…`:`Approve`})]}),(0,E.jsx)(`div`,{className:`mt-1.5`,children:(0,E.jsx)(g,{error:_.error??v.error})})]})}function A({paused:e}){return(0,E.jsx)(`svg`,{viewBox:`0 0 12 12`,width:12,height:12,"aria-hidden":`true`,className:`shrink-0`,children:(0,E.jsx)(`path`,{d:e?`M3 1.5v9l7.5-4.5z`:`M2.5 1.5h2.5v9h-2.5zM7 1.5h2.5v9h-2.5z`,fill:`currentColor`})})}function j(e,t){let n=e.clis.filter(t=>e.pausedClis?.[t]!==void 0),r=e.paused===void 0?e.clis.flatMap(n=>{let r=e.pausedClis?.[n];return r===void 0?[]:[`${n} paused ${l(r.at,t)}`]}):[`paused ${l(e.paused.at,t)}`];if(e.status!==`connected`){let n=`away${e.lastSeen===void 0?``:`, last seen ${l(e.lastSeen,t)}`}`;return{label:e.paused===void 0?`away`:`away · paused`,detail:[n,...r].join(`; `),tone:`text-amber-300`}}return e.paused===void 0&&n.length===0?{label:`connected`,detail:`connected`,tone:`text-fg-muted`}:{label:e.paused===void 0?`${n.join(`, `)} paused`:`paused`,detail:[`connected`,...r].join(`; `),tone:`text-amber-300`}}function M(){let{code:n}=m({from:`/runners`}),{api:a}=s(),c=t(),l=(0,b.useRef)(!1),f=d({mutationFn:({runner:e,paused:t,cli:n})=>a.setRunnerPaused(e,t,n),onSettled:async()=>{try{await c.invalidateQueries({queryKey:[`runners`]})}finally{l.current=!1}}}),h=e=>{l.current||(l.current=!0,f.mutate(e))},x=o(),T=r(),O=i(),M=e().data,N=u(3e4),P=x.data??[],F=(T.data??[]).map(e=>e.name),I=(T.data??[]).toSorted(D),L=I.filter(e=>e.status===`connected`).length,R=I.length-L,z=I.filter(e=>S(e,M)).length,B=I.filter(e=>C(e)!==null).length,V=I.filter(e=>e.paused!==void 0||e.clis.some(t=>e.pausedClis?.[t]!==void 0)).length,H=n===void 0?void 0:P.find(e=>w(e.userCode,n)),U=H===void 0?P:[H,...P.filter(e=>e!==H)],W=e=>(O.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:[`${L} connected`,...R===0?[]:[`${R} away`],...V===0?[]:[`${V} paused`],...P.length===0?[]:[`${P.length} waiting for approval`],...M===void 0?[]:[`server v${M}`],...z===0?[]:[`${z} on another version`],...B===0?[]:[`${B} without a git identity`]].join(` · `)}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[n!==void 0&&x.data!==void 0&&H===void 0?(0,E.jsxs)(`output`,{className:`block px-2 pb-2 text-meta`,children:[`No runner waits with the code `,n,`.`]}):null,U.length===0?null:(0,E.jsx)(`ul`,{"aria-label":`Waiting for approval`,className:`space-y-2 px-2 pb-3`,children:U.map(e=>(0,E.jsx)(k,{enrollment:e,taken:F,followed:e===H,now:N},e.userCode))}),T.data===void 0?(0,E.jsx)(_,{children:`Reading the runners…`}):I.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_auto] gap-x-3`,children:I.map(e=>{let t=e.clis.length===0?`no CLI`:e.clis.join(`, `),n=W(e),r=n.length===0?`no projects`:n.join(`, `),i=C(e),a=j(e,N);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`,children:[e.clis.map(t=>{let n=e.pausedClis?.[t]!==void 0,r=`${n?`Resume`:`Pause`} ${t} on ${e.name}`;return(0,E.jsx)(`button`,{type:`button`,"aria-label":r,title:r,"aria-disabled":f.isPending,onClick:()=>h({runner:e.name,paused:!n,cli:t}),className:`rounded p-0.5 transition-opacity hover:bg-surface-2/70 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${n?`opacity-30 hover:opacity-60`:``}`,children:(0,E.jsx)(p,{cli:t,size:13})},t)}),(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,M)?(0,E.jsxs)(`span`,{className:`text-xs text-amber-300`,title:`the server runs v${M}`,children:[`v`,e.version,(0,E.jsxs)(`span`,{className:`sr-only`,children:[`, not the server's v`,M]})]}):(0,E.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version===void 0?``:`v${e.version}`}),(0,E.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:e.capabilities.join(`, `),children:e.capabilities.join(`, `)}),(0,E.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,E.jsx)(`span`,{className:`text-right text-xs ${a.tone}`,title:a.detail,children:a.label}),(0,E.jsx)(`button`,{type:`button`,"aria-label":`${e.paused===void 0?`Pause`:`Resume`} ${e.name}`,title:`${e.paused===void 0?`Pause`:`Resume`} ${e.name}`,"aria-disabled":f.isPending,onClick:()=>h({runner:e.name,paused:e.paused===void 0}),className:`-mr-1 rounded p-1 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:(0,E.jsx)(A,{paused:e.paused!==void 0})})]},e.name)})}),(0,E.jsx)(`div`,{className:`px-2`,children:(0,E.jsx)(g,{error:f.error})}),(0,E.jsx)(y,{runners:I,now:N})]})]})}export{M as RunnersView};
@@ -1 +0,0 @@
1
- import{Gn as e,Kn as t,N as n,P as r,Xn as i,Zt as a,j as o,qn as s}from"./format-Dhd2NUB3.js";import{n as c,t as l}from"./Button-D4-iu6aX.js";import{l as u}from"./compose-D-X3BQgY.js";import{l as d}from"./governance-CWzi7hzX.js";import{A as f}from"./index-iplooQqq.js";import{t as p}from"./BackLink-BLiSCuKv.js";import{t as m}from"./Markdown-DPqvK--4.js";import{n as h,r as g}from"./ThreadForms-DwUOktyP.js";import{n as _,t as v}from"./Pane-C9TbEME4.js";import{n as y}from"./Overview-BGUnf6K1.js";import{t as b}from"./SkillFileList-BUpKUkaG.js";var x=i(s(),1),S=t(),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=r(),i=n(e),[o,s]=(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=i.data?.find(e=>e.path===`SKILL.md`),h=i.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)(a,{to:`/society`,"aria-label":`Back to the society`,className:C,children:`←`})}),title:(0,S.jsx)(`span`,{title:c.name,children:c.name}),subtitle:c.summary===``?void 0:(0,S.jsx)(`span`,{title:c.summary,children:c.summary}),trailing:o?null:(0,S.jsx)(l,{onClick:()=>s(!0),children:`Remove…`})}),o?(0,S.jsx)(T,{name:c.name,onCancel:()=>s(!1)}):null,(0,S.jsx)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:i.data===void 0?(0,S.jsx)(`p`,{className:`text-meta`,children:i.isError?`Could not read its files.`:`Reading…`}):(0,S.jsxs)(S.Fragment,{children:[u===void 0||u.text===null?null:(0,S.jsx)(m,{text:d(u.text)}),h.length===0?null:(0,S.jsx)(y,{title:`Files`,children:(0,S.jsx)(b,{files:h})})]})})]})}function T({name:t,onCancel:n}){let{api:r}=o(),i=e(),a=u(),[s,d]=(0,x.useState)(``),f=(0,x.useRef)(null);(0,x.useEffect)(()=>f.current?.focus(),[]);let p=c({mutationFn:()=>r.removeSkill({name:t,reason:s.trim()}),onSuccess:async()=>{await a({to:`/society`}),await i.invalidateQueries({queryKey:[`skills`]})}});return(0,S.jsxs)(`form`,{"aria-label":`Remove ${t}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),p.mutate()},children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`input`,{ref:f,value:s,"aria-label":`Reason`,placeholder:`Why it is wrong, superseded, or unused`,onChange:e=>d(e.target.value),className:`${h} min-w-0 flex-1`}),(0,S.jsx)(l,{onClick:n,children:`Cancel`}),(0,S.jsx)(l,{variant:`primary`,type:`submit`,disabled:p.isPending||s.trim()===``,children:p.isPending?`Removing…`:`Remove skill`})]}),(0,S.jsx)(g,{error:p.error})]})}export{w as SkillView};
@@ -1 +0,0 @@
1
- import{Kn as e,Zt as t,n,t as r}from"./format-Dhd2NUB3.js";import{_ as i,s as a}from"./index-iplooQqq.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===`open`,f=d?``:n(e.body,180),p=d?void 0:e.closedAt,m=p??e.openedAt;return(0,o.jsxs)(t,{to:`/thread/$threadId`,params:{threadId:e.id},className:`group flex gap-3 px-4 py-1`,children:[(0,o.jsx)(`span`,{title:e.state,className:`grid h-5 w-7 shrink-0 place-items-center ${d?`text-emerald-400 group-hover:text-emerald-300`:`text-fg-muted group-hover:text-fg-tertiary`}`,children:(0,o.jsx)(l,{})}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,o.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-sm text-fg-tertiary`,children:[u(e.openedBy),` opened `,s(e.subject),` thread`,` `,(0,o.jsx)(`span`,{className:`text-fg-secondary group-hover:text-fg-primary`,children:e.title}),(0,o.jsxs)(`span`,{className:`sr-only`,children:[`, `,e.state]})]}),(0,o.jsx)(`time`,{dateTime:m,title:`${p===void 0?`opened`:`closed`} ${m}`,className:`shrink-0 text-meta`,children:r(m,c)})]}),f===``?null:(0,o.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:(0,o.jsx)(i,{text:f,links:!1})})]})]})}export{u as n,s as r,c as t};