claude-code-session-manager 0.130.2 → 0.130.3

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 (58) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/bin/cli.cjs +19 -2
  3. package/dist/assets/AgentLibrary-BmrXNwK8.js +2 -0
  4. package/dist/assets/{AppSettings-Bpwynea4.js → AppSettings-Cs4POznd.js} +1 -1
  5. package/dist/assets/{Button-DSoqrxCB.js → Button-UUr5giu8.js} +1 -1
  6. package/dist/assets/DocumentEditorPane-C46Hj0lz.js +1 -0
  7. package/dist/assets/Extensions-B9QdiNOV.js +2 -0
  8. package/dist/assets/{History-DzMo9Otn.js → History-Bndupj87.js} +2 -2
  9. package/dist/assets/{Library-C5wKMTSn.js → Library-DFn0YPIW.js} +5 -5
  10. package/dist/assets/{ListDetail-DDQ1S0yu.js → ListDetail-DjMn8a_3.js} +1 -1
  11. package/dist/assets/{Panel-B-3NWUlv.js → Panel-CIvb-XXN.js} +1 -1
  12. package/dist/assets/ProjectClaudeConfig-BQQRtMdK.js +25 -0
  13. package/dist/assets/{ProvenanceBadge-CUChwz4Z.js → ProvenanceBadge-ej8W2ZIK.js} +1 -1
  14. package/dist/assets/{Scheduler-CkGHMXvo.js → Scheduler-DSVBWqRK.js} +8 -8
  15. package/dist/assets/Settings-DqxUna06.js +2 -0
  16. package/dist/assets/{SkillReferenceGraph-C6JEdypC.js → SkillReferenceGraph-BEMTdxdD.js} +1 -1
  17. package/dist/assets/Skills-DTXehVS7.js +12 -0
  18. package/dist/assets/{SourceChip-DcBNYYhe.js → SourceChip-BrPci8FX.js} +1 -1
  19. package/dist/assets/SystemPrompt-B43hNP0X.js +1 -0
  20. package/dist/assets/{TiptapBody-DiVYC-_O.js → TiptapBody-B-R2Bpda.js} +1 -1
  21. package/dist/assets/{Toggle-Cs3k6I96.js → Toggle-DKb4x1BP.js} +1 -1
  22. package/dist/assets/ViewTabs-CcJdFZgv.js +1 -0
  23. package/dist/assets/{VoiceButton-C3NLotUZ.js → VoiceButton-BSH0UI3u.js} +1 -1
  24. package/dist/assets/{historyTotals-f-E0L9Xw.js → historyTotals-5oUEu_fe.js} +1 -1
  25. package/dist/assets/index-C9w-dVzo.js +3090 -0
  26. package/dist/assets/{index-Bp8XE9A6.css → index-CMCcT2yg.css} +1 -1
  27. package/dist/index.html +2 -2
  28. package/dist-web/app.css +1 -1
  29. package/dist-web/app.js +420 -416
  30. package/package.json +1 -1
  31. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  32. package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +15 -5
  33. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +8 -4
  34. package/src/main/agentLibrary.cjs +81 -29
  35. package/src/main/agentsIpc.cjs +21 -16
  36. package/src/main/build-info.json +4 -4
  37. package/src/main/ipcSchemas.cjs +7 -1
  38. package/src/main/lib/epic/epicWorktreeMerge.cjs +11 -9
  39. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +2 -0
  40. package/src/main/lib/git/gitWorktree.cjs +216 -43
  41. package/src/main/lib/mdNetworkScan.cjs +555 -0
  42. package/src/main/lib/persona-macro/agentPersonaSchema.cjs +18 -5
  43. package/src/main/lib/persona-macro/builtinMacros.cjs +6 -4
  44. package/src/main/lib/persona-macro/macroJobDispatch.cjs +9 -2
  45. package/src/main/lib/scheduler/terminalRunOutcome.cjs +61 -15
  46. package/src/main/projectPages.cjs +32 -7
  47. package/src/main/scheduler/gitTreeGuard.cjs +85 -12
  48. package/src/main/scheduler.cjs +16 -5
  49. package/src/preload/api.d.ts +91 -6
  50. package/src/preload/apiSurface.json +7 -0
  51. package/src/preload/index.cjs +1 -0
  52. package/dist/assets/AgentLibrary-Bfj862qf.js +0 -2
  53. package/dist/assets/Extensions-BziIutWV.js +0 -13
  54. package/dist/assets/Memory-Bq5T33d2.js +0 -25
  55. package/dist/assets/Settings-DGxvyajs.js +0 -2
  56. package/dist/assets/SystemPrompt-CfozyVQx.js +0 -1
  57. package/dist/assets/ViewTabs-DFXH03tb.js +0 -1
  58. package/dist/assets/index-CuAfFXNd.js +0 -3086
@@ -0,0 +1,2 @@
1
+ import{b4 as T,au as e,b0 as R,aK as y,ba as L,b1 as V,bc as z,bj as H,P as le,l as C,a3 as ce,v as de,Q as Y,S,a as ue,bl as B,bf as pe,ay as me,aC as xe,J as he,aq as fe}from"./index-C9w-dVzo.js";import{P as F}from"./Panel-CIvb-XXN.js";import{P as ge,H as be,S as ye}from"./Library-DFn0YPIW.js";import{S as I}from"./SourceChip-BrPci8FX.js";import{V as U}from"./ViewTabs-CcJdFZgv.js";import{r as Z}from"./claude-settings-schema-COigsajx.js";import{L as je}from"./ListDetail-DjMn8a_3.js";import{P as ve}from"./ProvenanceBadge-ej8W2ZIK.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-UUr5giu8.js";function ke(t){const s=t??{},n={...s.$defs??{},...s.definitions??{}},r=i=>{if(!i)return{};if(!i.$ref)return l(i);const u=/^#\/(\$defs|definitions)\/(.+)$/.exec(i.$ref);if(!u)return l(i);const h=n[u[2]];return h?r({...h,...p(i)}):l(i)},a=new Set(["__proto__","constructor","prototype"]),o=i=>{if(!i)return{};const u={};for(const[h,f]of Object.entries(i))a.has(h)||(u[h]=f);return u},l=i=>{if(!i.allOf||i.allOf.length===0)return i;const u={...i};delete u.allOf;for(const h of i.allOf){const f=r(h);Object.assign(u,{properties:{...o(u.properties),...o(f.properties)},required:we([...u.required??[],...f.required??[]])}),!u.description&&f.description&&(u.description=f.description),u.default===void 0&&f.default!==void 0&&(u.default=f.default),!u.type&&f.type&&(u.type=f.type)}return u},p=i=>{const{$ref:u,...h}=i;return h},d=(i,u)=>{let h=r(i);for(const f of u){if(!h)return null;if(/^\d+$/.test(f)){const k=Array.isArray(h.items)?h.items[Number(f)]:h.items;h=k?r(k):null;continue}const N=h.properties;if(N&&!a.has(f)&&f in N){h=r(N[f]);continue}const g=h.additionalProperties;if(g&&typeof g=="object"){h=r(g);continue}return null}return h},c=(i,u,h)=>{if(!i)return null;const f={};if(i.description&&(f.description=i.description),i.type&&(f.type=i.type),i.default!==void 0&&(f.default=i.default),i.enum&&(f.enum=i.enum),i.const!==void 0&&(f.const=i.const),i.deprecated&&(f.deprecated=!0),i.examples&&(f.examples=i.examples),i.properties&&(f.knownChildren=Object.keys(i.properties)),h&&(u!=null&&u.includes(h))&&(f.required=!0),i.items&&!Array.isArray(i.items)){const N=r(i.items),g=c(N,void 0,null);g&&(f.itemsInfo=g)}return(i.additionalProperties===!0||typeof i.additionalProperties=="object")&&(f.open=!0),f},x=i=>u=>{if(u.length===0)return c(r(i),void 0,null);const h=d(i,u.slice(0,-1));if(!h)return null;const f=u[u.length-1],N=d(h,[f]);return c(N,h.required,f)},v=i=>{const u=r(i);return Object.keys(u.properties??{})},j=i=>({at:x(i),rootKeys:()=>v(i),rootedAt:u=>{const h=d(i,u);return j(h??{})}});return j(s)}function we(t){return Array.from(new Set(t))}let D=null;function Q(){return D||(D=ke(Z)),D}const Ne=["allow","deny","ask"],K="This settings file has invalid JSON. Fix it in the Settings raw editor first; Permissions will not overwrite it.";function Se(t){if(t.trim()==="")return{perms:{},full:{},err:null};try{const s=JSON.parse(t);if(s===null||typeof s!="object"||Array.isArray(s))return{perms:{},full:{},err:"settings file is not a JSON object"};const n=s;return{perms:n.permissions??{},full:n,err:null}}catch(s){return{perms:{},full:{},err:s.message}}}function Ce({scope:t="user"}={}){const s=L(),n=V(),r=(n==null?void 0:n.cwd)??null,a=z(i=>i.navFace),[o,l]=y.useState("rules");y.useEffect(()=>{a==="project"&&o==="presets"&&l("rules")},[a,o]);const d=H(le,s,r)[t]??null,c=T(i=>i.files),x=e.jsx(U,{options:[{key:"rules",label:"Rules"},...a==="home"?[{key:"presets",label:"Presets"}]:[]],active:o,onChange:l});if(!s)return e.jsx(C,{title:"loading…"});if(o==="presets")return e.jsx(F,{toolbar:x,children:e.jsx(ge,{})});const v=i=>i!=="user"&&!r,j=d?c[d]:null;return e.jsx(F,{toolbar:e.jsxs(e.Fragment,{children:[x,e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:d??"—"}),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 ↗"})]}),children:v(t)?e.jsx(C,{title:"no active project",hint:"open a tab in a project directory to edit project or local permissions"}):d&&j?e.jsx(X,{scope:t,cwd:r,activePath:d}):e.jsx(C,{title:"resolving…"})})}y.memo(Ce);function X({scope:t,cwd:s,activePath:n}){const r=T(c=>c.files[n]),{perms:a,err:o}=r?Se(r.draftRaw):{perms:{},err:null},l=(c,x)=>{if(o){R.error(K);return}window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:s,keyPath:["permissions",c],value:x}).catch(v=>R.error(v instanceof Error?v.message:String(v)))},p=(c,x)=>{const v=x.trim();if(!v)return;const j=a[c]??[];j.includes(v)||l(c,[...j,v])},d=(c,x)=>{const v=a[c]??[];l(c,v.filter((j,i)=>i!==x))};return e.jsxs("div",{className:"p-4 space-y-5 max-w-3xl",children:[o&&e.jsxs("div",{role:"alert",className:"text-xs text-red-400 border border-red-400/40 rounded px-3 py-2",children:[K," (",o,")"]}),e.jsx(_e,{value:a.defaultMode??"default",onChange:c=>l("defaultMode",c)}),Ne.map(c=>e.jsx(Ee,{list:c,rules:a[c]??[],disabled:!!o,onAdd:x=>p(c,x),onRemove:x=>d(c,x)},c)),e.jsx(Pe,{dirs:a.additionalDirectories??[],disabled:!!o,onChange:c=>l("additionalDirectories",c)})]})}function _e({value:t,onChange:s}){var o;const r=(((o=Q().at(["permissions","defaultMode"]))==null?void 0:o.enum)??[]).filter(l=>typeof l=="string"),a=t&&!r.includes(t)?[...r,t]:r;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(l=>e.jsx("button",{onClick:()=>s(l),className:`px-2.5 py-1 text-xs transition-colors ${t===l?"bg-bg-hi text-fg":"bg-bg-elev text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:l},l))})]})}function Ee({list:t,rules:s,onAdd:n,onRemove:r,disabled:a}){const[o,l]=y.useState(""),p=t==="allow"?"text-green-400":t==="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:t}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("input",{value:o,disabled:a,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(n(o),l(""))},placeholder:t==="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:()=>{n(o),l("")},disabled:a||!o.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"})]}),s.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no rules"}):e.jsx("ul",{className:"space-y-0.5",children:s.map((d,c)=>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:d}),e.jsx("button",{onClick:()=>r(c),className:"text-fg-faint hover:text-red-400",title:"remove",children:"×"})]},`${c}-${d}`))})]})}function Pe({dirs:t,onChange:s,disabled:n}){const[r,a]=y.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:r,disabled:n,onChange:o=>a(o.target.value),onKeyDown:o=>{o.key==="Enter"&&r.trim()&&(s([...t,r.trim()]),a(""))},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:t.map((o,l)=>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:o}),e.jsx("button",{onClick:()=>s(t.filter((p,d)=>d!==l)),className:"text-fg-faint hover:text-red-400",children:"×"})]},`${l}-${o}`))})]})}const Te={UserPromptSubmit:{when:"Fires just before the user prompt is sent to the model.",payload:"{ prompt: string }",example:"Block submission if the prompt mentions a secret."},UserPromptExpansion:{when:"Fires when a slash command expands into its final prompt text.",payload:"{ command: string, expanded: string }",example:"Audit which slash commands actually run, post-expansion."},PreToolUse:{when:"Fires before any tool runs. Can block the call.",payload:"{ tool_name: string, tool_input: object }",example:'matcher="Bash" — block dangerous shell commands.'},PostToolUse:{when:"Fires after a tool completes successfully.",payload:"{ tool_name: string, tool_input: object, tool_result: string }",example:'matcher="Write|Edit" — run a linter on changed files.'},PostToolUseFailure:{when:"Fires after a tool errors out (non-zero exit, exception, or refusal).",payload:"{ tool_name: string, tool_input: object, error: string }",example:"Pipe failed Bash runs into a desktop notification."},PostToolBatch:{when:"Fires once after a parallel batch of tool calls all complete.",payload:"{ tool_uses: Array<{ tool_name, tool_input, tool_result? }> }",example:"Aggregate file-edit batches into a single commit message."},Stop:{when:"Fires when the model emits end_turn.",payload:"{ stop_reason: string, output_tokens: number }",example:"Play a chime when the agent finishes a long task."},StopFailure:{when:"Fires when a turn aborts without end_turn (rate-limit, network, OOM).",payload:'{ reason: "rate_limit"|"network"|"oom"|"killed"|string }',example:"Auto-resume on transient failures."},SessionStart:{when:"Fires once when a session boots (claude or claude -p).",payload:'{ source: "startup"|"resume", model: string, agent_type: string }',example:"Inject a project-specific system prompt addendum."},SessionEnd:{when:"Fires once when the session terminates.",payload:'{ reason: "user_quit"|"timeout"|"error"|string }',example:"Persist transcript summary to ~/.claude/projects/<>."},Setup:{when:"Fires during interactive setup (claude /setup, /init).",payload:'{ mode: "init"|"reconfigure"|string }'},PreCompact:{when:"Fires before transcript compaction runs.",payload:'{ transcript_path: string, trigger: "manual"|"auto" }',example:"Snapshot the pre-compact transcript for later diffing."},PostCompact:{when:"Fires after compaction; the active transcript is the compacted one.",payload:'{ transcript_path: string, trigger: "manual"|"auto" }'},InstructionsLoaded:{when:"Fires after CLAUDE.md and any imported memory files are loaded.",payload:'{ source: "session_start"|"reload" }'},Notification:{when:"Fires when Claude Code emits a desktop notification.",payload:"{ title: string, message: string }",example:"Forward to your own notify-send / osascript pipeline."},PermissionRequest:{when:"Fires when a tool needs user permission (per the permissions block).",payload:"{ tool_name: string, tool_input?: object }",example:"Auto-allow npm test invocations."},PermissionDenied:{when:"Fires when the user (or policy) denies a permission request.",payload:"{ tool_name: string, retry: boolean }",example:"Track which tools the user habitually rejects."},SubagentStart:{when:"Fires when a subagent (Task tool) spawns.",payload:"{ agent_type: string }",example:'matcher="security-reviewer" — log every security scan.'},SubagentStop:{when:"Fires when a subagent finishes.",payload:'{ agent_type: string, reason: "end_turn"|"error"|string }'},TeammateIdle:{when:"Fires when a teammate agent goes idle (waiting for input).",payload:"{ teammate_id?: string }"},TaskCreated:{when:"Fires when a new Task is created via the Task tool.",payload:"{ task: { description: string, ...} }",example:"Track each spawned task in an external queue."},TaskCompleted:{when:"Fires when a Task completes (success or failure).",payload:"{ task: { description: string, ...} }"},ConfigChange:{when:"Fires when settings.json (any scope) is mutated mid-session.",payload:'{ source: "user_settings"|"project_settings"|"local_settings" }',example:"Reload tooling that depends on env vars on config change."},CwdChanged:{when:"Fires when the working directory changes (e.g. agent cd-ing).",payload:"{ old_cwd: string, new_cwd: string }",example:"Refresh project-scoped indexers when cwd drifts."},FileChanged:{when:"Fires when a watched file outside Claude Code's edits changes.",payload:'{ file_path: string, change_type: "modified"|"created"|"deleted" }',example:"Re-run typecheck when any .ts file changes."},WorktreeCreate:{when:"Fires after a git worktree is created via /worktree or subagent isolation.",payload:"{ worktree_path?: string, branch?: string }"},WorktreeRemove:{when:"Fires after a git worktree is removed.",payload:"{ worktree_path?: string }"},Elicitation:{when:"Fires when Claude asks the user a multiple-choice question.",payload:'{ action: "accept"|"reject", ...}'},ElicitationResult:{when:"Fires after the user resolves an elicitation prompt.",payload:"{ choice?: string }"}},ee=["UserPromptSubmit","UserPromptExpansion","PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Stop","StopFailure","SessionStart","SessionEnd","Setup","PreCompact","PostCompact","InstructionsLoaded","Notification","PermissionRequest","PermissionDenied","SubagentStart","SubagentStop","TeammateIdle","TaskCreated","TaskCompleted","ConfigChange","CwdChanged","FileChanged","WorktreeCreate","WorktreeRemove","Elicitation","ElicitationResult"],Fe=new Set(ee),Oe=["command","http","prompt","agent","mcp_tool"],Ae={UserPromptSubmit:{prompt:"hello"},UserPromptExpansion:{command:"/example",expanded:"hello"},PreToolUse:{tool_name:"Bash",tool_input:{command:"ls"}},PostToolUse:{tool_name:"Bash",tool_input:{command:"ls"},tool_result:""},PostToolUseFailure:{tool_name:"Bash",tool_input:{command:"ls"},error:""},PostToolBatch:{tool_uses:[]},Stop:{stop_reason:"end_turn",output_tokens:0},StopFailure:{reason:"rate_limit"},SessionStart:{source:"startup",model:"",agent_type:""},SessionEnd:{reason:"user_quit"},Setup:{mode:"init"},PreCompact:{transcript_path:"",trigger:"manual"},PostCompact:{transcript_path:"",trigger:"manual"},InstructionsLoaded:{source:"session_start"},Notification:{title:"test",message:"test notification"},PermissionRequest:{tool_name:"Bash"},PermissionDenied:{tool_name:"Bash",retry:!1},SubagentStart:{agent_type:"general-purpose"},SubagentStop:{agent_type:"general-purpose",reason:"end_turn"},TeammateIdle:{},TaskCreated:{task:{description:""}},TaskCompleted:{task:{description:""}},ConfigChange:{source:"user_settings"},CwdChanged:{old_cwd:"",new_cwd:""},FileChanged:{file_path:"",change_type:"modified"},WorktreeCreate:{},WorktreeRemove:{},Elicitation:{action:"accept"},ElicitationResult:{}},J="This settings file has invalid JSON. Fix it in the Settings raw editor first; Hooks will not overwrite it.";function Me(t){if(t.trim()==="")return{full:{},hooks:{},err:null};try{const s=JSON.parse(t);if(s===null||typeof s!="object"||Array.isArray(s))return{full:{},hooks:{},err:"settings file is not a JSON object"};const n=s;return{full:n,hooks:n.hooks??{},err:null}}catch(s){return{full:{},hooks:{},err:s.message}}}function Re(t,s){return(t[s]??[]).reduce((n,r)=>{var a;return n+(((a=r.hooks)==null?void 0:a.length)??0)},0)}function $e({scope:t="user"}={}){const s=L(),n=V(),r=(n==null?void 0:n.cwd)??null,a=z(x=>x.navFace),[o,l]=y.useState("events");y.useEffect(()=>{a==="project"&&o==="library"&&l("events")},[a,o]);const d=H(Y,s,r)[t]??null,c=e.jsx(U,{options:[{key:"events",label:"Events"},...a==="home"?[{key:"library",label:"Library"}]:[]],active:o,onChange:l});return s?o==="library"?e.jsx(F,{toolbar:c,children:e.jsx(be,{})}):t!=="user"&&!r?e.jsx(F,{toolbar:e.jsx(e.Fragment,{children:c}),children:e.jsx(C,{title:"no active project"})}):d?e.jsx(F,{toolbar:e.jsxs(e.Fragment,{children:[c,e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:d}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/hooks",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"hook reference ↗"})]}),children:e.jsx(te,{scope:t,cwd:r,path:d})}):e.jsx(C,{title:"loading…"}):e.jsx(C,{title:"loading…"})}function te({scope:t,cwd:s,path:n}){const[r,a]=y.useState("PreToolUse"),[o,l]=y.useState(null),p=(g,k)=>{window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:s,keyPath:g,value:k}).catch(m=>R.error(m instanceof Error?m.message:String(m)))},d=T(g=>g.files[n]),{hooks:c,err:x}=d?Me(d.draftRaw):{hooks:{},err:null},v=Object.keys(c).filter(g=>!Fe.has(g)),j=v.reduce((g,k)=>g+(c[k]??[]).reduce((m,b)=>{var w;return m+(((w=b.hooks)==null?void 0:w.length)??0)},0),0),i=(g,k)=>{if(x){R.error(J);return}p(["hooks",g],k)},u=c[r]??[],h=()=>{i(r,[...u,{matcher:"",hooks:[{type:"command",command:""}]}])},f=(g,k)=>{const m=u.slice();m[g]=k,i(r,m)},N=g=>{i(r,u.filter((k,m)=>m!==g))};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full",children:[x?e.jsxs("div",{role:"alert",className:"px-3 py-2 border-b border-line text-xs text-red-400",children:[J," (",x,")"]}):null,j>0?e.jsxs("div",{className:"px-3 py-2 border-b border-line text-xs bg-bg-elev text-fg-dim",children:[e.jsx("span",{className:"text-yellow-400",children:"⚠"})," ",j," hook(s) configured under unknown event names: ",e.jsx("span",{className:"font-mono text-fg",children:v.join(", ")}),e.jsx("span",{className:"text-fg-faint",children:" · these are ignored by Claude Code 2026; edit settings.json directly to remove."})]}):null,e.jsx(je,{sidebarWidth:"14rem",sidebar:e.jsx("div",{className:"py-1",children:ee.map(g=>{const k=Re(c,g),m=Te[g],b=m?e.jsxs("span",{className:"block space-y-1",children:[e.jsx("span",{className:"block text-fg",children:m.when}),e.jsxs("span",{className:"block text-fg-faint font-mono",children:["payload: ",m.payload]}),m.example?e.jsxs("span",{className:"block text-fg-faint italic",children:["e.g. ",m.example]}):null]}):e.jsx("span",{className:"text-fg-faint italic",children:"no documentation yet"});return e.jsx("div",{className:"[&>span]:w-full",children:e.jsx(ce,{content:b,align:"bottom-center",children:e.jsxs("button",{onClick:()=>a(g),title:m==null?void 0:m.when,className:`w-full text-left px-3 py-1 text-xs ${r===g?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate",children:g}),k>0&&e.jsx("span",{className:"text-accent shrink-0 ml-2",children:k})]}),m?e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 font-normal truncate",children:m.when}):e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 italic font-normal truncate",children:"no documentation yet"})]})})},g)})}),detail:e.jsxs("div",{className:"p-4 space-y-3 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-fg",children:r}),e.jsx("button",{onClick:h,disabled:!!x,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:"+ add group"})]}),u.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no hooks for this event"}):u.map((g,k)=>e.jsx(Ie,{group:g,jsonInvalid:!!x,onChange:m=>f(k,m),onRemove:()=>N(k),onTestFire:m=>l({event:r,matcher:g.matcher??"",command:m.command??""})},k))]})})]}),o?e.jsx(Be,{event:o.event,matcher:o.matcher,command:o.command,onClose:()=>l(null)}):null]})}y.memo($e);function M({value:t,onCommit:s,onDraft:n,...r}){const[a,o]=y.useState(t);y.useEffect(()=>o(t),[t]);const l=()=>{a!==t&&s(a)};return e.jsx("input",{...r,value:a,onChange:p=>{o(p.target.value),n==null||n(p.target.value)},onBlur:l,onKeyDown:p=>{p.key==="Enter"&&l()}})}function Ie({group:t,jsonInvalid:s,onChange:n,onRemove:r,onTestFire:a}){const o=()=>n({...t,hooks:[...t.hooks??[],{type:"command",command:""}]}),l=(d,c)=>{const x=t.hooks.slice();x[d]=c,n({...t,hooks:x})},p=d=>n({...t,hooks:t.hooks.filter((c,x)=>x!==d)});return e.jsxs("div",{className:"border border-line rounded p-3 bg-bg-elev space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-fg-faint w-16",children:"matcher"}),e.jsx(M,{value:t.matcher??"",disabled:s,onCommit:d=>n({...t,matcher:d}),placeholder:"tool name regex or exact match (optional)",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("button",{onClick:r,disabled:s,className:"text-fg-faint hover:text-red-400 text-xs disabled:opacity-40",title:"remove group",children:"× group"})]}),(t.hooks??[]).map((d,c)=>e.jsx(Le,{rule:d,jsonInvalid:s,onChange:x=>l(c,x),onRemove:()=>p(c),onTestFire:()=>a(d)},c)),e.jsx("button",{onClick:o,disabled:s,className:"text-xs text-fg-faint hover:text-fg disabled:opacity-40",children:"+ add hook"})]})}function De(t){var n,r,a;const s=((r=(n=Z.$defs)==null?void 0:n.hookCommand)==null?void 0:r.anyOf)??[];for(const o of s){const l=o.properties;if(((a=l==null?void 0:l.type)==null?void 0:a.const)!==t)continue;const p=l.timeout;if(typeof(p==null?void 0:p.default)=="number")return p.default;const d=/default:\s*(\d+)/.exec((p==null?void 0:p.description)??"");return d?Number(d[1]):null}return null}function G(t){return/^\d+$/.test(t.trim())&&Number(t)>0?Number(t):null}function Le({rule:t,jsonInvalid:s,onChange:n,onRemove:r,onTestFire:a}){const o=i=>({command:"e.g. node ./scripts/lint.js $FILE",http:"e.g. https://hooks.example.com/notify",prompt:"e.g. Review this change for security issues",agent:"e.g. security-reviewer",mcp_tool:"e.g. mcp__server__tool"})[i],l=t.type==="command"?"command":t.type==="http"?"url":t.type==="prompt"?"prompt":t.type==="mcp_tool"?"mcpTool":"agent",p=t[l]??"",d=(t.args??[]).join(" "),[c,x]=y.useState(null),v=De(t.type),j={type:"hook",name:p||t.type,command:t.type==="command"?t.command:void 0,url:t.type==="http"?t.url:void 0};return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:t.type,disabled:s,onChange:i=>n({type:i.target.value}),className:"bg-bg border border-line rounded px-1 py-0.5 text-xs text-fg",children:Oe.map(i=>e.jsx("option",{value:i,children:i},i))}),e.jsx(ve,{interactive:!1,input:j}),e.jsx(M,{value:p,disabled:s,onCommit:i=>n({...t,[l]:i}),placeholder:o(t.type),className:`flex-1 bg-bg border rounded px-2 py-0.5 text-xs text-fg font-mono ${s?"border-red-500/70":p.trim()?"border-line":"border-yellow-600/50"}`}),s?e.jsx("span",{className:"text-red-400 text-xs",title:"The enclosing settings.json is malformed; fix the JSON before editing.",children:"× invalid"}):null,e.jsx(M,{value:t.timeout!=null?String(t.timeout):"",disabled:s,"aria-label":"timeout (seconds)","aria-invalid":c?!0:void 0,title:c??"Timeout in seconds",onDraft:i=>{x(!i.trim()||G(i)!=null?null:"Timeout must be a positive whole number of seconds")},onCommit:i=>{if(!i.trim()){n({...t,timeout:void 0});return}const u=G(i);u!=null&&n({...t,timeout:u})},placeholder:v!=null?`${v} (seconds)`:"seconds",className:`w-24 bg-bg border rounded px-2 py-0.5 text-xs text-fg ${c?"border-red-500/70":"border-line"}`}),c?e.jsx("span",{role:"alert",className:"text-red-400 text-xs",children:c}):null,t.type==="command"?e.jsx("button",{onClick:a,disabled:s||!p.trim(),className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",title:"Run this command with a fake event payload",children:"test fire"}):null,e.jsx("button",{onClick:r,disabled:s,className:"text-fg-faint hover:text-red-400 text-xs disabled:opacity-40",children:"×"})]}),t.type==="command"?e.jsxs("div",{className:"flex items-center gap-2 pl-[3.75rem]",children:[e.jsx("span",{className:"text-xs text-fg-faint w-12",children:"args"}),e.jsx(M,{value:d,disabled:s,onCommit:i=>n({...t,args:i.trim()?i.split(/\s+/).filter(Boolean):void 0}),placeholder:"argv array (v2.1.139+ exec form, no shell)",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"})]}):null,e.jsxs("div",{className:"flex items-center gap-2 pl-[3.75rem]",children:[e.jsx("span",{className:"text-xs text-fg-faint w-12",children:"term"}),e.jsx(M,{value:t.terminalSequence??"",disabled:s,onCommit:i=>n({...t,terminalSequence:i||void 0}),placeholder:"terminalSequence — e.g. \\\\a (bell), v2.1.141+",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"})]})]})}function He(t){return JSON.stringify(Ae[t]??{},null,2)}function Ue(t,s){if(!t.trim())return{matched:!0,target:null,note:"empty matcher → matches all"};const n=s&&typeof s=="object"&&"tool_name"in s?String(s.tool_name??""):null;if(n==null)return{matched:!1,target:null,note:"payload has no tool_name to match against"};try{return{matched:new RegExp(`^(?:${t})$`).test(n),target:n}}catch{return{matched:t===n,target:n,note:"matcher not valid regex; fell back to exact match"}}}function Be({event:t,matcher:s,command:n,onClose:r}){const[a,o]=y.useState(()=>He(t)),[l,p]=y.useState(!1),[d,c]=y.useState(null),[x,v]=y.useState(null);let j=null;try{JSON.parse(a)}catch(u){j=u.message}const i=async()=>{p(!0),c(null);let u=null;try{u=JSON.parse(a)}catch{}v(Ue(s,u));try{const h=await window.api.app.testFireHook({command:n,payload:a,timeoutMs:5e3});c(h)}finally{p(!1)}};return e.jsx(de,{open:!0,onClose:r,title:`Test fire — ${t}`,children:e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"resolved command"}),e.jsx("div",{className:"font-mono text-fg bg-bg border border-line rounded px-2 py-1 break-all",children:n})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"matcher"}),e.jsx("div",{className:"font-mono text-fg bg-bg border border-line rounded px-2 py-1",children:s||e.jsx("span",{className:"text-fg-faint",children:"(empty — matches all)"})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-fg-faint",children:"fake event payload (stdin)"}),j?e.jsxs("span",{className:"text-red-400",children:["× ",j]}):null]}),e.jsx("textarea",{value:a,onChange:u=>o(u.target.value),rows:8,className:`w-full bg-bg border rounded px-2 py-1 font-mono text-fg ${j?"border-red-500/70":"border-line"}`})]}),x?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"matcher result"}),e.jsxs("div",{className:"font-mono",children:[e.jsx("span",{className:x.matched?"text-green-400":"text-red-400",children:x.matched?"✓ match":"✗ no match"}),x.target!=null?e.jsxs("span",{className:"text-fg-dim",children:[' · target tool_name="',x.target,'"']}):null,x.note?e.jsx("div",{className:"text-fg-faint",children:x.note}):null]})]}):null,d?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-fg-faint",children:["exit ",d.exitCode," · ",d.durationMs,"ms"]}),d.stdout?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"stdout"}),e.jsx("pre",{className:"bg-bg border border-line rounded p-2 font-mono text-fg whitespace-pre-wrap break-all max-h-40 overflow-auto",children:d.stdout})]}):null,d.stderr?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"stderr"}),e.jsx("pre",{className:"bg-bg border border-line rounded p-2 font-mono text-red-300 whitespace-pre-wrap break-all max-h-40 overflow-auto",children:d.stderr})]}):null]}):null,e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[e.jsx("button",{onClick:r,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"close"}),e.jsx("button",{onClick:i,disabled:l||!!j||!n.trim(),className:"px-2 py-0.5 text-xs border border-line rounded text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:l?"running…":"run"})]})]})})}const se=[{id:"permissions",label:"Permissions",tab:"permissions",keys:["permissions"]},{id:"hooks",label:"Hooks",tab:"hooks",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",label:"MCP Servers",tab:null,keys:["enabledMcpjsonServers","disabledMcpjsonServers","enableAllProjectMcpServers"]},{id:"plugins",label:"Plugins",tab:null,keys:["enabledPlugins"]}],q=new Set(se.flatMap(t=>t.keys)),Ke=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle"]},{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","fallbackModel","enforceAvailableModels","teammateDefaultModel","advisorModel"]},{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"]}],Je={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function ne(t){return t.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((r,a)=>{const o=Je[r];return o||(a===0?r.charAt(0).toUpperCase()+r.slice(1):r)}).join(" ")}function re(t){const s=new Set,n=[];for(const a of Ke){const o=a.keys.filter(l=>t.has(l)&&!q.has(l));o.forEach(l=>s.add(l)),o.length!==0&&n.push({id:a.id,title:a.title,summary:a.summary,advanced:!!a.advanced,keys:o})}const r=Array.from(t).filter(a=>!s.has(a)&&a!=="$schema"&&!q.has(a)).sort();return r.length>0&&n.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:r}),n}function Ge(t,s){return re(t).map(n=>({id:n.id,title:n.title,advanced:n.advanced,total:n.keys.length,setCount:n.keys.filter(r=>s.has(r)).length}))}const qe={};function ae(t,s){if(s)return{text:s,authored:!1};const n=qe[t];return n?{text:n,authored:!0}:null}const We={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"},Ve=["user","project","local","default"],ze={user:"user",project:"project",local:"local",default:"default"};function Ye({node:t,targetScope:s,onOverride:n,schema:r}){const[a,o]=y.useState(""),[l,p]=y.useState(!1),[d,c]=y.useState(!0),x=t.kind==="object"?t:null,v=x?Object.keys(x.children):[],j=r.rootKeys(),i=new Set([...v,...j]),u=y.useMemo(()=>re(i),[Array.from(i).sort().join(",")]),h=y.useMemo(()=>Ge(i,new Set(v)),[Array.from(i).sort().join(","),v.join(",")]),[f,N]=y.useState(null),g=y.useRef(null),k=b=>{const w=u.find(_=>_.id===b);w!=null&&w.advanced&&!l&&p(!0),N(b)};y.useEffect(()=>{if(!f)return;N(null);const b=g.current,w=document.getElementById(`settings-group-${f}`);if(!b||!w)return;const _=w.getBoundingClientRect().top-b.getBoundingClientRect().top;b.scrollBy({top:_,behavior:"smooth"})},[f]);const m=y.useMemo(()=>u.filter(b=>l||!b.advanced).map(b=>({...b,keys:b.keys.filter(w=>{const _=(x==null?void 0:x.children[w])!==void 0;if(!d&&!_)return!1;if(!a.trim())return!0;const E=r.at([w]);return[w,ne(w),(E==null?void 0:E.description)??""].join(" ").toLowerCase().includes(a.toLowerCase())})})).filter(b=>b.keys.length>0),[u,a,l,d,x,r]);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:d,onChange:b=>c(b.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:l,onChange:b=>p(b.target.checked),className:"accent-accent"}),"show advanced"]}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:a,onChange:b=>o(b.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(Ze,{groups:h,onJump:k}),e.jsxs("div",{ref:g,className:"flex-1 overflow-auto py-3",children:[m.map(b=>e.jsx(Qe,{id:b.id,title:b.title,summary:b.summary,advanced:b.advanced,children:b.keys.map(w=>{const _=x==null?void 0:x.children[w],E=r.at([w]);return e.jsx(Xe,{keyName:w,node:_,info:E,targetScope:s,onOverride:(A,$)=>n([w],A,$)},w)})},b.id)),m.length===0&&e.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',a,'"']})]})]})]})}function Ze({groups:t,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:t.map(n=>e.jsxs("button",{onClick:()=>s(n.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bg-hi transition-colors",title:`jump to ${n.title}`,children:[e.jsx(ue,{name:We[n.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:n.title}),e.jsxs("span",{className:"text-[10px] text-fg-faint font-mono shrink-0",children:[n.setCount,"/",n.total]})]},n.id))})}function Qe({id:t,title:s,summary:n,advanced:r,children:a}){const[o,l]=y.useState(!0);return e.jsxs("section",{id:`settings-group-${t}`,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:()=>l(!o),children:[e.jsx("span",{className:"text-fg-faint w-3",children:o?"▾":"▸"}),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}),r&&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:n})]})]}),o&&e.jsx("div",{className:"divide-y divide-line/60",children:a})]})}function Xe({keyName:t,node:s,info:n,targetScope:r,onOverride:a}){const[o,l]=y.useState(!1),[p,d]=y.useState(!1),c=ne(t),x=s!==void 0,j=(s==null?void 0:s.kind)==="leaf"?s:null,i=(s==null?void 0:s.kind)==="object"||(s==null?void 0:s.kind)==="array",u=n==null?void 0:n.default,h=j&&u!==void 0&&ie(j.value,u),f=it({isSet:x,leafNode:j,defaultVal:u,isDefault:!!h,node:s}),N=et(j,u),g=N.length>=2,k=!!j&&!h,m=ae(t,n==null?void 0:n.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:()=>l(!o),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:o?"collapse":"expand",children:o?"▾":"▸"}),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:c}),e.jsx(lt,{kind:f.kind,label:f.label}),g&&e.jsxs("button",{onClick:b=>{b.stopPropagation(),o||l(!0),d(w=>!w)},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 · ",N.map(b=>ze[b]).join(" · ")]}),k&&j&&e.jsx("button",{onClick:b=>{b.stopPropagation(),a(void 0,j.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[j.winner].label}`,children:"↺ reset"}),(n==null?void 0:n.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"}),(n==null?void 0:n.required)&&!x&&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"})]}),m&&e.jsx("p",{className:`text-fg-dim text-xs mt-0.5 leading-relaxed ${m.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:m.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:ct(m.text)}),o&&p&&j&&e.jsx(tt,{leaf:j,defaultVal:u,onReset:b=>a(void 0,b)}),o&&e.jsx(st,{keyName:t,node:s,info:n,targetScope:r,onOverride:b=>a(b)})]}),e.jsx("div",{className:"shrink-0",children:!o&&e.jsx(ot,{node:s,info:n,onSet:b=>{a(b)},disabled:i&&x})})]})})}function et(t,s){if(!t)return[];const n=new Set;n.add(t.winner);for(const r of t.shadowed)n.add(r.scope);return s!==void 0&&n.add("default"),Ve.filter(r=>n.has(r))}function tt({leaf:t,defaultVal:s,onReset:n}){const r={};r[t.winner]={value:t.value,winner:!0};for(const a of t.shadowed)r[a.scope]={value:a.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(a=>{const o=r[a],l=o!==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[a].label}),e.jsx("span",{className:`font-mono truncate ${o!=null&&o.winner?"text-accent":"text-fg-dim"}`,children:l?O(o.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),l?e.jsx("button",{onClick:()=>n(a),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[a].label}`,children:"↺"}):e.jsx("span",{})]},a)}),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?O(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function st({keyName:t,node:s,info:n,targetScope:r,onOverride:a}){const l=(s==null?void 0:s.kind)==="leaf"?s:null,p=ae(t,n==null?void 0:n.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:[(n==null?void 0:n.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(n.type)?n.type.join(" | "):n.type})]}),(n==null?void 0:n.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:O(n.default)})]}),(n==null?void 0:n.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:n.enum.map(d=>String(d)).join(" | ")})]}),l&&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:O(l.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",S[l.winner].label]})]})]}),l&&l.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:l.shadowed.map((d,c)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[O(d.value)," —"," ",e.jsx("span",{className:"no-underline",children:S[d.scope].label})]},c))})]}),(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(nt,{keyName:t,node:s,info:n,onChange:a,targetScope:r})})]})}function nt({node:t,info:s,onChange:n,targetScope:r}){const o=(t==null?void 0:t.kind)==="leaf"?t.value:s==null?void 0:s.default,l=oe(s==null?void 0:s.type);if(l==="boolean"){const p=o===!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:d,label:c})=>e.jsx("button",{onClick:()=>n(d),className:`px-3 py-0.5 text-xs transition-colors ${p===d?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:c},c))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[r].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 d=ie(o,p);return e.jsx("button",{onClick:()=>n(p),className:`px-2 py-0.5 text-xs rounded border ${d?"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[r].label]})]}):l==="integer"||l==="number"?e.jsx(rt,{value:typeof o=="number"?o:void 0,integer:l==="integer",onCommit:n,target:S[r].label}):l==="string"?e.jsx(at,{value:typeof o=="string"?o:"",onCommit:n,target:S[r].label}):e.jsxs("div",{className:"text-fg-faint",children:["Complex value (",l??"object/array",") — use the"," ",e.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function rt({value:t,integer:s,onCommit:n,target:r}){const[a,o]=y.useState(t!==void 0?String(t):""),l=()=>{const p=s?parseInt(a,10):parseFloat(a);Number.isNaN(p)||n(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:a,onChange:p=>o(p.target.value),onBlur:l,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:l,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",r]})]})}function at({value:t,onCommit:s,target:n}){const[r,a]=y.useState(t);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:r,onChange:o=>a(o.target.value),onKeyDown:o=>{o.key==="Enter"&&s(r)},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(r),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 → ",n]})]})}function ot({node:t,info:s,onSet:n,disabled:r}){const a=(t==null?void 0:t.kind)==="leaf",o=oe(s==null?void 0:s.type);if(r)return null;if(o==="boolean"){const l=a&&t.value===!0;return e.jsx("button",{onClick:()=>n(!l),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${l?"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:l?"on":"off"})}return null}function it({isSet:t,leafNode:s,defaultVal:n,isDefault:r,node:a}){return t?(a==null?void 0:a.kind)==="array"?{kind:"accumulated",label:`${a.items.length} items`}:(a==null?void 0:a.kind)==="object"?{kind:"set",label:"configured"}:s?r?{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"}:n!==void 0?{kind:"default",label:`using default: ${O(n)}`}:{kind:"unset",label:"not configured"}}function lt({kind:t,label:s}){const n={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"}[t];return e.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${n}`,children:s})}function oe(t){if(t)return Array.isArray(t)?t.find(n=>n!=="null")??t[0]:t}function ie(t,s){return t===s?!0:typeof t!=typeof s?!1:t&&s&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(s):!1}function ct(t){const s=t.trim().split(`
2
+ `)[0],n=s.match(/^([^.!?]+[.!?])/);return n?n[1]:s.length>120?s.slice(0,120)+"…":s}function O(t){if(typeof t=="string")return t===""?'""':JSON.stringify(t);if(t===null)return"null";if(t===void 0)return"—";if(typeof t=="object"){const s=JSON.stringify(t);return s.length>60?s.slice(0,60)+"…":s}return String(t)}const W={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 dt({effective:t,onOpenTab:s}){return e.jsx("ul",{"data-testid":"settings-owned-summaries",className:"px-3 py-2 space-y-1 text-[11.5px] border-b border-line",children:se.map(n=>{const r=n.keys.filter(o=>fe(t,[o])!==null),a=r.length?`${r.length} of ${n.keys.length} keys set (${r.join(", ")})`:"nothing set";return e.jsxs("li",{"data-testid":`owned-summary-${n.id}`,className:"flex items-center gap-2 text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg w-28 shrink-0",children:n.label}),e.jsx("span",{className:"truncate",children:a}),n.tab?e.jsxs("button",{type:"button",onClick:()=>s(n.tab),className:"ml-auto text-accent hover:underline shrink-0",children:["edit in ",n.label," tab →"]}):e.jsxs("span",{className:"ml-auto text-fg-faint shrink-0",children:["managed on the ",n.label," page"]})]},n.id)})})}function ut({scope:t="user"}={}){const s=L(),n=B(m=>m.tabs),r=B(m=>m.activeTabId),a=n.find(m=>m.id===r)??null,o=(a==null?void 0:a.cwd)??null,[l,p]=y.useState("general");pe("settings",m=>{(m==="general"||m==="permissions"||m==="hooks"||m==="raw")&&p(m)});const d=H(Y,s,o),c=d[t]??null,x=T(m=>m.files),v=T(m=>m.setDraft),j=T(m=>m.saveJson),i=T(m=>m.revert),[u,h]=y.useState(null),f=y.useMemo(()=>me(xe(x,d)),[x,d]),N=(m,b,w)=>{var $;const _=w??t,E=d[_];if(!E)return;const A=(($=x[E])==null?void 0:$.draftRaw)??"";if(A.trim())try{JSON.parse(A)}catch(P){h(`${E} is not valid JSON (${P instanceof Error?P.message:String(P)}) — fix it in Raw before editing from General.`);return}h(null),window.api.claudeConfig.patch({fileId:"settings",scope:_,cwd:o,keyPath:m,value:b}).catch(P=>R.error(P instanceof Error?P.message:String(P)))};if(!s)return e.jsx(C,{title:"loading…"});const g=c?x[c]:null,k=m=>m!=="user"&&!o;return e.jsx(F,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(U,{options:[{key:"general",label:"General"},{key:"permissions",label:"Permissions"},{key:"hooks",label:"Hooks"},{key:"raw",label:"Raw"}],active:l,onChange:p}),e.jsx(e.Fragment,{children:e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:l==="general"?`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:l==="raw"&&c&&g?e.jsx(ye,{dirty:g.dirty,busy:g.busy,parseError:u||g.parseError,lastSavedAt:g.lastSavedAt,leading:g.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{h(null);const m=await j(c);m.ok||h(m.error??"save failed")},onRevert:()=>{h(null),i(c)}}):null,children: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:W[t].title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:W[t].body}),c&&e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:c})]}),u&&l!=="raw"&&e.jsx("div",{role:"alert",className:"px-3 py-2 border-b border-line text-xs text-red-400",children:u}),k(t)?e.jsx(C,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"}):l==="general"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-2",children:e.jsx(I,{path:c??""})}),e.jsx(dt,{effective:f,onOpenTab:p}),e.jsx(Ye,{node:f,targetScope:t,onOverride:N,schema:Q()})]}):l==="permissions"?c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-2",children:e.jsx(I,{path:c,keyPath:["permissions"]})}),e.jsx(X,{scope:t,cwd:o,activePath:c})]}):e.jsx(C,{title:"resolving…"}):l==="hooks"?c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-2",children:e.jsx(I,{path:c,keyPath:["hooks"]})}),e.jsx(te,{scope:t,cwd:o,path:c})]}):e.jsx(C,{title:"resolving…"}):c&&g?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-2",children:e.jsx(I,{path:c})}),e.jsx(he,{path:c,value:g.draftRaw,onChange:m=>{h(null),v(c,m)}})]}):e.jsx(C,{title:"resolving…"})]})})}const kt=y.memo(ut);export{W as SETTINGS_SCOPE_NOTES,kt as Settings};
@@ -1,4 +1,4 @@
1
- import{aJ as Z,R as wo,aq as ko,at as tr}from"./index-CuAfFXNd.js";import"./monaco-editor-BsIlgG7c.js";function Ao(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 Co(e,n,r){return n=zo(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 To(e)||Ao(e,n)||ci(e,n)||Eo()}function So(e){return Mo(e)||Po(e)||ci(e)||Oo()}function Mo(e){if(Array.isArray(e))return gn(e)}function To(e){if(Array.isArray(e))return e}function Po(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ci(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 Oo(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{aK as Z,R as wo,ar as ko,au as tr}from"./index-C9w-dVzo.js";import"./monaco-editor-BsIlgG7c.js";function Ao(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 Co(e,n,r){return n=zo(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 To(e)||Ao(e,n)||ci(e,n)||Eo()}function So(e){return Mo(e)||Po(e)||ci(e)||Oo()}function Mo(e){if(Array.isArray(e))return gn(e)}function To(e){if(Array.isArray(e))return e}function Po(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ci(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 Oo(){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 Eo(){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 Ro(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 zo(e){var n=Ro(e,"string");return typeof n=="symbol"?n:String(n)}var No=function(n,r){var i=new Set(r);return Object.assign.apply(Object,[{}].concat(So(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 Co({},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 Io(e){if(Array.isArray(e))return e}function $o(e){if(Array.isArray(e))return yn(e)}function Do(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function jo(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 Fo(){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 Lo(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
@@ -0,0 +1,12 @@
1
+ import{au as e,aK as u,ba as ue,b1 as fe,b4 as M,l as D,b as ne,bn as ge,b0 as I,F as be,av as ve,b5 as je}from"./index-C9w-dVzo.js";import{P as G}from"./Panel-CIvb-XXN.js";import{L as xe}from"./ListDetail-DjMn8a_3.js";import{f as le,S as me,m as ye}from"./Library-DFn0YPIW.js";import{P as H}from"./ProvenanceBadge-ej8W2ZIK.js";import{T as Se}from"./Toggle-DKb4x1BP.js";const we={live:"bg-emerald-400",idle:"bg-amber-400",offline:"bg-fg-faint",attention:"bg-accent",paused:"bg-zinc-500"},ke={sm:"w-1.5 h-1.5",md:"w-2 h-2"},Ne={on:"live",off:"offline",warn:"attention",live:"live",idle:"idle"};function pe({state:r,kind:t,pulse:s=!1,size:f="sm",className:x="",title:c,"aria-label":o}){const m=r??(t?Ne[t]:"idle"),b=we[m],h=ke[f],C=s?"animate-pulse":"",d=o??c??m;return e.jsx("span",{role:"img","aria-label":d,className:`inline-block rounded-full ${h} ${b} ${C} ${x}`.trim(),title:c})}const Ce={failed:"Failed","needs-auth":"Needs auth",pending:"Pending approval"};function oe(r,t){const s=t!=null&&t.ok?t.servers.find(f=>f.name===r):void 0;return!s||s.status==="unknown"?{state:"unprobed",label:"Not checked",probeStatus:(s==null?void 0:s.status)??null,badgeTone:"dim",dotState:"offline"}:s.status==="connected"?{state:"ready",label:"Ready",probeStatus:s.status,badgeTone:"good",dotState:"live"}:{state:"not-ready",label:Ce[s.status],probeStatus:s.status,badgeTone:"warn",dotState:"attention"}}const ie=(r,t)=>({type:"mcp",name:r,command:t.command,args:t.args,url:t.url}),Ee=["stdio","http","streamable-http","sse","ws"],Te=new Set(["workspace"]),$e=new Set(["ide","tasks"]);function Re(r,t,s){return r==="user"?`${t}/.claude.json`:s?`${s}/.mcp.json`:null}function Me(r){if(r.trim()==="")return{full:{},servers:{},err:null};try{const t=JSON.parse(r),s=t.mcpServers??{};return{full:t,servers:s,err:null}}catch(t){return{full:{},servers:{},err:t.message}}}function Fe(r,t){const s={};for(const[f,x]of Object.entries(t)){const{enabled:c,...o}=x;s[f]=o}return JSON.stringify({...r,mcpServers:s},null,2)+`
2
+ `}function Le(r,t){const s=[];for(const[f,x]of Object.entries(t)){if(JSON.stringify(x)===JSON.stringify(r[f]))continue;const{enabled:c,...o}=x;s.push({name:f,value:o})}for(const f of Object.keys(r))f in t||s.push({name:f,value:void 0});return s}function Pe(r){let t=Object.keys(r).length+1,s=`server-${t}`;for(;r[s];)t+=1,s=`server-${t}`;return s}function Ae({onAdd:r,scope:t="user"}={}){const s=ue(),f=fe(),x=(f==null?void 0:f.cwd)??null,[c,o]=u.useState(null),[m,b]=u.useState(""),h=u.useMemo(()=>s?Re(t,s,x):null,[s,t,x]),C=M(l=>l.files),d=M(l=>l.loadJson),E=M(l=>l.setDraft),S=M(l=>l.revert),$=M(l=>l.watchFile),T=M(l=>l.unwatchFile);u.useEffect(()=>{if(h)return C[h]||d(h),$(h),()=>T(h)},[h]);const[i,v]=u.useState(null),[N,J]=u.useState(null),[A,z]=u.useState(!1),L=u.useRef(0),O=u.useRef(!0);u.useEffect(()=>()=>{O.current=!1},[]);const _=async()=>{const l=++L.current;z(!0);try{const p=await window.api.mcp.status();if(!O.current||l!==L.current)return;J(p),p.ok||I.error(p.error??"MCP status probe failed")}catch(p){if(!O.current||l!==L.current)return;J(null),I.error(p.message||"MCP status probe failed")}finally{O.current&&l===L.current&&z(!1)}};if(u.useEffect(()=>{_()},[]),!s)return e.jsx(D,{title:"loading…"});if(t==="project"&&!x)return e.jsx(G,{toolbar:e.jsx(e.Fragment,{}),children:e.jsx(D,{title:"no active project"})});if(!h)return e.jsx(D,{title:"loading…"});const F=C[h],{full:U,servers:w,err:Z}=F?Me(F.draftRaw):{full:{},servers:{},err:null},B=Object.keys(w).sort(),W=c?w[c]:null,K=l=>{v(null),E(h,Fe(U,l))},Q=()=>{const l=Pe(w);K({...w,[l]:{type:"stdio",command:"",args:[]}}),o(l)},Y=l=>{const p={...w};delete p[l],K(p),c===l&&o(null)},X=(l,p)=>{if(!p||p===l||w[p])return;const y={};for(const R of Object.keys(w))y[R===l?p:R]=w[R];K(y),o(p)},ee=(l,p)=>{K({...w,[l]:p})};return e.jsxs(G,{toolbar:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"ml-3 px-1.5 py-0.5 text-[10px] rounded border border-line text-fg-faint",children:[B.length," server",B.length===1?"":"s"]}),e.jsx("span",{className:"ml-2 text-fg-faint truncate",children:h}),e.jsx("div",{className:"flex-1"}),c&&W&&e.jsx(H,{scope:t,input:ie(c,W),className:"mr-2"}),e.jsx("button",{onClick:_,disabled:A,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:A?"checking…":"⟳ test connections"}),e.jsx("button",{onClick:()=>r==null?void 0:r({scope:t,cwd:x}),className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi mr-2",children:"Add…"}),e.jsx("button",{onClick:Q,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:F?e.jsx(me,{dirty:F.dirty,busy:F.busy,parseError:i||Z||F.parseError,lastSavedAt:F.lastSavedAt,onSave:async()=>{var p;v(null);const l=((p=F.diskData)==null?void 0:p.mcpServers)??{};for(const[y,R]of Object.entries(w)){if(JSON.stringify(R)===JSON.stringify(l[y]))continue;const a=le(R);if(a.length>0){ge.getState().show("error",`Not saved: "${y}" still contains placeholder ${a.map(j=>j.token).join(", ")} — replace it with a real value`);return}}try{for(const y of Le(l,w))await window.api.claudeConfig.patch({...ye(t,x),keyPath:["mcpServers",y.name],value:y.value});await d(h)}catch(y){v(y.message||"save failed")}},onRevert:()=>{v(null),S(h)}}):null,children:[t==="project"&&x&&e.jsx(De,{cwd:x,names:B}),e.jsx(xe,{sidebar:e.jsxs("div",{className:"py-2",children:[e.jsx("div",{className:"px-2 pb-1",children:e.jsx("input",{value:m,onChange:l=>b(l.target.value),placeholder:"filter…",className:"w-full bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"})}),B.length===0?e.jsx("div",{className:"px-3 py-1 text-xs text-fg-faint italic",children:"no servers"}):B.filter(l=>!m||l.toLowerCase().includes(m.toLowerCase())).map(l=>{var R;const p=oe(l,N),y=(R=w[l].description)==null?void 0:R.trim();return e.jsxs("button",{onClick:()=>o(l),className:`w-full text-left px-3 py-1 text-xs flex flex-col gap-0.5 ${c===l?"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(pe,{state:p.dotState,title:p.label}),e.jsx("span",{className:"truncate",children:l})]}),e.jsxs("span",{className:"ml-2 flex items-center gap-2 shrink-0",children:[(()=>{const a=le(w[l]);return a.length>0?e.jsxs(ne,{tone:"warn",title:`${t} scope · ${h}`,children:["unconfigured placeholder: ",a.map(j=>j.token).join(", ")]}):null})(),e.jsx(ne,{tone:p.badgeTone,children:p.label}),e.jsx(H,{interactive:!1,scope:t,input:ie(l,w[l])}),e.jsx("span",{className:"text-fg-faint",children:w[l].type??"stdio"})]})]}),y?e.jsx("span",{className:"pl-5 text-fg-faint truncate",title:y,children:y}):null]},l)})]}),detail:c&&W?e.jsx(Oe,{name:c,server:W,connection:oe(c,N),onTestConnection:_,testing:A,onRename:l=>X(c,l),onChange:l=>ee(c,l),onRemove:()=>Y(c)}):e.jsx(D,{title:"select a server or click + new"})})]})}const Xe=u.memo(Ae);function Oe({name:r,server:t,connection:s,onTestConnection:f,testing:x,onRename:c,onChange:o,onRemove:m}){var T;const b=t.type??"stdio",h=Te.has(r),C=$e.has(r),d=(T=t.permissions)==null?void 0:T.tools,E=d===void 0?"inherit":d==="allow"?"allow":d==="deny"?"deny":"list",S=Array.isArray(d)?d:[],$=(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(pe,{state:s.dotState,size:"md",title:s.label}),e.jsx(ne,{tone:s.badgeTone,children:s.label}),e.jsx("button",{onClick:f,disabled:x,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:x?"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:r,onBlur:i=>c(i.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:m,className:"text-xs text-fg-faint hover:text-red-400 px-2 py-1 border border-line rounded",children:"delete"})]}),e.jsx(q,{label:"description",value:t.description??"",onChange:i=>o({...t,description:i||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:r})," is a reserved name — Claude Code will refuse to load this server (v2.1.128+)."]}):C?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:r})," 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:b,onChange:i=>o({...t,type:i.target.value}),className:"bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg",children:Ee.map(i=>e.jsx("option",{value:i,children:i},i))}),b==="sse"?e.jsx("span",{className:"text-xs text-yellow-400/80",children:"sse is deprecated — prefer streamable-http"}):null]}),b==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(q,{label:"command",value:t.command??"",onChange:i=>o({...t,command:i}),placeholder:"npx / node / python …"}),e.jsx(q,{label:"args",value:(t.args??[]).join(" "),onChange:i=>o({...t,args:i.split(/\s+/).filter(Boolean)}),placeholder:"space-separated args"}),e.jsx(ce,{label:"env",value:t.env??{},onChange:i=>o({...t,env:i})})]}):e.jsxs(e.Fragment,{children:[e.jsx(q,{label:"url",value:t.url??"",onChange:i=>o({...t,url:i}),placeholder:"https://…"}),e.jsx(ce,{label:"headers",value:t.headers??{},onChange:i=>o({...t,headers:i})})]}),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:i=>o({...t,alwaysLoad:i.target.checked||void 0})}),e.jsx("span",{className:"text-fg-dim",children:"bypass tool-search deferral (v2.1.121+)"})]})]}),e.jsx(q,{label:"disabledTools",value:$,onChange:i=>{const v=i.split(",").map(N=>N.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:E,onChange:i=>{const v=i.target.value,N={...t};if(v==="inherit"){if(N.permissions){const{tools:J,...A}=N.permissions;N.permissions=Object.keys(A).length?A:void 0}}else v==="list"?N.permissions={...N.permissions??{},tools:[]}:N.permissions={...N.permissions??{},tools:v};o(N)},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…"})]}),E==="list"?e.jsx("input",{value:S.join(", "),onChange:i=>{const v=i.target.value.split(",").map(N=>N.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 q({label:r,value:t,onChange:s,placeholder:f}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:r}),e.jsx("input",{value:t,onChange:x=>s(x.target.value),placeholder:f,className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"})]})}function ce({label:r,value:t,onChange:s}){const[f,x]=u.useState(""),[c,o]=u.useState(""),m=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:r}),e.jsxs("div",{className:"flex-1 space-y-1",children:[m.map(([b,h])=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:b,onChange:C=>{const d={...t};delete d[b],d[C.target.value]=h,s(d)},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:C=>s({...t,[b]:C.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 C={...t};delete C[b],s(C)},className:"text-fg-faint hover:text-red-400 text-xs px-1",children:"×"})]},b)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:f,onChange:b=>x(b.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:c,onChange:b=>o(b.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:()=>{f.trim()&&(s({...t,[f.trim()]:c}),x(""),o(""))},className:"px-2 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"+"})]})]})]})}function De({cwd:r,names:t}){const s={fileId:"settings",scope:"project",cwd:r},[f,x]=u.useState([]),[c,o]=u.useState(!1),[m,b]=u.useState(!1);u.useEffect(()=>{var $,T;let d=!0;const E=()=>window.api.claudeConfig.read(s).then(i=>{if(!d)return;const v=i.data;x(Array.isArray(v==null?void 0:v.disabledMcpjsonServers)?v.disabledMcpjsonServers:[]),o((v==null?void 0:v.enableAllProjectMcpServers)===!0)}).catch(()=>{});E();const S=(T=($=window.api.config)==null?void 0:$.onChanged)==null?void 0:T.call($,()=>{E()});return()=>{d=!1,S==null||S()}},[r]);const h=async(d,E)=>{b(!0);try{await window.api.claudeConfig.patch({...s,keyPath:[d],value:E})}catch(S){I.error(S.message||"save failed")}finally{b(!1)}},C=async(d,E)=>{const S=E?f.filter($=>$!==d):[...new Set([...f,d])];x(S),await h("disabledMcpjsonServers",S.length?S:void 0)};return e.jsxs("div",{className:"px-3 py-1 text-xs text-fg-faint border-b border-line flex flex-wrap items-center gap-x-4 gap-y-1","data-testid":"mcp-gating",children:[e.jsxs("span",{children:["Gating · ",r,"/.claude/settings.json"]}),e.jsxs("label",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"checkbox","data-testid":"mcp-enable-all",checked:c,disabled:m,onChange:d=>{o(d.target.checked),h("enableAllProjectMcpServers",d.target.checked?!0:void 0)}}),"enableAllProjectMcpServers"]}),t.map(d=>e.jsxs("label",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"checkbox","data-testid":`mcp-gate-${d}`,checked:!f.includes(d),disabled:m,onChange:E=>C(d,E.target.checked)}),d]},d))]})}function _e({value:r,onChange:t,path:s,readOnly:f}){return e.jsx(be,{path:`file://${s}`,defaultLanguage:"markdown",value:r,onChange:x=>t(x??""),theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:13,fontFamily:"JetBrains Mono, ui-monospace, Menlo, monospace",lineNumbers:"on",renderLineHighlight:"line",scrollBeyondLastLine:!1,tabSize:2,wordWrap:"on",readOnly:f,automaticLayout:!0}})}const re=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,se="disable-model-invocation",he=/^\s*disable-model-invocation\s*:/;function Be(r){const t=r.match(re);if(!t)return!1;for(const s of t[1].split(/\r?\n/)){if(!he.test(s))continue;const f=s.slice(s.indexOf(":")+1).trim().toLowerCase();return f==="true"||f==="yes"}return!1}function Ie(r){const t=r.trim();return t.length>=2&&(t[0]==='"'&&t[t.length-1]==='"'||t[0]==="'"&&t[t.length-1]==="'")?t.slice(1,-1):t}function de(r){return r.length-r.trimStart().length}function Je(r){const t=r.match(re);if(!t)return{name:null,description:null,body:r};const s=t[1].split(/\r?\n/),f=t[2]??"";let x=null,c=null;for(let o=0;o<s.length;o++){const m=s[o],b=m.match(/^(\s*)(name|description)\s*:(.*)$/);if(!b)continue;const[,,h,C]=b,d=C.trim(),E=de(m);let S;if(d===""||d===">-"||d===">"||d==="|-"||d==="|"){const $=[];let T=o+1;for(;T<s.length&&s[T].trim()!==""&&de(s[T])>E;)$.push(s[T].trim()),T++;S=$.join(" ")}else S=Ie(d);h==="name"?x=S:c=S}return{name:x,description:c,body:f}}function We(r,t){const s=r.match(re);if(!s){if(!t)return r;const o=r.startsWith(`
3
+ `)?"":`
4
+ `;return`---
5
+ ${se}: true
6
+ ---
7
+ ${o}${r}`}const f=s[2]??"",x=s[1].split(/\r?\n/),c=x.findIndex(o=>he.test(o));if(t)c>=0?x[c]=`${se}: true`:x.push(`${se}: true`);else{if(c<0)return r;x.splice(c,1)}return`---
8
+ ${x.join(`
9
+ `)}
10
+ ---
11
+ ${f}`}const Ke=250,Ve=2e3;function ze(r,t){return{user:{skills:`${r}/.claude/skills`,commands:`${r}/.claude/commands`},project:t?{skills:`${t}/.claude/skills`,commands:`${t}/.claude/commands`}:null}}function qe({onAdd:r,scope:t="user"}={}){const s=ue(),f=fe(),x=(f==null?void 0:f.cwd)??null,[c,o]=u.useState([]),[m,b]=u.useState(null),[h,C]=u.useState(""),[d,E]=u.useState([]),[S,$]=u.useState(null),T=u.useMemo(()=>s?ze(s,x):null,[s,x]),i=u.useMemo(()=>T?t==="user"?T.user:T.project:null,[t,T]),v=u.useRef(0),N=u.useCallback(async()=>{const a=++v.current;if(!i){o([]),E([]);return}const j=[],k=[];try{const n=await ve(i.skills);k.push(...n.errors);for(const g of n.entries)j.push({kind:"skills",scope:t,name:g.name,path:g.path,dir:g.dir,disabled:Be(g.text),description:Je(g.text).description??void 0})}catch(n){k.push({path:i.skills,error:n instanceof Error?n.message:String(n)})}try{const n=await window.api.config.listDir(i.commands,{filesOnly:!0});n.ok||k.push({path:i.commands,error:n.error??"failed to list directory"});for(const g of n.entries)g.name.endsWith(".md")&&j.push({kind:"commands",scope:t,name:g.name.replace(/\.md$/,""),path:g.path,dir:null,disabled:!1})}catch(n){k.push({path:i.commands,error:n instanceof Error?n.message:String(n)})}if(v.current===a){for(const n of k)I.error(`Could not read ${n.path}: ${n.error}`);E(k),j.sort((n,g)=>n.kind===g.kind?n.name.localeCompare(g.name):n.kind==="skills"?-1:1),o(j),b(n=>{var g;return j.find(P=>P.path===n)?n:((g=j[0])==null?void 0:g.path)??null})}},[i,t]);u.useEffect(()=>{N()},[N]),u.useEffect(()=>()=>{v.current+=1},[]);const J=u.useRef(N);J.current=N;const A=u.useRef(c);A.current=c;const z=u.useRef(m);z.current=m;const L=u.useRef(null),O=u.useRef(!1),_=u.useRef(!1),F=u.useCallback(async()=>{if(O.current){_.current=!0;return}O.current=!0;try{await J.current()}finally{O.current=!1}_.current&&(_.current=!1,F())},[]);u.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]);const U=u.useCallback(a=>{var g;const j=z.current,k=j?A.current.find(P=>P.path===j):null,n=j?(g=M.getState().files[j])==null?void 0:g.lastSavedAt:null;k!=null&&k.dir&&n&&Date.now()-n<Ve&&(a===k.dir||k.dir.startsWith(`${a}/`))||(L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{L.current=null,F()},Ke))},[F]);je(i?[i.skills,i.commands]:[],U);const w=M(a=>a.files),Z=M(a=>a.loadText),B=M(a=>a.setDraft),W=M(a=>a.saveText),K=M(a=>a.revert),Q=M(a=>a.watchFile),Y=M(a=>a.unwatchFile);async function X(a,j){const k=await window.api.config.readText(a.path);if(!k.exists)return;const n=We(k.text,j);if(n===k.text)return;const g=await window.api.config.writeText(a.path,n);if(!g.ok){I.error(g.error??"failed to update skill");return}o(P=>P.map(V=>V.path===a.path?{...V,disabled:j}:V)),M.getState().files[a.path]&&M.getState().loadText(a.path,!0)}async function ee(a){if(!a.dir)return;$(null);const j=await window.api.files.delete(a.dir);if(!j.ok){I.error(j.error??"failed to remove skill");return}I.info(`Removed "${a.name}" — moved to trash`),Y(a.path),o(k=>{const n=k.filter(g=>g.path!==a.path);return b(g=>{var P;return g!==a.path?g:((P=n[0])==null?void 0:P.path)??null}),n})}u.useEffect(()=>{if(m)return w[m]||Z(m),Q(m),()=>Y(m)},[m]);const[l,p]=u.useState(null);if(!s)return e.jsx(D,{title:"loading…"});if(t==="project"&&!x)return e.jsx(G,{toolbar:e.jsx(e.Fragment,{}),children:e.jsx(D,{title:"no active project",hint:"open a tab in a project directory to view project skills & commands"})});const y=c.find(a=>a.path===m)??null,R=m?w[m]:null;return e.jsx(G,{toolbar:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"ml-3 text-fg-faint",children:[c.length," ",c.length===1?"item":"items"]}),e.jsx("div",{className:"flex-1"}),r&&e.jsx("button",{onClick:r,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"Add…"}),y&&e.jsx(H,{scope:y.scope,input:{type:y.kind==="commands"?"command":"skill",name:y.name}}),e.jsx("span",{className:"ml-2 text-fg-faint truncate",children:(y==null?void 0:y.path)??""})]}),footer:m&&R?e.jsx(me,{dirty:R.dirty,busy:R.busy,parseError:l,lastSavedAt:R.lastSavedAt,onSave:async()=>{p(null);const a=await W(m);a.ok||p(a.error??"save failed")},onRevert:()=>{p(null),K(m)}}):null,children:e.jsx(xe,{sidebar:e.jsxs("div",{className:"py-1",children:[e.jsx("div",{className:"px-2 pb-1",children:e.jsx("input",{value:h,onChange:a=>C(a.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(a=>{const j=h.toLowerCase(),k=c.filter(n=>n.kind===a&&(!j||n.name.toLowerCase().includes(j)));return e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"px-3 py-1 text-xs uppercase tracking-wider text-fg-faint",children:a==="skills"?"Skills":"Slash Commands"}),k.length===0?e.jsx("div",{className:"px-3 py-1 text-xs text-fg-faint italic",children:"none"}):k.map(n=>{var P,V,ae;const g=n.kind==="skills";return e.jsxs("div",{className:`w-full px-3 py-1 text-xs flex items-center justify-between gap-2 ${m===n.path?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsxs("button",{onClick:()=>b(n.path),className:"flex-1 min-w-0 text-left",children:[e.jsxs("div",{className:`truncate ${n.disabled?"line-through opacity-50":""}`,title:n.disabled?"Disabled — Claude will not auto-invoke this skill":void 0,children:[n.kind==="commands"?"/":"",n.name]}),n.description&&e.jsx("div",{className:"truncate text-fg-faint",children:n.description})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(H,{interactive:!1,scope:n.scope,input:{type:n.kind==="commands"?"command":"skill",name:n.name}}),((P=w[n.path])==null?void 0:P.dirty)&&e.jsx("span",{className:"w-1 h-1 rounded-full bg-accent"}),g&&e.jsx("span",{title:(V=w[n.path])!=null&&V.dirty?"This skill has unsaved edits — save or revert before toggling":void 0,children:e.jsx(Se,{checked:!n.disabled,disabled:!!((ae=w[n.path])!=null&&ae.dirty),onChange:te=>void X(n,!te)})}),n.kind==="skills"&&S===n.path&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>void ee(n),title:`Remove ${n.name} — moves the folder to trash; reinstall from the Library`,className:"text-[10px] font-semibold text-red-400 hover:text-red-300",children:"confirm"}),e.jsx("button",{onClick:()=>$(null),title:"Cancel",className:"text-[10px] text-fg-faint hover:text-fg",children:"cancel"})]}),n.kind==="skills"&&S!==n.path&&e.jsx("button",{onClick:te=>{te.stopPropagation(),$(n.path)},title:"Remove skill — moves the folder to trash; reinstall from the Library","aria-label":`Remove ${n.name}`,className:"text-fg-faint hover:text-red-400 leading-none px-0.5",children:"✕"})]})]},n.path)})]},a)})]}),detail:m&&R?e.jsx("div",{className:"h-full",children:e.jsx(_e,{path:m,value:R.draftRaw,onChange:a=>{p(null),B(m,a)}})}):c.length===0&&d.length>0?e.jsx("div",{"data-testid":"skills-list-error",children:e.jsx(D,{title:"could not list skills or commands",hint:d.map(a=>`${a.path}: ${a.error}`).join(`
12
+ `)})}):e.jsx(D,{title:c.length===0?"no skills or commands":"select an item"})})})}const et=u.memo(qe);export{_e as M,et as S,Xe as a,Je as p};
@@ -1 +1 @@
1
- import{b9 as p,aJ as d,ak as g,at as o,b7 as b}from"./index-CuAfFXNd.js";function h(e,t){return t&&(e===t||e.startsWith(t+"/"))?"~"+e.slice(t.length):e}function w({path:e,keyPath:t,note:l}){const u=p(),[n,r]=d.useState(void 0);d.useEffect(()=>{let i=!0;const c=()=>{window.api.config.readText(e,{maxBytes:1}).then(s=>{i&&r(s.exists?s.mtimeMs:null)}).catch(()=>{i&&r(void 0)})};c();const x=window.api.config.onChanged(s=>{s.path===e&&c()});return()=>{i=!1,x()}},[e]);const f=h(e,u)+(t&&t.length?` › ${t.join(".")}`:""),a=n===void 0?"":n===null?"created on first save":g(n),m=()=>{b.getState().openFile(e),window.dispatchEvent(new CustomEvent("sm:open-editor"))};return o.jsxs("button",{type:"button","data-testid":"source-chip",title:l??`Open ${e} in the editor`,onClick:m,className:"inline-flex items-center gap-1.5 max-w-full text-[11px] px-2 py-0.5 rounded border border-line bg-bg-elev text-fg-dim hover:bg-bg-hi",children:[o.jsx("span",{className:"font-mono truncate","data-testid":"source-chip-path",children:f}),a&&o.jsxs("span",{className:"text-fg-dim/70 shrink-0","data-testid":"source-chip-age",children:["· ",a]})]})}export{w as S};
1
+ import{ba as p,aK as d,al as g,au as o,b8 as b}from"./index-C9w-dVzo.js";function h(e,t){return t&&(e===t||e.startsWith(t+"/"))?"~"+e.slice(t.length):e}function w({path:e,keyPath:t,note:l}){const u=p(),[n,r]=d.useState(void 0);d.useEffect(()=>{let i=!0;const c=()=>{window.api.config.readText(e,{maxBytes:1}).then(s=>{i&&r(s.exists?s.mtimeMs:null)}).catch(()=>{i&&r(void 0)})};c();const x=window.api.config.onChanged(s=>{s.path===e&&c()});return()=>{i=!1,x()}},[e]);const f=h(e,u)+(t&&t.length?` › ${t.join(".")}`:""),a=n===void 0?"":n===null?"created on first save":g(n),m=()=>{b.getState().openFile(e),window.dispatchEvent(new CustomEvent("sm:open-editor"))};return o.jsxs("button",{type:"button","data-testid":"source-chip",title:l??`Open ${e} in the editor`,onClick:m,className:"inline-flex items-center gap-1.5 max-w-full text-[11px] px-2 py-0.5 rounded border border-line bg-bg-elev text-fg-dim hover:bg-bg-hi",children:[o.jsx("span",{className:"font-mono truncate","data-testid":"source-chip-path",children:f}),a&&o.jsxs("span",{className:"text-fg-dim/70 shrink-0","data-testid":"source-chip-age",children:["· ",a]})]})}export{w as S};
@@ -0,0 +1 @@
1
+ import{aK as i,b4 as d,au as e,a7 as E,b0 as O,ba as _,C as B,l as C,ae as P}from"./index-C9w-dVzo.js";import{P as $}from"./Panel-CIvb-XXN.js";import{S as z,I as H}from"./Library-DFn0YPIW.js";import{D as K}from"./DocumentEditorPane-C46Hj0lz.js";import{S as W}from"./SourceChip-BrPci8FX.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-UUr5giu8.js";const q=300;function G({activePath:o,selectedPath:r,onSelect:s}){const[f,n]=i.useState([]),x=i.useRef(0),j=i.useRef(s);j.current=s;const h=d(a=>{var l;return o?(l=a.files[o])==null?void 0:l.diskRaw:void 0}),u=i.useRef(null);if(i.useEffect(()=>{j.current(null)},[o]),i.useEffect(()=>{if(x.current+=1,!o){u.current=null,n([]);return}const a=u.current!==o;u.current=o;let l=!1;const m=()=>{x.current+=1;const y=x.current;window.api.config.parseImports(o).then(p=>{l||x.current!==y||(p.ok?n(p.imports):(n([]),O.error(p.error||"failed to parse @-imports")))})},v=a?null:setTimeout(m,q);return a&&m(),()=>{l=!0,v&&clearTimeout(v)}},[o,h]),f.length===0||!o)return null;const b=r===o||r===null;return e.jsxs("div",{className:"w-64 shrink-0 border-r border-line bg-bg-elev overflow-auto","data-testid":"referenced-files-rail",children:[e.jsxs("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wide text-fg-faint border-b border-line",children:["Documents · ",f.length+1]}),e.jsxs("button",{type:"button",onClick:()=>s(null),"aria-current":b,"data-testid":"referenced-file-root",className:`w-full text-left px-3 py-2 border-b border-line ${b?"bg-bg-hi text-fg":"text-fg-dim hover:bg-bg"}`,children:[e.jsx("div",{className:"text-[11.5px] font-medium truncate",children:E(o)}),e.jsx("div",{className:"text-[10px] text-fg-faint truncate",title:o,children:"this system prompt"})]}),f.map(a=>{const l=!a.ok||!a.exists,m=r===a.path;return e.jsxs("button",{type:"button",onClick:()=>s(a),"aria-current":m,"data-testid":"referenced-file-row",className:`w-full text-left px-3 py-2 border-b border-line last:border-b-0 ${m?"bg-bg-hi text-fg":"text-fg-dim hover:bg-bg"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[11.5px] font-medium truncate flex-1",children:E(a.path)}),l&&e.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide text-amber-400/90 border border-amber-400/30","data-testid":"referenced-file-missing",children:"missing"})]}),e.jsx("div",{className:"text-[10px] text-fg-faint truncate",title:a.path,children:a.path}),e.jsxs("div",{className:"text-[10px] text-fg-faint",children:[a.sizeBytes.toLocaleString()," bytes · ~",a.tokenEstimate.toLocaleString()," tokens"]})]},a.path)})]})}const R={title:"User system prompt",body:"This is the real ~/.claude/CLAUDE.md on disk — the instructions the claude CLI loads into every session it starts on this machine, in every project. A project's own CLAUDE.md / CLAUDE.local.md are read from that project's directory when a session launches there; they are not edited here."};function J(){const o=_(),r=i.useMemo(()=>o?B.resolve("user",o,null):null,[o]),[s,f]=i.useState(null),n=(s==null?void 0:s.path)??r,[x,j]=i.useState({});i.useEffect(()=>{const t=s==null?void 0:s.path;if(!t||!s.ok||!s.exists)return;let k=!0;return Promise.resolve().then(()=>window.api.config.canWrite(t)).then(I=>{k&&j(M=>({...M,[t]:I===!1}))}).catch(()=>{}),()=>{k=!1}},[s]);const h=!!s&&x[s.path]===!0,u=!!s&&(!s.ok||!s.exists||h),b=d(t=>t.files),a=d(t=>t.loadText),l=d(t=>t.setDraft),m=d(t=>t.saveText),v=d(t=>t.revert),y=d(t=>t.watchFile),p=d(t=>t.unwatchFile);i.useEffect(()=>{if(r)return a(r,!0),y(r),()=>{p(r)}},[r]),i.useEffect(()=>{if(!(!n||n===r))return a(n,!0),y(n),()=>{p(n)}},[n,r]);const[D,g]=i.useState(null),T=i.useCallback(t=>{g(null),f(t)},[]);if(!o)return e.jsx(C,{title:"loading…"});const L=r?b[r]:null,c=n?b[n]:null,N=(c==null?void 0:c.draftRaw)??"",U=P(N),A=N.length,F=u&&!h,S=u,w=async()=>{if(!n)return;g(null);const t=await m(n);t.ok||g(t.error??"save failed")};return e.jsx($,{toolbar:e.jsxs(e.Fragment,{children:[r&&e.jsx(H,{path:r,disabled:!!s}),e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:"User scope"}),e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:n??"—"}),r&&e.jsx("span",{className:"ml-3",children:e.jsx(W,{path:r})}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-fg-faint",children:[A.toLocaleString()," chars · ~",U.toLocaleString()," tokens"]})]}),footer:n&&c&&!S?e.jsx(z,{dirty:c.dirty,busy:c.busy,parseError:D,lastSavedAt:c.lastSavedAt,leading:c.exists?s?e.jsx("span",{children:"editing an imported file"}):null:e.jsx("span",{children:"file will be created on save"}),onSave:w,onRevert:()=>{g(null),v(n)}}):null,children:r&&L?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{"data-testid":"system-prompt-scope-note",className:"shrink-0 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:R.title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:R.body}),e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:r})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex",children:[e.jsx(G,{activePath:r,selectedPath:n,onSelect:T}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[F&&e.jsx("div",{"data-testid":"system-prompt-missing-note",className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 text-[11px] text-amber-400/90",children:"This import does not resolve to a readable file — the CLI will skip it."}),h&&s&&e.jsxs("div",{"data-testid":"system-prompt-readonly-note",className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 text-[11px] text-amber-400/90",children:["Read-only: ",e.jsx("span",{className:"font-mono",children:s.path})," is outside the folders Session Manager may write to."]}),n&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(K,{path:n,value:N,readOnly:S,defaultMode:"split",onChange:t=>{g(null),l(n,t)},onSave:()=>{w()}},n)})]})]})]}):e.jsx(C,{title:"resolving…"})})}const se=i.memo(J);export{se as SystemPrompt};
@@ -1,4 +1,4 @@
1
- import{aO as aa,aJ as G,R as Pt,at as R,G as Nf,aq as If,a5 as Rf}from"./index-CuAfFXNd.js";import"./monaco-editor-BsIlgG7c.js";var zi={exports:{}},$i={};/**
1
+ import{aP as aa,aK as G,R as Pt,au as R,G as Nf,ar as If,a5 as Rf}from"./index-C9w-dVzo.js";import"./monaco-editor-BsIlgG7c.js";var zi={exports:{}},$i={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.js
4
4
  *
@@ -1 +1 @@
1
- import{at as r}from"./index-CuAfFXNd.js";function a({checked:t,onChange:e,label:n,disabled:s}){return r.jsxs("label",{className:`inline-flex items-center gap-2 text-xs ${s?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[r.jsx("button",{type:"button",role:"switch","aria-checked":t,disabled:s,onClick:()=>!s&&e(!t),className:`relative w-7 h-4 rounded-full transition-colors ${t?"bg-accent":"bg-bg-hi border border-line"}`,children:r.jsx("span",{className:`absolute top-0.5 w-3 h-3 rounded-full bg-fg transition-transform ${t?"translate-x-3.5":"translate-x-0.5"}`})}),n&&r.jsx("span",{className:"text-fg-dim",children:n})]})}export{a as T};
1
+ import{au as r}from"./index-C9w-dVzo.js";function a({checked:t,onChange:e,label:n,disabled:s}){return r.jsxs("label",{className:`inline-flex items-center gap-2 text-xs ${s?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[r.jsx("button",{type:"button",role:"switch","aria-checked":t,disabled:s,onClick:()=>!s&&e(!t),className:`relative w-7 h-4 rounded-full transition-colors ${t?"bg-accent":"bg-bg-hi border border-line"}`,children:r.jsx("span",{className:`absolute top-0.5 w-3 h-3 rounded-full bg-fg transition-transform ${t?"translate-x-3.5":"translate-x-0.5"}`})}),n&&r.jsx("span",{className:"text-fg-dim",children:n})]})}export{a as T};
@@ -0,0 +1 @@
1
+ import{au as r}from"./index-C9w-dVzo.js";function n({options:t,active:o,onChange:i}){return r.jsx("div",{className:"flex rounded border border-line overflow-hidden",children:t.map(({key:e,label:s})=>r.jsx("button",{onClick:()=>i(e),className:`px-2 py-0.5 text-xs ${o===e?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:s},e))})}export{n as V};
@@ -1 +1 @@
1
- import{bn as o,bl as m,a8 as j,at as e,aS as l,bk as b,aw as R}from"./index-CuAfFXNd.js";let u=0;const T=1e3;function w(n){const s=performance.now();s-u<T||(u=s,R.debug("voice","mic.gate.click_rejected",{reason:n}))}function y(){const n=o(t=>t.isRecording),s=o(t=>t.error),i=o(t=>t.loadingProgress),r=o(m(l)),x=()=>{const t=o.getState(),{canRecord:h,reason:a}=l(t);if(t.isRecording)return t.stopRecording();if(t.wizardArmed&&!t.wizardOpen){t.openWizard();return}if(a==="error"||a==="load-timeout"){t.resetAndRetryModel();return}if(!h)return w(a);const c=b.getState().activeTabId;c&&t.startRecording(c)},d=j(r.reason,{loadingPct:i,errorMessage:s,isRecording:n}),g=r.reason==="unsupported",p=!r.canRecord,f=r.reason==="loading"?"text-fg-faint animate-pulse cursor-wait":r.reason==="error"||r.reason==="load-timeout"?"text-red-400 cursor-pointer":r.reason==="permission-denied"?"text-amber-400 cursor-pointer":r.reason==="idle"?"text-fg-faint cursor-pointer":r.reason==="unsupported"?"text-fg-faint cursor-not-allowed":n?"text-red-400 ring-2 ring-red-400 animate-pulse":"text-fg-dim hover:text-fg";return e.jsx("button",{onClick:x,disabled:g,"aria-disabled":p,"aria-label":d,title:d,"data-testid":"mic-button","data-state":r.reason,className:`p-1.5 rounded transition-colors ${f}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"9",y:"1",width:"6",height:"12",rx:"3"}),e.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"})]})})}function v(){const n=o(i=>i.ttsEnabled),s=o(i=>i.toggleTTS);return e.jsxs("button",{onClick:s,title:n?"Read Claude replies aloud: ON":"Read Claude replies aloud: OFF",className:`px-1.5 py-1 rounded transition-colors flex items-center gap-1 ${n?"text-accent":"text-fg-dim hover:text-fg"}`,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),n?e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),e.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}):e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),e.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]})]}),e.jsx("span",{className:"text-[10px] font-medium tracking-wide",children:"TTS"})]})}export{v as T,y as V};
1
+ import{bo as o,bm as m,a9 as j,au as e,aT as l,bl as b,ax as T}from"./index-C9w-dVzo.js";let u=0;const R=1e3;function w(n){const s=performance.now();s-u<R||(u=s,T.debug("voice","mic.gate.click_rejected",{reason:n}))}function k(){const n=o(t=>t.isRecording),s=o(t=>t.error),i=o(t=>t.loadingProgress),r=o(m(l)),x=()=>{const t=o.getState(),{canRecord:h,reason:a}=l(t);if(t.isRecording)return t.stopRecording();if(t.wizardArmed&&!t.wizardOpen){t.openWizard();return}if(a==="error"||a==="load-timeout"){t.resetAndRetryModel();return}if(!h)return w(a);const c=b.getState().activeTabId;c&&t.startRecording(c)},d=j(r.reason,{loadingPct:i,errorMessage:s,isRecording:n}),g=r.reason==="unsupported",p=!r.canRecord,f=r.reason==="loading"?"text-fg-faint animate-pulse cursor-wait":r.reason==="error"||r.reason==="load-timeout"?"text-red-400 cursor-pointer":r.reason==="permission-denied"?"text-amber-400 cursor-pointer":r.reason==="idle"?"text-fg-faint cursor-pointer":r.reason==="unsupported"?"text-fg-faint cursor-not-allowed":n?"text-red-400 ring-2 ring-red-400 animate-pulse":"text-fg-dim hover:text-fg";return e.jsx("button",{onClick:x,disabled:g,"aria-disabled":p,"aria-label":d,title:d,"data-testid":"mic-button","data-state":r.reason,className:`p-1.5 rounded transition-colors ${f}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"9",y:"1",width:"6",height:"12",rx:"3"}),e.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"})]})})}function v(){const n=o(i=>i.ttsEnabled),s=o(i=>i.toggleTTS);return e.jsxs("button",{onClick:s,title:n?"Read Claude replies aloud: ON":"Read Claude replies aloud: OFF",className:`px-1.5 py-1 rounded transition-colors flex items-center gap-1 ${n?"text-accent":"text-fg-dim hover:text-fg"}`,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),n?e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),e.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}):e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),e.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]})]}),e.jsx("span",{className:"text-[10px] font-medium tracking-wide",children:"TTS"})]})}export{v as T,k as V};
@@ -1 +1 @@
1
- import{bq as s}from"./index-CuAfFXNd.js";function a(t){const e=Number.isFinite(t)?t:0,r=Math.abs(e)<1?4:2;return`$${e.toFixed(r)}`}function u(t){const e=Number.isFinite(t)?t:0,r=Math.abs(e);return r>=1e9?`${(e/1e9).toFixed(1)}B`:r>=1e6?`${(e/1e6).toFixed(1)}M`:r>=1e3?`${(e/1e3).toFixed(1)}K`:`${Math.round(e)}`}function f(t){const e=Number.isFinite(t)?t:0;return Math.round(e).toLocaleString("en-US")}function m(t){const e=Math.max(0,Math.round(Number.isFinite(t)?t:0));if(e<60)return`${e}m`;const r=Math.floor(e/60),n=e%60;return n===0?`${r}h`:`${r}h ${n}m`}function h(t){return Number.isFinite(t)?t>0&&t<1?"<1%":`${t.toFixed(1)}%`:"0.0%"}async function l(t,e=5e3){try{return{ok:!0,data:await s(Promise.resolve().then(()=>window.api.history.dashboard({rangeDays:t})),e,"history.dashboard")}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}}function c(t){return`${a(t.costUsd)} · ${u(t.tokens)} tok`}function b(t,e){const r=e!=null&&e.day?t.days.filter(o=>o.date===e.day).flatMap(o=>Object.values(o.byProject)):[t.totals];let n=0,i=0;for(const o of r)n+=o.estimatedCostUsd,i+=o.inputTokens+o.outputTokens+o.cacheReadTokens+o.cacheCreationTokens;return{costUsd:n,tokens:i,label:c({costUsd:n,tokens:i})}}export{c as a,l as f,f as i,m,h as p,b as s,u as t,a as u};
1
+ import{br as s}from"./index-C9w-dVzo.js";function a(t){const e=Number.isFinite(t)?t:0,r=Math.abs(e)<1?4:2;return`$${e.toFixed(r)}`}function u(t){const e=Number.isFinite(t)?t:0,r=Math.abs(e);return r>=1e9?`${(e/1e9).toFixed(1)}B`:r>=1e6?`${(e/1e6).toFixed(1)}M`:r>=1e3?`${(e/1e3).toFixed(1)}K`:`${Math.round(e)}`}function f(t){const e=Number.isFinite(t)?t:0;return Math.round(e).toLocaleString("en-US")}function m(t){const e=Math.max(0,Math.round(Number.isFinite(t)?t:0));if(e<60)return`${e}m`;const r=Math.floor(e/60),n=e%60;return n===0?`${r}h`:`${r}h ${n}m`}function h(t){return Number.isFinite(t)?t>0&&t<1?"<1%":`${t.toFixed(1)}%`:"0.0%"}async function l(t,e=5e3){try{return{ok:!0,data:await s(Promise.resolve().then(()=>window.api.history.dashboard({rangeDays:t})),e,"history.dashboard")}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}}function c(t){return`${a(t.costUsd)} · ${u(t.tokens)} tok`}function b(t,e){const r=e!=null&&e.day?t.days.filter(o=>o.date===e.day).flatMap(o=>Object.values(o.byProject)):[t.totals];let n=0,i=0;for(const o of r)n+=o.estimatedCostUsd,i+=o.inputTokens+o.outputTokens+o.cacheReadTokens+o.cacheCreationTokens;return{costUsd:n,tokens:i,label:c({costUsd:n,tokens:i})}}export{c as a,l as f,f as i,m,h as p,b as s,u as t,a as u};