@wjarka/cezarion 0.18.0-dev.6319 → 0.18.0-dev.6369

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 (67) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/activity-motion-DdE0kJi3.js +2 -0
  3. package/web/dist/assets/{activity-route-BJxCiEIp.js → activity-route-DLSJeSnu.js} +1 -1
  4. package/web/dist/assets/agent-accounts-CH91aYcr.js +18 -0
  5. package/web/dist/assets/{alert-dialog-h-3h9B4l.js → alert-dialog-CPBKJTj_.js} +1 -1
  6. package/web/dist/assets/attention-BQflw45i.js +1 -0
  7. package/web/dist/assets/{button-CS5tOblf.js → button-Czdi8NqC.js} +1 -1
  8. package/web/dist/assets/{centered-state-BmsqxbI8.js → centered-state-8l6wvu0C.js} +1 -1
  9. package/web/dist/assets/{cez-idle-NomdGTfa.js → cez-idle-xv7f96fc.js} +1 -1
  10. package/web/dist/assets/{commit-diff-panel-CtUOJAqz.js → commit-diff-panel-1KsqfPQm.js} +1 -1
  11. package/web/dist/assets/{dialog-Dw7fMdDQ.js → dialog-CkU56ywj.js} +1 -1
  12. package/web/dist/assets/{diff-DJyC6ofi.js → diff-BcgZstvZ.js} +2 -2
  13. package/web/dist/assets/{diff-controls-BHF0Pvdc.js → diff-controls-DzcrZF8L.js} +1 -1
  14. package/web/dist/assets/{diff-view-20SWzhxR.js → diff-view-Bf81mon2.js} +1 -1
  15. package/web/dist/assets/{dist-DvNdR7gM.js → dist-D4TujV9O.js} +1 -1
  16. package/web/dist/assets/{dropdown-menu-D7f0O7xR.js → dropdown-menu-BN2BI4R1.js} +1 -1
  17. package/web/dist/assets/{es2015-CX0rgbM5.js → es2015-DnySZnV4.js} +1 -1
  18. package/web/dist/assets/{file-preview-C_c-tyCm.js → file-preview-CWH2pPkO.js} +1 -1
  19. package/web/dist/assets/{git-toolbar-Dm75uXLu.js → git-toolbar-BDazbdBO.js} +1 -1
  20. package/web/dist/assets/{github-BtFBo0G5.js → github-DYA-wBvz.js} +1 -1
  21. package/web/dist/assets/{global-activity-route-Dr3RsNfM.js → global-activity-route-CalieTgD.js} +1 -1
  22. package/web/dist/assets/{image-preview-Dy3o8upo.js → image-preview-DpaJAUA9.js} +1 -1
  23. package/web/dist/assets/index-B7K7I3e9.js +17 -0
  24. package/web/dist/assets/index-DS1HIBHa.css +1 -0
  25. package/web/dist/assets/{input-DIwJvCgi.js → input-Dilvz-YI.js} +1 -1
  26. package/web/dist/assets/{live-protocol-DBPXI6ks.js → live-protocol-DjH6ZQwI.js} +1 -1
  27. package/web/dist/assets/{nav-row-styles-CEA9c88Q.js → nav-row-styles-DoZBu-jT.js} +1 -1
  28. package/web/dist/assets/{preview-pane-connected-NLUpfhGa.js → preview-pane-connected-BUPElme2.js} +2 -2
  29. package/web/dist/assets/{project-router-BFKfAFvq.js → project-router-DZfQkmEw.js} +1 -1
  30. package/web/dist/assets/project-scope-context-DHDNqsXD.js +4 -0
  31. package/web/dist/assets/{prompt-template-menu-B8VpFfKO.js → prompt-template-menu-Dyu7XblO.js} +1 -1
  32. package/web/dist/assets/queries-BvZol9tf.js +1 -0
  33. package/web/dist/assets/{reference-chip-DMgD6d01.js → reference-chip-BD5-b_CU.js} +1 -1
  34. package/web/dist/assets/{repo-git-uAud743a.js → repo-git-B-pzLLjM.js} +1 -1
  35. package/web/dist/assets/{report-reader-CdSUukXf.js → report-reader-BKo8xIqy.js} +1 -1
  36. package/web/dist/assets/reports-CHoco8IF.js +1 -0
  37. package/web/dist/assets/run-header-Co7v26sT.js +2 -0
  38. package/web/dist/assets/skills-BVSRZ4Fr.js +1 -0
  39. package/web/dist/assets/{tab-link-DDpdYMnv.js → tab-link-CXiNVJ5a.js} +1 -1
  40. package/web/dist/assets/{task-changes-Bh_7YAeI.js → task-changes-CItEr9td.js} +1 -1
  41. package/web/dist/assets/{task-commits-DfXEs6zT.js → task-commits-BYAybF0L.js} +1 -1
  42. package/web/dist/assets/{task-files-BRhNrDE4.js → task-files-CW8lh-Jp.js} +1 -1
  43. package/web/dist/assets/{task-github-item-BqZH0LVz.js → task-github-item-FWzM8NKC.js} +1 -1
  44. package/web/dist/assets/{task-thread-DvZKVSna.js → task-thread-CCUIMhcV.js} +5 -5
  45. package/web/dist/assets/{thread-state-FqUDnt89.js → thread-state-CFLv_VQJ.js} +1 -1
  46. package/web/dist/assets/{toaster-CRVRHlMR.js → toaster-2NK3PogQ.js} +1 -1
  47. package/web/dist/assets/{use-desktop-DeG3Ha7y.js → use-desktop-DhAwfRfO.js} +1 -1
  48. package/web/dist/assets/{use-hand-to-agent-state-DeLboLqM.js → use-hand-to-agent-state-CqFlsg5z.js} +1 -1
  49. package/web/dist/assets/{useInfiniteQuery-BmfExLUr.js → useInfiniteQuery-BmndP0ve.js} +1 -1
  50. package/web/dist/assets/useQuery-CsEdg2zt.js +1 -0
  51. package/web/dist/assets/{workflows-DIB7faC8.js → workflows-DJgvKk6C.js} +1 -1
  52. package/web/dist/assets/ws-DBsqEdPb.js +1 -0
  53. package/web/dist/assets/{zoomable-image-UzXCYU7Z.js → zoomable-image-D0zshpve.js} +1 -1
  54. package/web/dist/index.html +25 -25
  55. package/web/dist/live-worker.js +1 -1
  56. package/web/dist/assets/activity-motion-DC9hC5nV.js +0 -2
  57. package/web/dist/assets/agent-accounts-DnFoFuBJ.js +0 -18
  58. package/web/dist/assets/attention-VmnPpwJx.js +0 -1
  59. package/web/dist/assets/index-CrlovI4F.css +0 -1
  60. package/web/dist/assets/index-jbljrsnC.js +0 -17
  61. package/web/dist/assets/project-scope-context-DSkcNKO7.js +0 -4
  62. package/web/dist/assets/queries-sEwd08S5.js +0 -1
  63. package/web/dist/assets/reports-C842hFaD.js +0 -1
  64. package/web/dist/assets/run-header-Bj-L6zkj.js +0 -2
  65. package/web/dist/assets/skills-DFTYrwoH.js +0 -1
  66. package/web/dist/assets/useQuery-8pHkglP4.js +0 -1
  67. package/web/dist/assets/ws-CEQH0TUT.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{D as t,I as n,L as r,M as i,t as a,u as o}from"./button-CS5tOblf.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{Kr as l,Rt as u,f as d,on as f,tn as p,wn as m}from"./project-scope-context-DSkcNKO7.js";import{$ as h,J as g,K as _,X as v,Y as y,Z as b,et as x,rt as S,z as C}from"./live-protocol-DBPXI6ks.js";import{$t as w,I as ee,Rt as te,Z as T,jt as ne,n as E}from"./queries-sEwd08S5.js";import{t as re}from"./useQuery-8pHkglP4.js";import{n as D}from"./toaster-CRVRHlMR.js";import{G as ie,Q as ae,Z as O,ct as k,d as oe,ht as se,l as ce,mt as le,u as ue}from"./design-icons-DmYTv2r1.js";import{t as A}from"./input-DIwJvCgi.js";import{t as j}from"./project-router-BFKfAFvq.js";import{c as de,i as fe,o as pe,p as me}from"./skills-DFBiAuJG.js";import{t as he}from"./centered-state-BmsqxbI8.js";import{$ as ge,$t as _e,I as ve,P as ye}from"./index-jbljrsnC.js";import{t as be}from"./skill-empty-hint-YDmkqgo-.js";var M=e(s(),1),N=`owner/name, an https, ssh or git URL, git@host:path, or a local or file:// path`,xe=new Set([`https`,`http`,`ssh`,`git`,`file`]);function P(e){let t=e.trim();if(!t||t.startsWith(`-`)||t.includes(`::`))return null;if(t.startsWith(`~/`))return`home`;if(/^(\/|\.\/|\.\.\/)/.test(t)||/^[A-Za-z]:[\\/]/.test(t))return`local`;if(/^[\w.-]+\/[\w.-]+$/.test(t))return`github`;let n=/^([a-z][a-z0-9+.-]*):\/\//i.exec(t);return n?xe.has(n[1].toLowerCase())?`url`:null:/^[\w.-]+@[\w.-]+:/.test(t)?`scp`:null}function F(e){return e.length>0&&e.length<=256&&!e.startsWith(`-`)&&!e.includes(`..`)&&/^[A-Za-z0-9._/-]+$/.test(e)}var Se=S().trim().min(1).max(500).refine(e=>P(e)!==null,{message:`Use ${N}.`}),Ce=S().trim().refine(F,{message:`Use a branch, tag or commit SHA, such as main.`}),we=x({repo:S().min(1).max(500),ref:S().min(1).max(256)}).strict();x({repo:Se,ref:Ce.optional()}).strict(),we.extend({enabled:y()}).strict();var Te=_([`refused-format`,`fetch-failed`,`ref-not-found`]),Ee=v(`state`,[x({state:b(`idle`)}),x({state:b(`loading`)}),x({state:b(`ok`),skillCount:h().int().min(0)}),x({state:b(`error`),cause:Te,detail:S(),skillCount:h().int().min(0)})]);x({sources:g(x({repo:S(),ref:S(),enabled:y(),status:Ee})),editable:y(),configIssue:S().nullable()});var I=()=>[i(),`skills`,`sources`];async function De(e){return m(await d.api.v1.p[`:projectId`].skills.sources.$get({param:{projectId:i()}},u(e)),`/skills/sources`)}async function Oe(e){return m(await d.api.v1.p[`:projectId`].skills.sources.$post({param:{projectId:i()},json:e}),`/skills/sources`)}async function ke(e){return m(await d.api.v1.p[`:projectId`].skills.sources.$patch({param:{projectId:i()},json:e}),`/skills/sources`)}async function Ae(e){return m(await d.api.v1.p[`:projectId`].skills.sources.$delete({param:{projectId:i()},json:e}),`/skills/sources`)}async function je(e){return m(await d.api.v1.p[`:projectId`].skills.sources.retry.$post({param:{projectId:i()},json:e}),`/skills/sources/retry`)}var L=c(),Me=1e3,R=e=>`${e.repo} @ ${e.ref}`;function Ne(){return re({queryKey:I(),queryFn:({signal:e})=>De({signal:e}),refetchInterval:e=>e.state.data?.sources.some(e=>e.status.state===`loading`)?Me:!1})}function Pe(){return{sources:I(),lists:[E.skills,E.skillsReady,E.importableSkills,E.importableSkillsReady]}}function z(e,t=Pe()){for(let n of t.lists)e.invalidateQueries({queryKey:n,exact:!0})}function B(e,t){let n=l();return w({mutationFn:async t=>{let n=Pe();return{answer:await e(t),keys:n}},onSuccess:({answer:e,keys:r},i)=>{n.setQueryData(r.sources,e),n.invalidateQueries({queryKey:r.sources,exact:!0}),z(n,r),t?.(i)},onError:e=>D(e.message,{tone:`danger`})})}function Fe(e){let t=l(),n=(0,M.useRef)(!1),r=e?.sources.some(e=>e.status.state===`loading`)??!1;(0,M.useEffect)(()=>{n.current&&!r&&z(t),n.current=r},[r,t])}function Ie(){let e=Ne();Fe(e.data);let t=B(ke),i=B(Ae,e=>D(`Removed ${R(e)}. Add it again to restore its skill switches.`)),o=B(je),s=e.data,c=s?.editable===!0&&s.configIssue===null,l=t.isPending||i.isPending;return(0,L.jsxs)(`section`,{"data-slot":`skill-sources`,"aria-labelledby":`skill-sources-heading`,className:`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-3 @min-[520px]:p-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{id:`skill-sources-heading`,className:`text-[15px] font-semibold`,children:`Team skill sources`}),(0,L.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[`Repos whose skills this project can use. Changes are saved to`,` `,(0,L.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/config.json`}),`.`]})]}),e.isError?(0,L.jsxs)(V,{slot:`skill-sources-error`,alert:!0,children:[`Could not load the team skill sources: `,e.error.message,` `,(0,L.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2 min-h-11`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,s?.configIssue?(0,L.jsx)(V,{slot:`skill-sources-config-issue`,alert:!0,children:s.configIssue}):null,s&&!s.editable?(0,L.jsxs)(V,{slot:`skill-sources-read-only`,children:[`Sources are read-only on this remote cockpit. To edit them here, run`,` `,(0,L.jsxs)(`span`,{className:`font-mono`,children:[n(),` remote-settings enable`]}),` on the machine running `,r(`cezar`),`.`]}):null,e.isPending?(0,L.jsx)(`p`,{role:`status`,"aria-busy":`true`,className:`text-xs text-muted-foreground`,children:`Loading sources…`}):s&&s.configIssue===null&&s.sources.length===0?(0,L.jsx)(`p`,{"data-slot":`skill-sources-empty`,className:`text-xs leading-relaxed text-soft-foreground`,children:`No team skill sources yet. Add a repo below to use its skills in this project.`}):s&&s.sources.length>0?(0,L.jsx)(`ul`,{"data-slot":`skill-source-list`,className:`flex flex-col divide-y divide-border rounded-lg border border-border`,children:s.sources.map(e=>(0,L.jsx)(Le,{source:e,editable:c,busy:l,retrying:o.isPending,onToggle:()=>t.mutate({repo:e.repo,ref:e.ref,enabled:!e.enabled}),onRemove:()=>i.mutate({repo:e.repo,ref:e.ref}),onRetry:()=>o.mutate({repo:e.repo,ref:e.ref})},JSON.stringify([e.repo,e.ref])))}):null,s?(0,L.jsx)(Ve,{disabled:!c}):null]})}function V({slot:e,alert:t=!1,children:n}){return(0,L.jsxs)(`div`,{role:t?`alert`:void 0,"data-slot":e,className:`flex items-start gap-2 rounded-lg border border-border bg-background p-3 text-xs leading-relaxed text-muted-foreground`,children:[t?(0,L.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-danger`}):null,(0,L.jsx)(`div`,{className:`min-w-0 break-words`,children:n})]})}function Le({source:e,editable:t,busy:n,retrying:r,onToggle:i,onRemove:o,onRetry:s}){let c=(0,M.useId)(),l=Re(e),u=e.status.state===`error`,d=e.enabled&&(u||e.status.state===`idle`);return(0,L.jsxs)(`li`,{"data-slot":`skill-source`,"data-repo":e.repo,"data-ref":e.ref,"data-state":e.enabled?e.status.state:`disabled`,className:`flex flex-col gap-2 p-2.5 @min-[520px]:flex-row @min-[520px]:items-center`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`p`,{className:`break-all font-mono text-[13px] text-foreground`,children:[e.repo,` `,(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`@ `,e.ref]})]}),(0,L.jsx)(`p`,{id:c,"data-slot":`skill-source-status`,role:u?`alert`:void 0,"aria-live":u?void 0:`polite`,className:u?`mt-1 text-xs leading-relaxed text-danger`:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:l})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[d?(0,L.jsxs)(a,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`skill-source-retry`,className:`min-h-11`,disabled:!t||r,"aria-label":`Retry ${R(e)}`,onClick:s,children:[(0,L.jsx)(O,{"aria-hidden":`true`}),`Retry`]}):null,(0,L.jsx)(`span`,{className:`inline-flex min-h-11 min-w-11 items-center justify-center`,children:(0,L.jsx)(_e,{"data-slot":`skill-source-switch`,"aria-label":`Enable ${R(e)}`,"aria-describedby":c,checked:e.enabled,disabled:!t||n,onCheckedChange:i,className:`relative before:absolute before:-inset-x-1 before:-inset-y-2.5 before:content-['']`})}),(0,L.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,"data-slot":`skill-source-remove`,className:`size-11`,disabled:!t||n,"aria-label":`Remove ${R(e)}`,onClick:o,children:(0,L.jsx)(le,{"aria-hidden":`true`})})]})]})}function Re(e){if(!e.enabled)return`Disabled. Its skills are hidden from the catalog and from tasks.`;let t=e.status;switch(t.state){case`loading`:return`Fetching…`;case`idle`:return`Not fetched yet. Use Retry to fetch it now.`;case`ok`:return t.skillCount===1?`1 skill`:`${t.skillCount} skills`;case`error`:{let e=t.skillCount>0?` Skills from an earlier fetch still show.`:``;return t.cause===`refused-format`?`${r(`cezar`)} does not accept this repo format. Remove it, then add it as ${N}.`:t.cause===`ref-not-found`?`${t.detail} Check the ref, or remove the source and add it with another ref.${e}`:`Could not fetch: ${ze(t.detail)} Check the network and your access to the repo, then Retry.${e}`}}}var ze=e=>/[.!?]$/.test(e.trim())?e.trim():`${e.trim()}.`;function Be(e,t){return e.trim()?P(e)===null?`Use ${N}.`:t.trim()&&!F(t.trim())?`Use a branch, tag or commit SHA for the ref, such as main.`:null:`Enter a repo.`}function Ve({disabled:e}){let[t,n]=(0,M.useState)(``),[r,i]=(0,M.useState)(``),[o,s]=(0,M.useState)(null),c=(0,M.useId)(),l=(0,M.useId)(),u=(0,M.useId)(),d=B(Oe,()=>{n(``),i(``)});return(0,L.jsxs)(`form`,{"data-slot":`skill-source-add`,"aria-label":`Add a team skill source`,noValidate:!0,onSubmit:e=>{e.preventDefault();let n=Be(t,r);s(n),!n&&d.mutate(r.trim()?{repo:t.trim(),ref:r.trim()}:{repo:t.trim()})},className:`flex flex-col gap-2 @min-[520px]:flex-row @min-[520px]:flex-wrap @min-[520px]:items-end`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,L.jsx)(`label`,{htmlFor:c,className:`text-xs font-medium`,children:`Repo`}),(0,L.jsx)(A,{id:c,"data-slot":`skill-source-repo`,value:t,placeholder:`owner/name`,autoComplete:`off`,spellCheck:!1,disabled:e,"aria-invalid":o?!0:void 0,"aria-describedby":o?u:void 0,onChange:e=>{n(e.target.value),s(null)},className:`h-11 font-mono text-[13px]`})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 @min-[520px]:w-36`,children:[(0,L.jsx)(`label`,{htmlFor:l,className:`text-xs font-medium`,children:`Ref`}),(0,L.jsx)(A,{id:l,"data-slot":`skill-source-ref`,value:r,placeholder:`main`,autoComplete:`off`,spellCheck:!1,disabled:e,onChange:e=>{i(e.target.value),s(null)},className:`h-11 font-mono text-[13px]`})]}),(0,L.jsx)(a,{type:`submit`,"data-slot":`skill-source-submit`,className:`h-11`,disabled:e||d.isPending,children:`Add source`}),o?(0,L.jsx)(`p`,{id:u,role:`alert`,"data-slot":`skill-source-problem`,className:`text-xs text-danger @min-[520px]:basis-full`,children:o}):null]})}var He=[[`.ai`,`cezar`,`skills`],[`.ai`,`squawk`,`skills`],[`.ai`,`skills`],[`.claude`,`skills`],[`.agents`,`skills`],[`skills`]];function Ue(e){let t=e.split(`/`).slice(0,-1);if((e===`SKILL.md`||e.endsWith(`/SKILL.md`)||t.at(-1)===`commands`)&&t.pop(),t[0]===`plugins`&&t[1])return{kind:`plugin`,name:t[1]};for(let e of He){let n=We(t,e);if(n!==-1&&(e.length>1||n===t.length-1)){t.splice(n,e.length);break}}return t.length>0?{kind:`directory`,name:t.join(`/`)}:null}function We(e,t){for(let n=e.length-t.length;n>=0;n--)if(t.every((t,r)=>e[n+r]===t))return n;return-1}var H=[{id:`project`,label:`This project`,sources:new Set([`ai`,`cezar`,`agents`])},{id:`global`,label:`Global`,sources:new Set([`global`])},{id:`builtin`,label:`Built-in`,sources:new Set([`builtin`])}],U=(e,t,n,r)=>({key:e,label:t,kind:n,locked:r,items:[],children:[]});function Ge(e){let t=H.map(e=>U(`source\u0000${e.id}`,e.label,`source`,!0)),n=new Map;for(let r of e){let{skill:e}=r;if(!e.team){let n=H.findIndex(t=>t.sources.has(e.source));t[n===-1?0:n].items.push(r);continue}let{repo:i,path:a}=e.team,o=n.get(i);o||(o=U(`repo\u0000${i}`,i,`repo`,!1),n.set(i,o));let s=Ue(a);if(!s){o.items.push(r);continue}let c=`${o.key}\u0000${s.kind}\u0000${s.name}`,l=o.children.find(e=>e.key===c);l||(l=U(c,s.name,s.kind,!1),o.children.push(l)),l.items.push(r)}for(let e of n.values())e.children.sort((e,t)=>e.label.localeCompare(t.label));let r=[...n.values()].sort((e,t)=>e.label.localeCompare(t.label));return[t[0],...r,t[1],t[2]].filter(e=>e.items.length>0||e.children.length>0)}function W(e){return e.flatMap(e=>[e.key,...W(e.children)])}function G(e){return[...e.items,...e.children.flatMap(G)]}function Ke(e,t){let n=G(e);if(e.locked)return{enabled:n.length,total:n.length,state:`on`,refs:[]};let r=[],i=0;for(let{skill:e}of n)e.team&&(r.push({repo:e.team.repo,name:e.name}),t(e)&&i++);let a=i===0?`off`:i===r.length?`on`:`mixed`;return{enabled:i,total:r.length,state:a,refs:r}}function K(e,t){if(t.trim()===``)return null;let n=new Set,r=(e,i)=>{let a=[...i,e.label];for(let{skill:r,key:i}of e.items){let e=[r.description??``,...a].join(` `);de(r.name,e,t)>0&&n.add(i)}for(let t of e.children)r(t,a)};for(let t of e)r(t,[]);return n}function q(e,t){let n=[],r=(e,i)=>{let a=[...i,e.key],o=e.items.some(e=>t.has(e.key));o&&n.push(...a.filter(e=>!n.includes(e)));for(let t of e.children)o=r(t,a)||o;return o};for(let t of e)r(t,[]);return n}function J(e){let t=e?.disabledTeamSkills;if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=C.safeParse(e);t.success&&n.push(t.data)}return n}var Y=(e,t)=>e.repo===t.repo&&e.name===t.name;function X(e){return e.team?{repo:e.team.repo,name:e.name}:void 0}function qe(e,t,n){let r=new Map;for(let e of t)r.has(e.name)||r.set(e.name,e);let i=[],a=new Set;for(let t of e){let e=X(t);if(!e)continue;let o=JSON.stringify([e.repo,e.name]);if(a.has(o))continue;a.add(o);let s=n(e),c=r.get(t.name),l=c?X(c):void 0;s&&c&&!(l&&Y(l,e))?i.push({skill:t,on:s,hiddenBy:c.team?.repo??c.source}):i.push({skill:t,on:s})}return i}var Z=new Map;function Je(e){let t=Z.get(e);return t||(t={chain:Promise.resolve(),latest:0},Z.set(e,t)),t}function Ye(e){let t=l(),n=T(e),[r,i]=M.useState(0),a=M.useMemo(()=>J(n.data),[n.data]),o=M.useCallback(e=>!a.some(t=>Y(t,e)),[a]),s=M.useCallback(n=>{let r=[e,`ui-state`],a=[e,`skills`],o=t.getQueryData(r),s=n(J(o));t.setQueryData(r,{...o,disabledTeamSkills:s});let c=Je(e),l=++c.latest;i(e=>e+1),c.chain=c.chain.then(async()=>{try{let n=await p({disabledTeamSkills:s},e);l===c.latest&&(t.setQueryData(r,n),t.invalidateQueries({queryKey:a}))}catch(e){D(e instanceof Error?e.message:String(e),{tone:`danger`}),l===c.latest&&t.invalidateQueries({queryKey:r})}finally{i(e=>e-1)}})},[e,t]);return{disabled:a,isOn:o,toggle:M.useCallback(e=>{let t={repo:e.repo,name:e.name};s(e=>e.some(e=>Y(e,t))?e.filter(e=>!Y(e,t)):[...e,t])},[s]),setMany:M.useCallback((e,t)=>{let n=e.map(e=>({repo:e.repo,name:e.name}));s(e=>{if(t)return e.filter(e=>!n.some(t=>Y(e,t)));let r=[...e];for(let e of n)r.some(t=>Y(t,e))||r.push(e);return r})},[s]),pending:r>0,ready:n.isSuccess}}var Q=`__bm`,Xe=`__import`,$=e=>e.team?`${e.team.repo}\u0000${e.name}`:e.path,Ze=e=>e.source!==`team`&&e.source!==`builtin`;function Qe(){return(0,L.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,L.jsx)($e,{})})}function $e(){let e=ne(),n=te(),r=ee(),[a]=t(),[o,s]=(0,M.useState)(``),c=Ye(i()),l=et(),u=(0,M.useMemo)(()=>e.data??[],[e.data]),d=(0,M.useMemo)(()=>r.data??[],[r.data]),f=r.isSuccess,p=(0,M.useMemo)(()=>tt(u,f?d:null,c.isOn),[u,d,f,c.isOn]),m=(0,M.useMemo)(()=>Ge(p),[p]),h=new Map;for(let e of p)h.set(e.skill.name,(h.get(e.skill.name)??0)+1);let g=e=>(h.get(e.name)??0)>1&&e.team!==void 0,_=e=>{let t=X(e);return t&&f?c.isOn(t):!0},v=e=>{let t=X(e);return t?{ariaLabel:g(e)?`Enable ${e.name} from ${t.repo}`:`Enable ${e.name}`,checked:_(e),disabled:!f||!c.ready,locked:!1,onCheckedChange:()=>c.toggle(t)}:{ariaLabel:`${e.name} is always enabled`,checked:!0,disabled:!0,locked:!0,onCheckedChange:()=>{}}},y=e=>`/skills?skill=${encodeURIComponent(e.name)}${g(e)?`&repo=${encodeURIComponent(e.team.repo)}`:``}`,b=a.get(`skill`),x=nt(p,b,a.get(`repo`),_)?.key??null,S=rt(m,x),C=e=>{s(e);let t=K(m,e);t&&t.size>0&&S.open(q(m,t))};if(e.isError)return(0,L.jsx)(he,{icon:(0,L.jsx)(k,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let w=b===Q,T=e.isPending?[]:it({tree:m,matches:K(m,o),isOpen:S.isOpen,onFold:S.toggle,openKey:x,workflows:n.data?.workflows??[],activationFor:v,linkFor:y,groupActivationFor:e=>Ke(e,_),switchable:f&&c.ready,onActivate:c.setMany});return(0,L.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,L.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,L.jsxs)(j,{to:w?`/skills`:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":w?`page`:void 0,"aria-expanded":w,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,L.jsx)(se,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Run from GitHub`]})})]}),w?(0,L.jsx)(`section`,{"data-slot":`skills-bookmarklets`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:(0,L.jsx)(ge,{skills:p.filter(e=>_(e.skill)&&!e.hiddenBy).map(e=>e.skill)})}):null,(0,L.jsx)(Ie,{}),(0,L.jsx)(ot,{query:o,onQuery:C,refreshing:l.isPending,onRefresh:()=>l.mutate(),onFoldAll:S.setAll}),(0,L.jsxs)(`section`,{"data-slot":`skills-list`,"aria-label":`Skills`,className:`flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-2 @min-[520px]:p-3`,children:[r.isError?(0,L.jsx)(st,{message:r.error.message,retrying:r.isFetching,onRetry:()=>void r.refetch()}):null,(0,L.jsx)(`div`,{"data-slot":`skill-rows`,className:`min-h-0 overflow-y-auto md:max-h-[calc(100dvh-260px)]`,children:e.isPending?(0,L.jsx)(`p`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-muted-foreground`,children:`Loading skills…`}):T.length>0?(0,L.jsxs)(`table`,{"data-slot":`skills-table`,className:`w-full table-fixed border-collapse text-left`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{className:`border-b border-border text-[12px] text-muted-foreground`,children:[(0,L.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-semibold`,children:`Skill / group`}),(0,L.jsx)(`th`,{scope:`col`,className:`hidden w-[30%] px-2 py-2 font-semibold @min-[520px]:table-cell`,children:`Used by`}),(0,L.jsx)(`th`,{scope:`col`,className:`w-[116px] px-2 py-2 text-right font-semibold`,children:`Enabled`})]})}),(0,L.jsx)(`tbody`,{children:T})]}):(0,L.jsx)(`p`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:p.length>0?`(no skills match)`:(0,L.jsx)(be,{})})})]})]})}function et(){let e=l();return w({mutationFn:()=>f(),onSuccess:t=>{e.setQueryData(E.skills,t),e.invalidateQueries({queryKey:E.importableSkills}),D(`Team skills refreshed.`)},onError:e=>D(e.message,{tone:`danger`})})}function tt(e,t,n){let r=new Set(e.filter(Ze).map(e=>e.name)),i=t?qe(t.filter(e=>!r.has(e.name)),e,n):[],a=(e,t)=>({skill:e,key:$(e),...t?{hiddenBy:t}:{}}),o=new Set((t??[]).map($)),s=[...e.filter(e=>e.source!==`team`||!o.has($(e))).map(e=>a(e)),...i.map(e=>a(e.skill,e.on?e.hiddenBy:void 0))].sort((e,t)=>e.skill.name.localeCompare(t.skill.name)),c=new Map(s.map(e=>[e.skill,e]));return pe(s.map(e=>e.skill)).map(e=>c.get(e))}function nt(e,t,n,r){if(t===null||t===Q)return null;if(t===Xe)return e.find(e=>!r(e.skill))??null;let i=e.filter(e=>e.skill.name===t);return i.find(e=>n===null||e.skill.team?.repo===n)??i[0]??null}function rt(e,t){let[n,r]=(0,M.useState)({}),i=e=>r(t=>({...t,...Object.fromEntries(e.map(e=>[e,!0]))})),a=t?q(e,new Set([t])).join(``):``;return(0,M.useEffect)(()=>{a&&r(e=>({...e,...Object.fromEntries(a.split(``).map(e=>[e,!0]))}))},[a]),{isOpen:(e,t)=>n[e.key]??t===0,toggle:(e,t)=>r(n=>({...n,[e]:t})),open:i,setAll:t=>r(Object.fromEntries(W(e).map(e=>[e,t])))}}function it(e){let t=[],n=t=>e.matches===null||e.matches.has(t.key),r=e=>e.items.some(n)||e.children.some(r),i=(a,o)=>{if(!r(a))return;let s=e.isOpen(a,o);if(t.push((0,L.jsx)(ut,{node:a,depth:o,open:s,onFold:()=>e.onFold(a.key,!s),activation:e.groupActivationFor(a),switchable:e.switchable,onActivate:e.onActivate},a.key)),s){for(let r of a.items.filter(n)){let n=r.key===e.openKey,i=me(e.workflows,r.skill.name),a=e.activationFor(r.skill);t.push((0,L.jsx)(ft,{item:r,depth:o+1,href:n?`/skills`:e.linkFor(r.skill),expanded:n,usedBy:i,activation:a},r.key)),n&&t.push((0,L.jsx)(at,{skill:r.skill,usedBy:i,activation:a},`${r.key}\u0000detail`))}for(let e of a.children)i(e,o+1)}};for(let t of e.tree)i(t,0);return t}function at({skill:e,usedBy:t,activation:n}){return(0,L.jsx)(`tr`,{"data-slot":`skill-detail-row`,children:(0,L.jsx)(`td`,{colSpan:3,className:`border-b border-border px-3 pb-5 @min-[520px]:px-5`,children:(0,L.jsx)(`div`,{"data-slot":`skills-detail`,className:`min-w-0 rounded-lg border border-border bg-background p-4 md:p-5`,children:(0,L.jsx)(ye,{skill:e,usedBy:t,activation:n})})})})}function ot({query:e,onQuery:t,refreshing:n,onRefresh:r,onFoldAll:i}){return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(`div`,{className:`sw-search relative min-w-0 basis-full sm:basis-auto sm:flex-1`,children:[(0,L.jsx)(ae,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(A,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:e,onChange:e=>t(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,L.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:n,onClick:r,className:`flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-55`,children:[(0,L.jsx)(O,{"aria-hidden":`true`,className:o(`size-3`,n&&`motion-safe:animate-spin`)}),n?`Refreshing…`:`Refresh`]}),(0,L.jsx)(a,{type:`button`,variant:`outline`,"data-slot":`skills-expand-all`,className:`h-11 text-xs`,onClick:()=>i(!0),children:`Expand groups`}),(0,L.jsx)(a,{type:`button`,variant:`outline`,"data-slot":`skills-collapse-all`,className:`h-11 text-xs`,onClick:()=>i(!1),children:`Collapse groups`})]})}function st({message:e,retrying:t,onRetry:n}){return(0,L.jsxs)(`div`,{role:`alert`,"data-slot":`skills-importable-error`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-background p-3 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{children:[`Could not load the team skills, so they cannot be switched right now. Your saved choice is kept.`,` `,e]}),(0,L.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11`,disabled:t,onClick:n,children:`Retry`})]})}var ct={repo:`repository`,plugin:`plugin`,directory:`directory`},lt=e=>({paddingInlineStart:`${e*16}px`});function ut({node:e,depth:t,open:n,onFold:r,activation:i,switchable:a,onActivate:s}){let c=n?ue:oe,l=ct[e.kind],u=e.locked||a;return(0,L.jsxs)(`tr`,{"data-slot":`skill-group-row`,"data-group":e.label,"data-kind":e.kind,"data-level":t,className:o(`border-b border-border`,t===0&&`bg-muted/40`),children:[(0,L.jsx)(`th`,{scope:`row`,className:`min-w-0 p-0 text-left font-normal`,children:(0,L.jsx)(`span`,{className:`flex min-w-0`,style:lt(t),children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`skill-group-toggle`,"aria-expanded":n,onClick:r,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground`,children:[(0,L.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),(0,L.jsx)(`span`,{className:o(`min-w-0 [overflow-wrap:anywhere]`,t===0?`text-[13px] font-semibold`:`text-[13px] font-medium`),children:e.label}),l?(0,L.jsx)(`span`,{className:`shrink-0 text-[12px] text-soft-foreground`,children:l}):null]})})}),(0,L.jsx)(`td`,{"aria-hidden":`true`,className:`hidden @min-[520px]:table-cell`}),(0,L.jsx)(`td`,{className:`px-1 py-0 text-right`,children:(0,L.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-1`,children:[(0,L.jsx)(`span`,{"data-slot":`skill-group-count`,className:`text-[12px] tabular-nums text-muted-foreground`,children:u?`${i.enabled} / ${i.total}`:`—`}),(0,L.jsx)(dt,{label:e.label,locked:e.locked,state:u?i.state:null,disabled:e.locked||!a||i.total===0,onClick:()=>s(i.refs,i.state!==`on`)})]})})]})}function dt({label:e,locked:t,state:n,disabled:r,onClick:i}){return(0,L.jsx)(`button`,{type:`button`,role:`checkbox`,"data-slot":`skill-group-switch`,"data-state":n??`unknown`,"aria-checked":n===null?void 0:n===`mixed`?`mixed`:n===`on`,"aria-busy":n===null||void 0,"aria-label":t?`${e} skills are always enabled`:`Enable all skills in ${e}`,disabled:r,onClick:i,className:`group/check inline-flex size-11 shrink-0 items-center justify-center rounded-md focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground disabled:cursor-default`,children:(0,L.jsx)(`span`,{"aria-hidden":`true`,className:o(`inline-flex size-5 items-center justify-center rounded border-2 transition-colors`,n===`on`||n===`mixed`?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-muted-foreground bg-card text-transparent`,n===null&&`border-dashed border-soft-foreground`,`group-disabled/check:opacity-60`),children:n===`mixed`?(0,L.jsx)(ie,{className:`size-3.5`}):(0,L.jsx)(ce,{className:`size-3.5`})})})}function ft({item:e,depth:t,href:n,expanded:r,usedBy:i,activation:a}){let{skill:s,hiddenBy:c}=e,l=fe(s),u=[...new Set(i.map(e=>e.split(` › `)[0]))];return(0,L.jsxs)(`tr`,{"data-slot":`skill-table-row`,className:o(`border-b border-border`,r&&`border-transparent`),children:[(0,L.jsx)(`td`,{className:`min-w-0 p-0`,style:lt(t),children:(0,L.jsxs)(j,{to:n,"data-slot":`skill-row`,"data-skill":s.name,"data-repo":s.team?.repo,"data-project":l?`true`:void 0,"data-enabled":a.checked?`true`:void 0,"aria-current":r?`page`:void 0,"aria-expanded":r,className:o(`selection-row flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-3 py-2 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-link-foreground`,r&&`bg-accent-strong/10`),children:[(0,L.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,L.jsx)(`span`,{className:o(`min-w-0 break-words text-[13px]`,l?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:s.name})}),s.description?(0,L.jsx)(`span`,{className:`line-clamp-1 text-xs leading-relaxed text-supporting-foreground`,children:s.description}):null,u.length>0?(0,L.jsxs)(`span`,{"data-slot":`skill-used-by-inline`,className:`text-xs text-supporting-foreground @min-[520px]:hidden`,children:[`Used by `,u.join(`, `)]}):null,c?(0,L.jsxs)(`span`,{"data-slot":`skill-hidden-by`,className:`min-w-0 text-xs text-supporting-foreground [overflow-wrap:anywhere]`,children:[`hidden by `,c]}):null]})}),(0,L.jsx)(`td`,{"data-slot":`skill-used-by-cell`,className:`hidden px-2 py-2 align-middle text-xs text-supporting-foreground @min-[520px]:table-cell`,children:u.length>0?(0,L.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:u.join(`, `)}):(0,L.jsx)(`span`,{className:`text-soft-foreground`,children:`—`})}),(0,L.jsx)(`td`,{className:`px-1 py-0 text-right align-middle`,children:(0,L.jsx)(`span`,{className:`inline-flex justify-end`,children:(0,L.jsx)(ve,{skill:s,activation:a})})})]})}export{Qe as SkillsRoute};
@@ -1 +0,0 @@
1
- import{Ir as e,qr as t}from"./project-scope-context-DSkcNKO7.js";function n(n,r){return e(n,t,r)}export{n as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Ar as n,Kr as r}from"./project-scope-context-DSkcNKO7.js";import{i}from"./live-protocol-DBPXI6ks.js";var a=e(t(),1);function o(e,t){if(!i(e.path))throw Error(`unsupported shared read`);let r=new URL(e.path,`http://cezar.invalid`);return r.searchParams.sort(),n({kind:`read`,path:`${r.pathname}${r.search}`,intervalMs:e.intervalMs},{value:t})}function s(e,t,n,i){let s=r(),c=JSON.stringify(t),l=(0,a.useMemo)(()=>JSON.parse(c),[c]);(0,a.useEffect)(()=>{if(!e||n===!1)return;let t=!0,r=o({path:e,intervalMs:n},(e,n)=>{n||s.cancelQueries({queryKey:l,exact:!0}).then(()=>{t&&s.setQueryData(l,i?i(e,s):e)})});return()=>{t=!1,r()}},[s,e,l,n,i])}function c(e,t){return n({kind:`topic`,topic:e},{value:t})}export{o as n,s as r,c as t};