claude-code-session-manager 0.81.0 → 0.82.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 (34) hide show
  1. package/dist/assets/{AgentLibrary-psZYVM2w.js → AgentLibrary-pwlkAFb3.js} +1 -1
  2. package/dist/assets/{DataModel-BMied5pg.js → DataModel-BZK9PXFD.js} +1 -1
  3. package/dist/assets/{History-BFC0oaKc.js → History-BVRjxJjS.js} +1 -1
  4. package/dist/assets/{Hooks-CTLfO9G8.js → Hooks-CNuwHeGx.js} +1 -1
  5. package/dist/assets/{HostBilko-D4I0Cpwn.js → HostBilko-cjwNodhV.js} +1 -1
  6. package/dist/assets/{Library-BTzS8KsS.js → Library-YPNm9W92.js} +1 -1
  7. package/dist/assets/{ListDetail-CuRmT008.js → ListDetail-CY4GM1Om.js} +1 -1
  8. package/dist/assets/{MarkdownEditor-BgQGtvWo.js → MarkdownEditor-BF4y2Jiz.js} +1 -1
  9. package/dist/assets/{McpServers-DiVQUK57.js → McpServers-CmBdWtX_.js} +1 -1
  10. package/dist/assets/{Memory-DSu15JmL.js → Memory-CvkIXNl1.js} +1 -1
  11. package/dist/assets/{Panel-CD5wxGSR.js → Panel-D93o-sxe.js} +1 -1
  12. package/dist/assets/{Permissions-C_tAE6yJ.js → Permissions-DQipg16I.js} +1 -1
  13. package/dist/assets/{Plugins-kwI7W-eK.js → Plugins-B6NwzPfK.js} +2 -2
  14. package/dist/assets/{ProvenanceBadge-CQceOgsH.js → ProvenanceBadge-DACVJhrB.js} +1 -1
  15. package/dist/assets/{SaveBar-BDk5e3Pp.js → SaveBar-Cg4lbChb.js} +1 -1
  16. package/dist/assets/{Scheduler-DRnvEYzv.js → Scheduler-Dr5ZcBLe.js} +1 -1
  17. package/dist/assets/{ScopeSwitcher-CeifaOlq.js → ScopeSwitcher-C-locvy0.js} +1 -1
  18. package/dist/assets/{Settings-BWQ1Utop.js → Settings-BVrAle90.js} +1 -1
  19. package/dist/assets/{SkillReferenceGraph-CW6e1SW1.js → SkillReferenceGraph-DDzuYgSK.js} +1 -1
  20. package/dist/assets/{Skills-BLwFB0E4.js → Skills-DFvhiOAQ.js} +1 -1
  21. package/dist/assets/{SystemPrompt-DC4ZTArJ.js → SystemPrompt-8PiTyUyL.js} +1 -1
  22. package/dist/assets/{TagLibrary-pMeGfjUb.js → TagLibrary-DruUYaAc.js} +1 -1
  23. package/dist/assets/{TiptapBody-BHFid2pZ.js → TiptapBody-Dr4a--42.js} +1 -1
  24. package/dist/assets/{Toggle-D9eYoZh4.js → Toggle-B_EH2TFb.js} +1 -1
  25. package/dist/assets/{index-CuyM9vAP.js → index-DApB4DHS.js} +3 -3
  26. package/dist/assets/{settingsSchema-DrxC67uZ.js → settingsSchema-BKa-xk8g.js} +1 -1
  27. package/dist/index.html +1 -1
  28. package/package.json +1 -1
  29. package/src/main/__tests__/machineProfile.test.cjs +134 -0
  30. package/src/main/__tests__/scheduler-periodic-reverify-guard.test.cjs +85 -0
  31. package/src/main/__tests__/telemetrySettings.test.cjs +178 -0
  32. package/src/main/lib/machineProfile.cjs +144 -0
  33. package/src/main/lib/telemetrySettings.cjs +171 -0
  34. package/src/main/scheduler.cjs +27 -3
@@ -1,2 +1,2 @@
1
- import{a7 as e,ag as c,aw as oe,ar as ie,ay as ce,at as N,j as O,b as Q,aq as q}from"./index-CuyM9vAP.js";import{P as $}from"./Panel-CD5wxGSR.js";import{L as de}from"./ListDetail-CuRmT008.js";import{S as xe}from"./SaveBar-BDk5e3Pp.js";import{S as Y}from"./ScopeSwitcher-CeifaOlq.js";import{P as G}from"./ProvenanceBadge-CQceOgsH.js";import{M as ue,V as D}from"./Library-BTzS8KsS.js";import"./monaco-editor-BW5C4Iv1.js";const pe={live:"bg-emerald-400",idle:"bg-amber-400",offline:"bg-fg-faint",attention:"bg-accent",paused:"bg-zinc-500"},fe={sm:"w-1.5 h-1.5",md:"w-2 h-2"},me={on:"live",off:"offline",warn:"attention",live:"live",idle:"idle"};function W({state:n,kind:t,pulse:a=!1,size:d="sm",className:p="",title:b,"aria-label":o}){const j=n??(t?me[t]:"idle"),r=pe[j],h=fe[d],x=a?"animate-pulse":"",u=o??b??j;return e.jsx("span",{role:"img","aria-label":u,className:`inline-block rounded-full ${h} ${r} ${x} ${p}`.trim(),title:b})}const ge={failed:"Failed","needs-auth":"Needs auth",pending:"Pending approval"};function H(n,t){const a=t!=null&&t.ok?t.servers.find(d=>d.name===n):void 0;return!a||a.status==="unknown"?{state:"unprobed",label:"Not checked",probeStatus:(a==null?void 0:a.status)??null,badgeTone:"dim",dotState:"offline"}:a.status==="connected"?{state:"ready",label:"Ready",probeStatus:a.status,badgeTone:"good",dotState:"live"}:{state:"not-ready",label:ge[a.status],probeStatus:a.status,badgeTone:"warn",dotState:"attention"}}const U=(n,t)=>({type:"mcp",name:n,command:t.command,args:t.args,url:t.url}),he=["stdio","http","streamable-http","sse","ws"],be=new Set(["workspace"]),je=new Set(["ide","tasks"]);function ve(n,t,a){return n==="user"?`${t}/.claude.json`:a?`${a}/.mcp.json`:null}function ye(n){if(n.trim()==="")return{full:{},servers:{},err:null};try{const t=JSON.parse(n),a=t.mcpServers??{};return{full:t,servers:a,err:null}}catch(t){return{full:{},servers:{},err:t.message}}}function Ne(n,t){return JSON.stringify({...n,mcpServers:t},null,2)+`
1
+ import{a7 as e,ag as c,aw as oe,ar as ie,ay as ce,at as N,j as O,b as Q,aq as q}from"./index-DApB4DHS.js";import{P as $}from"./Panel-D93o-sxe.js";import{L as de}from"./ListDetail-CY4GM1Om.js";import{S as xe}from"./SaveBar-Cg4lbChb.js";import{S as Y}from"./ScopeSwitcher-C-locvy0.js";import{P as G}from"./ProvenanceBadge-DACVJhrB.js";import{M as ue,V as D}from"./Library-YPNm9W92.js";import"./monaco-editor-BW5C4Iv1.js";const pe={live:"bg-emerald-400",idle:"bg-amber-400",offline:"bg-fg-faint",attention:"bg-accent",paused:"bg-zinc-500"},fe={sm:"w-1.5 h-1.5",md:"w-2 h-2"},me={on:"live",off:"offline",warn:"attention",live:"live",idle:"idle"};function W({state:n,kind:t,pulse:a=!1,size:d="sm",className:p="",title:b,"aria-label":o}){const j=n??(t?me[t]:"idle"),r=pe[j],h=fe[d],x=a?"animate-pulse":"",u=o??b??j;return e.jsx("span",{role:"img","aria-label":u,className:`inline-block rounded-full ${h} ${r} ${x} ${p}`.trim(),title:b})}const ge={failed:"Failed","needs-auth":"Needs auth",pending:"Pending approval"};function H(n,t){const a=t!=null&&t.ok?t.servers.find(d=>d.name===n):void 0;return!a||a.status==="unknown"?{state:"unprobed",label:"Not checked",probeStatus:(a==null?void 0:a.status)??null,badgeTone:"dim",dotState:"offline"}:a.status==="connected"?{state:"ready",label:"Ready",probeStatus:a.status,badgeTone:"good",dotState:"live"}:{state:"not-ready",label:ge[a.status],probeStatus:a.status,badgeTone:"warn",dotState:"attention"}}const U=(n,t)=>({type:"mcp",name:n,command:t.command,args:t.args,url:t.url}),he=["stdio","http","streamable-http","sse","ws"],be=new Set(["workspace"]),je=new Set(["ide","tasks"]);function ve(n,t,a){return n==="user"?`${t}/.claude.json`:a?`${a}/.mcp.json`:null}function ye(n){if(n.trim()==="")return{full:{},servers:{},err:null};try{const t=JSON.parse(n),a=t.mcpServers??{};return{full:t,servers:a,err:null}}catch(t){return{full:{},servers:{},err:t.message}}}function Ne(n,t){return JSON.stringify({...n,mcpServers:t},null,2)+`
2
2
  `}function we(n){let t=Object.keys(n).length+1,a=`server-${t}`;for(;n[a];)t+=1,a=`server-${t}`;return a}function Se(){const n=oe(),t=ie(),a=(t==null?void 0:t.cwd)??null,d=ce(s=>s.navFace),p=c.useRef(!1),b=c.useRef(d),[o,j]=c.useState(()=>d==="project"&&a?"project":"user"),[r,h]=c.useState(null),[x,u]=c.useState("installed"),[w,_]=c.useState("");c.useEffect(()=>{if(b.current!==d){if(b.current=d,p.current){p.current=!1;return}j(d==="project"&&a?"project":"user")}},[d,a]);const f=c.useMemo(()=>n?ve(o,n,a):null,[n,o,a]),k=N(s=>s.files),l=N(s=>s.loadJson),v=N(s=>s.setDraft),m=N(s=>s.saveJson),I=N(s=>s.revert),T=N(s=>s.watchFile),X=N(s=>s.unwatchFile);c.useEffect(()=>{if(f)return k[f]||l(f),T(f),()=>X(f)},[f]);const[ee,R]=c.useState(null),[J,z]=c.useState(null),[B,K]=c.useState(!1),F=c.useRef(0),A=c.useRef(!0);c.useEffect(()=>()=>{A.current=!1},[]);const V=async()=>{const s=++F.current;K(!0);try{const i=await window.api.mcp.status();if(!A.current||s!==F.current)return;z(i),i.ok||q.error(i.error??"MCP status probe failed")}catch(i){if(!A.current||s!==F.current)return;z(null),q.error(i.message||"MCP status probe failed")}finally{A.current&&s===F.current&&K(!1)}};if(c.useEffect(()=>{V()},[]),!n)return e.jsx(O,{title:"loading…"});if(x==="library")return e.jsx($,{toolbar:e.jsx(D,{active:x,onChange:u}),children:e.jsx(ue,{})});if(o==="project"&&!a)return e.jsx($,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(D,{active:x,onChange:u}),e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx(Y,{scopes:["user","project"],active:o,onChange:s=>{p.current=!0,j(s)}})]}),children:e.jsx(O,{title:"no active project"})});if(!f)return e.jsx(O,{title:"loading…"});const y=k[f],{full:te,servers:g,err:se}=y?ye(y.draftRaw):{full:{},servers:{},err:null},L=Object.keys(g).sort(),M=r?g[r]:null,P=s=>{R(null),v(f,Ne(te,s))},ae=()=>{const s=we(g);P({...g,[s]:{type:"stdio",command:"",args:[]}}),h(s)},le=s=>{const i={...g};delete i[s],P(i),r===s&&h(null)},ne=(s,i)=>{if(!i||i===s||g[i])return;const S={};for(const C of Object.keys(g))S[C===s?i:C]=g[C];P(S),h(i)},re=(s,i)=>{P({...g,[s]:i})};return e.jsx($,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(D,{active:x,onChange:u}),e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx(Y,{scopes:["user","project"],active:o,onChange:s=>{p.current=!0,j(s)}}),e.jsxs("span",{className:"ml-3 px-1.5 py-0.5 text-[10px] rounded border border-line text-fg-faint",children:[L.length," server",L.length===1?"":"s"]}),e.jsx("span",{className:"ml-2 text-fg-faint truncate",children:f}),e.jsx("div",{className:"flex-1"}),r&&M&&e.jsx(G,{scope:o,input:U(r,M),className:"mr-2"}),e.jsx("button",{onClick:V,disabled:B,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-50 mr-2",children:B?"checking…":"⟳ test connections"}),e.jsx("button",{onClick:ae,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"+ new server"})]}),footer:y?e.jsx(xe,{dirty:y.dirty,busy:y.busy,parseError:ee||se||y.parseError,lastSavedAt:y.lastSavedAt,onSave:async()=>{R(null);const s=await m(f);s.ok||R(s.error??"save failed")},onRevert:()=>{R(null),I(f)}}):null,children:e.jsx(de,{sidebar:e.jsxs("div",{className:"py-2",children:[e.jsx("div",{className:"px-2 pb-1",children:e.jsx("input",{value:w,onChange:s=>_(s.target.value),placeholder:"filter…",className:"w-full bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"})}),L.length===0?e.jsx("div",{className:"px-3 py-1 text-xs text-fg-faint italic",children:"no servers"}):L.filter(s=>!w||s.toLowerCase().includes(w.toLowerCase())).map(s=>{var C;const i=H(s,J),S=(C=g[s].description)==null?void 0:C.trim();return e.jsxs("button",{onClick:()=>h(s),className:`w-full text-left px-3 py-1 text-xs flex flex-col gap-0.5 ${r===s?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsxs("span",{className:"flex items-center gap-2 justify-between w-full",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(W,{state:i.dotState,title:i.label}),e.jsx("span",{className:"truncate",children:s})]}),e.jsxs("span",{className:"ml-2 flex items-center gap-2 shrink-0",children:[e.jsx(Q,{tone:i.badgeTone,children:i.label}),e.jsx(G,{interactive:!1,scope:o,input:U(s,g[s])}),e.jsx("span",{className:"text-fg-faint",children:g[s].type??"stdio"})]})]}),S?e.jsx("span",{className:"pl-5 text-fg-faint truncate",title:S,children:S}):null]},s)})]}),detail:r&&M?e.jsx(Ce,{name:r,server:M,connection:H(r,J),onTestConnection:V,testing:B,onRename:s=>ne(r,s),onChange:s=>re(r,s),onRemove:()=>le(r)}):e.jsx(O,{title:"select a server or click + new"})})})}const Pe=c.memo(Se);function Ce({name:n,server:t,connection:a,onTestConnection:d,testing:p,onRename:b,onChange:o,onRemove:j}){var k;const r=t.type??"stdio",h=be.has(n),x=je.has(n),u=(k=t.permissions)==null?void 0:k.tools,w=u===void 0?"inherit":u==="allow"?"allow":u==="deny"?"deny":"list",_=Array.isArray(u)?u:[],f=(t.disabledTools??[]).join(", ");return e.jsxs("div",{className:"p-4 space-y-4 max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{state:a.dotState,size:"md",title:a.label}),e.jsx(Q,{tone:a.badgeTone,children:a.label}),e.jsx("button",{onClick:d,disabled:p,className:"ml-auto px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-50",children:p?"checking…":"test connection"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"name"}),e.jsx("input",{defaultValue:n,onBlur:l=>b(l.target.value.trim()),className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"}),e.jsx("button",{onClick:j,className:"text-xs text-fg-faint hover:text-red-400 px-2 py-1 border border-line rounded",children:"delete"})]}),e.jsx(E,{label:"description",value:t.description??"",onChange:l=>o({...t,description:l||void 0}),placeholder:"what this server does…"}),h?e.jsxs("div",{className:"text-xs px-2 py-1 border border-red-500/50 rounded text-red-300 bg-red-500/5",children:["⚠ ",e.jsx("span",{className:"font-mono",children:n})," is a reserved name — Claude Code will refuse to load this server (v2.1.128+)."]}):x?e.jsxs("div",{className:"text-xs px-2 py-1 border border-yellow-600/50 rounded text-yellow-200 bg-yellow-500/5",children:["⚠ ",e.jsx("span",{className:"font-mono",children:n})," collides with a commonly-bundled MCP name; expect surprises in other tools."]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"type"}),e.jsx("select",{value:r,onChange:l=>o({...t,type:l.target.value}),className:"bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg",children:he.map(l=>e.jsx("option",{value:l,children:l},l))}),r==="sse"?e.jsx("span",{className:"text-xs text-yellow-400/80",children:"sse is deprecated — prefer streamable-http"}):null]}),r==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(E,{label:"command",value:t.command??"",onChange:l=>o({...t,command:l}),placeholder:"npx / node / python …"}),e.jsx(E,{label:"args",value:(t.args??[]).join(" "),onChange:l=>o({...t,args:l.split(/\s+/).filter(Boolean)}),placeholder:"space-separated args"}),e.jsx(Z,{label:"env",value:t.env??{},onChange:l=>o({...t,env:l})})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{label:"url",value:t.url??"",onChange:l=>o({...t,url:l}),placeholder:"https://…"}),e.jsx(Z,{label:"headers",value:t.headers??{},onChange:l=>o({...t,headers:l})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"alwaysLoad"}),e.jsxs("label",{className:"flex items-center gap-2 text-xs text-fg",children:[e.jsx("input",{type:"checkbox",checked:t.alwaysLoad===!0,onChange:l=>o({...t,alwaysLoad:l.target.checked||void 0})}),e.jsx("span",{className:"text-fg-dim",children:"bypass tool-search deferral (v2.1.121+)"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"enabled"}),e.jsxs("label",{className:"flex items-center gap-2 text-xs text-fg",children:[e.jsx("input",{type:"checkbox",checked:t.enabled!==!1,onChange:l=>o({...t,enabled:l.target.checked?void 0:!1})}),e.jsx("span",{className:"text-fg-dim",children:"load this server in new sessions"})]})]}),e.jsx(E,{label:"disabledTools",value:f,onChange:l=>{const v=l.split(",").map(m=>m.trim()).filter(Boolean);o({...t,disabledTools:v.length?v:void 0})},placeholder:"comma-separated tool names to hide"}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20 pt-1",children:"permissions"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("select",{value:w,onChange:l=>{const v=l.target.value,m={...t};if(v==="inherit"){if(m.permissions){const{tools:I,...T}=m.permissions;m.permissions=Object.keys(T).length?T:void 0}}else v==="list"?m.permissions={...m.permissions??{},tools:[]}:m.permissions={...m.permissions??{},tools:v};o(m)},className:"bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg",children:[e.jsx("option",{value:"inherit",children:"inherit (default)"}),e.jsx("option",{value:"allow",children:"allow all tools"}),e.jsx("option",{value:"deny",children:"deny all tools"}),e.jsx("option",{value:"list",children:"allowlist…"})]}),w==="list"?e.jsx("input",{value:_.join(", "),onChange:l=>{const v=l.target.value.split(",").map(m=>m.trim()).filter(Boolean);o({...t,permissions:{...t.permissions??{},tools:v}})},placeholder:"comma-separated tool names",className:"w-full bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"}):null]})]})]})}function E({label:n,value:t,onChange:a,placeholder:d}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:n}),e.jsx("input",{value:t,onChange:p=>a(p.target.value),placeholder:d,className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"})]})}function Z({label:n,value:t,onChange:a}){const[d,p]=c.useState(""),[b,o]=c.useState(""),j=Object.entries(t);return e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20 pt-1",children:n}),e.jsxs("div",{className:"flex-1 space-y-1",children:[j.map(([r,h])=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:r,onChange:x=>{const u={...t};delete u[r],u[x.target.value]=h,a(u)},className:"w-32 bg-bg-elev border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("input",{value:h,onChange:x=>a({...t,[r]:x.target.value}),className:"flex-1 bg-bg-elev border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("button",{onClick:()=>{const x={...t};delete x[r],a(x)},className:"text-fg-faint hover:text-red-400 text-xs px-1",children:"×"})]},r)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:d,onChange:r=>p(r.target.value),placeholder:"key",className:"w-32 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg-dim font-mono"}),e.jsx("input",{value:b,onChange:r=>o(r.target.value),placeholder:"value",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg-dim font-mono"}),e.jsx("button",{onClick:()=>{d.trim()&&(a({...t,[d.trim()]:b}),p(""),o(""))},className:"px-2 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"+"})]})]})]})}export{Pe as McpServers,we as nextServerName};
@@ -1,4 +1,4 @@
1
- import{aw as Y,ar as I,ag as l,aq as A,a7 as e,j as F,z as oe,X as H,K as le,a0 as K,V as J}from"./index-CuyM9vAP.js";import{P as ee}from"./Panel-CD5wxGSR.js";import{L as te}from"./ListDetail-CuRmT008.js";import{M as se}from"./MarkdownEditor-BgQGtvWo.js";import"./monaco-editor-BW5C4Iv1.js";function ie(t){return!t||!t.trim()?"default":t.replace(/[^a-zA-Z0-9]/g,"-")}const re=/^[a-z0-9-_]+$/;function ce(t,o,r,i){return t.filter(m=>!o||m.name.toLowerCase().includes(o.toLowerCase())).filter(m=>{var s;return!r||((s=i[m.name])==null?void 0:s.stale)===!0})}const de=["Commands:"," list — show all memory entries"," show <slug> — read one entry"," search <text> — find entries containing <text>"," forget <slug> — delete an entry (with confirm)"," remember <free-form> — ask Claude to save this"," help — this message","","Anything else: I will offer to send it to Claude in the terminal,","or add it as a new memory entry directly."].join(`
1
+ import{aw as Y,ar as I,ag as l,aq as A,a7 as e,j as F,z as oe,X as H,K as le,a0 as K,V as J}from"./index-DApB4DHS.js";import{P as ee}from"./Panel-D93o-sxe.js";import{L as te}from"./ListDetail-CY4GM1Om.js";import{M as se}from"./MarkdownEditor-BF4y2Jiz.js";import"./monaco-editor-BW5C4Iv1.js";function ie(t){return!t||!t.trim()?"default":t.replace(/[^a-zA-Z0-9]/g,"-")}const re=/^[a-z0-9-_]+$/;function ce(t,o,r,i){return t.filter(m=>!o||m.name.toLowerCase().includes(o.toLowerCase())).filter(m=>{var s;return!r||((s=i[m.name])==null?void 0:s.stale)===!0})}const de=["Commands:"," list — show all memory entries"," show <slug> — read one entry"," search <text> — find entries containing <text>"," forget <slug> — delete an entry (with confirm)"," remember <free-form> — ask Claude to save this"," help — this message","","Anything else: I will offer to send it to Claude in the terminal,","or add it as a new memory entry directly."].join(`
2
2
  `);function me(t){const o=t.trim();if(!o)return{kind:"freeform",arg:"",raw:t};const r=o.toLowerCase();if(r==="help"||r==="?")return{kind:"help",arg:"",raw:t};if(r==="list"||r==="ls"||r==="list memories"||r==="list all"||r==="what do you remember"||r==="what do you remember?")return{kind:"list",arg:"",raw:t};const i=o.match(/^(?:show|read|open)\s+(.+)$/i);if(i)return{kind:"show",arg:i[1].trim(),raw:t};const m=o.match(/^(?:forget|delete|remove)\s+(.+)$/i);if(m)return{kind:"forget",arg:m[1].trim(),raw:t};const s=o.match(/^(?:search|find)\s+(.+)$/i)||o.match(/^what (?:do )?you know about\s+(.+?)\??$/i);if(s)return{kind:"search",arg:s[1].trim(),raw:t};const f=o.match(/^remember(?:\s+that)?\s+(.+)$/i)||o.match(/^note(?:\s+that)?\s+(.+)$/i)||o.match(/^save(?:\s+that)?\s+(.+)$/i);return f?{kind:"remember",arg:f[1].trim(),raw:t}:{kind:"freeform",arg:o,raw:t}}function G(t,o){const r=t.toLowerCase().replace(/\.md$/,""),i=o.find(f=>f.name.replace(/\.md$/,"").toLowerCase()===r);if(i)return i;const m=o.filter(f=>f.name.replace(/\.md$/,"").toLowerCase().startsWith(r));if(m.length===1)return m[0];const s=o.filter(f=>f.name.replace(/\.md$/,"").toLowerCase().includes(r));return s.length===1?s[0]:null}function Z(t){const o=new Set(["the","a","an","is","are","to","of","in","for","and","or"]);return t.toLowerCase().replace(/[^a-z0-9\s-]/g," ").split(/\s+/).filter(m=>m&&!o.has(m)).slice(0,4).join("-").replace(/-+/g,"-").replace(/^-|-$/g,"")||`note-${Date.now().toString(36).slice(-4)}`}function X(t,o){return[`Please save this to my workspace memory (workspace: ${t}).`,`Use the memory tool (or write a markdown file under ~/.claude/projects/${t}/memory/).`,"Pick a short kebab-case filename and add a one-line title at the top.","","Memory to save:",o].join(`
3
3
  `)}function Q(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function xe({workspace:t,entries:o,onChanged:r}){const i=Y(),m=I(),s=(m==null?void 0:m.id)??null,[f,u]=l.useState(""),[c,b]=l.useState(()=>[{id:Q(),role:"system",text:"Hi — I am the memory assistant for this workspace. Type `help` for what I understand, or just talk to me."}]),[C,g]=l.useState(!1),N=l.useRef(null),$=l.useRef(null);l.useEffect(()=>{const a=N.current;a&&(a.scrollTop=a.scrollHeight)},[c]);const x=l.useCallback(a=>{b(p=>[...p,{...a,id:Q()}])},[]),S=l.useCallback(()=>{if(o.length===0){x({role:"result",text:"No memories saved for this workspace yet."});return}x({role:"result",text:`Found ${o.length} ${o.length===1?"memory":"memories"}:`,payload:{kind:"entries",entries:o}})},[o,x]),T=l.useCallback(async a=>{const p=G(a,o);if(!p){x({role:"result",text:`No memory matches "${a}". Try \`list\` to see what is here.`});return}const y=await window.api.memory.read(p.name,t);if(y.error){A.error(`Memory read failed: ${y.error}`),x({role:"result",text:`Read failed: ${y.error}`});return}x({role:"result",text:`${p.name}`,payload:{kind:"entry",entry:p,content:y.content}})},[o,t,x]),B=l.useCallback(async a=>{const p=a.toLowerCase(),y=o.filter(k=>k.name.toLowerCase().includes(p)),O=[];for(const k of o){if(y.includes(k))continue;const L=await window.api.memory.read(k.name,t);if(L.error)continue;const d=L.content.split(`
4
4
  `),h=d.findIndex(v=>v.toLowerCase().includes(p));h>=0&&O.push({entry:k,snippet:d[h].trim().slice(0,200)})}const n=[...y.map(k=>({entry:k,snippet:"(filename match)"})),...O];if(n.length===0){x({role:"result",text:`No matches for "${a}".`});return}x({role:"result",text:`Found ${n.length} ${n.length===1?"match":"matches"} for "${a}":`,payload:{kind:"search",query:a,hits:n}})},[o,t,x]),D=l.useCallback(async a=>{const p=G(a,o);if(!p){x({role:"result",text:`No memory matches "${a}". Try \`list\` to see what is here.`});return}if(!window.confirm(`Delete memory "${p.name}"? This cannot be undone.`))return;const y=await window.api.memory.delete(p.name,t);if(!y.ok){A.error(`Memory delete failed: ${y.error??"unknown error"}`),x({role:"result",text:`Delete failed: ${y.error??"unknown error"}`});return}x({role:"result",text:`Deleted ${p.name}.`}),r()},[o,t,x,r]),w=l.useCallback(a=>{const p=Z(a),y=X(t,a);x({role:"result",text:"I do not write to memory from this panel. Send the request to Claude in the active terminal, or add it directly as a new memory entry below.",payload:{kind:"suggest-send",prompt:y,original:a}}),x({role:"result",text:`Add it directly as \`${p}.md\` instead?`,payload:{kind:"suggest-add",slug:p,content:a}})},[t,x]),_=l.useCallback(a=>{const p=Z(a),y=X(t,a);x({role:"result",text:"Not a recognised command. Options:",payload:{kind:"suggest-send",prompt:y,original:a}}),x({role:"result",text:`…or save it directly as \`${p}.md\`.`,payload:{kind:"suggest-add",slug:p,content:a}})},[t,x]),M=l.useCallback(async a=>{g(!0);try{switch(a.kind){case"list":S();break;case"show":await T(a.arg);break;case"search":await B(a.arg);break;case"forget":await D(a.arg);break;case"help":x({role:"result",text:de});break;case"remember":w(a.arg);break;case"freeform":_(a.arg);break}}finally{g(!1)}},[S,T,B,D,w,_,x]),R=l.useCallback(async()=>{const a=f.trim();!a||C||(u(""),x({role:"user",text:a}),await M(me(a)))},[f,C,M,x]),j=a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),R())},E=l.useCallback(a=>{if(!s){A.error("No active terminal session — open or focus a tab first.");return}window.api.pty.write({tabId:s,data:a}),A.info("Prompt sent to active terminal (not submitted)")},[s]),P=l.useCallback(async(a,p)=>{if(!re.test(a)){A.error(`Invalid slug "${a}" — must be [a-z0-9-_]+`);return}const y=`${a}.md`,O=await window.api.memory.create(y,void 0,t);if(!O.ok){A.error(`Create failed: ${O.error??"unknown error"}`);return}const n=await window.api.memory.read(y,t),k=n.error?p:`${n.content.trimEnd()}
@@ -1 +1 @@
1
- import{a7 as e}from"./index-CuyM9vAP.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{a7 as e}from"./index-DApB4DHS.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,3 +1,3 @@
1
- import{ag as d,aw as z,ar as H,ay as W,at as N,a7 as e,j as w,P as D,V as q}from"./index-CuyM9vAP.js";import{P as A}from"./Panel-CD5wxGSR.js";import{S as G}from"./ScopeSwitcher-CeifaOlq.js";import{S as Q}from"./SaveBar-BDk5e3Pp.js";import{P as U}from"./Library-BTzS8KsS.js";import{u as X,m as Y,p as Z,g as ee,E as te,a as se,s as re}from"./settingsSchema-DrxC67uZ.js";import"./monaco-editor-BW5C4Iv1.js";const ne=["allow","deny","ask"];function ae(r){if(r.trim()==="")return{perms:{},full:{},err:null};try{const n=JSON.parse(r);return{perms:n.permissions??{},full:n,err:null}}catch(n){return{perms:{},full:{},err:n.message}}}function oe(r,n){const a={...r,permissions:n};return JSON.stringify(a,null,2)+`
1
+ import{ag as d,aw as z,ar as H,ay as W,at as N,a7 as e,j as w,P as D,V as q}from"./index-DApB4DHS.js";import{P as A}from"./Panel-D93o-sxe.js";import{S as G}from"./ScopeSwitcher-C-locvy0.js";import{S as Q}from"./SaveBar-Cg4lbChb.js";import{P as U}from"./Library-YPNm9W92.js";import{u as X,m as Y,p as Z,g as ee,E as te,a as se,s as re}from"./settingsSchema-BKa-xk8g.js";import"./monaco-editor-BW5C4Iv1.js";const ne=["allow","deny","ask"];function ae(r){if(r.trim()==="")return{perms:{},full:{},err:null};try{const n=JSON.parse(r);return{perms:n.permissions??{},full:n,err:null}}catch(n){return{perms:{},full:{},err:n.message}}}function oe(r,n){const a={...r,permissions:n};return JSON.stringify(a,null,2)+`
2
2
  `}function ie(){const r=z(),n=H(),a=(n==null?void 0:n.cwd)??null,s=W(t=>t.navFace),i=d.useRef(!1),u=d.useRef(s),[p,c]=d.useState(()=>s==="project"&&a?"project":"user"),[m,P]=d.useState("effective");d.useEffect(()=>{if(u.current!==s){if(u.current=s,i.current){i.current=!1;return}c(s==="project"&&a?"project":"user")}},[s,a]),d.useEffect(()=>{s==="project"&&m==="presets"&&P("effective")},[s,m]);const J=t=>{i.current=!0,c(t)},b=X(D,r,a),f=b[p]??null,j=N(t=>t.files),E=N(t=>t.setDraft),O=N(t=>t.saveJson),I=N(t=>t.revert),[M,y]=d.useState(null),k=e.jsx(q,{options:[{key:"effective",label:"Effective"},{key:"rules",label:"Rules"},...s==="home"?[{key:"presets",label:"Presets"}]:[]],active:m,onChange:P}),$=d.useMemo(()=>{const t=Y(Z(j,b));return ee(t,["permissions"])??{kind:"object",children:{}}},[j,b]),F=(t,l)=>{var R;const o=b[p];if(!o)return;y(null);const h=((R=j[o])==null?void 0:R.draftRaw)??"";let v={};if(h.trim())try{v=JSON.parse(h)}catch{v={}}const B=re(v.permissions??{},t,l),K={...v,permissions:B};E(o,JSON.stringify(K,null,2)+`
3
3
  `)};if(!r)return e.jsx(w,{title:"loading…"});if(m==="presets")return e.jsx(A,{toolbar:k,children:e.jsx(U,{})});const C=t=>t!=="user"&&!a,g=f?j[f]:null,{perms:x,full:L,err:T}=g?ae(g.draftRaw):{perms:{},full:{},err:null},S=t=>{f&&(y(null),E(f,oe(L,t)))},_=(t,l)=>{const o=l.trim();if(!o)return;const h=x[t]??[];h.includes(o)||S({...x,[t]:[...h,o]})},V=(t,l)=>{const o=x[t]??[];S({...x,[t]:o.filter((h,v)=>v!==l)})};return e.jsx(A,{toolbar:e.jsxs(e.Fragment,{children:[k,e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx(G,{scopes:D.scopes,active:p,onChange:J,annotate:t=>{if(C(t))return{exists:!1};const l=b[t];if(!l)return null;const o=j[l];return{exists:(o==null?void 0:o.exists)??!1,dirty:(o==null?void 0:o.dirty)??!1}}}),e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:f??"—"}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings#permissions",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"rule syntax ↗"})]}),footer:f&&g?e.jsx(Q,{dirty:g.dirty,busy:g.busy,parseError:M||T||g.parseError,lastSavedAt:g.lastSavedAt,onSave:async()=>{y(null);const t=await O(f);t.ok||y(t.error??"save failed")},onRevert:()=>{y(null),I(f)}}):null,children:C(p)?e.jsx(w,{title:"no active project",hint:"open a tab in a project directory to edit project or local permissions"}):m==="effective"?e.jsx(te,{node:$,targetScope:p,onOverride:F,schema:se().rootedAt(["permissions"]),rootLabel:"permissions"}):f&&g?e.jsxs("div",{className:"p-4 space-y-5 max-w-3xl",children:[e.jsx(le,{value:x.defaultMode??"default",onChange:t=>S({...x,defaultMode:t})}),ne.map(t=>e.jsx(ce,{list:t,rules:x[t]??[],onAdd:l=>_(t,l),onRemove:l=>V(t,l)},t)),e.jsx(de,{dirs:x.additionalDirectories??[],onChange:t=>S({...x,additionalDirectories:t})})]}):e.jsx(w,{title:"resolving…"})})}const ve=d.memo(ie);function le({value:r,onChange:n}){const a=["default","acceptEdits","plan","bypassPermissions"];return e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs text-fg uppercase tracking-wider mb-2",children:"Default Mode"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:a.map(s=>e.jsx("button",{onClick:()=>n(s),className:`px-2.5 py-1 text-xs transition-colors ${r===s?"bg-bg-hi text-fg":"bg-bg-elev text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:s},s))})]})}function ce({list:r,rules:n,onAdd:a,onRemove:s}){const[i,u]=d.useState(""),p=r==="allow"?"text-green-400":r==="deny"?"text-red-400":"text-yellow-400";return e.jsxs("section",{children:[e.jsx("h3",{className:`text-xs uppercase tracking-wider mb-2 ${p}`,children:r}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("input",{value:i,onChange:c=>u(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(a(i),u(""))},placeholder:r==="allow"?"e.g. Bash(ls:*) or Read(~/.claude/**)":"e.g. Write(/etc/**)",className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg placeholder-fg-faint"}),e.jsx("button",{onClick:()=>{a(i),u("")},disabled:!i.trim(),className:"px-2.5 py-1 border border-line rounded text-xs text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40",children:"add"})]}),n.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no rules"}):e.jsx("ul",{className:"space-y-0.5",children:n.map((c,m)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs font-mono bg-bg-elev border border-line rounded px-2 py-1",children:[e.jsx("span",{className:"flex-1 text-fg-dim truncate",children:c}),e.jsx("button",{onClick:()=>s(m),className:"text-fg-faint hover:text-red-400",title:"remove",children:"×"})]},`${m}-${c}`))})]})}function de({dirs:r,onChange:n}){const[a,s]=d.useState("");return e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs text-fg uppercase tracking-wider mb-2",children:"Additional Directories"}),e.jsx("div",{className:"flex gap-2 mb-2",children:e.jsx("input",{value:a,onChange:i=>s(i.target.value),onKeyDown:i=>{i.key==="Enter"&&a.trim()&&(n([...r,a.trim()]),s(""))},placeholder:"/absolute/path/to/dir",className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg placeholder-fg-faint"})}),e.jsx("ul",{className:"space-y-0.5",children:r.map((i,u)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs font-mono bg-bg-elev border border-line rounded px-2 py-1",children:[e.jsx("span",{className:"flex-1 text-fg-dim truncate",children:i}),e.jsx("button",{onClick:()=>n(r.filter((p,c)=>c!==u)),className:"text-fg-faint hover:text-red-400",children:"×"})]},`${u}-${i}`))})]})}export{ve as Permissions};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SkillReferenceGraph-CW6e1SW1.js","./index-CuyM9vAP.js","./monaco-editor-BW5C4Iv1.js","./monaco-editor-BTnBOi8r.css","./index-CYhdtisq.css"])))=>i.map(i=>d[i]);
2
- import{a7 as e,ag as p,j as y,aw as X,aq as R,b as Y}from"./index-CuyM9vAP.js";import{P as V}from"./Panel-CD5wxGSR.js";import{P as z}from"./ProvenanceBadge-CQceOgsH.js";import{e as Z}from"./Library-BTzS8KsS.js";import{p as G}from"./skillFrontmatter-Dif5JIg7.js";import{_ as ee}from"./monaco-editor-BW5C4Iv1.js";import{L as te}from"./ListDetail-CuRmT008.js";import{M as ne}from"./MarkdownEditor-BgQGtvWo.js";function se({columns:t,rows:n,getKey:o,onRowClick:a,activeKey:i,empty:m}){return n.length===0?e.jsx("div",{className:"p-6 text-fg-faint text-xs text-center",children:m??"no entries"}):e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-bg-elev text-fg-faint uppercase tracking-wider",children:e.jsx("tr",{className:"border-b border-line",children:t.map(l=>e.jsx("th",{className:`text-left font-normal px-3 py-1.5 ${l.className??""}`,style:l.width?{width:l.width}:void 0,children:l.header},l.key))})}),e.jsx("tbody",{children:n.map(l=>{const r=o(l),d=i===r;return e.jsx("tr",{"data-row-key":r,onClick:()=>a==null?void 0:a(l),className:`border-b border-line/50 transition-colors ${a?"cursor-pointer":""} ${d?"bg-bg-hi text-fg":"text-fg-dim hover:bg-bg-hi/50"}`,children:t.map(f=>e.jsx("td",{className:`px-3 py-1 ${f.className??""}`,children:f.render(l)},f.key))},r)})})]})}async function ie(t,n,o){var f,b;const a=`${n}/skills`;try{const c=await window.api.config.listDir(a,{dirsOnly:!0});if(c.ok&&c.entries.length>0)return a}catch{}let i=null;try{const c=await window.api.config.readJson(`${o}/.claude/plugins/installed_plugins.json`);c.exists&&!c.parseError&&c.data&&typeof c.data=="object"&&(i=c.data)}catch{return null}if(!(i!=null&&i.plugins))return null;const m=Object.keys(i.plugins).find(c=>c===t||c.startsWith(`${t}@`));if(!m)return null;const l=(b=(f=i.plugins[m])==null?void 0:f[0])==null?void 0:b.installPath;if(!l)return null;const r=`${l}/skills`;return await window.api.config.exists(r)?r:null}async function ae(t){const n=await window.api.config.listDir(t,{dirsOnly:!0}),o=[];for(const a of n.entries){const i=`${a.path}/SKILL.md`,m=await window.api.config.readText(i);if(!m.exists)continue;const l=G(m.text);o.push({id:a.name,name:l.name,description:l.description,dir:a.path,path:i,body:l.body})}return o}function le(t){const n=[],o=new Set;for(const a of t)for(const i of t){if(a.id===i.id)continue;const m=i.id.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=[`/${m}\\b`,`\`${m}\``];if(i.id.length>=4&&l.push(`\\b${m}\\b`),!l.some(f=>new RegExp(f,"i").test(a.body)))continue;const d=`${a.id}->${i.id}`;o.has(d)||(o.add(d),n.push({from:a.id,to:i.id}))}return n}const re=p.lazy(()=>ee(()=>import("./SkillReferenceGraph-CW6e1SW1.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.SkillReferenceGraph})));function oe({pluginName:t,skills:n,onBack:o,initialSelectedId:a}){var b;const[i,m]=p.useState(a??((b=n[0])==null?void 0:b.id)??null),l=i?n.find(c=>c.id===i)??null:null,r=p.useMemo(()=>le(n),[n]),[d,f]=p.useState("list");return e.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 h-11 flex items-baseline gap-3.5 px-3 border-b border-line bg-bg",children:[e.jsxs("button",{type:"button",onClick:o,className:"font-mono text-accent hover:underline shrink-0 text-xs",children:["← ",t]}),e.jsx("span",{className:"font-serif text-[22px] text-fg shrink-0 truncate max-w-[16rem]",children:(l==null?void 0:l.name)??(l==null?void 0:l.id)??"skill"}),e.jsx("span",{className:"flex-1"}),e.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:e.jsxs("div",{className:"flex rounded border border-line overflow-hidden",children:[e.jsx("button",{onClick:()=>f("list"),className:`px-2 py-0.5 text-xs ${d==="list"?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:"list"}),e.jsx("button",{onClick:()=>f("graph"),className:`px-2 py-0.5 text-xs ${d==="graph"?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:"graph"})]})})]}),e.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:[l!=null&&l.description?e.jsx("span",{className:"text-fg-dim truncate normal-case",children:l.description}):null,e.jsxs("span",{className:"ml-auto text-fg-faint truncate normal-case",children:[n.length," ",n.length===1?"skill":"skills"," · ",r.length," ",r.length===1?"reference":"references"]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:n.length===0?e.jsx(y,{title:"no skills in this plugin"}):d==="graph"?e.jsx(p.Suspense,{fallback:e.jsx("div",{className:"p-6 text-xs text-fg-faint",children:"Loading graph…"}),children:e.jsx(re,{skills:n,edges:r,selectedId:i,onSelect:m})}):e.jsx(te,{sidebar:e.jsx("div",{className:"py-1",children:n.map(c=>e.jsxs("button",{onClick:()=>m(c.id),className:`w-full px-3 py-1 text-xs text-left ${i===c.id?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsx("div",{className:"truncate",children:c.name??c.id}),c.description?e.jsx("div",{className:"truncate text-fg-faint",children:c.description}):null]},c.id))}),detail:l?e.jsx("div",{className:"h-full min-h-0",children:e.jsx(ne,{path:l.path,value:l.body,onChange:()=>{},readOnly:!0})}):e.jsx(y,{title:"select a skill"})})})]})}const q=t=>{var n,o;return{type:"plugin",name:t.name,repository:(n=t.manifest)==null?void 0:n.repository,homepage:(o=t.manifest)==null?void 0:o.homepage}};function ce(){const t=X(),[n,o]=p.useState([]),[a,i]=p.useState(!0),[m,l]=p.useState(null),[r,d]=p.useState("installed"),[f,b]=p.useState(null),[c,L]=p.useState(new Set);p.useEffect(()=>{var x,k;let s=!1;return(k=(x=window.api.app).seedStatus)==null||k.call(x).then(j=>{s||b(j)}).catch(()=>{}),()=>{s=!0}},[]),p.useEffect(()=>{if(!t)return;let s=!1;return(async()=>{var k;i(!0);const x=[];try{const j=await window.api.config.readJson(`${t}/.claude/plugins/installed_plugins.json`);if(j.exists&&!j.parseError&&j.data&&typeof j.data=="object"){const w=j.data;for(const[C,A]of Object.entries(w.plugins??{})){if(!Array.isArray(A))continue;const _=C.split("@")[0],u=C.split("@")[1];for(const g of A){if(!(g!=null&&g.installPath))continue;const B={name:_,path:g.installPath,isDirectory:!0,isFile:!1,mtimeMs:0,size:0},v=await fe(B);(k=v.manifest)!=null&&k.version||(v.manifest={...v.manifest??{},version:g.version}),v.marketplace=u,x.push(v)}}}}catch{}s||(x.sort((j,w)=>j.name.localeCompare(w.name)),s||(o(x),i(!1)))})(),()=>{s=!0}},[t]);const S=[{key:"name",header:"name",render:s=>{var x;return e.jsxs("div",{style:{maxWidth:"16rem"},children:[e.jsx("div",{className:"truncate",children:s.name}),(x=s.manifest)!=null&&x.description?e.jsx("div",{className:"truncate text-fg-faint",title:s.manifest.description,children:s.manifest.description}):null]})},width:"16rem"},{key:"origin",header:"origin",render:s=>e.jsx(z,{interactive:!1,input:q(s)}),width:"7rem"},{key:"version",header:"version",render:s=>{var x;return((x=s.manifest)==null?void 0:x.version)??e.jsx("span",{className:"text-fg-faint",children:"—"})},width:"6rem"},{key:"manifest",header:"manifest",render:s=>s.hasManifest?"plugin.json":e.jsx("span",{className:"text-fg-faint",children:"—"}),width:"8rem"},{key:"contents",header:"contents",render:s=>e.jsx("span",{className:"font-mono text-fg-faint text-xs",children:[s.agents>0?`${s.agents} agents`:null,s.skills>0?`${s.skills} skills`:null,s.hooks>0?`${s.hooks} hooks`:null,s.monitors>0?`${s.monitors} monitors`:null,s.binCount>0?`${s.binCount} bin`:null,s.hasLsp?"lsp":null,s.hasMcp?"mcp":null].filter(Boolean).join(" · ")||"—"})},{key:"path",header:"path",render:s=>e.jsx("span",{className:"font-mono text-fg-faint truncate",children:s.path})}],$=p.useMemo(()=>f?Object.keys(f).filter(s=>f[s].status==="exhausted"&&!c.has(s)):[],[f,c]),E=$.length>0?e.jsx(de,{seeders:$,seedStatus:f,onDismiss:s=>L(x=>new Set(x).add(s)),onOpenLibrary:()=>d("library")}):null;if(r==="library")return e.jsxs(V,{toolbar:e.jsx(W,{active:r,onChange:d}),children:[E,e.jsx(Z,{})]});const h=m?n.find(s=>s.path===m)??null:null;return e.jsxs(V,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(W,{active:r,onChange:d}),e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsxs("span",{className:"text-fg-faint",children:[n.length," plugins"]}),e.jsx("div",{className:"flex-1"}),e.jsx("span",{className:"text-fg-faint font-mono truncate",children:"~/.claude/plugins/installed_plugins.json"})]}),children:[E,a?e.jsx(y,{title:"scanning plugins…"}):h?e.jsx(me,{row:h,home:t,onBack:()=>l(null)},h.path):e.jsx("div",{className:"flex flex-col h-full",children:e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:e.jsx(se,{columns:S,rows:n,getKey:s=>s.path,activeKey:m,onRowClick:s=>l(s.path),empty:e.jsxs(e.Fragment,{children:["no plugins installed",e.jsxs("div",{className:"mt-2 text-fg-faint",children:["drop a plugin into ",e.jsx("code",{children:"~/.claude/plugins/"})]})]})})})})]})}const ke=p.memo(ce),K={"dev-plugin":"session-manager-dev plugin","scheduler-mcp":"Scheduler MCP server","agent-personas":"Agent personas (Architect, Dev Lead)"};function de({seeders:t,seedStatus:n,onDismiss:o,onOpenLibrary:a}){return e.jsx("div",{className:"shrink-0 flex flex-col gap-1.5 px-3 py-2 border-b border-line bg-yellow-950/20",children:t.map(i=>e.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-300",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium",children:[K[i]," setup failed after retrying — manual fix needed"]}),i==="dev-plugin"?e.jsxs("div",{className:"text-yellow-400/80 mt-0.5",children:["Click ",e.jsx("button",{onClick:a,className:"underline hover:no-underline",children:"here"}),' to open the Library tab, then click Install next to "session-manager-dev".']}):e.jsx("div",{className:"text-yellow-400/80 mt-0.5 font-mono",children:n[i].fix})]}),e.jsx("button",{onClick:()=>o(i),className:"shrink-0 text-yellow-400/70 hover:text-yellow-300","aria-label":`Dismiss ${K[i]} warning`,children:"✕"})]},i))})}function W({active:t,onChange:n}){const o=[["installed","Installed"],["library","Library"]];return e.jsx("div",{className:"flex rounded border border-line overflow-hidden",role:"tablist","aria-label":"Plugins view",children:o.map(([a,i])=>e.jsx("button",{onClick:()=>n(a),role:"tab","aria-selected":t===a,className:`px-2 py-0.5 text-xs ${t===a?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:i},a))})}function me({row:t,home:n,onBack:o}){var j,w,C,A,_;const[a,i]=p.useState([]),[m,l]=p.useState([]),[r,d]=p.useState([]),[f,b]=p.useState([]),[c,L]=p.useState("skills"),[S,$]=p.useState(null),[E,h]=p.useState(!0);p.useEffect(()=>{if(!n)return;let u=!1;return(async()=>{h(!0);try{const[g,B,v,Q]=await Promise.all([ie(t.name,t.path,n),O(`${t.path}/agents`,{filesOnly:!0}),t.hasMcp?window.api.config.readJson(`${t.path}/.mcp.json`):Promise.resolve(null),O(`${t.path}/bin`,{filesOnly:!0})]),J=g?await ae(g):[],T=B.filter(N=>N.endsWith(".md")),U=await Promise.all(T.map(N=>window.api.config.readText(`${t.path}/agents/${N}`))),I=[];T.forEach((N,F)=>{const M=U[F];if(!M.exists)return;const D=G(M.text);I.push({id:N,name:D.name??N.replace(/\.md$/,""),description:D.description})});const H=[];if(v&&v.exists&&!v.parseError&&v.data&&typeof v.data=="object"){const N=v.data.mcpServers;if(N&&typeof N=="object")for(const[F,M]of Object.entries(N)){const D=M&&typeof M=="object"?M.command:void 0;H.push({id:F,name:F,description:typeof D=="string"?D:null})}}if(u)return;i(J),l(I),d(H),b(Q),L(J.length>0?"skills":I.length>0?"agents":H.length>0?"mcp":t.hooks>0?"hooks":t.monitors>0?"monitors":t.hasLsp?"lsp":"files")}catch(g){if(u)return;R.error(`Failed to load plugin contents: ${g instanceof Error?g.message:String(g)}`),i([]),l([]),d([]),b([])}finally{u||h(!1)}})(),()=>{u=!0}},[t.path,t.name,t.hasMcp,t.hooks,t.monitors,t.hasLsp,n]);const s=[{key:"skills",label:"Skills",count:a.length},{key:"agents",label:"Agents",count:m.length},{key:"mcp",label:"MCP server",count:r.length},{key:"hooks",label:"Hooks",count:t.hooks},{key:"monitors",label:"Monitors",count:t.monitors},{key:"lsp",label:"LSP",count:t.hasLsp?1:0},{key:"files",label:"Bin",count:f.length}],x=(j=t.manifest)!=null&&j.author?typeof t.manifest.author=="string"?t.manifest.author:t.manifest.author.name??null:null,k=async u=>{const g=await window.api.shell.open({as:"external",url:u});g.ok||R.error(g.error??`Failed to open ${u}`)};return S?e.jsx(oe,{pluginName:((w=t.manifest)==null?void 0:w.name)??t.name,skills:a,initialSelectedId:S.id,onBack:()=>$(null)},S.id):e.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 h-11 flex items-baseline gap-3.5 px-3 border-b border-line bg-bg",children:[e.jsx("button",{type:"button",onClick:o,className:"font-mono text-accent hover:underline shrink-0 text-xs",children:"← Plugins"}),e.jsx("span",{className:"font-serif text-[22px] text-fg shrink-0 truncate max-w-[16rem]",children:((C=t.manifest)==null?void 0:C.name)??t.name}),(A=t.manifest)!=null&&A.version?e.jsxs("span",{className:"font-mono text-fg-faint text-xs shrink-0",children:["v",t.manifest.version]}):null,(_=t.manifest)!=null&&_.description?e.jsx("span",{className:"text-fg-dim text-xs min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:t.manifest.description}):e.jsx("span",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(z,{input:q(t)}),t.hasMcp?e.jsx(Y,{tone:"accent",children:"MCP"}):null]})]}),t.manifest?e.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:[x?e.jsxs("span",{className:"text-fg-dim truncate",children:[e.jsx("span",{className:"text-fg-faint",children:"Author "}),x]}):null,t.manifest.license?e.jsxs("span",{className:"text-fg-dim truncate",children:[e.jsx("span",{className:"text-fg-faint",children:"License "}),t.manifest.license]}):null,t.manifest.homepage?e.jsxs("button",{onClick:()=>k(t.manifest.homepage),className:"text-accent hover:underline truncate normal-case",title:t.manifest.homepage,children:[e.jsx("span",{className:"text-fg-faint uppercase",children:"Homepage "}),t.manifest.homepage]}):null,e.jsx("span",{className:"ml-auto text-fg-faint truncate normal-case",children:t.path})]}):e.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:e.jsx("span",{className:"ml-auto text-fg-faint truncate normal-case",children:t.path})}),e.jsxs("div",{className:"flex-1 min-h-0 grid overflow-hidden",style:{gridTemplateColumns:"170px 1fr"},children:[e.jsx("div",{className:"min-h-0 overflow-auto bg-bg-elev border-r border-line py-1",children:s.map(u=>e.jsxs("button",{type:"button",disabled:u.count===0,onClick:()=>L(u.key),className:`w-full text-left px-3 py-1.5 text-xs flex items-center justify-between ${u.count===0?"text-fg-faint opacity-50 cursor-default":c===u.key?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsx("span",{children:u.label}),u.count>0?e.jsx("span",{className:"font-mono text-fg-faint",children:u.count}):null]},u.key))}),e.jsx("div",{className:"min-h-0 overflow-auto",children:E?e.jsx(y,{title:"scanning…"}):e.jsx(he,{active:c,row:t,skills:a,agents:m,mcpServers:r,files:f,onOpenSkill:$})})]})]})}function he({active:t,row:n,skills:o,agents:a,mcpServers:i,files:m,onOpenSkill:l}){return t==="skills"?o.length===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:o.map((r,d)=>e.jsx(P,{n:d+1,name:r.name??r.id,description:r.description,onClick:()=>l(r)},r.id))}):t==="agents"?a.length===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:a.map((r,d)=>e.jsx(P,{n:d+1,name:r.name??r.id,description:r.description},r.id))}):t==="mcp"?i.length===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:i.map((r,d)=>e.jsx(P,{n:d+1,name:r.name,description:r.description},r.id))}):t==="hooks"?n.hooks===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:e.jsx(P,{n:1,name:`${n.hooks} ${n.hooks===1?"hook":"hooks"} configured`,description:`${n.path}/hooks/hooks.json`})}):t==="monitors"?n.monitors===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:e.jsx(P,{n:1,name:`${n.monitors} ${n.monitors===1?"monitor":"monitors"} configured`,description:`${n.path}/monitors/monitors.json`})}):t==="lsp"?n.hasLsp?e.jsx("div",{children:e.jsx(P,{n:1,name:"LSP server enabled",description:`${n.path}/.lsp.json`})}):e.jsx(y,{title:"no components"}):m.length===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:m.map((r,d)=>e.jsx(P,{n:d+1,name:r,description:null},r))})}function P({n:t,name:n,description:o,onClick:a}){const i=a?"button":"div";return e.jsxs(i,{onClick:a,className:`w-full flex items-baseline gap-2.5 py-[9px] px-3 border-b border-line text-left min-w-0 ${a?"hover:bg-bg-hi cursor-pointer":""}`,children:[e.jsx("span",{className:"font-serif text-fg-faint text-xs shrink-0 w-6 text-right",children:String(t).padStart(2,"0")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-mono font-semibold text-accent truncate",children:n}),o?e.jsx("div",{className:"text-fg-dim text-xs truncate",children:o}):null]})]})}async function fe(t){let n=`${t.path}/.claude-plugin/plugin.json`,o=await window.api.config.exists(n);o||(n=`${t.path}/plugin.json`,o=await window.api.config.exists(n));let a=null;if(o){const h=await window.api.config.readJson(n);h.exists&&!h.parseError&&h.data&&typeof h.data=="object"&&(a=h.data)}const[i,m,l,r]=await Promise.all([window.api.config.exists(`${t.path}/.lsp.json`),window.api.config.exists(`${t.path}/.mcp.json`),window.api.config.exists(`${t.path}/monitors/monitors.json`),window.api.config.exists(`${t.path}/hooks/hooks.json`)]);let d=0;if(l){const h=await window.api.config.readJson(`${t.path}/monitors/monitors.json`);Array.isArray(h.data)?d=h.data.length:h.data&&typeof h.data=="object"&&Array.isArray(h.data.monitors)&&(d=h.data.monitors.length)}let f=0;if(r){const h=await window.api.config.readJson(`${t.path}/hooks/hooks.json`);if(h.data&&typeof h.data=="object"){const s=h.data;f=Object.values(s).reduce((x,k)=>Array.isArray(k)?x+k.reduce((j,w)=>j+(Array.isArray(w.hooks)?w.hooks.length:0),0):x,0)}}const[b,c,L]=await Promise.all([O(`${t.path}/agents`,{filesOnly:!0}),O(`${t.path}/bin`,{filesOnly:!0}),O(`${t.path}/skills`,{dirsOnly:!0})]),S=b.filter(h=>h.endsWith(".md")).length,$=c.length,E=L.length;return{name:t.name,path:t.path,mtimeMs:t.mtimeMs,hasManifest:o,manifest:a,hasLsp:i,monitors:d,hooks:f,agents:S,skills:E,binCount:$,hasMcp:m}}async function O(t,n){try{return(await window.api.config.listDir(t,n)).entries.map(a=>a.name)}catch{return[]}}export{ke as Plugins};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SkillReferenceGraph-DDzuYgSK.js","./index-DApB4DHS.js","./monaco-editor-BW5C4Iv1.js","./monaco-editor-BTnBOi8r.css","./index-CYhdtisq.css"])))=>i.map(i=>d[i]);
2
+ import{a7 as e,ag as p,j as y,aw as X,aq as R,b as Y}from"./index-DApB4DHS.js";import{P as V}from"./Panel-D93o-sxe.js";import{P as z}from"./ProvenanceBadge-DACVJhrB.js";import{e as Z}from"./Library-YPNm9W92.js";import{p as G}from"./skillFrontmatter-Dif5JIg7.js";import{_ as ee}from"./monaco-editor-BW5C4Iv1.js";import{L as te}from"./ListDetail-CY4GM1Om.js";import{M as ne}from"./MarkdownEditor-BF4y2Jiz.js";function se({columns:t,rows:n,getKey:o,onRowClick:a,activeKey:i,empty:m}){return n.length===0?e.jsx("div",{className:"p-6 text-fg-faint text-xs text-center",children:m??"no entries"}):e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-bg-elev text-fg-faint uppercase tracking-wider",children:e.jsx("tr",{className:"border-b border-line",children:t.map(l=>e.jsx("th",{className:`text-left font-normal px-3 py-1.5 ${l.className??""}`,style:l.width?{width:l.width}:void 0,children:l.header},l.key))})}),e.jsx("tbody",{children:n.map(l=>{const r=o(l),d=i===r;return e.jsx("tr",{"data-row-key":r,onClick:()=>a==null?void 0:a(l),className:`border-b border-line/50 transition-colors ${a?"cursor-pointer":""} ${d?"bg-bg-hi text-fg":"text-fg-dim hover:bg-bg-hi/50"}`,children:t.map(f=>e.jsx("td",{className:`px-3 py-1 ${f.className??""}`,children:f.render(l)},f.key))},r)})})]})}async function ie(t,n,o){var f,b;const a=`${n}/skills`;try{const c=await window.api.config.listDir(a,{dirsOnly:!0});if(c.ok&&c.entries.length>0)return a}catch{}let i=null;try{const c=await window.api.config.readJson(`${o}/.claude/plugins/installed_plugins.json`);c.exists&&!c.parseError&&c.data&&typeof c.data=="object"&&(i=c.data)}catch{return null}if(!(i!=null&&i.plugins))return null;const m=Object.keys(i.plugins).find(c=>c===t||c.startsWith(`${t}@`));if(!m)return null;const l=(b=(f=i.plugins[m])==null?void 0:f[0])==null?void 0:b.installPath;if(!l)return null;const r=`${l}/skills`;return await window.api.config.exists(r)?r:null}async function ae(t){const n=await window.api.config.listDir(t,{dirsOnly:!0}),o=[];for(const a of n.entries){const i=`${a.path}/SKILL.md`,m=await window.api.config.readText(i);if(!m.exists)continue;const l=G(m.text);o.push({id:a.name,name:l.name,description:l.description,dir:a.path,path:i,body:l.body})}return o}function le(t){const n=[],o=new Set;for(const a of t)for(const i of t){if(a.id===i.id)continue;const m=i.id.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=[`/${m}\\b`,`\`${m}\``];if(i.id.length>=4&&l.push(`\\b${m}\\b`),!l.some(f=>new RegExp(f,"i").test(a.body)))continue;const d=`${a.id}->${i.id}`;o.has(d)||(o.add(d),n.push({from:a.id,to:i.id}))}return n}const re=p.lazy(()=>ee(()=>import("./SkillReferenceGraph-DDzuYgSK.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.SkillReferenceGraph})));function oe({pluginName:t,skills:n,onBack:o,initialSelectedId:a}){var b;const[i,m]=p.useState(a??((b=n[0])==null?void 0:b.id)??null),l=i?n.find(c=>c.id===i)??null:null,r=p.useMemo(()=>le(n),[n]),[d,f]=p.useState("list");return e.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 h-11 flex items-baseline gap-3.5 px-3 border-b border-line bg-bg",children:[e.jsxs("button",{type:"button",onClick:o,className:"font-mono text-accent hover:underline shrink-0 text-xs",children:["← ",t]}),e.jsx("span",{className:"font-serif text-[22px] text-fg shrink-0 truncate max-w-[16rem]",children:(l==null?void 0:l.name)??(l==null?void 0:l.id)??"skill"}),e.jsx("span",{className:"flex-1"}),e.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:e.jsxs("div",{className:"flex rounded border border-line overflow-hidden",children:[e.jsx("button",{onClick:()=>f("list"),className:`px-2 py-0.5 text-xs ${d==="list"?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:"list"}),e.jsx("button",{onClick:()=>f("graph"),className:`px-2 py-0.5 text-xs ${d==="graph"?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:"graph"})]})})]}),e.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:[l!=null&&l.description?e.jsx("span",{className:"text-fg-dim truncate normal-case",children:l.description}):null,e.jsxs("span",{className:"ml-auto text-fg-faint truncate normal-case",children:[n.length," ",n.length===1?"skill":"skills"," · ",r.length," ",r.length===1?"reference":"references"]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:n.length===0?e.jsx(y,{title:"no skills in this plugin"}):d==="graph"?e.jsx(p.Suspense,{fallback:e.jsx("div",{className:"p-6 text-xs text-fg-faint",children:"Loading graph…"}),children:e.jsx(re,{skills:n,edges:r,selectedId:i,onSelect:m})}):e.jsx(te,{sidebar:e.jsx("div",{className:"py-1",children:n.map(c=>e.jsxs("button",{onClick:()=>m(c.id),className:`w-full px-3 py-1 text-xs text-left ${i===c.id?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsx("div",{className:"truncate",children:c.name??c.id}),c.description?e.jsx("div",{className:"truncate text-fg-faint",children:c.description}):null]},c.id))}),detail:l?e.jsx("div",{className:"h-full min-h-0",children:e.jsx(ne,{path:l.path,value:l.body,onChange:()=>{},readOnly:!0})}):e.jsx(y,{title:"select a skill"})})})]})}const q=t=>{var n,o;return{type:"plugin",name:t.name,repository:(n=t.manifest)==null?void 0:n.repository,homepage:(o=t.manifest)==null?void 0:o.homepage}};function ce(){const t=X(),[n,o]=p.useState([]),[a,i]=p.useState(!0),[m,l]=p.useState(null),[r,d]=p.useState("installed"),[f,b]=p.useState(null),[c,L]=p.useState(new Set);p.useEffect(()=>{var x,k;let s=!1;return(k=(x=window.api.app).seedStatus)==null||k.call(x).then(j=>{s||b(j)}).catch(()=>{}),()=>{s=!0}},[]),p.useEffect(()=>{if(!t)return;let s=!1;return(async()=>{var k;i(!0);const x=[];try{const j=await window.api.config.readJson(`${t}/.claude/plugins/installed_plugins.json`);if(j.exists&&!j.parseError&&j.data&&typeof j.data=="object"){const w=j.data;for(const[C,A]of Object.entries(w.plugins??{})){if(!Array.isArray(A))continue;const _=C.split("@")[0],u=C.split("@")[1];for(const g of A){if(!(g!=null&&g.installPath))continue;const B={name:_,path:g.installPath,isDirectory:!0,isFile:!1,mtimeMs:0,size:0},v=await fe(B);(k=v.manifest)!=null&&k.version||(v.manifest={...v.manifest??{},version:g.version}),v.marketplace=u,x.push(v)}}}}catch{}s||(x.sort((j,w)=>j.name.localeCompare(w.name)),s||(o(x),i(!1)))})(),()=>{s=!0}},[t]);const S=[{key:"name",header:"name",render:s=>{var x;return e.jsxs("div",{style:{maxWidth:"16rem"},children:[e.jsx("div",{className:"truncate",children:s.name}),(x=s.manifest)!=null&&x.description?e.jsx("div",{className:"truncate text-fg-faint",title:s.manifest.description,children:s.manifest.description}):null]})},width:"16rem"},{key:"origin",header:"origin",render:s=>e.jsx(z,{interactive:!1,input:q(s)}),width:"7rem"},{key:"version",header:"version",render:s=>{var x;return((x=s.manifest)==null?void 0:x.version)??e.jsx("span",{className:"text-fg-faint",children:"—"})},width:"6rem"},{key:"manifest",header:"manifest",render:s=>s.hasManifest?"plugin.json":e.jsx("span",{className:"text-fg-faint",children:"—"}),width:"8rem"},{key:"contents",header:"contents",render:s=>e.jsx("span",{className:"font-mono text-fg-faint text-xs",children:[s.agents>0?`${s.agents} agents`:null,s.skills>0?`${s.skills} skills`:null,s.hooks>0?`${s.hooks} hooks`:null,s.monitors>0?`${s.monitors} monitors`:null,s.binCount>0?`${s.binCount} bin`:null,s.hasLsp?"lsp":null,s.hasMcp?"mcp":null].filter(Boolean).join(" · ")||"—"})},{key:"path",header:"path",render:s=>e.jsx("span",{className:"font-mono text-fg-faint truncate",children:s.path})}],$=p.useMemo(()=>f?Object.keys(f).filter(s=>f[s].status==="exhausted"&&!c.has(s)):[],[f,c]),E=$.length>0?e.jsx(de,{seeders:$,seedStatus:f,onDismiss:s=>L(x=>new Set(x).add(s)),onOpenLibrary:()=>d("library")}):null;if(r==="library")return e.jsxs(V,{toolbar:e.jsx(W,{active:r,onChange:d}),children:[E,e.jsx(Z,{})]});const h=m?n.find(s=>s.path===m)??null:null;return e.jsxs(V,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(W,{active:r,onChange:d}),e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsxs("span",{className:"text-fg-faint",children:[n.length," plugins"]}),e.jsx("div",{className:"flex-1"}),e.jsx("span",{className:"text-fg-faint font-mono truncate",children:"~/.claude/plugins/installed_plugins.json"})]}),children:[E,a?e.jsx(y,{title:"scanning plugins…"}):h?e.jsx(me,{row:h,home:t,onBack:()=>l(null)},h.path):e.jsx("div",{className:"flex flex-col h-full",children:e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:e.jsx(se,{columns:S,rows:n,getKey:s=>s.path,activeKey:m,onRowClick:s=>l(s.path),empty:e.jsxs(e.Fragment,{children:["no plugins installed",e.jsxs("div",{className:"mt-2 text-fg-faint",children:["drop a plugin into ",e.jsx("code",{children:"~/.claude/plugins/"})]})]})})})})]})}const ke=p.memo(ce),K={"dev-plugin":"session-manager-dev plugin","scheduler-mcp":"Scheduler MCP server","agent-personas":"Agent personas (Architect, Dev Lead)"};function de({seeders:t,seedStatus:n,onDismiss:o,onOpenLibrary:a}){return e.jsx("div",{className:"shrink-0 flex flex-col gap-1.5 px-3 py-2 border-b border-line bg-yellow-950/20",children:t.map(i=>e.jsxs("div",{className:"flex items-start gap-2 text-xs text-yellow-300",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium",children:[K[i]," setup failed after retrying — manual fix needed"]}),i==="dev-plugin"?e.jsxs("div",{className:"text-yellow-400/80 mt-0.5",children:["Click ",e.jsx("button",{onClick:a,className:"underline hover:no-underline",children:"here"}),' to open the Library tab, then click Install next to "session-manager-dev".']}):e.jsx("div",{className:"text-yellow-400/80 mt-0.5 font-mono",children:n[i].fix})]}),e.jsx("button",{onClick:()=>o(i),className:"shrink-0 text-yellow-400/70 hover:text-yellow-300","aria-label":`Dismiss ${K[i]} warning`,children:"✕"})]},i))})}function W({active:t,onChange:n}){const o=[["installed","Installed"],["library","Library"]];return e.jsx("div",{className:"flex rounded border border-line overflow-hidden",role:"tablist","aria-label":"Plugins view",children:o.map(([a,i])=>e.jsx("button",{onClick:()=>n(a),role:"tab","aria-selected":t===a,className:`px-2 py-0.5 text-xs ${t===a?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:i},a))})}function me({row:t,home:n,onBack:o}){var j,w,C,A,_;const[a,i]=p.useState([]),[m,l]=p.useState([]),[r,d]=p.useState([]),[f,b]=p.useState([]),[c,L]=p.useState("skills"),[S,$]=p.useState(null),[E,h]=p.useState(!0);p.useEffect(()=>{if(!n)return;let u=!1;return(async()=>{h(!0);try{const[g,B,v,Q]=await Promise.all([ie(t.name,t.path,n),O(`${t.path}/agents`,{filesOnly:!0}),t.hasMcp?window.api.config.readJson(`${t.path}/.mcp.json`):Promise.resolve(null),O(`${t.path}/bin`,{filesOnly:!0})]),J=g?await ae(g):[],T=B.filter(N=>N.endsWith(".md")),U=await Promise.all(T.map(N=>window.api.config.readText(`${t.path}/agents/${N}`))),I=[];T.forEach((N,F)=>{const M=U[F];if(!M.exists)return;const D=G(M.text);I.push({id:N,name:D.name??N.replace(/\.md$/,""),description:D.description})});const H=[];if(v&&v.exists&&!v.parseError&&v.data&&typeof v.data=="object"){const N=v.data.mcpServers;if(N&&typeof N=="object")for(const[F,M]of Object.entries(N)){const D=M&&typeof M=="object"?M.command:void 0;H.push({id:F,name:F,description:typeof D=="string"?D:null})}}if(u)return;i(J),l(I),d(H),b(Q),L(J.length>0?"skills":I.length>0?"agents":H.length>0?"mcp":t.hooks>0?"hooks":t.monitors>0?"monitors":t.hasLsp?"lsp":"files")}catch(g){if(u)return;R.error(`Failed to load plugin contents: ${g instanceof Error?g.message:String(g)}`),i([]),l([]),d([]),b([])}finally{u||h(!1)}})(),()=>{u=!0}},[t.path,t.name,t.hasMcp,t.hooks,t.monitors,t.hasLsp,n]);const s=[{key:"skills",label:"Skills",count:a.length},{key:"agents",label:"Agents",count:m.length},{key:"mcp",label:"MCP server",count:r.length},{key:"hooks",label:"Hooks",count:t.hooks},{key:"monitors",label:"Monitors",count:t.monitors},{key:"lsp",label:"LSP",count:t.hasLsp?1:0},{key:"files",label:"Bin",count:f.length}],x=(j=t.manifest)!=null&&j.author?typeof t.manifest.author=="string"?t.manifest.author:t.manifest.author.name??null:null,k=async u=>{const g=await window.api.shell.open({as:"external",url:u});g.ok||R.error(g.error??`Failed to open ${u}`)};return S?e.jsx(oe,{pluginName:((w=t.manifest)==null?void 0:w.name)??t.name,skills:a,initialSelectedId:S.id,onBack:()=>$(null)},S.id):e.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 h-11 flex items-baseline gap-3.5 px-3 border-b border-line bg-bg",children:[e.jsx("button",{type:"button",onClick:o,className:"font-mono text-accent hover:underline shrink-0 text-xs",children:"← Plugins"}),e.jsx("span",{className:"font-serif text-[22px] text-fg shrink-0 truncate max-w-[16rem]",children:((C=t.manifest)==null?void 0:C.name)??t.name}),(A=t.manifest)!=null&&A.version?e.jsxs("span",{className:"font-mono text-fg-faint text-xs shrink-0",children:["v",t.manifest.version]}):null,(_=t.manifest)!=null&&_.description?e.jsx("span",{className:"text-fg-dim text-xs min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:t.manifest.description}):e.jsx("span",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(z,{input:q(t)}),t.hasMcp?e.jsx(Y,{tone:"accent",children:"MCP"}):null]})]}),t.manifest?e.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:[x?e.jsxs("span",{className:"text-fg-dim truncate",children:[e.jsx("span",{className:"text-fg-faint",children:"Author "}),x]}):null,t.manifest.license?e.jsxs("span",{className:"text-fg-dim truncate",children:[e.jsx("span",{className:"text-fg-faint",children:"License "}),t.manifest.license]}):null,t.manifest.homepage?e.jsxs("button",{onClick:()=>k(t.manifest.homepage),className:"text-accent hover:underline truncate normal-case",title:t.manifest.homepage,children:[e.jsx("span",{className:"text-fg-faint uppercase",children:"Homepage "}),t.manifest.homepage]}):null,e.jsx("span",{className:"ml-auto text-fg-faint truncate normal-case",children:t.path})]}):e.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:e.jsx("span",{className:"ml-auto text-fg-faint truncate normal-case",children:t.path})}),e.jsxs("div",{className:"flex-1 min-h-0 grid overflow-hidden",style:{gridTemplateColumns:"170px 1fr"},children:[e.jsx("div",{className:"min-h-0 overflow-auto bg-bg-elev border-r border-line py-1",children:s.map(u=>e.jsxs("button",{type:"button",disabled:u.count===0,onClick:()=>L(u.key),className:`w-full text-left px-3 py-1.5 text-xs flex items-center justify-between ${u.count===0?"text-fg-faint opacity-50 cursor-default":c===u.key?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsx("span",{children:u.label}),u.count>0?e.jsx("span",{className:"font-mono text-fg-faint",children:u.count}):null]},u.key))}),e.jsx("div",{className:"min-h-0 overflow-auto",children:E?e.jsx(y,{title:"scanning…"}):e.jsx(he,{active:c,row:t,skills:a,agents:m,mcpServers:r,files:f,onOpenSkill:$})})]})]})}function he({active:t,row:n,skills:o,agents:a,mcpServers:i,files:m,onOpenSkill:l}){return t==="skills"?o.length===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:o.map((r,d)=>e.jsx(P,{n:d+1,name:r.name??r.id,description:r.description,onClick:()=>l(r)},r.id))}):t==="agents"?a.length===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:a.map((r,d)=>e.jsx(P,{n:d+1,name:r.name??r.id,description:r.description},r.id))}):t==="mcp"?i.length===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:i.map((r,d)=>e.jsx(P,{n:d+1,name:r.name,description:r.description},r.id))}):t==="hooks"?n.hooks===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:e.jsx(P,{n:1,name:`${n.hooks} ${n.hooks===1?"hook":"hooks"} configured`,description:`${n.path}/hooks/hooks.json`})}):t==="monitors"?n.monitors===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:e.jsx(P,{n:1,name:`${n.monitors} ${n.monitors===1?"monitor":"monitors"} configured`,description:`${n.path}/monitors/monitors.json`})}):t==="lsp"?n.hasLsp?e.jsx("div",{children:e.jsx(P,{n:1,name:"LSP server enabled",description:`${n.path}/.lsp.json`})}):e.jsx(y,{title:"no components"}):m.length===0?e.jsx(y,{title:"no components"}):e.jsx("div",{children:m.map((r,d)=>e.jsx(P,{n:d+1,name:r,description:null},r))})}function P({n:t,name:n,description:o,onClick:a}){const i=a?"button":"div";return e.jsxs(i,{onClick:a,className:`w-full flex items-baseline gap-2.5 py-[9px] px-3 border-b border-line text-left min-w-0 ${a?"hover:bg-bg-hi cursor-pointer":""}`,children:[e.jsx("span",{className:"font-serif text-fg-faint text-xs shrink-0 w-6 text-right",children:String(t).padStart(2,"0")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-mono font-semibold text-accent truncate",children:n}),o?e.jsx("div",{className:"text-fg-dim text-xs truncate",children:o}):null]})]})}async function fe(t){let n=`${t.path}/.claude-plugin/plugin.json`,o=await window.api.config.exists(n);o||(n=`${t.path}/plugin.json`,o=await window.api.config.exists(n));let a=null;if(o){const h=await window.api.config.readJson(n);h.exists&&!h.parseError&&h.data&&typeof h.data=="object"&&(a=h.data)}const[i,m,l,r]=await Promise.all([window.api.config.exists(`${t.path}/.lsp.json`),window.api.config.exists(`${t.path}/.mcp.json`),window.api.config.exists(`${t.path}/monitors/monitors.json`),window.api.config.exists(`${t.path}/hooks/hooks.json`)]);let d=0;if(l){const h=await window.api.config.readJson(`${t.path}/monitors/monitors.json`);Array.isArray(h.data)?d=h.data.length:h.data&&typeof h.data=="object"&&Array.isArray(h.data.monitors)&&(d=h.data.monitors.length)}let f=0;if(r){const h=await window.api.config.readJson(`${t.path}/hooks/hooks.json`);if(h.data&&typeof h.data=="object"){const s=h.data;f=Object.values(s).reduce((x,k)=>Array.isArray(k)?x+k.reduce((j,w)=>j+(Array.isArray(w.hooks)?w.hooks.length:0),0):x,0)}}const[b,c,L]=await Promise.all([O(`${t.path}/agents`,{filesOnly:!0}),O(`${t.path}/bin`,{filesOnly:!0}),O(`${t.path}/skills`,{dirsOnly:!0})]),S=b.filter(h=>h.endsWith(".md")).length,$=c.length,E=L.length;return{name:t.name,path:t.path,mtimeMs:t.mtimeMs,hasManifest:o,manifest:a,hasLsp:i,monitors:d,hooks:f,agents:S,skills:E,binCount:$,hasMcp:m}}async function O(t,n){try{return(await window.api.config.listDir(t,n)).entries.map(a=>a.name)}catch{return[]}}export{ke as Plugins};
@@ -1 +1 @@
1
- import{K as P,aw as G,ag as x,a7 as i,Z as R,B as T,b as _}from"./index-CuyM9vAP.js";import{a as E,C as B,c as L,d as S,b as I}from"./Library-BTzS8KsS.js";const O=e=>`${e}/.claude/session-manager/provenance.json`;function K(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 r=await window.api.config.readJson(O(n)),d=r.exists?K(r.data):{};e(g=>({overrides:{...d,...g.overrides},loaded:!0,loading:!1}))}catch{e({loaded:!0,loading:!1})}}},setOverride:async(n,o)=>{const r={...t().overrides};o===null?delete r[n]:r[n]=o,e({overrides:r});const d=t().home;if(d)try{await window.api.config.writeJson(O(d),r)}catch{}}})),a=e=>(e??"").toLowerCase().trim(),j=new Set,$=new Set;for(const e of I){const t=e.official?j:$;t.add(a(e.id)),t.add(a(e.name))}const H=new Set(S.filter(e=>e.official).flatMap(e=>[a(e.id),a(e.name)])),J=new Set(S.filter(e=>!e.official).flatMap(e=>[a(e.id),a(e.name)])),U=new Set(L.filter(e=>e.official).flatMap(e=>[a(e.id),a(e.name)])),V=new Set(L.filter(e=>!e.official).flatMap(e=>[a(e.id),a(e.name)])),z=new Set(B.flatMap(e=>[a(e.id),a(e.name)])),Z=new Set(E.flatMap(e=>[a(e.id),a(e.name)])),q=new Set(E.map(e=>e.command.trim())),F=new Set(["security-review","pr-comments","release-notes","add-dir","code-review","simplify"]),Q=/(@anthropic-ai\/|anthropic\.com|github\.com\/anthropics)/i,W=/(^|\s)(npx|uvx|pipx|bunx|mcp-remote|deno\s+run|docker\s+run)(\s|$)/i;function X(e){return[e.command,...e.args??[],e.url,e.repository,e.homepage].filter(Boolean).join(" ").toLowerCase()}const l=e=>({provenance:"anthropic",reason:e}),w=e=>({provenance:"community",reason:e});function Y(e,t,n){switch(e){case"mcp":return j.has(t)?l("official MCP server (catalog)"):$.has(t)?w("third-party server (catalog)"):null;case"skill":case"command":return H.has(t)?l("official Anthropic skill (catalog)"):J.has(t)?w("third-party skill (catalog)"):null;case"plugin":return U.has(t)?l("official Anthropic plugin (catalog)"):V.has(t)?w("third-party plugin (catalog)"):null;case"subagent":return z.has(t)?l("bundled Anthropic subagent (catalog)"):null;case"hook":return Z.has(t)||n&&q.has(n.trim())?l("bundled hook (catalog)"):null}}function ee(e,t){return e.repository?"has a source repository":e.homepage?"has a homepage":e.url?"remote endpoint":W.test(t)?"installed from a package registry":null}function te(e){const t=a(e.name),n=X(e),o=Y(e.type,t,e.command);if(o)return o;if((e.type==="command"||e.type==="skill")&&F.has(t))return l("built-in Claude Code command");if(Q.test(n))return l("Anthropic package or repo");const r=ee(e,n);return r?w(r):{provenance:"local",reason:"no external source — assumed self-created"}}function ne(e,t,n){return`${e}:${t??"-"}:${n}`}const c={anthropic:"Anthropic",community:"Community",local:"Local"},N={anthropic:"accent",community:"warn",local:"dim"},oe=["anthropic","community","local"];function se({input:e,scope:t,interactive:n=!0,className:o=""}){const r=G(),{overrides:d,load:g,setOverride:k}=D(),[y,m]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{r&&g(r)},[r,g]),x.useEffect(()=>{if(!y)return;const s=C=>{b.current&&!b.current.contains(C.target)&&m(!1)},h=C=>{C.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",s),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",s),window.removeEventListener("keydown",h)}},[y]);const v=ne(e.type,t??null,e.name),f=te(e),p=d[v],u=p??f.provenance,M=p?`Origin manually set to ${c[u]} — auto-detected ${c[f.provenance]} (${f.reason})`:`Auto-detected ${c[u]}: ${f.reason}`,A=i.jsxs(_,{tone:N[u],title:M,className:`${n?"cursor-pointer hover:brightness-125":""} ${o}`,children:[c[u],p&&i.jsx("span",{className:"w-1 h-1 rounded-full bg-current opacity-70","aria-hidden":!0})]});return n?i.jsxs("span",{ref:b,className:"relative inline-flex",children:[i.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),m(h=>!h)},className:"inline-flex","aria-label":`Origin: ${c[u]}. Click to change.`,children:A}),y&&i.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:s=>s.stopPropagation(),children:[i.jsx("span",{className:"block px-2 pb-1 text-[10px] uppercase tracking-wide text-fg-faint",children:"Mark origin as"}),oe.map(s=>i.jsxs("button",{type:"button",onClick:()=>{k(v,s),m(!1)},className:`flex w-full items-center gap-2 px-2 py-1 text-[12px] hover:bg-bg-hi/60 ${u===s?"text-fg":"text-fg-dim"}`,children:[i.jsx("span",{className:`w-2 h-2 rounded-full border ${T[N[s]]}`,"aria-hidden":!0}),c[s],p===s&&i.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:"set"})]},s)),i.jsx("div",{className:"my-1 border-t border-line"}),i.jsxs("button",{type:"button",onClick:()=>{k(v,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[f.provenance]})`,children:["Auto-detect",i.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:c[f.provenance]})]})]})]}):A}export{se as P};
1
+ import{K as P,aw as G,ag as x,a7 as i,Z as R,B as T,b as _}from"./index-DApB4DHS.js";import{a as E,C as B,c as L,d as S,b as I}from"./Library-YPNm9W92.js";const O=e=>`${e}/.claude/session-manager/provenance.json`;function K(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 r=await window.api.config.readJson(O(n)),d=r.exists?K(r.data):{};e(g=>({overrides:{...d,...g.overrides},loaded:!0,loading:!1}))}catch{e({loaded:!0,loading:!1})}}},setOverride:async(n,o)=>{const r={...t().overrides};o===null?delete r[n]:r[n]=o,e({overrides:r});const d=t().home;if(d)try{await window.api.config.writeJson(O(d),r)}catch{}}})),a=e=>(e??"").toLowerCase().trim(),j=new Set,$=new Set;for(const e of I){const t=e.official?j:$;t.add(a(e.id)),t.add(a(e.name))}const H=new Set(S.filter(e=>e.official).flatMap(e=>[a(e.id),a(e.name)])),J=new Set(S.filter(e=>!e.official).flatMap(e=>[a(e.id),a(e.name)])),U=new Set(L.filter(e=>e.official).flatMap(e=>[a(e.id),a(e.name)])),V=new Set(L.filter(e=>!e.official).flatMap(e=>[a(e.id),a(e.name)])),z=new Set(B.flatMap(e=>[a(e.id),a(e.name)])),Z=new Set(E.flatMap(e=>[a(e.id),a(e.name)])),q=new Set(E.map(e=>e.command.trim())),F=new Set(["security-review","pr-comments","release-notes","add-dir","code-review","simplify"]),Q=/(@anthropic-ai\/|anthropic\.com|github\.com\/anthropics)/i,W=/(^|\s)(npx|uvx|pipx|bunx|mcp-remote|deno\s+run|docker\s+run)(\s|$)/i;function X(e){return[e.command,...e.args??[],e.url,e.repository,e.homepage].filter(Boolean).join(" ").toLowerCase()}const l=e=>({provenance:"anthropic",reason:e}),w=e=>({provenance:"community",reason:e});function Y(e,t,n){switch(e){case"mcp":return j.has(t)?l("official MCP server (catalog)"):$.has(t)?w("third-party server (catalog)"):null;case"skill":case"command":return H.has(t)?l("official Anthropic skill (catalog)"):J.has(t)?w("third-party skill (catalog)"):null;case"plugin":return U.has(t)?l("official Anthropic plugin (catalog)"):V.has(t)?w("third-party plugin (catalog)"):null;case"subagent":return z.has(t)?l("bundled Anthropic subagent (catalog)"):null;case"hook":return Z.has(t)||n&&q.has(n.trim())?l("bundled hook (catalog)"):null}}function ee(e,t){return e.repository?"has a source repository":e.homepage?"has a homepage":e.url?"remote endpoint":W.test(t)?"installed from a package registry":null}function te(e){const t=a(e.name),n=X(e),o=Y(e.type,t,e.command);if(o)return o;if((e.type==="command"||e.type==="skill")&&F.has(t))return l("built-in Claude Code command");if(Q.test(n))return l("Anthropic package or repo");const r=ee(e,n);return r?w(r):{provenance:"local",reason:"no external source — assumed self-created"}}function ne(e,t,n){return`${e}:${t??"-"}:${n}`}const c={anthropic:"Anthropic",community:"Community",local:"Local"},N={anthropic:"accent",community:"warn",local:"dim"},oe=["anthropic","community","local"];function se({input:e,scope:t,interactive:n=!0,className:o=""}){const r=G(),{overrides:d,load:g,setOverride:k}=D(),[y,m]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{r&&g(r)},[r,g]),x.useEffect(()=>{if(!y)return;const s=C=>{b.current&&!b.current.contains(C.target)&&m(!1)},h=C=>{C.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",s),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",s),window.removeEventListener("keydown",h)}},[y]);const v=ne(e.type,t??null,e.name),f=te(e),p=d[v],u=p??f.provenance,M=p?`Origin manually set to ${c[u]} — auto-detected ${c[f.provenance]} (${f.reason})`:`Auto-detected ${c[u]}: ${f.reason}`,A=i.jsxs(_,{tone:N[u],title:M,className:`${n?"cursor-pointer hover:brightness-125":""} ${o}`,children:[c[u],p&&i.jsx("span",{className:"w-1 h-1 rounded-full bg-current opacity-70","aria-hidden":!0})]});return n?i.jsxs("span",{ref:b,className:"relative inline-flex",children:[i.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),m(h=>!h)},className:"inline-flex","aria-label":`Origin: ${c[u]}. Click to change.`,children:A}),y&&i.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:s=>s.stopPropagation(),children:[i.jsx("span",{className:"block px-2 pb-1 text-[10px] uppercase tracking-wide text-fg-faint",children:"Mark origin as"}),oe.map(s=>i.jsxs("button",{type:"button",onClick:()=>{k(v,s),m(!1)},className:`flex w-full items-center gap-2 px-2 py-1 text-[12px] hover:bg-bg-hi/60 ${u===s?"text-fg":"text-fg-dim"}`,children:[i.jsx("span",{className:`w-2 h-2 rounded-full border ${T[N[s]]}`,"aria-hidden":!0}),c[s],p===s&&i.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:"set"})]},s)),i.jsx("div",{className:"my-1 border-t border-line"}),i.jsxs("button",{type:"button",onClick:()=>{k(v,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[f.provenance]})`,children:["Auto-detect",i.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:c[f.provenance]})]})]})]}):A}export{se as P};
@@ -1 +1 @@
1
- import{a7 as e,a2 as x}from"./index-CuyM9vAP.js";function m({dirty:a,busy:n,parseError:t,lastSavedAt:c,onSave:i,onRevert:l,leading:d}){const s=a&&!n&&!t;return e.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"flex-1 min-w-0 truncate text-fg-faint",children:d}),t&&e.jsx("span",{className:"text-red-400 truncate max-w-xs",title:t,children:t}),!a&&!t&&c&&e.jsx("span",{className:"text-fg-faint",children:x(c)}),a&&!t&&e.jsx("span",{className:"text-accent",children:"unsaved"}),e.jsx("button",{onClick:l,disabled:!a||n,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.jsx("button",{onClick:i,disabled:!s,className:`px-2.5 py-0.5 rounded border ${s?"border-accent bg-accent/15 text-accent hover:bg-accent/25":"border-line text-fg-faint opacity-50 cursor-not-allowed"}`,children:n?"Saving…":"Save"})]})}export{m as S};
1
+ import{a7 as e,a2 as x}from"./index-DApB4DHS.js";function m({dirty:a,busy:n,parseError:t,lastSavedAt:c,onSave:i,onRevert:l,leading:d}){const s=a&&!n&&!t;return e.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"flex-1 min-w-0 truncate text-fg-faint",children:d}),t&&e.jsx("span",{className:"text-red-400 truncate max-w-xs",title:t,children:t}),!a&&!t&&c&&e.jsx("span",{className:"text-fg-faint",children:x(c)}),a&&!t&&e.jsx("span",{className:"text-accent",children:"unsaved"}),e.jsx("button",{onClick:l,disabled:!a||n,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.jsx("button",{onClick:i,disabled:!s,className:`px-2.5 py-0.5 rounded border ${s?"border-accent bg-accent/15 text-accent hover:bg-accent/25":"border-line text-fg-faint opacity-50 cursor-not-allowed"}`,children:n?"Saving…":"Save"})]})}export{m as S};
@@ -1,4 +1,4 @@
1
- import{a7 as e,aC as we,ag as i,az as Te,a as ue,W as U,aq as L,a1 as H,a3 as re,Y as z,af as be,aA as le,ak as ve,al as je,_ as Se,aF as ce,x as Le,ab as W,q as Me,L as Oe,m as Ue,k as Ne,s as ye,D as B,d as D,$ as Fe,v as _e,T as Qe,ac as Pe,au as $e,j as ae,r as Ce,i as Ye,ao as We,y as Ke,p as He,aw as Xe,at as se,w as Ze,C as et,aD as tt,ah as st,aG as nt,aE as Ae,l as at,n as he}from"./index-CuyM9vAP.js";import{l as rt}from"./listSkills-QORduPIk.js";import{T as lt}from"./Toggle-D9eYoZh4.js";import"./monaco-editor-BW5C4Iv1.js";function it({options:t,active:s,onChange:n}){return e.jsx("div",{className:"inline-flex gap-1 bg-bg-hi p-1 rounded-xl shadow-[inset_0_0_0_1px] shadow-line",children:t.map(({key:a,label:c})=>{const o=s===a;return e.jsx("button",{type:"button",onClick:()=>n(a),className:`px-[18px] py-[7px] rounded-lg text-[13.5px] transition-colors ${o?"bg-bg-elev shadow-[inset_0_0_0_1px] shadow-line font-semibold text-fg":"font-medium text-fg-dim hover:text-fg"}`,children:c},a)})})}const ot=5e3;let oe=null,ne=null;async function De(t){const s=Date.now();return!(t!=null&&t.fresh)&&oe&&s-oe.at<ot?oe.result:ne||(ne=(async()=>{try{const n=await window.api.schedule.lintQueue();return oe={result:n,at:Date.now()},n}finally{ne=null}})(),ne)}function qe({options:t,value:s,onChange:n,pillPadding:a="px-3 py-1.5"}){return e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:t.map(c=>{const o=c.value===s;return e.jsxs("button",{type:"button",onClick:()=>n(c.value),className:`rounded-full ${a} text-[12.5px] border transition-colors ${o?"bg-accent text-white border-accent font-semibold":"bg-bg-hi text-fg-dim border-line hover:border-fg-faint font-medium"}`,children:[c.label,c.count!==void 0&&e.jsxs("span",{children:[" ",c.count]})]},c.value)})})}const dt=5,ct=1440*60*1e3,Be="sm.scheduler.hiddenCompletedSlugs",de="sm.scheduler.focusedJobIndex",Ge="sm.scheduler.queueFilter";function ut(t,s=60){const n=t.trim();return n.length<=s?n:`${n.slice(0,s-1)}…`}const xt=["all","running","investigating","pending","completed","skipped","needs_review","failed","quarantined"];function pt(){try{const t=localStorage.getItem(Ge);if(!t)return{text:"",status:"all"};const s=JSON.parse(t);return{text:"",status:xt.includes(s.status)?s.status:"all"}}catch{return{text:"",status:"all"}}}function mt(t){try{localStorage.setItem(Ge,JSON.stringify({status:t.status}))}catch{}}function ht(t,s){if(s.status==="all"&&!s.text)return t;const n=s.text.toLowerCase();return t.filter(a=>{if(s.status!=="all"&&a.status!==s.status)return!1;if(!n)return!0;const c=be(a.cwd)??"";return a.title.toLowerCase().includes(n)||a.slug.toLowerCase().includes(n)||c.toLowerCase().includes(n)})}function ft(){try{const t=localStorage.getItem(Be);if(!t)return new Set;const s=JSON.parse(t);return Array.isArray(s)?new Set(s.filter(n=>typeof n=="string")):new Set}catch{return new Set}}function Re(t){try{localStorage.setItem(Be,JSON.stringify([...t]))}catch{}}function gt({scopeCwd:t=null,navigate:s}){const n=we(p=>p.snapshot),a=i.useMemo(()=>!n||!t?n:{...n,jobs:n.jobs.filter(p=>p.cwd===t)},[n,t]),[c,o]=i.useState(null),[r,x]=i.useState(!1),[d,u]=i.useState(()=>Date.now()),[b,w]=i.useState(()=>ft()),[h,j]=i.useState(!1),[k,C]=i.useState(()=>pt()),[v,y]=i.useState(!1),[N,g]=i.useState("queue"),f=i.useRef(null),[A,$]=i.useState(()=>{try{return Number(localStorage.getItem(de))||0}catch{return 0}}),[G,xe]=i.useState(""),J=Te();i.useEffect(()=>(window.api.schedule.health().then(o).catch(()=>{}),window.api.schedule.onState(()=>{window.api.schedule.health().then(o).catch(()=>{})})),[]),i.useEffect(()=>{if(!J)return;u(Date.now());const p=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(p)},[J]);const M=i.useMemo(()=>{if(!a)return 15e4;const p=[];for(const S of a.jobs)if(S.status==="completed"&&S.startedAt&&S.finishedAt){const T=Date.parse(S.finishedAt)-Date.parse(S.startedAt);T>0&&p.push(T)}return p.length===0?15e4:p.reduce((S,T)=>S+T,0)/p.length},[a]),K=i.useRef(new Map);i.useEffect(()=>{if(!a)return;const p=[];for(const S of a.jobs){const T=K.current.get(S.slug);T&&T!==S.status&&p.push(`${S.title}: ${T} → ${S.status}`),K.current.set(S.slug,S.status)}p.length>0&&xe(p.join("; "))},[a]);const X=i.useMemo(()=>{var S;const p=new Map;for(const T of((S=a==null?void 0:a.lastTick)==null?void 0:S.holds)??[])p.set(T.slug,T);return p},[a==null?void 0:a.lastTick]),Z=i.useCallback(p=>{var T,ie,ke;const S=(T=f.current)==null?void 0:T.querySelectorAll("[data-job-row]");if(!(!S||S.length===0)){if(p.key==="ArrowDown"){p.preventDefault();const V=Math.min(A+1,S.length-1);$(V);try{localStorage.setItem(de,String(V))}catch{}(ie=S[V])==null||ie.focus()}else if(p.key==="ArrowUp"){p.preventDefault();const V=Math.max(A-1,0);$(V);try{localStorage.setItem(de,String(V))}catch{}(ke=S[V])==null||ke.focus()}}},[A]),pe=i.useCallback(p=>{$(p);try{localStorage.setItem(de,String(p))}catch{}},[]);if(!a)return null;if(N==="supervisor")return e.jsx(It,{supervisorConfig:a.config.supervisor,onSetConfig:p=>window.api.schedule.setConfig({supervisor:p}),onBack:()=>g("queue")});const{config:ee,jobs:O,paused:me,lastRunAt:q,nextReset:Q,effectiveConcurrency:R}=a;if(O.length===0)return e.jsx(vt,{navigate:s});const F={pending:0,running:0,investigating:0,completed:0,needs_review:0,failed:0};for(const p of O)p.status in F&&F[p.status]++;const te=O.filter(p=>p.status==="running"),l=jt({snap:a,now:d,avgDurationMs:M,runningJobs:te}),m=ht(O,k),P=Nt(m),{inline:I,collapsedCount:E}=yt(m,b,d,h),_=At(I,O,P,M,l.kind,d),Y=()=>{const p=new Set(b);for(const S of O)(S.status==="completed"||S.status==="failed")&&p.add(S.slug);w(p),Re(p)},Je=async()=>{const p=O.filter(ie=>ie.status!=="running").length;if(p===0)return;const S=`Archive ${p} non-running PRD${p===1?"":"s"} and remove from the queue?
1
+ import{a7 as e,aC as we,ag as i,az as Te,a as ue,W as U,aq as L,a1 as H,a3 as re,Y as z,af as be,aA as le,ak as ve,al as je,_ as Se,aF as ce,x as Le,ab as W,q as Me,L as Oe,m as Ue,k as Ne,s as ye,D as B,d as D,$ as Fe,v as _e,T as Qe,ac as Pe,au as $e,j as ae,r as Ce,i as Ye,ao as We,y as Ke,p as He,aw as Xe,at as se,w as Ze,C as et,aD as tt,ah as st,aG as nt,aE as Ae,l as at,n as he}from"./index-DApB4DHS.js";import{l as rt}from"./listSkills-QORduPIk.js";import{T as lt}from"./Toggle-B_EH2TFb.js";import"./monaco-editor-BW5C4Iv1.js";function it({options:t,active:s,onChange:n}){return e.jsx("div",{className:"inline-flex gap-1 bg-bg-hi p-1 rounded-xl shadow-[inset_0_0_0_1px] shadow-line",children:t.map(({key:a,label:c})=>{const o=s===a;return e.jsx("button",{type:"button",onClick:()=>n(a),className:`px-[18px] py-[7px] rounded-lg text-[13.5px] transition-colors ${o?"bg-bg-elev shadow-[inset_0_0_0_1px] shadow-line font-semibold text-fg":"font-medium text-fg-dim hover:text-fg"}`,children:c},a)})})}const ot=5e3;let oe=null,ne=null;async function De(t){const s=Date.now();return!(t!=null&&t.fresh)&&oe&&s-oe.at<ot?oe.result:ne||(ne=(async()=>{try{const n=await window.api.schedule.lintQueue();return oe={result:n,at:Date.now()},n}finally{ne=null}})(),ne)}function qe({options:t,value:s,onChange:n,pillPadding:a="px-3 py-1.5"}){return e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:t.map(c=>{const o=c.value===s;return e.jsxs("button",{type:"button",onClick:()=>n(c.value),className:`rounded-full ${a} text-[12.5px] border transition-colors ${o?"bg-accent text-white border-accent font-semibold":"bg-bg-hi text-fg-dim border-line hover:border-fg-faint font-medium"}`,children:[c.label,c.count!==void 0&&e.jsxs("span",{children:[" ",c.count]})]},c.value)})})}const dt=5,ct=1440*60*1e3,Be="sm.scheduler.hiddenCompletedSlugs",de="sm.scheduler.focusedJobIndex",Ge="sm.scheduler.queueFilter";function ut(t,s=60){const n=t.trim();return n.length<=s?n:`${n.slice(0,s-1)}…`}const xt=["all","running","investigating","pending","completed","skipped","needs_review","failed","quarantined"];function pt(){try{const t=localStorage.getItem(Ge);if(!t)return{text:"",status:"all"};const s=JSON.parse(t);return{text:"",status:xt.includes(s.status)?s.status:"all"}}catch{return{text:"",status:"all"}}}function mt(t){try{localStorage.setItem(Ge,JSON.stringify({status:t.status}))}catch{}}function ht(t,s){if(s.status==="all"&&!s.text)return t;const n=s.text.toLowerCase();return t.filter(a=>{if(s.status!=="all"&&a.status!==s.status)return!1;if(!n)return!0;const c=be(a.cwd)??"";return a.title.toLowerCase().includes(n)||a.slug.toLowerCase().includes(n)||c.toLowerCase().includes(n)})}function ft(){try{const t=localStorage.getItem(Be);if(!t)return new Set;const s=JSON.parse(t);return Array.isArray(s)?new Set(s.filter(n=>typeof n=="string")):new Set}catch{return new Set}}function Re(t){try{localStorage.setItem(Be,JSON.stringify([...t]))}catch{}}function gt({scopeCwd:t=null,navigate:s}){const n=we(p=>p.snapshot),a=i.useMemo(()=>!n||!t?n:{...n,jobs:n.jobs.filter(p=>p.cwd===t)},[n,t]),[c,o]=i.useState(null),[r,x]=i.useState(!1),[d,u]=i.useState(()=>Date.now()),[b,w]=i.useState(()=>ft()),[h,j]=i.useState(!1),[k,C]=i.useState(()=>pt()),[v,y]=i.useState(!1),[N,g]=i.useState("queue"),f=i.useRef(null),[A,$]=i.useState(()=>{try{return Number(localStorage.getItem(de))||0}catch{return 0}}),[G,xe]=i.useState(""),J=Te();i.useEffect(()=>(window.api.schedule.health().then(o).catch(()=>{}),window.api.schedule.onState(()=>{window.api.schedule.health().then(o).catch(()=>{})})),[]),i.useEffect(()=>{if(!J)return;u(Date.now());const p=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(p)},[J]);const M=i.useMemo(()=>{if(!a)return 15e4;const p=[];for(const S of a.jobs)if(S.status==="completed"&&S.startedAt&&S.finishedAt){const T=Date.parse(S.finishedAt)-Date.parse(S.startedAt);T>0&&p.push(T)}return p.length===0?15e4:p.reduce((S,T)=>S+T,0)/p.length},[a]),K=i.useRef(new Map);i.useEffect(()=>{if(!a)return;const p=[];for(const S of a.jobs){const T=K.current.get(S.slug);T&&T!==S.status&&p.push(`${S.title}: ${T} → ${S.status}`),K.current.set(S.slug,S.status)}p.length>0&&xe(p.join("; "))},[a]);const X=i.useMemo(()=>{var S;const p=new Map;for(const T of((S=a==null?void 0:a.lastTick)==null?void 0:S.holds)??[])p.set(T.slug,T);return p},[a==null?void 0:a.lastTick]),Z=i.useCallback(p=>{var T,ie,ke;const S=(T=f.current)==null?void 0:T.querySelectorAll("[data-job-row]");if(!(!S||S.length===0)){if(p.key==="ArrowDown"){p.preventDefault();const V=Math.min(A+1,S.length-1);$(V);try{localStorage.setItem(de,String(V))}catch{}(ie=S[V])==null||ie.focus()}else if(p.key==="ArrowUp"){p.preventDefault();const V=Math.max(A-1,0);$(V);try{localStorage.setItem(de,String(V))}catch{}(ke=S[V])==null||ke.focus()}}},[A]),pe=i.useCallback(p=>{$(p);try{localStorage.setItem(de,String(p))}catch{}},[]);if(!a)return null;if(N==="supervisor")return e.jsx(It,{supervisorConfig:a.config.supervisor,onSetConfig:p=>window.api.schedule.setConfig({supervisor:p}),onBack:()=>g("queue")});const{config:ee,jobs:O,paused:me,lastRunAt:q,nextReset:Q,effectiveConcurrency:R}=a;if(O.length===0)return e.jsx(vt,{navigate:s});const F={pending:0,running:0,investigating:0,completed:0,needs_review:0,failed:0};for(const p of O)p.status in F&&F[p.status]++;const te=O.filter(p=>p.status==="running"),l=jt({snap:a,now:d,avgDurationMs:M,runningJobs:te}),m=ht(O,k),P=Nt(m),{inline:I,collapsedCount:E}=yt(m,b,d,h),_=At(I,O,P,M,l.kind,d),Y=()=>{const p=new Set(b);for(const S of O)(S.status==="completed"||S.status==="failed")&&p.add(S.slug);w(p),Re(p)},Je=async()=>{const p=O.filter(ie=>ie.status!=="running").length;if(p===0)return;const S=`Archive ${p} non-running PRD${p===1?"":"s"} and remove from the queue?
2
2
 
3
3
  Files are moved to prds-archived/<timestamp>/ and can be restored from disk. Running jobs are kept.`;if(!window.confirm(S))return;const T=await window.api.schedule.clearQueue();T.ok||L.error(`Clear queue failed: ${T.error??"unknown error"}`)},Ve=()=>{w(new Set),Re(new Set),j(!1)},ze=I.some(p=>p.status==="completed");return e.jsxs("div",{className:"overflow-y-auto h-full",children:[e.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:G}),e.jsxs("div",{className:"px-9 py-6 max-w-[1100px] mx-auto space-y-4",children:[e.jsxs("div",{className:`flex flex-wrap items-center gap-3 px-4 py-3 rounded-xl border ${kt(l.kind)}`,title:l.tooltip,children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:`w-[38px] h-[38px] rounded-xl bg-bg border border-line flex items-center justify-center shrink-0 ${St(l.kind)}`,children:e.jsx(ue,{name:"clock",size:19})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] text-fg truncate",children:$t(Ct(l.line1,a.utilization))}),l.line2&&e.jsx("div",{className:"text-[12px] text-fg-faint font-mono mt-0.5 truncate",children:l.line2})]})]}),e.jsxs("span",{className:"ml-auto font-mono text-[11.5px] text-fg-faint whitespace-nowrap",children:[(R==null?void 0:R.cap)??5," slot",((R==null?void 0:R.cap)??5)!==1?"s":""," · last batch ",U(q?Date.parse(q):null,d)]}),l.action&&e.jsx("button",{type:"button",onClick:l.action.onClick,className:"text-[12px] px-3 py-1.5 border border-line hover:border-fg-faint rounded-lg shrink-0 hover:bg-bg-hi text-fg-dim hover:text-fg",title:l.action.title,children:l.action.label})]}),c&&c.consecutiveFailures>5&&c.lastFailureKind==="meter_rate_limited"&&!me&&!v&&e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 bg-amber-400/15 border border-amber-400/30 rounded-xl",children:[e.jsx("span",{"aria-hidden":"true",children:"⚠"}),e.jsxs("span",{className:"text-[13.5px] text-amber-400/90",children:[e.jsx("strong",{className:"font-semibold",children:"Usage meter unavailable"})," — last good reading"," ",U(c.lastPollAt,d),". Firing on a conservative estimate until it recovers."]}),e.jsx("button",{type:"button",onClick:()=>y(!0),className:"ml-auto text-[12px] text-amber-400/70 hover:text-amber-400 shrink-0",title:"Dismiss this banner. The scheduler continues firing normally.",children:"Dismiss"})]}),e.jsxs("div",{className:"flex items-center gap-[18px] flex-wrap bg-bg-elev border border-line rounded-xl px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[13px] text-fg-dim",children:"Start jobs"}),e.jsxs("select",{value:ee.firePolicy??"when-available",onChange:p=>window.api.schedule.setConfig({firePolicy:p.target.value}),className:"appearance-none border border-line bg-bg-hi rounded-lg px-2.5 py-1.5 font-sans text-[13px] text-fg font-medium",title:"when-available: poll usage and fire when tokens are below threshold. on-reset: fire after each 5h reset. manual: only on Run now.",children:[e.jsx("option",{value:"when-available",children:"when available"}),e.jsx("option",{value:"on-reset",children:"only on reset"}),e.jsx("option",{value:"manual",children:"manually"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[13px] text-fg-dim",children:"Up to"}),(R==null?void 0:R.source)==="env"&&e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-amber-400/90 bg-amber-400/10 border border-amber-400/30 rounded px-1.5 py-0.5",title:"Pinned by SM_SESSION_SLOTS — unset the env var to edit",children:"env"}),e.jsx("input",{type:"number",min:0,max:10,value:(R==null?void 0:R.cap)??5,disabled:(R==null?void 0:R.source)==="env",onChange:p=>{window.api.schedule.setSessionSlots(Number(p.target.value))},className:"w-11 text-center border border-line bg-bg-hi rounded-lg py-1.5 font-mono text-[13px] text-fg disabled:opacity-50 disabled:cursor-not-allowed",title:(R==null?void 0:R.source)==="env"?"pinned by SM_SESSION_SLOTS — unset the env var to edit":"Machine-wide claude -p session slots, shared with chat runs"}),e.jsx("span",{className:"text-[13px] text-fg-dim",children:"at once"})]}),(ee.firePolicy??"when-available")==="when-available"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[13px] text-fg-dim",children:"Pause above"}),e.jsx("input",{type:"number",min:0,max:100,value:ee.utilizationThreshold??90,onChange:p=>window.api.schedule.setConfig({utilizationThreshold:Number(p.target.value)}),className:"w-11 text-center border border-line bg-bg-hi rounded-lg py-1.5 font-mono text-[13px] text-fg",title:"Fire only when 5h utilization is below this percent"}),e.jsx("span",{className:"text-[13px] text-fg-dim",children:"% of window"})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>window.api.schedule.forceTick().then(L.fromOutcome).catch(()=>L.error("Failed to fire batch")),disabled:F.pending===0&&F.running===0,className:"bg-accent text-white rounded-lg px-4 py-2 text-[13px] font-semibold whitespace-nowrap disabled:opacity-40 disabled:cursor-not-allowed hover:opacity-90",title:"Bypasses the billing-usage poll. Use when the meter is rate-limited or you want immediate progress.",children:"Fire next batch now"}),e.jsx("button",{type:"button",onClick:()=>window.api.schedule.rescan().then(L.fromOutcome).catch(()=>L.error("Failed to rescan")),className:"bg-bg-hi border border-line text-fg-dim hover:text-fg rounded-lg px-3.5 py-2 text-[13px] font-medium",title:"Re-scan the prds/ folder. Use when you've added or edited PRDs on disk and want the queue to reflect them immediately.",children:"Refresh"})]})]}),te.length>0&&(()=>{const p=(R==null?void 0:R.cap)??5,S=O.filter(T=>T.status==="pending").length;return e.jsxs("div",{className:"flex items-center gap-2 text-[12px] font-mono",children:[e.jsxs("span",{className:"px-2 py-0.5 rounded bg-amber-400/20 text-amber-400 shrink-0",children:[te.length,"/",p," running"]}),S>0&&e.jsxs("span",{className:"text-fg-faint",children:["+",S," ready in this group"]})]})})(),O.length>0&&e.jsx(Et,{filter:k,onChange:p=>{C(p),mt(p)}}),e.jsxs("div",{className:"bg-bg-hi border border-line rounded-2xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-[18px] py-3 bg-bg-elev",children:[e.jsxs("span",{className:"font-serif text-base font-semibold text-fg",children:[m.length," job",m.length!==1?"s":""]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"font-mono text-[12px] text-fg-faint",children:[F.pending,"p · ",F.running,"r · ",F.completed,"d",F.failed>0&&e.jsxs("span",{className:"text-accent",children:[" · ",F.failed,"f"]})]}),ze&&e.jsx("button",{type:"button",onClick:Y,className:"text-[12.5px] text-fg-dim hover:text-fg bg-transparent border-0 cursor-pointer font-medium",title:"Hide completed jobs from this view (queue.json unchanged — they remain in history)",children:"Clear completed"}),e.jsx("button",{type:"button",onClick:Je,disabled:O.every(p=>p.status==="running"),className:"text-[12px] text-accent border border-accent/40 hover:bg-accent/10 rounded-md px-2.5 py-1 cursor-pointer font-medium disabled:opacity-40 disabled:cursor-not-allowed",title:"Archive every non-running PRD (moved to prds-archived/<timestamp>/) and remove them from the queue. Running jobs are kept.",children:"Archive & clear queue…"})]})]}),I.length===0&&E===0&&e.jsx("div",{className:"px-[18px] py-6 text-[13px] text-fg-faint italic",children:"no matching jobs"}),e.jsx("div",{ref:f,role:"list","aria-label":"Job queue",onKeyDown:Z,children:I.map((p,S)=>e.jsx(Rt,{job:p,eta:_.get(p.slug)??null,elapsedMs:p.status==="running"&&p.startedAt?d-Date.parse(p.startedAt):null,avgDurationMs:M,listIndex:S,hold:X.get(p.slug),onFocused:pe},p.slug))}),E>0&&e.jsxs("button",{type:"button",onClick:()=>j(p=>!p),className:"w-full text-left text-[12px] text-fg-faint hover:text-fg-dim px-[18px] py-3 border-t border-line",title:h?"Re-collapse old/cleared completed":"Show all completed (incl. cleared and >24h)",children:[h?"▾":"▸"," ",E," more completed",e.jsx("span",{className:"ml-1.5 font-mono text-[11.5px] text-fg-faint",children:"· fresh & capped at 5 shown inline"}),b.size>0&&e.jsx("span",{className:"ml-2 underline",onClick:p=>{p.stopPropagation(),Ve()},children:"un-hide"})]})]}),e.jsx(Lt,{snap:a,health:c,now:d,open:r,setOpen:x}),!me&&e.jsxs("div",{className:"flex gap-2.5 bg-sage/10 border border-sage/30 rounded-xl px-3.5 py-2.5 text-[13.5px] text-fg-dim leading-relaxed",children:[e.jsx("span",{"aria-hidden":"true",children:"✓"}),e.jsxs("span",{children:[e.jsx("strong",{className:"font-semibold text-fg",children:"Nothing needed from you."})," ","Close the app if you like — jobs keep running, and History shows how each one ended."]})]}),e.jsxs("div",{className:"flex items-center justify-between text-[12px] text-fg-faint pt-1 border-t border-line",children:[e.jsxs("span",{children:[Q&&e.jsxs("span",{title:`next 5h reset: ${Q}`,children:["reset ",H(Date.parse(Q)-d)]}),q&&e.jsxs("span",{className:"ml-2",title:q,children:["last run ",H(d-Date.parse(q))," ago"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>g("supervisor"),className:"hover:text-fg-dim underline",title:"Open supervisor log and settings",children:"supervisor"}),e.jsx("button",{type:"button",onClick:()=>window.api.schedule.openFolder(),className:"hover:text-fg-dim underline",children:"folder"})]})]})]})]})}const bt=[{title:"Start a session",body:"In Sessions, pick an Agent and a Mission, describe the outcome you want, then Approve & start. Its thread writes the PRD files into that session's own folder."},{title:"Queue what it wrote",body:"The PRDs tab lists every file the session produced. Queue one, or the whole session, and they appear here."},{title:"Leave it alone",body:"Jobs start themselves inside your window, pause on rate-limit, and resume at the reset. History records how each ended."}],wt=[{term:"Session",def:"One goal, one Claude session, and the folder of PRDs written to reach it."},{term:"PRD",def:"One markdown file = one job. Authored by the session."},{term:"5-hour window",def:"Your Claude billing window, on a rolling clock."},{term:"Session pool",def:"5 slots shared with terminal and session chats."}];function vt({navigate:t}){return e.jsx("div",{className:"overflow-y-auto h-full",children:e.jsx("div",{className:"px-9 py-6 max-w-[900px] mx-auto",children:e.jsxs("div",{className:"bg-bg-hi border border-line rounded-2xl px-9 py-8",children:[e.jsx("h2",{className:"m-0 font-serif text-[25px] font-semibold text-fg",children:"Nothing to run yet — the scheduler needs a session."}),e.jsx("p",{className:"mt-2 mb-6 text-[14.5px] text-fg-dim leading-relaxed max-w-[580px]",children:"You don't write PRDs here. A session breaks its goal into numbered PRD files, and this page runs them in order. Two steps, once."}),e.jsx("div",{className:"grid grid-cols-3 gap-3.5",children:bt.map((s,n)=>{const a=n===0;return e.jsxs("div",{className:`bg-bg border rounded-xl px-4 py-4 flex flex-col gap-2 ${a?"border-accent shadow-[0_0_0_3px_rgba(184,92,52,.09)]":"border-line"}`,children:[e.jsx("span",{className:`w-6 h-6 rounded-full grid place-items-center font-mono text-[12px] font-semibold ${a?"bg-accent text-white":"bg-bg-elev text-fg-dim"}`,children:n+1}),e.jsx("h3",{className:"m-0 text-[15px] font-semibold text-fg",children:s.title}),e.jsx("p",{className:"m-0 text-[13.5px] text-fg-dim leading-relaxed",children:s.body}),a&&e.jsx("button",{type:"button",onClick:()=>t==null?void 0:t("terminal"),className:"self-start bg-accent text-white rounded-lg px-3.5 py-1.5 text-[13px] font-semibold mt-1",children:"Go to Sessions →"})]},s.title)})}),e.jsx("dl",{className:"flex mt-[22px] pt-4 border-t border-line gap-5 flex-wrap",children:wt.map(({term:s,def:n})=>e.jsxs("div",{className:"flex-1 min-w-[150px]",children:[e.jsx("dt",{className:"text-[13.5px] font-semibold text-fg mb-0.5",children:s}),e.jsx("dd",{className:"m-0 text-[12.5px] text-fg-faint leading-relaxed",children:n})]},s))})]})})})}function jt({snap:t,now:s,avgDurationMs:n,runningJobs:a}){const{config:c,jobs:o,paused:r,nextReset:x,utilization:d,effectiveConcurrency:u}=t;let b=0,w=0;for(const y of o)y.status==="pending"?b++:y.status==="completed"&&w++;const h=a.length,j=b+h,k=(u==null?void 0:u.cap)??5;if(h>0){const y=a.reduce(($,G)=>($.startedAt??"")<(G.startedAt??"")?$:G),N=y.startedAt?s-Date.parse(y.startedAt):0,g=w+h,f=w+j,A=h>1?` · ${h}/${k} parallel`:"";return{kind:"running",line1:`Running ${g}/${f}${A} · ${re(N)}`,line2:h===1?y.title:a.map($=>$.title).join(", "),tooltip:a.map($=>`${$.slug} (g${$.parallelGroup})`).join("; ")}}if(r){const y=r.resumeAt?Date.parse(r.resumeAt)-s:null;return{kind:"paused",line1:{rate_limit:"Paused — tokens exhausted",auth:"Paused — authentication failed",network:"Paused — network unreachable",reset_failure:"Paused — billing data unavailable",manual:"Paused — manual"}[r.reason]??`Paused — ${r.reason}`,line2:r.reason==="auth"?"Run `claude` in any terminal to refresh credentials, then Resume":y!==null&&y>0?`auto-resume ${z(Date.parse(r.resumeAt))} (in ${H(y)})`:r.resumeAt?"resuming…":"no auto-resume scheduled",tooltip:r.resumeAt??"",action:{label:"Resume",onClick:()=>window.api.schedule.resume(),title:"Clear the pause and resume queue immediately"}}}if(j===0)return{kind:"idle",line1:"No work queued",line2:null};const C=c.firePolicy??"when-available";if(C==="manual")return{kind:"manual",line1:`Manual · ${b} pending`,line2:"click Fire next batch now to fire",action:{label:"Fire next batch now",onClick:()=>window.api.schedule.forceTick().then(L.fromOutcome).catch(()=>L.error("Failed to fire batch")),title:"Bypasses the billing-usage poll. Use when the meter is rate-limited or you want immediate progress."}};if(C==="on-reset"){if(!x)return{kind:"on-reset",line1:"On-reset · waiting for billing data",line2:null};const y=Date.parse(x)+c.offsetMinutes*6e4,N=y-s;return{kind:"on-reset",line1:`On-reset · ${b} pending`,line2:N>0?`fires ${z(y)} (in ${H(N)})`:"firing now…"}}const v=c.utilizationThreshold??90;if(d==null)return{kind:"auto-soon",line1:`Auto · ${b} pending`,line2:"checking token availability…"};if(d>=v){const y=x?Date.parse(x)-s:null;return{kind:"auto-throttled",line1:`Auto · throttled (util ${d.toFixed(0)}% ≥ ${v}%)`,line2:y&&y>0?`next reset ${z(Date.parse(x))} (in ${H(y)})`:"will fire when usage drops"}}return{kind:"auto-soon",line1:`Auto · ${b} pending · util ${d.toFixed(0)}%`,line2:"fires within 2 min (poll cycle)"}}function Nt(t){const s=t.filter(a=>a.status==="running"||a.status==="pending").sort((a,c)=>a.parallelGroup-c.parallelGroup||a.slug.localeCompare(c.slug)),n=new Map;return s.forEach((a,c)=>n.set(a.slug,c)),n}function yt(t,s,n,a){if(a)return{inline:t,collapsedCount:0};const c=t.filter(u=>u.status==="completed").sort((u,b)=>{const w=u.finishedAt?Date.parse(u.finishedAt):0;return(b.finishedAt?Date.parse(b.finishedAt):0)-w}),o=new Set;let r=0;for(const u of c){if(r>=dt)break;s.has(u.slug)||u.finishedAt&&n-Date.parse(u.finishedAt)>ct||(o.add(u.slug),r++)}const x=[];let d=0;for(const u of t){if(u.status==="failed"&&s.has(u.slug)){d++;continue}if(u.status!=="completed"){x.push(u);continue}o.has(u.slug)?x.push(u):d++}return{inline:x,collapsedCount:d}}function kt(t){return t==="running"?"bg-amber-400/10 border-amber-400/25":t==="paused"?"bg-amber-500/10 border-amber-500/25":t==="auto-throttled"?"bg-amber-500/5 border-amber-500/15":"bg-bg-elev border-line"}function St(t){return t==="running"||t==="auto-soon"?"text-accent":t==="idle"?"text-sage":t==="paused"||t==="auto-throttled"?"text-butter":"text-fg-faint"}const Pt=["Running","Paused","Manual","On-reset","Auto"];function $t(t){for(const s of Pt)if(t.startsWith(s))return e.jsxs(e.Fragment,{children:[e.jsx("strong",{className:"font-bold",children:s}),t.slice(s.length)]});return t}function Ct(t,s){return s==null||t.includes("util")?t:`${t} · util ${Math.round(s)}%`}function At(t,s,n,a,c,o){const r=new Map;if(c==="paused"||c==="manual"||c==="auto-throttled"){for(const u of t)r.set(u.slug,null);return r}const x=s.find(u=>u.status==="running"&&u.startedAt),d=x!=null&&x.startedAt?o-Date.parse(x.startedAt):0;for(const u of t){if(u.status!=="pending"){r.set(u.slug,null);continue}const b=n.get(u.slug)??0;let w=b*a;b>0&&(w-=Math.min(a,d)),r.set(u.slug,w<=5e3?"~now":`~${re(w)}`)}return r}function Dt({job:t,eta:s,elapsedMs:n,avgDurationMs:a,listIndex:c,onFocused:o,hold:r}){const[x,d]=i.useState(!1),[u,b]=i.useState(!1),w=le(A=>A.sessions),h=i.useMemo(()=>ve(t,w),[t,w]),j=h.known&&h.epicId?w[h.epicId]:null,k=i.useCallback(A=>{je(A),window.dispatchEvent(new CustomEvent("sm:navigate",{detail:"terminal"}))},[]),C=t.status==="running",v=t.status==="failed";let y=null;C&&n!==null?y=`${Se(n)} elapsed`:t.status==="completed"&&t.startedAt&&t.finishedAt?y=`took ${re(Date.parse(t.finishedAt)-Date.parse(t.startedAt))}`:s&&(y=s);const N=t.error??null,g=v&&N?N.split(`
4
4
  `)[0]:t.status==="needs_review"&&t.verifierVerdict?ce(t.verifierVerdict):null,f=C&&n!==null?Math.min(.99,n/a):0;return e.jsxs("div",{role:"listitem",className:"border-t border-line",children:[e.jsxs("button",{type:"button","data-job-row":!0,"data-job-index":c,onClick:()=>d(A=>!A),onFocus:()=>o(c),className:`w-full text-left grid grid-cols-[116px_1fr_auto_auto] items-center gap-4 px-[18px] py-3.5 hover:bg-bg/40 focus:outline-none focus:ring-1 focus:ring-accent focus:ring-inset ${x?"bg-bg-elev/40":""}`,"aria-expanded":x,"aria-label":`${W(t.slug)?`PRD ${W(t.slug)}, `:""}${t.title}, ${t.status}${y?`, ${y}`:""}`,title:t.title,children:[e.jsx(Le,{status:t.status}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 text-[14.5px] font-medium text-fg leading-snug",children:[W(t.slug)&&e.jsx(Me,{n:W(t.slug)}),t.title,e.jsx(Oe,{leaked:t.leakedDescendants}),e.jsx(Ue,{count:t.leftoverCount,truncated:t.leftoverPathsTruncated,salvagePatch:t.salvagePatch})]}),g&&e.jsx("div",{className:`text-[12.5px] mt-0.5 ${v?"text-accent/80":"text-fg-faint"}`,children:g}),r&&e.jsx("div",{className:"text-[12.5px] mt-0.5 text-amber-400/90 font-mono","data-testid":"job-row-hold",children:r.dep?e.jsxs(e.Fragment,{children:["held · waiting on ",r.dep," (",r.depStatus,")"]}):e.jsxs(e.Fragment,{children:["held · ",r.reason??"launch blocked"]})}),!r&&t.status==="pending"&&t.heldReason&&e.jsxs("div",{className:"text-[12.5px] mt-0.5 text-amber-400/90 font-mono","data-testid":"job-row-held-reason",children:["held · ",t.heldReason]}),e.jsx(Ne,{epicId:h.epicId,label:h.label?ut(h.label):null,onOpen:k,testId:"job-row-prompt-session-chip",className:"mt-0.5"})]}),e.jsx(ye,{cwd:t.cwd}),e.jsxs("span",{className:"inline-flex items-center gap-2.5 font-mono text-xs text-fg-faint shrink-0",children:[y,e.jsx("span",{className:`text-fg-faint inline-flex transition-transform duration-150 ${x?"rotate-90":""}`,"aria-hidden":"true",children:e.jsx(ue,{name:"chevron",size:14})})]})]}),C&&!x&&e.jsx("div",{className:"h-1 bg-line mx-[18px] mb-3 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent transition-all duration-1000",style:{width:`${Math.max(4,f*100)}%`}})}),x&&e.jsxs("div",{className:"px-[18px] py-5 grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-5 bg-bg-elev/50 border-t border-line",children:[e.jsxs(B,{label:"Status",children:[e.jsx(D,{k:"result",v:t.exitCode!==null?`exit ${t.exitCode}`:"—"}),e.jsx(D,{k:"state",v:t.status.replace(/_/g," ")}),t.verifierVerdict&&e.jsx(D,{k:"verdict",v:ce(t.verifierVerdict)}),t.leakedDescendants&&t.leakedDescendants.length>0&&e.jsx(D,{k:"leaked",v:Fe(t.leakedDescendants),wrap:!0}),t.leftoverCount!=null&&t.leftoverCount>0&&e.jsx(D,{k:"uncommitted",v:`${t.leftoverCount} file${t.leftoverCount===1?"":"s"}${t.leftoverPathsTruncated?"+":""}: ${(t.leftoverPaths??[]).join(", ")}${t.salvagePatch?` — salvaged to ${t.salvagePatch}`:""}`,wrap:!0}),N&&e.jsx(D,{k:"error",v:N.split(`
@@ -1 +1 @@
1
- import{a7 as i,S as d}from"./index-CuyM9vAP.js";function a({scopes:l,active:n,onChange:o,annotate:s}){return i.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:l.map(t=>{const r=d[t],e=s==null?void 0:s(t),c=t===n;return i.jsxs("button",{title:r.hint,onClick:()=>o(t),className:`px-2.5 py-1 text-xs flex items-center gap-1.5 transition-colors ${c?"bg-bg-hi text-fg":"bg-bg-elev text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[i.jsx("span",{children:r.label}),(e==null?void 0:e.dirty)&&i.jsx("span",{className:"w-1 h-1 rounded-full bg-accent",title:"unsaved edits"}),e&&e.exists===!1&&!e.dirty&&i.jsx("span",{className:"w-1 h-1 rounded-full bg-fg-faint",title:"not yet created"})]},t)})})}export{a as S};
1
+ import{a7 as i,S as d}from"./index-DApB4DHS.js";function a({scopes:l,active:n,onChange:o,annotate:s}){return i.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:l.map(t=>{const r=d[t],e=s==null?void 0:s(t),c=t===n;return i.jsxs("button",{title:r.hint,onClick:()=>o(t),className:`px-2.5 py-1 text-xs flex items-center gap-1.5 transition-colors ${c?"bg-bg-hi text-fg":"bg-bg-elev text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[i.jsx("span",{children:r.label}),(e==null?void 0:e.dirty)&&i.jsx("span",{className:"w-1 h-1 rounded-full bg-accent",title:"unsaved edits"}),e&&e.exists===!1&&!e.dirty&&i.jsx("span",{className:"w-1 h-1 rounded-full bg-fg-faint",title:"not yet created"})]},t)})})}export{a as S};
@@ -1,3 +1,3 @@
1
- import{ag as d,a7 as e,S,a as Z,j as M,aB as Y,R as Q,aq as X,aw as ee,aE as $,ay as te,at as R,J as se,V as ae,w as F}from"./index-CuyM9vAP.js";import{P as ne}from"./Panel-CD5wxGSR.js";import{S as re}from"./ScopeSwitcher-CeifaOlq.js";import{S as J}from"./SaveBar-BDk5e3Pp.js";import{u as le,m as ie,p as oe,a as G,E as ce,s as de}from"./settingsSchema-DrxC67uZ.js";import{T as U}from"./Toggle-D9eYoZh4.js";import"./monaco-editor-BW5C4Iv1.js";const ue=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle","permissions"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Model allow/override lists, reasoning depth, and fast-mode toggles — machine-wide, with no per-Epic override yet. An Epic's Agent persona model (Agent Library) still wins over Essentials' plain model default.",advanced:!0,keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],pe={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function B(a){return a.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((l,n)=>{const r=pe[l];return r||(n===0?l.charAt(0).toUpperCase()+l.slice(1):l)}).join(" ")}function K(a){const s=new Set,t=[];for(const n of ue){const r=n.keys.filter(i=>a.has(i));r.forEach(i=>s.add(i)),r.length!==0&&t.push({id:n.id,title:n.title,summary:n.summary,advanced:!!n.advanced,keys:r})}const l=Array.from(a).filter(n=>!s.has(n)&&n!=="$schema").sort();return l.length>0&&t.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:l}),t}function xe(a,s){return K(a).map(t=>({id:t.id,title:t.title,advanced:t.advanced,total:t.keys.length,setCount:t.keys.filter(l=>s.has(l)).length}))}const me={};function V(a,s){if(s)return{text:s,authored:!1};const t=me[a];return t?{text:t,authored:!0}:null}const fe={essentials:"star",git:"link",memory:"memory",model:"sparkle",interface:"eye",updates:"reload",env:"keys",hooks:"hooks",mcp:"mcp",plugins:"plugins",filesystem:"folder",login:"lock",feedback:"send",advanced:"shield",other:"dot"},ge=["user","project","local","default"],he={user:"user",project:"project",local:"local",default:"default"};function be({node:a,targetScope:s,onOverride:t,schema:l}){const[n,r]=d.useState(""),[i,p]=d.useState(!1),[x,v]=d.useState(!0),u=a.kind==="object"?a:null,N=u?Object.keys(u.children):[],g=l.rootKeys(),b=new Set([...N,...g]),c=d.useMemo(()=>K(b),[Array.from(b).sort().join(",")]),h=d.useMemo(()=>xe(b,new Set(N)),[Array.from(b).sort().join(","),N.join(",")]),[C,E]=d.useState(null),m=d.useRef(null),k=o=>{const y=c.find(j=>j.id===o);y!=null&&y.advanced&&!i&&p(!0),E(o)};d.useEffect(()=>{if(!C)return;E(null);const o=m.current,y=document.getElementById(`settings-group-${C}`);if(!o||!y)return;const j=y.getBoundingClientRect().top-o.getBoundingClientRect().top;o.scrollBy({top:j,behavior:"smooth"})},[C]);const w=d.useMemo(()=>c.filter(o=>i||!o.advanced).map(o=>({...o,keys:o.keys.filter(y=>{const j=(u==null?void 0:u.children[y])!==void 0;if(!x&&!j)return!1;if(!n.trim())return!0;const T=l.at([y]);return[y,B(y),(T==null?void 0:T.description)??""].join(" ").toLowerCase().includes(n.toLowerCase())})})).filter(o=>o.keys.length>0),[c,n,i,x,u,l]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:"text-fg-faint",children:["writing overrides to"," ",e.jsx("span",{className:"text-fg-dim font-medium",children:S[s].label})]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:o=>v(o.target.checked),className:"accent-accent"}),"show not-yet-configured"]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:o=>p(o.target.checked),className:"accent-accent"}),"show advanced"]}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:n,onChange:o=>r(o.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(ye,{groups:h,onJump:k}),e.jsxs("div",{ref:m,className:"flex-1 overflow-auto py-3",children:[w.map(o=>e.jsx(ve,{id:o.id,title:o.title,summary:o.summary,advanced:o.advanced,children:o.keys.map(y=>{const j=u==null?void 0:u.children[y],T=l.at([y]);return e.jsx(je,{keyName:y,node:j,info:T,targetScope:s,onOverride:(f,P)=>t([y],f,P)},y)})},o.id)),w.length===0&&e.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',n,'"']})]})]})]})}function ye({groups:a,onJump:s}){return e.jsx("nav",{className:"shrink-0 w-48 border-r border-line bg-bg-elev/30 overflow-y-auto py-3",children:a.map(t=>e.jsxs("button",{onClick:()=>s(t.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bg-hi transition-colors",title:`jump to ${t.title}`,children:[e.jsx(Z,{name:fe[t.id]??"dot",size:15,className:"text-fg-faint shrink-0"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-fg-dim",children:t.title}),e.jsxs("span",{className:"text-[10px] text-fg-faint font-mono shrink-0",children:[t.setCount,"/",t.total]})]},t.id))})}function ve({id:a,title:s,summary:t,advanced:l,children:n}){const[r,i]=d.useState(!0);return e.jsxs("section",{id:`settings-group-${a}`,className:"mx-4 mb-4 rounded-lg border border-line shadow-sm bg-bg-elev/50 overflow-hidden",children:[e.jsxs("header",{className:"px-4 py-3 bg-bg-elev cursor-pointer hover:bg-bg-hi flex items-center gap-3 border-b border-line",onClick:()=>i(!r),children:[e.jsx("span",{className:"text-fg-faint w-3",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-fg text-base font-semibold",children:s}),l&&e.jsx("span",{className:"text-[9px] px-1.5 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"advanced"})]}),e.jsx("p",{className:"text-fg-dim text-sm mt-0.5",children:t})]})]}),r&&e.jsx("div",{className:"divide-y divide-line/60",children:n})]})}function je({keyName:a,node:s,info:t,targetScope:l,onOverride:n}){const[r,i]=d.useState(!1),[p,x]=d.useState(!1),v=B(a),u=s!==void 0,g=(s==null?void 0:s.kind)==="leaf"?s:null,b=(s==null?void 0:s.kind)==="object"||(s==null?void 0:s.kind)==="array",c=t==null?void 0:t.default,h=g&&c!==void 0&&z(g.value,c),C=Oe({isSet:u,leafNode:g,defaultVal:c,isDefault:!!h,node:s}),E=Ne(g,c),m=E.length>=2,k=!!g&&!h,w=V(a,t==null?void 0:t.description);return e.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{onClick:()=>i(!r),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:r?"collapse":"expand",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-fg text-sm",children:v}),e.jsx(Pe,{kind:C.kind,label:C.label}),m&&e.jsxs("button",{onClick:o=>{o.stopPropagation(),r||i(!0),x(y=>!y)},className:"text-[9px] px-1.5 py-0 rounded border border-blue-900/40 bg-blue-950/30 text-blue-300/90 uppercase tracking-wide hover:bg-blue-900/40",title:"this key is defined in multiple scopes — click to expand",children:["drift · ",E.map(o=>he[o]).join(" · ")]}),k&&g&&e.jsx("button",{onClick:o=>{o.stopPropagation(),n(void 0,g.winner)},className:"text-[9px] px-1.5 py-0 rounded border border-line bg-bg-elev text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`reset · delete from ${S[g.winner].label}`,children:"↺ reset"}),(t==null?void 0:t.deprecated)&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"deprecated"}),(t==null?void 0:t.required)&&!u&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-red-900/40 bg-red-950/30 text-red-400/80 uppercase tracking-wide",children:"required"})]}),w&&e.jsx("p",{className:`text-fg-dim text-xs mt-0.5 leading-relaxed ${w.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:w.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:Ae(w.text)}),r&&p&&g&&e.jsx(we,{leaf:g,defaultVal:c,onReset:o=>n(void 0,o)}),r&&e.jsx(ke,{keyName:a,node:s,info:t,targetScope:l,onOverride:o=>n(o)})]}),e.jsx("div",{className:"shrink-0",children:!r&&e.jsx(Te,{node:s,info:t,onSet:o=>{n(o)},disabled:b&&u})})]})})}function Ne(a,s){if(!a)return[];const t=new Set;t.add(a.winner);for(const l of a.shadowed)t.add(l.scope);return s!==void 0&&t.add("default"),ge.filter(l=>t.has(l))}function we({leaf:a,defaultVal:s,onReset:t}){const l={};l[a.winner]={value:a.value,winner:!0};for(const n of a.shadowed)l[n.scope]={value:n.value,winner:!1};return e.jsxs("div",{className:"mt-2 border border-line rounded bg-bg-elev/40 text-xs",children:[e.jsx("div",{className:"px-2 py-1 text-fg-faint border-b border-line/60",children:"Values across all scopes (winner highlighted · reset removes that scope's value):"}),e.jsxs("div",{className:"divide-y divide-line/60",children:[["user","project","local"].map(n=>{const r=l[n],i=r!==void 0;return e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:S[n].label}),e.jsx("span",{className:`font-mono truncate ${r!=null&&r.winner?"text-accent":"text-fg-dim"}`,children:i?A(r.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),i?e.jsx("button",{onClick:()=>t(n),className:"text-[9px] px-1.5 py-0 rounded border border-line text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`delete this key from ${S[n].label}`,children:"↺"}):e.jsx("span",{})]},n)}),e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:"Default"}),e.jsx("span",{className:"font-mono text-fg-dim truncate",children:s!==void 0?A(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function ke({keyName:a,node:s,info:t,targetScope:l,onOverride:n}){const i=(s==null?void 0:s.kind)==="leaf"?s:null,p=V(a,t==null?void 0:t.description);return e.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[p&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${p.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:p.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:p.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(t==null?void 0:t.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(t.type)?t.type.join(" | "):t.type})]}),(t==null?void 0:t.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:A(t.default)})]}),(t==null?void 0:t.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:t.enum.map(x=>String(x)).join(" | ")})]}),i&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Current"}),e.jsxs("dd",{className:"font-mono",children:[e.jsx("span",{className:"text-fg-dim",children:A(i.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",S[i.winner].label]})]})]}),i&&i.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:i.shadowed.map((x,v)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[A(x.value)," —"," ",e.jsx("span",{className:"no-underline",children:S[x.scope].label})]},v))})]}),(s==null?void 0:s.kind)==="array"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Accumulated"}),e.jsxs("dd",{className:"text-fg-dim",children:[s.items.length," items across all scopes"]})]})]}),e.jsx("div",{className:"pt-2 flex items-center gap-2 flex-wrap border-t border-line/60",children:e.jsx(Se,{keyName:a,node:s,info:t,onChange:n,targetScope:l})})]})}function Se({node:a,info:s,onChange:t,targetScope:l}){const r=(a==null?void 0:a.kind)==="leaf"?a.value:s==null?void 0:s.default,i=W(s==null?void 0:s.type);if(i==="boolean"){const p=r===!0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:[{v:!0,label:"on"},{v:!1,label:"off"}].map(({v:x,label:v})=>e.jsx("button",{onClick:()=>t(x),className:`px-3 py-0.5 text-xs transition-colors ${p===x?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:v},v))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[l].label]})]})}return s!=null&&s.enum?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-fg-faint",children:"Choose:"}),s.enum.map(p=>{const x=z(r,p);return e.jsx("button",{onClick:()=>t(p),className:`px-2 py-0.5 text-xs rounded border ${x?"bg-accent text-bg border-accent":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,children:String(p)},String(p))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[l].label]})]}):i==="integer"||i==="number"?e.jsx(Ce,{value:typeof r=="number"?r:void 0,integer:i==="integer",onCommit:t,target:S[l].label}):i==="string"?e.jsx(Ee,{value:typeof r=="string"?r:"",onCommit:t,target:S[l].label}):e.jsxs("div",{className:"text-fg-faint",children:["Complex value (",i??"object/array",") — use the"," ",e.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function Ce({value:a,integer:s,onCommit:t,target:l}){const[n,r]=d.useState(a!==void 0?String(a):""),i=()=>{const p=s?parseInt(n,10):parseFloat(n);Number.isNaN(p)||t(p)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("input",{type:"number",value:n,onChange:p=>r(p.target.value),onBlur:i,onKeyDown:p=>{p.key==="Enter"&&p.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:i,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",l]})]})}function Ee({value:a,onCommit:s,target:t}){const[l,n]=d.useState(a);return e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"text-fg-faint shrink-0",children:"Set to:"}),e.jsx("input",{type:"text",value:l,onChange:r=>n(r.target.value),onKeyDown:r=>{r.key==="Enter"&&s(l)},className:"flex-1 min-w-0 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:()=>s(l),className:"shrink-0 px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",t]})]})}function Te({node:a,info:s,onSet:t,disabled:l}){const n=(a==null?void 0:a.kind)==="leaf",r=W(s==null?void 0:s.type);if(l)return null;if(r==="boolean"){const i=n&&a.value===!0;return e.jsx("button",{onClick:()=>t(!i),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${i?"bg-accent/15 text-accent border-accent/40 hover:bg-accent hover:text-bg":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,title:"toggle",children:i?"on":"off"})}return null}function Oe({isSet:a,leafNode:s,defaultVal:t,isDefault:l,node:n}){return a?(n==null?void 0:n.kind)==="array"?{kind:"accumulated",label:`${n.items.length} items`}:(n==null?void 0:n.kind)==="object"?{kind:"set",label:"configured"}:s?l?{kind:"default",label:`= default · ${S[s.winner].label}`}:s.shadowed.length>0?{kind:"override",label:`overriding ${s.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${S[s.winner].label}`}:{kind:"set",label:"configured"}:t!==void 0?{kind:"default",label:`using default: ${A(t)}`}:{kind:"unset",label:"not configured"}}function Pe({kind:a,label:s}){const t={set:"bg-accent/15 text-accent border-accent/30",default:"bg-bg-hi text-fg-dim border-line",unset:"bg-bg-elev text-fg-faint border-line",override:"bg-purple-950/30 text-purple-400/80 border-purple-900/40",accumulated:"bg-blue-950/30 text-blue-400/80 border-blue-900/40"}[a];return e.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${t}`,children:s})}function W(a){if(a)return Array.isArray(a)?a.find(t=>t!=="null")??a[0]:a}function z(a,s){return a===s?!0:typeof a!=typeof s?!1:a&&s&&typeof a=="object"?JSON.stringify(a)===JSON.stringify(s):!1}function Ae(a){const s=a.trim().split(`
1
+ import{ag as d,a7 as e,S,a as Z,j as M,aB as Y,R as Q,aq as X,aw as ee,aE as $,ay as te,at as R,J as se,V as ae,w as F}from"./index-DApB4DHS.js";import{P as ne}from"./Panel-D93o-sxe.js";import{S as re}from"./ScopeSwitcher-C-locvy0.js";import{S as J}from"./SaveBar-Cg4lbChb.js";import{u as le,m as ie,p as oe,a as G,E as ce,s as de}from"./settingsSchema-BKa-xk8g.js";import{T as U}from"./Toggle-B_EH2TFb.js";import"./monaco-editor-BW5C4Iv1.js";const ue=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle","permissions"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Model allow/override lists, reasoning depth, and fast-mode toggles — machine-wide, with no per-Epic override yet. An Epic's Agent persona model (Agent Library) still wins over Essentials' plain model default.",advanced:!0,keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],pe={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function B(a){return a.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((l,n)=>{const r=pe[l];return r||(n===0?l.charAt(0).toUpperCase()+l.slice(1):l)}).join(" ")}function K(a){const s=new Set,t=[];for(const n of ue){const r=n.keys.filter(i=>a.has(i));r.forEach(i=>s.add(i)),r.length!==0&&t.push({id:n.id,title:n.title,summary:n.summary,advanced:!!n.advanced,keys:r})}const l=Array.from(a).filter(n=>!s.has(n)&&n!=="$schema").sort();return l.length>0&&t.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:l}),t}function xe(a,s){return K(a).map(t=>({id:t.id,title:t.title,advanced:t.advanced,total:t.keys.length,setCount:t.keys.filter(l=>s.has(l)).length}))}const me={};function V(a,s){if(s)return{text:s,authored:!1};const t=me[a];return t?{text:t,authored:!0}:null}const fe={essentials:"star",git:"link",memory:"memory",model:"sparkle",interface:"eye",updates:"reload",env:"keys",hooks:"hooks",mcp:"mcp",plugins:"plugins",filesystem:"folder",login:"lock",feedback:"send",advanced:"shield",other:"dot"},ge=["user","project","local","default"],he={user:"user",project:"project",local:"local",default:"default"};function be({node:a,targetScope:s,onOverride:t,schema:l}){const[n,r]=d.useState(""),[i,p]=d.useState(!1),[x,v]=d.useState(!0),u=a.kind==="object"?a:null,N=u?Object.keys(u.children):[],g=l.rootKeys(),b=new Set([...N,...g]),c=d.useMemo(()=>K(b),[Array.from(b).sort().join(",")]),h=d.useMemo(()=>xe(b,new Set(N)),[Array.from(b).sort().join(","),N.join(",")]),[C,E]=d.useState(null),m=d.useRef(null),k=o=>{const y=c.find(j=>j.id===o);y!=null&&y.advanced&&!i&&p(!0),E(o)};d.useEffect(()=>{if(!C)return;E(null);const o=m.current,y=document.getElementById(`settings-group-${C}`);if(!o||!y)return;const j=y.getBoundingClientRect().top-o.getBoundingClientRect().top;o.scrollBy({top:j,behavior:"smooth"})},[C]);const w=d.useMemo(()=>c.filter(o=>i||!o.advanced).map(o=>({...o,keys:o.keys.filter(y=>{const j=(u==null?void 0:u.children[y])!==void 0;if(!x&&!j)return!1;if(!n.trim())return!0;const T=l.at([y]);return[y,B(y),(T==null?void 0:T.description)??""].join(" ").toLowerCase().includes(n.toLowerCase())})})).filter(o=>o.keys.length>0),[c,n,i,x,u,l]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:"text-fg-faint",children:["writing overrides to"," ",e.jsx("span",{className:"text-fg-dim font-medium",children:S[s].label})]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:o=>v(o.target.checked),className:"accent-accent"}),"show not-yet-configured"]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:o=>p(o.target.checked),className:"accent-accent"}),"show advanced"]}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:n,onChange:o=>r(o.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(ye,{groups:h,onJump:k}),e.jsxs("div",{ref:m,className:"flex-1 overflow-auto py-3",children:[w.map(o=>e.jsx(ve,{id:o.id,title:o.title,summary:o.summary,advanced:o.advanced,children:o.keys.map(y=>{const j=u==null?void 0:u.children[y],T=l.at([y]);return e.jsx(je,{keyName:y,node:j,info:T,targetScope:s,onOverride:(f,P)=>t([y],f,P)},y)})},o.id)),w.length===0&&e.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',n,'"']})]})]})]})}function ye({groups:a,onJump:s}){return e.jsx("nav",{className:"shrink-0 w-48 border-r border-line bg-bg-elev/30 overflow-y-auto py-3",children:a.map(t=>e.jsxs("button",{onClick:()=>s(t.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bg-hi transition-colors",title:`jump to ${t.title}`,children:[e.jsx(Z,{name:fe[t.id]??"dot",size:15,className:"text-fg-faint shrink-0"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-fg-dim",children:t.title}),e.jsxs("span",{className:"text-[10px] text-fg-faint font-mono shrink-0",children:[t.setCount,"/",t.total]})]},t.id))})}function ve({id:a,title:s,summary:t,advanced:l,children:n}){const[r,i]=d.useState(!0);return e.jsxs("section",{id:`settings-group-${a}`,className:"mx-4 mb-4 rounded-lg border border-line shadow-sm bg-bg-elev/50 overflow-hidden",children:[e.jsxs("header",{className:"px-4 py-3 bg-bg-elev cursor-pointer hover:bg-bg-hi flex items-center gap-3 border-b border-line",onClick:()=>i(!r),children:[e.jsx("span",{className:"text-fg-faint w-3",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-fg text-base font-semibold",children:s}),l&&e.jsx("span",{className:"text-[9px] px-1.5 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"advanced"})]}),e.jsx("p",{className:"text-fg-dim text-sm mt-0.5",children:t})]})]}),r&&e.jsx("div",{className:"divide-y divide-line/60",children:n})]})}function je({keyName:a,node:s,info:t,targetScope:l,onOverride:n}){const[r,i]=d.useState(!1),[p,x]=d.useState(!1),v=B(a),u=s!==void 0,g=(s==null?void 0:s.kind)==="leaf"?s:null,b=(s==null?void 0:s.kind)==="object"||(s==null?void 0:s.kind)==="array",c=t==null?void 0:t.default,h=g&&c!==void 0&&z(g.value,c),C=Oe({isSet:u,leafNode:g,defaultVal:c,isDefault:!!h,node:s}),E=Ne(g,c),m=E.length>=2,k=!!g&&!h,w=V(a,t==null?void 0:t.description);return e.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{onClick:()=>i(!r),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:r?"collapse":"expand",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-fg text-sm",children:v}),e.jsx(Pe,{kind:C.kind,label:C.label}),m&&e.jsxs("button",{onClick:o=>{o.stopPropagation(),r||i(!0),x(y=>!y)},className:"text-[9px] px-1.5 py-0 rounded border border-blue-900/40 bg-blue-950/30 text-blue-300/90 uppercase tracking-wide hover:bg-blue-900/40",title:"this key is defined in multiple scopes — click to expand",children:["drift · ",E.map(o=>he[o]).join(" · ")]}),k&&g&&e.jsx("button",{onClick:o=>{o.stopPropagation(),n(void 0,g.winner)},className:"text-[9px] px-1.5 py-0 rounded border border-line bg-bg-elev text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`reset · delete from ${S[g.winner].label}`,children:"↺ reset"}),(t==null?void 0:t.deprecated)&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"deprecated"}),(t==null?void 0:t.required)&&!u&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-red-900/40 bg-red-950/30 text-red-400/80 uppercase tracking-wide",children:"required"})]}),w&&e.jsx("p",{className:`text-fg-dim text-xs mt-0.5 leading-relaxed ${w.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:w.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:Ae(w.text)}),r&&p&&g&&e.jsx(we,{leaf:g,defaultVal:c,onReset:o=>n(void 0,o)}),r&&e.jsx(ke,{keyName:a,node:s,info:t,targetScope:l,onOverride:o=>n(o)})]}),e.jsx("div",{className:"shrink-0",children:!r&&e.jsx(Te,{node:s,info:t,onSet:o=>{n(o)},disabled:b&&u})})]})})}function Ne(a,s){if(!a)return[];const t=new Set;t.add(a.winner);for(const l of a.shadowed)t.add(l.scope);return s!==void 0&&t.add("default"),ge.filter(l=>t.has(l))}function we({leaf:a,defaultVal:s,onReset:t}){const l={};l[a.winner]={value:a.value,winner:!0};for(const n of a.shadowed)l[n.scope]={value:n.value,winner:!1};return e.jsxs("div",{className:"mt-2 border border-line rounded bg-bg-elev/40 text-xs",children:[e.jsx("div",{className:"px-2 py-1 text-fg-faint border-b border-line/60",children:"Values across all scopes (winner highlighted · reset removes that scope's value):"}),e.jsxs("div",{className:"divide-y divide-line/60",children:[["user","project","local"].map(n=>{const r=l[n],i=r!==void 0;return e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:S[n].label}),e.jsx("span",{className:`font-mono truncate ${r!=null&&r.winner?"text-accent":"text-fg-dim"}`,children:i?A(r.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),i?e.jsx("button",{onClick:()=>t(n),className:"text-[9px] px-1.5 py-0 rounded border border-line text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`delete this key from ${S[n].label}`,children:"↺"}):e.jsx("span",{})]},n)}),e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:"Default"}),e.jsx("span",{className:"font-mono text-fg-dim truncate",children:s!==void 0?A(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function ke({keyName:a,node:s,info:t,targetScope:l,onOverride:n}){const i=(s==null?void 0:s.kind)==="leaf"?s:null,p=V(a,t==null?void 0:t.description);return e.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[p&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${p.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:p.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:p.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(t==null?void 0:t.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(t.type)?t.type.join(" | "):t.type})]}),(t==null?void 0:t.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:A(t.default)})]}),(t==null?void 0:t.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:t.enum.map(x=>String(x)).join(" | ")})]}),i&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Current"}),e.jsxs("dd",{className:"font-mono",children:[e.jsx("span",{className:"text-fg-dim",children:A(i.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",S[i.winner].label]})]})]}),i&&i.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:i.shadowed.map((x,v)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[A(x.value)," —"," ",e.jsx("span",{className:"no-underline",children:S[x.scope].label})]},v))})]}),(s==null?void 0:s.kind)==="array"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Accumulated"}),e.jsxs("dd",{className:"text-fg-dim",children:[s.items.length," items across all scopes"]})]})]}),e.jsx("div",{className:"pt-2 flex items-center gap-2 flex-wrap border-t border-line/60",children:e.jsx(Se,{keyName:a,node:s,info:t,onChange:n,targetScope:l})})]})}function Se({node:a,info:s,onChange:t,targetScope:l}){const r=(a==null?void 0:a.kind)==="leaf"?a.value:s==null?void 0:s.default,i=W(s==null?void 0:s.type);if(i==="boolean"){const p=r===!0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:[{v:!0,label:"on"},{v:!1,label:"off"}].map(({v:x,label:v})=>e.jsx("button",{onClick:()=>t(x),className:`px-3 py-0.5 text-xs transition-colors ${p===x?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:v},v))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[l].label]})]})}return s!=null&&s.enum?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-fg-faint",children:"Choose:"}),s.enum.map(p=>{const x=z(r,p);return e.jsx("button",{onClick:()=>t(p),className:`px-2 py-0.5 text-xs rounded border ${x?"bg-accent text-bg border-accent":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,children:String(p)},String(p))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[l].label]})]}):i==="integer"||i==="number"?e.jsx(Ce,{value:typeof r=="number"?r:void 0,integer:i==="integer",onCommit:t,target:S[l].label}):i==="string"?e.jsx(Ee,{value:typeof r=="string"?r:"",onCommit:t,target:S[l].label}):e.jsxs("div",{className:"text-fg-faint",children:["Complex value (",i??"object/array",") — use the"," ",e.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function Ce({value:a,integer:s,onCommit:t,target:l}){const[n,r]=d.useState(a!==void 0?String(a):""),i=()=>{const p=s?parseInt(n,10):parseFloat(n);Number.isNaN(p)||t(p)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("input",{type:"number",value:n,onChange:p=>r(p.target.value),onBlur:i,onKeyDown:p=>{p.key==="Enter"&&p.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:i,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",l]})]})}function Ee({value:a,onCommit:s,target:t}){const[l,n]=d.useState(a);return e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"text-fg-faint shrink-0",children:"Set to:"}),e.jsx("input",{type:"text",value:l,onChange:r=>n(r.target.value),onKeyDown:r=>{r.key==="Enter"&&s(l)},className:"flex-1 min-w-0 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:()=>s(l),className:"shrink-0 px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",t]})]})}function Te({node:a,info:s,onSet:t,disabled:l}){const n=(a==null?void 0:a.kind)==="leaf",r=W(s==null?void 0:s.type);if(l)return null;if(r==="boolean"){const i=n&&a.value===!0;return e.jsx("button",{onClick:()=>t(!i),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${i?"bg-accent/15 text-accent border-accent/40 hover:bg-accent hover:text-bg":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,title:"toggle",children:i?"on":"off"})}return null}function Oe({isSet:a,leafNode:s,defaultVal:t,isDefault:l,node:n}){return a?(n==null?void 0:n.kind)==="array"?{kind:"accumulated",label:`${n.items.length} items`}:(n==null?void 0:n.kind)==="object"?{kind:"set",label:"configured"}:s?l?{kind:"default",label:`= default · ${S[s.winner].label}`}:s.shadowed.length>0?{kind:"override",label:`overriding ${s.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${S[s.winner].label}`}:{kind:"set",label:"configured"}:t!==void 0?{kind:"default",label:`using default: ${A(t)}`}:{kind:"unset",label:"not configured"}}function Pe({kind:a,label:s}){const t={set:"bg-accent/15 text-accent border-accent/30",default:"bg-bg-hi text-fg-dim border-line",unset:"bg-bg-elev text-fg-faint border-line",override:"bg-purple-950/30 text-purple-400/80 border-purple-900/40",accumulated:"bg-blue-950/30 text-blue-400/80 border-blue-900/40"}[a];return e.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${t}`,children:s})}function W(a){if(a)return Array.isArray(a)?a.find(t=>t!=="null")??a[0]:a}function z(a,s){return a===s?!0:typeof a!=typeof s?!1:a&&s&&typeof a=="object"?JSON.stringify(a)===JSON.stringify(s):!1}function Ae(a){const s=a.trim().split(`
2
2
  `)[0],t=s.match(/^([^.!?]+[.!?])/);return t?t[1]:s.length>120?s.slice(0,120)+"…":s}function A(a){if(typeof a=="string")return a===""?'""':JSON.stringify(a);if(a===null)return"null";if(a===void 0)return"—";if(typeof a=="object"){const s=JSON.stringify(a);return s.length>60?s.slice(0,60)+"…":s}return String(a)}function Re(){const[a,s]=d.useState(null),[t,l]=d.useState(null),[n,r]=d.useState(null),[i,p]=d.useState(null),[x,v]=d.useState(!1),[u,N]=d.useState(null),[g,b]=d.useState(null);if(d.useEffect(()=>{let m=!1;return Promise.all([window.api.otel.getConfig(),window.api.otel.status(),window.api.otel.configPath()]).then(([k,w,o])=>{m||(s(k),r(k),l(w),p(o))}).catch(k=>{console.warn("[telemetry] load failed:",k==null?void 0:k.message)}),()=>{m=!0}},[]),!n||!a)return e.jsx(M,{title:"loading…"});const c=JSON.stringify(n)!==JSON.stringify(a),h=(m,k)=>{N(null),r({...n,[m]:k})},C=async()=>{v(!0),N(null);try{const m=await window.api.otel.setConfig(n);!m.ok&&m.error&&N(m.error),s(m.config),r(m.config),l(m.status),b(Date.now())}catch(m){N(m instanceof Error?m.message:String(m))}finally{v(!1)}},E=()=>{N(null),r(a)};return e.jsxs("div",{className:"p-4 max-w-3xl space-y-5 text-sm",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Telemetry — OpenTelemetry export"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"When enabled, every classified transcript event (tool_use, todo_write, plan, usage, agent_spawn) is mirrored as a 0-duration OTLP/HTTP span. Point this at a local collector (Jaeger, Grafana Tempo, SigNoz, Honeycomb) for cross-session analysis."}),i&&e.jsxs("p",{className:"text-fg-faint text-[11px]",children:["stored at ",e.jsx("span",{className:"font-mono",children:i})]})]}),e.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Export transcripts to OTEL"}),e.jsx("div",{className:"text-fg-faint text-xs",children:"Toggle off to disable all span emission immediately."})]}),e.jsx(U,{checked:n.enabled,onChange:m=>h("enabled",m),label:n.enabled?"on":"off"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"OTLP/HTTP traces endpoint"}),e.jsx("input",{type:"text",value:n.endpoint,onChange:m=>h("endpoint",m.target.value),placeholder:"http://localhost:4318/v1/traces",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsxs("span",{className:"text-fg-dim text-xs",children:["Headers (newline-separated ",e.jsx("span",{className:"font-mono",children:"Key: Value"}),")"]}),e.jsx("textarea",{value:n.headers,onChange:m=>h("headers",m.target.value),placeholder:"x-honeycomb-team: YOUR_API_KEY",rows:3,className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Service name"}),e.jsx("input",{type:"text",value:n.serviceName,onChange:m=>h("serviceName",m.target.value),placeholder:"session-manager",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("div",{className:"flex items-start justify-between gap-3 pt-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Include content (PII)"}),e.jsxs("div",{className:"text-fg-faint text-xs leading-relaxed",children:["Adds tool inputs, plan text, and agent prompts to span attributes. Off by default — matches upstream Claude Code's ",e.jsx("span",{className:"font-mono",children:"OTEL_LOG_USER_PROMPTS"})," opt-in."]})]}),e.jsx(U,{checked:n.includeContent,onChange:m=>h("includeContent",m),label:n.includeContent?"on":"off"})]})]}),t&&e.jsxs("section",{className:"border border-line rounded p-3 text-xs space-y-1",children:[e.jsx("div",{className:"text-fg-dim",children:"Runtime status"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"enabled:"})," ",e.jsx("span",{className:t.enabled?"text-accent":"text-fg-dim",children:String(t.enabled)})]}),t.error&&e.jsxs("div",{className:"text-red-400 break-words",children:[e.jsx("span",{className:"text-fg-faint",children:"error:"})," ",t.error]}),!t.error&&t.enabled&&e.jsx("div",{className:"text-fg-faint",children:"spans batched and exported in the background. Verify by enabling and pointing at a local Jaeger."})]}),e.jsxs("footer",{className:"flex items-center gap-3 pt-2 border-t border-line",children:[e.jsx("button",{onClick:C,disabled:!c||x,className:"px-3 py-1 text-xs rounded bg-accent text-bg disabled:opacity-50 disabled:cursor-not-allowed",children:x?"saving…":"Save"}),e.jsx("button",{onClick:E,disabled:!c||x,className:"px-3 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg disabled:opacity-50 disabled:cursor-not-allowed",children:"Revert"}),u&&e.jsx("span",{className:"text-red-400 text-xs",children:u}),!u&&g&&!c&&e.jsx("span",{className:"text-fg-faint text-xs",children:"saved"})]})]})}function Me(){const{model:a,setModel:s}=Y();return e.jsxs("div",{className:"p-4 max-w-3xl space-y-5 text-sm",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Session Manager preferences"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"Native app preferences, stored locally — not part of Claude Code's own settings."})]}),e.jsx("section",{className:"border border-line rounded p-3 space-y-3",children:e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Default model for raw sessions"}),e.jsx("select",{value:a,onChange:t=>s(t.target.value),className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs",children:Q.map(t=>e.jsx("option",{value:t,children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsx("span",{className:"text-fg-faint text-[11px]",children:"Used when opening a raw interactive session without an explicit per-launch override."})]})})]})}function Ie({cwd:a}){const[s,t]=d.useState(!1),[l,n]=d.useState(!1),[r,i]=d.useState(!1),[p,x]=d.useState(!1);d.useEffect(()=>{var b,c;let g=!1;return t(!1),Promise.resolve((c=(b=window.api.promptSessions)==null?void 0:b.getWorktreeDisabled)==null?void 0:c.call(b,{cwd:a})).then(h=>{g||(n((h==null?void 0:h.disabled)??!1),i((h==null?void 0:h.disabled)??!1),t(!0))},()=>{g||t(!0)}),()=>{g=!0}},[a]);const v=s&&r!==l,u=()=>{var g,b;x(!0),Promise.resolve((b=(g=window.api.promptSessions)==null?void 0:g.setWorktreeDisabled)==null?void 0:b.call(g,{cwd:a,disabled:r})).then(c=>{n((c==null?void 0:c.disabled)??r),i((c==null?void 0:c.disabled)??r)}).catch(c=>X.error(c instanceof Error?c.message:String(c))).finally(()=>x(!1))},N=()=>i(l);return e.jsxs("div",{"data-testid":"settings-epic-isolation",className:"border-b border-line bg-bg-elev px-3 py-2.5 text-[11.5px] leading-snug",children:[e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx("input",{type:"checkbox",checked:r,disabled:!s||p,onChange:g=>i(g.target.checked),"data-testid":"settings-epic-isolation-checkbox",className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-fg",children:"Disable Epic worktree isolation for this project"}),e.jsxs("span",{className:"block text-fg-dim",children:["Off by default — each active Epic runs in its own isolated ",e.jsx("code",{children:"git worktree"})," (branch"," ",e.jsx("code",{children:"sm-epic/<id>"}),"), merged back to main at an explicit checkpoint. Turning this on makes every new Epic in this project run directly in the shared working tree instead, same as before this feature existed."]})]})]}),v&&e.jsx(J,{dirty:v,busy:p,onSave:u,onRevert:N})]})}const H={user:{title:"Global settings",body:"This is the real ~/.claude/settings.json on disk — the same file the claude CLI reads on every session it starts. Edits apply machine-wide, to every project and every session."},project:{title:"Project settings",body:"This is the real <project>/.claude/settings.json on disk, checked into git. Edits apply to every current and future session in this project, for anyone who clones it."},local:{title:"Local settings",body:"This is the real <project>/.claude/settings.local.json on disk, gitignored. Edits apply to every current and future session in this project, on this machine only."}};function Le(){const a=ee(),s=$(f=>f.tabs),t=$(f=>f.activeTabId),l=s.find(f=>f.id===t)??null,n=(l==null?void 0:l.cwd)??null,r=te(f=>f.navFace),i=d.useRef(!1),p=d.useRef(r),[x,v]=d.useState(()=>r==="project"&&n?"project":"user"),[u,N]=d.useState("effective");d.useEffect(()=>{if(p.current!==r){if(p.current=r,i.current){i.current=!1;return}v(r==="project"&&n?"project":"user")}},[r,n]),d.useEffect(()=>{r==="project"&&(u==="telemetry"||u==="app")&&N("effective")},[r,u]);const g=f=>{i.current=!0,v(f)},b=le(F,a,n),c=b[x]??null,h=R(f=>f.files),C=R(f=>f.setDraft),E=R(f=>f.saveJson),m=R(f=>f.revert),[k,w]=d.useState(null),o=d.useMemo(()=>ie(oe(h,b)),[h,b]),y=(f,P,O)=>{var _;const I=b[O??x];if(!I)return;w(null);const D=((_=h[I])==null?void 0:_.draftRaw)??"";let L={};if(D.trim())try{L=JSON.parse(D)}catch{L={}}const q=de(L,f,P);C(I,JSON.stringify(q,null,2)+`
3
3
  `)};if(!a)return e.jsx(M,{title:"loading…"});const j=c?h[c]:null,T=f=>f!=="user"&&!n;return e.jsx(ne,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(ae,{options:[{key:"effective",label:"Guided"},{key:"tree",label:"Tree"},{key:"raw",label:"Raw"},...r==="home"?[{key:"telemetry",label:"Telemetry"},{key:"app",label:"Session Manager"}]:[]],active:u,onChange:N}),u!=="telemetry"&&u!=="app"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx(re,{scopes:F.scopes,active:x,onChange:g,annotate:f=>{if(T(f))return{exists:!1};const P=b[f];if(!P)return null;const O=h[P];return{exists:(O==null?void 0:O.exists)??!1,dirty:(O==null?void 0:O.dirty)??!1}}}),e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:u==="effective"?`overrides → ${c??"—"}`:c??"—"})]}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"schema reference ↗"})]}),footer:u!=="telemetry"&&u!=="app"&&c&&j?e.jsx(J,{dirty:j.dirty,busy:j.busy,parseError:k||j.parseError,lastSavedAt:j.lastSavedAt,leading:j.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{w(null);const f=await E(c);f.ok||w(f.error??"save failed")},onRevert:()=>{w(null),m(c)}}):null,children:u==="telemetry"?e.jsx(Re,{}):u==="app"?e.jsx(Me,{}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"settings-scope-note",className:"sticky top-0 z-10 border-b border-line bg-bg-elev px-3 py-2 text-[11.5px] leading-snug",children:[e.jsx("span",{className:"font-semibold text-fg",children:H[x].title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:H[x].body}),c&&e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:c})]}),x==="project"&&n&&e.jsx(Ie,{cwd:n}),T(x)?e.jsx(M,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"}):u==="effective"?e.jsx(be,{node:o,targetScope:x,onOverride:y,schema:G()}):u==="tree"?e.jsx(ce,{node:o,targetScope:x,onOverride:y,schema:G()}):c&&j?e.jsx(se,{path:c,value:j.draftRaw,onChange:f=>{w(null),C(c,f)}}):e.jsx(M,{title:"resolving…"})]})})}const Be=d.memo(Le);export{H as SETTINGS_SCOPE_NOTES,Be as Settings};
@@ -1,4 +1,4 @@
1
- import{ag as Q,t as bo,a4 as wo,a7 as tr}from"./index-CuyM9vAP.js";import"./monaco-editor-BW5C4Iv1.js";function ko(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,a,s,u=[],l=!0,f=!1;try{if(a=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(u.push(i.value),u.length!==n);l=!0);}catch(h){f=!0,o=h}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return u}}function Ao(e,n,r){return n=Ro(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function er(e,n){return Mo(e)||ko(e,n)||fi(e,n)||Oo()}function Co(e){return So(e)||To(e)||fi(e)||Po()}function So(e){if(Array.isArray(e))return gn(e)}function Mo(e){if(Array.isArray(e))return e}function To(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function fi(e,n){if(e){if(typeof e=="string")return gn(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gn(e,n)}}function gn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function Po(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{ag as Q,t as bo,a4 as wo,a7 as tr}from"./index-DApB4DHS.js";import"./monaco-editor-BW5C4Iv1.js";function ko(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,a,s,u=[],l=!0,f=!1;try{if(a=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(u.push(i.value),u.length!==n);l=!0);}catch(h){f=!0,o=h}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return u}}function Ao(e,n,r){return n=Ro(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function er(e,n){return Mo(e)||ko(e,n)||fi(e,n)||Oo()}function Co(e){return So(e)||To(e)||fi(e)||Po()}function So(e){if(Array.isArray(e))return gn(e)}function Mo(e){if(Array.isArray(e))return e}function To(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function fi(e,n){if(e){if(typeof e=="string")return gn(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gn(e,n)}}function gn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function Po(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eo(e,n){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Ro(e){var n=Eo(e,"string");return typeof n=="symbol"?n:String(n)}var zo=function(n,r){var i=new Set(r);return Object.assign.apply(Object,[{}].concat(Co(Object.entries(n).filter(function(o){var a=er(o,1),s=a[0];return!i.has(s)}).map(function(o){var a=er(o,2),s=a[0],u=a[1];return Ao({},s,u)}))))};function yn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function No(e){if(Array.isArray(e))return e}function Io(e){if(Array.isArray(e))return yn(e)}function $o(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Do(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,a,s,u=[],l=!0,f=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(l=(i=a.call(r)).done)&&(u.push(i.value),u.length!==n);l=!0);}catch(h){f=!0,o=h}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return u}}function jo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4
4
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fo(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
@@ -1,3 +1,3 @@
1
- import{ag as l,aw as K,ar as Q,ay as U,at as u,a7 as t,j as R,aq as L}from"./index-CuyM9vAP.js";import{P as D}from"./Panel-CD5wxGSR.js";import{L as X}from"./ListDetail-CuRmT008.js";import{M as Y}from"./MarkdownEditor-BgQGtvWo.js";import{S as Z}from"./SaveBar-BDk5e3Pp.js";import{S as V}from"./ScopeSwitcher-CeifaOlq.js";import{T as _}from"./Toggle-D9eYoZh4.js";import{P as B}from"./ProvenanceBadge-CQceOgsH.js";import{l as ee}from"./listSkills-QORduPIk.js";import{S as te,V as F}from"./Library-BTzS8KsS.js";import{p as se,r as ae,s as ne}from"./skillFrontmatter-Dif5JIg7.js";import"./monaco-editor-BW5C4Iv1.js";function re(d,m){return{user:{skills:`${d}/.claude/skills`,commands:`${d}/.claude/commands`},project:m?{skills:`${m}/.claude/skills`,commands:`${m}/.claude/commands`}:null}}function le(){const d=K(),m=Q(),h=(m==null?void 0:m.cwd)??null,x=U(e=>e.navFace),j=l.useRef(!1),T=l.useRef(x),[p,N]=l.useState(()=>x==="project"&&h?"project":"user"),[v,k]=l.useState([]),[r,C]=l.useState(null),[w,E]=l.useState("installed"),[$,I]=l.useState(""),b=l.useMemo(()=>d?re(d,h):null,[d,h]);l.useEffect(()=>{if(T.current!==x){if(T.current=x,j.current){j.current=!1;return}N(x==="project"&&h?"project":"user")}},[x,h]),l.useEffect(()=>{if(!b)return;let e=!1;const i=p==="user"?b.user:b.project;if(!i){k([]);return}return(async()=>{var c;const n=[],s=await ee(i.skills);for(const a of s)n.push({kind:"skills",scope:p,name:a.name,path:a.path,dir:a.dir,disabled:ae(a.text),description:se(a.text).description??void 0});const o=await window.api.config.listDir(i.commands,{filesOnly:!0});for(const a of o.entries)a.name.endsWith(".md")&&n.push({kind:"commands",scope:p,name:a.name.replace(/\.md$/,""),path:a.path,dir:null,disabled:!1});e||(n.sort((a,A)=>a.kind===A.kind?a.name.localeCompare(A.name):a.kind==="skills"?-1:1),k(n),n.find(a=>a.path===r)||C(((c=n[0])==null?void 0:c.path)??null))})(),()=>{e=!0}},[p,b]);const y=u(e=>e.files),P=u(e=>e.loadText),q=u(e=>e.setDraft),H=u(e=>e.saveText),O=u(e=>e.revert),W=u(e=>e.watchFile),M=u(e=>e.unwatchFile);async function z(e,i){const n=await window.api.config.readText(e.path);if(!n.exists)return;const s=ne(n.text,i);if(s===n.text)return;const o=await window.api.config.writeText(e.path,s);if(!o.ok){L.error(o.error??"failed to update skill");return}k(c=>c.map(a=>a.path===e.path?{...a,disabled:i}:a)),y[e.path]&&P(e.path)}async function G(e){if(!e.dir||!window.confirm(`Remove skill "${e.name}"?
1
+ import{ag as l,aw as K,ar as Q,ay as U,at as u,a7 as t,j as R,aq as L}from"./index-DApB4DHS.js";import{P as D}from"./Panel-D93o-sxe.js";import{L as X}from"./ListDetail-CY4GM1Om.js";import{M as Y}from"./MarkdownEditor-BF4y2Jiz.js";import{S as Z}from"./SaveBar-Cg4lbChb.js";import{S as V}from"./ScopeSwitcher-C-locvy0.js";import{T as _}from"./Toggle-B_EH2TFb.js";import{P as B}from"./ProvenanceBadge-DACVJhrB.js";import{l as ee}from"./listSkills-QORduPIk.js";import{S as te,V as F}from"./Library-YPNm9W92.js";import{p as se,r as ae,s as ne}from"./skillFrontmatter-Dif5JIg7.js";import"./monaco-editor-BW5C4Iv1.js";function re(d,m){return{user:{skills:`${d}/.claude/skills`,commands:`${d}/.claude/commands`},project:m?{skills:`${m}/.claude/skills`,commands:`${m}/.claude/commands`}:null}}function le(){const d=K(),m=Q(),h=(m==null?void 0:m.cwd)??null,x=U(e=>e.navFace),j=l.useRef(!1),T=l.useRef(x),[p,N]=l.useState(()=>x==="project"&&h?"project":"user"),[v,k]=l.useState([]),[r,C]=l.useState(null),[w,E]=l.useState("installed"),[$,I]=l.useState(""),b=l.useMemo(()=>d?re(d,h):null,[d,h]);l.useEffect(()=>{if(T.current!==x){if(T.current=x,j.current){j.current=!1;return}N(x==="project"&&h?"project":"user")}},[x,h]),l.useEffect(()=>{if(!b)return;let e=!1;const i=p==="user"?b.user:b.project;if(!i){k([]);return}return(async()=>{var c;const n=[],s=await ee(i.skills);for(const a of s)n.push({kind:"skills",scope:p,name:a.name,path:a.path,dir:a.dir,disabled:ae(a.text),description:se(a.text).description??void 0});const o=await window.api.config.listDir(i.commands,{filesOnly:!0});for(const a of o.entries)a.name.endsWith(".md")&&n.push({kind:"commands",scope:p,name:a.name.replace(/\.md$/,""),path:a.path,dir:null,disabled:!1});e||(n.sort((a,A)=>a.kind===A.kind?a.name.localeCompare(A.name):a.kind==="skills"?-1:1),k(n),n.find(a=>a.path===r)||C(((c=n[0])==null?void 0:c.path)??null))})(),()=>{e=!0}},[p,b]);const y=u(e=>e.files),P=u(e=>e.loadText),q=u(e=>e.setDraft),H=u(e=>e.saveText),O=u(e=>e.revert),W=u(e=>e.watchFile),M=u(e=>e.unwatchFile);async function z(e,i){const n=await window.api.config.readText(e.path);if(!n.exists)return;const s=ne(n.text,i);if(s===n.text)return;const o=await window.api.config.writeText(e.path,s);if(!o.ok){L.error(o.error??"failed to update skill");return}k(c=>c.map(a=>a.path===e.path?{...a,disabled:i}:a)),y[e.path]&&P(e.path)}async function G(e){if(!e.dir||!window.confirm(`Remove skill "${e.name}"?
2
2
 
3
3
  Its folder moves to the trash (recoverable); reinstall any time from the Library.`))return;const i=await window.api.files.delete(e.dir);if(!i.ok){L.error(i.error??"failed to remove skill");return}L.info(`Removed "${e.name}" — moved to trash`),M(e.path),k(n=>n.filter(s=>s.path!==e.path)),C(n=>{var o;return n!==e.path?n:((o=v.filter(c=>c.path!==e.path)[0])==null?void 0:o.path)??null})}l.useEffect(()=>{if(r)return y[r]||P(r),W(r),()=>M(r)},[r]);const[J,S]=l.useState(null);if(!d)return t.jsx(R,{title:"loading…"});if(w==="library")return t.jsx(D,{toolbar:t.jsx(F,{active:w,onChange:E,installedLabel:"Installed",libraryLabel:"Library"}),children:t.jsx(te,{})});if(p==="project"&&!h)return t.jsx(D,{toolbar:t.jsxs(t.Fragment,{children:[t.jsx(F,{active:w,onChange:E}),t.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),t.jsx(V,{scopes:["user","project"],active:p,onChange:e=>{j.current=!0,N(e)}})]}),children:t.jsx(R,{title:"no active project",hint:"open a tab in a project directory to view project skills & commands"})});const f=v.find(e=>e.path===r)??null,g=r?y[r]:null;return t.jsx(D,{toolbar:t.jsxs(t.Fragment,{children:[t.jsx(F,{active:w,onChange:E}),t.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),t.jsx(V,{scopes:["user","project"],active:p,onChange:e=>{j.current=!0,N(e)}}),t.jsxs("span",{className:"ml-3 text-fg-faint",children:[v.length," ",v.length===1?"item":"items"]}),t.jsx("div",{className:"flex-1"}),f&&t.jsx(B,{scope:f.scope,input:{type:f.kind==="commands"?"command":"skill",name:f.name}}),t.jsx("span",{className:"ml-2 text-fg-faint truncate",children:(f==null?void 0:f.path)??""})]}),footer:r&&g?t.jsx(Z,{dirty:g.dirty,busy:g.busy,parseError:J,lastSavedAt:g.lastSavedAt,onSave:async()=>{S(null);const e=await H(r);e.ok||S(e.error??"save failed")},onRevert:()=>{S(null),O(r)}}):null,children:t.jsx(X,{sidebar:t.jsxs("div",{className:"py-1",children:[t.jsx("div",{className:"px-2 pb-1",children:t.jsx("input",{value:$,onChange:e=>I(e.target.value),placeholder:"filter…",className:"w-full bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"})}),["skills","commands"].map(e=>{const i=$.toLowerCase(),n=v.filter(s=>s.kind===e&&(!i||s.name.toLowerCase().includes(i)));return t.jsxs("div",{className:"mb-3",children:[t.jsx("div",{className:"px-3 py-1 text-xs uppercase tracking-wider text-fg-faint",children:e==="skills"?"Skills":"Slash Commands"}),n.length===0?t.jsx("div",{className:"px-3 py-1 text-xs text-fg-faint italic",children:"none"}):n.map(s=>{var c;const o=s.kind==="skills";return t.jsxs("div",{className:`w-full px-3 py-1 text-xs flex items-center justify-between gap-2 ${r===s.path?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[t.jsxs("button",{onClick:()=>C(s.path),className:"flex-1 min-w-0 text-left",children:[t.jsxs("div",{className:`truncate ${s.disabled?"line-through opacity-50":""}`,title:s.disabled?"Disabled — Claude will not auto-invoke this skill":void 0,children:[s.kind==="commands"?"/":"",s.name]}),s.description&&t.jsx("div",{className:"truncate text-fg-faint",children:s.description})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[t.jsx(B,{interactive:!1,scope:s.scope,input:{type:s.kind==="commands"?"command":"skill",name:s.name}}),((c=y[s.path])==null?void 0:c.dirty)&&t.jsx("span",{className:"w-1 h-1 rounded-full bg-accent"}),o&&t.jsx(_,{checked:!s.disabled,onChange:a=>void z(s,!a)}),s.kind==="skills"&&t.jsx("button",{onClick:a=>{a.stopPropagation(),G(s)},title:"Remove skill — moves the folder to trash; reinstall from the Library","aria-label":`Remove ${s.name}`,className:"text-fg-faint hover:text-red-400 leading-none px-0.5",children:"✕"})]})]},s.path)})]},e)})]}),detail:r&&g?t.jsx("div",{className:"h-full",children:t.jsx(Y,{path:r,value:g.draftRaw,onChange:e=>{S(null),q(r,e)}})}):t.jsx(R,{title:v.length===0?"no skills or commands":"select an item"})})})}const je=l.memo(le);export{je as Skills};