@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
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "codex",
9
9
  "multi-agent"
10
10
  ],
11
- "version": "0.4.0",
11
+ "version": "0.4.2",
12
12
  "license": "MIT",
13
13
  "homepage": "https://github.com/kr4t0n/stellaris",
14
14
  "repository": {
@@ -1 +1 @@
1
- import{$t as e,Kn as t,S as n}from"./format-Dhd2NUB3.js";import{O as r,n as i,r as a,t as o,v as s}from"./index-iplooQqq.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
+ import{S as e,Xn as t,rn as n}from"./format-hyYD8qd8.js";import{O as r,n as i,r as a,t as o,v as s}from"./index-5CbC_NpF.js";var c=t(),l=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function u({fallback:t}){let u=n(),d=r({select:e=>e.location.state.__TSR_index}),f=a(),p=s(),m=e(),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 +1 @@
1
- import{An as e,Dn as t,Gn as n,Hn as r,Kn as i,Mn as a,On as o,Pn as s,Rn as c,Vn as l,Xn as u,qn as d}from"./format-Dhd2NUB3.js";var f=class extends t{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||p(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=o({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(t){let n=e=>{switch(t.type){case`failed`:return{...e,failureCount:t.failureCount,failureReason:t.error};case`pause`:return{...e,isPaused:!0};case`continue`:return{...e,isPaused:!1};case`pending`:return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:`pending`,variables:t.variables,submittedAt:Date.now()};case`success`:return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:`error`}}};this.state=n(this.state),e.batch(()=>{this.#t.forEach(e=>{e.onMutationUpdate(t)}),this.#n.notify({mutation:this,type:`updated`,action:t})})}};function p(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var m=class extends a{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),l(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&s(t.mutationKey)!==s(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??p();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(t){e.batch(()=>{if(this.#r&&this.hasListeners()){let e=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type===`success`){try{this.#r.onSuccess?.(t.data,e,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(t.data,null,e,n,r)}catch(e){Promise.reject(e)}}else if(t?.type===`error`){try{this.#r.onError?.(t.error,e,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,t.error,e,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},h=u(d(),1);function g(t,i){let a=n(i),[o]=h.useState(()=>new m(a,t));h.useEffect(()=>{o.setOptions(t)},[o,t]);let s=h.useSyncExternalStore(h.useCallback(t=>o.subscribe(e.batchCalls(t)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),l=h.useCallback((...e)=>{o.mutate(e[0],e[1]).catch(c)},[o]);if(s.error&&r(o.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:l,mutateAsync:s.mutate}}var _=i(),v={primary:`bg-fg-primary font-medium text-surface-0 hover:bg-white`,ghost:`text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`};function y({variant:e=`ghost`,className:t=``,...n}){return(0,_.jsx)(`button`,{type:`button`,...n,className:`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40 ${v[e]} ${t}`})}export{g as n,f as r,y as t};
1
+ import{Gn as e,Hn as t,In as n,Kn as r,Mn as i,Pn as a,Rn as o,Xn as s,Yn as c,Zn as l,er as u,jn as d}from"./format-hyYD8qd8.js";var f=class extends d{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||p(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=i({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),a=this.state.status===`pending`,o=!r.canStart();try{if(a)t();else{this.#i({type:`pending`,variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:o})}let i=await r.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#i({type:`success`,data:i}),i}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),a.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function p(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var m=class extends n{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let n=this.options;this.options=this.#e.defaultMutationOptions(t),e(this.options,n)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&o(n.mutationKey)!==o(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??p();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){a.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},h=u(l(),1);function g(e,n){let i=c(n),[o]=h.useState(()=>new m(i,e));h.useEffect(()=>{o.setOptions(e)},[o,e]);let s=h.useSyncExternalStore(h.useCallback(e=>o.subscribe(a.batchCalls(e)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),l=h.useCallback((...e)=>{o.mutate(e[0],e[1]).catch(t)},[o]);if(s.error&&r(o.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:l,mutateAsync:s.mutate}}var _=s(),v={primary:`bg-fg-primary font-medium text-surface-0 hover:bg-white`,ghost:`text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`};function y({variant:e=`ghost`,className:t=``,...n}){return(0,_.jsx)(`button`,{type:`button`,...n,className:`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40 ${v[e]} ${t}`})}export{g as n,f as r,y as t};
@@ -1 +1 @@
1
- import{Gn as e,Kn as t,Xn as n,Zt as r,j as i,qn as a,t as o}from"./format-Dhd2NUB3.js";import{n as s,t as c}from"./Button-D4-iu6aX.js";import{l}from"./compose-D-X3BQgY.js";import{n as u,r as d}from"./ThreadForms-DwUOktyP.js";var f=n(a(),1),p=t();function m({project:t,onDone:n}){let{api:r}=i(),a=e(),o=l(),[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(``),v=(0,f.useRef)(null);(0,f.useEffect)(()=>v.current?.focus(),[]);let y=s({mutationFn:()=>r.createChannel({project:t,name:m.trim(),purpose:g.trim()}),onSuccess:async e=>{await a.invalidateQueries({queryKey:[`channels`]}),n(),await o({to:`/c/$`,params:{_splat:e}})}});return(0,p.jsxs)(`form`,{"aria-label":`New channel`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),y.mutate()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`div`,{className:`w-40 shrink-0`,children:(0,p.jsx)(`input`,{ref:v,value:m,maxLength:64,spellCheck:!1,"aria-label":`Channel name`,placeholder:`release-0-4`,onChange:e=>h(e.target.value),className:`${u} font-mono`})}),(0,p.jsx)(`input`,{value:g,"aria-label":`Purpose`,placeholder:`What the channel is for`,onChange:e=>_(e.target.value),className:`${u} min-w-0 flex-1`}),(0,p.jsx)(c,{onClick:n,children:`Cancel`}),(0,p.jsx)(c,{variant:`primary`,type:`submit`,disabled:y.isPending||m.trim()===``||g.trim()===``,children:y.isPending?`Opening…`:`Open`})]}),(0,p.jsx)(d,{error:y.error})]})}function h({channel:t,onDone:n}){let{api:r}=i(),a=e(),[o,l]=(0,f.useState)(``),m=s({mutationFn:()=>r.archiveChannel({channel:t,reason:o.trim()}),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`channels`]}),n()}});return(0,p.jsxs)(`form`,{"aria-label":`Archive the channel`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`input`,{value:o,"aria-label":`Reason`,placeholder:`Why its work is done`,onChange:e=>l(e.target.value),className:`${u} min-w-0 flex-1`}),(0,p.jsx)(c,{onClick:n,children:`Cancel`}),(0,p.jsx)(c,{variant:`primary`,type:`submit`,disabled:m.isPending||o.trim()===``,children:m.isPending?`Archiving…`:`Archive channel`})]}),(0,p.jsx)(d,{error:m.error})]})}function g({channels:e,now:t}){return e.length===0?(0,p.jsx)(`p`,{className:`text-meta`,children:`No channels.`}):(0,p.jsx)(`ul`,{className:`space-y-1`,children:e.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsxs)(r,{to:`/c/$`,params:{_splat:e.ref},className:`text-sm hover:text-fg-primary ${e.archived===void 0?`text-fg-secondary`:`text-fg-tertiary`}`,children:[`# `,e.name]}),(0,p.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.messages,` messages`,e.archived===void 0?``:` · archived ${o(e.archived.at,t)}`]})]},e.ref))})}export{g as n,m as r,h as t};
1
+ import{Xn as e,Yn as t,Zn as n,er as r,j as i,t as a,tn as o}from"./format-hyYD8qd8.js";import{n as s,t as c}from"./Button-B6EN7Lh7.js";import{l}from"./compose-BnOoMY1c.js";import{n as u,r as d}from"./ThreadForms-BlOEvY5E.js";var f=r(n(),1),p=e();function m({project:e,onDone:n}){let{api:r}=i(),a=t(),o=l(),[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(``),v=(0,f.useRef)(null);(0,f.useEffect)(()=>v.current?.focus(),[]);let y=s({mutationFn:()=>r.createChannel({project:e,name:m.trim(),purpose:g.trim()}),onSuccess:async e=>{await a.invalidateQueries({queryKey:[`channels`]}),n(),await o({to:`/c/$`,params:{_splat:e}})}});return(0,p.jsxs)(`form`,{"aria-label":`New channel`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),y.mutate()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`div`,{className:`w-40 shrink-0`,children:(0,p.jsx)(`input`,{ref:v,value:m,maxLength:64,spellCheck:!1,"aria-label":`Channel name`,placeholder:`release-0-4`,onChange:e=>h(e.target.value),className:`${u} font-mono`})}),(0,p.jsx)(`input`,{value:g,"aria-label":`Purpose`,placeholder:`What the channel is for`,onChange:e=>_(e.target.value),className:`${u} min-w-0 flex-1`}),(0,p.jsx)(c,{onClick:n,children:`Cancel`}),(0,p.jsx)(c,{variant:`primary`,type:`submit`,disabled:y.isPending||m.trim()===``||g.trim()===``,children:y.isPending?`Opening…`:`Open`})]}),(0,p.jsx)(d,{error:y.error})]})}function h({channel:e,onDone:n}){let{api:r}=i(),a=t(),[o,l]=(0,f.useState)(``),m=s({mutationFn:()=>r.archiveChannel({channel:e,reason:o.trim()}),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`channels`]}),n()}});return(0,p.jsxs)(`form`,{"aria-label":`Archive the channel`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`input`,{value:o,"aria-label":`Reason`,placeholder:`Why its work is done`,onChange:e=>l(e.target.value),className:`${u} min-w-0 flex-1`}),(0,p.jsx)(c,{onClick:n,children:`Cancel`}),(0,p.jsx)(c,{variant:`primary`,type:`submit`,disabled:m.isPending||o.trim()===``,children:m.isPending?`Archiving…`:`Archive channel`})]}),(0,p.jsx)(d,{error:m.error})]})}function g({channels:e,now:t}){return e.length===0?(0,p.jsx)(`p`,{className:`text-meta`,children:`No channels.`}):(0,p.jsx)(`ul`,{className:`space-y-1`,children:e.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsxs)(o,{to:`/c/$`,params:{_splat:e.ref},className:`text-sm hover:text-fg-primary ${e.archived===void 0?`text-fg-secondary`:`text-fg-tertiary`}`,children:[`# `,e.name]}),(0,p.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.messages,` messages`,e.archived===void 0?``:` · archived ${a(e.archived.at,t)}`]})]},e.ref))})}export{g as n,m as r,h as t};
@@ -0,0 +1,2 @@
1
+ import{Et as e,K as t,S as n,V as r,Xn as i,Zn as a,er as o,j as s,kn as c,l,t as u,tn as d,v as f,x as p}from"./format-hyYD8qd8.js";import{t as m}from"./Button-B6EN7Lh7.js";import{A as h,C as g,i as _,k as v,s as y}from"./index-5CbC_NpF.js";import{t as b}from"./BackLink-DNHWkHmh.js";import{i as x}from"./ThreadForms-BlOEvY5E.js";import{t as S}from"./ChannelForms-BrcWrkej.js";import{t as C}from"./MessageItem-WBBIzv48.js";import{n as w,t as T}from"./Pane-DFJdAhv9.js";import{t as E}from"./StickyList-Q0KEWBUl.js";import{n as D}from"./ThreadItem-D5N_Fw1K.js";var O=o(a(),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=i();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)(d,{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:i,target:a}){let{api:o}=s(),h=c({queryKey:[`channel`,i],queryFn:()=>o.channel(i)}),v=r(),y=f(),k=n(),j=l(),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})),t=(v.data??[]).filter(e=>e.channel===i).map(e=>({kind:`thread`,at:e.openedAt,id:e.id,thread:e}));return[...e,...t].toSorted((e,t)=>e.at.localeCompare(t.at)||e.id.localeCompare(t.id))},[h.data,v.data,i]),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(i,H),[i,H]);let[U,W]=i.split(`/`),G=W??U??i,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===i)?.archived,Y=K?.archived!==void 0||J!==void 0,X=!Y&&!e(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)(d,{to:`/society`,"aria-label":`Back to the society`,className:R,children:`←`}):(0,N.jsx)(d,{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:i,onDone:()=>F(!1)}):null,I?(0,N.jsx)(S,{channel:i,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 t&&h.error.status===404?(0,N.jsxs)(w,{children:[`There is no channel `,i,`.`]}):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:i},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};
@@ -0,0 +1,2 @@
1
+ import{D as e,Jt as t,K as n,O as r,S as i,U as a,W as o,X as s,Xn as c,Yn as l,Yt as u,Zn as d,a as f,er as p,h as m,j as h,k as g,m as _,o as v,p as y,t as b,tn as x,u as S,v as C,wt as w,x as T,y as ee,z as E}from"./format-hyYD8qd8.js";import{n as D,t as O}from"./Button-B6EN7Lh7.js";import{t as te}from"./CliIcon-BRq1tnhu.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 R,p as ne,u as z,v as B}from"./index-5CbC_NpF.js";import{t as V}from"./Markdown-DYk-gVwe.js";import{n as re,r as H}from"./ThreadForms-BlOEvY5E.js";import{n as U,t as ie}from"./Pane-DFJdAhv9.js";import{t as ae}from"./StickyList-Q0KEWBUl.js";import{a as oe,c as se,f as ce,l as le,m as ue,n as de,o as W,p as fe,r as pe,u as me}from"./citizen-BRg9UIgD.js";import{n as G}from"./Picker-CAEREZF9.js";import{t as he}from"./Quota-D6_yyawu.js";var K=p(d(),1),q=c(),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)(V,{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)(V,{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 `,b(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],` `,b(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=y(e,t.commit,!0);return(0,q.jsxs)(`div`,{className:`space-y-3 px-4 pt-1 pb-3`,children:[(0,q.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[t.kind===`merge`?Ce.merge:t.kind===`board`?`Written by the board: ${t.subject.replace(/^home: /,``)}.`:t.turnId===void 0?t.subject:(0,q.jsx)(x,{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]} ${b(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:b(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=m(e,t),i=T(3e4);if(r.data===void 0)return(0,q.jsx)(U,{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)(U,{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=ee(e.name),r=v(e.name),i=_(e.name),a=T(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`,` `,b(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)(V,{text:fe(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)(V,{text:fe(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=a(e,t?.turnId??null);return{turn:(0,K.useMemo)(()=>t===void 0||n.data===void 0?void 0:ne(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=B(),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:ue(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:[W(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:[de(t),` `,b(t.ts,n)]}),(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,title:t.usage===void 0?void 0:se(t.usage),children:[c,t.toolCalls===void 0?null:`${t.toolCalls} tools`,t.usage===void 0?null:le(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=o(e,n),a=T(3e4);if(i.data===void 0)return(0,q.jsx)(U,{children:`Reading the turns…`});let s=i.data.toReversed();if(s.length===0)return(0,q.jsxs)(U,{children:[e,` has not finished a turn yet.`]});let c=pe(s),l=c.usage===null?``:` · ${le(c.usage)}${c.withUsage<c.turns?` over ${c.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:c.usage===null?void 0:se(c.usage),children:[c.turns===1?`1 turn`:`${c.turns} turns`,c.failed===0?``:`, ${c.failed} not completed`,l]}),t!==null&&!s.some(e=>e.turnId===t)?(0,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:s.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:t}){let{api:r}=h(),i=l(),a=f(e.name),o=e.model??Z,s=e.effort??Q,[c,u]=(0,K.useState)(o),[d,p]=(0,K.useState)(s),m=D({mutationFn:async()=>{c!==o&&await r.setModel(e.name,c===Z?null:c),d!==s&&await r.setEffort(e.name,d===Q?null:d)},onSettled:()=>void i.invalidateQueries({queryKey:[`members`]}),onSuccess:t}),g=a.data?.models??[],_=e.model!==void 0&&!g.some(t=>t.id===e.model)?e.model:null,v=e=>g.find(t=>e===Z?t.isDefault:t.id===e),y=v(c)?.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)&&p(Q)},S=c!==o||d!==s;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(),m.mutate()},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.isPending?(0,q.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Asking `,e.cli,` for its models…`]}):a.error===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(G,{label:`Model`,choices:Ie(g,_),value:c,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(c),b),value:d,onChange:p,listClassName:`right-0 w-64`})})]}):(0,q.jsxs)(`p`,{role:`alert`,className:`min-w-0 flex-1 truncate text-xs text-red-400`,children:[e.cli,` did not list its models:`,` `,a.error instanceof n?a.error.message:`the board server did not answer`]}),(0,q.jsx)(O,{onClick:t,children:`Cancel`}),(0,q.jsx)(O,{variant:`primary`,type:`submit`,disabled:m.isPending||!S||a.error!==null,children:m.isPending?`Saving…`:`Save`})]}),a.data===void 0?null:(0,q.jsxs)(`p`,{className:`text-meta`,children:[`Listed by `,a.data.cli,` on `,a.data.runner]}),(0,q.jsx)(H,{error:m.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:t}){let{api:n}=h(),i=l(),a=r(),o=e.homeRunner??$,[s,c]=(0,K.useState)(o),u=D({mutationFn:()=>n.setRunner(e.name,s===$?null:s),onSuccess:()=>{i.invalidateQueries({queryKey:[`members`]}),t()}});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:[a.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(a.data,e),value:s,onChange:c}),(0,q.jsx)(O,{onClick:t,children:`Cancel`}),(0,q.jsx)(O,{variant:`primary`,type:`submit`,disabled:u.isPending||s===o,children:u.isPending?`Saving…`:`Run here`})]}),(0,q.jsx)(H,{error:u.error})]})}function He(e){if(e.thread!==void 0)return{threadId:e.thread};let n=e.scope===`society`?null:e.scope;return e.channel===void 0?e.place===void 0?{channel:e.askedIn??t(n,`general`)}:{channel:e.askedIn!==void 0&&u(e.askedIn).project===e.place?e.askedIn:t(e.place,`general`)}:{channel:t(n,e.channel)}}function Ue({name:e,turn:t}){let{api:n}=h(),r=l(),[i,a]=(0,K.useState)(!1),o=D({mutationFn:()=>n.stopTurn(t.turnId),onSuccess:()=>{a(!1),r.invalidateQueries({queryKey:[`scheduler`]})}});return(0,q.jsxs)(`div`,{className:`border-t border-line`,children:[(0,q.jsx)(F,{target:He(t),initialText:`@${e} `,placeholder:t.steerable?`Message ${e} while it works`:`Message ${e} for its next turn`,className:`px-3 pt-3 pb-2`},t.turnId),t.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:i?`Stop ${e}'s turn?`:t.steerable?`Posts reach the turn at its next step.`:`This runner delivers posts after the turn ends.`}),i?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(O,{onClick:()=>{a(!1),o.reset()},children:`Keep it running`}),(0,q.jsx)(O,{variant:`primary`,disabled:o.isPending,onClick:()=>{o.mutate()},children:o.isPending?`Stopping…`:`Stop the turn`})]}):(0,q.jsx)(O,{onClick:()=>a(!0),children:`Stop…`})]}):null,o.error===null?null:(0,q.jsx)(`div`,{className:`px-3 pb-3`,children:(0,q.jsx)(H,{error:o.error})})]})}function We({member:e,scopes:t,preferred:n,running:r,paused:i,onDone:a}){let{api:o}=h(),s=l(),[c,u]=(0,K.useState)(`manual`),[d,f]=(0,K.useState)(n!==null&&t.includes(n)?n:t[0]??``),[p,m]=(0,K.useState)(``),g=(0,K.useRef)(null);(0,K.useEffect)(()=>g.current?.focus(),[]);let _=D({mutationFn:()=>o.wake({agent:e.name,project:d,kind:c,...p.trim()===``?{}:{reason:p.trim()}}),onSuccess:()=>{s.invalidateQueries({queryKey:[`scheduler`]}),a()}}),v=i?`The society is paused.`:r.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 ${c===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:c===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:oe(t),value:d,onChange:f})]})]}),(0,q.jsx)(`textarea`,{ref:g,value:p,rows:2,placeholder:c===`reflection`?`What to reflect on, optional`:`What it should look at`,"aria-label":`Reason`,onChange:e=>m(e.target.value),className:`${re} 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:a,children:`Cancel`}),(0,q.jsx)(O,{variant:`primary`,type:`submit`,disabled:_.isPending||d===``,children:_.isPending?`Waking…`:c===`reflection`?`Ask for a reflection`:`Wake ${e.name}`})]}),(0,q.jsx)(H,{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)(x,{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:w(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:a,turn:o}){let c=C(),l=e(),u=g(),d=P(),f=S(),p=r(),m=i(),h=T(3e4),[_,v]=(0,K.useState)(null),y=c.data?.find(e=>e.name===t);if(y===void 0)return(0,q.jsx)(U,{children:c.data===void 0?`Reading the roster…`:`There is no citizen ${t}.`});let b=s(u.data?.running??[]).filter(e=>e.agent===t),w=[...new Set(b.map(e=>e.scope))],ee=b.map(e=>z(e.agent,e.scope,e)),E=s(u.data?.pending??[]).find(e=>e.agent===t),D=w.length>0?`working`:E===void 0?`idle`:`queued`,k=R(d,t)[0],A=k?.model??y.lastModel,j=A??y.model??`CLI default`,M=y.model!==void 0&&y.model!==A?y.model:null,N=l.data?.find(e=>e.name===y.role),F=ce(y),I=y.status===`active`&&y.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)(ie,{leading:y.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:y.cli,size:20})}),title:t,subtitle:(0,q.jsxs)(q.Fragment,{children:[y.role,` · `,j,M===null?``:` · set to ${M}`,y.effort===void 0?``:` · ${y.effort} effort`,y.homeRunner===void 0?``:` · on ${y.homeRunner}`,y.status===`retired`?` · retired`:``]}),trailing:(0,q.jsxs)(q.Fragment,{children:[L===0?null:(0,q.jsx)(x,{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&&_===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(O,{onClick:()=>v(`model`),children:`Model…`}),(0,q.jsx)(O,{onClick:()=>v(`runner`),children:`Runner…`}),(0,q.jsx)(O,{onClick:()=>v(`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:y,runners:p.data??[],placed:new Map((m.data??[]).flatMap(e=>e.runner===void 0?[]:[[e.slug,e.runner]])),now:h}),_===`wake`?(0,q.jsx)(We,{member:y,scopes:F,preferred:n?.split(`/`)[0]??k?.scope??null,running:w,paused:u.data?.paused??!1,onDone:()=>v(null)}):_===`model`?(0,q.jsx)(Re,{member:y,onDone:()=>v(null)}):_===`runner`?(0,q.jsx)(Ve,{member:y,onDone:()=>v(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)(x,{to:`/citizen/$name`,params:{name:t},search:{...n===null?{}:{scope:n},...e.tab===`now`?{}:{tab:e.tab}},replace:!0,"aria-current":e.tab===a?`page`:void 0,className:`rounded-md px-2.5 py-1 text-xs transition-colors ${e.tab===a?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:e.label},e.tab))}),a===`turns`?(0,q.jsx)(Fe,{name:t,opened:o},o):a===`memory`?(0,q.jsx)(je,{member:y,charter:N}):a===`history`?(0,q.jsx)(Ae,{name:t}):(0,q.jsx)(Ze,{name:t,chosen:n,lastTurnAt:y.lastTurnAt,state:D,runningScopes:w,runningKeys:ee,runningTurns:(u.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:s,queuedScope:c}){let l=P(),u=T(5e3),d=R(l,e),f=o(e,1),p=Me(e,d.length===0?f.data?.at(-1):void 0),m=B(),h=e=>e.end===null&&a.includes(z(e.agent,e.scope,e)),g=t?.split(`/`)[0]??null,_=(t?.includes(`/`)===!0?d.find(e=>j(e)===t):void 0)??Xe(d.filter(e=>e.scope===g&&h(e)))??d.find(e=>j(e)===t)??Xe(d.filter(h))??d[0]??p.turn,v=e=>e.thread===void 0?e.channel===void 0?e.place===void 0?W(e.scope):`${W(e.scope)} · ${e.place}'s channels`:`${W(e.scope)} · #${e.channel}`:`${W(e.scope)} · ${m.get(e.thread)?.title??`a thread`}`,y=_!==void 0&&h(_),S=_?.scope??i[0]??c,C=(_===void 0?void 0:s.find(e=>e.scope===_.scope&&e.thread===_.thread&&e.channel===_.channel&&e.place===_.place))??(y?void 0:s[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:y?`In a turn at ${W(_.scope)} for ${_.fromStart?``:`at least `}${L(_.startedAt,u)}`:i.length>0?`In a turn at ${i.map(W).join(` and `)}`:c===null?n===void 0?`No turns yet`:`Last turn ${b(n,u)}`:`Queued for a turn at ${W(c)}`}),S===null||S===`society`?null:(0,q.jsx)(Ke,{project:S,name:e})]}),(0,q.jsx)(ae,{className:`px-4 py-3`,children:_===void 0?(0,q.jsx)(U,{children:r===`working`?`The turn has not reported a step yet.`:p.loading?`Reading the last turn…`:n===void 0?`${e} has not taken a turn yet.`:`${e}'s last turn kept no steps.`}):(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)(x,{to:`/citizen/$name`,params:{name:e},search:{scope:j(t)},replace:!0,"aria-current":t===_?`true`:void 0,className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[11px] transition-colors ${t===_?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[h(t)?(0,q.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}):null,v(t)]},j(t)))}):null,(0,q.jsxs)(`p`,{className:`text-caps`,children:[y?`This turn`:`Last turn`,` · `,v(_),` · started`,` `,_.fromStart?J(_.startedAt):`before the earliest step shown`]}),(0,q.jsx)(ye,{steps:_.steps}),(0,q.jsx)(be,{turn:_,running:y,now:u})]})}),C===void 0?null:(0,q.jsx)(Ue,{name:e,turn:C})]})}export{qe as CitizenView};
@@ -1 +1 @@
1
- import{H as e,Kn as t,O as n,S as r,X as i,Xn as a,Zt as o,k as s,qn as c,t as l,v as u,x as d}from"./format-Dhd2NUB3.js";import{t as f}from"./CliIcon-DL4ZwgZv.js";import{k as p}from"./index-iplooQqq.js";import{n as m,t as h}from"./Pane-C9TbEME4.js";import{i as g,o as _,s as v}from"./citizen-BOn5BBRL.js";import{r as y}from"./Quota-BkF7pa0u.js";var b=a(c(),1),x=t(),S=[{window:`24h`,label:`24h`,title:`the last 24 hours`},{window:`7d`,label:`7d`,title:`the last 7 days`},{window:`all`,label:`All`,title:`all time`}];function C(e){let t=e.lastModel??e.model??`CLI default`,n=e.model!==void 0&&e.model!==t?`${t} · set to ${e.model}`:t;return e.effort===void 0?n:`${n} · ${e.effort}`}function w(e,t){return e.name.localeCompare(t.name)}function T(e,t){return e.role.localeCompare(t.role)||w(e,t)}function E({member:e,state:t,tokens:n,outputs:r,runners:i,placed:a,now:s}){let c=C(e),l=e.memberships.length===0?`no projects`:e.memberships.join(`, `),u=g(e,a);return(0,x.jsx)(`li`,{className:`col-span-full grid grid-cols-subgrid`,children:(0,x.jsxs)(o,{to:`/citizen/$name`,params:{name:e.name},className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-surface-2/50`,children:[(0,x.jsxs)(`span`,{className:`relative grid size-4 place-items-center`,children:[e.cli===null?null:(0,x.jsx)(f,{cli:e.cli,size:13}),e.status===`active`?(0,x.jsx)(y,{member:e,runners:i,placed:a,now:s}):null]}),(0,x.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,x.jsx)(`span`,{className:`text-fg-secondary`,children:e.role}),(0,x.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:c,children:c}),(0,x.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:u.detail,children:u.label}),(0,x.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:l,children:l}),(0,x.jsxs)(`span`,{className:`col-[2/-1] row-start-2 text-right text-xs whitespace-nowrap text-fg-muted tabular-nums @min-[560px]:col-auto @min-[560px]:row-auto`,title:n.detail,children:[n.counts===null?n.label:(0,x.jsxs)(x.Fragment,{children:[`${n.counts.input} · `,(0,x.jsxs)(`span`,{className:`inline-grid justify-items-end`,children:[(0,x.jsx)(`span`,{className:`[grid-area:1/1]`,children:n.counts.output}),r.map(e=>(0,x.jsx)(`span`,{"data-width":e,className:`invisible [grid-area:1/1] before:content-[attr(data-width)]`},e))]})]}),n.spoken===null?null:(0,x.jsxs)(`span`,{className:`sr-only`,children:[`, `,n.spoken]})]}),(0,x.jsxs)(`span`,{className:`text-right text-xs whitespace-nowrap @min-[560px]:-ml-2 @min-[560px]:text-left`,children:[(0,x.jsxs)(`span`,{"aria-hidden":`true`,className:`hidden text-fg-muted @min-[560px]:inline`,children:[`·`,` `]}),(0,x.jsx)(`span`,{className:t.tone,title:t.detail,children:t.label})]})]})})}function D(){let{window:t=`24h`}=p({from:`/citizens`}),a=u(),c=s(),f=r(),g=n(),y=e(t),C=d(3e4),D=(0,b.useId)(),O=(0,b.useId)();if(a.data===void 0)return(0,x.jsx)(m,{children:`Reading the roster…`});let k=a.data.filter(e=>e.cli!==null),A=k.filter(e=>e.status===`active`).toSorted(T),j=k.filter(e=>e.status!==`active`).toSorted(w),M=new Set(A.map(e=>e.role)).size,N=i(c.data?.running??[]),P=i(c.data?.pending??[]),F=new Map((f.data??[]).flatMap(e=>e.runner===void 0?[]:[[e.slug,e.runner]])),I=new Map((y.data?.citizens??[]).map(e=>[e.agent,e])),L=e=>{if(e.status!==`active`)return{label:`retired`,detail:e.retiredAt===void 0?`retired`:`retired ${l(e.retiredAt,C)}`,tone:`text-fg-muted`};let t=[...new Set(N.filter(t=>t.agent===e.name).map(e=>e.scope))];return t.length>0?{label:`working`,detail:`in a turn at ${t.map(_).join(` and `)}`,tone:`text-emerald-300`}:P.some(t=>t.agent===e.name)?{label:`queued`,detail:`queued for a turn`,tone:`text-amber-300`}:{label:`resting`,detail:`resting`,tone:`text-fg-muted`}},R=e=>y.data===void 0?y.error===null?{label:`counting…`,counts:null,detail:void 0,spoken:null}:{label:`tokens unknown`,counts:null,detail:y.error.message,spoken:null}:v(I.get(e.name),t),z=[...new Set([...A,...j].flatMap(e=>R(e).counts?.output??[]))],B=e=>(0,x.jsx)(E,{member:e,state:L(e),tokens:R(e),outputs:z,runners:g.data??[],placed:F,now:C},e.name),V=(0,x.jsxs)(`nav`,{"aria-labelledby":D,className:`flex shrink-0 items-center gap-1`,children:[(0,x.jsx)(`span`,{id:D,className:`mr-1 text-caps`,children:`Tokens`}),S.map(e=>(0,x.jsx)(o,{to:`/citizens`,search:{window:e.window},title:e.title,"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))]});return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(h,{title:`Citizens`,subtitle:`${A.length} active in ${M===1?`1 role`:`${M} roles`}${j.length===0?``:` · ${j.length} retired`}`,trailing:V}),(0,x.jsxs)(`div`,{className:`@container flex-1 overflow-y-auto px-2 py-2`,children:[A.length===0?(0,x.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:j.length===0?`No citizens yet.`:`No active citizens.`}):null,(0,x.jsxs)(`div`,{className:`grid grid-cols-[auto_auto_auto_minmax(0,max-content)_minmax(0,max-content)_minmax(3rem,1fr)_auto] gap-x-3 @min-[560px]:grid-cols-[auto_auto_auto_minmax(0,max-content)_minmax(0,max-content)_minmax(0,max-content)_minmax(max-content,1fr)_auto]`,children:[(0,x.jsx)(`ul`,{className:`col-span-full grid grid-cols-subgrid`,children:A.map(B)}),j.length===0?null:(0,x.jsxs)(`section`,{"aria-labelledby":O,className:`col-span-full mt-2 grid grid-cols-subgrid border-t border-line pt-2`,children:[(0,x.jsx)(`h3`,{id:O,className:`col-span-full px-2 py-1 text-section`,children:`Retired`}),(0,x.jsx)(`ul`,{className:`col-span-full grid grid-cols-subgrid`,children:j.map(B)})]})]})]})]})}export{D as CitizensView};
1
+ import{H as e,O as t,S as n,X as r,Xn as i,Zn as a,er as o,k as s,t as c,tn as l,v as u,x as d}from"./format-hyYD8qd8.js";import{t as f}from"./CliIcon-BRq1tnhu.js";import{k as p}from"./index-5CbC_NpF.js";import{n as m,t as h}from"./Pane-DFJdAhv9.js";import{i as g,o as _,s as v}from"./citizen-BRg9UIgD.js";import{r as y}from"./Quota-D6_yyawu.js";var b=o(a(),1),x=i(),S=[{window:`24h`,label:`24h`,title:`the last 24 hours`},{window:`7d`,label:`7d`,title:`the last 7 days`},{window:`all`,label:`All`,title:`all time`}];function C(e){let t=e.lastModel??e.model??`CLI default`,n=e.model!==void 0&&e.model!==t?`${t} · set to ${e.model}`:t;return e.effort===void 0?n:`${n} · ${e.effort}`}function w(e,t){return e.name.localeCompare(t.name)}function T(e,t){return e.role.localeCompare(t.role)||w(e,t)}function E({member:e,state:t,tokens:n,outputs:r,runners:i,placed:a,now:o}){let s=C(e),c=e.memberships.length===0?`no projects`:e.memberships.join(`, `),u=g(e,a);return(0,x.jsx)(`li`,{className:`col-span-full grid grid-cols-subgrid`,children:(0,x.jsxs)(l,{to:`/citizen/$name`,params:{name:e.name},className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-surface-2/50`,children:[(0,x.jsxs)(`span`,{className:`relative grid size-4 place-items-center`,children:[e.cli===null?null:(0,x.jsx)(f,{cli:e.cli,size:13}),e.status===`active`?(0,x.jsx)(y,{member:e,runners:i,placed:a,now:o}):null]}),(0,x.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,x.jsx)(`span`,{className:`text-fg-secondary`,children:e.role}),(0,x.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:s,children:s}),(0,x.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:u.detail,children:u.label}),(0,x.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:c,children:c}),(0,x.jsxs)(`span`,{className:`col-[2/-1] row-start-2 text-right text-xs whitespace-nowrap text-fg-muted tabular-nums @min-[560px]:col-auto @min-[560px]:row-auto`,title:n.detail,children:[n.counts===null?n.label:(0,x.jsxs)(x.Fragment,{children:[`${n.counts.input} · `,(0,x.jsxs)(`span`,{className:`inline-grid justify-items-end`,children:[(0,x.jsx)(`span`,{className:`[grid-area:1/1]`,children:n.counts.output}),r.map(e=>(0,x.jsx)(`span`,{"data-width":e,className:`invisible [grid-area:1/1] before:content-[attr(data-width)]`},e))]})]}),n.spoken===null?null:(0,x.jsxs)(`span`,{className:`sr-only`,children:[`, `,n.spoken]})]}),(0,x.jsxs)(`span`,{className:`text-right text-xs whitespace-nowrap @min-[560px]:-ml-2 @min-[560px]:text-left`,children:[(0,x.jsxs)(`span`,{"aria-hidden":`true`,className:`hidden text-fg-muted @min-[560px]:inline`,children:[`·`,` `]}),(0,x.jsx)(`span`,{className:t.tone,title:t.detail,children:t.label})]})]})})}function D(){let{window:i=`24h`}=p({from:`/citizens`}),a=u(),o=s(),f=n(),g=t(),y=e(i),C=d(3e4),D=(0,b.useId)(),O=(0,b.useId)();if(a.data===void 0)return(0,x.jsx)(m,{children:`Reading the roster…`});let k=a.data.filter(e=>e.cli!==null),A=k.filter(e=>e.status===`active`).toSorted(T),j=k.filter(e=>e.status!==`active`).toSorted(w),M=new Set(A.map(e=>e.role)).size,N=r(o.data?.running??[]),P=r(o.data?.pending??[]),F=new Map((f.data??[]).flatMap(e=>e.runner===void 0?[]:[[e.slug,e.runner]])),I=new Map((y.data?.citizens??[]).map(e=>[e.agent,e])),L=e=>{if(e.status!==`active`)return{label:`retired`,detail:e.retiredAt===void 0?`retired`:`retired ${c(e.retiredAt,C)}`,tone:`text-fg-muted`};let t=[...new Set(N.filter(t=>t.agent===e.name).map(e=>e.scope))];return t.length>0?{label:`working`,detail:`in a turn at ${t.map(_).join(` and `)}`,tone:`text-emerald-300`}:P.some(t=>t.agent===e.name)?{label:`queued`,detail:`queued for a turn`,tone:`text-amber-300`}:{label:`resting`,detail:`resting`,tone:`text-fg-muted`}},R=e=>y.data===void 0?y.error===null?{label:`counting…`,counts:null,detail:void 0,spoken:null}:{label:`tokens unknown`,counts:null,detail:y.error.message,spoken:null}:v(I.get(e.name),i),z=[...new Set([...A,...j].flatMap(e=>R(e).counts?.output??[]))],B=e=>(0,x.jsx)(E,{member:e,state:L(e),tokens:R(e),outputs:z,runners:g.data??[],placed:F,now:C},e.name),V=(0,x.jsxs)(`nav`,{"aria-labelledby":D,className:`flex shrink-0 items-center gap-1`,children:[(0,x.jsx)(`span`,{id:D,className:`mr-1 text-caps`,children:`Tokens`}),S.map(e=>(0,x.jsx)(l,{to:`/citizens`,search:{window:e.window},title:e.title,"aria-current":e.window===i?`page`:void 0,className:`rounded-md px-2 py-1 text-xs transition-colors ${e.window===i?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`}`,children:e.label},e.window))]});return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(h,{title:`Citizens`,subtitle:`${A.length} active in ${M===1?`1 role`:`${M} roles`}${j.length===0?``:` · ${j.length} retired`}`,trailing:V}),(0,x.jsxs)(`div`,{className:`@container flex-1 overflow-y-auto px-2 py-2`,children:[A.length===0?(0,x.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:j.length===0?`No citizens yet.`:`No active citizens.`}):null,(0,x.jsxs)(`div`,{className:`grid grid-cols-[auto_auto_auto_minmax(0,max-content)_minmax(0,max-content)_minmax(3rem,1fr)_auto] gap-x-3 @min-[560px]:grid-cols-[auto_auto_auto_minmax(0,max-content)_minmax(0,max-content)_minmax(0,max-content)_minmax(max-content,1fr)_auto]`,children:[(0,x.jsx)(`ul`,{className:`col-span-full grid grid-cols-subgrid`,children:A.map(B)}),j.length===0?null:(0,x.jsxs)(`section`,{"aria-labelledby":O,className:`col-span-full mt-2 grid grid-cols-subgrid border-t border-line pt-2`,children:[(0,x.jsx)(`h3`,{id:O,className:`col-span-full px-2 py-1 text-section`,children:`Retired`}),(0,x.jsx)(`ul`,{className:`col-span-full grid grid-cols-subgrid`,children:j.map(B)})]})]})]})]})}export{D as CitizensView};
@@ -1 +1 @@
1
- import{Kn as e}from"./format-Dhd2NUB3.js";var t=`M6.766 11.328c-2.063-.25-3.516-1.734-3.516-3.656 0-.781.281-1.625.75-2.188-.203-.515-.172-1.609.063-2.062.625-.078 1.468.25 1.968.703.594-.187 1.219-.281 1.985-.281.765 0 1.39.094 1.953.265.484-.437 1.344-.765 1.969-.687.218.422.25 1.515.046 2.047.5.593.766 1.39.766 2.203 0 1.922-1.453 3.375-3.547 3.64.531.344.89 1.094.89 1.954v1.625c0 .468.391.734.86.547C13.781 14.359 16 11.53 16 8.03 16 3.61 12.406 0 7.984 0 3.563 0 0 3.61 0 8.031a7.88 7.88 0 0 0 5.172 7.422c.422.156.828-.125.828-.547v-1.25c-.219.094-.5.156-.75.156-1.031 0-1.64-.562-2.078-1.609-.172-.422-.36-.672-.719-.719-.187-.015-.25-.093-.25-.187 0-.188.313-.328.625-.328.453 0 .844.281 1.25.86.313.452.64.655 1.031.655s.641-.14 1-.5c.266-.265.47-.5.657-.656`,n={claude:{label:`Claude Code`,path:`M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z`,fill:`#D97757`,accent:`#fb923c`},codex:{label:`Codex`,path:`M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z`,fill:`#f5f5f5`,accent:`#10b981`}},r=e();function i({cli:e,size:t=16}){let i=n[e];return(0,r.jsx)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,"aria-hidden":`true`,className:`shrink-0`,children:(0,r.jsx)(`path`,{d:i.path,fill:i.fill,fillRule:`evenodd`,clipRule:`evenodd`})})}export{n,t as r,i as t};
1
+ import{Xn as e}from"./format-hyYD8qd8.js";var t=`M6.766 11.328c-2.063-.25-3.516-1.734-3.516-3.656 0-.781.281-1.625.75-2.188-.203-.515-.172-1.609.063-2.062.625-.078 1.468.25 1.968.703.594-.187 1.219-.281 1.985-.281.765 0 1.39.094 1.953.265.484-.437 1.344-.765 1.969-.687.218.422.25 1.515.046 2.047.5.593.766 1.39.766 2.203 0 1.922-1.453 3.375-3.547 3.64.531.344.89 1.094.89 1.954v1.625c0 .468.391.734.86.547C13.781 14.359 16 11.53 16 8.03 16 3.61 12.406 0 7.984 0 3.563 0 0 3.61 0 8.031a7.88 7.88 0 0 0 5.172 7.422c.422.156.828-.125.828-.547v-1.25c-.219.094-.5.156-.75.156-1.031 0-1.64-.562-2.078-1.609-.172-.422-.36-.672-.719-.719-.187-.015-.25-.093-.25-.187 0-.188.313-.328.625-.328.453 0 .844.281 1.25.86.313.452.64.655 1.031.655s.641-.14 1-.5c.266-.265.47-.5.657-.656`,n={claude:{label:`Claude Code`,path:`M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z`,fill:`#D97757`,accent:`#fb923c`},codex:{label:`Codex`,path:`M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z`,fill:`#f5f5f5`,accent:`#10b981`}},r=e();function i({cli:e,size:t=16}){let i=n[e];return(0,r.jsx)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,"aria-hidden":`true`,className:`shrink-0`,children:(0,r.jsx)(`path`,{d:i.path,fill:i.fill,fillRule:`evenodd`,clipRule:`evenodd`})})}export{n,t as r,i as t};
@@ -1 +1 @@
1
- import{F as e,Gn as t,Kn as n,Lt as r,S as i,V as a,Xn as o,Zt as s,j as c,qn as l,t as u,u as d,v as f,x as p,yt as m}from"./format-Dhd2NUB3.js";import{n as h,t as g}from"./Button-D4-iu6aX.js";import{t as _}from"./CliIcon-DL4ZwgZv.js";import{D as v,E as y,T as b,k as x,w as S}from"./index-iplooQqq.js";import{t as C}from"./Markdown-DPqvK--4.js";import{a as w,o as T,r as E}from"./ThreadForms-DwUOktyP.js";import{n as D,t as O}from"./Pane-C9TbEME4.js";import{a as k,f as A,o as j}from"./citizen-BOn5BBRL.js";import{n as M,r as N,t as P}from"./Picker-BK48MjLY.js";var F=o(l(),1),I=n(),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))}else e.key===`Enter`&&i&&d[o]!==void 0?(e.preventDefault(),p(d[o])):e.key===`Tab`?a(!1):e.key===`Escape`&&i&&(e.preventDefault(),e.stopPropagation(),a(!1))},className:T}),i&&d.length>0&&(d.length!==1||d[0]!==e)?(0,I.jsx)(`div`,{className:`max-h-48 ${P}`,children:d.map((e,t)=>(0,I.jsxs)(`button`,{ref:e=>{l.current[t]=e},type:`button`,tabIndex:-1,"aria-current":t===o?`true`:void 0,onPointerDown:e=>e.preventDefault(),onPointerEnter:()=>s(t),onClick:()=>p(e),className:N(t===o),children:[(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-secondary`,children:e}),(0,I.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-muted`,children:z(e,f)})]},e))}):null]})}function V({word:e,children:t}){return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,I.jsx)(`span`,{className:`shrink-0 text-xs text-fg-tertiary`,children:e}),t]})}function H(e,t){return r(typeof e==`string`?new Date(e):e,t)}function U({cron:e}){let t=a(),n=b(e);if(n.kind===`thread`){let e=t.data?.find(e=>e.id===n.id)?.title??n.id;return(0,I.jsxs)(s,{to:`/thread/$threadId`,params:{threadId:n.id},className:`truncate hover:text-fg-primary`,children:[`thread “`,e,`”`]})}return n.kind===`channel`?(0,I.jsxs)(s,{to:`/c/$`,params:{_splat:n.ref},className:`hover:text-fg-primary`,children:[`#`,n.ref]}):n.kind===`place`?(0,I.jsxs)(s,{to:`/p/$slug`,params:{slug:n.project},className:`hover:text-fg-primary`,children:[n.project,`'s channels`]}):(0,I.jsxs)(`span`,{children:[`home at `,j(n.scope)]})}function W({cron:e,next:n,member:r,zone:i,now:a,focused:o}){let l=(0,F.useRef)(null);(0,F.useEffect)(()=>{o&&l.current!==null&&(l.current.open=!0,l.current.scrollIntoView({block:`nearest`}))},[o]);let{api:d}=c(),f=t(),[p,m]=(0,F.useState)(!1),[v,b]=(0,F.useState)(``),x=()=>void f.invalidateQueries({queryKey:[`crons`]}),S=h({mutationFn:t=>d.pauseCron(e.id,t),onSuccess:x}),w=h({mutationFn:()=>d.removeCron(e.id,v.trim()),onSuccess:x}),D=`at`in e.schedule?`once, ${H(e.schedule.at,i)}`:`${e.schedule.cron} · ${e.schedule.timezone??i}`,O=e.ended===void 0?e.paused===void 0?n===null?`no time to come`:n.getTime()<=a?`due, waiting for its turn`:u(n.toISOString(),a):`paused`:`ended ${u(e.ended.at,a)}`,k=y(e);return(0,I.jsx)(`li`,{className:`rounded-lg ${o?`bg-surface-2/30`:``}`,children:(0,I.jsxs)(`details`,{ref:l,className:`group`,children:[(0,I.jsxs)(`summary`,{className:`cursor-pointer list-none rounded-lg px-2 py-2 hover:bg-surface-2/40 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2 text-sm`,children:[r?.cli===void 0||r.cli===null?null:(0,I.jsx)(_,{cli:r.cli,size:13}),(0,I.jsx)(`span`,{className:`shrink-0 text-fg-secondary`,children:e.agent}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-primary`,children:e.title}),(0,I.jsx)(`span`,{className:`shrink-0 text-xs ${e.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:e}),e.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 `,e.lastRun.outcome,` `,u(e.lastRun.at,a)]})]}),k?(0,I.jsxs)(`span`,{className:`text-amber-300`,children:[`· `,e.failures,` failed in a row`]}):null]})]}),(0,I.jsxs)(`div`,{className:`space-y-3 px-2 pt-1 pb-3`,children:[(0,I.jsx)(`div`,{className:`rounded-lg bg-surface-2/30 px-3 py-2`,children:(0,I.jsx)(C,{text:e.note})}),(0,I.jsxs)(`p`,{className:`text-meta`,children:[`Set by `,e.createdBy,` `,u(e.createdAt,a),e.lastFiredAt===void 0?``:` · fired last ${H(e.lastFiredAt,i)}`,e.ended===void 0?``:` · ended by ${e.ended.by}: ${e.ended.reason}`]}),n===null?null:(0,I.jsxs)(`p`,{className:`text-meta`,children:[`Next `,H(n,i),` (`,i,`)`]}),e.lastRun===void 0?null:(0,I.jsx)(s,{to:`/citizen/$name`,params:{name:e.agent},search:{tab:`turns`,turn:e.lastRun.turnId},className:`text-meta underline-offset-2 hover:text-fg-primary hover:underline`,children:`Open its last turn`}),e.ended===void 0?p?(0,I.jsxs)(`form`,{"aria-label":`Remove ${e.title}`,className:`space-y-2`,onSubmit:e=>{e.preventDefault(),w.mutate()},children:[(0,I.jsx)(`input`,{value:v,"aria-label":`Why it ends`,placeholder:`Why it ends`,onChange:e=>b(e.target.value),className:T}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:()=>m(!1),children:`Cancel`}),(0,I.jsx)(g,{variant:`primary`,type:`submit`,disabled:w.isPending||v.trim()===``,children:w.isPending?`Removing…`:`Remove cron`})]}),(0,I.jsx)(E,{error:w.error})]}):(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:()=>S.mutate(e.paused===void 0),disabled:S.isPending,children:e.paused===void 0?`Pause`:`Resume`}),(0,I.jsx)(g,{onClick:()=>m(!0),children:`Remove…`}),(0,I.jsx)(E,{error:S.error})]}):null]})]})})}function G({zone:e,onDone:n}){let{api:r}=c(),i=t(),[a,o]=(0,F.useState)(e),s=new Intl.DateTimeFormat().resolvedOptions().timeZone,l=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(),l.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)(g,{onClick:()=>o(s),children:[`Use `,s]})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:n,children:`Cancel`}),(0,I.jsx)(g,{variant:`primary`,type:`submit`,disabled:l.isPending||a.trim()===``||a.trim()===e,children:l.isPending?`Saving…`:`Save`})]}),(0,I.jsx)(E,{error:l.error})]})}function K({members:n,preferred:r,zone:a,onDone:o}){let{api:s}=c(),l=t(),u=i(),d=e(),[f,_]=(0,F.useState)(n.find(e=>e.name===r)?.name??n[0]?.name??``),y=n.find(e=>e.name===f),b=y===void 0?[]:A(y),[x,S]=(0,F.useState)(b[0]??`society`),[C,D]=(0,F.useState)(``),[O,j]=(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=p(3e4),ee=(x===`society`?d.data?.channels??[]:u.data?.find(e=>e.slug===x)?.channels??[]).filter(e=>e!==`general`),X=O===`repeats`?{cron:N,...L.trim()===``?{}:{timezone:L.trim()}}:{at:z===``?``:new Date(z).toISOString()},Z=v(O===`once`&&z===``?{at:`invalid`}:X,a,new Date(Y)),Q=O===`repeats`?L.trim()===``?a:L.trim():a,$=h({mutationFn:()=>s.createCron({agent:f,title:W.trim(),note:K.trim(),project:x,...C===``?{}:{channel:C},...X}),onSuccess:()=>{l.invalidateQueries({queryKey:[`crons`]}),o()}});return(0,I.jsxs)(`form`,{"aria-label":`New cron`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),$.mutate()},children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(V,{word:`wakes`,children:(0,I.jsx)(M,{label:`Citizen`,choices: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:f,onChange:e=>{let t=n.find(t=>t.name===e);_(e),S(t===void 0?m:A(t)[0]??`society`),D(``)}})}),(0,I.jsx)(V,{word:`at`,children:(0,I.jsx)(M,{label:`Where`,choices:k(b),value:x,onChange:e=>{S(e),D(``)}})}),(0,I.jsx)(V,{word:`in`,children:(0,I.jsx)(M,{label:`Conversation`,choices:[{value:``,name:`its home`,id:null,description:`general, and work tied to no other channel`},...ee.map(e=>({value:e,name:`#${e}`,id:null,description:`a workstream's own conversation`}))],value:C,onChange:D})})]}),(0,I.jsx)(`input`,{ref:J,value:W,maxLength:120,"aria-label":`Title`,placeholder:`Title, such as Morning report`,onChange:e=>G(e.target.value),className:T}),(0,I.jsx)(`textarea`,{value:K,rows:3,"aria-label":`Note`,placeholder:`What to do when it fires`,onChange:e=>q(e.target.value),className:w}),(0,I.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,I.jsx)(`legend`,{className:`sr-only`,children:`How often`}),[`repeats`,`once`].map(e=>(0,I.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${O===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:O===e,onChange:()=>j(e),className:`sr-only`}),e===`repeats`?`Repeats`:`Once`]},e))]}),O===`repeats`?(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,I.jsx)(`input`,{value:N,spellCheck:!1,"aria-label":`Cron expression`,placeholder:`minute hour day month weekday`,onChange:e=>P(e.target.value),className:T})}),(0,I.jsx)(B,{value:L,onChange:R,label:`Its time zone`,placeholder:`${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:T}),(0,I.jsx)(`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,`).`]})}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:o,children:`Cancel`}),(0,I.jsx)(g,{variant:`primary`,type:`submit`,disabled:$.isPending||f===``||W.trim()===``||K.trim()===``||`error`in Z,children:$.isPending?`Setting…`:`Set cron`})]}),(0,I.jsx)(E,{error:$.error})]})}function q(){let{agent:t,cron:n}=x({from:`/crons`}),r=d(),i=f(),a=e(),o=p(3e4),[c,l]=(0,F.useState)(null),u=a.data?.timezone??`UTC`,m=(r.data??[]).filter(e=>t===void 0||e.agent===t),h=S(m,u),_=m.filter(y).length,v=(i.data??[]).filter(e=>e.status===`active`&&e.cli!==null),b=e=>i.data?.find(t=>t.name===e);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(O,{title:t===void 0?`Crons`:`Crons of ${t}`,subtitle:[`${h.active.length} running`,...h.paused.length===0?[]:[`${h.paused.length} paused`],..._===0?[]:[`${_} failing`],`times in ${u}`].join(` · `),trailing:c===null?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g,{onClick:()=>l(`zone`),children:`Time zone…`}),(0,I.jsx)(g,{onClick:()=>l(`new`),disabled:v.length===0,children:`New cron…`})]}):null}),c===`new`?(0,I.jsx)(K,{members:v,preferred:t,zone:u,onDone:()=>l(null)}):c===`zone`?(0,I.jsx)(G,{zone:u,onDone:()=>l(null)}):null,(0,I.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[t===void 0?null:(0,I.jsx)(s,{to:`/crons`,className:`block px-2 pb-2 text-meta hover:text-fg-primary`,children:`Show every citizen's crons`}),r.error!==null&&r.data===void 0?(0,I.jsxs)(D,{children:[`Could not read the crons: `,r.error.message]}):r.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.`}):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:b(e.agent),zone:u,now:o,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:b(e.agent),zone:u,now:o,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:b(e.agent),zone:u,now:o,focused:e.id===n},e.id))})]})]})]})}export{q as CronsView};
1
+ import{F as e,S as t,V as n,Vt as r,Xn as i,Yn as a,Zn as o,er as s,j as c,t as l,tn as u,u as d,v as f,x as p,xt as m}from"./format-hyYD8qd8.js";import{n as h,t as g}from"./Button-B6EN7Lh7.js";import{t as _}from"./CliIcon-BRq1tnhu.js";import{D as v,E as y,T as b,k as x,w as S}from"./index-5CbC_NpF.js";import{t as C}from"./Markdown-DYk-gVwe.js";import{a as w,o as T,r as E}from"./ThreadForms-BlOEvY5E.js";import{n as D,t as O}from"./Pane-DFJdAhv9.js";import{a as k,f as A,o as j}from"./citizen-BRg9UIgD.js";import{n as M,r as N,t as P}from"./Picker-CAEREZF9.js";var F=s(o(),1),I=i(),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))}else e.key===`Enter`&&i&&d[o]!==void 0?(e.preventDefault(),p(d[o])):e.key===`Tab`?a(!1):e.key===`Escape`&&i&&(e.preventDefault(),e.stopPropagation(),a(!1))},className:T}),i&&d.length>0&&(d.length!==1||d[0]!==e)?(0,I.jsx)(`div`,{className:`max-h-48 ${P}`,children:d.map((e,t)=>(0,I.jsxs)(`button`,{ref:e=>{l.current[t]=e},type:`button`,tabIndex:-1,"aria-current":t===o?`true`:void 0,onPointerDown:e=>e.preventDefault(),onPointerEnter:()=>s(t),onClick:()=>p(e),className:N(t===o),children:[(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-secondary`,children:e}),(0,I.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-muted`,children:z(e,f)})]},e))}):null]})}function V({word:e,children:t}){return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,I.jsx)(`span`,{className:`shrink-0 text-xs text-fg-tertiary`,children:e}),t]})}function H(e,t){return r(typeof e==`string`?new Date(e):e,t)}function U({cron:e}){let t=n(),r=b(e);if(r.kind===`thread`){let e=t.data?.find(e=>e.id===r.id)?.title??r.id;return(0,I.jsxs)(u,{to:`/thread/$threadId`,params:{threadId:r.id},className:`truncate hover:text-fg-primary`,children:[`thread “`,e,`”`]})}return r.kind===`channel`?(0,I.jsxs)(u,{to:`/c/$`,params:{_splat:r.ref},className:`hover:text-fg-primary`,children:[`#`,r.ref]}):r.kind===`place`?(0,I.jsxs)(u,{to:`/p/$slug`,params:{slug:r.project},className:`hover:text-fg-primary`,children:[r.project,`'s channels`]}):(0,I.jsxs)(`span`,{children:[`home at `,j(r.scope)]})}function W({cron:e,next:t,member:n,zone:r,now:i,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:d}=c(),f=a(),[p,m]=(0,F.useState)(!1),[v,b]=(0,F.useState)(``),x=()=>void f.invalidateQueries({queryKey:[`crons`]}),S=h({mutationFn:t=>d.pauseCron(e.id,t),onSuccess:x}),w=h({mutationFn:()=>d.removeCron(e.id,v.trim()),onSuccess:x}),D=`at`in e.schedule?`once, ${H(e.schedule.at,r)}`:`${e.schedule.cron} · ${e.schedule.timezone??r}`,O=e.ended===void 0?e.paused===void 0?t===null?`no time to come`:t.getTime()<=i?`due, waiting for its turn`:l(t.toISOString(),i):`paused`:`ended ${l(e.ended.at,i)}`,k=y(e);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:[n?.cli===void 0||n.cli===null?null:(0,I.jsx)(_,{cli:n.cli,size:13}),(0,I.jsx)(`span`,{className:`shrink-0 text-fg-secondary`,children:e.agent}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-primary`,children:e.title}),(0,I.jsx)(`span`,{className:`shrink-0 text-xs ${e.paused===void 0?`text-fg-muted`:`text-amber-300`}`,title:t===null?void 0:`${H(t,r)}, ${r}`,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:e}),e.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 `,e.lastRun.outcome,` `,l(e.lastRun.at,i)]})]}),k?(0,I.jsxs)(`span`,{className:`text-amber-300`,children:[`· `,e.failures,` failed in a row`]}):null]})]}),(0,I.jsxs)(`div`,{className:`space-y-3 px-2 pt-1 pb-3`,children:[(0,I.jsx)(`div`,{className:`rounded-lg bg-surface-2/30 px-3 py-2`,children:(0,I.jsx)(C,{text:e.note})}),(0,I.jsxs)(`p`,{className:`text-meta`,children:[`Set by `,e.createdBy,` `,l(e.createdAt,i),e.lastFiredAt===void 0?``:` · fired last ${H(e.lastFiredAt,r)}`,e.ended===void 0?``:` · ended by ${e.ended.by}: ${e.ended.reason}`]}),t===null?null:(0,I.jsxs)(`p`,{className:`text-meta`,children:[`Next `,H(t,r),` (`,r,`)`]}),e.lastRun===void 0?null:(0,I.jsx)(u,{to:`/citizen/$name`,params:{name:e.agent},search:{tab:`turns`,turn:e.lastRun.turnId},className:`text-meta underline-offset-2 hover:text-fg-primary hover:underline`,children:`Open its last turn`}),e.ended===void 0?p?(0,I.jsxs)(`form`,{"aria-label":`Remove ${e.title}`,className:`space-y-2`,onSubmit:e=>{e.preventDefault(),w.mutate()},children:[(0,I.jsx)(`input`,{value:v,"aria-label":`Why it ends`,placeholder:`Why it ends`,onChange:e=>b(e.target.value),className:T}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:()=>m(!1),children:`Cancel`}),(0,I.jsx)(g,{variant:`primary`,type:`submit`,disabled:w.isPending||v.trim()===``,children:w.isPending?`Removing…`:`Remove cron`})]}),(0,I.jsx)(E,{error:w.error})]}):(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:()=>S.mutate(e.paused===void 0),disabled:S.isPending,children:e.paused===void 0?`Pause`:`Resume`}),(0,I.jsx)(g,{onClick:()=>m(!0),children:`Remove…`}),(0,I.jsx)(E,{error:S.error})]}):null]})]})})}function G({zone:e,onDone:t}){let{api:n}=c(),r=a(),[i,o]=(0,F.useState)(e),s=new Intl.DateTimeFormat().resolvedOptions().timeZone,l=h({mutationFn:()=>n.setTimezone(i.trim()),onSuccess:()=>{r.invalidateQueries({queryKey:[`society`]}),r.invalidateQueries({queryKey:[`crons`]}),t()}});return(0,I.jsxs)(`form`,{"aria-label":`Time zone`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),l.mutate()},children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(B,{value:i,onChange:o,label:`Society time zone`}),s===i?null:(0,I.jsxs)(g,{onClick:()=>o(s),children:[`Use `,s]})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:t,children:`Cancel`}),(0,I.jsx)(g,{variant:`primary`,type:`submit`,disabled:l.isPending||i.trim()===``||i.trim()===e,children:l.isPending?`Saving…`:`Save`})]}),(0,I.jsx)(E,{error:l.error})]})}function K({members:n,preferred:r,zone:i,onDone:o}){let{api:s}=c(),l=a(),u=t(),d=e(),[f,_]=(0,F.useState)(n.find(e=>e.name===r)?.name??n[0]?.name??``),y=n.find(e=>e.name===f),b=y===void 0?[]:A(y),[x,S]=(0,F.useState)(b[0]??`society`),[C,D]=(0,F.useState)(``),[O,j]=(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=p(3e4),ee=(x===`society`?d.data?.channels??[]:u.data?.find(e=>e.slug===x)?.channels??[]).filter(e=>e!==`general`),X=O===`repeats`?{cron:N,...L.trim()===``?{}:{timezone:L.trim()}}:{at:z===``?``:new Date(z).toISOString()},Z=v(O===`once`&&z===``?{at:`invalid`}:X,i,new Date(Y)),Q=O===`repeats`?L.trim()===``?i:L.trim():i,$=h({mutationFn:()=>s.createCron({agent:f,title:W.trim(),note:K.trim(),project:x,...C===``?{}:{channel:C},...X}),onSuccess:()=>{l.invalidateQueries({queryKey:[`crons`]}),o()}});return(0,I.jsxs)(`form`,{"aria-label":`New cron`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),$.mutate()},children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(V,{word:`wakes`,children:(0,I.jsx)(M,{label:`Citizen`,choices: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:f,onChange:e=>{let t=n.find(t=>t.name===e);_(e),S(t===void 0?m:A(t)[0]??`society`),D(``)}})}),(0,I.jsx)(V,{word:`at`,children:(0,I.jsx)(M,{label:`Where`,choices:k(b),value:x,onChange:e=>{S(e),D(``)}})}),(0,I.jsx)(V,{word:`in`,children:(0,I.jsx)(M,{label:`Conversation`,choices:[{value:``,name:`its home`,id:null,description:`general, and work tied to no other channel`},...ee.map(e=>({value:e,name:`#${e}`,id:null,description:`a workstream's own conversation`}))],value:C,onChange:D})})]}),(0,I.jsx)(`input`,{ref:J,value:W,maxLength:120,"aria-label":`Title`,placeholder:`Title, such as Morning report`,onChange:e=>G(e.target.value),className:T}),(0,I.jsx)(`textarea`,{value:K,rows:3,"aria-label":`Note`,placeholder:`What to do when it fires`,onChange:e=>q(e.target.value),className:w}),(0,I.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,I.jsx)(`legend`,{className:`sr-only`,children:`How often`}),[`repeats`,`once`].map(e=>(0,I.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${O===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:O===e,onChange:()=>j(e),className:`sr-only`}),e===`repeats`?`Repeats`:`Once`]},e))]}),O===`repeats`?(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,I.jsx)(`input`,{value:N,spellCheck:!1,"aria-label":`Cron expression`,placeholder:`minute hour day month weekday`,onChange:e=>P(e.target.value),className:T})}),(0,I.jsx)(B,{value:L,onChange:R,label:`Its time zone`,placeholder:`${i}, the society's`})]}):(0,I.jsx)(`input`,{type:`datetime-local`,value:z,"aria-label":`When, in this browser's time`,onChange:e=>U(e.target.value),className:T}),(0,I.jsx)(`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,`).`]})}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(g,{onClick:o,children:`Cancel`}),(0,I.jsx)(g,{variant:`primary`,type:`submit`,disabled:$.isPending||f===``||W.trim()===``||K.trim()===``||`error`in Z,children:$.isPending?`Setting…`:`Set cron`})]}),(0,I.jsx)(E,{error:$.error})]})}function q(){let{agent:t,cron:n}=x({from:`/crons`}),r=d(),i=f(),a=e(),o=p(3e4),[s,c]=(0,F.useState)(null),l=a.data?.timezone??`UTC`,m=(r.data??[]).filter(e=>t===void 0||e.agent===t),h=S(m,l),_=m.filter(y).length,v=(i.data??[]).filter(e=>e.status===`active`&&e.cli!==null),b=e=>i.data?.find(t=>t.name===e);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(O,{title:t===void 0?`Crons`:`Crons of ${t}`,subtitle:[`${h.active.length} running`,...h.paused.length===0?[]:[`${h.paused.length} paused`],..._===0?[]:[`${_} failing`],`times in ${l}`].join(` · `),trailing:s===null?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g,{onClick:()=>c(`zone`),children:`Time zone…`}),(0,I.jsx)(g,{onClick:()=>c(`new`),disabled:v.length===0,children:`New cron…`})]}):null}),s===`new`?(0,I.jsx)(K,{members:v,preferred:t,zone:l,onDone:()=>c(null)}):s===`zone`?(0,I.jsx)(G,{zone:l,onDone:()=>c(null)}):null,(0,I.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[t===void 0?null:(0,I.jsx)(u,{to:`/crons`,className:`block px-2 pb-2 text-meta hover:text-fg-primary`,children:`Show every citizen's crons`}),r.error!==null&&r.data===void 0?(0,I.jsxs)(D,{children:[`Could not read the crons: `,r.error.message]}):r.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.`}):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:b(e.agent),zone:l,now:o,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:b(e.agent),zone:l,now:o,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:b(e.agent),zone:l,now:o,focused:e.id===n},e.id))})]})]})]})}export{q as CronsView};
@@ -1 +1 @@
1
- import{Kn as e}from"./format-Dhd2NUB3.js";var t=e(),n=`flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40`;function r({nested:e,children:n}){return(0,t.jsx)(`ul`,{className:e?`ml-[5px] border-l border-line-strong pl-2`:`mt-2`,children:n})}function i({name:e,open:r,onToggle:i,children:a}){return(0,t.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:i,className:n,children:[(0,t.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block w-2.5 shrink-0 text-[10px] text-fg-muted transition-transform ${r?`rotate-90`:``}`,children:`▸`}),(0,t.jsxs)(`span`,{className:`min-w-0 truncate text-fg-primary`,children:[e,`/`]}),a]})}function a(){return(0,t.jsx)(`span`,{"aria-hidden":`true`,className:`w-2.5 shrink-0`})}export{r as i,i as n,n as r,a as t};
1
+ import{Xn as e}from"./format-hyYD8qd8.js";var t=e(),n=`flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40`;function r({nested:e,children:n}){return(0,t.jsx)(`ul`,{className:e?`ml-[5px] border-l border-line-strong pl-2`:`mt-2`,children:n})}function i({name:e,open:r,onToggle:i,children:a}){return(0,t.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:i,className:n,children:[(0,t.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block w-2.5 shrink-0 text-[10px] text-fg-muted transition-transform ${r?`rotate-90`:``}`,children:`▸`}),(0,t.jsxs)(`span`,{className:`min-w-0 truncate text-fg-primary`,children:[e,`/`]}),a]})}function a(){return(0,t.jsx)(`span`,{"aria-hidden":`true`,className:`w-2.5 shrink-0`})}export{r as i,i as n,n as r,a as t};
@@ -1,4 +1,4 @@
1
- import{I as e,K as t,Kn as n,S as r,Xn as i,Zt as a,c as o,it as s,qn as c,t as l,x as u}from"./format-Dhd2NUB3.js";import{A as d,k as f}from"./index-iplooQqq.js";import{t as p}from"./BackLink-BLiSCuKv.js";import{_ as m,a as h,d as g,g as _,h as v,i as y,n as b,p as x,r as S,s as C,t as w,u as T}from"./Markdown-DPqvK--4.js";import{n as E,t as D}from"./Pane-C9TbEME4.js";var O=i(c(),1),k=n(),A=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,j=`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`,M=1e3,N=2e4;function P({source:e,path:t}){let n=t===``?[]:t.split(`/`),r=`text-fg-tertiary hover:text-fg-primary`;return(0,k.jsxs)(`nav`,{"aria-label":`Path`,className:`flex flex-wrap items-center gap-x-1 text-meta`,children:[n.length===0?(0,k.jsx)(`span`,{children:`Files`}):(0,k.jsx)(b,{source:e,path:``,className:r,children:`Files`}),n.map((t,i)=>(0,k.jsxs)(O.Fragment,{children:[(0,k.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i===n.length-1?(0,k.jsx)(`span`,{className:`text-fg-secondary`,children:t}):(0,k.jsx)(b,{source:e,path:n.slice(0,i+1).join(`/`),className:r,children:t})]},n.slice(0,i+1).join(`/`)))]})}function F({rows:e}){let[t,...n]=e;if(t===void 0)return(0,k.jsx)(`p`,{className:`mt-3 text-meta`,children:`The table is empty.`});let r=n.slice(0,M),i=`border border-line px-2 py-1 text-left align-top whitespace-pre-wrap`;return(0,k.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,children:[(0,k.jsxs)(`table`,{className:`text-xs text-fg-secondary`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsx)(`tr`,{children:t.map((e,t)=>(0,k.jsx)(`th`,{scope:`col`,className:`${i} font-medium text-fg-primary`,children:e},t))})}),(0,k.jsx)(`tbody`,{children:r.map((e,t)=>(0,k.jsx)(`tr`,{children:e.map((e,t)=>(0,k.jsx)(`td`,{className:i,children:e},t))},t))})]}),n.length>r.length?(0,k.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,M,` of `,n.length,` rows`]}):null]})}function I({text:e,line:t}){let n=e.endsWith(`
1
+ import{I as e,K as t,S as n,Xn as r,Zn as i,c as a,er as o,it as s,t as c,tn as l,x as u}from"./format-hyYD8qd8.js";import{A as d,k as f}from"./index-5CbC_NpF.js";import{t as p}from"./BackLink-DNHWkHmh.js";import{_ as m,a as h,d as g,g as _,h as v,i as y,n as b,p as x,r as S,s as C,t as w,u as T}from"./Markdown-DYk-gVwe.js";import{n as E,t as D}from"./Pane-DFJdAhv9.js";var O=o(i(),1),k=r(),A=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,j=`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`,M=1e3,N=2e4;function P({source:e,path:t}){let n=t===``?[]:t.split(`/`),r=`text-fg-tertiary hover:text-fg-primary`;return(0,k.jsxs)(`nav`,{"aria-label":`Path`,className:`flex flex-wrap items-center gap-x-1 text-meta`,children:[n.length===0?(0,k.jsx)(`span`,{children:`Files`}):(0,k.jsx)(b,{source:e,path:``,className:r,children:`Files`}),n.map((t,i)=>(0,k.jsxs)(O.Fragment,{children:[(0,k.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i===n.length-1?(0,k.jsx)(`span`,{className:`text-fg-secondary`,children:t}):(0,k.jsx)(b,{source:e,path:n.slice(0,i+1).join(`/`),className:r,children:t})]},n.slice(0,i+1).join(`/`)))]})}function F({rows:e}){let[t,...n]=e;if(t===void 0)return(0,k.jsx)(`p`,{className:`mt-3 text-meta`,children:`The table is empty.`});let r=n.slice(0,M),i=`border border-line px-2 py-1 text-left align-top whitespace-pre-wrap`;return(0,k.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,children:[(0,k.jsxs)(`table`,{className:`text-xs text-fg-secondary`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsx)(`tr`,{children:t.map((e,t)=>(0,k.jsx)(`th`,{scope:`col`,className:`${i} font-medium text-fg-primary`,children:e},t))})}),(0,k.jsx)(`tbody`,{children:r.map((e,t)=>(0,k.jsx)(`tr`,{children:e.map((e,t)=>(0,k.jsx)(`td`,{className:i,children:e},t))},t))})]}),n.length>r.length?(0,k.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,M,` of `,n.length,` rows`]}):null]})}function I({text:e,line:t}){let n=e.endsWith(`
2
2
  `)?e.slice(0,-1).split(`
3
3
  `):e.split(`
4
- `),r=`mt-3 overflow-x-auto rounded-lg bg-surface-0/80 p-3 font-mono text-[12px] leading-relaxed text-fg-secondary shadow-[inset_0_0_0_1px_rgba(255,255,255,0.05)]`;return n.length>N?(0,k.jsx)(`pre`,{className:r,children:e}):(0,k.jsx)(`pre`,{className:r,children:n.map((e,n)=>(0,k.jsxs)(`span`,{className:`flex ${n+1===t?`line-target`:``}`,children:[(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`w-10 shrink-0 pr-3 text-right text-fg-muted select-none`,children:n+1}),(0,k.jsx)(`span`,{className:`whitespace-pre`,children:e===``?` `:e})]},n))})}function L({source:e,file:t,url:n,line:r}){let i=(0,O.useMemo)(()=>t.content===null?null:m(t.path,h(t.content)),[t.path,t.content]),a=t.path.split(`/`).at(-1)??t.path;return i===null?(0,k.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[a,` is `,_(t.size),`, more than the `,_(s),` the board shows.`]}):i.kind===`markdown`?(0,k.jsx)(`div`,{className:`mt-3`,children:(0,k.jsx)(w,{text:i.text,base:{source:e,dir:x(t.path)},line:r})}):i.kind===`image`?n===null?null:(0,k.jsx)(`img`,{src:n,alt:a,className:`mt-3 max-w-full rounded-lg`}):i.kind===`table`?(0,k.jsx)(F,{rows:i.rows}):i.kind===`text`?(0,k.jsx)(I,{text:i.text,line:r}):(0,k.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[a,` is not text (`,_(t.size),`).`]})}function R(e,t){let n=C(g(e??``)??``);return{path:n.path,line:t.line??n.line}}function z({source:e,path:n,line:r,where:i,parent:a,missing:s,away:c,readFrom:d}){let f=o(e,n),m=u(3e4),h=f.data,g=h?.kind===`file`?h.content:null,_=y(g,T(n)??`application/octet-stream`),v=n===``?`Files`:n.split(`/`).at(-1)??n,b=(0,O.useRef)(null);(0,O.useEffect)(()=>{r!==void 0&&h!==void 0&&b.current?.querySelector(`.line-target`)?.scrollIntoView({block:`center`})},[r,h]);let x;return x=h===void 0?f.error instanceof t&&f.error.status===404?(0,k.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:s}):f.error instanceof t&&f.error.status===503?(0,k.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:c}):f.error===null?(0,k.jsxs)(E,{children:[`Reading `,v,` from `,d,`…`]}):(0,k.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:f.error.message}):h.kind===`dir`?(0,k.jsx)(S,{source:e,file:h,className:`mt-3 space-y-1`}):(0,k.jsx)(L,{source:e,file:h,url:_,line:r}),(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(D,{leading:(0,k.jsx)(p,{fallback:a}),title:v,subtitle:h===void 0?i:`${i}${r===void 0?``:` · line ${r}`} · committed by ${h.commit.author} ${l(h.commit.at,m)} · ${h.commit.id.slice(0,7)}`,trailing:_===null?null:(0,k.jsx)(`a`,{href:_,download:v,className:j,children:`Download`})}),(0,k.jsxs)(`div`,{ref:b,className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,k.jsx)(P,{source:e,path:n}),x]})]})}function B(){let{taskId:t,_splat:n}=d({from:`/task/$taskId/files/$`}),{path:i,line:o}=R(n,f({from:`/task/$taskId/files/$`})),s=e(t),c=r(),l=s.data?.title??t,u=c.data?.find(e=>e.slug===s.data?.project);return(0,k.jsx)(z,{source:{kind:`task`,taskId:t},path:i,line:o,where:l,parent:(0,k.jsx)(a,{to:`/task/$taskId`,params:{taskId:t},"aria-label":`Back to the task ${l}`,className:A,children:`←`}),missing:`${i===``?`Nothing`:i} is not on task/${t} yet.`,away:`${v(u)}, is not connected, so the task's files cannot be read now.`,readFrom:`the task's runner`})}function V(){let{slug:e,_splat:t}=d({from:`/p/$slug/files/$`}),{path:n,line:i}=R(t,f({from:`/p/$slug/files/$`})),o=r(),s=o.data?.find(t=>t.slug===e),c=s?.name??e,l=s?.defaultBranch;return o.data!==void 0&&s===void 0?(0,k.jsxs)(E,{children:[`There is no project `,e,`.`]}):(0,k.jsx)(z,{source:{kind:`project`,slug:e},path:n,line:i,where:l===void 0?c:`${c} · ${l}`,parent:(0,k.jsx)(a,{to:`/p/$slug`,params:{slug:e},"aria-label":`Back to the project ${c}`,className:A,children:`←`}),missing:n===``?`Nothing on ${l??`the default branch`} yet.`:`${n} is not on ${l??`the default branch`}.`,away:`${v(s)}, is not connected, so the project's files cannot be read now.`,readFrom:`the project's runner`})}export{V as ProjectFileView,B as TaskFileView};
4
+ `),r=`mt-3 overflow-x-auto rounded-lg bg-surface-0/80 p-3 font-mono text-[12px] leading-relaxed text-fg-secondary shadow-[inset_0_0_0_1px_rgba(255,255,255,0.05)]`;return n.length>N?(0,k.jsx)(`pre`,{className:r,children:e}):(0,k.jsx)(`pre`,{className:r,children:n.map((e,n)=>(0,k.jsxs)(`span`,{className:`flex ${n+1===t?`line-target`:``}`,children:[(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`w-10 shrink-0 pr-3 text-right text-fg-muted select-none`,children:n+1}),(0,k.jsx)(`span`,{className:`whitespace-pre`,children:e===``?` `:e})]},n))})}function L({source:e,file:t,url:n,line:r}){let i=(0,O.useMemo)(()=>t.content===null?null:m(t.path,h(t.content)),[t.path,t.content]),a=t.path.split(`/`).at(-1)??t.path;return i===null?(0,k.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[a,` is `,_(t.size),`, more than the `,_(s),` the board shows.`]}):i.kind===`markdown`?(0,k.jsx)(`div`,{className:`mt-3`,children:(0,k.jsx)(w,{text:i.text,base:{source:e,dir:x(t.path)},line:r})}):i.kind===`image`?n===null?null:(0,k.jsx)(`img`,{src:n,alt:a,className:`mt-3 max-w-full rounded-lg`}):i.kind===`table`?(0,k.jsx)(F,{rows:i.rows}):i.kind===`text`?(0,k.jsx)(I,{text:i.text,line:r}):(0,k.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[a,` is not text (`,_(t.size),`).`]})}function R(e,t){let n=C(g(e??``)??``);return{path:n.path,line:t.line??n.line}}function z({source:e,path:n,line:r,where:i,parent:o,missing:s,away:l,readFrom:d}){let f=a(e,n),m=u(3e4),h=f.data,g=h?.kind===`file`?h.content:null,_=y(g,T(n)??`application/octet-stream`),v=n===``?`Files`:n.split(`/`).at(-1)??n,b=(0,O.useRef)(null);(0,O.useEffect)(()=>{r!==void 0&&h!==void 0&&b.current?.querySelector(`.line-target`)?.scrollIntoView({block:`center`})},[r,h]);let x;return x=h===void 0?f.error instanceof t&&f.error.status===404?(0,k.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:s}):f.error instanceof t&&f.error.status===503?(0,k.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:l}):f.error===null?(0,k.jsxs)(E,{children:[`Reading `,v,` from `,d,`…`]}):(0,k.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:f.error.message}):h.kind===`dir`?(0,k.jsx)(S,{source:e,file:h,className:`mt-3 space-y-1`}):(0,k.jsx)(L,{source:e,file:h,url:_,line:r}),(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(D,{leading:(0,k.jsx)(p,{fallback:o}),title:v,subtitle:h===void 0?i:`${i}${r===void 0?``:` · line ${r}`} · committed by ${h.commit.author} ${c(h.commit.at,m)} · ${h.commit.id.slice(0,7)}`,trailing:_===null?null:(0,k.jsx)(`a`,{href:_,download:v,className:j,children:`Download`})}),(0,k.jsxs)(`div`,{ref:b,className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,k.jsx)(P,{source:e,path:n}),x]})]})}function B(){let{taskId:t,_splat:r}=d({from:`/task/$taskId/files/$`}),{path:i,line:a}=R(r,f({from:`/task/$taskId/files/$`})),o=e(t),s=n(),c=o.data?.title??t,u=s.data?.find(e=>e.slug===o.data?.project);return(0,k.jsx)(z,{source:{kind:`task`,taskId:t},path:i,line:a,where:c,parent:(0,k.jsx)(l,{to:`/task/$taskId`,params:{taskId:t},"aria-label":`Back to the task ${c}`,className:A,children:`←`}),missing:`${i===``?`Nothing`:i} is not on task/${t} yet.`,away:`${v(u)}, is not connected, so the task's files cannot be read now.`,readFrom:`the task's runner`})}function V(){let{slug:e,_splat:t}=d({from:`/p/$slug/files/$`}),{path:r,line:i}=R(t,f({from:`/p/$slug/files/$`})),a=n(),o=a.data?.find(t=>t.slug===e),s=o?.name??e,c=o?.defaultBranch;return a.data!==void 0&&o===void 0?(0,k.jsxs)(E,{children:[`There is no project `,e,`.`]}):(0,k.jsx)(z,{source:{kind:`project`,slug:e},path:r,line:i,where:c===void 0?s:`${s} · ${c}`,parent:(0,k.jsx)(l,{to:`/p/$slug`,params:{slug:e},"aria-label":`Back to the project ${s}`,className:A,children:`←`}),missing:r===``?`Nothing on ${c??`the default branch`} yet.`:`${r} is not on ${c??`the default branch`}.`,away:`${v(o)}, is not connected, so the project's files cannot be read now.`,readFrom:`the project's runner`})}export{V as ProjectFileView,B as TaskFileView};
@@ -1 +1 @@
1
- import{Gn as e,Kn as t,S as n,Xn as r,Zt as i,g as a,j as o,qn as s,t as c,x as l,yt as u}from"./format-Dhd2NUB3.js";import{n as d,t as f}from"./Button-D4-iu6aX.js";import{l as p}from"./compose-D-X3BQgY.js";import{A as m}from"./index-iplooQqq.js";import{t as h}from"./BackLink-BLiSCuKv.js";import{t as g}from"./Markdown-DPqvK--4.js";import{r as _}from"./ThreadForms-DwUOktyP.js";import{n as v,t as y}from"./Pane-C9TbEME4.js";var b=r(s(),1),x=t(),S=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function C(){let{scope:t,topic:r}=m({from:`/knowledge/$scope/$topic`}),{api:s}=o(),C=e(),w=p(),T=a(t),E=n(),D=l(3e4),[O,k]=(0,b.useState)(!1),A=t===u,j=A?`the society`:E.data?.find(e=>e.slug===t)?.name??t,M=T.data?.find(e=>e.topic===r),N=d({mutationFn:()=>s.removeKnowledge({project:A?null:t,topic:r}),onSuccess:async()=>{await C.invalidateQueries({queryKey:[`knowledge`,t]}),await w(A?{to:`/society`}:{to:`/p/$slug`,params:{slug:t}})}}),P=A?(0,x.jsx)(i,{to:`/society`,"aria-label":`Back to the society`,className:S,children:`←`}):(0,x.jsx)(i,{to:`/p/$slug`,params:{slug:t},"aria-label":`Back to ${j}`,className:S,children:`←`});return M===void 0?(0,x.jsx)(v,{children:T.data===void 0?`Reading…`:`${j} has no topic ${r}.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(y,{leading:(0,x.jsx)(h,{fallback:P}),title:M.topic,subtitle:`Knowledge of ${j} · written by ${M.updatedBy} ${c(M.updatedAt,D)}`,trailing:O?null:(0,x.jsx)(f,{onClick:()=>k(!0),children:`Remove…`})}),O?(0,x.jsxs)(`form`,{"aria-label":`Remove the topic`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),N.mutate()},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Remove `,M.topic,`?`]}),(0,x.jsx)(f,{onClick:()=>k(!1),children:`Cancel`}),(0,x.jsx)(f,{variant:`primary`,type:`submit`,disabled:N.isPending,children:N.isPending?`Removing…`:`Remove topic`})]}),(0,x.jsx)(_,{error:N.error})]}):null,(0,x.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:(0,x.jsx)(g,{text:M.body})})]})}export{C as KnowledgeView};
1
+ import{S as e,Xn as t,Yn as n,Zn as r,er as i,g as a,j as o,t as s,tn as c,x as l,xt as u}from"./format-hyYD8qd8.js";import{n as d,t as f}from"./Button-B6EN7Lh7.js";import{l as p}from"./compose-BnOoMY1c.js";import{A as m}from"./index-5CbC_NpF.js";import{t as h}from"./BackLink-DNHWkHmh.js";import{t as g}from"./Markdown-DYk-gVwe.js";import{r as _}from"./ThreadForms-BlOEvY5E.js";import{n as v,t as y}from"./Pane-DFJdAhv9.js";var b=i(r(),1),x=t(),S=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function C(){let{scope:t,topic:r}=m({from:`/knowledge/$scope/$topic`}),{api:i}=o(),C=n(),w=p(),T=a(t),E=e(),D=l(3e4),[O,k]=(0,b.useState)(!1),A=t===u,j=A?`the society`:E.data?.find(e=>e.slug===t)?.name??t,M=T.data?.find(e=>e.topic===r),N=d({mutationFn:()=>i.removeKnowledge({project:A?null:t,topic:r}),onSuccess:async()=>{await C.invalidateQueries({queryKey:[`knowledge`,t]}),await w(A?{to:`/society`}:{to:`/p/$slug`,params:{slug:t}})}}),P=A?(0,x.jsx)(c,{to:`/society`,"aria-label":`Back to the society`,className:S,children:`←`}):(0,x.jsx)(c,{to:`/p/$slug`,params:{slug:t},"aria-label":`Back to ${j}`,className:S,children:`←`});return M===void 0?(0,x.jsx)(v,{children:T.data===void 0?`Reading…`:`${j} has no topic ${r}.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(y,{leading:(0,x.jsx)(h,{fallback:P}),title:M.topic,subtitle:`Knowledge of ${j} · written by ${M.updatedBy} ${s(M.updatedAt,D)}`,trailing:O?null:(0,x.jsx)(f,{onClick:()=>k(!0),children:`Remove…`})}),O?(0,x.jsxs)(`form`,{"aria-label":`Remove the topic`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),N.mutate()},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Remove `,M.topic,`?`]}),(0,x.jsx)(f,{onClick:()=>k(!1),children:`Cancel`}),(0,x.jsx)(f,{variant:`primary`,type:`submit`,disabled:N.isPending,children:N.isPending?`Removing…`:`Remove topic`})]}),(0,x.jsx)(_,{error:N.error})]}):null,(0,x.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:(0,x.jsx)(g,{text:M.body})})]})}export{C as KnowledgeView};