claude-code-session-manager 0.134.0 → 0.135.0

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 (41) hide show
  1. package/dist/assets/{AgentLibrary-C9KFGJQq.js → AgentLibrary-DRlcF1YD.js} +1 -1
  2. package/dist/assets/{AppSettings-CvVQ6ot5.js → AppSettings-CBhYHKGI.js} +1 -1
  3. package/dist/assets/{Button-BHvploNk.js → Button-DtBUGvGI.js} +1 -1
  4. package/dist/assets/{DocumentEditorPane-DaX4xag_.js → DocumentEditorPane-C82c7Qtl.js} +1 -1
  5. package/dist/assets/{Extensions-DbRY-KEz.js → Extensions-Kn-oUD2_.js} +2 -2
  6. package/dist/assets/{History-BE_mjM24.js → History-B4c3Uz9u.js} +1 -1
  7. package/dist/assets/{Library-I37dQ6pB.js → Library-1RpLT-aH.js} +1 -1
  8. package/dist/assets/{ListDetail-DJYMWYQd.js → ListDetail-xr0oxNkv.js} +1 -1
  9. package/dist/assets/{Panel-DP8eSKSs.js → Panel-O8XPrpJu.js} +1 -1
  10. package/dist/assets/{ProjectClaudeConfig-Cw8lc3Qi.js → ProjectClaudeConfig-DBGhhzg2.js} +1 -1
  11. package/dist/assets/{ProvenanceBadge-DUwhsmdA.js → ProvenanceBadge-DSaizfZL.js} +1 -1
  12. package/dist/assets/{Scheduler-B9D2gZqs.js → Scheduler-D2_5NyiR.js} +1 -1
  13. package/dist/assets/{Settings-DSk7bn-1.js → Settings-Clgqb3Lq.js} +1 -1
  14. package/dist/assets/{SkillReferenceGraph-DtJcJJHR.js → SkillReferenceGraph-D80RA7kR.js} +1 -1
  15. package/dist/assets/{Skills-BPZnSjsB.js → Skills-DNG7tHSf.js} +1 -1
  16. package/dist/assets/{SourceChip-DUxulNOp.js → SourceChip-D-Imzszd.js} +1 -1
  17. package/dist/assets/{SystemPrompt-BXAugVle.js → SystemPrompt-CGlOpUQA.js} +1 -1
  18. package/dist/assets/{TiptapBody-CDC1vrOo.js → TiptapBody-CJFGfBdz.js} +1 -1
  19. package/dist/assets/{Toggle-CrgM7OTR.js → Toggle-0Ff0bPa_.js} +1 -1
  20. package/dist/assets/{ViewTabs-DLwaU9RB.js → ViewTabs-BCMYQwo_.js} +1 -1
  21. package/dist/assets/{VoiceButton-C4hIBxIP.js → VoiceButton-JzyC6DAB.js} +1 -1
  22. package/dist/assets/{historyTotals-itA00dXm.js → historyTotals-B01WPBwh.js} +1 -1
  23. package/dist/assets/{index-Cjt8B7H9.css → index-CjQ_p5y7.css} +1 -1
  24. package/dist/assets/{index-Cznhnxhq.js → index-rt7pTODX.js} +362 -362
  25. package/dist/index.html +2 -2
  26. package/dist-web/app.css +1 -1
  27. package/dist-web/app.js +392 -392
  28. package/package.json +1 -1
  29. package/plugins/session-manager-dev/skills/develop/standards.md +1 -1
  30. package/src/main/build-info.json +4 -4
  31. package/src/main/lib/persona-macro/macroJobDispatch.cjs +3 -2
  32. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  33. package/src/main/lib/prd/prdFrontmatter.cjs +25 -1
  34. package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
  35. package/src/main/promptSessionEvents.cjs +7 -1
  36. package/src/main/runVerify.cjs +2 -2
  37. package/src/main/scheduler/prdParser.cjs +17 -1
  38. package/src/main/scheduler.cjs +137 -15
  39. package/src/main/templates/PRD_AUTHORING.md +2 -2
  40. package/src/preload/api.d.ts +8 -2
  41. package/src/seed/agents/project-home-builder.md +4 -2
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SkillReferenceGraph-DtJcJJHR.js","./index-Cznhnxhq.js","./monaco-editor-BsIlgG7c.js","./monaco-editor-Cu5D__1H.css","./index-Cjt8B7H9.css"])))=>i.map(i=>d[i]);
2
- import{aO as a,ay as t,bh as re,bc as Y,az as fe,ax as xe,m as S,a7 as he,aW as ge,ac as be,b7 as te,bj as ie,bu as ke,c as je,bm as ve,H as ye}from"./index-Cznhnxhq.js";import{s as ue}from"./SourceChip-DUxulNOp.js";import{d as Ne,M as we,s as Se,i as Ce,f as $e,E as Ee,c as Pe,e as Me,g as Ae,l as Oe,b as Re,r as ce,S as Le,a as Te}from"./Skills-BPZnSjsB.js";import{a as pe}from"./ProvenanceBadge-DUwhsmdA.js";import{_ as De}from"./monaco-editor-BsIlgG7c.js";import{L as _e}from"./ListDetail-DJYMWYQd.js";import{e as Ie,M as Fe,d as Ue}from"./Library-I37dQ6pB.js";import"./Panel-DP8eSKSs.js";import"./Toggle-CrgM7OTR.js";import"./Button-BHvploNk.js";const Be="flex items-center gap-[9px] px-5 whitespace-nowrap cursor-default h-[41px] bg-bg-elev border border-accent border-t-2 border-b-bg-elev rounded-t-[9px] text-[14.5px] font-semibold text-fg",He="flex items-center gap-[9px] px-5 whitespace-nowrap cursor-pointer h-[38px] border border-b-0 border-transparent rounded-t-[9px] text-[14.5px] font-medium text-fg-dim hover:bg-bg-elev hover:border-line hover:text-fg",Ve="font-mono text-[11px] font-semibold text-accent",We="font-mono text-[11px] font-medium text-fg-faint";function qe({options:e,active:s,onChange:n,ariaLabel:l,trailing:o}){const c=a.useRef([]),u=Math.max(0,e.findIndex(i=>i.key===s)),f=i=>{i!==s&&n(i)},r=(i,g)=>{var j;if(i.key!=="ArrowRight"&&i.key!=="ArrowLeft")return;i.preventDefault();const p=(g+(i.key==="ArrowRight"?1:-1)+e.length)%e.length;(j=c.current[p])==null||j.focus(),f(e[p].key)};return t.jsxs("div",{className:"flex items-end gap-0.5",children:[t.jsx("div",{role:"tablist","aria-label":l,className:"flex flex-none items-end gap-0.5",children:e.map(({key:i,label:g,count:p},j)=>{const m=i===s;return t.jsxs("button",{ref:y=>{c.current[j]=y},type:"button",role:"tab","aria-selected":m,tabIndex:j===u?0:-1,"data-testid":`folder-tab-${i}`,onClick:()=>f(i),onKeyDown:y=>r(y,j),className:m?Be:He,children:[g,typeof p=="number"&&t.jsx("span",{"data-testid":`folder-tab-count-${i}`,className:m?Ve:We,children:p})]},i)})}),o!=null&&t.jsx("div",{className:"ml-auto self-center min-w-0",children:o})]})}const Je={skills:null,mcp:null,plugins:null},Ke={fileId:"claudeJson",scope:"user"};function ze(e){return{skillsDir:`${e}/.claude/skills`,commandsDir:`${e}/.claude/commands`,claudeJson:`${e}/.claude.json`,pluginsManifest:`${e}/.claude/plugins/installed_plugins.json`}}async function Ge(e,s){const[n,l]=await Promise.all([fe(e),window.api.config.listDir(s,{filesOnly:!0})]),o=n.errors[0];if(o)throw new Error(`${o.path}: ${o.error}`);if(!l.ok)throw new Error(`${s}: ${l.error??"failed to list directory"}`);return n.entries.length+l.entries.filter(c=>c.name.endsWith(".md")).length}async function Ye(){const{data:e}=await window.api.claudeConfig.read(Ke),s=e==null?void 0:e.mcpServers;return s&&typeof s=="object"&&!Array.isArray(s)?Object.keys(s).length:0}async function Xe(){return(await window.api.plugins.list()).length}function Ze(){const e=re(),[s,n]=a.useState(Je),l=a.useRef({skills:0,mcp:0,plugins:0}),o=a.useCallback((i,g)=>{const p=l.current,j=++p[i],m=y=>{p[i]===j&&n(k=>k[i]===y?k:{...k,[i]:y})};g().then(m,()=>m(null))},[]),c=a.useMemo(()=>e?ze(e):null,[e]),u=a.useCallback(()=>{c&&o("skills",()=>Ge(c.skillsDir,c.commandsDir))},[c,o]),f=a.useCallback(()=>o("mcp",Ye),[o]),r=a.useCallback(()=>o("plugins",Xe),[o]);return a.useEffect(()=>{const i=l.current;return u(),()=>{i.skills++}},[u]),a.useEffect(()=>{const i=l.current;return f(),r(),()=>{i.mcp++,i.plugins++}},[f,r]),Y(c?[c.skillsDir,c.commandsDir]:[],u),Y(c?[c.claudeJson]:[],f),Y(c?[c.pluginsManifest]:[],r),s}const Q=6e4,ee=60*Q,de=24*ee;function Qe(e,s=Date.now()){if(e===null)return"created on first save";if(e==="present"||!Number.isFinite(e))return null;const n=Math.max(0,s-e);return n<Q?"just now":n<ee?`${Math.floor(n/Q)}m ago`:n<de?`${Math.floor(n/ee)}h ${Math.floor(n%ee/Q)}m ago`:`${Math.floor(n/de)}d ago`}async function et(e){try{if(e.kind==="dir")return await window.api.config.exists(e.path)?"present":null;const s=await window.api.config.readText(e.path,{maxBytes:1});return s.exists?Number.isFinite(s.mtimeMs)?s.mtimeMs:void 0:s.error?void 0:null}catch{return}}function tt(e,s){const n=Object.keys(e);return n.length!==Object.keys(s).length?!1:n.every(l=>Object.prototype.hasOwnProperty.call(s,l)&&Object.is(e[l],s[l]))}function nt(e){const s=JSON.stringify(e.map(c=>[c.path,c.kind])),[n,l]=a.useState({}),o=a.useRef(0);return a.useEffect(()=>{const c=JSON.parse(s).map(([r,i])=>({path:r,kind:i})),u=()=>{const r=++o.current;Promise.all(c.map(et)).then(i=>{if(r!==o.current)return;const g={};c.forEach((p,j)=>{const m=i[j];m!==void 0&&(g[p.path]=m)}),l(p=>tt(p,g)?p:g)})};u();const f=window.api.config.onChanged(r=>{c.some(i=>r.path===i.path||i.kind==="dir"&&xe(r.path,i.path))&&u()});return()=>{o.current++,f()}},[s]),n}const st=a.lazy(()=>De(()=>import("./SkillReferenceGraph-DtJcJJHR.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(e=>({default:e.SkillReferenceGraph})));function lt({pluginName:e,skills:s,onBack:n,initialSelectedId:l}){var g;const[o,c]=a.useState(l??((g=s[0])==null?void 0:g.id)??null),u=o?s.find(p=>p.id===o)??null:null,f=a.useMemo(()=>Ne(s),[s]),[r,i]=a.useState("list");return t.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[t.jsxs("div",{className:"shrink-0 h-11 flex items-baseline gap-3.5 px-3 border-b border-line bg-bg",children:[t.jsxs("button",{type:"button",onClick:n,className:"font-mono text-accent hover:underline shrink-0 text-xs",children:["← ",e]}),t.jsx("span",{className:"font-serif text-[22px] text-fg shrink-0 truncate max-w-[16rem]",children:(u==null?void 0:u.name)??(u==null?void 0:u.id)??"skill"}),t.jsx("span",{className:"flex-1"}),t.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:t.jsxs("div",{className:"flex rounded border border-line overflow-hidden",children:[t.jsx("button",{onClick:()=>i("list"),className:`px-2 py-0.5 text-xs ${r==="list"?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:"list"}),t.jsx("button",{onClick:()=>i("graph"),className:`px-2 py-0.5 text-xs ${r==="graph"?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:"graph"})]})})]}),t.jsxs("div",{className:"shrink-0 h-[26px] flex items-center gap-[18px] px-3 bg-bg-elev border-b border-line text-[9px] font-mono uppercase tracking-wide overflow-hidden",children:[u!=null&&u.description?t.jsx("span",{className:"text-fg-dim truncate normal-case",children:u.description}):null,t.jsxs("span",{className:"ml-auto text-fg-faint truncate normal-case",children:[s.length," ",s.length===1?"skill":"skills"," · ",f.length," ",f.length===1?"reference":"references"]})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:s.length===0?t.jsx(S,{title:"no skills in this plugin"}):r==="graph"?t.jsx(a.Suspense,{fallback:t.jsx("div",{className:"p-6 text-xs text-fg-faint",children:"Loading graph…"}),children:t.jsx(st,{skills:s,edges:f,selectedId:o,onSelect:c})}):t.jsx(_e,{sidebar:t.jsx("div",{className:"py-1",children:s.map(p=>t.jsxs("button",{onClick:()=>c(p.id),className:`w-full px-3 py-1 text-xs text-left ${o===p.id?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[t.jsx("div",{className:"truncate",children:p.name??p.id}),p.description?t.jsx("div",{className:"truncate text-fg-faint",children:p.description}):null]},p.id))}),detail:u?t.jsx("div",{className:"h-full min-h-0",children:t.jsx(we,{path:u.path,value:u.body,onChange:()=>{},readOnly:!0})}):t.jsx(S,{title:"select a skill"})})})]})}const me=e=>{var s,n;return{type:"plugin",name:e.name,repository:(s=e.manifest)==null?void 0:s.repository,homepage:(n=e.manifest)==null?void 0:n.homepage}},G=(e,s,n)=>e===1?s:n;function at(e,s){const n=Se(e),l=[];return n.skills>0&&l.push({kind:"skills",count:n.skills,label:G(n.skills,"skill","skills"),arrow:"›",title:"Show in the Skills tab",onClick:()=>s("skills")}),n.commands>0&&l.push({kind:"commands",count:n.commands,label:G(n.commands,"command","commands"),arrow:"›",title:"Show in the Skills tab",onClick:()=>s("skills")}),n.mcpServers>0&&l.push({kind:"mcp",count:n.mcpServers===1?null:n.mcpServers,label:G(n.mcpServers,"MCP server","MCP servers"),arrow:"›",title:"Show in the MCP Servers tab",onClick:()=>s("mcp")}),n.agents>0&&l.push({kind:"agents",count:n.agents,label:G(n.agents,"agent","agents"),arrow:"↗",title:"Open the Agents page",onClick:()=>ie.getState().openPanel("agent-library")}),n.hooks>0&&l.push({kind:"hooks",count:n.hooks,label:G(n.hooks,"hook","hooks"),arrow:"↗",title:"Open Settings ▸ Hooks",onClick:()=>ie.getState().openPanel("settings","hooks")}),l}const it=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)} scope`;function rt({row:e,home:s,busy:n,onToggle:l,onOpen:o,onUninstall:c,onJump:u}){var p,j;const f=e.enabled===!0,r=(p=e.manifest)==null?void 0:p.version,i=(j=e.manifest)==null?void 0:j.description,g=at(e,u);return t.jsxs("div",{"data-testid":"plugin-card",className:"grid grid-cols-[36px_minmax(0,1fr)_auto] gap-x-4 px-[18px] py-4 bg-bg-hi border border-line rounded-[10px]",children:[t.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-label":`${f?"Disable":"Enable"} ${e.name}`,"data-testid":"plugin-enabled-switch",disabled:!e.key||n,onClick:()=>l(e),className:`relative mt-px w-9 h-5 rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${f?"bg-accent":"bg-rule"}`,children:t.jsx("span",{"aria-hidden":"true",className:`absolute top-0.5 w-4 h-4 rounded-full bg-bg-hi shadow transition-[left] ${f?"left-[18px]":"left-0.5"}`})}),t.jsxs("div",{className:"min-w-0 flex flex-col gap-2",children:[t.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2.5 gap-y-1.5",children:[t.jsx("button",{type:"button","data-testid":"plugin-card-name",onClick:()=>o(e),title:`Open ${e.name}`,className:"text-left text-[15px] font-semibold text-fg hover:text-accent hover:underline",children:e.name}),r?t.jsxs("span",{className:"font-mono text-[11.5px] text-fg-faint",children:["v",r]}):null,t.jsx(pe,{interactive:!1,input:me(e)}),e.scope?t.jsx("span",{"data-testid":"plugin-scope",className:"text-xs text-fg-faint",children:it(e.scope)}):null]}),i?t.jsx("p",{"data-testid":"plugin-card-description",title:i,className:"text-[13px] text-fg-dim",children:i}):null,g.length>0||e.error?t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[g.map(m=>t.jsxs("button",{type:"button","data-testid":`plugin-chip-${m.kind}`,title:m.title,onClick:m.onClick,className:"inline-flex items-center gap-[5px] h-6 px-2.5 bg-bg border border-line rounded-full text-xs text-fg-dim hover:border-accent hover:text-fg",children:[m.count!==null?t.jsx("b",{className:"font-mono font-semibold text-fg",children:m.count}):null,m.count!==null?" ":null,m.label," ",t.jsx("span",{"aria-hidden":"true",className:"text-fg-faint/60",children:m.arrow})]},m.kind)),e.error?t.jsx("span",{title:e.error,className:"inline-flex items-center h-6 px-2.5 border border-delta-bad/30 rounded-full text-xs text-delta-bad",children:"inspection failed"}):null]}):null,t.jsx("span",{"data-testid":"plugin-card-path",title:e.path,className:"font-mono text-[11px] text-fg-faint/80 whitespace-nowrap overflow-hidden text-ellipsis",children:ue(e.path,s)})]}),t.jsx(ot,{row:e,busy:n,onUninstall:c})]})}function ot({row:e,busy:s,onUninstall:n}){const[l,o]=a.useState(!1),[c,u]=a.useState(!1),f=a.useRef(null),r=a.useId(),i=a.useCallback(()=>{o(!1),u(!1)},[]);a.useEffect(()=>{if(!l)return;const y=P=>{var E;(E=f.current)!=null&&E.contains(P.target)||i()},k=P=>{P.key==="Escape"&&i()};return window.addEventListener("mousedown",y),window.addEventListener("keydown",k),()=>{window.removeEventListener("mousedown",y),window.removeEventListener("keydown",k)}},[l,i]);const g=()=>{i(),ge(e.path)},p=async()=>{i(),await be(e.path)||te.error(`Could not copy ${e.path} to the clipboard`)},j=()=>{i(),n(e)},m="px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev";return t.jsxs("div",{ref:f,className:"relative self-start",children:[t.jsx("button",{type:"button","data-testid":"plugin-menu","aria-label":`Actions for ${e.name}`,"aria-haspopup":"menu","aria-expanded":l,"aria-controls":l?r:void 0,onClick:()=>l?i():o(!0),className:"w-[30px] h-7 inline-flex items-center justify-center bg-bg border border-line rounded-md text-fg-dim hover:border-rule",children:t.jsxs("svg",{"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:[t.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),t.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),t.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}),l&&t.jsx("div",{id:r,role:"menu","aria-label":`Actions for ${e.name}`,className:`absolute ${he.dialog} right-0 top-[34px] w-[210px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[12.5px] text-fg`,children:c?t.jsxs("div",{className:"flex flex-col gap-2 px-2.5 py-[7px]",children:[t.jsxs("span",{className:"font-medium",children:["Uninstall ",e.name,"?"]}),t.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[t.jsx("button",{type:"button",role:"menuitem","data-testid":"plugin-uninstall",disabled:s,onClick:j,className:"h-6 px-2.5 rounded-[5px] bg-delta-bad text-bg-hi font-medium hover:bg-delta-bad/90 disabled:opacity-40",children:"Confirm"}),t.jsx("button",{type:"button",role:"menuitem",onClick:()=>u(!1),className:"h-6 px-2.5 rounded-[5px] border border-line text-fg-dim hover:bg-bg-elev",children:"Cancel"})]})]}):t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",role:"menuitem",onClick:g,className:m,children:"Reveal in File Explorer"}),t.jsx("button",{type:"button",role:"menuitem",onClick:()=>void p(),className:m,children:"Copy path"}),t.jsx("div",{role:"separator",className:"h-px mx-1.5 my-1 bg-line"}),t.jsxs("button",{type:"button",role:"menuitem",disabled:!e.marketplace||s,title:e.marketplace?void 0:"No marketplace is recorded for this install",onClick:()=>u(!0),className:`${m} font-medium text-delta-bad hover:bg-delta-bad/10 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent`,children:["Uninstall ",e.name]})]})})]})}const ct="Plugin contents also appear, read-only, in Skills and MCP Servers — tagged with the plugin that added them.",dt=e=>ie.getState().openPanel("extensions",e);function ut(e,s){var n,l;return[e.name,(n=e.manifest)==null?void 0:n.name,(l=e.manifest)==null?void 0:l.description].some(o=>typeof o=="string"&&o.toLowerCase().includes(s))}function pt({onAdd:e,onJump:s}){const n=re(),[l,o]=a.useState([]),[c,u]=a.useState(!0),[f,r]=a.useState(null),[i,g]=a.useState(null),[p,j]=a.useState(""),[m,y]=a.useState(null),[k,P]=a.useState(new Set),E=ke(d=>d.show),[U,D]=a.useState(null);a.useEffect(()=>{var x,C;let d=!1;return(C=(x=window.api.app).seedStatus)==null||C.call(x).then(b=>{d||y(b)}).catch(()=>{}),()=>{d=!0}},[]);const B=a.useRef(0),M=a.useRef(!1),A=a.useCallback(async()=>{var N,q;const d=++B.current;if(!n)return;M.current||u(!0);const x=`${n}/.claude/plugins/installed_plugins.json`;let C=[],b=null;try{const v=await window.api.config.readJson(x);if(v.exists&&v.parseError)b=`could not parse installed_plugins.json${v.error?`: ${v.error}`:""}`;else if(v.exists&&v.data&&typeof v.data=="object"){const J=v.data,K=[];for(const[$,w]of Object.entries(J.plugins??{})){if(!Array.isArray(w))continue;const[L,T]=$.split("@");for(const h of w)h!=null&&h.installPath&&K.push({name:L,marketplace:T,entry:h})}let z=new Map;try{const $=await((q=(N=window.api.plugins)==null?void 0:N.list)==null?void 0:q.call(N))??[];z=new Map($.map(w=>[w.key,w.enabled]))}catch{}C=await jt(K,kt,async({name:$,marketplace:w,entry:L})=>{var oe;const T={name:$,path:L.installPath,isDirectory:!0,isFile:!1,mtimeMs:0,size:0};let h;try{h=await Ce(T)}catch(le){h=$e(T,le instanceof Error?le.message:String(le))}return(oe=h.manifest)!=null&&oe.version||(h.manifest={...h.manifest??{},version:L.version}),h.marketplace=w,h.scope=L.scope,h.key=w?`${$}@${w}`:$,h.enabled=z.get(h.key)===!0,h})}}catch(v){b=`could not read installed_plugins.json: ${v instanceof Error?v.message:String(v)}`}B.current===d&&(r(b),b?te.error(`Plugins: ${b}`):(C.sort((v,J)=>v.name.localeCompare(J.name)),M.current=C.length>0,o(C)),u(!1))},[n]);a.useEffect(()=>{A()},[A]),a.useEffect(()=>()=>{B.current+=1},[]),Y(n?[`${n}/.claude/plugins/installed_plugins.json`]:[],A);const _=async d=>{if(d.key){D(d.key);try{const x=await window.api.plugins.setEnabled({key:d.key,enabled:!d.enabled});x.ok||E("error",`Could not ${d.enabled?"disable":"enable"} ${d.name}: ${x.error??"unknown error"}`)}catch(x){E("error",`Could not update ${d.name}: ${x instanceof Error?x.message:String(x)}`)}finally{D(null),await A()}}},O=async d=>{if(d.marketplace){D(d.key??d.name);try{const x=await window.api.plugins.uninstall({slug:d.name,marketplaceName:d.marketplace});x.ok||E("error",`Uninstall ${d.name} failed: ${x.error??`exit ${x.exitCode}`}`)}catch(x){E("error",`Uninstall ${d.name} failed: ${x instanceof Error?x.message:String(x)}`)}finally{D(null),await A()}}},I=a.useMemo(()=>m?Object.keys(m).filter(d=>(m[d].status==="exhausted"||m[d].status==="failed")&&!k.has(d)):[],[m,k]),H=I.length>0?t.jsx(ft,{seeders:I,seedStatus:m,onDismiss:d=>P(x=>new Set(x).add(d)),onOpenLibrary:()=>e==null?void 0:e()}):null,F=i?l.find(d=>d.path===i)??null:null,ne=a.useMemo(()=>l.filter(d=>d.enabled===!0).length,[l]),V=p.trim().toLowerCase(),W=a.useMemo(()=>V?l.filter(d=>ut(d,V)):l,[l,V]),se=a.useMemo(()=>({label:"+ Add plugin",testId:"plugins-add",items:[{label:"Browse catalog…",testId:"plugins-add-catalog",onSelect:()=>e==null?void 0:e()}]}),[e]),X=a.useCallback(d=>g(d.path),[]),Z=s??dt;return F?t.jsx(gt,{row:F,home:n,onBack:()=>g(null)},F.path):t.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[t.jsx(Ee,{filter:p,onFilterChange:j,placeholder:"Filter plugins",summary:`${l.length} installed · ${ne} enabled`,primary:se}),H,f?t.jsxs("div",{role:"alert",className:"shrink-0 px-3 py-2 border-b border-line bg-red-950/20 text-xs text-red-300",children:[f,l.length>0?" — showing the last known list":null]}):null,t.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:c&&l.length===0?t.jsx(S,{title:"scanning plugins…"}):f&&l.length===0?null:t.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[l.length===0?t.jsxs("div",{"data-testid":"plugins-empty",className:"flex flex-col gap-1 px-[18px] py-4 border border-dashed border-rule rounded-[10px] text-[13px] text-fg-dim",children:[t.jsx("span",{className:"font-semibold text-fg",children:"No plugins installed"}),t.jsxs("span",{children:["Use + Add plugin, or run ",t.jsx("code",{className:"font-mono text-xs",children:"claude plugin install"}),"."]})]}):W.length===0?t.jsxs("p",{className:"px-1 text-[13px] text-fg-dim",children:["No plugins match “",p.trim(),"”."]}):W.map(d=>t.jsx(rt,{row:d,home:n,busy:U!==null&&U===(d.key??d.name),onToggle:x=>void _(x),onOpen:X,onUninstall:x=>void O(x),onJump:Z},d.path)),t.jsx("p",{className:"px-1 text-xs text-fg-faint",children:ct})]})})]})}const mt=a.memo(pt),ae={"dev-plugin":"session-manager-dev plugin","scheduler-mcp":"Scheduler MCP server","agent-personas":"Agent personas (Architect, Dev Lead)"};function ft({seeders:e,seedStatus:s,onDismiss:n,onOpenLibrary:l}){return t.jsx("div",{className:"shrink-0 flex flex-col gap-1.5 px-3 py-2 border-b border-line bg-yellow-950/20",children:e.map(o=>t.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-300",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium",children:s[o].status==="failed"?`${ae[o]} setup failed — it will retry on next launch. To fix it now:`:`${ae[o]} setup failed after retrying — manual fix needed`}),o==="dev-plugin"?t.jsxs("div",{className:"text-yellow-400/80 mt-0.5",children:["Click ",t.jsx("button",{onClick:l,className:"underline hover:no-underline",children:"here"}),' to open the Library tab, then click Install next to "session-manager-dev".']}):t.jsx("div",{className:"text-yellow-400/80 mt-0.5 font-mono",children:s[o].fix})]}),t.jsx("button",{onClick:()=>n(o),className:"shrink-0 text-yellow-400/70 hover:text-yellow-300","aria-label":`Dismiss ${ae[o]} warning`,children:"✕"})]},o))})}const xt=250,ht=["hooks/hooks.json",".mcp.json",".lsp.json","agents","skills","commands",".claude-plugin/plugin.json"];function gt({row:e,home:s,onBack:n}){var X,Z,d,x,C;const[l,o]=a.useState([]),[c,u]=a.useState([]),[f,r]=a.useState([]),[i,g]=a.useState([]),[p,j]=a.useState([]),[m,y]=a.useState("skills"),[k,P]=a.useState(null),[E,U]=a.useState(!0),[D,B]=a.useState([]),M=a.useRef(0),A=a.useRef(!1),_=a.useCallback(async()=>{if(!s)return;const b=++M.current;try{const{manifest:N}=await Pe(e.path),[q,v,J]=await Promise.all([Me(e.path),Ae(e.path,N),Oe(`${e.path}/bin`,{filesOnly:!0})]),K=q?await Re(q):[],[z,$]=await Promise.all([ce(v.agentFiles),ce(v.commandFiles)]),w=v.mcpServers,L=await Promise.all([...new Set([...ht.map(h=>`${e.path}/${h}`),...v.sourcePaths])].map(async h=>await window.api.config.exists(h)?h:null));if(b!==M.current)return;o(K),u(z),r($),g(w),j(J);const T=L.filter(h=>h!==null);B(h=>h.join("\0")===T.join("\0")?h:T),A.current||(A.current=!0,y(K.length>0?"skills":z.length>0?"agents":$.length>0?"commands":w.length>0?"mcp":e.hooks>0?"hooks":e.monitors>0?"monitors":e.hasLsp?"lsp":"files"))}catch(N){if(b!==M.current)return;te.error(`Failed to load plugin contents: ${N instanceof Error?N.message:String(N)}`)}finally{b===M.current&&U(!1)}},[e.path,e.name,e.hooks,e.monitors,e.hasLsp,s]);a.useEffect(()=>(U(!0),_(),()=>{M.current+=1}),[_]);const O=a.useRef(null),I=a.useRef(!1),H=a.useRef(!1),F=a.useCallback(async()=>{if(I.current){H.current=!0;return}I.current=!0;try{do H.current=!1,await _();while(H.current)}finally{I.current=!1}},[_]),ne=a.useCallback(()=>{O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{O.current=null,F()},xt)},[F]);a.useEffect(()=>()=>{O.current&&clearTimeout(O.current)},[]),Y(D,ne,{depth:0});const V=[{key:"skills",label:"Skills",count:l.length},{key:"agents",label:"Agents",count:c.length},{key:"commands",label:"Commands",count:f.length},{key:"mcp",label:"MCP server",count:i.length},{key:"hooks",label:"Hooks",count:e.hooks},{key:"monitors",label:"Monitors",count:e.monitors},{key:"lsp",label:"LSP",count:e.hasLsp?1:0},{key:"files",label:"Bin",count:p.length}],W=(X=e.manifest)!=null&&X.author?typeof e.manifest.author=="string"?e.manifest.author:e.manifest.author.name??null:null,se=async b=>{const N=await window.api.shell.open({as:"external",url:b});N.ok||te.error(N.error??`Failed to open ${b}`)};return k?t.jsx(lt,{pluginName:((Z=e.manifest)==null?void 0:Z.name)??e.name,skills:l,initialSelectedId:k.id,onBack:()=>P(null)},k.id):t.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[t.jsxs("div",{className:"shrink-0 h-11 flex items-baseline gap-3.5 px-3 border-b border-line bg-bg",children:[t.jsx("button",{type:"button",onClick:n,className:"font-mono text-accent hover:underline shrink-0 text-xs",children:"← Plugins"}),t.jsx("span",{className:"font-serif text-[22px] text-fg shrink-0 truncate max-w-[16rem]",children:((d=e.manifest)==null?void 0:d.name)??e.name}),(x=e.manifest)!=null&&x.version?t.jsxs("span",{className:"font-mono text-fg-faint text-xs shrink-0",children:["v",e.manifest.version]}):null,(C=e.manifest)!=null&&C.description?t.jsx("span",{className:"text-fg-dim text-xs min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:e.manifest.description}):t.jsx("span",{className:"flex-1"}),t.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[t.jsx(pe,{input:me(e)}),e.hasMcp?t.jsx(je,{tone:"accent",children:"MCP"}):null]})]}),e.manifest?t.jsxs("div",{className:"shrink-0 h-[26px] flex items-center gap-[18px] px-3 bg-bg-elev border-b border-line text-[9px] font-mono uppercase tracking-wide overflow-hidden",children:[W?t.jsxs("span",{className:"text-fg-dim truncate",children:[t.jsx("span",{className:"text-fg-faint",children:"Author "}),W]}):null,e.manifest.license?t.jsxs("span",{className:"text-fg-dim truncate",children:[t.jsx("span",{className:"text-fg-faint",children:"License "}),e.manifest.license]}):null,e.manifest.homepage?t.jsxs("button",{onClick:()=>se(e.manifest.homepage),className:"text-accent hover:underline truncate normal-case",title:e.manifest.homepage,children:[t.jsx("span",{className:"text-fg-faint uppercase",children:"Homepage "}),e.manifest.homepage]}):null,t.jsx("span",{className:"ml-auto text-fg-faint truncate normal-case",children:e.path})]}):t.jsx("div",{className:"shrink-0 h-[26px] flex items-center px-3 bg-bg-elev border-b border-line text-[9px] font-mono uppercase tracking-wide overflow-hidden",children:t.jsx("span",{className:"ml-auto text-fg-faint truncate normal-case",children:e.path})}),t.jsxs("div",{className:"flex-1 min-h-0 grid overflow-hidden",style:{gridTemplateColumns:"170px 1fr"},children:[t.jsx("div",{className:"min-h-0 overflow-auto bg-bg-elev border-r border-line py-1",children:V.map(b=>t.jsxs("button",{type:"button",disabled:b.count===0,onClick:()=>y(b.key),className:`w-full text-left px-3 py-1.5 text-xs flex items-center justify-between ${b.count===0?"text-fg-faint opacity-50 cursor-default":m===b.key?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[t.jsx("span",{children:b.label}),b.count>0?t.jsx("span",{className:"font-mono text-fg-faint",children:b.count}):null]},b.key))}),t.jsx("div",{className:"min-h-0 overflow-auto",children:E?t.jsx(S,{title:"scanning…"}):t.jsx(bt,{active:m,row:e,skills:l,agents:c,commands:f,mcpServers:i,files:p,onOpenSkill:P})})]})]})}function bt({active:e,row:s,skills:n,agents:l,commands:o,mcpServers:c,files:u,onOpenSkill:f}){return e==="skills"?n.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:n.map((r,i)=>t.jsx(R,{n:i+1,name:r.name??r.id,description:r.description,onClick:()=>f(r)},r.id))}):e==="agents"?l.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:l.map((r,i)=>t.jsx(R,{n:i+1,name:r.name??r.id,description:r.description},r.id))}):e==="commands"?o.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:o.map((r,i)=>t.jsx(R,{n:i+1,name:r.name??r.id,description:r.description},r.id))}):e==="mcp"?c.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:c.map((r,i)=>t.jsx(R,{n:i+1,name:r.name,description:r.description},r.id))}):e==="hooks"?s.hooks===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:t.jsx(R,{n:1,name:`${s.hooks} ${s.hooks===1?"hook":"hooks"} configured`,description:`${s.path}/hooks/hooks.json`})}):e==="monitors"?s.monitors===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:t.jsx(R,{n:1,name:`${s.monitors} ${s.monitors===1?"monitor":"monitors"} configured`,description:`${s.path}/monitors/monitors.json`})}):e==="lsp"?s.hasLsp?t.jsx("div",{children:t.jsx(R,{n:1,name:"LSP server enabled",description:`${s.path}/.lsp.json`})}):t.jsx(S,{title:"no components"}):u.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:u.map((r,i)=>t.jsx(R,{n:i+1,name:r,description:null},r))})}function R({n:e,name:s,description:n,onClick:l}){const o=l?"button":"div";return t.jsxs(o,{onClick:l,className:`w-full flex items-baseline gap-2.5 py-[9px] px-3 border-b border-line text-left min-w-0 ${l?"hover:bg-bg-hi cursor-pointer":""}`,children:[t.jsx("span",{className:"font-serif text-fg-faint text-xs shrink-0 w-6 text-right",children:String(e).padStart(2,"0")}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"font-mono font-semibold text-accent truncate",children:s}),n?t.jsx("div",{className:"text-fg-dim text-xs truncate",children:n}):null]})]})}const kt=4;async function jt(e,s,n){const l=new Array(e.length);let o=0;const c=Array.from({length:Math.min(s,e.length)},async()=>{for(;o<e.length;){const u=o++;l[u]=await n(e[u])}});return await Promise.all(c),l}const vt={skills:"Add skill",mcp:"Add MCP server",plugins:"Add plugin"};function yt(e){return{skills:[{path:`${e}/.claude/skills`,kind:"dir"}],mcp:[{path:`${e}/.claude.json`,kind:"file",keyPath:"mcpServers"}],plugins:[{path:`${e}/.claude/plugins/installed_plugins.json`,kind:"file"},{path:`${e}/.claude/settings.json`,kind:"file",keyPath:"enabledPlugins"}]}}const Nt=[];function wt({sources:e,ages:s,home:n}){return t.jsx("div",{className:"flex flex-wrap justify-end gap-x-[18px] gap-y-1 text-[11.5px] text-fg-faint",children:e.map(l=>{const o=s[l.path],c=o===void 0?null:Qe(o);return t.jsxs("span",{"data-testid":"extensions-source",title:l.path,className:"whitespace-nowrap",children:[t.jsxs("span",{className:"font-mono text-fg-dim",children:[ue(l.path,n),l.keyPath?` › ${l.keyPath}`:""]}),c&&` · ${c}`]},l.path)})})}function St(){const e=re(),s=Ze(),[n,l]=a.useState("skills"),[o,c]=a.useState(!1),[u,f]=a.useState({scope:"user",cwd:null});ve("extensions",k=>{(k==="skills"||k==="mcp"||k==="plugins")&&(l(k),c(!1))});const r=a.useMemo(()=>e?yt(e):null,[e]),i=a.useMemo(()=>r?[...r.skills,...r.mcp,...r.plugins]:Nt,[r]),g=nt(i),p=a.useCallback(k=>{l(k),c(!1)},[]),j=a.useCallback(()=>c(!1),[]),m=a.useCallback(k=>{f(k),c(!0)},[]),y=a.useCallback(()=>c(!0),[]);return t.jsxs("div",{className:"flex flex-col h-full min-h-0","data-testid":"extensions",children:[t.jsx("div",{className:"shrink-0 mt-6 -mb-px relative z-[1]","data-testid":"extensions-tabs",children:t.jsx(qe,{ariaLabel:"Extensions",options:[{key:"skills",label:"Skills",count:s.skills},{key:"mcp",label:"MCP Servers",count:s.mcp},{key:"plugins",label:"Plugins",count:s.plugins}],active:n,onChange:p,trailing:e&&r?t.jsx(wt,{sources:r[n],ages:g,home:e}):null})}),t.jsxs("div",{className:"flex-1 min-h-0 border border-line bg-bg","data-testid":"extensions-panel",children:[n==="skills"&&t.jsx(Le,{onAdd:y,scope:"user"}),n==="mcp"&&t.jsx(Te,{onAdd:m,scope:"user"}),n==="plugins"&&t.jsx(mt,{onAdd:y,onJump:p})]}),t.jsxs(ye,{open:o,onClose:j,title:vt[n],keyVals:[],children:[n==="skills"&&t.jsx(Ie,{}),n==="mcp"&&t.jsx(Fe,{scope:u.scope,cwd:u.cwd}),n==="plugins"&&t.jsx(Ue,{})]})]})}const Dt=a.memo(St);export{Dt as Extensions};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SkillReferenceGraph-D80RA7kR.js","./index-rt7pTODX.js","./monaco-editor-BsIlgG7c.js","./monaco-editor-Cu5D__1H.css","./index-CjQ_p5y7.css"])))=>i.map(i=>d[i]);
2
+ import{aO as a,ay as t,bh as re,bc as Y,az as fe,ax as xe,m as S,a7 as he,aW as ge,ac as be,b7 as te,bj as ie,bu as ke,c as je,bm as ve,H as ye}from"./index-rt7pTODX.js";import{s as ue}from"./SourceChip-D-Imzszd.js";import{d as Ne,M as we,s as Se,i as Ce,f as $e,E as Ee,c as Pe,e as Me,g as Ae,l as Oe,b as Re,r as ce,S as Le,a as Te}from"./Skills-DNG7tHSf.js";import{a as pe}from"./ProvenanceBadge-DSaizfZL.js";import{_ as De}from"./monaco-editor-BsIlgG7c.js";import{L as _e}from"./ListDetail-xr0oxNkv.js";import{e as Ie,M as Fe,d as Ue}from"./Library-1RpLT-aH.js";import"./Panel-O8XPrpJu.js";import"./Toggle-0Ff0bPa_.js";import"./Button-DtBUGvGI.js";const Be="flex items-center gap-[9px] px-5 whitespace-nowrap cursor-default h-[41px] bg-bg-elev border border-accent border-t-2 border-b-bg-elev rounded-t-[9px] text-[14.5px] font-semibold text-fg",He="flex items-center gap-[9px] px-5 whitespace-nowrap cursor-pointer h-[38px] border border-b-0 border-transparent rounded-t-[9px] text-[14.5px] font-medium text-fg-dim hover:bg-bg-elev hover:border-line hover:text-fg",Ve="font-mono text-[11px] font-semibold text-accent",We="font-mono text-[11px] font-medium text-fg-faint";function qe({options:e,active:s,onChange:n,ariaLabel:l,trailing:o}){const c=a.useRef([]),u=Math.max(0,e.findIndex(i=>i.key===s)),f=i=>{i!==s&&n(i)},r=(i,g)=>{var j;if(i.key!=="ArrowRight"&&i.key!=="ArrowLeft")return;i.preventDefault();const p=(g+(i.key==="ArrowRight"?1:-1)+e.length)%e.length;(j=c.current[p])==null||j.focus(),f(e[p].key)};return t.jsxs("div",{className:"flex items-end gap-0.5",children:[t.jsx("div",{role:"tablist","aria-label":l,className:"flex flex-none items-end gap-0.5",children:e.map(({key:i,label:g,count:p},j)=>{const m=i===s;return t.jsxs("button",{ref:y=>{c.current[j]=y},type:"button",role:"tab","aria-selected":m,tabIndex:j===u?0:-1,"data-testid":`folder-tab-${i}`,onClick:()=>f(i),onKeyDown:y=>r(y,j),className:m?Be:He,children:[g,typeof p=="number"&&t.jsx("span",{"data-testid":`folder-tab-count-${i}`,className:m?Ve:We,children:p})]},i)})}),o!=null&&t.jsx("div",{className:"ml-auto self-center min-w-0",children:o})]})}const Je={skills:null,mcp:null,plugins:null},Ke={fileId:"claudeJson",scope:"user"};function ze(e){return{skillsDir:`${e}/.claude/skills`,commandsDir:`${e}/.claude/commands`,claudeJson:`${e}/.claude.json`,pluginsManifest:`${e}/.claude/plugins/installed_plugins.json`}}async function Ge(e,s){const[n,l]=await Promise.all([fe(e),window.api.config.listDir(s,{filesOnly:!0})]),o=n.errors[0];if(o)throw new Error(`${o.path}: ${o.error}`);if(!l.ok)throw new Error(`${s}: ${l.error??"failed to list directory"}`);return n.entries.length+l.entries.filter(c=>c.name.endsWith(".md")).length}async function Ye(){const{data:e}=await window.api.claudeConfig.read(Ke),s=e==null?void 0:e.mcpServers;return s&&typeof s=="object"&&!Array.isArray(s)?Object.keys(s).length:0}async function Xe(){return(await window.api.plugins.list()).length}function Ze(){const e=re(),[s,n]=a.useState(Je),l=a.useRef({skills:0,mcp:0,plugins:0}),o=a.useCallback((i,g)=>{const p=l.current,j=++p[i],m=y=>{p[i]===j&&n(k=>k[i]===y?k:{...k,[i]:y})};g().then(m,()=>m(null))},[]),c=a.useMemo(()=>e?ze(e):null,[e]),u=a.useCallback(()=>{c&&o("skills",()=>Ge(c.skillsDir,c.commandsDir))},[c,o]),f=a.useCallback(()=>o("mcp",Ye),[o]),r=a.useCallback(()=>o("plugins",Xe),[o]);return a.useEffect(()=>{const i=l.current;return u(),()=>{i.skills++}},[u]),a.useEffect(()=>{const i=l.current;return f(),r(),()=>{i.mcp++,i.plugins++}},[f,r]),Y(c?[c.skillsDir,c.commandsDir]:[],u),Y(c?[c.claudeJson]:[],f),Y(c?[c.pluginsManifest]:[],r),s}const Q=6e4,ee=60*Q,de=24*ee;function Qe(e,s=Date.now()){if(e===null)return"created on first save";if(e==="present"||!Number.isFinite(e))return null;const n=Math.max(0,s-e);return n<Q?"just now":n<ee?`${Math.floor(n/Q)}m ago`:n<de?`${Math.floor(n/ee)}h ${Math.floor(n%ee/Q)}m ago`:`${Math.floor(n/de)}d ago`}async function et(e){try{if(e.kind==="dir")return await window.api.config.exists(e.path)?"present":null;const s=await window.api.config.readText(e.path,{maxBytes:1});return s.exists?Number.isFinite(s.mtimeMs)?s.mtimeMs:void 0:s.error?void 0:null}catch{return}}function tt(e,s){const n=Object.keys(e);return n.length!==Object.keys(s).length?!1:n.every(l=>Object.prototype.hasOwnProperty.call(s,l)&&Object.is(e[l],s[l]))}function nt(e){const s=JSON.stringify(e.map(c=>[c.path,c.kind])),[n,l]=a.useState({}),o=a.useRef(0);return a.useEffect(()=>{const c=JSON.parse(s).map(([r,i])=>({path:r,kind:i})),u=()=>{const r=++o.current;Promise.all(c.map(et)).then(i=>{if(r!==o.current)return;const g={};c.forEach((p,j)=>{const m=i[j];m!==void 0&&(g[p.path]=m)}),l(p=>tt(p,g)?p:g)})};u();const f=window.api.config.onChanged(r=>{c.some(i=>r.path===i.path||i.kind==="dir"&&xe(r.path,i.path))&&u()});return()=>{o.current++,f()}},[s]),n}const st=a.lazy(()=>De(()=>import("./SkillReferenceGraph-D80RA7kR.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(e=>({default:e.SkillReferenceGraph})));function lt({pluginName:e,skills:s,onBack:n,initialSelectedId:l}){var g;const[o,c]=a.useState(l??((g=s[0])==null?void 0:g.id)??null),u=o?s.find(p=>p.id===o)??null:null,f=a.useMemo(()=>Ne(s),[s]),[r,i]=a.useState("list");return t.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[t.jsxs("div",{className:"shrink-0 h-11 flex items-baseline gap-3.5 px-3 border-b border-line bg-bg",children:[t.jsxs("button",{type:"button",onClick:n,className:"font-mono text-accent hover:underline shrink-0 text-xs",children:["← ",e]}),t.jsx("span",{className:"font-serif text-[22px] text-fg shrink-0 truncate max-w-[16rem]",children:(u==null?void 0:u.name)??(u==null?void 0:u.id)??"skill"}),t.jsx("span",{className:"flex-1"}),t.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:t.jsxs("div",{className:"flex rounded border border-line overflow-hidden",children:[t.jsx("button",{onClick:()=>i("list"),className:`px-2 py-0.5 text-xs ${r==="list"?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:"list"}),t.jsx("button",{onClick:()=>i("graph"),className:`px-2 py-0.5 text-xs ${r==="graph"?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:"graph"})]})})]}),t.jsxs("div",{className:"shrink-0 h-[26px] flex items-center gap-[18px] px-3 bg-bg-elev border-b border-line text-[9px] font-mono uppercase tracking-wide overflow-hidden",children:[u!=null&&u.description?t.jsx("span",{className:"text-fg-dim truncate normal-case",children:u.description}):null,t.jsxs("span",{className:"ml-auto text-fg-faint truncate normal-case",children:[s.length," ",s.length===1?"skill":"skills"," · ",f.length," ",f.length===1?"reference":"references"]})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:s.length===0?t.jsx(S,{title:"no skills in this plugin"}):r==="graph"?t.jsx(a.Suspense,{fallback:t.jsx("div",{className:"p-6 text-xs text-fg-faint",children:"Loading graph…"}),children:t.jsx(st,{skills:s,edges:f,selectedId:o,onSelect:c})}):t.jsx(_e,{sidebar:t.jsx("div",{className:"py-1",children:s.map(p=>t.jsxs("button",{onClick:()=>c(p.id),className:`w-full px-3 py-1 text-xs text-left ${o===p.id?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[t.jsx("div",{className:"truncate",children:p.name??p.id}),p.description?t.jsx("div",{className:"truncate text-fg-faint",children:p.description}):null]},p.id))}),detail:u?t.jsx("div",{className:"h-full min-h-0",children:t.jsx(we,{path:u.path,value:u.body,onChange:()=>{},readOnly:!0})}):t.jsx(S,{title:"select a skill"})})})]})}const me=e=>{var s,n;return{type:"plugin",name:e.name,repository:(s=e.manifest)==null?void 0:s.repository,homepage:(n=e.manifest)==null?void 0:n.homepage}},G=(e,s,n)=>e===1?s:n;function at(e,s){const n=Se(e),l=[];return n.skills>0&&l.push({kind:"skills",count:n.skills,label:G(n.skills,"skill","skills"),arrow:"›",title:"Show in the Skills tab",onClick:()=>s("skills")}),n.commands>0&&l.push({kind:"commands",count:n.commands,label:G(n.commands,"command","commands"),arrow:"›",title:"Show in the Skills tab",onClick:()=>s("skills")}),n.mcpServers>0&&l.push({kind:"mcp",count:n.mcpServers===1?null:n.mcpServers,label:G(n.mcpServers,"MCP server","MCP servers"),arrow:"›",title:"Show in the MCP Servers tab",onClick:()=>s("mcp")}),n.agents>0&&l.push({kind:"agents",count:n.agents,label:G(n.agents,"agent","agents"),arrow:"↗",title:"Open the Agents page",onClick:()=>ie.getState().openPanel("agent-library")}),n.hooks>0&&l.push({kind:"hooks",count:n.hooks,label:G(n.hooks,"hook","hooks"),arrow:"↗",title:"Open Settings ▸ Hooks",onClick:()=>ie.getState().openPanel("settings","hooks")}),l}const it=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)} scope`;function rt({row:e,home:s,busy:n,onToggle:l,onOpen:o,onUninstall:c,onJump:u}){var p,j;const f=e.enabled===!0,r=(p=e.manifest)==null?void 0:p.version,i=(j=e.manifest)==null?void 0:j.description,g=at(e,u);return t.jsxs("div",{"data-testid":"plugin-card",className:"grid grid-cols-[36px_minmax(0,1fr)_auto] gap-x-4 px-[18px] py-4 bg-bg-hi border border-line rounded-[10px]",children:[t.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-label":`${f?"Disable":"Enable"} ${e.name}`,"data-testid":"plugin-enabled-switch",disabled:!e.key||n,onClick:()=>l(e),className:`relative mt-px w-9 h-5 rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${f?"bg-accent":"bg-rule"}`,children:t.jsx("span",{"aria-hidden":"true",className:`absolute top-0.5 w-4 h-4 rounded-full bg-bg-hi shadow transition-[left] ${f?"left-[18px]":"left-0.5"}`})}),t.jsxs("div",{className:"min-w-0 flex flex-col gap-2",children:[t.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2.5 gap-y-1.5",children:[t.jsx("button",{type:"button","data-testid":"plugin-card-name",onClick:()=>o(e),title:`Open ${e.name}`,className:"text-left text-[15px] font-semibold text-fg hover:text-accent hover:underline",children:e.name}),r?t.jsxs("span",{className:"font-mono text-[11.5px] text-fg-faint",children:["v",r]}):null,t.jsx(pe,{interactive:!1,input:me(e)}),e.scope?t.jsx("span",{"data-testid":"plugin-scope",className:"text-xs text-fg-faint",children:it(e.scope)}):null]}),i?t.jsx("p",{"data-testid":"plugin-card-description",title:i,className:"text-[13px] text-fg-dim",children:i}):null,g.length>0||e.error?t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[g.map(m=>t.jsxs("button",{type:"button","data-testid":`plugin-chip-${m.kind}`,title:m.title,onClick:m.onClick,className:"inline-flex items-center gap-[5px] h-6 px-2.5 bg-bg border border-line rounded-full text-xs text-fg-dim hover:border-accent hover:text-fg",children:[m.count!==null?t.jsx("b",{className:"font-mono font-semibold text-fg",children:m.count}):null,m.count!==null?" ":null,m.label," ",t.jsx("span",{"aria-hidden":"true",className:"text-fg-faint/60",children:m.arrow})]},m.kind)),e.error?t.jsx("span",{title:e.error,className:"inline-flex items-center h-6 px-2.5 border border-delta-bad/30 rounded-full text-xs text-delta-bad",children:"inspection failed"}):null]}):null,t.jsx("span",{"data-testid":"plugin-card-path",title:e.path,className:"font-mono text-[11px] text-fg-faint/80 whitespace-nowrap overflow-hidden text-ellipsis",children:ue(e.path,s)})]}),t.jsx(ot,{row:e,busy:n,onUninstall:c})]})}function ot({row:e,busy:s,onUninstall:n}){const[l,o]=a.useState(!1),[c,u]=a.useState(!1),f=a.useRef(null),r=a.useId(),i=a.useCallback(()=>{o(!1),u(!1)},[]);a.useEffect(()=>{if(!l)return;const y=P=>{var E;(E=f.current)!=null&&E.contains(P.target)||i()},k=P=>{P.key==="Escape"&&i()};return window.addEventListener("mousedown",y),window.addEventListener("keydown",k),()=>{window.removeEventListener("mousedown",y),window.removeEventListener("keydown",k)}},[l,i]);const g=()=>{i(),ge(e.path)},p=async()=>{i(),await be(e.path)||te.error(`Could not copy ${e.path} to the clipboard`)},j=()=>{i(),n(e)},m="px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev";return t.jsxs("div",{ref:f,className:"relative self-start",children:[t.jsx("button",{type:"button","data-testid":"plugin-menu","aria-label":`Actions for ${e.name}`,"aria-haspopup":"menu","aria-expanded":l,"aria-controls":l?r:void 0,onClick:()=>l?i():o(!0),className:"w-[30px] h-7 inline-flex items-center justify-center bg-bg border border-line rounded-md text-fg-dim hover:border-rule",children:t.jsxs("svg",{"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:[t.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),t.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),t.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}),l&&t.jsx("div",{id:r,role:"menu","aria-label":`Actions for ${e.name}`,className:`absolute ${he.dialog} right-0 top-[34px] w-[210px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[12.5px] text-fg`,children:c?t.jsxs("div",{className:"flex flex-col gap-2 px-2.5 py-[7px]",children:[t.jsxs("span",{className:"font-medium",children:["Uninstall ",e.name,"?"]}),t.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[t.jsx("button",{type:"button",role:"menuitem","data-testid":"plugin-uninstall",disabled:s,onClick:j,className:"h-6 px-2.5 rounded-[5px] bg-delta-bad text-bg-hi font-medium hover:bg-delta-bad/90 disabled:opacity-40",children:"Confirm"}),t.jsx("button",{type:"button",role:"menuitem",onClick:()=>u(!1),className:"h-6 px-2.5 rounded-[5px] border border-line text-fg-dim hover:bg-bg-elev",children:"Cancel"})]})]}):t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",role:"menuitem",onClick:g,className:m,children:"Reveal in File Explorer"}),t.jsx("button",{type:"button",role:"menuitem",onClick:()=>void p(),className:m,children:"Copy path"}),t.jsx("div",{role:"separator",className:"h-px mx-1.5 my-1 bg-line"}),t.jsxs("button",{type:"button",role:"menuitem",disabled:!e.marketplace||s,title:e.marketplace?void 0:"No marketplace is recorded for this install",onClick:()=>u(!0),className:`${m} font-medium text-delta-bad hover:bg-delta-bad/10 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent`,children:["Uninstall ",e.name]})]})})]})}const ct="Plugin contents also appear, read-only, in Skills and MCP Servers — tagged with the plugin that added them.",dt=e=>ie.getState().openPanel("extensions",e);function ut(e,s){var n,l;return[e.name,(n=e.manifest)==null?void 0:n.name,(l=e.manifest)==null?void 0:l.description].some(o=>typeof o=="string"&&o.toLowerCase().includes(s))}function pt({onAdd:e,onJump:s}){const n=re(),[l,o]=a.useState([]),[c,u]=a.useState(!0),[f,r]=a.useState(null),[i,g]=a.useState(null),[p,j]=a.useState(""),[m,y]=a.useState(null),[k,P]=a.useState(new Set),E=ke(d=>d.show),[U,D]=a.useState(null);a.useEffect(()=>{var x,C;let d=!1;return(C=(x=window.api.app).seedStatus)==null||C.call(x).then(b=>{d||y(b)}).catch(()=>{}),()=>{d=!0}},[]);const B=a.useRef(0),M=a.useRef(!1),A=a.useCallback(async()=>{var N,q;const d=++B.current;if(!n)return;M.current||u(!0);const x=`${n}/.claude/plugins/installed_plugins.json`;let C=[],b=null;try{const v=await window.api.config.readJson(x);if(v.exists&&v.parseError)b=`could not parse installed_plugins.json${v.error?`: ${v.error}`:""}`;else if(v.exists&&v.data&&typeof v.data=="object"){const J=v.data,K=[];for(const[$,w]of Object.entries(J.plugins??{})){if(!Array.isArray(w))continue;const[L,T]=$.split("@");for(const h of w)h!=null&&h.installPath&&K.push({name:L,marketplace:T,entry:h})}let z=new Map;try{const $=await((q=(N=window.api.plugins)==null?void 0:N.list)==null?void 0:q.call(N))??[];z=new Map($.map(w=>[w.key,w.enabled]))}catch{}C=await jt(K,kt,async({name:$,marketplace:w,entry:L})=>{var oe;const T={name:$,path:L.installPath,isDirectory:!0,isFile:!1,mtimeMs:0,size:0};let h;try{h=await Ce(T)}catch(le){h=$e(T,le instanceof Error?le.message:String(le))}return(oe=h.manifest)!=null&&oe.version||(h.manifest={...h.manifest??{},version:L.version}),h.marketplace=w,h.scope=L.scope,h.key=w?`${$}@${w}`:$,h.enabled=z.get(h.key)===!0,h})}}catch(v){b=`could not read installed_plugins.json: ${v instanceof Error?v.message:String(v)}`}B.current===d&&(r(b),b?te.error(`Plugins: ${b}`):(C.sort((v,J)=>v.name.localeCompare(J.name)),M.current=C.length>0,o(C)),u(!1))},[n]);a.useEffect(()=>{A()},[A]),a.useEffect(()=>()=>{B.current+=1},[]),Y(n?[`${n}/.claude/plugins/installed_plugins.json`]:[],A);const _=async d=>{if(d.key){D(d.key);try{const x=await window.api.plugins.setEnabled({key:d.key,enabled:!d.enabled});x.ok||E("error",`Could not ${d.enabled?"disable":"enable"} ${d.name}: ${x.error??"unknown error"}`)}catch(x){E("error",`Could not update ${d.name}: ${x instanceof Error?x.message:String(x)}`)}finally{D(null),await A()}}},O=async d=>{if(d.marketplace){D(d.key??d.name);try{const x=await window.api.plugins.uninstall({slug:d.name,marketplaceName:d.marketplace});x.ok||E("error",`Uninstall ${d.name} failed: ${x.error??`exit ${x.exitCode}`}`)}catch(x){E("error",`Uninstall ${d.name} failed: ${x instanceof Error?x.message:String(x)}`)}finally{D(null),await A()}}},I=a.useMemo(()=>m?Object.keys(m).filter(d=>(m[d].status==="exhausted"||m[d].status==="failed")&&!k.has(d)):[],[m,k]),H=I.length>0?t.jsx(ft,{seeders:I,seedStatus:m,onDismiss:d=>P(x=>new Set(x).add(d)),onOpenLibrary:()=>e==null?void 0:e()}):null,F=i?l.find(d=>d.path===i)??null:null,ne=a.useMemo(()=>l.filter(d=>d.enabled===!0).length,[l]),V=p.trim().toLowerCase(),W=a.useMemo(()=>V?l.filter(d=>ut(d,V)):l,[l,V]),se=a.useMemo(()=>({label:"+ Add plugin",testId:"plugins-add",items:[{label:"Browse catalog…",testId:"plugins-add-catalog",onSelect:()=>e==null?void 0:e()}]}),[e]),X=a.useCallback(d=>g(d.path),[]),Z=s??dt;return F?t.jsx(gt,{row:F,home:n,onBack:()=>g(null)},F.path):t.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[t.jsx(Ee,{filter:p,onFilterChange:j,placeholder:"Filter plugins",summary:`${l.length} installed · ${ne} enabled`,primary:se}),H,f?t.jsxs("div",{role:"alert",className:"shrink-0 px-3 py-2 border-b border-line bg-red-950/20 text-xs text-red-300",children:[f,l.length>0?" — showing the last known list":null]}):null,t.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:c&&l.length===0?t.jsx(S,{title:"scanning plugins…"}):f&&l.length===0?null:t.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[l.length===0?t.jsxs("div",{"data-testid":"plugins-empty",className:"flex flex-col gap-1 px-[18px] py-4 border border-dashed border-rule rounded-[10px] text-[13px] text-fg-dim",children:[t.jsx("span",{className:"font-semibold text-fg",children:"No plugins installed"}),t.jsxs("span",{children:["Use + Add plugin, or run ",t.jsx("code",{className:"font-mono text-xs",children:"claude plugin install"}),"."]})]}):W.length===0?t.jsxs("p",{className:"px-1 text-[13px] text-fg-dim",children:["No plugins match “",p.trim(),"”."]}):W.map(d=>t.jsx(rt,{row:d,home:n,busy:U!==null&&U===(d.key??d.name),onToggle:x=>void _(x),onOpen:X,onUninstall:x=>void O(x),onJump:Z},d.path)),t.jsx("p",{className:"px-1 text-xs text-fg-faint",children:ct})]})})]})}const mt=a.memo(pt),ae={"dev-plugin":"session-manager-dev plugin","scheduler-mcp":"Scheduler MCP server","agent-personas":"Agent personas (Architect, Dev Lead)"};function ft({seeders:e,seedStatus:s,onDismiss:n,onOpenLibrary:l}){return t.jsx("div",{className:"shrink-0 flex flex-col gap-1.5 px-3 py-2 border-b border-line bg-yellow-950/20",children:e.map(o=>t.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-300",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium",children:s[o].status==="failed"?`${ae[o]} setup failed — it will retry on next launch. To fix it now:`:`${ae[o]} setup failed after retrying — manual fix needed`}),o==="dev-plugin"?t.jsxs("div",{className:"text-yellow-400/80 mt-0.5",children:["Click ",t.jsx("button",{onClick:l,className:"underline hover:no-underline",children:"here"}),' to open the Library tab, then click Install next to "session-manager-dev".']}):t.jsx("div",{className:"text-yellow-400/80 mt-0.5 font-mono",children:s[o].fix})]}),t.jsx("button",{onClick:()=>n(o),className:"shrink-0 text-yellow-400/70 hover:text-yellow-300","aria-label":`Dismiss ${ae[o]} warning`,children:"✕"})]},o))})}const xt=250,ht=["hooks/hooks.json",".mcp.json",".lsp.json","agents","skills","commands",".claude-plugin/plugin.json"];function gt({row:e,home:s,onBack:n}){var X,Z,d,x,C;const[l,o]=a.useState([]),[c,u]=a.useState([]),[f,r]=a.useState([]),[i,g]=a.useState([]),[p,j]=a.useState([]),[m,y]=a.useState("skills"),[k,P]=a.useState(null),[E,U]=a.useState(!0),[D,B]=a.useState([]),M=a.useRef(0),A=a.useRef(!1),_=a.useCallback(async()=>{if(!s)return;const b=++M.current;try{const{manifest:N}=await Pe(e.path),[q,v,J]=await Promise.all([Me(e.path),Ae(e.path,N),Oe(`${e.path}/bin`,{filesOnly:!0})]),K=q?await Re(q):[],[z,$]=await Promise.all([ce(v.agentFiles),ce(v.commandFiles)]),w=v.mcpServers,L=await Promise.all([...new Set([...ht.map(h=>`${e.path}/${h}`),...v.sourcePaths])].map(async h=>await window.api.config.exists(h)?h:null));if(b!==M.current)return;o(K),u(z),r($),g(w),j(J);const T=L.filter(h=>h!==null);B(h=>h.join("\0")===T.join("\0")?h:T),A.current||(A.current=!0,y(K.length>0?"skills":z.length>0?"agents":$.length>0?"commands":w.length>0?"mcp":e.hooks>0?"hooks":e.monitors>0?"monitors":e.hasLsp?"lsp":"files"))}catch(N){if(b!==M.current)return;te.error(`Failed to load plugin contents: ${N instanceof Error?N.message:String(N)}`)}finally{b===M.current&&U(!1)}},[e.path,e.name,e.hooks,e.monitors,e.hasLsp,s]);a.useEffect(()=>(U(!0),_(),()=>{M.current+=1}),[_]);const O=a.useRef(null),I=a.useRef(!1),H=a.useRef(!1),F=a.useCallback(async()=>{if(I.current){H.current=!0;return}I.current=!0;try{do H.current=!1,await _();while(H.current)}finally{I.current=!1}},[_]),ne=a.useCallback(()=>{O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{O.current=null,F()},xt)},[F]);a.useEffect(()=>()=>{O.current&&clearTimeout(O.current)},[]),Y(D,ne,{depth:0});const V=[{key:"skills",label:"Skills",count:l.length},{key:"agents",label:"Agents",count:c.length},{key:"commands",label:"Commands",count:f.length},{key:"mcp",label:"MCP server",count:i.length},{key:"hooks",label:"Hooks",count:e.hooks},{key:"monitors",label:"Monitors",count:e.monitors},{key:"lsp",label:"LSP",count:e.hasLsp?1:0},{key:"files",label:"Bin",count:p.length}],W=(X=e.manifest)!=null&&X.author?typeof e.manifest.author=="string"?e.manifest.author:e.manifest.author.name??null:null,se=async b=>{const N=await window.api.shell.open({as:"external",url:b});N.ok||te.error(N.error??`Failed to open ${b}`)};return k?t.jsx(lt,{pluginName:((Z=e.manifest)==null?void 0:Z.name)??e.name,skills:l,initialSelectedId:k.id,onBack:()=>P(null)},k.id):t.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[t.jsxs("div",{className:"shrink-0 h-11 flex items-baseline gap-3.5 px-3 border-b border-line bg-bg",children:[t.jsx("button",{type:"button",onClick:n,className:"font-mono text-accent hover:underline shrink-0 text-xs",children:"← Plugins"}),t.jsx("span",{className:"font-serif text-[22px] text-fg shrink-0 truncate max-w-[16rem]",children:((d=e.manifest)==null?void 0:d.name)??e.name}),(x=e.manifest)!=null&&x.version?t.jsxs("span",{className:"font-mono text-fg-faint text-xs shrink-0",children:["v",e.manifest.version]}):null,(C=e.manifest)!=null&&C.description?t.jsx("span",{className:"text-fg-dim text-xs min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:e.manifest.description}):t.jsx("span",{className:"flex-1"}),t.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[t.jsx(pe,{input:me(e)}),e.hasMcp?t.jsx(je,{tone:"accent",children:"MCP"}):null]})]}),e.manifest?t.jsxs("div",{className:"shrink-0 h-[26px] flex items-center gap-[18px] px-3 bg-bg-elev border-b border-line text-[9px] font-mono uppercase tracking-wide overflow-hidden",children:[W?t.jsxs("span",{className:"text-fg-dim truncate",children:[t.jsx("span",{className:"text-fg-faint",children:"Author "}),W]}):null,e.manifest.license?t.jsxs("span",{className:"text-fg-dim truncate",children:[t.jsx("span",{className:"text-fg-faint",children:"License "}),e.manifest.license]}):null,e.manifest.homepage?t.jsxs("button",{onClick:()=>se(e.manifest.homepage),className:"text-accent hover:underline truncate normal-case",title:e.manifest.homepage,children:[t.jsx("span",{className:"text-fg-faint uppercase",children:"Homepage "}),e.manifest.homepage]}):null,t.jsx("span",{className:"ml-auto text-fg-faint truncate normal-case",children:e.path})]}):t.jsx("div",{className:"shrink-0 h-[26px] flex items-center px-3 bg-bg-elev border-b border-line text-[9px] font-mono uppercase tracking-wide overflow-hidden",children:t.jsx("span",{className:"ml-auto text-fg-faint truncate normal-case",children:e.path})}),t.jsxs("div",{className:"flex-1 min-h-0 grid overflow-hidden",style:{gridTemplateColumns:"170px 1fr"},children:[t.jsx("div",{className:"min-h-0 overflow-auto bg-bg-elev border-r border-line py-1",children:V.map(b=>t.jsxs("button",{type:"button",disabled:b.count===0,onClick:()=>y(b.key),className:`w-full text-left px-3 py-1.5 text-xs flex items-center justify-between ${b.count===0?"text-fg-faint opacity-50 cursor-default":m===b.key?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[t.jsx("span",{children:b.label}),b.count>0?t.jsx("span",{className:"font-mono text-fg-faint",children:b.count}):null]},b.key))}),t.jsx("div",{className:"min-h-0 overflow-auto",children:E?t.jsx(S,{title:"scanning…"}):t.jsx(bt,{active:m,row:e,skills:l,agents:c,commands:f,mcpServers:i,files:p,onOpenSkill:P})})]})]})}function bt({active:e,row:s,skills:n,agents:l,commands:o,mcpServers:c,files:u,onOpenSkill:f}){return e==="skills"?n.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:n.map((r,i)=>t.jsx(R,{n:i+1,name:r.name??r.id,description:r.description,onClick:()=>f(r)},r.id))}):e==="agents"?l.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:l.map((r,i)=>t.jsx(R,{n:i+1,name:r.name??r.id,description:r.description},r.id))}):e==="commands"?o.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:o.map((r,i)=>t.jsx(R,{n:i+1,name:r.name??r.id,description:r.description},r.id))}):e==="mcp"?c.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:c.map((r,i)=>t.jsx(R,{n:i+1,name:r.name,description:r.description},r.id))}):e==="hooks"?s.hooks===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:t.jsx(R,{n:1,name:`${s.hooks} ${s.hooks===1?"hook":"hooks"} configured`,description:`${s.path}/hooks/hooks.json`})}):e==="monitors"?s.monitors===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:t.jsx(R,{n:1,name:`${s.monitors} ${s.monitors===1?"monitor":"monitors"} configured`,description:`${s.path}/monitors/monitors.json`})}):e==="lsp"?s.hasLsp?t.jsx("div",{children:t.jsx(R,{n:1,name:"LSP server enabled",description:`${s.path}/.lsp.json`})}):t.jsx(S,{title:"no components"}):u.length===0?t.jsx(S,{title:"no components"}):t.jsx("div",{children:u.map((r,i)=>t.jsx(R,{n:i+1,name:r,description:null},r))})}function R({n:e,name:s,description:n,onClick:l}){const o=l?"button":"div";return t.jsxs(o,{onClick:l,className:`w-full flex items-baseline gap-2.5 py-[9px] px-3 border-b border-line text-left min-w-0 ${l?"hover:bg-bg-hi cursor-pointer":""}`,children:[t.jsx("span",{className:"font-serif text-fg-faint text-xs shrink-0 w-6 text-right",children:String(e).padStart(2,"0")}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"font-mono font-semibold text-accent truncate",children:s}),n?t.jsx("div",{className:"text-fg-dim text-xs truncate",children:n}):null]})]})}const kt=4;async function jt(e,s,n){const l=new Array(e.length);let o=0;const c=Array.from({length:Math.min(s,e.length)},async()=>{for(;o<e.length;){const u=o++;l[u]=await n(e[u])}});return await Promise.all(c),l}const vt={skills:"Add skill",mcp:"Add MCP server",plugins:"Add plugin"};function yt(e){return{skills:[{path:`${e}/.claude/skills`,kind:"dir"}],mcp:[{path:`${e}/.claude.json`,kind:"file",keyPath:"mcpServers"}],plugins:[{path:`${e}/.claude/plugins/installed_plugins.json`,kind:"file"},{path:`${e}/.claude/settings.json`,kind:"file",keyPath:"enabledPlugins"}]}}const Nt=[];function wt({sources:e,ages:s,home:n}){return t.jsx("div",{className:"flex flex-wrap justify-end gap-x-[18px] gap-y-1 text-[11.5px] text-fg-faint",children:e.map(l=>{const o=s[l.path],c=o===void 0?null:Qe(o);return t.jsxs("span",{"data-testid":"extensions-source",title:l.path,className:"whitespace-nowrap",children:[t.jsxs("span",{className:"font-mono text-fg-dim",children:[ue(l.path,n),l.keyPath?` › ${l.keyPath}`:""]}),c&&` · ${c}`]},l.path)})})}function St(){const e=re(),s=Ze(),[n,l]=a.useState("skills"),[o,c]=a.useState(!1),[u,f]=a.useState({scope:"user",cwd:null});ve("extensions",k=>{(k==="skills"||k==="mcp"||k==="plugins")&&(l(k),c(!1))});const r=a.useMemo(()=>e?yt(e):null,[e]),i=a.useMemo(()=>r?[...r.skills,...r.mcp,...r.plugins]:Nt,[r]),g=nt(i),p=a.useCallback(k=>{l(k),c(!1)},[]),j=a.useCallback(()=>c(!1),[]),m=a.useCallback(k=>{f(k),c(!0)},[]),y=a.useCallback(()=>c(!0),[]);return t.jsxs("div",{className:"flex flex-col h-full min-h-0","data-testid":"extensions",children:[t.jsx("div",{className:"shrink-0 mt-6 -mb-px relative z-[1]","data-testid":"extensions-tabs",children:t.jsx(qe,{ariaLabel:"Extensions",options:[{key:"skills",label:"Skills",count:s.skills},{key:"mcp",label:"MCP Servers",count:s.mcp},{key:"plugins",label:"Plugins",count:s.plugins}],active:n,onChange:p,trailing:e&&r?t.jsx(wt,{sources:r[n],ages:g,home:e}):null})}),t.jsxs("div",{className:"flex-1 min-h-0 border border-line bg-bg","data-testid":"extensions-panel",children:[n==="skills"&&t.jsx(Le,{onAdd:y,scope:"user"}),n==="mcp"&&t.jsx(Te,{onAdd:m,scope:"user"}),n==="plugins"&&t.jsx(mt,{onAdd:y,onJump:p})]}),t.jsxs(ye,{open:o,onClose:j,title:vt[n],keyVals:[],children:[n==="skills"&&t.jsx(Ie,{}),n==="mcp"&&t.jsx(Fe,{scope:u.scope,cwd:u.cwd}),n==="plugins"&&t.jsx(Ue,{})]})]})}const Dt=a.memo(St);export{Dt as Extensions};
@@ -1,2 +1,2 @@
1
- import{aJ as xe,aR as Ge,bB as ze,ay as e,aO as x,b7 as q,aK as A,aL as L,bu as Ve,bj as Ye,bs as ye,aE as Xe,bi as qe,m as Je}from"./index-Cznhnxhq.js";import{P as Qe}from"./Panel-DP8eSKSs.js";import{p as Ee,i as O,m as De,t as I,u as E,f as Ze}from"./historyTotals-itA00dXm.js";import"./monaco-editor-BsIlgG7c.js";function ce(){return{promptCount:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,toolCallCount:0,sessionCount:0,errorCount:0,activeMinutes:0,estimatedCostUsd:0}}function Ce(t,s){t.promptCount+=s.promptCount,t.inputTokens+=s.inputTokens,t.outputTokens+=s.outputTokens,t.cacheReadTokens+=s.cacheReadTokens,t.cacheCreationTokens+=s.cacheCreationTokens,t.toolCallCount+=s.toolCallCount,t.sessionCount+=s.sessionCount,t.errorCount+=s.errorCount,t.activeMinutes+=s.activeMinutes,t.estimatedCostUsd+=s.estimatedCostUsd}function et(t){return t.promptCount>0||t.sessionCount>0||t.toolCallCount>0||t.inputTokens>0||t.outputTokens>0}function tt(t,s){const n=s===null,r=[],o=ce(),i={};let a=0;for(const c of t.days){const u=ce();let d=!1;for(const[l,p]of Object.entries(c.byProject))if(!(!n&&!s.has(l))){Ce(u,p),Ce(o,p),et(p)&&(d=!0);for(const[m,v]of Object.entries(p.byModel)){const k=i[m]??(i[m]={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,costUsd:0});k.inputTokens+=v.inputTokens,k.outputTokens+=v.outputTokens,k.cacheReadTokens+=v.cacheReadTokens,k.cacheCreationTokens+=v.cacheCreationTokens,k.costUsd+=v.costUsd,v.estimated&&(k.estimated=!0)}}d&&(a+=1),r.push({date:c.date,totals:u})}return{days:r,totals:o,prevTotals:n?t.prevTotals:ce(),prevAvailable:n,byModelTotals:i,activeDays:a}}function Ue(t,s){if(!s)return{pct:null,direction:"flat"};const n=(t-s)/s*100,r=n>0?"up":n<0?"down":"flat";return{pct:n,direction:r}}function st(t,s,n){return s<=0?0:t/s*n}const nt=["promptCount","inputTokens","outputTokens","cacheReadTokens","cacheCreationTokens","toolCallCount","sessionCount","errorCount","activeMinutes","estimatedCostUsd"],ot=["inputTokens","outputTokens","cacheReadTokens","cacheCreationTokens","costUsd"];function Ne(t){const s={promptCount:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,toolCallCount:0,sessionCount:0,errorCount:0,activeMinutes:0,estimatedCostUsd:0,byModel:{}},n=r=>typeof r=="number"&&Number.isFinite(r)?r:0;for(const r of t){for(const o of nt)s[o]+=n(r[o]);for(const[o,i]of Object.entries(r.byModel??{})){const a=s.byModel[o]??(s.byModel[o]={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,costUsd:0});for(const c of ot)a[c]+=n(i==null?void 0:i[c])}}return s}const Pe={in:"In tokens",out:"Out tokens",total:"Total tokens",prompts:"Prompts",sessions:"Sessions",time:"Time",spend:"Spend"};function $(t,s){const n=t.inputTokens+t.cacheReadTokens+t.cacheCreationTokens;switch(s){case"in":return n;case"out":return t.outputTokens;case"total":return n+t.outputTokens;case"prompts":return t.promptCount;case"sessions":return t.sessionCount;case"time":return t.activeMinutes;case"spend":return t.estimatedCostUsd}}function at(t,s){const n=$(t.totals,s),r=t.prevAvailable?Ue(n,$(t.prevTotals,s)):null,o=t.days.map(i=>$(i.totals,s));return{value:n,delta:r,series:o}}function Te(t,s){const n=new Map,r=Math.ceil(t.length/2);t.forEach((a,c)=>{for(const[u,d]of Object.entries(a.byProject)){let l=n.get(u);l||(l={totals:{promptCount:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,toolCallCount:0,sessionCount:0,errorCount:0,activeMinutes:0,estimatedCostUsd:0},toolBreakdown:{},firstHalf:0,secondHalf:0},n.set(u,l)),l.totals.promptCount+=d.promptCount,l.totals.inputTokens+=d.inputTokens,l.totals.outputTokens+=d.outputTokens,l.totals.cacheReadTokens+=d.cacheReadTokens,l.totals.cacheCreationTokens+=d.cacheCreationTokens,l.totals.toolCallCount+=d.toolCallCount,l.totals.sessionCount+=d.sessionCount,l.totals.errorCount+=d.errorCount,l.totals.activeMinutes+=d.activeMinutes,l.totals.estimatedCostUsd+=d.estimatedCostUsd;for(const[m,v]of Object.entries(d.toolBreakdown))l.toolBreakdown[m]=(l.toolBreakdown[m]??0)+v;const p=$(d,s);c<r?l.firstHalf+=p:l.secondHalf+=p}});const o=Array.from(n.entries()).map(([a,c])=>{let u="",d=-1;for(const[l,p]of Object.entries(c.toolBreakdown))p>d&&(d=p,u=l);return{projectDir:a,value:$(c.totals,s),sharePct:0,trend:Ue(c.secondHalf,c.firstHalf),sessions:c.totals.sessionCount,topTool:u}}),i=o.reduce((a,c)=>a+c.value,0);for(const a of o)a.sharePct=i>0?a.value/i*100:0;return o.sort((a,c)=>c.value-a.value)}const rt=["date","cost_usd","input_tokens","output_tokens","cache_write_tokens","cache_read_tokens","total_tokens","cache_hit_pct","num_models","top_model"];function ct(t){return/[",\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function we(t){return t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreationTokens}function it(t){const s=t.map(n=>{const r=n.inputTokens+n.outputTokens+n.cacheCreationTokens+n.cacheReadTokens,o=n.inputTokens+n.cacheReadTokens+n.cacheCreationTokens,i=o>0?n.cacheReadTokens/o*100:0,a=Object.entries(n.byModel).filter(([,l])=>we(l)>0);let c="",u=-1;for(const[l,p]of a){const m=we(p);m>u&&(u=m,c=l)}return[n.date,n.costUsd.toFixed(4),String(n.inputTokens),String(n.outputTokens),String(n.cacheCreationTokens),String(n.cacheReadTokens),String(r),i.toFixed(1),String(a.length),c?xe(c):""].map(ct).join(",")});return[rt.join(","),...s].join(`
1
+ import{aJ as xe,aR as Ge,bB as ze,ay as e,aO as x,b7 as q,aK as A,aL as L,bu as Ve,bj as Ye,bs as ye,aE as Xe,bi as qe,m as Je}from"./index-rt7pTODX.js";import{P as Qe}from"./Panel-O8XPrpJu.js";import{p as Ee,i as O,m as De,t as I,u as E,f as Ze}from"./historyTotals-B01WPBwh.js";import"./monaco-editor-BsIlgG7c.js";function ce(){return{promptCount:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,toolCallCount:0,sessionCount:0,errorCount:0,activeMinutes:0,estimatedCostUsd:0}}function Ce(t,s){t.promptCount+=s.promptCount,t.inputTokens+=s.inputTokens,t.outputTokens+=s.outputTokens,t.cacheReadTokens+=s.cacheReadTokens,t.cacheCreationTokens+=s.cacheCreationTokens,t.toolCallCount+=s.toolCallCount,t.sessionCount+=s.sessionCount,t.errorCount+=s.errorCount,t.activeMinutes+=s.activeMinutes,t.estimatedCostUsd+=s.estimatedCostUsd}function et(t){return t.promptCount>0||t.sessionCount>0||t.toolCallCount>0||t.inputTokens>0||t.outputTokens>0}function tt(t,s){const n=s===null,r=[],o=ce(),i={};let a=0;for(const c of t.days){const u=ce();let d=!1;for(const[l,p]of Object.entries(c.byProject))if(!(!n&&!s.has(l))){Ce(u,p),Ce(o,p),et(p)&&(d=!0);for(const[m,v]of Object.entries(p.byModel)){const k=i[m]??(i[m]={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,costUsd:0});k.inputTokens+=v.inputTokens,k.outputTokens+=v.outputTokens,k.cacheReadTokens+=v.cacheReadTokens,k.cacheCreationTokens+=v.cacheCreationTokens,k.costUsd+=v.costUsd,v.estimated&&(k.estimated=!0)}}d&&(a+=1),r.push({date:c.date,totals:u})}return{days:r,totals:o,prevTotals:n?t.prevTotals:ce(),prevAvailable:n,byModelTotals:i,activeDays:a}}function Ue(t,s){if(!s)return{pct:null,direction:"flat"};const n=(t-s)/s*100,r=n>0?"up":n<0?"down":"flat";return{pct:n,direction:r}}function st(t,s,n){return s<=0?0:t/s*n}const nt=["promptCount","inputTokens","outputTokens","cacheReadTokens","cacheCreationTokens","toolCallCount","sessionCount","errorCount","activeMinutes","estimatedCostUsd"],ot=["inputTokens","outputTokens","cacheReadTokens","cacheCreationTokens","costUsd"];function Ne(t){const s={promptCount:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,toolCallCount:0,sessionCount:0,errorCount:0,activeMinutes:0,estimatedCostUsd:0,byModel:{}},n=r=>typeof r=="number"&&Number.isFinite(r)?r:0;for(const r of t){for(const o of nt)s[o]+=n(r[o]);for(const[o,i]of Object.entries(r.byModel??{})){const a=s.byModel[o]??(s.byModel[o]={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,costUsd:0});for(const c of ot)a[c]+=n(i==null?void 0:i[c])}}return s}const Pe={in:"In tokens",out:"Out tokens",total:"Total tokens",prompts:"Prompts",sessions:"Sessions",time:"Time",spend:"Spend"};function $(t,s){const n=t.inputTokens+t.cacheReadTokens+t.cacheCreationTokens;switch(s){case"in":return n;case"out":return t.outputTokens;case"total":return n+t.outputTokens;case"prompts":return t.promptCount;case"sessions":return t.sessionCount;case"time":return t.activeMinutes;case"spend":return t.estimatedCostUsd}}function at(t,s){const n=$(t.totals,s),r=t.prevAvailable?Ue(n,$(t.prevTotals,s)):null,o=t.days.map(i=>$(i.totals,s));return{value:n,delta:r,series:o}}function Te(t,s){const n=new Map,r=Math.ceil(t.length/2);t.forEach((a,c)=>{for(const[u,d]of Object.entries(a.byProject)){let l=n.get(u);l||(l={totals:{promptCount:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,toolCallCount:0,sessionCount:0,errorCount:0,activeMinutes:0,estimatedCostUsd:0},toolBreakdown:{},firstHalf:0,secondHalf:0},n.set(u,l)),l.totals.promptCount+=d.promptCount,l.totals.inputTokens+=d.inputTokens,l.totals.outputTokens+=d.outputTokens,l.totals.cacheReadTokens+=d.cacheReadTokens,l.totals.cacheCreationTokens+=d.cacheCreationTokens,l.totals.toolCallCount+=d.toolCallCount,l.totals.sessionCount+=d.sessionCount,l.totals.errorCount+=d.errorCount,l.totals.activeMinutes+=d.activeMinutes,l.totals.estimatedCostUsd+=d.estimatedCostUsd;for(const[m,v]of Object.entries(d.toolBreakdown))l.toolBreakdown[m]=(l.toolBreakdown[m]??0)+v;const p=$(d,s);c<r?l.firstHalf+=p:l.secondHalf+=p}});const o=Array.from(n.entries()).map(([a,c])=>{let u="",d=-1;for(const[l,p]of Object.entries(c.toolBreakdown))p>d&&(d=p,u=l);return{projectDir:a,value:$(c.totals,s),sharePct:0,trend:Ue(c.secondHalf,c.firstHalf),sessions:c.totals.sessionCount,topTool:u}}),i=o.reduce((a,c)=>a+c.value,0);for(const a of o)a.sharePct=i>0?a.value/i*100:0;return o.sort((a,c)=>c.value-a.value)}const rt=["date","cost_usd","input_tokens","output_tokens","cache_write_tokens","cache_read_tokens","total_tokens","cache_hit_pct","num_models","top_model"];function ct(t){return/[",\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function we(t){return t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreationTokens}function it(t){const s=t.map(n=>{const r=n.inputTokens+n.outputTokens+n.cacheCreationTokens+n.cacheReadTokens,o=n.inputTokens+n.cacheReadTokens+n.cacheCreationTokens,i=o>0?n.cacheReadTokens/o*100:0,a=Object.entries(n.byModel).filter(([,l])=>we(l)>0);let c="",u=-1;for(const[l,p]of a){const m=we(p);m>u&&(u=m,c=l)}return[n.date,n.costUsd.toFixed(4),String(n.inputTokens),String(n.outputTokens),String(n.cacheCreationTokens),String(n.cacheReadTokens),String(r),i.toFixed(1),String(a.length),c?xe(c):""].map(ct).join(",")});return[rt.join(","),...s].join(`
2
2
  `)}const lt={folderCount:0,sessionCount:0,promptCount:0,estimatedCostUsd:0,totalTokens:0};function dt(t,s){t.promptCount+=s.promptCount,t.inputTokens+=s.inputTokens,t.outputTokens+=s.outputTokens,t.cacheReadTokens+=s.cacheReadTokens,t.cacheCreationTokens+=s.cacheCreationTokens,t.toolCallCount+=s.toolCallCount,t.sessionCount+=s.sessionCount,t.errorCount+=s.errorCount,t.activeMinutes+=s.activeMinutes,t.estimatedCostUsd+=s.estimatedCostUsd;for(const[n,r]of Object.entries(s.toolBreakdown??{}))t.toolBreakdown[n]=(t.toolBreakdown[n]??0)+r;for(const[n,r]of Object.entries(s.byModel??{})){const o=t.byModel[n]??(t.byModel[n]={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,costUsd:0});o.inputTokens+=r.inputTokens,o.outputTokens+=r.outputTokens,o.cacheReadTokens+=r.cacheReadTokens,o.cacheCreationTokens+=r.cacheCreationTokens,o.costUsd+=r.costUsd,r.estimated&&(o.estimated=!0)}}function ut(t,s){const n={};for(const[r,o]of Object.entries(t.byModel??{}))n[r]={...o};return{...t,projectDir:s,toolBreakdown:{...t.toolBreakdown??{}},byModel:n}}function ft(t,s){const n={...lt},r=new Set,o=t.map(i=>{const a={};for(const[c,u]of Object.entries(i.byProject)){const d=s[c];if(!d){r.add(c),n.sessionCount+=u.sessionCount,n.promptCount+=u.promptCount,n.estimatedCostUsd+=u.estimatedCostUsd,n.totalTokens+=u.inputTokens+u.outputTokens;continue}const l=a[d];l?dt(l,u):a[d]=ut(u,d)}return{...i,byProject:a}});return n.folderCount=r.size,{days:o,excluded:n}}function xt(t){return t.folderCount>0}function pt(t){const s=[`${t.folderCount} transcript folder${t.folderCount===1?"":"s"} with no resolvable working directory`];return t.sessionCount&&s.push(`${t.sessionCount.toLocaleString()} sessions`),t.promptCount&&s.push(`${t.promptCount.toLocaleString()} prompts`),t.estimatedCostUsd>=.005&&s.push(`$${t.estimatedCostUsd.toFixed(2)}`),`Excluded: ${s.join(" · ")}`}async function pe(){return(await Ge()).history??{}}let Re=Promise.resolve();function ue(t){const s=Re.then(async()=>{const n=await pe();await ze({history:{...n,...t}})});return Re=s.catch(()=>{}),s}const ht=["in","out","total","prompts","sessions","time","spend"],mt=[{value:30,label:"30d"},{value:60,label:"60d"},{value:90,label:"90d"},{value:0,label:"All time"}];function Me({value:t,options:s,onChange:n}){return e.jsx("div",{className:"flex gap-0.5 p-0.5 rounded bg-bg-elev shadow-[inset_0_0_0_1px_rgba(0,0,0,0.06)] text-[11px]",children:s.map(r=>e.jsx("button",{onClick:()=>n(r.value),className:`px-2 py-1 rounded whitespace-nowrap font-mono ${t===r.value?"bg-bg-hi text-fg shadow-sm":"text-fg-faint hover:text-fg"}`,children:r.label},String(r.value)))})}function jt({measure:t,onMeasure:s,range:n,onRange:r,projectsShown:o,projectsTotal:i,fromDate:a,toDate:c,onRefresh:u,onExport:d,exportDisabled:l}){return e.jsxs("div",{className:"sticky top-0 z-10 border-b border-line px-4 py-2.5 flex flex-wrap items-center gap-3 backdrop-blur-sm",style:{backgroundColor:"rgba(246,239,225,0.93)"},children:[e.jsx(Me,{value:t,options:ht.map(p=>({value:p,label:Pe[p]})),onChange:s}),e.jsx(Me,{value:n,options:mt,onChange:r}),e.jsxs("span",{className:"text-[11px] text-fg-faint font-mono",children:[o," / ",i," projects"]}),e.jsxs("span",{className:"text-[11px] text-fg-faint font-mono",children:[a," → ",c]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:u,className:"px-2 py-1 text-[11px] border border-line rounded hover:text-fg hover:bg-bg-hi text-fg-faint",title:"Re-fetch the rollup (no scan)",children:"↻ Refresh"}),e.jsx("button",{onClick:d,disabled:l,className:"px-2 py-1 text-[11px] border border-line rounded hover:text-fg hover:bg-bg-hi text-fg-faint disabled:opacity-40 disabled:pointer-events-none",children:"Export CSV"})]})}const T="rounded-card bg-bg-hi border border-line",gt="#ded2bd",bt="#6f7d52";function R({kicker:t,title:s,right:n}){return e.jsxs("div",{className:"flex items-baseline justify-between gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] uppercase tracking-wider text-accent font-mono",children:t}),e.jsx("h2",{className:"font-serif text-[25px] leading-tight tracking-tight text-fg",children:s})]}),n]})}function J(t,s){switch(t){case"spend":return E(s);case"in":case"out":case"total":return I(s);case"time":return De(s);default:return O(s)}}function vt({measure:t,headline:s,activeDays:n,projectsTouched:r,totalSessions:o}){const i=n>0?s.value/n:0,a=o>0?s.value/o:0,{delta:c}=s,u=c&&(t==="spend"?c.direction==="down":c.direction==="up"),d=c&&c.direction!=="flat"&&(t==="spend"?c.direction==="up":c.direction==="down"),l=u?"text-delta-good":d?"text-delta-bad":"text-fg-faint";return e.jsxs("div",{className:`${T} p-4`,children:[e.jsx(R,{kicker:"01 · overview",title:Pe[t]}),e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[52px] leading-none font-mono tracking-tight text-fg",children:J(t,s.value)}),c?e.jsxs("div",{className:`text-xs font-mono mt-2 ${l}`,children:[c.direction==="up"?"▲":c.direction==="down"?"▼":"·"," ",Ee(Math.abs(c.pct??0))," vs prior period"]}):e.jsx("div",{className:"text-xs text-fg-faint mt-2",children:"no prior window to compare"})]}),e.jsx("div",{className:"flex-1 min-w-0 self-stretch",children:e.jsx(kt,{series:s.series})})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-3 mt-4 pt-3 border-t border-line",children:[e.jsx(X,{label:"per active day",value:J(t,i)}),e.jsx(X,{label:"per session",value:J(t,a)}),e.jsx(X,{label:"active days",value:O(n)}),e.jsx(X,{label:"projects touched",value:O(r)})]})]})}function X({label:t,value:s}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-fg-faint uppercase tracking-wider",children:t}),e.jsx("div",{className:"text-[17px] font-mono tracking-tight text-fg-dim",children:s})]})}function kt({series:t}){if(t.length<2)return null;const r=Math.max(...t,0),o=Math.min(...t,0),i=r-o||1,a=160/(t.length-1),c=t.map((d,l)=>`${l*a},${48-(d-o)/i*48}`).join(" "),u=`0,48 ${c} 160,48`;return e.jsxs("svg",{viewBox:"0 0 160 48",preserveAspectRatio:"none",className:"w-full h-full min-h-[48px]",children:[e.jsx("polygon",{points:u,fill:"#b85c34",opacity:.15}),e.jsx("polyline",{points:c,fill:"none",stroke:"#b85c34",strokeWidth:1.5,vectorEffect:"non-scaling-stroke"})]})}const yt=50;function Ct({days:t}){const[s,n]=x.useState(yt),r=x.useRef(!1);x.useEffect(()=>{let d=!1;return pe().then(l=>{d||r.current||typeof l.budgetCapUsd=="number"&&Number.isFinite(l.budgetCapUsd)&&l.budgetCapUsd>0&&n(l.budgetCapUsd)}),()=>{d=!0}},[]);const o=d=>{r.current=!0;const l=s;n(d),ue({budgetCapUsd:d}).catch(()=>{n(l),q.error("Couldn't save the budget cap — reverted.")})},{mtdSpend:i,projectedSpend:a}=x.useMemo(()=>{const d=new Date,l=d.toLocaleDateString("en-CA").slice(0,7),p=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),m=d.getDate();let v=0;for(const k of t)if(k.date.startsWith(l))for(const M of Object.values(k.byProject))v+=M.estimatedCostUsd;return{mtdSpend:v,projectedSpend:st(v,m,p)}},[t]),c=a>s,u=s>0?Math.min(100,i/s*100):0;return e.jsxs("div",{className:`${T} p-3`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-[10.5px] uppercase tracking-wider text-fg-faint font-mono",children:"Monthly budget"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] text-fg-faint",children:["cap",e.jsx("span",{children:"$"}),e.jsx("input",{type:"number",min:1,step:1,value:s,onChange:d=>{const l=Number(d.target.value);Number.isFinite(l)&&l>0&&o(l)},className:"w-16 bg-bg border border-line rounded px-1.5 py-0.5 text-xs text-fg font-mono"})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs font-mono mb-1.5",children:[e.jsxs("span",{className:"text-fg",children:[E(i)," ",e.jsx("span",{className:"text-fg-faint",children:"month-to-date"})]}),e.jsxs("span",{className:c?"text-delta-bad":"text-fg-dim",children:[E(a)," ",e.jsx("span",{className:"text-fg-faint",children:"projected"})]})]}),e.jsx("div",{className:"h-1.5 rounded bg-bg-hi overflow-hidden",children:e.jsx("div",{className:`h-full ${c?"bg-delta-bad":"bg-sage"}`,style:{width:`${Math.max(u,u>0?2:0)}%`}})}),e.jsx("div",{className:`text-[10px] mt-1 font-mono ${c?"text-delta-bad":"text-fg-faint"}`,children:c?`projected to exceed $${s.toFixed(0)} cap`:`${u.toFixed(0)}% of $${s.toFixed(0)} cap`})]})}function Nt({chips:t,keep:s,onToggle:n,onIsolate:r,onShowAll:o}){const i=s===null;return e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("button",{onClick:o,className:`px-2 py-1 rounded text-[11px] font-mono border ${i?"bg-accent text-white border-accent":"border-line text-fg-faint hover:text-fg hover:bg-bg-hi"}`,children:["show all (",t.length,")"]}),t.map(a=>{const c=i||s.has(a.projectDir);return e.jsxs("button",{onClick:u=>u.shiftKey?r(a.projectDir):n(a.projectDir),title:a.projectDir,className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-[11px] font-mono border ${c?"border-line text-fg-dim bg-bg-hi":"border-line text-fg-faint opacity-40 hover:opacity-70"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:A(a.projectDir)}}),L(a.projectDir)]},a.projectDir)})]})}function Tt(t,s){const n=new Map;for(const o of t)for(const[i,a]of Object.entries(o.values))n.set(i,(n.get(i)??0)+a);const r=Array.from(n.entries()).sort((o,i)=>i[1]-o[1]).map(([o])=>o);return t.map(o=>{const i=r.reduce((u,d)=>u+(o.values[d]??0),0);let a=0;const c=r.map(u=>{const d=o.values[u]??0;if(i<=0)return{projectDir:u,value:d,y0:0,y1:0};const l=s==="share"?d/i:d,p=a,m=a+l;return a=m,{projectDir:u,value:d,y0:p,y1:m}});return{date:o.date,bands:c,total:i}})}const ie=720,le=220,de=44,wt=20;function Rt(t,s){return t==="spend"?E(s):I(s)}function Mt({days:t,measure:s,selected:n,onSelect:r}){const[o,i]=x.useState("absolute"),a=x.useMemo(()=>Tt(t,o),[t,o]),c=x.useMemo(()=>{if(o==="share")return 1;let h=0;for(const g of a)h=Math.max(h,g.total);return h||1},[a,o]),u=ie-de,d=le-wt,l=a.length>1?u/(a.length-1):u,p=h=>de+h*l,m=h=>d-h/c*d,v=Math.max(1,Math.ceil(a.length/8)),k=4,M=Array.from({length:k+1},(h,g)=>c/k*g);return e.jsxs("div",{className:`${T} p-4`,children:[e.jsx(R,{kicker:"02 · over time",title:"Trend by project",right:e.jsx("div",{className:"flex border border-line rounded overflow-hidden text-[10px] font-mono",children:["absolute","share"].map(h=>e.jsx("button",{onClick:()=>i(h),className:`px-2 py-0.5 ${o===h?"bg-accent text-white":"text-fg-faint hover:text-fg"}`,children:h},h))})}),e.jsxs("svg",{width:"100%",viewBox:`0 0 ${ie} ${le}`,className:"overflow-visible",children:[M.map((h,g)=>e.jsxs("g",{children:[e.jsx("line",{x1:de,x2:ie,y1:m(h),y2:m(h),stroke:"currentColor",className:"text-line",strokeWidth:1}),e.jsx("text",{x:0,y:m(h)+3,fontSize:9,className:"fill-fg-faint",children:o==="share"?`${Math.round(h*100)}%`:Rt(s,h)})]},g)),a.map((h,g)=>{if(g===0)return null;const D=a[g-1];return h.bands.map((j,Z)=>{const K=D.bands[Z],W=n!==null&&n!==j.projectDir,ee=W?gt:A(j.projectDir),te=[`${p(g-1)},${m(K.y0)}`,`${p(g)},${m(j.y0)}`,`${p(g)},${m(j.y1)}`,`${p(g-1)},${m(K.y1)}`].join(" ");return e.jsx("polygon",{points:te,fill:ee,opacity:W?.6:.75,className:"cursor-pointer",onClick:()=>r(n===j.projectDir?null:j.projectDir),children:e.jsx("title",{children:L(j.projectDir)})},`${j.projectDir}-${g}`)})}),a.map((h,g)=>g%v!==0&&g!==a.length-1?null:e.jsx("text",{x:p(g),y:le-4,fontSize:9,textAnchor:"middle",className:"fill-fg-faint",children:h.date.slice(5)},h.date))]})]})}function St({rows:t,measure:s,selected:n,onSelect:r}){return t.length?e.jsxs("div",{className:`${T} overflow-hidden`,children:[e.jsx("div",{className:"p-4 pb-0",children:e.jsx(R,{kicker:"03 · by project",title:"Ranking"})}),e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"bg-bg-elev",children:e.jsx("tr",{children:["project","share","value","share %","trend","sessions","top tool"].map(o=>e.jsx("th",{className:"text-left px-3 py-2 text-fg-faint uppercase tracking-wider whitespace-nowrap",children:o},o))})}),e.jsx("tbody",{children:t.map(o=>{const i=A(o.projectDir),a=n===o.projectDir;return e.jsxs("tr",{onClick:()=>r(o.projectDir),className:`border-t border-line hover:bg-bg-elev cursor-pointer ${a?"bg-bg-elev":""}`,children:[e.jsx("td",{className:"px-3 py-2 font-mono text-fg-dim",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:i}}),L(o.projectDir)]})}),e.jsx("td",{className:"px-3 py-2 w-32",children:e.jsx("div",{className:"h-1.5 rounded bg-bg-hi overflow-hidden",children:e.jsx("div",{className:"h-full",style:{width:`${Math.max(o.sharePct,o.sharePct>0?2:0)}%`,backgroundColor:i}})})}),e.jsx("td",{className:"px-3 py-2 text-fg-faint font-mono",children:J(s,o.value)}),e.jsxs("td",{className:"px-3 py-2 text-fg-faint font-mono",children:[o.sharePct.toFixed(1),"%"]}),e.jsx("td",{className:"px-3 py-2 font-mono",children:o.trend.pct===null?e.jsx("span",{className:"text-fg-faint",children:"—"}):e.jsxs("span",{className:o.trend.direction==="up"?"text-delta-good":o.trend.direction==="down"?"text-delta-bad":"text-fg-faint",children:[o.trend.direction==="up"?"▲":o.trend.direction==="down"?"▼":"·"," ",Ee(Math.abs(o.trend.pct))]})}),e.jsx("td",{className:"px-3 py-2 text-fg-faint font-mono",children:O(o.sessions)}),e.jsx("td",{className:"px-3 py-2 text-fg-faint font-mono",children:o.topTool||"—"})]},o.projectDir)})})]})]}):e.jsxs("div",{className:`${T} p-4`,children:[e.jsx(R,{kicker:"03 · by project",title:"Ranking"}),e.jsx("div",{className:"text-xs text-fg-faint",children:"no projects in range"})]})}function $t({projectDir:t,totals:s,byModel:n,toolBreakdown:r,onClear:o}){var l;const i=$(s,"in"),a=$(s,"out"),c=Object.entries(n).sort((p,m)=>m[1].costUsd-p[1].costUsd),u=Object.entries(r).sort((p,m)=>m[1]-p[1]),d=((l=u[0])==null?void 0:l[1])??0;return e.jsxs("div",{className:`${T} p-4`,children:[e.jsx(R,{kicker:"04 · drill in",title:L(t),right:e.jsx("button",{onClick:o,className:"text-[11px] text-fg-faint hover:text-fg font-mono",children:"clear ✕"})}),e.jsx("div",{className:"flex items-center gap-1.5 -mt-2 mb-3",children:e.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:A(t)}})}),e.jsxs("div",{className:"grid grid-cols-6 gap-3 mb-4",children:[e.jsx(H,{label:"prompts",value:O(s.promptCount)}),e.jsx(H,{label:"sessions",value:O(s.sessionCount)}),e.jsx(H,{label:"in tokens",value:I(i)}),e.jsx(H,{label:"out tokens",value:I(a)}),e.jsx(H,{label:"spend",value:E(s.estimatedCostUsd)}),e.jsx(H,{label:"time",value:De(s.activeMinutes)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-fg-faint uppercase tracking-wider mb-1.5",children:"model mix"}),c.length===0?e.jsx("div",{className:"text-xs text-fg-faint",children:"no model data"}):e.jsx("div",{className:"space-y-1",children:c.map(([p,m])=>e.jsxs("div",{className:"flex items-center justify-between text-[11px] font-mono text-fg-dim",children:[e.jsx("span",{children:xe(p)}),e.jsx("span",{className:"text-fg-faint",children:E(m.costUsd)})]},p))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-fg-faint uppercase tracking-wider mb-1.5",children:"tool mix"}),u.length===0?e.jsx("div",{className:"text-xs text-fg-faint",children:"no tool data"}):e.jsx("div",{className:"space-y-1",children:u.slice(0,6).map(([p,m])=>e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"w-20 shrink-0 truncate text-fg-dim font-mono",children:p}),e.jsx("div",{className:"flex-1 h-1.5 rounded bg-bg-hi overflow-hidden",children:e.jsx("div",{className:"h-full bg-hive-teal",style:{width:`${d>0?m/d*100:0}%`}})}),e.jsx("span",{className:"text-fg-faint font-mono w-8 text-right",children:m})]},p))})]})]})]})}function H({label:t,value:s}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-fg-faint uppercase tracking-wider",children:t}),e.jsx("div",{className:"text-[17px] font-mono tracking-tight text-fg",children:s})]})}function Et({byModelTotals:t}){const s=Object.entries(t).sort((r,o)=>o[1].costUsd-r[1].costUsd),n=s.reduce((r,[,o])=>r+o.costUsd,0);return e.jsxs("div",{className:`${T} p-4`,children:[e.jsx(R,{kicker:"05 · composition",title:"Model mix",right:e.jsxs("span",{className:"text-xs font-mono text-fg-faint",children:[E(n)," total"]})}),s.length===0?e.jsx("div",{className:"text-xs text-fg-faint",children:"no model data in range"}):e.jsx("div",{className:"space-y-2",children:s.map(([r,o])=>{const i=n>0?o.costUsd/n*100:0,a=A(r);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-0.5",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-fg-dim truncate",children:[e.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:a}}),xe(r),o.estimated&&e.jsx("span",{className:"text-fg-faint",children:"(est.)"})]}),e.jsxs("span",{className:"text-fg-faint whitespace-nowrap ml-2",children:[E(o.costUsd)," · ",i.toFixed(0),"%"]})]}),e.jsx("div",{className:"h-1.5 rounded bg-bg-hi overflow-hidden",children:e.jsx("div",{className:"h-full",style:{width:`${Math.max(i,i>0?2:0)}%`,backgroundColor:a}})})]},r)})})]})}function Dt({rows:t}){const s=t.slice(0,3),n=s.reduce((i,a)=>i+a.sharePct,0),r=t.slice(3),o=r.reduce((i,a)=>i+a.sharePct,0);return e.jsxs("div",{className:`${T} p-4`,children:[e.jsx(R,{kicker:"05 · composition",title:"Concentration",right:e.jsxs("span",{className:"text-xs font-mono text-fg-faint",children:["top 3 = ",n.toFixed(0),"%"]})}),t.length===0?e.jsx("div",{className:"text-xs text-fg-faint",children:"no projects in range"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-3 rounded overflow-hidden mb-2",children:t.map(i=>e.jsx("div",{style:{width:`${Math.max(i.sharePct,.5)}%`,backgroundColor:A(i.projectDir)},title:`${L(i.projectDir)} · ${i.sharePct.toFixed(1)}%`},i.projectDir))}),e.jsx("div",{className:"space-y-1 mb-2",children:s.map(i=>e.jsxs("div",{className:"flex items-center justify-between text-[11px] font-mono",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-fg-dim truncate",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:A(i.projectDir)}}),L(i.projectDir)]}),e.jsxs("span",{className:"text-fg-faint",children:[i.sharePct.toFixed(1),"%"]})]},i.projectDir))}),r.length>0&&e.jsxs("p",{className:"text-[10px] text-fg-faint",children:[r.length," more project",r.length===1?"":"s"," account for ",o.toFixed(1),"% (long tail)."]})]})]})}const Q=30,fe=9,P=(Q+fe)*2;function Ut({totals:t}){const s=t.inputTokens+t.cacheReadTokens+t.cacheCreationTokens,n=s>0?t.cacheReadTokens/s*100:0,r=2*Math.PI*Q,o=P/2;return e.jsxs("div",{className:`${T} p-4`,children:[e.jsx(R,{kicker:"05 · composition",title:"Cache"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative shrink-0",style:{width:P,height:P},children:[e.jsxs("svg",{width:P,height:P,viewBox:`0 0 ${P} ${P}`,className:"-rotate-90",children:[e.jsx("circle",{cx:o,cy:o,r:Q,fill:"none",stroke:"currentColor",className:"text-bg-hi",strokeWidth:fe}),e.jsx("circle",{cx:o,cy:o,r:Q,fill:"none",stroke:bt,strokeWidth:fe,strokeDasharray:r,strokeDashoffset:r*(1-n/100),strokeLinecap:"round"})]}),e.jsxs("div",{className:"absolute inset-0 flex items-center justify-center text-[13px] font-mono text-fg",children:[n.toFixed(0),"%"]})]}),e.jsxs("div",{className:"text-[11px] space-y-1 font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-fg-faint",children:"reused (cache read)"}),e.jsx("span",{className:"text-fg-dim",children:I(t.cacheReadTokens)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-fg-faint",children:"written to cache"}),e.jsx("span",{className:"text-fg-dim",children:I(t.cacheCreationTokens)})]})]})]})]})}const Pt=.05,At="—",Se=t=>`$${t.toFixed(2)}`;function Ft(){const[t,s]=x.useState(null),[n,r]=x.useState(null),o=Ve(a=>a.show);x.useEffect(()=>{let a=!0;const c=()=>{window.api.history.loopEfficiency().then(d=>{a&&(s(d),r(null))}).catch(d=>{if(!a)return;const l=d instanceof Error?d.message:String(d);r(l),o("error",`Loop efficiency failed to load: ${l}`)})};c();const u=window.api.history.onUpdated(c);return()=>{a=!1,u()}},[o]);let i;if(n&&!t)i=e.jsxs("div",{"data-testid":"loop-eff-error",className:"text-[11px] font-mono text-fg-faint",children:["Failed to load: ",n]});else if(!t)i=e.jsx("div",{"data-testid":"loop-eff-loading",className:"text-[11px] font-mono text-fg-faint",children:"Loading…"});else if(t.rows.length===0)i=e.jsx("div",{"data-testid":"loop-eff-empty",className:"text-[11px] font-mono text-fg-faint",children:"No runs this week."});else{const a=t.totals.wastedRunRate>Pt;i=e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full text-[11px] font-mono","data-testid":"loop-eff-table",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-fg-faint text-left",children:[e.jsx("th",{className:"font-normal",children:"Project"}),e.jsx("th",{className:"font-normal text-right",children:"Runs"}),e.jsx("th",{className:"font-normal text-right",children:"Wasted"}),e.jsx("th",{className:"font-normal text-right",children:"Verified"}),e.jsx("th",{className:"font-normal text-right",children:"Refuted"}),e.jsx("th",{className:"font-normal text-right",children:"List-price $"}),e.jsx("th",{className:"font-normal text-right",children:"$ / verified"})]})}),e.jsx("tbody",{className:"text-fg-dim",children:t.rows.map(c=>e.jsxs("tr",{"data-testid":"loop-eff-row",children:[e.jsx("td",{children:c.project}),e.jsx("td",{className:"text-right",children:c.runs}),e.jsx("td",{className:"text-right",children:c.wastedRuns}),e.jsx("td",{className:"text-right",children:c.verified}),e.jsx("td",{className:"text-right",children:c.refuted}),e.jsx("td",{className:"text-right",children:Se(c.executorUsd)}),e.jsx("td",{className:"text-right","data-testid":"loop-eff-per-verified",children:c.usdPerVerified==null?At:Se(c.usdPerVerified)})]},c.cwd))})]}),e.jsxs("div",{"data-testid":"loop-eff-totals","data-warning":a?"true":"false",className:`mt-2 text-[11px] font-mono ${a?"text-amber-300":"text-fg-dim"}`,children:["wasted runs ",(t.totals.wastedRunRate*100).toFixed(1),"% (",t.totals.wastedRuns,"/",t.totals.runs,") · target ≤ 5%"]}),e.jsx("div",{"data-testid":"loop-eff-usage",className:"mt-1 text-[11px] font-mono text-fg-faint",children:t.verifiedPerUsagePct!=null?`${t.verifiedPerUsagePct} verified PRDs per 1% of weekly usage`:"weekly usage unavailable"})]})}return e.jsxs("div",{className:`${T} p-4`,"data-testid":"loop-efficiency",children:[e.jsx(R,{kicker:"06 · reliability",title:"Loop efficiency"}),i]})}const _t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Bt({days:t,measure:s}){const{buckets:n,weekendShare:r,peakIdx:o}=x.useMemo(()=>{const a=new Array(7).fill(0);for(const l of t){const[p,m,v]=l.date.split("-").map(Number),k=new Date(p,m-1,v).getDay();a[k]+=$(l.totals,s)}const c=a.reduce((l,p)=>l+p,0),u=a[0]+a[6];let d=0;for(let l=1;l<7;l++)a[l]>a[d]&&(d=l);return{buckets:a,weekendShare:c>0?u/c*100:0,peakIdx:d}},[t,s]),i=Math.max(...n,1);return e.jsxs("div",{className:`${T} p-4`,children:[e.jsx(R,{kicker:"05 · composition",title:"Rhythm",right:e.jsxs("span",{className:"text-xs font-mono text-fg-faint",children:["weekend ",r.toFixed(0),"%"]})}),e.jsx("div",{className:"flex items-end gap-2 h-24",children:n.map((a,c)=>e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-end gap-1 h-full",children:[e.jsx("div",{className:`w-full rounded-t ${c===o?"bg-accent":"bg-rhythm"}`,style:{height:`${i>0?a/i*100:0}%`,minHeight:a>0?2:0}}),e.jsx("span",{className:"text-[9px] text-fg-faint font-mono",children:_t[c]})]},c))})]})}const Ht=["in","out","total","prompts","sessions","time","spend"],Lt=[30,60,90,0],Ot="spend",It=30,Wt=3e4,Kt=[];function Gt(){var ke;const[t,s]=x.useState(Ot),[n,r]=x.useState(It),o=x.useRef(!1),i=x.useRef(!1),a=f=>{o.current=!0;const b=t;s(f),ue({measure:f}).catch(()=>{s(b),q.error("Couldn't save the measure preference — reverted.")})},c=f=>{i.current=!0;const b=n;r(f),ue({range:f}).catch(()=>{r(b),q.error("Couldn't save the range preference — reverted.")})};x.useEffect(()=>{let f=!1;return pe().then(b=>{f||(!o.current&&b.measure&&Ht.includes(b.measure)&&s(b.measure),!i.current&&b.range!==void 0&&Lt.includes(b.range)&&r(b.range))}),()=>{f=!0}},[]);const u=Ye(f=>f.navFace),d=ye(f=>f.tabs),l=ye(f=>f.activeTabId),p=((ke=d.find(f=>f.id===l))==null?void 0:ke.cwd)??null,m=x.useRef(u),v=p?Xe(p):null,[k,M]=x.useState(null),h=x.useMemo(()=>u==="project"&&v?new Set([v]):k,[u,v,k]),[g,D]=x.useState(null),[j,Z]=x.useState(null),[K,W]=x.useState(!0),[ee,te]=x.useState(0),se=x.useRef(n);se.current=n;const G=x.useRef(!0),ne=x.useRef(0),he=x.useRef(0),F=x.useRef(null),z=x.useCallback(f=>{const b=se.current;ne.current+=1,he.current=Date.now(),Ze(b).then(y=>{if(ne.current-=1,!(!G.current||b!==se.current)){if(W(!1),y.ok){Z(y.data);return}f||q.error(`History analytics failed to load: ${y.error}`)}})},[]);x.useEffect(()=>{G.current=!0,W(!0),z(!1)},[n,ee,z]),x.useEffect(()=>{const f=()=>{if(!G.current)return;const N=he.current+Wt-Date.now();if(ne.current===0&&N<=0){z(!0);return}F.current||(F.current=setTimeout(()=>{F.current=null,f()},Math.max(N,1e3)))},b=()=>{document.visibilityState==="visible"&&f()},y=window.api.history.onUpdated(f);return window.addEventListener("focus",f),document.addEventListener("visibilitychange",b),()=>{G.current=!1,y(),window.removeEventListener("focus",f),document.removeEventListener("visibilitychange",b),F.current&&(clearTimeout(F.current),F.current=null)}},[z]);const me=x.useRef(!1);x.useEffect(()=>{if(!me.current){me.current=!0;return}M(null),D(null)},[n]),x.useEffect(()=>{m.current!==u&&(m.current=u,u==="home"&&M(null))},[u]);const{projects:je,resolving:ge}=qe(),be=x.useMemo(()=>{const f={};for(const b of je)for(const y of b.encodedIds)f[y]=b.cwd;return f},[je]),_=x.useMemo(()=>j&&!ge?ft(j.days,be):null,[j,be,ge]),w=(_==null?void 0:_.days)??(j==null?void 0:j.days)??Kt,oe=(_==null?void 0:_.excluded)??null,S=x.useMemo(()=>j?tt({days:w,totals:j.totals,prevTotals:j.prevTotals},h):null,[j,w,h]),B=x.useMemo(()=>h===null?w:w.map(f=>({date:f.date,byProject:Object.fromEntries(Object.entries(f.byProject).filter(([b])=>h.has(b)))})),[w,h]),V=x.useMemo(()=>Te(w,t),[w,t]),ae=x.useMemo(()=>Te(B,t),[B,t]),Ae=x.useMemo(()=>B.map(f=>({date:f.date,values:Object.fromEntries(Object.entries(f.byProject).map(([b,y])=>[b,$(y,t)]))})),[B,t]),ve=x.useMemo(()=>S?at(S,t):null,[S,t]),Y=x.useMemo(()=>{if(!j||!g)return null;const f=w.flatMap(C=>C.byProject[g]?[C.byProject[g]]:[]),{byModel:b,...y}=Ne(f),N={};for(const C of f)for(const[U,re]of Object.entries(C.toolBreakdown))N[U]=(N[U]??0)+re;return{totals:y,byModel:b,toolBreakdown:N}},[j,w,g]);x.useEffect(()=>{g&&h!==null&&!h.has(g)&&D(null)},[g,h]);function Fe(f){M(b=>{const y=new Set(V.map(U=>U.projectDir)),N=b??new Set(y),C=new Set(N);return C.has(f)?C.delete(f):C.add(f),C.size>=y.size?null:C})}function _e(f){M(new Set([f]))}function Be(){M(null)}function He(){if(!j)return;const f=B.map(U=>{const{byModel:re,estimatedCostUsd:Le,inputTokens:Oe,outputTokens:Ie,cacheCreationTokens:We,cacheReadTokens:Ke}=Ne(Object.values(U.byProject));return{date:U.date,costUsd:Le,inputTokens:Oe,outputTokens:Ie,cacheCreationTokens:We,cacheReadTokens:Ke,byModel:re}}),b=it(f),y=new Blob([b],{type:"text/csv"}),N=URL.createObjectURL(y),C=document.createElement("a");C.href=N,C.download=`usage-history-${j.from}-${j.to}.csv`,C.click(),URL.revokeObjectURL(N)}return K&&!j?e.jsx($e,{}):j&&j.days.length===0?e.jsx(Je,{title:"no sessions in range",hint:"Widen the range or check back after your next session."}):!j||!S||!ve?e.jsx($e,{}):e.jsxs("div",{"data-testid":"history-dashboard",className:"flex flex-col h-full",children:[e.jsxs("h1",{className:"font-serif text-[42px] leading-tight tracking-tight text-fg px-4 pt-4",children:["Where your ",e.jsx("em",{className:"italic text-accent",children:"Claude time"})," goes"]}),e.jsx(jt,{measure:t,onMeasure:a,range:n,onRange:c,projectsShown:h===null?V.length:h.size,projectsTotal:V.length,fromDate:j.from,toDate:j.to,onRefresh:()=>te(f=>f+1),onExport:He,exportDisabled:B.length===0}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-auto p-4 space-y-4",children:[e.jsx(vt,{measure:t,headline:ve,activeDays:S.activeDays,projectsTouched:ae.length,totalSessions:S.totals.sessionCount}),e.jsx(Ct,{days:w}),oe&&xt(oe)&&e.jsx("div",{"data-testid":"history-excluded-note",className:"rounded-[10px] border border-line bg-bg-hi px-3 py-2 text-[11.5px] font-mono text-fg-faint",title:"A project is a working directory. ~/.claude/projects holds one folder per path the CLI was ever launched from — throwaway /tmp dirs and test fixtures included — and a folder whose cwd can't be recovered from its transcripts is not a project. Their totals are stated here rather than silently folded into the charts.",children:pt(oe)}),u==="home"&&e.jsx(Nt,{chips:V.map(f=>({projectDir:f.projectDir,value:f.value})),keep:h,onToggle:Fe,onIsolate:_e,onShowAll:Be}),e.jsx(Mt,{days:Ae,measure:t,selected:g,onSelect:D}),e.jsx(St,{rows:ae,measure:t,selected:g,onSelect:D}),g&&Y&&e.jsx($t,{projectDir:g,totals:Y.totals,byModel:Y.byModel,toolBreakdown:Y.toolBreakdown,onClear:()=>D(null)}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(Et,{byModelTotals:S.byModelTotals}),e.jsx(Dt,{rows:ae}),e.jsx(Ut,{totals:S.totals}),e.jsx(Bt,{days:S.days,measure:t})]}),e.jsx(Ft,{})]})]})}function $e(){return e.jsxs("div",{className:"p-4 space-y-4 animate-pulse",children:[e.jsx("div",{className:"h-24 bg-bg-elev rounded"}),e.jsx("div",{className:"h-16 bg-bg-elev rounded"}),e.jsx("div",{className:"h-8 bg-bg-elev rounded"}),e.jsx("div",{className:"h-56 bg-bg-elev rounded"}),e.jsx("div",{className:"h-40 bg-bg-elev rounded"})]})}function zt(){return e.jsx(Qe,{children:e.jsx(Gt,{})})}const Jt=x.memo(zt);export{Jt as History};
@@ -1,4 +1,4 @@
1
- import{aO as p,ay as e,aq as J,b7 as k,bb as O,a7 as Y,bh as I,m as N,c as S,az as X,ac as Z}from"./index-Cznhnxhq.js";import{B as _}from"./Button-BHvploNk.js";function ee(){return typeof navigator<"u"&&/Mac/.test(navigator.platform)}function ye({dirty:t,busy:a,parseError:i,lastSavedAt:n,onSave:s,onRevert:o,leading:m,cleanLabel:r,shortcutHint:d,scopeRef:c}){const g=t&&!a&&!i;p.useEffect(()=>{if(!d||!c)return;const b=x=>{if(!g||x.defaultPrevented||!(x.ctrlKey||x.metaKey)||x.shiftKey||x.altKey||x.key!=="s"&&x.key!=="S")return;const f=c.current,l=document.activeElement;!f||!l||!f.contains(l)||(x.preventDefault(),s())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[d,c,g,s]);const h=d?ee():!1,y=!t&&!i&&!!r;return e.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2 text-xs",children:[y&&e.jsxs("span",{"data-testid":"savebar-clean",className:"min-w-0 flex items-center gap-[7px] text-fg-faint",children:[e.jsx("span",{"aria-hidden":"true",className:"shrink-0 w-1.5 h-1.5 rounded-full bg-sage"}),e.jsx("span",{className:"truncate",children:r})]}),e.jsx("div",{className:"flex-1 min-w-0 truncate text-fg-faint",children:m}),i&&e.jsx("span",{className:"text-red-400 truncate max-w-xs",title:i,children:i}),!t&&!i&&!r&&n&&e.jsx("span",{className:"text-fg-faint",children:J(n)}),t&&!i&&e.jsx("span",{className:"text-accent",children:"unsaved"}),e.jsx("button",{onClick:o,disabled:!t||a,className:"px-2 py-0.5 border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:"Revert"}),e.jsxs("button",{onClick:s,disabled:!g,"aria-keyshortcuts":d&&c?h?"Meta+S":"Control+S":void 0,className:`px-2.5 py-0.5 rounded border ${g?"border-accent bg-accent/15 text-accent hover:bg-accent/25":"border-line text-fg-faint opacity-50 cursor-not-allowed"}`,children:[a?"Saving…":"Save",d&&e.jsx("kbd",{"aria-hidden":"true",className:"ml-2 font-mono text-[10.5px]",children:h?"⌘S":"Ctrl S"})]})]})}const U=/<[A-Za-z][A-Za-z0-9_-]*>/g,te=/<[A-Za-z][A-Za-z0-9_-]*>/;function se(t){return t.match(U)??[]}function ie(t){const a=[],i=(s,o)=>{if(typeof s=="string")for(const m of se(s))a.push({token:m,label:o})};i(t.command,"command");const n=Array.isArray(t.args)?t.args:[];n.forEach((s,o)=>{if(typeof s!="string")return;const m=n[o-1],r=o>0&&typeof m=="string"&&m.startsWith("-")&&!te.test(m)?`${m} ${s}`:s;i(s,r)});for(const[s,o]of Object.entries(t.env??{}))i(o,`env ${s}`);return i(t.url,"url"),a}function ne(t){const a=new Map;for(const i of ie(t))a.has(i.token)||a.set(i.token,i);return[...a.values()]}function ae(t,a){const i=s=>s.replace(U,o=>Object.prototype.hasOwnProperty.call(a,o)?a[o]:o),n={...t};return typeof n.command=="string"&&(n.command=i(n.command)),Array.isArray(n.args)&&(n.args=n.args.map(s=>typeof s=="string"?i(s):s)),n.env&&(n.env=Object.fromEntries(Object.entries(n.env).map(([s,o])=>[s,typeof o=="string"?i(o):o]))),typeof n.url=="string"&&(n.url=i(n.url)),n}const T=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function re(t){if(typeof t=="string")return t;if(T(t)){for(const a of["url","repo","path"])if(typeof t[a]=="string")return t[a]}return""}async function oe(t){const a=`${t}/.claude/plugins`,i=[];let n;try{const s=await window.api.config.readJson(`${a}/known_marketplaces.json`);if(s.parseError||s.error)return k.error(`known_marketplaces.json unreadable: ${s.parseError??s.error}`),i;if(!s.exists)return i;if(!T(s.data))return k.error("known_marketplaces.json is not an object"),i;n=s.data}catch(s){return k.error(`known_marketplaces.json unreadable: ${s instanceof Error?s.message:String(s)}`),i}for(const[s,o]of Object.entries(n)){const r=`${T(o)&&typeof o.installLocation=="string"?o.installLocation:`${a}/marketplaces/${s}`}/.claude-plugin/marketplace.json`;try{const d=await window.api.config.readJson(r);if(!d.exists){k.warn(`Marketplace ${s}: ${r} not found`);continue}if(d.parseError||d.error||!T(d.data)||!Array.isArray(d.data.plugins)){k.error(`Marketplace ${s}: invalid marketplace.json${d.parseError?` — ${d.parseError}`:""}`);continue}for(const c of d.data.plugins)!T(c)||typeof c.name!="string"||!c.name||i.push({marketplace:s,name:c.name,description:typeof c.description=="string"?c.description:"",source:re(c.source)})}catch(d){k.error(`Marketplace ${s}: ${d instanceof Error?d.message:String(d)}`)}}return i}const q=[{id:"filesystem",name:"Filesystem",description:"Secure file operations with configurable access controls",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem",config:{command:"npx",args:["-y","@modelcontextprotocol/server-filesystem","<path>"]},envVars:[]},{id:"fetch",name:"Fetch",description:"Web content fetching and conversion for efficient LLM usage",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/fetch",config:{command:"uvx",args:["mcp-server-fetch"]},envVars:[]},{id:"memory",name:"Memory",description:"Knowledge graph-based persistent memory system",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/memory",config:{command:"npx",args:["-y","@modelcontextprotocol/server-memory"]},envVars:[]},{id:"sequential-thinking",name:"Sequential Thinking",description:"Dynamic and reflective problem-solving through thought sequences",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking",config:{command:"npx",args:["-y","@modelcontextprotocol/server-sequential-thinking"]},envVars:[]},{id:"git",name:"Git",description:"Tools to read, search, and manipulate Git repositories",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/git",config:{command:"uvx",args:["mcp-server-git","--repository","<path>"]},envVars:[]},{id:"time",name:"Time",description:"Time and timezone conversion capabilities",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/time",config:{command:"uvx",args:["mcp-server-time"]},envVars:[]},{id:"everything",name:"Everything",description:"Reference/test server with prompts, resources, and tools",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/everything",config:{command:"npx",args:["-y","@modelcontextprotocol/server-everything"]},envVars:[]},{id:"github",name:"GitHub",description:"Official GitHub repository, issues, and PR management",official:!1,homepage:"https://github.com/github/github-mcp-server",config:{command:"docker",args:["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server"]},envVars:["GITHUB_PERSONAL_ACCESS_TOKEN"]},{id:"gitlab",name:"GitLab",description:"GitLab API integration for projects, issues, and merge requests",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gitlab",config:{command:"npx",args:["-y","@modelcontextprotocol/server-gitlab"]},envVars:["GITLAB_PERSONAL_ACCESS_TOKEN","GITLAB_API_URL"]},{id:"postgres",name:"PostgreSQL",description:"Read-only database access with schema inspection",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres",config:{command:"npx",args:["-y","@modelcontextprotocol/server-postgres","<connection-string>"]},envVars:[]},{id:"sqlite",name:"SQLite",description:"Database interaction and business intelligence over SQLite",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/sqlite",config:{command:"uvx",args:["--with","mcp<2","mcp-server-sqlite","--db-path","<path>"]},envVars:[]},{id:"slack",name:"Slack",description:"Channel management and messaging for Slack workspaces",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/slack",config:{command:"npx",args:["-y","@modelcontextprotocol/server-slack"]},envVars:["SLACK_BOT_TOKEN","SLACK_TEAM_ID"]},{id:"google-drive",name:"Google Drive",description:"File access and search for Google Drive",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gdrive",config:{command:"npx",args:["-y","@modelcontextprotocol/server-gdrive"]},envVars:["GDRIVE_CREDENTIALS_PATH"]},{id:"google-maps",name:"Google Maps",description:"Location services, directions, and place details",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/google-maps",config:{command:"npx",args:["-y","@modelcontextprotocol/server-google-maps"]},envVars:["GOOGLE_MAPS_API_KEY"]},{id:"puppeteer",name:"Puppeteer",description:"Browser automation and web scraping via Puppeteer",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/puppeteer",config:{command:"npx",args:["-y","@modelcontextprotocol/server-puppeteer"]},envVars:[]},{id:"playwright",name:"Playwright",description:"Cross-browser automation for navigation, screenshots, and data extraction",official:!1,homepage:"https://github.com/microsoft/playwright-mcp",config:{command:"npx",args:["-y","@playwright/mcp@latest"]},envVars:[]},{id:"brave-search",name:"Brave Search",description:"Web and local search using the Brave Search API",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/brave-search",config:{command:"npx",args:["-y","@modelcontextprotocol/server-brave-search"]},envVars:["BRAVE_API_KEY"]},{id:"redis",name:"Redis",description:"Interact with Redis key-value stores",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/redis",config:{command:"npx",args:["-y","@modelcontextprotocol/server-redis","<redis-url>"]},envVars:[]},{id:"sentry",name:"Sentry",description:"Retrieve and analyze Sentry error tracking issues",official:!1,homepage:"https://github.com/getsentry/sentry-mcp",config:{command:"npx",args:["-y","@sentry/mcp-server@latest"]},envVars:["SENTRY_AUTH_TOKEN"]},{id:"linear",name:"Linear",description:"Issue tracking and project management for Linear",official:!1,homepage:"https://linear.app/docs/mcp",config:{command:"npx",args:["-y","mcp-remote","https://mcp.linear.app/sse"]},envVars:[]},{id:"notion",name:"Notion",description:"Notion workspace page and database management",official:!1,homepage:"https://github.com/makenotion/notion-mcp-server",config:{command:"npx",args:["-y","@notionhq/notion-mcp-server"]},envVars:["NOTION_API_KEY"]},{id:"stripe",name:"Stripe",description:"Payment processing, customers, and invoices via Stripe API",official:!1,homepage:"https://github.com/stripe/agent-toolkit",config:{command:"npx",args:["-y","@stripe/mcp","--tools=all"]},envVars:["STRIPE_SECRET_KEY"]},{id:"cloudflare",name:"Cloudflare",description:"Manage Cloudflare Workers, KV, R2, D1, and Workers AI",official:!1,homepage:"https://github.com/cloudflare/mcp-server-cloudflare",config:{command:"npx",args:["-y","mcp-remote","https://observability.mcp.cloudflare.com/sse"]},envVars:[]},{id:"context7",name:"Context7",description:"Up-to-date version-specific library docs injected into prompts",official:!1,homepage:"https://github.com/upstash/context7",config:{command:"npx",args:["-y","@upstash/context7-mcp@latest"]},envVars:[]},{id:"tavily",name:"Tavily",description:"AI-optimized web search with clean structured results",official:!1,homepage:"https://github.com/tavily-ai/tavily-mcp",config:{command:"npx",args:["-y","tavily-mcp@latest"]},envVars:["TAVILY_API_KEY"]},{id:"perplexity",name:"Perplexity",description:"Answer-engine search with deep research and reasoning",official:!1,homepage:"https://github.com/ppl-ai/modelcontextprotocol",config:{command:"npx",args:["-y","server-perplexity-ask"]},envVars:["PERPLEXITY_API_KEY"]},{id:"figma",name:"Figma Dev Mode",description:"First-party Figma design-to-code bridge exposing node tree",official:!1,homepage:"https://help.figma.com/hc/en-us/articles/32132100833559",config:{url:"http://127.0.0.1:3845/sse"},envVars:[]},{id:"supabase",name:"Supabase",description:"Manage Supabase projects, tables, and SQL queries",official:!1,homepage:"https://github.com/supabase-community/supabase-mcp",config:{command:"npx",args:["-y","@supabase/mcp-server-supabase@latest"]},envVars:["SUPABASE_ACCESS_TOKEN"]},{id:"atlassian",name:"Atlassian (Jira/Confluence)",description:"Official Jira and Confluence integration",official:!1,homepage:"https://www.atlassian.com/platform/remote-mcp-server",config:{command:"npx",args:["-y","mcp-remote","https://mcp.atlassian.com/v1/sse"]},envVars:[]},{id:"aws",name:"AWS",description:"AWS services access and best-practice guidance",official:!1,homepage:"https://github.com/awslabs/mcp",config:{command:"uvx",args:["awslabs.core-mcp-server@latest"]},envVars:["AWS_PROFILE","AWS_REGION"]},{id:"obsidian",name:"Obsidian",description:"Read and search notes in an Obsidian vault",official:!1,homepage:"https://github.com/MarkusPfundstein/mcp-obsidian",config:{command:"uvx",args:["mcp-obsidian"]},envVars:["OBSIDIAN_API_KEY"]}],F=[{id:"pdf",name:"PDF",description:"Create, edit, and extract content from PDF documents",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/pdf"},{id:"docx",name:"DOCX",description:"Create and edit Microsoft Word documents",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/docx"},{id:"xlsx",name:"XLSX",description:"Create and edit Excel spreadsheets with formulas and formatting",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/xlsx"},{id:"pptx",name:"PPTX",description:"Create and edit PowerPoint presentations",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/pptx"},{id:"webapp-testing",name:"Webapp Testing",description:"Test web applications using Playwright-driven browser automation",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/webapp-testing"},{id:"playwright-e2e",name:"Playwright E2E",description:"End-to-end browser tests — navigation, forms, assertions, waiting strategies",official:!1,source:"local"},{id:"playwright-visual-testing",name:"Playwright Visual Testing",description:"Visual regression testing — screenshot comparison, pixel diffs, responsive layouts",official:!1,source:"local"},{id:"playwright-accessibility",name:"Playwright Accessibility",description:"Accessibility testing — WCAG compliance, axe-core scans, keyboard navigation",official:!1,source:"local"},{id:"playwright-api-testing",name:"Playwright API Testing",description:"API testing with Playwright request context — REST endpoints, auth flows, contracts",official:!1,source:"local"},{id:"playwright-debug",name:"Playwright Debug",description:"Debug failing tests — trace viewer, inspector, headed mode, flaky test fixes",official:!1,source:"local"},{id:"web-artifacts-builder",name:"Web Artifacts Builder",description:"Build polished interactive web artifacts and demos",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/web-artifacts-builder"},{id:"frontend-design",name:"Frontend Design",description:"Apply frontend UI/UX design patterns and visual polish",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/frontend-design"},{id:"canvas-design",name:"Canvas Design",description:"Canvas-based graphic design and composition techniques",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/canvas-design"},{id:"algorithmic-art",name:"Algorithmic Art",description:"Create generative and algorithmic art",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/algorithmic-art"},{id:"brand-guidelines",name:"Brand Guidelines",description:"Apply brand identity and style guideline specifications",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/brand-guidelines"},{id:"theme-factory",name:"Theme Factory",description:"Generate and customize visual themes",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/theme-factory"},{id:"slack-gif-creator",name:"Slack GIF Creator",description:"Create animated GIFs suitable for Slack",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/slack-gif-creator"},{id:"doc-coauthoring",name:"Doc Coauthoring",description:"Collaborative document authoring and editing workflows",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/doc-coauthoring"},{id:"internal-comms",name:"Internal Comms",description:"Internal communications templates and drafting",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/internal-comms"},{id:"claude-api",name:"Claude API",description:"Build apps with the Claude API and Anthropic SDKs",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/claude-api"},{id:"mcp-builder",name:"MCP Builder",description:"Scaffold and build new Model Context Protocol servers",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/mcp-builder"},{id:"skill-creator",name:"Skill Creator",description:"Scaffold and create new Claude Code skills",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/skill-creator"}],z=[{id:"prettier-on-write",name:"Prettier on Write",description:"Auto-format JS/TS/JSON/MD files after edit via prettier",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.(js|jsx|ts|tsx|json|md|css|html|yaml|yml)$' | xargs -r -I{} npx --no-install prettier --write {} 2>/dev/null || true"},{id:"black-on-write",name:"Black on Write (Python)",description:"Auto-format Python files after edit via black",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.py$' | xargs -r black -q 2>/dev/null || true"},{id:"rustfmt-on-write",name:"rustfmt on Write",description:"Auto-format Rust files after edit via rustfmt",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.rs$' | xargs -r rustfmt 2>/dev/null || true"},{id:"gofmt-on-write",name:"gofmt on Write",description:"Auto-format Go files after edit via gofmt",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.go$' | xargs -r gofmt -w 2>/dev/null || true"},{id:"block-secret-writes",name:"Block Writes to Secrets",description:"Deny edits to .env, credentials, key files",event:"PreToolUse",matcher:"Write|Edit",command:`path=$(jq -r '.tool_input.file_path // empty'); echo "$path" | grep -qE '(^|/)(\\.env|\\.env\\..+|id_rsa|id_ed25519|.*\\.pem|.*\\.key|credentials\\.json|\\.aws/credentials)$' && { echo '{"decision":"block","reason":"refusing to edit secret file"}'; exit 2; } || true`},{id:"notify-on-stop",name:"Desktop Notify on Stop",description:"Send a desktop notification when Claude finishes a turn",event:"Stop",command:`command -v notify-send >/dev/null && notify-send "Claude Code" "Session ready" || (command -v osascript >/dev/null && osascript -e 'display notification "Session ready" with title "Claude Code"') || true`},{id:"bell-on-notification",name:"Terminal Bell on Notification",description:"Ring the terminal bell on permission prompts / idle notifications",event:"Notification",command:"printf '\\a'"},{id:"log-tool-calls",name:"Log Tool Calls (JSONL)",description:"Append every tool call to ~/.claude/logs/tool-calls.jsonl for audit",event:"PreToolUse",command:"mkdir -p ~/.claude/logs && cat >> ~/.claude/logs/tool-calls.jsonl"},{id:"auto-stage-edits",name:"Auto-stage Edited Files",description:"git add each file Claude edits (inside a repo)",event:"PostToolUse",matcher:"Write|Edit",command:`path=$(jq -r '.tool_input.file_path // empty'); [ -n "$path" ] && git -C "$(dirname "$path")" add "$path" 2>/dev/null || true`},{id:"block-dangerous-bash",name:"Block Dangerous Bash",description:"Refuse rm -rf /, fork bombs, curl|sh pipes",event:"PreToolUse",matcher:"Bash",command:`cmd=$(jq -r '.tool_input.command // empty'); echo "$cmd" | grep -qE '(rm -rf /|:\\(\\)\\{.*\\};|curl.*\\|\\s*(bash|sh)|wget.*\\|\\s*(bash|sh)|mkfs\\.|dd if=.*of=/dev/)' && { echo '{"decision":"block","reason":"dangerous command pattern"}'; exit 2; } || true`},{id:"prepend-cwd-to-prompt",name:"Prepend CWD to Prompt",description:"Add cwd context to every user prompt automatically",event:"UserPromptSubmit",command:'echo "{\\"additionalContext\\":\\"cwd: $(pwd)\\"}"'},{id:"archive-transcript",name:"Archive Transcript on SessionEnd",description:"Copy the session jsonl to ~/.claude/archive/ when done",event:"SessionEnd",command:`src=$(jq -r '.transcript_path // empty'); [ -n "$src" ] && mkdir -p ~/.claude/archive && cp "$src" ~/.claude/archive/ 2>/dev/null || true`}],j=(t,a,i,n)=>`---
1
+ import{aO as p,ay as e,aq as J,b7 as k,bb as O,a7 as Y,bh as I,m as N,c as S,az as X,ac as Z}from"./index-rt7pTODX.js";import{B as _}from"./Button-DtBUGvGI.js";function ee(){return typeof navigator<"u"&&/Mac/.test(navigator.platform)}function ye({dirty:t,busy:a,parseError:i,lastSavedAt:n,onSave:s,onRevert:o,leading:m,cleanLabel:r,shortcutHint:d,scopeRef:c}){const g=t&&!a&&!i;p.useEffect(()=>{if(!d||!c)return;const b=x=>{if(!g||x.defaultPrevented||!(x.ctrlKey||x.metaKey)||x.shiftKey||x.altKey||x.key!=="s"&&x.key!=="S")return;const f=c.current,l=document.activeElement;!f||!l||!f.contains(l)||(x.preventDefault(),s())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[d,c,g,s]);const h=d?ee():!1,y=!t&&!i&&!!r;return e.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2 text-xs",children:[y&&e.jsxs("span",{"data-testid":"savebar-clean",className:"min-w-0 flex items-center gap-[7px] text-fg-faint",children:[e.jsx("span",{"aria-hidden":"true",className:"shrink-0 w-1.5 h-1.5 rounded-full bg-sage"}),e.jsx("span",{className:"truncate",children:r})]}),e.jsx("div",{className:"flex-1 min-w-0 truncate text-fg-faint",children:m}),i&&e.jsx("span",{className:"text-red-400 truncate max-w-xs",title:i,children:i}),!t&&!i&&!r&&n&&e.jsx("span",{className:"text-fg-faint",children:J(n)}),t&&!i&&e.jsx("span",{className:"text-accent",children:"unsaved"}),e.jsx("button",{onClick:o,disabled:!t||a,className:"px-2 py-0.5 border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:"Revert"}),e.jsxs("button",{onClick:s,disabled:!g,"aria-keyshortcuts":d&&c?h?"Meta+S":"Control+S":void 0,className:`px-2.5 py-0.5 rounded border ${g?"border-accent bg-accent/15 text-accent hover:bg-accent/25":"border-line text-fg-faint opacity-50 cursor-not-allowed"}`,children:[a?"Saving…":"Save",d&&e.jsx("kbd",{"aria-hidden":"true",className:"ml-2 font-mono text-[10.5px]",children:h?"⌘S":"Ctrl S"})]})]})}const U=/<[A-Za-z][A-Za-z0-9_-]*>/g,te=/<[A-Za-z][A-Za-z0-9_-]*>/;function se(t){return t.match(U)??[]}function ie(t){const a=[],i=(s,o)=>{if(typeof s=="string")for(const m of se(s))a.push({token:m,label:o})};i(t.command,"command");const n=Array.isArray(t.args)?t.args:[];n.forEach((s,o)=>{if(typeof s!="string")return;const m=n[o-1],r=o>0&&typeof m=="string"&&m.startsWith("-")&&!te.test(m)?`${m} ${s}`:s;i(s,r)});for(const[s,o]of Object.entries(t.env??{}))i(o,`env ${s}`);return i(t.url,"url"),a}function ne(t){const a=new Map;for(const i of ie(t))a.has(i.token)||a.set(i.token,i);return[...a.values()]}function ae(t,a){const i=s=>s.replace(U,o=>Object.prototype.hasOwnProperty.call(a,o)?a[o]:o),n={...t};return typeof n.command=="string"&&(n.command=i(n.command)),Array.isArray(n.args)&&(n.args=n.args.map(s=>typeof s=="string"?i(s):s)),n.env&&(n.env=Object.fromEntries(Object.entries(n.env).map(([s,o])=>[s,typeof o=="string"?i(o):o]))),typeof n.url=="string"&&(n.url=i(n.url)),n}const T=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function re(t){if(typeof t=="string")return t;if(T(t)){for(const a of["url","repo","path"])if(typeof t[a]=="string")return t[a]}return""}async function oe(t){const a=`${t}/.claude/plugins`,i=[];let n;try{const s=await window.api.config.readJson(`${a}/known_marketplaces.json`);if(s.parseError||s.error)return k.error(`known_marketplaces.json unreadable: ${s.parseError??s.error}`),i;if(!s.exists)return i;if(!T(s.data))return k.error("known_marketplaces.json is not an object"),i;n=s.data}catch(s){return k.error(`known_marketplaces.json unreadable: ${s instanceof Error?s.message:String(s)}`),i}for(const[s,o]of Object.entries(n)){const r=`${T(o)&&typeof o.installLocation=="string"?o.installLocation:`${a}/marketplaces/${s}`}/.claude-plugin/marketplace.json`;try{const d=await window.api.config.readJson(r);if(!d.exists){k.warn(`Marketplace ${s}: ${r} not found`);continue}if(d.parseError||d.error||!T(d.data)||!Array.isArray(d.data.plugins)){k.error(`Marketplace ${s}: invalid marketplace.json${d.parseError?` — ${d.parseError}`:""}`);continue}for(const c of d.data.plugins)!T(c)||typeof c.name!="string"||!c.name||i.push({marketplace:s,name:c.name,description:typeof c.description=="string"?c.description:"",source:re(c.source)})}catch(d){k.error(`Marketplace ${s}: ${d instanceof Error?d.message:String(d)}`)}}return i}const q=[{id:"filesystem",name:"Filesystem",description:"Secure file operations with configurable access controls",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem",config:{command:"npx",args:["-y","@modelcontextprotocol/server-filesystem","<path>"]},envVars:[]},{id:"fetch",name:"Fetch",description:"Web content fetching and conversion for efficient LLM usage",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/fetch",config:{command:"uvx",args:["mcp-server-fetch"]},envVars:[]},{id:"memory",name:"Memory",description:"Knowledge graph-based persistent memory system",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/memory",config:{command:"npx",args:["-y","@modelcontextprotocol/server-memory"]},envVars:[]},{id:"sequential-thinking",name:"Sequential Thinking",description:"Dynamic and reflective problem-solving through thought sequences",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking",config:{command:"npx",args:["-y","@modelcontextprotocol/server-sequential-thinking"]},envVars:[]},{id:"git",name:"Git",description:"Tools to read, search, and manipulate Git repositories",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/git",config:{command:"uvx",args:["mcp-server-git","--repository","<path>"]},envVars:[]},{id:"time",name:"Time",description:"Time and timezone conversion capabilities",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/time",config:{command:"uvx",args:["mcp-server-time"]},envVars:[]},{id:"everything",name:"Everything",description:"Reference/test server with prompts, resources, and tools",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/everything",config:{command:"npx",args:["-y","@modelcontextprotocol/server-everything"]},envVars:[]},{id:"github",name:"GitHub",description:"Official GitHub repository, issues, and PR management",official:!1,homepage:"https://github.com/github/github-mcp-server",config:{command:"docker",args:["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server"]},envVars:["GITHUB_PERSONAL_ACCESS_TOKEN"]},{id:"gitlab",name:"GitLab",description:"GitLab API integration for projects, issues, and merge requests",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gitlab",config:{command:"npx",args:["-y","@modelcontextprotocol/server-gitlab"]},envVars:["GITLAB_PERSONAL_ACCESS_TOKEN","GITLAB_API_URL"]},{id:"postgres",name:"PostgreSQL",description:"Read-only database access with schema inspection",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres",config:{command:"npx",args:["-y","@modelcontextprotocol/server-postgres","<connection-string>"]},envVars:[]},{id:"sqlite",name:"SQLite",description:"Database interaction and business intelligence over SQLite",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/sqlite",config:{command:"uvx",args:["--with","mcp<2","mcp-server-sqlite","--db-path","<path>"]},envVars:[]},{id:"slack",name:"Slack",description:"Channel management and messaging for Slack workspaces",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/slack",config:{command:"npx",args:["-y","@modelcontextprotocol/server-slack"]},envVars:["SLACK_BOT_TOKEN","SLACK_TEAM_ID"]},{id:"google-drive",name:"Google Drive",description:"File access and search for Google Drive",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gdrive",config:{command:"npx",args:["-y","@modelcontextprotocol/server-gdrive"]},envVars:["GDRIVE_CREDENTIALS_PATH"]},{id:"google-maps",name:"Google Maps",description:"Location services, directions, and place details",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/google-maps",config:{command:"npx",args:["-y","@modelcontextprotocol/server-google-maps"]},envVars:["GOOGLE_MAPS_API_KEY"]},{id:"puppeteer",name:"Puppeteer",description:"Browser automation and web scraping via Puppeteer",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/puppeteer",config:{command:"npx",args:["-y","@modelcontextprotocol/server-puppeteer"]},envVars:[]},{id:"playwright",name:"Playwright",description:"Cross-browser automation for navigation, screenshots, and data extraction",official:!1,homepage:"https://github.com/microsoft/playwright-mcp",config:{command:"npx",args:["-y","@playwright/mcp@latest"]},envVars:[]},{id:"brave-search",name:"Brave Search",description:"Web and local search using the Brave Search API",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/brave-search",config:{command:"npx",args:["-y","@modelcontextprotocol/server-brave-search"]},envVars:["BRAVE_API_KEY"]},{id:"redis",name:"Redis",description:"Interact with Redis key-value stores",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/redis",config:{command:"npx",args:["-y","@modelcontextprotocol/server-redis","<redis-url>"]},envVars:[]},{id:"sentry",name:"Sentry",description:"Retrieve and analyze Sentry error tracking issues",official:!1,homepage:"https://github.com/getsentry/sentry-mcp",config:{command:"npx",args:["-y","@sentry/mcp-server@latest"]},envVars:["SENTRY_AUTH_TOKEN"]},{id:"linear",name:"Linear",description:"Issue tracking and project management for Linear",official:!1,homepage:"https://linear.app/docs/mcp",config:{command:"npx",args:["-y","mcp-remote","https://mcp.linear.app/sse"]},envVars:[]},{id:"notion",name:"Notion",description:"Notion workspace page and database management",official:!1,homepage:"https://github.com/makenotion/notion-mcp-server",config:{command:"npx",args:["-y","@notionhq/notion-mcp-server"]},envVars:["NOTION_API_KEY"]},{id:"stripe",name:"Stripe",description:"Payment processing, customers, and invoices via Stripe API",official:!1,homepage:"https://github.com/stripe/agent-toolkit",config:{command:"npx",args:["-y","@stripe/mcp","--tools=all"]},envVars:["STRIPE_SECRET_KEY"]},{id:"cloudflare",name:"Cloudflare",description:"Manage Cloudflare Workers, KV, R2, D1, and Workers AI",official:!1,homepage:"https://github.com/cloudflare/mcp-server-cloudflare",config:{command:"npx",args:["-y","mcp-remote","https://observability.mcp.cloudflare.com/sse"]},envVars:[]},{id:"context7",name:"Context7",description:"Up-to-date version-specific library docs injected into prompts",official:!1,homepage:"https://github.com/upstash/context7",config:{command:"npx",args:["-y","@upstash/context7-mcp@latest"]},envVars:[]},{id:"tavily",name:"Tavily",description:"AI-optimized web search with clean structured results",official:!1,homepage:"https://github.com/tavily-ai/tavily-mcp",config:{command:"npx",args:["-y","tavily-mcp@latest"]},envVars:["TAVILY_API_KEY"]},{id:"perplexity",name:"Perplexity",description:"Answer-engine search with deep research and reasoning",official:!1,homepage:"https://github.com/ppl-ai/modelcontextprotocol",config:{command:"npx",args:["-y","server-perplexity-ask"]},envVars:["PERPLEXITY_API_KEY"]},{id:"figma",name:"Figma Dev Mode",description:"First-party Figma design-to-code bridge exposing node tree",official:!1,homepage:"https://help.figma.com/hc/en-us/articles/32132100833559",config:{url:"http://127.0.0.1:3845/sse"},envVars:[]},{id:"supabase",name:"Supabase",description:"Manage Supabase projects, tables, and SQL queries",official:!1,homepage:"https://github.com/supabase-community/supabase-mcp",config:{command:"npx",args:["-y","@supabase/mcp-server-supabase@latest"]},envVars:["SUPABASE_ACCESS_TOKEN"]},{id:"atlassian",name:"Atlassian (Jira/Confluence)",description:"Official Jira and Confluence integration",official:!1,homepage:"https://www.atlassian.com/platform/remote-mcp-server",config:{command:"npx",args:["-y","mcp-remote","https://mcp.atlassian.com/v1/sse"]},envVars:[]},{id:"aws",name:"AWS",description:"AWS services access and best-practice guidance",official:!1,homepage:"https://github.com/awslabs/mcp",config:{command:"uvx",args:["awslabs.core-mcp-server@latest"]},envVars:["AWS_PROFILE","AWS_REGION"]},{id:"obsidian",name:"Obsidian",description:"Read and search notes in an Obsidian vault",official:!1,homepage:"https://github.com/MarkusPfundstein/mcp-obsidian",config:{command:"uvx",args:["mcp-obsidian"]},envVars:["OBSIDIAN_API_KEY"]}],F=[{id:"pdf",name:"PDF",description:"Create, edit, and extract content from PDF documents",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/pdf"},{id:"docx",name:"DOCX",description:"Create and edit Microsoft Word documents",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/docx"},{id:"xlsx",name:"XLSX",description:"Create and edit Excel spreadsheets with formulas and formatting",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/xlsx"},{id:"pptx",name:"PPTX",description:"Create and edit PowerPoint presentations",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/pptx"},{id:"webapp-testing",name:"Webapp Testing",description:"Test web applications using Playwright-driven browser automation",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/webapp-testing"},{id:"playwright-e2e",name:"Playwright E2E",description:"End-to-end browser tests — navigation, forms, assertions, waiting strategies",official:!1,source:"local"},{id:"playwright-visual-testing",name:"Playwright Visual Testing",description:"Visual regression testing — screenshot comparison, pixel diffs, responsive layouts",official:!1,source:"local"},{id:"playwright-accessibility",name:"Playwright Accessibility",description:"Accessibility testing — WCAG compliance, axe-core scans, keyboard navigation",official:!1,source:"local"},{id:"playwright-api-testing",name:"Playwright API Testing",description:"API testing with Playwright request context — REST endpoints, auth flows, contracts",official:!1,source:"local"},{id:"playwright-debug",name:"Playwright Debug",description:"Debug failing tests — trace viewer, inspector, headed mode, flaky test fixes",official:!1,source:"local"},{id:"web-artifacts-builder",name:"Web Artifacts Builder",description:"Build polished interactive web artifacts and demos",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/web-artifacts-builder"},{id:"frontend-design",name:"Frontend Design",description:"Apply frontend UI/UX design patterns and visual polish",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/frontend-design"},{id:"canvas-design",name:"Canvas Design",description:"Canvas-based graphic design and composition techniques",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/canvas-design"},{id:"algorithmic-art",name:"Algorithmic Art",description:"Create generative and algorithmic art",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/algorithmic-art"},{id:"brand-guidelines",name:"Brand Guidelines",description:"Apply brand identity and style guideline specifications",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/brand-guidelines"},{id:"theme-factory",name:"Theme Factory",description:"Generate and customize visual themes",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/theme-factory"},{id:"slack-gif-creator",name:"Slack GIF Creator",description:"Create animated GIFs suitable for Slack",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/slack-gif-creator"},{id:"doc-coauthoring",name:"Doc Coauthoring",description:"Collaborative document authoring and editing workflows",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/doc-coauthoring"},{id:"internal-comms",name:"Internal Comms",description:"Internal communications templates and drafting",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/internal-comms"},{id:"claude-api",name:"Claude API",description:"Build apps with the Claude API and Anthropic SDKs",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/claude-api"},{id:"mcp-builder",name:"MCP Builder",description:"Scaffold and build new Model Context Protocol servers",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/mcp-builder"},{id:"skill-creator",name:"Skill Creator",description:"Scaffold and create new Claude Code skills",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/skill-creator"}],z=[{id:"prettier-on-write",name:"Prettier on Write",description:"Auto-format JS/TS/JSON/MD files after edit via prettier",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.(js|jsx|ts|tsx|json|md|css|html|yaml|yml)$' | xargs -r -I{} npx --no-install prettier --write {} 2>/dev/null || true"},{id:"black-on-write",name:"Black on Write (Python)",description:"Auto-format Python files after edit via black",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.py$' | xargs -r black -q 2>/dev/null || true"},{id:"rustfmt-on-write",name:"rustfmt on Write",description:"Auto-format Rust files after edit via rustfmt",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.rs$' | xargs -r rustfmt 2>/dev/null || true"},{id:"gofmt-on-write",name:"gofmt on Write",description:"Auto-format Go files after edit via gofmt",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.go$' | xargs -r gofmt -w 2>/dev/null || true"},{id:"block-secret-writes",name:"Block Writes to Secrets",description:"Deny edits to .env, credentials, key files",event:"PreToolUse",matcher:"Write|Edit",command:`path=$(jq -r '.tool_input.file_path // empty'); echo "$path" | grep -qE '(^|/)(\\.env|\\.env\\..+|id_rsa|id_ed25519|.*\\.pem|.*\\.key|credentials\\.json|\\.aws/credentials)$' && { echo '{"decision":"block","reason":"refusing to edit secret file"}'; exit 2; } || true`},{id:"notify-on-stop",name:"Desktop Notify on Stop",description:"Send a desktop notification when Claude finishes a turn",event:"Stop",command:`command -v notify-send >/dev/null && notify-send "Claude Code" "Session ready" || (command -v osascript >/dev/null && osascript -e 'display notification "Session ready" with title "Claude Code"') || true`},{id:"bell-on-notification",name:"Terminal Bell on Notification",description:"Ring the terminal bell on permission prompts / idle notifications",event:"Notification",command:"printf '\\a'"},{id:"log-tool-calls",name:"Log Tool Calls (JSONL)",description:"Append every tool call to ~/.claude/logs/tool-calls.jsonl for audit",event:"PreToolUse",command:"mkdir -p ~/.claude/logs && cat >> ~/.claude/logs/tool-calls.jsonl"},{id:"auto-stage-edits",name:"Auto-stage Edited Files",description:"git add each file Claude edits (inside a repo)",event:"PostToolUse",matcher:"Write|Edit",command:`path=$(jq -r '.tool_input.file_path // empty'); [ -n "$path" ] && git -C "$(dirname "$path")" add "$path" 2>/dev/null || true`},{id:"block-dangerous-bash",name:"Block Dangerous Bash",description:"Refuse rm -rf /, fork bombs, curl|sh pipes",event:"PreToolUse",matcher:"Bash",command:`cmd=$(jq -r '.tool_input.command // empty'); echo "$cmd" | grep -qE '(rm -rf /|:\\(\\)\\{.*\\};|curl.*\\|\\s*(bash|sh)|wget.*\\|\\s*(bash|sh)|mkfs\\.|dd if=.*of=/dev/)' && { echo '{"decision":"block","reason":"dangerous command pattern"}'; exit 2; } || true`},{id:"prepend-cwd-to-prompt",name:"Prepend CWD to Prompt",description:"Add cwd context to every user prompt automatically",event:"UserPromptSubmit",command:'echo "{\\"additionalContext\\":\\"cwd: $(pwd)\\"}"'},{id:"archive-transcript",name:"Archive Transcript on SessionEnd",description:"Copy the session jsonl to ~/.claude/archive/ when done",event:"SessionEnd",command:`src=$(jq -r '.transcript_path // empty'); [ -n "$src" ] && mkdir -p ~/.claude/archive && cp "$src" ~/.claude/archive/ 2>/dev/null || true`}],j=(t,a,i,n)=>`---
2
2
  name: ${t}
3
3
  description: ${a}
4
4
  tools: ${i}
@@ -1 +1 @@
1
- import{ay as e}from"./index-Cznhnxhq.js";function o({sidebar:r,detail:s,sidebarWidth:i="18rem"}){return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"shrink-0 border-r border-line overflow-y-auto",style:{width:i},children:r}),e.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:s})]})}export{o as L};
1
+ import{ay as e}from"./index-rt7pTODX.js";function o({sidebar:r,detail:s,sidebarWidth:i="18rem"}){return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"shrink-0 border-r border-line overflow-y-auto",style:{width:i},children:r}),e.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:s})]})}export{o as L};
@@ -1 +1 @@
1
- import{ay as e}from"./index-Cznhnxhq.js";function n({toolbar:s,footer:l,children:r}){return e.jsxs("div",{className:"h-full flex flex-col",children:[s&&e.jsx("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:s}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:r}),l&&e.jsx("div",{className:"shrink-0 border-t border-line bg-bg-elev",children:l})]})}export{n as P};
1
+ import{ay as e}from"./index-rt7pTODX.js";function n({toolbar:s,footer:l,children:r}){return e.jsxs("div",{className:"h-full flex flex-col",children:[s&&e.jsx("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:s}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:r}),l&&e.jsx("div",{className:"shrink-0 border-t border-line bg-bg-elev",children:l})]})}export{n as P};
@@ -1,4 +1,4 @@
1
- import{aO as o,b7 as E,ay as e,a7 as W,ak as Lt,aS as Dt,aj as Tt,L as Rt,bh as Je,b8 as et,m as ve,bm as It,C as Ot,H as _t,bb as J}from"./index-Cznhnxhq.js";import{V as Se}from"./ViewTabs-DLwaU9RB.js";import{S as de}from"./SourceChip-DUxulNOp.js";import{S as tt,M as Pt}from"./Library-I37dQ6pB.js";import{D as Ft}from"./DocumentEditorPane-DaX4xag_.js";import{V as Bt}from"./VoiceButton-C4hIBxIP.js";import{Settings as Wt}from"./Settings-DSk7bn-1.js";import{a as Kt,S as Ut}from"./Skills-BPZnSjsB.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-BHvploNk.js";import"./Panel-DP8eSKSs.js";import"./claude-settings-schema-COigsajx.js";import"./ListDetail-DJYMWYQd.js";import"./ProvenanceBadge-DUwhsmdA.js";import"./Toggle-CrgM7OTR.js";function st(s){return!s||!s.trim()?"default":s.replace(/[^a-zA-Z0-9]/g,"-")}const _e=["bg-accent","bg-sage-dark","bg-honey","bg-fg-dim","bg-fg-faint","bg-hive-teal","bg-butter","bg-delta-bad"],nt=864e5,Vt="MEMORY.md",Pe=2e3,$e=s=>s.replace(/\.md$/,"");function Ht(s,t,n,l){var b,j,h;const m=new Map(((t==null?void 0:t.entries)??[]).map(a=>[a.name,a])),r=new Set(((b=t==null?void 0:t.index)==null?void 0:b.orphans)??[]),p=new Map;for(const a of(n==null?void 0:n.clusters)??[])for(const d of a.memberSlugs)p.has(d)||p.set(d,a.id);const f=s.filter(a=>a.name!==Vt),c=new Map;for(const a of f){const d=$e(a.name),u=((j=m.get(a.name))==null?void 0:j.outLinks)??((h=m.get(d))==null?void 0:h.outLinks)??[];for(const N of u){const C=$e(N),v=c.get(C)??[];v.includes(d)||v.push(d),c.set(C,v)}}return f.map(a=>{const d=$e(a.name),u=m.get(a.name)??m.get(d),N=(u==null?void 0:u.deadRefs)??[],C=(u==null?void 0:u.danglingLinks)??[],v=(u==null?void 0:u.stale)??!1;return{name:a.name,slug:d,path:a.path,description:(u==null?void 0:u.description)??"",bytes:a.bytes,mtimeMs:a.mtimeMs,ageDays:Math.floor((l-a.mtimeMs)/nt),stale:v,staleReasons:(u==null?void 0:u.reasons)??[],ageOnlyStale:v&&N.length===0,deadRefs:N,broken:N.length>0||C.length>0,danglingLinks:C,outLinks:(u==null?void 0:u.outLinks)??[],inLinks:c.get(d)??[],notIndexed:r.has(a.name)||r.has(d),clusterId:p.get(d)??null,type:(u==null?void 0:u.type)??null,originSessionId:(u==null?void 0:u.originSessionId)??null}})}function zt(s,t){const n=new Set(t.filter(l=>l.stale).map(l=>l.slug));return((s==null?void 0:s.clusters)??[]).map((l,m)=>({id:l.id,name:l.name,summary:l.summary,memberSlugs:l.memberSlugs,linkCount:l.links.length,retireCount:l.links.filter(r=>/retire/i.test(r.label??"")).length,staleCount:l.memberSlugs.filter(r=>n.has(r)).length,dotClass:_e[m%_e.length]}))}function at(s,t,n){const l=t.trim().toLowerCase(),m=l?s.filter(r=>r.slug.toLowerCase().includes(l)||r.description.toLowerCase().includes(l)):s;return n===void 0?m:m.slice(0,n)}function xe(s,t,n){let l;return t==="ask"||t==="clusters"||t==="archived"?[]:(t==="all"?l=s:t==="stale"?l=s.filter(m=>m.stale):t==="broken"?l=s.filter(m=>m.broken):t==="recent"?l=s.filter(m=>Date.now()-m.mtimeMs<=7*nt):t==="unindexed"?l=s.filter(m=>m.notIndexed):t==="cluster:unclustered"?l=s.filter(m=>m.clusterId===null):t.startsWith("cluster:")?l=s.filter(m=>m.clusterId===t.slice(8)):l=s,at(l,n))}function rt(s,t){const n=[...s];return t==="recent"?n.sort((l,m)=>m.mtimeMs-l.mtimeMs):t==="name"?n.sort((l,m)=>l.slug<m.slug?-1:l.slug>m.slug?1:0):n.sort((l,m)=>m.bytes-l.bytes),n}function Gt(s){return{all:s.length,stale:xe(s,"stale","").length,broken:xe(s,"broken","").length,recent:xe(s,"recent","").length,unindexed:xe(s,"unindexed","").length}}function ot(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"untitled_memory"}function Yt(s,t){const n=s===""?[]:s.split(`
1
+ import{aO as o,b7 as E,ay as e,a7 as W,ak as Lt,aS as Dt,aj as Tt,L as Rt,bh as Je,b8 as et,m as ve,bm as It,C as Ot,H as _t,bb as J}from"./index-rt7pTODX.js";import{V as Se}from"./ViewTabs-BCMYQwo_.js";import{S as de}from"./SourceChip-D-Imzszd.js";import{S as tt,M as Pt}from"./Library-1RpLT-aH.js";import{D as Ft}from"./DocumentEditorPane-C82c7Qtl.js";import{V as Bt}from"./VoiceButton-JzyC6DAB.js";import{Settings as Wt}from"./Settings-Clgqb3Lq.js";import{a as Kt,S as Ut}from"./Skills-DNG7tHSf.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-DtBUGvGI.js";import"./Panel-O8XPrpJu.js";import"./claude-settings-schema-COigsajx.js";import"./ListDetail-xr0oxNkv.js";import"./ProvenanceBadge-DSaizfZL.js";import"./Toggle-0Ff0bPa_.js";function st(s){return!s||!s.trim()?"default":s.replace(/[^a-zA-Z0-9]/g,"-")}const _e=["bg-accent","bg-sage-dark","bg-honey","bg-fg-dim","bg-fg-faint","bg-hive-teal","bg-butter","bg-delta-bad"],nt=864e5,Vt="MEMORY.md",Pe=2e3,$e=s=>s.replace(/\.md$/,"");function Ht(s,t,n,l){var b,j,h;const m=new Map(((t==null?void 0:t.entries)??[]).map(a=>[a.name,a])),r=new Set(((b=t==null?void 0:t.index)==null?void 0:b.orphans)??[]),p=new Map;for(const a of(n==null?void 0:n.clusters)??[])for(const d of a.memberSlugs)p.has(d)||p.set(d,a.id);const f=s.filter(a=>a.name!==Vt),c=new Map;for(const a of f){const d=$e(a.name),u=((j=m.get(a.name))==null?void 0:j.outLinks)??((h=m.get(d))==null?void 0:h.outLinks)??[];for(const N of u){const C=$e(N),v=c.get(C)??[];v.includes(d)||v.push(d),c.set(C,v)}}return f.map(a=>{const d=$e(a.name),u=m.get(a.name)??m.get(d),N=(u==null?void 0:u.deadRefs)??[],C=(u==null?void 0:u.danglingLinks)??[],v=(u==null?void 0:u.stale)??!1;return{name:a.name,slug:d,path:a.path,description:(u==null?void 0:u.description)??"",bytes:a.bytes,mtimeMs:a.mtimeMs,ageDays:Math.floor((l-a.mtimeMs)/nt),stale:v,staleReasons:(u==null?void 0:u.reasons)??[],ageOnlyStale:v&&N.length===0,deadRefs:N,broken:N.length>0||C.length>0,danglingLinks:C,outLinks:(u==null?void 0:u.outLinks)??[],inLinks:c.get(d)??[],notIndexed:r.has(a.name)||r.has(d),clusterId:p.get(d)??null,type:(u==null?void 0:u.type)??null,originSessionId:(u==null?void 0:u.originSessionId)??null}})}function zt(s,t){const n=new Set(t.filter(l=>l.stale).map(l=>l.slug));return((s==null?void 0:s.clusters)??[]).map((l,m)=>({id:l.id,name:l.name,summary:l.summary,memberSlugs:l.memberSlugs,linkCount:l.links.length,retireCount:l.links.filter(r=>/retire/i.test(r.label??"")).length,staleCount:l.memberSlugs.filter(r=>n.has(r)).length,dotClass:_e[m%_e.length]}))}function at(s,t,n){const l=t.trim().toLowerCase(),m=l?s.filter(r=>r.slug.toLowerCase().includes(l)||r.description.toLowerCase().includes(l)):s;return n===void 0?m:m.slice(0,n)}function xe(s,t,n){let l;return t==="ask"||t==="clusters"||t==="archived"?[]:(t==="all"?l=s:t==="stale"?l=s.filter(m=>m.stale):t==="broken"?l=s.filter(m=>m.broken):t==="recent"?l=s.filter(m=>Date.now()-m.mtimeMs<=7*nt):t==="unindexed"?l=s.filter(m=>m.notIndexed):t==="cluster:unclustered"?l=s.filter(m=>m.clusterId===null):t.startsWith("cluster:")?l=s.filter(m=>m.clusterId===t.slice(8)):l=s,at(l,n))}function rt(s,t){const n=[...s];return t==="recent"?n.sort((l,m)=>m.mtimeMs-l.mtimeMs):t==="name"?n.sort((l,m)=>l.slug<m.slug?-1:l.slug>m.slug?1:0):n.sort((l,m)=>m.bytes-l.bytes),n}function Gt(s){return{all:s.length,stale:xe(s,"stale","").length,broken:xe(s,"broken","").length,recent:xe(s,"recent","").length,unindexed:xe(s,"unindexed","").length}}function ot(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"untitled_memory"}function Yt(s,t){const n=s===""?[]:s.split(`
2
2
  `),l=t===""?[]:t.split(`
3
3
  `);if(n.length>Pe||l.length>Pe)return[...n.map(j=>({sign:"−",text:j})),...l.map(j=>({sign:"+",text:j}))];const m=n.length,r=l.length,p=Array.from({length:m+1},()=>new Array(r+1).fill(0));for(let j=m-1;j>=0;j--)for(let h=r-1;h>=0;h--)p[j][h]=n[j]===l[h]?p[j+1][h+1]+1:Math.max(p[j+1][h],p[j][h+1]);const f=[];let c=0,b=0;for(;c<m&&b<r;)n[c]===l[b]?(c++,b++):p[c+1][b]>=p[c][b+1]?f.push({sign:"−",text:n[c++]}):f.push({sign:"+",text:l[b++]});for(;c<m;)f.push({sign:"−",text:n[c++]});for(;b<r;)f.push({sign:"+",text:l[b++]});return f}const P=s=>s instanceof Error?s.message:String(s);function Fe(s){const t=/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(s);return t?{front:t[0],body:s.slice(t[0].length)}:{front:"",body:s}}function qt(s){return s.split(`
4
4
  `).map(t=>t.trim()).find(t=>t.length>0)??""}function Xt(s,t){const n=s.kind==="agent"?s.agent:null,l=n?`${n.name}|${n.memoryScope??""}`:"",m=n!==null&&n.memoryScope===null,r=o.useMemo(()=>m?null:n&&n.memoryScope?{agent:{name:n.name,scope:n.memoryScope},...t?{cwd:t}:{}}:{workspace:st(t),...t?{cwd:t}:{}},[l,m,t]),p=n===null,[f,c]=o.useState(!0),[b,j]=o.useState([]),[h,a]=o.useState(null),[d,u]=o.useState(null),[N,C]=o.useState(!1),[v,S]=o.useState(""),[R,K]=o.useState(!0),[te,ue]=o.useState([]),[q,A]=o.useState([]),[U,L]=o.useState({}),[pe,ke]=o.useState(()=>Date.now()),X=o.useRef(r);X.current=r;const I=o.useCallback(async()=>{if(!r){j([]),a(null),u(null),ue([]),S(""),c(!1);return}try{const g=await window.api.memory.list(r);if(X.current!==r)return;j(g.entries??[]),S(g.dir??""),K(g.autoMemoryEnabled!==!1),g.error&&E.error(`Memory list failed: ${g.error}`);const[x,k]=await Promise.all([window.api.memory.stale(r).catch(w=>(E.error(`Memory staleness check failed: ${P(w)}`),null)),window.api.memory.listArchived(r).catch(()=>({names:[],error:null}))]);if(X.current!==r)return;a(x),ue(k.names??[]),ke(Date.now())}catch(g){E.error(`Memory list failed: ${P(g)}`)}finally{c(!1)}},[r]);o.useEffect(()=>{c(!0),u(null),I(),r&&p&&r.workspace&&window.api.memory.aggregate(r.workspace,!1,t??void 0).then(g=>{X.current===r&&u(g)}).catch(g=>E.error(`Memory clusters failed: ${P(g)}`))},[I]),o.useEffect(()=>{let g=!1;return(async()=>{try{const{agents:x}=await window.api.memory.agents(t??void 0);if(g)return;A(x);const k={};await Promise.all(x.filter(w=>w.memoryScope).map(async w=>{const G=await window.api.memory.list({agent:{name:w.name,scope:w.memoryScope},...t?{cwd:t}:{}});k[w.name]=(G.entries??[]).filter(_=>_.name!=="MEMORY.md").length})),g||L(k)}catch(x){g||E.error(`Memory agents failed: ${P(x)}`)}})(),()=>{g=!0}},[t]),o.useEffect(()=>{if(!v)return;const g=v;window.api.config.watch([g]);const x=window.api.config.onChanged(({path:k})=>{(k===g||k.startsWith(g+"/"))&&I()});return()=>{x(),window.api.config.unwatch([g])}},[v,I]);const O=o.useMemo(()=>Ht(b,h,d,pe),[b,h,d,pe]),se=o.useMemo(()=>zt(d,O),[d,O]),Ne=o.useMemo(()=>({generatedAt:(d==null?void 0:d.generatedAt)??null,running:N}),[d,N]),D=o.useCallback(async g=>{if(!r)return null;try{const x=await window.api.memory.read(g,r);return x.error?(E.error(`Memory read failed: ${x.error}`),null):x.content}catch(x){return E.error(`Memory read failed: ${P(x)}`),null}},[r]),M=o.useCallback(async(g,x)=>{try{const k=await x();return k.ok?(await I(),!0):(E.error(`${g} failed: ${k.error??"unknown error"}`),!1)}catch(k){return E.error(`${g} failed: ${P(k)}`),!1}},[I]),Q=o.useCallback(async(g,x)=>{if(!r)return!1;const k=await D(g);if(k===null)return!1;const{front:w}=Fe(k);return M("Memory save",()=>window.api.memory.write(g,w+x,r))},[r,D,M]),V=o.useCallback(async(g,x)=>{if(!r)return null;const k=ot(g),w=qt(x);if(!await M("Memory create",()=>window.api.memory.create(k,w,r)))return null;const _=`---
@@ -1 +1 @@
1
- import{ad as P,bh as M,aO as x,ay as s,a7 as R,B as G,c as T}from"./index-Cznhnxhq.js";import{a as E,C as _,c as j,b as B}from"./Library-I37dQ6pB.js";const O=e=>`${e}/.claude/session-manager/provenance.json`;function I(e){if(!e||typeof e!="object")return{};const t={};for(const[n,o]of Object.entries(e))(o==="anthropic"||o==="community"||o==="local")&&(t[n]=o);return t}const D=P((e,t)=>({overrides:{},loaded:!1,loading:!1,home:null,load:async n=>{const o=t();if(!(o.home===n&&(o.loaded||o.loading))){e({home:n,loading:!0});try{const a=await window.api.config.readJson(O(n)),d=a.exists?I(a.data):{};e(h=>({overrides:{...d,...h.overrides},loaded:!0,loading:!1}))}catch{e({loaded:!0,loading:!1})}}},setOverride:async(n,o)=>{const a={...t().overrides};o===null?delete a[n]:a[n]=o,e({overrides:a});const d=t().home;if(d)try{await window.api.config.writeJson(O(d),a)}catch{}}})),i=e=>(e??"").toLowerCase().trim(),$=new Set,L=new Set;for(const e of B){const t=e.official?$:L;t.add(i(e.id)),t.add(i(e.name))}const K=new Set(j.filter(e=>e.official).flatMap(e=>[i(e.id),i(e.name)])),H=new Set(j.filter(e=>!e.official).flatMap(e=>[i(e.id),i(e.name)])),J=new Set(_.flatMap(e=>[i(e.id),i(e.name)])),V=new Set(E.flatMap(e=>[i(e.id),i(e.name)])),z=new Set(E.map(e=>e.command.trim())),U=new Set(["security-review","pr-comments","release-notes","add-dir","code-review","simplify"]),Z=/(@anthropic-ai\/|anthropic\.com|github\.com\/anthropics)/i,q=/(^|\s)(npx|uvx|pipx|bunx|mcp-remote|deno\s+run|docker\s+run)(\s|$)/i;function F(e){return[e.command,...e.args??[],e.url,e.repository,e.homepage].filter(Boolean).join(" ").toLowerCase()}const l=e=>({provenance:"anthropic",reason:e}),C=e=>({provenance:"community",reason:e});function Q(e,t,n){switch(e){case"mcp":return $.has(t)?l("official MCP server (catalog)"):L.has(t)?C("third-party server (catalog)"):null;case"skill":case"command":return K.has(t)?l("official Anthropic skill (catalog)"):H.has(t)?C("third-party skill (catalog)"):null;case"plugin":return null;case"subagent":return J.has(t)?l("bundled Anthropic subagent (catalog)"):null;case"hook":return V.has(t)||n&&z.has(n.trim())?l("bundled hook (catalog)"):null}}function W(e,t){return e.repository?"has a source repository":e.homepage?"has a homepage":e.url?"remote endpoint":q.test(t)?"installed from a package registry":null}function X(e){const t=i(e.name),n=F(e),o=Q(e.type,t,e.command);if(o)return o;if((e.type==="command"||e.type==="skill")&&U.has(t))return l("built-in Claude Code command");if(Z.test(n))return l("Anthropic package or repo");const a=W(e,n);return a?C(a):{provenance:"local",reason:"no external source — assumed self-created"}}function Y(e,t,n){return`${e}:${t??"-"}:${n}`}const c={anthropic:"Anthropic",community:"Community",local:"Local"},N={anthropic:"accent",community:"warn",local:"dim"},ee=["anthropic","community","local"];function oe({input:e,scope:t,interactive:n=!0,className:o=""}){const a=M(),{overrides:d,load:h,setOverride:k}=D(),[b,m]=x.useState(!1),v=x.useRef(null);x.useEffect(()=>{a&&h(a)},[a,h]),x.useEffect(()=>{if(!b)return;const r=w=>{v.current&&!v.current.contains(w.target)&&m(!1)},g=w=>{w.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",r),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("keydown",g)}},[b]);const y=Y(e.type,t??null,e.name),u=X(e),p=d[y],f=p??u.provenance,S=p?`Origin manually set to ${c[f]} — auto-detected ${c[u.provenance]} (${u.reason})`:`Auto-detected ${c[f]}: ${u.reason}`,A=s.jsxs(T,{tone:N[f],title:S,className:`${n?"cursor-pointer hover:brightness-125":""} ${o}`,children:[c[f],p&&s.jsx("span",{className:"w-1 h-1 rounded-full bg-current opacity-70","aria-hidden":!0})]});return n?s.jsxs("span",{ref:v,className:"relative inline-flex",children:[s.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),m(g=>!g)},className:"inline-flex","aria-label":`Origin: ${c[f]}. Click to change.`,children:A}),b&&s.jsxs("span",{className:`absolute ${R.dialog} top-full right-0 mt-1 min-w-[7.5rem] rounded-md border border-line bg-bg-elev shadow-lg py-1 text-left`,onClick:r=>r.stopPropagation(),children:[s.jsx("span",{className:"block px-2 pb-1 text-[10px] uppercase tracking-wide text-fg-faint",children:"Mark origin as"}),ee.map(r=>s.jsxs("button",{type:"button",onClick:()=>{k(y,r),m(!1)},className:`flex w-full items-center gap-2 px-2 py-1 text-[12px] hover:bg-bg-hi/60 ${f===r?"text-fg":"text-fg-dim"}`,children:[s.jsx("span",{className:`w-2 h-2 rounded-full border ${G[N[r]]}`,"aria-hidden":!0}),c[r],p===r&&s.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:"set"})]},r)),s.jsx("div",{className:"my-1 border-t border-line"}),s.jsxs("button",{type:"button",onClick:()=>{k(y,null),m(!1)},disabled:!p,className:"flex w-full items-center gap-2 px-2 py-1 text-[12px] text-fg-dim hover:bg-bg-hi/60 disabled:opacity-40 disabled:hover:bg-transparent",title:`Revert to auto-detection (${c[u.provenance]})`,children:["Auto-detect",s.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:c[u.provenance]})]})]})]}):A}export{c as P,oe as a,X as c,Y as p,D as u};
1
+ import{ad as P,bh as M,aO as x,ay as s,a7 as R,B as G,c as T}from"./index-rt7pTODX.js";import{a as E,C as _,c as j,b as B}from"./Library-1RpLT-aH.js";const O=e=>`${e}/.claude/session-manager/provenance.json`;function I(e){if(!e||typeof e!="object")return{};const t={};for(const[n,o]of Object.entries(e))(o==="anthropic"||o==="community"||o==="local")&&(t[n]=o);return t}const D=P((e,t)=>({overrides:{},loaded:!1,loading:!1,home:null,load:async n=>{const o=t();if(!(o.home===n&&(o.loaded||o.loading))){e({home:n,loading:!0});try{const a=await window.api.config.readJson(O(n)),d=a.exists?I(a.data):{};e(h=>({overrides:{...d,...h.overrides},loaded:!0,loading:!1}))}catch{e({loaded:!0,loading:!1})}}},setOverride:async(n,o)=>{const a={...t().overrides};o===null?delete a[n]:a[n]=o,e({overrides:a});const d=t().home;if(d)try{await window.api.config.writeJson(O(d),a)}catch{}}})),i=e=>(e??"").toLowerCase().trim(),$=new Set,L=new Set;for(const e of B){const t=e.official?$:L;t.add(i(e.id)),t.add(i(e.name))}const K=new Set(j.filter(e=>e.official).flatMap(e=>[i(e.id),i(e.name)])),H=new Set(j.filter(e=>!e.official).flatMap(e=>[i(e.id),i(e.name)])),J=new Set(_.flatMap(e=>[i(e.id),i(e.name)])),V=new Set(E.flatMap(e=>[i(e.id),i(e.name)])),z=new Set(E.map(e=>e.command.trim())),U=new Set(["security-review","pr-comments","release-notes","add-dir","code-review","simplify"]),Z=/(@anthropic-ai\/|anthropic\.com|github\.com\/anthropics)/i,q=/(^|\s)(npx|uvx|pipx|bunx|mcp-remote|deno\s+run|docker\s+run)(\s|$)/i;function F(e){return[e.command,...e.args??[],e.url,e.repository,e.homepage].filter(Boolean).join(" ").toLowerCase()}const l=e=>({provenance:"anthropic",reason:e}),C=e=>({provenance:"community",reason:e});function Q(e,t,n){switch(e){case"mcp":return $.has(t)?l("official MCP server (catalog)"):L.has(t)?C("third-party server (catalog)"):null;case"skill":case"command":return K.has(t)?l("official Anthropic skill (catalog)"):H.has(t)?C("third-party skill (catalog)"):null;case"plugin":return null;case"subagent":return J.has(t)?l("bundled Anthropic subagent (catalog)"):null;case"hook":return V.has(t)||n&&z.has(n.trim())?l("bundled hook (catalog)"):null}}function W(e,t){return e.repository?"has a source repository":e.homepage?"has a homepage":e.url?"remote endpoint":q.test(t)?"installed from a package registry":null}function X(e){const t=i(e.name),n=F(e),o=Q(e.type,t,e.command);if(o)return o;if((e.type==="command"||e.type==="skill")&&U.has(t))return l("built-in Claude Code command");if(Z.test(n))return l("Anthropic package or repo");const a=W(e,n);return a?C(a):{provenance:"local",reason:"no external source — assumed self-created"}}function Y(e,t,n){return`${e}:${t??"-"}:${n}`}const c={anthropic:"Anthropic",community:"Community",local:"Local"},N={anthropic:"accent",community:"warn",local:"dim"},ee=["anthropic","community","local"];function oe({input:e,scope:t,interactive:n=!0,className:o=""}){const a=M(),{overrides:d,load:h,setOverride:k}=D(),[b,m]=x.useState(!1),v=x.useRef(null);x.useEffect(()=>{a&&h(a)},[a,h]),x.useEffect(()=>{if(!b)return;const r=w=>{v.current&&!v.current.contains(w.target)&&m(!1)},g=w=>{w.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",r),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("keydown",g)}},[b]);const y=Y(e.type,t??null,e.name),u=X(e),p=d[y],f=p??u.provenance,S=p?`Origin manually set to ${c[f]} — auto-detected ${c[u.provenance]} (${u.reason})`:`Auto-detected ${c[f]}: ${u.reason}`,A=s.jsxs(T,{tone:N[f],title:S,className:`${n?"cursor-pointer hover:brightness-125":""} ${o}`,children:[c[f],p&&s.jsx("span",{className:"w-1 h-1 rounded-full bg-current opacity-70","aria-hidden":!0})]});return n?s.jsxs("span",{ref:v,className:"relative inline-flex",children:[s.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),m(g=>!g)},className:"inline-flex","aria-label":`Origin: ${c[f]}. Click to change.`,children:A}),b&&s.jsxs("span",{className:`absolute ${R.dialog} top-full right-0 mt-1 min-w-[7.5rem] rounded-md border border-line bg-bg-elev shadow-lg py-1 text-left`,onClick:r=>r.stopPropagation(),children:[s.jsx("span",{className:"block px-2 pb-1 text-[10px] uppercase tracking-wide text-fg-faint",children:"Mark origin as"}),ee.map(r=>s.jsxs("button",{type:"button",onClick:()=>{k(y,r),m(!1)},className:`flex w-full items-center gap-2 px-2 py-1 text-[12px] hover:bg-bg-hi/60 ${f===r?"text-fg":"text-fg-dim"}`,children:[s.jsx("span",{className:`w-2 h-2 rounded-full border ${G[N[r]]}`,"aria-hidden":!0}),c[r],p===r&&s.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:"set"})]},r)),s.jsx("div",{className:"my-1 border-t border-line"}),s.jsxs("button",{type:"button",onClick:()=>{k(y,null),m(!1)},disabled:!p,className:"flex w-full items-center gap-2 px-2 py-1 text-[12px] text-fg-dim hover:bg-bg-hi/60 disabled:opacity-40 disabled:hover:bg-transparent",title:`Revert to auto-detection (${c[u.provenance]})`,children:["Auto-detect",s.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:c[u.provenance]})]})]})]}):A}export{c as P,oe as a,X as c,Y as p,D as u};