@kubitnodes/stellaris 0.3.17 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +87 -27
- package/dist/server/index.js +59 -7
- package/package.json +1 -1
- package/web/dist/assets/BackLink-DUOMS3fv.js +1 -0
- package/web/dist/assets/{ChannelForms-B3XwkJj_.js → ChannelForms-DfG4vYvk.js} +1 -1
- package/web/dist/assets/{ChannelView-B3qNylz5.js → ChannelView-DTLhLXy4.js} +2 -2
- package/web/dist/assets/{CitizenView-BUeC52q2.js → CitizenView-q24CExsI.js} +2 -2
- package/web/dist/assets/{CitizensView-BSWYcQ-Q.js → CitizensView-bKbUaCab.js} +1 -1
- package/web/dist/assets/{CliIcon-CFObB9XW.js → CliIcon-DTVk0pGU.js} +1 -1
- package/web/dist/assets/{CronsView-BBIx84f7.js → CronsView-DaG1xhQu.js} +1 -1
- package/web/dist/assets/{KnowledgeView-C8r5hAa_.js → KnowledgeView-Dt7wE3FT.js} +1 -1
- package/web/dist/assets/{Markdown-BO_bF8WD.js → Markdown-DeF9PKNm.js} +4 -4
- package/web/dist/assets/{MessageItem-BkDlfhQC.js → MessageItem-DDs7m3-4.js} +1 -1
- package/web/dist/assets/MetricsView-Bw7nL6Y9.js +1 -0
- package/web/dist/assets/NeedsYouView-DbESNtQT.js +1 -0
- package/web/dist/assets/Overview-Dv7SS4yW.js +1 -0
- package/web/dist/assets/{Pane-DHXhVwfI.js → Pane-v044FaP5.js} +1 -1
- package/web/dist/assets/{Picker-CQQ7hj8T.js → Picker-wWsO86nu.js} +1 -1
- package/web/dist/assets/ProjectView--nzlqSDA.js +1 -0
- package/web/dist/assets/ProposalView-Cdw_xzG1.js +1 -0
- package/web/dist/assets/{ProposalsView-BJg4ZsTy.js → ProposalsView-dVA50yG1.js} +1 -1
- package/web/dist/assets/{RunnersView-DOW8xq-J.js → RunnersView-C-l5QYIa.js} +1 -1
- package/web/dist/assets/SocietyView--mWRXRj_.js +1 -0
- package/web/dist/assets/{SubjectThread-Do5As1cO.js → SubjectThread-DvvsxHN9.js} +1 -1
- package/web/dist/assets/TaskFileView-DYuPrCdk.js +4 -0
- package/web/dist/assets/{TaskView-q6Kn30K7.js → TaskView-BgJcOmGj.js} +2 -2
- package/web/dist/assets/{TasksView-CT9Cui_C.js → TasksView-f8KIsif_.js} +1 -1
- package/web/dist/assets/ThreadCard-BRLvjdz3.js +1 -0
- package/web/dist/assets/ThreadForms-CXsunS-N.js +1 -0
- package/web/dist/assets/{ThreadView-BZ2nKfyD.js → ThreadView-DzpaXkik.js} +1 -1
- package/web/dist/assets/{citizen-DFaT61S1.js → citizen-VtLNxjtf.js} +1 -1
- package/web/dist/assets/compose-D-SO-HE-.js +1 -0
- package/web/dist/assets/{format-Cp_C4ygr.js → format-CkySAdH1.js} +1 -1
- package/web/dist/assets/{governance-BbogC_X-.js → governance-1UeTD2K_.js} +1 -1
- package/web/dist/assets/index-CwkK8XtJ.js +23 -0
- package/web/dist/assets/{index-BoTts74M.css → index-DaES0xVj.css} +1 -1
- package/web/dist/assets/{link-DIpiSYJj.js → link-BN04dcBX.js} +1 -1
- package/web/dist/assets/{tasks-C1wf85BJ.js → tasks-CD70eybR.js} +1 -1
- package/web/dist/assets/useMatch-i33QT_GI.js +1 -0
- package/web/dist/assets/{useStickyScroll-7ZZcyLI0.js → useStickyScroll-WSVpAMrA.js} +1 -1
- package/web/dist/index.html +9 -9
- package/web/dist/assets/BackLink-CssfJ-vJ.js +0 -1
- package/web/dist/assets/MetricsView-DqAQ4th0.js +0 -1
- package/web/dist/assets/NeedsYouView-D2Z-iLdT.js +0 -1
- package/web/dist/assets/Overview-DThLwb0l.js +0 -1
- package/web/dist/assets/ProjectView-DOtPYF6z.js +0 -1
- package/web/dist/assets/ProposalView-BpeiCg46.js +0 -1
- package/web/dist/assets/SocietyView-CbIpCGhP.js +0 -1
- package/web/dist/assets/TaskFileView-CPwEmR6p.js +0 -4
- package/web/dist/assets/ThreadCard-DsIkg4Br.js +0 -1
- package/web/dist/assets/ThreadForms-BPowHd4M.js +0 -1
- package/web/dist/assets/compose-96HAETM2.js +0 -1
- package/web/dist/assets/index-BXHV32GA.js +0 -23
- package/web/dist/assets/useMatch-DYOY33wl.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e,G as t,
|
|
1
|
+
import{D as e,G as t,_ as n,x as r,yn as i}from"./format-CkySAdH1.js";import{t as a}from"./link-BN04dcBX.js";import{t as o}from"./CliIcon-DTVk0pGU.js";import{n as s,t as c}from"./Pane-v044FaP5.js";import{a as l,r as u}from"./citizen-VtLNxjtf.js";var d=i();function f(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 p(e,t){return e.name.localeCompare(t.name)}function m(e,t){return e.role.localeCompare(t.role)||p(e,t)}function h(){let i=n(),h=e(),g=r();if(i.data===void 0)return(0,d.jsx)(s,{children:`Reading the roster…`});let _=i.data.filter(e=>e.cli!==null),v=_.filter(e=>e.status===`active`).toSorted(m),y=_.filter(e=>e.status!==`active`).toSorted(p),b=new Set(v.map(e=>e.role)).size,x=t(h.data?.running??[]),S=t(h.data?.pending??[]),C=new Map((g.data??[]).flatMap(e=>e.runner===void 0?[]:[[e.slug,e.runner]])),w=e=>{let t=[...new Set(x.filter(t=>t.agent===e.name).map(e=>e.scope))];return t.length>0?{label:`working`,detail:`in a turn at ${t.map(l).join(` and `)}`,tone:`text-emerald-300`}:S.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`}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c,{title:`Citizens`,subtitle:`${v.length} active in ${b===1?`1 role`:`${b} roles`}${y.length===0?``:` · ${y.length} retired`}`}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[v.length===0?(0,d.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No citizens yet. Ask the concierge for one.`}):null,(0,d.jsx)(`ul`,{className:`grid grid-cols-[auto_auto_auto_minmax(0,max-content)_auto_minmax(3rem,1fr)_auto] gap-x-3`,children:v.map(e=>{let t=w(e),n=f(e),r=e.memberships.length===0?`no projects`:e.memberships.join(`, `),i=u(e,C);return(0,d.jsx)(`li`,{className:`col-span-full grid grid-cols-subgrid`,children:(0,d.jsxs)(a,{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,d.jsx)(`span`,{className:`grid size-4 place-items-center`,children:e.cli===null?null:(0,d.jsx)(o,{cli:e.cli,size:13})}),(0,d.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,d.jsx)(`span`,{className:`text-fg-secondary`,children:e.role}),(0,d.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:n,children:n}),(0,d.jsx)(`span`,{className:`text-xs text-fg-muted`,title:i.detail,children:i.label}),(0,d.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,d.jsx)(`span`,{className:`text-right text-xs ${t.tone}`,title:t.detail,children:t.label})]})},e.name)})}),y.length===0?null:(0,d.jsxs)(`p`,{className:`mt-2 border-t border-line px-2 pt-2 text-meta`,children:[`Retired: `,y.map(e=>`${e.name} (${e.role})`).join(`, `)]})]})]})}export{h as CitizensView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{yn as e}from"./format-CkySAdH1.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{Cn as e,Ct as t,En as n,M as r,R as i,Sn as a,_ as o,b as s,dt as c,k as l,l as u,t as d,x as f,xn as p}from"./format-Cp_C4ygr.js";import{l as m,s as h}from"./compose-96HAETM2.js";import{t as g}from"./link-DIpiSYJj.js";import{t as _}from"./CliIcon-CFObB9XW.js";import{C as v,E as y,O as b,T as x,w as S}from"./index-BXHV32GA.js";import{a as C,o as w,r as T}from"./ThreadForms-BPowHd4M.js";import{t as E}from"./Markdown-BO_bF8WD.js";import{n as D,t as O}from"./Pane-DHXhVwfI.js";import{a as k,i as A,l as j}from"./citizen-DFaT61S1.js";import{n as M,r as N,t as P}from"./Picker-CQQ7hj8T.js";var F=n(e(),1),I=a(),L=[`UTC`,...Intl.supportedValuesOf(`timeZone`).filter(e=>e!==`UTC`)],R=50;function z(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).formatToParts(t).find(e=>e.type===`timeZoneName`)?.value??``;return n===`GMT`?`UTC`:n.replace(`GMT`,`UTC`)}function B({value:e,onChange:t,label:n,placeholder:r}){let[i,a]=(0,F.useState)(!1),[o,s]=(0,F.useState)(0),c=(0,F.useRef)(null),l=(0,F.useRef)([]),u=e.trim().toLowerCase(),d=(0,F.useMemo)(()=>(u===``?L:L.filter(e=>e.toLowerCase().includes(u))).slice(0,R),[u]),f=(0,F.useMemo)(()=>new Date,[]);(0,F.useEffect)(()=>{i&&l.current[o]?.scrollIntoView({block:`nearest`})},[i,o]),(0,F.useEffect)(()=>{if(!i)return;let e=e=>{e.target instanceof Node&&c.current?.contains(e.target)===!0||a(!1)};return window.addEventListener(`click`,e),()=>window.removeEventListener(`click`,e)},[i]);let p=e=>{t(e),a(!1)};return(0,I.jsxs)(`div`,{ref:c,className:`relative min-w-0 flex-1`,children:[(0,I.jsx)(`input`,{"aria-label":n,value:e,spellCheck:!1,autoComplete:`off`,placeholder:r,onChange:e=>{t(e.target.value),s(0),a(!0)},onClick:()=>a(!0),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!i){a(!0);return}let t=e.key===`ArrowDown`?1:-1;s(e=>(e+t+d.length)%Math.max(d.length,1));return}if(e.key===`Enter`&&i&&d[o]!==void 0){e.preventDefault(),p(d[o]);return}if(e.key===`Tab`){a(!1);return}e.key===`Escape`&&i&&(e.preventDefault(),e.stopPropagation(),a(!1))},className:w}),i&&d.length>0&&(d.length!==1||d[0]!==e)?(0,I.jsx)(`div`,{className:`max-h-48 ${P}`,children:d.map((e,t)=>(0,I.jsxs)(`button`,{ref:e=>{l.current[t]=e},type:`button`,tabIndex:-1,"aria-current":t===o?`true`:void 0,onPointerDown:e=>e.preventDefault(),onPointerEnter:()=>s(t),onClick:()=>p(e),className:N(t===o),children:[(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-secondary`,children:e}),(0,I.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-muted`,children:z(e,f)})]},e))}):null]})}function V({word:e,children:t}){return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,I.jsx)(`span`,{className:`shrink-0 text-xs text-fg-tertiary`,children:e}),t]})}function H(e,n){return t(typeof e==`string`?new Date(e):e,n)}function U({cron:e}){let t=i(),n=S(e);if(n.kind===`thread`){let e=t.data?.find(e=>e.id===n.id)?.title??n.id;return(0,I.jsxs)(g,{to:`/thread/$threadId`,params:{threadId:n.id},className:`truncate hover:text-fg-primary`,children:[`thread “`,e,`”`]})}return n.kind===`channel`?(0,I.jsxs)(g,{to:`/c/$`,params:{_splat:n.ref},className:`hover:text-fg-primary`,children:[`#`,n.ref]}):(0,I.jsxs)(`span`,{children:[`home at `,k(n.scope)]})}function W({cron:e,next:t,member:n,zone:r,now:i,focused:a}){let o=(0,F.useRef)(null);(0,F.useEffect)(()=>{a&&o.current!==null&&(o.current.open=!0,o.current.scrollIntoView({block:`nearest`}))},[a]);let{api:s}=l(),c=p(),[u,f]=(0,F.useState)(!1),[v,y]=(0,F.useState)(``),b=()=>void c.invalidateQueries({queryKey:[`crons`]}),S=m({mutationFn:t=>s.pauseCron(e.id,t),onSuccess:b}),C=m({mutationFn:()=>s.removeCron(e.id,v.trim()),onSuccess:b}),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`:d(t.toISOString(),i):`paused`:`ended ${d(e.ended.at,i)}`,k=x(e);return(0,I.jsx)(`li`,{className:`rounded-lg ${a?`bg-surface-2/30`:``}`,children:(0,I.jsxs)(`details`,{ref:o,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,` `,d(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)(E,{text:e.note})}),(0,I.jsxs)(`p`,{className:`text-meta`,children:[`Set by `,e.createdBy,` `,d(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)(g,{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?u?(0,I.jsxs)(`form`,{"aria-label":`Remove ${e.title}`,className:`space-y-2`,onSubmit:e=>{e.preventDefault(),C.mutate()},children:[(0,I.jsx)(`input`,{value:v,"aria-label":`Why it ends`,placeholder:`Why it ends, which the cron keeps`,onChange:e=>y(e.target.value),className:w}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(h,{onClick:()=>f(!1),children:`Cancel`}),(0,I.jsx)(h,{variant:`primary`,type:`submit`,disabled:C.isPending||v.trim()===``,children:C.isPending?`Removing…`:`Remove cron`})]}),(0,I.jsx)(T,{error:C.error})]}):(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(h,{onClick:()=>S.mutate(e.paused===void 0),disabled:S.isPending,children:e.paused===void 0?`Pause`:`Resume`}),(0,I.jsx)(h,{onClick:()=>f(!0),children:`Remove…`}),(0,I.jsx)(T,{error:S.error})]}):null]})]})})}function G({zone:e,onDone:t}){let{api:n}=l(),r=p(),[i,a]=(0,F.useState)(e),o=new Intl.DateTimeFormat().resolvedOptions().timeZone,s=m({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(),s.mutate()},children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(B,{value:i,onChange:a,label:`Society time zone`}),o===i?null:(0,I.jsxs)(h,{onClick:()=>a(o),children:[`Use `,o]})]}),(0,I.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:`Crons that name no zone are read in it, so their times move with it, and every turn's prompt tells the time in it.`}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(h,{onClick:t,children:`Cancel`}),(0,I.jsx)(h,{variant:`primary`,type:`submit`,disabled:s.isPending||i.trim()===``||i.trim()===e,children:s.isPending?`Saving…`:`Save`})]}),(0,I.jsx)(T,{error:s.error})]})}function K({members:e,preferred:t,zone:n,onDone:i}){let{api:a}=l(),o=p(),u=f(),d=r(),[g,_]=(0,F.useState)(e.find(e=>e.name===t)?.name??e[0]?.name??``),v=e.find(e=>e.name===g),b=v===void 0?[]:j(v),[x,S]=(0,F.useState)(b[0]??`society`),[E,D]=(0,F.useState)(``),[O,k]=(0,F.useState)(`repeats`),[N,P]=(0,F.useState)(`0 9 * * 1-5`),[L,R]=(0,F.useState)(``),[z,U]=(0,F.useState)(``),[W,G]=(0,F.useState)(``),[K,q]=(0,F.useState)(``),J=(0,F.useRef)(null);(0,F.useEffect)(()=>J.current?.focus(),[]);let Y=s(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=y(O===`once`&&z===``?{at:`invalid`}:X,n,new Date(Y)),Q=O===`repeats`?L.trim()===``?n:L.trim():n,$=m({mutationFn:()=>a.createCron({agent:g,title:W.trim(),note:K.trim(),project:x,...E===``?{}:{channel:E},...X}),onSuccess:()=>{o.invalidateQueries({queryKey:[`crons`]}),i()}});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:e.map(e=>({value:e.name,name:e.name,id:e.role,description:e.memberships.length===0?`in no project`:`in ${e.memberships.join(`, `)}`})),value:g,onChange:t=>{let n=e.find(e=>e.name===t);_(t),S(n===void 0?c:j(n)[0]??`society`),D(``)}})}),(0,I.jsx)(V,{word:`at`,children:(0,I.jsx)(M,{label:`Where`,choices:A(b),value:x,onChange:e=>{S(e),D(``)}})}),(0,I.jsx)(V,{word:`in`,children:(0,I.jsx)(M,{label:`Conversation`,choices:[{value:``,name:`its home`,id:null,description:`general, and work tied to no other channel`},...ee.map(e=>({value:e,name:`#${e}`,id:null,description:`a workstream's own conversation`}))],value:E,onChange:D})})]}),(0,I.jsx)(`input`,{ref:J,value:W,maxLength:120,"aria-label":`Title`,placeholder:`Title, such as Morning report`,onChange:e=>G(e.target.value),className:w}),(0,I.jsx)(`textarea`,{value:K,rows:3,"aria-label":`Note`,placeholder:`What to do when it fires; the citizen reads this in every turn it starts.`,onChange:e=>q(e.target.value),className:C}),(0,I.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,I.jsx)(`legend`,{className:`sr-only`,children:`How often`}),[`repeats`,`once`].map(e=>(0,I.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${O===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:O===e,onChange:()=>k(e),className:`sr-only`}),e===`repeats`?`Repeats`:`Once`]},e))]}),O===`repeats`?(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,I.jsx)(`input`,{value:N,spellCheck:!1,"aria-label":`Cron expression`,placeholder:`minute hour day month weekday`,onChange:e=>P(e.target.value),className:w})}),(0,I.jsx)(B,{value:L,onChange:R,label:`Its time zone`,placeholder:`${n}, the society's`})]}):(0,I.jsx)(`input`,{type:`datetime-local`,value:z,"aria-label":`When, in this browser's time`,onChange:e=>U(e.target.value),className:w}),(0,I.jsxs)(`p`,{"aria-live":`polite`,className:`text-xs leading-relaxed text-fg-muted`,children:[`error`in Z?(0,I.jsx)(`span`,{className:`text-amber-300`,children:Z.error}):(0,I.jsxs)(I.Fragment,{children:[Z.times.length===1?`Fires `:`Fires next `,Z.times.map(e=>H(e,Q)).join(`, `),` (`,Q,`).`]}),` `,`Each fire is a turn for `,g===``?`the citizen`:g,`, which costs money.`]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(h,{onClick:i,children:`Cancel`}),(0,I.jsx)(h,{variant:`primary`,type:`submit`,disabled:$.isPending||g===``||W.trim()===``||K.trim()===``||`error`in Z,children:$.isPending?`Setting…`:`Set cron`})]}),(0,I.jsx)(T,{error:$.error})]})}function q(){let{agent:e,cron:t}=b({from:`/crons`}),n=u(),i=o(),a=r(),c=s(3e4),[l,d]=(0,F.useState)(null),f=a.data?.timezone??`UTC`,p=(n.data??[]).filter(t=>e===void 0||t.agent===e),m=v(p,f),_=p.filter(x).length,y=(i.data??[]).filter(e=>e.status===`active`&&e.cli!==null),S=e=>i.data?.find(t=>t.name===e);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(O,{title:e===void 0?`Crons`:`Crons of ${e}`,subtitle:[`${m.active.length} running`,...m.paused.length===0?[]:[`${m.paused.length} paused`],..._===0?[]:[`${_} failing`],`times in ${f}`].join(` · `),trailing:l===null?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(h,{onClick:()=>d(`zone`),children:`Time zone…`}),(0,I.jsx)(h,{onClick:()=>d(`new`),disabled:y.length===0,children:`New cron…`})]}):null}),l===`new`?(0,I.jsx)(K,{members:y,preferred:e,zone:f,onDone:()=>d(null)}):l===`zone`?(0,I.jsx)(G,{zone:f,onDone:()=>d(null)}):null,(0,I.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e===void 0?null:(0,I.jsx)(g,{to:`/crons`,className:`block px-2 pb-2 text-meta hover:text-fg-primary`,children:`Show every citizen's crons`}),n.error!==null&&n.data===void 0?(0,I.jsxs)(D,{children:[`The board server did not list its crons (`,n.error.message,`); one older than this interface has none.`]}):n.data===void 0?(0,I.jsx)(D,{children:`Reading the crons…`}):m.active.length+m.paused.length+m.ended.length===0?(0,I.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No crons yet. A citizen sets one with create_cron when it needs to come back to something later; you can set one for any citizen here.`}):null,m.active.length===0?null:(0,I.jsx)(`ul`,{"aria-label":`Running`,className:`space-y-0.5`,children:m.active.map(({cron:e,next:n})=>(0,I.jsx)(W,{cron:e,next:n,member:S(e.agent),zone:f,now:c,focused:e.id===t},e.id))}),m.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:m.paused.map(e=>(0,I.jsx)(W,{cron:e,next:null,member:S(e.agent),zone:f,now:c,focused:e.id===t},e.id))})]}),m.ended.length===0?null:(0,I.jsxs)(`details`,{className:`mt-3`,open:m.ended.some(e=>e.id===t),children:[(0,I.jsxs)(`summary`,{className:`cursor-pointer px-2 pb-1 text-section`,children:[`Ended (`,m.ended.length,`)`]}),(0,I.jsx)(`ul`,{"aria-label":`Ended`,className:`space-y-0.5`,children:m.ended.map(e=>(0,I.jsx)(W,{cron:e,next:null,member:S(e.agent),zone:f,now:c,focused:e.id===t},e.id))})]})]})]})}export{q as CronsView};
|
|
1
|
+
import{Cn as e,M as t,R as n,_ as r,b as i,bn as a,k as o,l as s,t as c,ut as l,vn as u,x as d,xt as f,yn as p}from"./format-CkySAdH1.js";import{a as m,s as h}from"./compose-D-SO-HE-.js";import{t as g}from"./link-BN04dcBX.js";import{t as _}from"./CliIcon-DTVk0pGU.js";import{C as v,E as y,O as b,T as x,w as S}from"./index-CwkK8XtJ.js";import{a as C,o as w,r as T}from"./ThreadForms-CXsunS-N.js";import{t as E}from"./Markdown-DeF9PKNm.js";import{n as D,t as O}from"./Pane-v044FaP5.js";import{a as k,i as A,l as j}from"./citizen-VtLNxjtf.js";import{n as M,r as N,t as P}from"./Picker-wWsO86nu.js";var F=e(a(),1),I=p(),L=[`UTC`,...Intl.supportedValuesOf(`timeZone`).filter(e=>e!==`UTC`)],R=50;function z(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).formatToParts(t).find(e=>e.type===`timeZoneName`)?.value??``;return n===`GMT`?`UTC`:n.replace(`GMT`,`UTC`)}function B({value:e,onChange:t,label:n,placeholder:r}){let[i,a]=(0,F.useState)(!1),[o,s]=(0,F.useState)(0),c=(0,F.useRef)(null),l=(0,F.useRef)([]),u=e.trim().toLowerCase(),d=(0,F.useMemo)(()=>(u===``?L:L.filter(e=>e.toLowerCase().includes(u))).slice(0,R),[u]),f=(0,F.useMemo)(()=>new Date,[]);(0,F.useEffect)(()=>{i&&l.current[o]?.scrollIntoView({block:`nearest`})},[i,o]),(0,F.useEffect)(()=>{if(!i)return;let e=e=>{e.target instanceof Node&&c.current?.contains(e.target)===!0||a(!1)};return window.addEventListener(`click`,e),()=>window.removeEventListener(`click`,e)},[i]);let p=e=>{t(e),a(!1)};return(0,I.jsxs)(`div`,{ref:c,className:`relative min-w-0 flex-1`,children:[(0,I.jsx)(`input`,{"aria-label":n,value:e,spellCheck:!1,autoComplete:`off`,placeholder:r,onChange:e=>{t(e.target.value),s(0),a(!0)},onClick:()=>a(!0),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!i){a(!0);return}let t=e.key===`ArrowDown`?1:-1;s(e=>(e+t+d.length)%Math.max(d.length,1));return}if(e.key===`Enter`&&i&&d[o]!==void 0){e.preventDefault(),p(d[o]);return}if(e.key===`Tab`){a(!1);return}e.key===`Escape`&&i&&(e.preventDefault(),e.stopPropagation(),a(!1))},className:w}),i&&d.length>0&&(d.length!==1||d[0]!==e)?(0,I.jsx)(`div`,{className:`max-h-48 ${P}`,children:d.map((e,t)=>(0,I.jsxs)(`button`,{ref:e=>{l.current[t]=e},type:`button`,tabIndex:-1,"aria-current":t===o?`true`:void 0,onPointerDown:e=>e.preventDefault(),onPointerEnter:()=>s(t),onClick:()=>p(e),className:N(t===o),children:[(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-secondary`,children:e}),(0,I.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-muted`,children:z(e,f)})]},e))}):null]})}function V({word:e,children:t}){return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,I.jsx)(`span`,{className:`shrink-0 text-xs text-fg-tertiary`,children:e}),t]})}function H(e,t){return f(typeof e==`string`?new Date(e):e,t)}function U({cron:e}){let t=n(),r=S(e);if(r.kind===`thread`){let e=t.data?.find(e=>e.id===r.id)?.title??r.id;return(0,I.jsxs)(g,{to:`/thread/$threadId`,params:{threadId:r.id},className:`truncate hover:text-fg-primary`,children:[`thread “`,e,`”`]})}return r.kind===`channel`?(0,I.jsxs)(g,{to:`/c/$`,params:{_splat:r.ref},className:`hover:text-fg-primary`,children:[`#`,r.ref]}):(0,I.jsxs)(`span`,{children:[`home at `,k(r.scope)]})}function W({cron:e,next:t,member:n,zone:r,now:i,focused:a}){let s=(0,F.useRef)(null);(0,F.useEffect)(()=>{a&&s.current!==null&&(s.current.open=!0,s.current.scrollIntoView({block:`nearest`}))},[a]);let{api:l}=o(),d=u(),[f,p]=(0,F.useState)(!1),[v,y]=(0,F.useState)(``),b=()=>void d.invalidateQueries({queryKey:[`crons`]}),S=h({mutationFn:t=>l.pauseCron(e.id,t),onSuccess:b}),C=h({mutationFn:()=>l.removeCron(e.id,v.trim()),onSuccess:b}),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`:c(t.toISOString(),i):`paused`:`ended ${c(e.ended.at,i)}`,k=x(e);return(0,I.jsx)(`li`,{className:`rounded-lg ${a?`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,` `,c(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)(E,{text:e.note})}),(0,I.jsxs)(`p`,{className:`text-meta`,children:[`Set by `,e.createdBy,` `,c(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)(g,{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?f?(0,I.jsxs)(`form`,{"aria-label":`Remove ${e.title}`,className:`space-y-2`,onSubmit:e=>{e.preventDefault(),C.mutate()},children:[(0,I.jsx)(`input`,{value:v,"aria-label":`Why it ends`,placeholder:`Why it ends, which the cron keeps`,onChange:e=>y(e.target.value),className:w}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(m,{onClick:()=>p(!1),children:`Cancel`}),(0,I.jsx)(m,{variant:`primary`,type:`submit`,disabled:C.isPending||v.trim()===``,children:C.isPending?`Removing…`:`Remove cron`})]}),(0,I.jsx)(T,{error:C.error})]}):(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(m,{onClick:()=>S.mutate(e.paused===void 0),disabled:S.isPending,children:e.paused===void 0?`Pause`:`Resume`}),(0,I.jsx)(m,{onClick:()=>p(!0),children:`Remove…`}),(0,I.jsx)(T,{error:S.error})]}):null]})]})})}function G({zone:e,onDone:t}){let{api:n}=o(),r=u(),[i,a]=(0,F.useState)(e),s=new Intl.DateTimeFormat().resolvedOptions().timeZone,c=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(),c.mutate()},children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(B,{value:i,onChange:a,label:`Society time zone`}),s===i?null:(0,I.jsxs)(m,{onClick:()=>a(s),children:[`Use `,s]})]}),(0,I.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:`Crons that name no zone are read in it, so their times move with it, and every turn's prompt tells the time in it.`}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(m,{onClick:t,children:`Cancel`}),(0,I.jsx)(m,{variant:`primary`,type:`submit`,disabled:c.isPending||i.trim()===``||i.trim()===e,children:c.isPending?`Saving…`:`Save`})]}),(0,I.jsx)(T,{error:c.error})]})}function K({members:e,preferred:n,zone:r,onDone:a}){let{api:s}=o(),c=u(),f=d(),p=t(),[g,_]=(0,F.useState)(e.find(e=>e.name===n)?.name??e[0]?.name??``),v=e.find(e=>e.name===g),b=v===void 0?[]:j(v),[x,S]=(0,F.useState)(b[0]??`society`),[E,D]=(0,F.useState)(``),[O,k]=(0,F.useState)(`repeats`),[N,P]=(0,F.useState)(`0 9 * * 1-5`),[L,R]=(0,F.useState)(``),[z,U]=(0,F.useState)(``),[W,G]=(0,F.useState)(``),[K,q]=(0,F.useState)(``),J=(0,F.useRef)(null);(0,F.useEffect)(()=>J.current?.focus(),[]);let Y=i(3e4),ee=(x===`society`?p.data?.channels??[]:f.data?.find(e=>e.slug===x)?.channels??[]).filter(e=>e!==`general`),X=O===`repeats`?{cron:N,...L.trim()===``?{}:{timezone:L.trim()}}:{at:z===``?``:new Date(z).toISOString()},Z=y(O===`once`&&z===``?{at:`invalid`}:X,r,new Date(Y)),Q=O===`repeats`?L.trim()===``?r:L.trim():r,$=h({mutationFn:()=>s.createCron({agent:g,title:W.trim(),note:K.trim(),project:x,...E===``?{}:{channel:E},...X}),onSuccess:()=>{c.invalidateQueries({queryKey:[`crons`]}),a()}});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:e.map(e=>({value:e.name,name:e.name,id:e.role,description:e.memberships.length===0?`in no project`:`in ${e.memberships.join(`, `)}`})),value:g,onChange:t=>{let n=e.find(e=>e.name===t);_(t),S(n===void 0?l:j(n)[0]??`society`),D(``)}})}),(0,I.jsx)(V,{word:`at`,children:(0,I.jsx)(M,{label:`Where`,choices:A(b),value:x,onChange:e=>{S(e),D(``)}})}),(0,I.jsx)(V,{word:`in`,children:(0,I.jsx)(M,{label:`Conversation`,choices:[{value:``,name:`its home`,id:null,description:`general, and work tied to no other channel`},...ee.map(e=>({value:e,name:`#${e}`,id:null,description:`a workstream's own conversation`}))],value:E,onChange:D})})]}),(0,I.jsx)(`input`,{ref:J,value:W,maxLength:120,"aria-label":`Title`,placeholder:`Title, such as Morning report`,onChange:e=>G(e.target.value),className:w}),(0,I.jsx)(`textarea`,{value:K,rows:3,"aria-label":`Note`,placeholder:`What to do when it fires; the citizen reads this in every turn it starts.`,onChange:e=>q(e.target.value),className:C}),(0,I.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,I.jsx)(`legend`,{className:`sr-only`,children:`How often`}),[`repeats`,`once`].map(e=>(0,I.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${O===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:O===e,onChange:()=>k(e),className:`sr-only`}),e===`repeats`?`Repeats`:`Once`]},e))]}),O===`repeats`?(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,I.jsx)(`input`,{value:N,spellCheck:!1,"aria-label":`Cron expression`,placeholder:`minute hour day month weekday`,onChange:e=>P(e.target.value),className:w})}),(0,I.jsx)(B,{value:L,onChange:R,label:`Its time zone`,placeholder:`${r}, the society's`})]}):(0,I.jsx)(`input`,{type:`datetime-local`,value:z,"aria-label":`When, in this browser's time`,onChange:e=>U(e.target.value),className:w}),(0,I.jsxs)(`p`,{"aria-live":`polite`,className:`text-xs leading-relaxed text-fg-muted`,children:[`error`in Z?(0,I.jsx)(`span`,{className:`text-amber-300`,children:Z.error}):(0,I.jsxs)(I.Fragment,{children:[Z.times.length===1?`Fires `:`Fires next `,Z.times.map(e=>H(e,Q)).join(`, `),` (`,Q,`).`]}),` `,`Each fire is a turn for `,g===``?`the citizen`:g,`, which costs money.`]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(m,{onClick:a,children:`Cancel`}),(0,I.jsx)(m,{variant:`primary`,type:`submit`,disabled:$.isPending||g===``||W.trim()===``||K.trim()===``||`error`in Z,children:$.isPending?`Setting…`:`Set cron`})]}),(0,I.jsx)(T,{error:$.error})]})}function q(){let{agent:e,cron:n}=b({from:`/crons`}),a=s(),o=r(),c=t(),l=i(3e4),[u,d]=(0,F.useState)(null),f=c.data?.timezone??`UTC`,p=(a.data??[]).filter(t=>e===void 0||t.agent===e),h=v(p,f),_=p.filter(x).length,y=(o.data??[]).filter(e=>e.status===`active`&&e.cli!==null),S=e=>o.data?.find(t=>t.name===e);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(O,{title:e===void 0?`Crons`:`Crons of ${e}`,subtitle:[`${h.active.length} running`,...h.paused.length===0?[]:[`${h.paused.length} paused`],..._===0?[]:[`${_} failing`],`times in ${f}`].join(` · `),trailing:u===null?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(m,{onClick:()=>d(`zone`),children:`Time zone…`}),(0,I.jsx)(m,{onClick:()=>d(`new`),disabled:y.length===0,children:`New cron…`})]}):null}),u===`new`?(0,I.jsx)(K,{members:y,preferred:e,zone:f,onDone:()=>d(null)}):u===`zone`?(0,I.jsx)(G,{zone:f,onDone:()=>d(null)}):null,(0,I.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e===void 0?null:(0,I.jsx)(g,{to:`/crons`,className:`block px-2 pb-2 text-meta hover:text-fg-primary`,children:`Show every citizen's crons`}),a.error!==null&&a.data===void 0?(0,I.jsxs)(D,{children:[`The board server did not list its crons (`,a.error.message,`); one older than this interface has none.`]}):a.data===void 0?(0,I.jsx)(D,{children:`Reading the crons…`}):h.active.length+h.paused.length+h.ended.length===0?(0,I.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No crons yet. A citizen sets one with create_cron when it needs to come back to something later; you can set one for any citizen here.`}):null,h.active.length===0?null:(0,I.jsx)(`ul`,{"aria-label":`Running`,className:`space-y-0.5`,children:h.active.map(({cron:e,next:t})=>(0,I.jsx)(W,{cron:e,next:t,member:S(e.agent),zone:f,now:l,focused:e.id===n},e.id))}),h.paused.length===0?null:(0,I.jsxs)(`section`,{"aria-label":`Paused`,className:`mt-3`,children:[(0,I.jsx)(`h3`,{className:`px-2 pb-1 text-section`,children:`Paused`}),(0,I.jsx)(`ul`,{className:`space-y-0.5`,children:h.paused.map(e=>(0,I.jsx)(W,{cron:e,next:null,member:S(e.agent),zone:f,now:l,focused:e.id===n},e.id))})]}),h.ended.length===0?null:(0,I.jsxs)(`details`,{className:`mt-3`,open:h.ended.some(e=>e.id===n),children:[(0,I.jsxs)(`summary`,{className:`cursor-pointer px-2 pb-1 text-section`,children:[`Ended (`,h.ended.length,`)`]}),(0,I.jsx)(`ul`,{"aria-label":`Ended`,className:`space-y-0.5`,children:h.ended.map(e=>(0,I.jsx)(W,{cron:e,next:null,member:S(e.agent),zone:f,now:l,focused:e.id===n},e.id))})]})]})]})}export{q as CronsView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Cn as e,
|
|
1
|
+
import{Cn as e,b as t,bn as n,h as r,k as i,t as a,ut as o,vn as s,x as c,yn as l}from"./format-CkySAdH1.js";import{a as u,o as d,s as f}from"./compose-D-SO-HE-.js";import{t as p}from"./link-BN04dcBX.js";import{k as m}from"./index-CwkK8XtJ.js";import{r as h}from"./ThreadForms-CXsunS-N.js";import{t as g}from"./Markdown-DeF9PKNm.js";import{n as _,t as v}from"./Pane-v044FaP5.js";import{t as y}from"./BackLink-DUOMS3fv.js";var b=e(n(),1),x=l(),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:e,topic:n}=m({from:`/knowledge/$scope/$topic`}),{api:l}=i(),C=s(),w=d(),T=r(e),E=c(),D=t(3e4),[O,k]=(0,b.useState)(!1),A=e===o,j=A?`the society`:E.data?.find(t=>t.slug===e)?.name??e,M=T.data?.find(e=>e.topic===n),N=f({mutationFn:()=>l.removeKnowledge({project:A?null:e,topic:n}),onSuccess:async()=>{await C.invalidateQueries({queryKey:[`knowledge`,e]}),await w(A?{to:`/society`}:{to:`/p/$slug`,params:{slug:e}})}}),P=A?(0,x.jsx)(p,{to:`/society`,"aria-label":`Back to the society`,className:S,children:`←`}):(0,x.jsx)(p,{to:`/p/$slug`,params:{slug:e},"aria-label":`Back to ${j}`,className:S,children:`←`});return M===void 0?(0,x.jsx)(_,{children:T.data===void 0?`Reading…`:`${j} has no topic ${n}.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(v,{leading:(0,x.jsx)(y,{fallback:P}),title:M.topic,subtitle:`Knowledge of ${j} · written by ${M.updatedBy} ${a(M.updatedAt,D)}`,trailing:O?null:(0,x.jsx)(u,{onClick:()=>k(!0),children:`Remove…`})}),O?(0,x.jsxs)(`form`,{"aria-label":`Remove the topic`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),N.mutate()},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(`p`,{className:`min-w-0 flex-1 text-meta`,children:[`No turn or search finds `,M.topic,` again, and a note in`,` `,A?`#general`:`#${e}/general`,` says so without waking anyone. The server keeps its text aside.`]}),(0,x.jsx)(u,{onClick:()=>k(!1),children:`Cancel`}),(0,x.jsx)(u,{variant:`primary`,type:`submit`,disabled:N.isPending,children:N.isPending?`Removing…`:`Remove topic`})]}),(0,x.jsx)(h,{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};
|