claude-code-session-manager 0.132.0 → 0.133.1

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 (87) hide show
  1. package/README.md +3 -3
  2. package/dist/assets/{AgentLibrary-C09MlPFx.js → AgentLibrary-BTIBmZkM.js} +2 -2
  3. package/dist/assets/{AppSettings-DvDKsCnD.js → AppSettings-DwnfV9-4.js} +2 -2
  4. package/dist/assets/{Button-BzG_KdBC.js → Button-CObXxw7b.js} +1 -1
  5. package/dist/assets/DocumentEditorPane-CgB5IuOY.js +1 -0
  6. package/dist/assets/{Extensions-DgxKT_OZ.js → Extensions-Fuhshcl6.js} +2 -2
  7. package/dist/assets/{History-Nd3bKjBq.js → History-DbUV4jxK.js} +2 -2
  8. package/dist/assets/{Library-R71t6VAB.js → Library-COr79GyT.js} +1 -1
  9. package/dist/assets/{ListDetail-CG50Ul7c.js → ListDetail-DY53nXya.js} +1 -1
  10. package/dist/assets/{Panel-C7EFG4eU.js → Panel-D7NX5iP8.js} +1 -1
  11. package/dist/assets/{ProjectClaudeConfig-J92iNEGC.js → ProjectClaudeConfig-DuWzM8qA.js} +1 -1
  12. package/dist/assets/{ProvenanceBadge-C3KB3ILO.js → ProvenanceBadge-AnwE1p5X.js} +1 -1
  13. package/dist/assets/{Scheduler-DeYBA7uc.js → Scheduler-BHfx0rXd.js} +9 -9
  14. package/dist/assets/Settings-tt0VZCyz.js +2 -0
  15. package/dist/assets/{SkillReferenceGraph-D7bt3fyB.js → SkillReferenceGraph-D_rxqWgq.js} +1 -1
  16. package/dist/assets/{Skills-GpxtUrFP.js → Skills-BVQPJZaF.js} +1 -1
  17. package/dist/assets/{SourceChip-uyVMCZc7.js → SourceChip-DC5XD8KC.js} +1 -1
  18. package/dist/assets/{SystemPrompt-Cv25uFSM.js → SystemPrompt-XnvP0_cS.js} +1 -1
  19. package/dist/assets/{TiptapBody-uP8fJkbM.js → TiptapBody-B_TNEADm.js} +1 -1
  20. package/dist/assets/{Toggle-DRs80cX-.js → Toggle-CxQO8pGN.js} +1 -1
  21. package/dist/assets/{ViewTabs-BDkvvzJ8.js → ViewTabs-CEjnWPD9.js} +1 -1
  22. package/dist/assets/{VoiceButton-Cmtz2sQt.js → VoiceButton-B-6gdmKe.js} +1 -1
  23. package/dist/assets/{historyTotals-DHwAXunq.js → historyTotals-dT8vcKzX.js} +1 -1
  24. package/dist/assets/{index-oXqzajWV.css → index-5QIl5Kcd.css} +1 -1
  25. package/dist/assets/index-BLORXCcT.js +3111 -0
  26. package/dist/index.html +2 -2
  27. package/dist-web/app.css +1 -1
  28. package/dist-web/app.js +427 -413
  29. package/package.json +4 -2
  30. package/scripts/README.md +1 -0
  31. package/src/main/build-info.json +4 -4
  32. package/src/main/chatRunner.cjs +77 -14
  33. package/src/main/index.cjs +13 -0
  34. package/src/main/ipcSchemas.cjs +54 -0
  35. package/src/main/lib/CLAUDE.md +2 -0
  36. package/src/main/lib/agent-cli/adapters/antigravity.cjs +147 -0
  37. package/src/main/lib/agent-cli/adapters/codex.cjs +170 -0
  38. package/src/main/lib/agent-cli/adapters/cursor.cjs +138 -0
  39. package/src/main/lib/agent-cli/adapters/gemini.cjs +119 -0
  40. package/src/main/lib/agent-cli/adapters/opencode.cjs +117 -0
  41. package/src/main/lib/agent-cli/agentCliEvents.cjs +94 -0
  42. package/src/main/lib/agent-cli/agentCliIpc.cjs +109 -0
  43. package/src/main/lib/agent-cli/agentCliRegistry.cjs +213 -0
  44. package/src/main/lib/agent-cli/agentCliSessionStore.cjs +152 -0
  45. package/src/main/lib/agent-cli/agentCliTurn.cjs +99 -0
  46. package/src/main/lib/app-preview/appPreviewIpc.cjs +125 -0
  47. package/src/main/lib/app-preview/appPreviewManager.cjs +317 -0
  48. package/src/main/lib/app-preview/appPreviewScripts.cjs +106 -0
  49. package/src/main/lib/app-preview/appPreviewSweep.cjs +92 -0
  50. package/src/main/lib/chatBootRecovery.cjs +41 -1
  51. package/src/main/lib/claude/agentEffortResolve.cjs +11 -3
  52. package/src/main/lib/epic/activeIndexMerge.cjs +25 -2
  53. package/src/main/lib/epic/archivedTranscript.cjs +39 -6
  54. package/src/main/lib/epic/epicChanges.cjs +466 -0
  55. package/src/main/lib/epic/epicMint.cjs +45 -1
  56. package/src/main/lib/epic/epicReopen.cjs +8 -2
  57. package/src/main/lib/epic/epicSpawnPlan.cjs +12 -0
  58. package/src/main/lib/epic/epicWorktreeMerge.cjs +39 -4
  59. package/src/main/lib/epic/promptSessionsCreateEpic.cjs +9 -4
  60. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +2 -0
  61. package/src/main/lib/git/gitExec.cjs +9 -1
  62. package/src/main/lib/git/gitWorktree.cjs +94 -0
  63. package/src/main/lib/git/unifiedDiff.cjs +207 -0
  64. package/src/main/lib/mdDocCensus.cjs +364 -0
  65. package/src/main/lib/mdDocRefs.cjs +249 -0
  66. package/src/main/lib/mdNetworkScan.cjs +158 -15
  67. package/src/main/lib/persona-macro/macroJobDispatch.cjs +4 -1
  68. package/src/main/lib/persona-macro/macroJobIpc.cjs +1 -1
  69. package/src/main/lib/prd/prdCreate.cjs +7 -2
  70. package/src/main/lib/prd/prdFrontmatter.cjs +10 -3
  71. package/src/main/lib/promptSessionSchema.cjs +6 -0
  72. package/src/main/lib/remoteTranscriptTail.cjs +23 -4
  73. package/src/main/lib/scheduler/landedSinceRun.cjs +2 -1
  74. package/src/main/lib/scheduler/scheduleJobSchema.cjs +2 -0
  75. package/src/main/lib/scheduler/schedulerPaths.cjs +3 -0
  76. package/src/main/projectPages.cjs +14 -3
  77. package/src/main/scheduler/gitTreeGuard.cjs +2 -1
  78. package/src/main/scheduler/prdParser.cjs +2 -1
  79. package/src/main/scheduler.cjs +7 -2
  80. package/src/main/transcripts.cjs +18 -4
  81. package/src/main/webRemote.cjs +10 -5
  82. package/src/preload/api.d.ts +147 -2
  83. package/src/preload/apiSurface.json +56 -0
  84. package/src/preload/index.cjs +22 -0
  85. package/dist/assets/DocumentEditorPane-fm6zsnLM.js +0 -1
  86. package/dist/assets/Settings-B6r7N4v-.js +0 -2
  87. package/dist/assets/index-CBCdyHbZ.js +0 -3097
@@ -0,0 +1,2 @@
1
+ import{b9 as A,ax as e,b5 as D,aN as b,bf as U,b6 as ee,bh as te,bo as K,w as he,l as P,a4 as fe,v as ge,T as se,aX as be,S as _,a as ye,bq as q,bk as ve,aB as je,aF as we,J as ke,as as Ne}from"./index-BLORXCcT.js";import{P as R}from"./Panel-D7NX5iP8.js";import{P as Se,H as Ce,S as _e}from"./Library-COr79GyT.js";import{S as V}from"./SourceChip-DC5XD8KC.js";import{V as B}from"./ViewTabs-CEjnWPD9.js";import{r as ne}from"./claude-settings-schema-COigsajx.js";import{L as Ee}from"./ListDetail-DY53nXya.js";import{a as Pe}from"./ProvenanceBadge-AnwE1p5X.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-CObXxw7b.js";function Te(t){const n=t??{},s={...n.$defs??{},...n.definitions??{}},o=l=>{if(!l)return{};if(!l.$ref)return i(l);const m=/^#\/(\$defs|definitions)\/(.+)$/.exec(l.$ref);if(!m)return i(l);const h=s[m[2]];return h?o({...h,...u(l)}):i(l)},r=new Set(["__proto__","constructor","prototype"]),a=l=>{if(!l)return{};const m={};for(const[h,f]of Object.entries(l))r.has(h)||(m[h]=f);return m},i=l=>{if(!l.allOf||l.allOf.length===0)return l;const m={...l};delete m.allOf;for(const h of l.allOf){const f=o(h);Object.assign(m,{properties:{...a(m.properties),...a(f.properties)},required:Fe([...m.required??[],...f.required??[]])}),!m.description&&f.description&&(m.description=f.description),m.default===void 0&&f.default!==void 0&&(m.default=f.default),!m.type&&f.type&&(m.type=f.type)}return m},u=l=>{const{$ref:m,...h}=l;return h},d=(l,m)=>{let h=o(l);for(const f of m){if(!h)return null;if(/^\d+$/.test(f)){const E=Array.isArray(h.items)?h.items[Number(f)]:h.items;h=E?o(E):null;continue}const w=h.properties;if(w&&!r.has(f)&&f in w){h=o(w[f]);continue}const k=h.additionalProperties;if(k&&typeof k=="object"){h=o(k);continue}return null}return h},c=(l,m,h)=>{if(!l)return null;const f={};if(l.description&&(f.description=l.description),l.type&&(f.type=l.type),l.default!==void 0&&(f.default=l.default),l.enum&&(f.enum=l.enum),l.const!==void 0&&(f.const=l.const),l.deprecated&&(f.deprecated=!0),l.examples&&(f.examples=l.examples),l.properties&&(f.knownChildren=Object.keys(l.properties)),h&&(m!=null&&m.includes(h))&&(f.required=!0),l.items&&!Array.isArray(l.items)){const w=o(l.items),k=c(w,void 0,null);k&&(f.itemsInfo=k)}return(l.additionalProperties===!0||typeof l.additionalProperties=="object")&&(f.open=!0),f},x=l=>m=>{if(m.length===0)return c(o(l),void 0,null);const h=d(l,m.slice(0,-1));if(!h)return null;const f=m[m.length-1],w=d(h,[f]);return c(w,h.required,f)},y=l=>{const m=o(l);return Object.keys(m.properties??{})},g=l=>({at:x(l),rootKeys:()=>y(l),rootedAt:m=>{const h=d(l,m);return g(h??{})}});return g(n)}function Fe(t){return Array.from(new Set(t))}let H=null;function re(){return H||(H=Te(ne)),H}const Oe=["allow","deny","ask"],z="This settings file has invalid JSON. Fix it in the Settings raw editor first; Permissions will not overwrite it.";function Ae(t){if(t.trim()==="")return{perms:{},full:{},err:null};try{const n=JSON.parse(t);if(n===null||typeof n!="object"||Array.isArray(n))return{perms:{},full:{},err:"settings file is not a JSON object"};const s=n;return{perms:s.permissions??{},full:s,err:null}}catch(n){return{perms:{},full:{},err:n.message}}}function Me({scope:t="user"}={}){const n=U(),s=ee(),o=(s==null?void 0:s.cwd)??null,r=te(l=>l.navFace),[a,i]=b.useState("rules");b.useEffect(()=>{r==="project"&&a==="presets"&&i("rules")},[r,a]);const d=K(he,n,o)[t]??null,c=A(l=>l.files),x=e.jsx(B,{options:[{key:"rules",label:"Rules"},...r==="home"?[{key:"presets",label:"Presets"}]:[]],active:a,onChange:i});if(!n)return e.jsx(P,{title:"loading…"});if(a==="presets")return e.jsx(R,{toolbar:x,children:e.jsx(Se,{})});const y=l=>l!=="user"&&!o,g=d?c[d]:null;return e.jsx(R,{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:y(t)?e.jsx(P,{title:"no active project",hint:"open a tab in a project directory to edit project or local permissions"}):d&&g?e.jsx(ae,{scope:t,cwd:o,activePath:d}):e.jsx(P,{title:"resolving…"})})}b.memo(Me);function ae({scope:t,cwd:n,activePath:s}){const o=A(c=>c.files[s]),{perms:r,err:a}=o?Ae(o.draftRaw):{perms:{},err:null},i=(c,x)=>{if(a){D.error(z);return}window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:n,keyPath:["permissions",c],value:x}).catch(y=>D.error(y instanceof Error?y.message:String(y)))},u=(c,x)=>{const y=x.trim();if(!y)return;const g=r[c]??[];g.includes(y)||i(c,[...g,y])},d=(c,x)=>{const y=r[c]??[];i(c,y.filter((g,l)=>l!==x))};return e.jsxs("div",{className:"p-4 space-y-5 max-w-3xl",children:[a&&e.jsxs("div",{role:"alert",className:"text-xs text-red-400 border border-red-400/40 rounded px-3 py-2",children:[z," (",a,")"]}),e.jsx(Re,{value:r.defaultMode??"default",onChange:c=>i("defaultMode",c)}),Oe.map(c=>e.jsx($e,{list:c,rules:r[c]??[],disabled:!!a,onAdd:x=>u(c,x),onRemove:x=>d(c,x)},c)),e.jsx(Ie,{dirs:r.additionalDirectories??[],disabled:!!a,onChange:c=>i("additionalDirectories",c)})]})}function Re({value:t,onChange:n}){var a;const o=(((a=re().at(["permissions","defaultMode"]))==null?void 0:a.enum)??[]).filter(i=>typeof i=="string"),r=t&&!o.includes(t)?[...o,t]:o;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:r.map(i=>e.jsx("button",{onClick:()=>n(i),className:`px-2.5 py-1 text-xs transition-colors ${t===i?"bg-bg-hi text-fg":"bg-bg-elev text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:i},i))})]})}function $e({list:t,rules:n,onAdd:s,onRemove:o,disabled:r}){const[a,i]=b.useState(""),u=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 ${u}`,children:t}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("input",{value:a,disabled:r,onChange:d=>i(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(s(a),i(""))},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:()=>{s(a),i("")},disabled:r||!a.trim(),className:"px-2.5 py-1 border border-line rounded text-xs text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40",children:"add"})]}),n.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no rules"}):e.jsx("ul",{className:"space-y-0.5",children:n.map((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:()=>o(c),className:"text-fg-faint hover:text-red-400",title:"remove",children:"×"})]},`${c}-${d}`))})]})}function Ie({dirs:t,onChange:n,disabled:s}){const[o,r]=b.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:o,disabled:s,onChange:a=>r(a.target.value),onKeyDown:a=>{a.key==="Enter"&&o.trim()&&(n([...t,o.trim()]),r(""))},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((a,i)=>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:a}),e.jsx("button",{onClick:()=>n(t.filter((u,d)=>d!==i)),className:"text-fg-faint hover:text-red-400",children:"×"})]},`${i}-${a}`))})]})}const De={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 }"}},oe=["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"],Le=new Set(oe),He=["command","http","prompt","agent","mcp_tool"],Ue={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:{}},Y="This settings file has invalid JSON. Fix it in the Settings raw editor first; Hooks will not overwrite it.";function Ke(t){if(t.trim()==="")return{full:{},hooks:{},err:null};try{const n=JSON.parse(t);if(n===null||typeof n!="object"||Array.isArray(n))return{full:{},hooks:{},err:"settings file is not a JSON object"};const s=n;return{full:s,hooks:s.hooks??{},err:null}}catch(n){return{full:{},hooks:{},err:n.message}}}function Be(t,n){return(t[n]??[]).reduce((s,o)=>{var r;return s+(((r=o.hooks)==null?void 0:r.length)??0)},0)}function Ge({scope:t="user"}={}){const n=U(),s=ee(),o=(s==null?void 0:s.cwd)??null,r=te(x=>x.navFace),[a,i]=b.useState("events");b.useEffect(()=>{r==="project"&&a==="library"&&i("events")},[r,a]);const d=K(se,n,o)[t]??null,c=e.jsx(B,{options:[{key:"events",label:"Events"},...r==="home"?[{key:"library",label:"Library"}]:[]],active:a,onChange:i});return n?a==="library"?e.jsx(R,{toolbar:c,children:e.jsx(Ce,{})}):t!=="user"&&!o?e.jsx(R,{toolbar:e.jsx(e.Fragment,{children:c}),children:e.jsx(P,{title:"no active project"})}):d?e.jsx(R,{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(ie,{scope:t,cwd:o,path:d})}):e.jsx(P,{title:"loading…"}):e.jsx(P,{title:"loading…"})}function ie({scope:t,cwd:n,path:s,renderLayout:o}){const[r,a]=b.useState("PreToolUse"),[i,u]=b.useState(null),d=(v,j)=>{window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:n,keyPath:v,value:j}).catch(p=>D.error(p instanceof Error?p.message:String(p)))},c=A(v=>v.files[s]),{hooks:x,err:y}=c?Ke(c.draftRaw):{hooks:{},err:null},g=Object.keys(x).filter(v=>!Le.has(v)),l=g.reduce((v,j)=>v+(x[j]??[]).reduce((p,T)=>{var M;return p+(((M=T.hooks)==null?void 0:M.length)??0)},0),0),m=(v,j)=>{if(y){D.error(Y);return}d(["hooks",v],j)},h=x[r]??[],f=()=>{m(r,[...h,{matcher:"",hooks:[{type:"command",command:""}]}])},w=(v,j)=>{const p=h.slice();p[v]=j,m(r,p)},k=v=>{m(r,h.filter((j,p)=>p!==v))},E=e.jsxs(e.Fragment,{children:[y?e.jsxs("div",{role:"alert",className:"px-3 py-2 border-b border-line text-xs text-red-400",children:[Y," (",y,")"]}):null,l>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:"⚠"})," ",l," hook(s) configured under unknown event names: ",e.jsx("span",{className:"font-mono text-fg",children:g.join(", ")}),e.jsx("span",{className:"text-fg-faint",children:" · these are ignored by Claude Code 2026; edit settings.json directly to remove."})]}):null]}),N=y||l>0?E:null,S=e.jsx("div",{className:"py-1",children:oe.map(v=>{const j=Be(x,v),p=De[v],T=p?e.jsxs("span",{className:"block space-y-1",children:[e.jsx("span",{className:"block text-fg",children:p.when}),e.jsxs("span",{className:"block text-fg-faint font-mono",children:["payload: ",p.payload]}),p.example?e.jsxs("span",{className:"block text-fg-faint italic",children:["e.g. ",p.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(fe,{content:T,align:"bottom-center",children:e.jsxs("button",{onClick:()=>a(v),title:p==null?void 0:p.when,className:`w-full text-left px-3 py-1 text-xs ${r===v?"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:v}),j>0&&e.jsx("span",{className:"text-accent shrink-0 ml-2",children:j})]}),p?e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 font-normal truncate",children:p.when}):e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 italic font-normal truncate",children:"no documentation yet"})]})})},v)})}),C=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:f,disabled:!!y,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"})]}),h.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no hooks for this event"}):h.map((v,j)=>e.jsx(Je,{group:v,jsonInvalid:!!y,onChange:p=>w(j,p),onRemove:()=>k(j),onTestFire:p=>u({event:r,matcher:v.matcher??"",command:p.command??""})},j))]});return e.jsxs(e.Fragment,{children:[o?o({banners:N,list:S,detail:C}):e.jsxs("div",{className:"flex flex-col h-full",children:[N,e.jsx(Ee,{sidebarWidth:"14rem",sidebar:S,detail:C})]}),i?e.jsx(Ye,{event:i.event,matcher:i.matcher,command:i.command,onClose:()=>u(null)}):null]})}b.memo(Ge);function I({value:t,onCommit:n,onDraft:s,...o}){const[r,a]=b.useState(t);b.useEffect(()=>a(t),[t]);const i=()=>{r!==t&&n(r)};return e.jsx("input",{...o,value:r,onChange:u=>{a(u.target.value),s==null||s(u.target.value)},onBlur:i,onKeyDown:u=>{u.key==="Enter"&&i()}})}function Je({group:t,jsonInvalid:n,onChange:s,onRemove:o,onTestFire:r}){const a=()=>s({...t,hooks:[...t.hooks??[],{type:"command",command:""}]}),i=(d,c)=>{const x=t.hooks.slice();x[d]=c,s({...t,hooks:x})},u=d=>s({...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(I,{value:t.matcher??"",disabled:n,onCommit:d=>s({...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:o,disabled:n,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(qe,{rule:d,jsonInvalid:n,onChange:x=>i(c,x),onRemove:()=>u(c),onTestFire:()=>r(d)},c)),e.jsx("button",{onClick:a,disabled:n,className:"text-xs text-fg-faint hover:text-fg disabled:opacity-40",children:"+ add hook"})]})}function We(t){var s,o,r;const n=((o=(s=ne.$defs)==null?void 0:s.hookCommand)==null?void 0:o.anyOf)??[];for(const a of n){const i=a.properties;if(((r=i==null?void 0:i.type)==null?void 0:r.const)!==t)continue;const u=i.timeout;if(typeof(u==null?void 0:u.default)=="number")return u.default;const d=/default:\s*(\d+)/.exec((u==null?void 0:u.description)??"");return d?Number(d[1]):null}return null}function Z(t){return/^\d+$/.test(t.trim())&&Number(t)>0?Number(t):null}function qe({rule:t,jsonInvalid:n,onChange:s,onRemove:o,onTestFire:r}){const a=l=>({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"})[l],i=t.type==="command"?"command":t.type==="http"?"url":t.type==="prompt"?"prompt":t.type==="mcp_tool"?"mcpTool":"agent",u=t[i]??"",d=(t.args??[]).join(" "),[c,x]=b.useState(null),y=We(t.type),g={type:"hook",name:u||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:n,onChange:l=>s({type:l.target.value}),className:"bg-bg border border-line rounded px-1 py-0.5 text-xs text-fg",children:He.map(l=>e.jsx("option",{value:l,children:l},l))}),e.jsx(Pe,{interactive:!1,input:g}),e.jsx(I,{value:u,disabled:n,onCommit:l=>s({...t,[i]:l}),placeholder:a(t.type),className:`flex-1 bg-bg border rounded px-2 py-0.5 text-xs text-fg font-mono ${n?"border-red-500/70":u.trim()?"border-line":"border-yellow-600/50"}`}),n?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(I,{value:t.timeout!=null?String(t.timeout):"",disabled:n,"aria-label":"timeout (seconds)","aria-invalid":c?!0:void 0,title:c??"Timeout in seconds",onDraft:l=>{x(!l.trim()||Z(l)!=null?null:"Timeout must be a positive whole number of seconds")},onCommit:l=>{if(!l.trim()){s({...t,timeout:void 0});return}const m=Z(l);m!=null&&s({...t,timeout:m})},placeholder:y!=null?`${y} (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:r,disabled:n||!u.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:o,disabled:n,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(I,{value:d,disabled:n,onCommit:l=>s({...t,args:l.trim()?l.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(I,{value:t.terminalSequence??"",disabled:n,onCommit:l=>s({...t,terminalSequence:l||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 Ve(t){return JSON.stringify(Ue[t]??{},null,2)}function ze(t,n){if(!t.trim())return{matched:!0,target:null,note:"empty matcher → matches all"};const s=n&&typeof n=="object"&&"tool_name"in n?String(n.tool_name??""):null;if(s==null)return{matched:!1,target:null,note:"payload has no tool_name to match against"};try{return{matched:new RegExp(`^(?:${t})$`).test(s),target:s}}catch{return{matched:t===s,target:s,note:"matcher not valid regex; fell back to exact match"}}}function Ye({event:t,matcher:n,command:s,onClose:o}){const[r,a]=b.useState(()=>Ve(t)),[i,u]=b.useState(!1),[d,c]=b.useState(null),[x,y]=b.useState(null);let g=null;try{JSON.parse(r)}catch(m){g=m.message}const l=async()=>{u(!0),c(null);let m=null;try{m=JSON.parse(r)}catch{}y(ze(n,m));try{const h=await window.api.app.testFireHook({command:s,payload:r,timeoutMs:5e3});c(h)}finally{u(!1)}};return e.jsx(ge,{open:!0,onClose:o,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:s})]}),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:n||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)"}),g?e.jsxs("span",{className:"text-red-400",children:["× ",g]}):null]}),e.jsx("textarea",{value:r,onChange:m=>a(m.target.value),rows:8,className:`w-full bg-bg border rounded px-2 py-1 font-mono text-fg ${g?"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:o,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:l,disabled:i||!!g||!s.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:i?"running…":"run"})]})]})})}const le=[{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"]}],X=new Set(le.flatMap(t=>t.keys)),Ze=[{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"]}],Xe={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function ce(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((o,r)=>{const a=Xe[o];return a||(r===0?o.charAt(0).toUpperCase()+o.slice(1):o)}).join(" ")}function de(t){const n=new Set,s=[];for(const r of Ze){const a=r.keys.filter(i=>t.has(i)&&!X.has(i));a.forEach(i=>n.add(i)),a.length!==0&&s.push({id:r.id,title:r.title,summary:r.summary,advanced:!!r.advanced,keys:a})}const o=Array.from(t).filter(r=>!n.has(r)&&r!=="$schema"&&!X.has(r)).sort();return o.length>0&&s.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:o}),s}function Qe(t,n){return de(t).map(s=>({id:s.id,title:s.title,advanced:s.advanced,total:s.keys.length,setCount:s.keys.filter(o=>n.has(o)).length}))}const et={};function ue(t,n){if(n)return{text:n,authored:!1};const s=et[t];return s?{text:s,authored:!0}:null}const me=b.createContext(null);function tt(){const t=b.useContext(me);if(!t)throw new Error("usePageShell() must be used inside a <PageShell>.");return t}function O({header:t,subnav:n,footer:s,children:o,subnavWidth:r=220}){const a=b.useRef(null),i=b.useCallback((d,c)=>{const x=a.current;if(!x)return;let y=null;for(const g of Array.from(x.querySelectorAll("[id]")))if(g.id===d){y=g;break}y&&be(x,y,{block:"start",behavior:c==null?void 0:c.behavior})},[]),u=b.useMemo(()=>({scrollToAnchor:i,contentRef:a}),[i]);return e.jsx(me.Provider,{value:u,children:e.jsxs("div",{"data-testid":"page-shell",className:"h-full w-full min-h-0 min-w-0 flex flex-col overflow-clip",children:[t!=null&&e.jsx("div",{"data-testid":"page-shell-header",className:"shrink-0 min-w-0 overflow-clip",children:t}),e.jsxs("div",{"data-testid":"page-shell-body",className:"flex-1 min-h-0 min-w-0 flex flex-row overflow-clip",children:[n!=null&&e.jsx("nav",{"data-testid":"page-shell-subnav",className:"shrink-0 min-h-0 overflow-y-auto overscroll-contain",style:{width:r},children:n}),e.jsx("div",{ref:a,"data-testid":"page-shell-content",className:"flex-1 min-w-0 min-h-0 overflow-y-auto overscroll-contain",children:o})]}),s!=null&&e.jsx("div",{"data-testid":"page-shell-footer",className:"shrink-0 min-w-0 overflow-clip",children:s})]})})}const st={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"},nt=["user","project","local","default"],rt={user:"user",project:"project",local:"local",default:"default"};function at({node:t,schema:n}){const[s,o]=b.useState(""),[r,a]=b.useState(!1),[i,u]=b.useState(!0),d=t.kind==="object"?t:null,c=d?Object.keys(d.children):[],x=n.rootKeys(),y=new Set([...c,...x]),g=Array.from(y).sort().join(","),l=c.join(","),m=b.useMemo(()=>de(y),[g]),h=b.useMemo(()=>Qe(y,new Set(c)),[g,l]),f=b.useMemo(()=>m.filter(w=>r||!w.advanced).map(w=>({...w,keys:w.keys.filter(k=>{const E=(d==null?void 0:d.children[k])!==void 0;if(!i&&!E)return!1;if(!s.trim())return!0;const N=n.at([k]);return[k,ce(k),(N==null?void 0:N.description)??""].join(" ").toLowerCase().includes(s.toLowerCase())})})).filter(w=>w.keys.length>0),[m,s,r,i,d,n]);return{filter:s,setFilter:o,showAdvanced:r,setShowAdvanced:a,showUnset:i,setShowUnset:u,rootNode:d,schema:n,groups:m,railGroups:h,visibleGroups:f}}function ot({cards:t,targetScope:n}){return e.jsxs("div",{className:"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:_[n].label})]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.showUnset,onChange:s=>t.setShowUnset(s.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:t.showAdvanced,onChange:s=>t.setShowAdvanced(s.target.checked),className:"accent-accent"}),"show advanced"]}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:t.filter,onChange:s=>t.setFilter(s.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]})}function it({cards:t,targetScope:n,onOverride:s}){const{visibleGroups:o,rootNode:r,schema:a,filter:i}=t;return e.jsxs("div",{className:"py-3",children:[o.map(u=>e.jsx(dt,{id:u.id,title:u.title,summary:u.summary,advanced:u.advanced,children:u.keys.map(d=>{const c=r==null?void 0:r.children[d],x=a.at([d]);return e.jsx(ut,{keyName:d,node:c,info:x,targetScope:n,onOverride:(y,g)=>s([d],y,g)},d)})},u.id)),o.length===0&&e.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',i,'"']})]})}function lt({cards:t}){const n=tt(),[s,o]=b.useState(null),{groups:r,showAdvanced:a,setShowAdvanced:i}=t,u=d=>{const c=r.find(x=>x.id===d);c!=null&&c.advanced&&!a&&i(!0),o(d)};return b.useEffect(()=>{s&&(o(null),n.scrollToAnchor(`settings-group-${s}`,{behavior:"smooth"}))},[s,n]),e.jsx(ct,{groups:t.railGroups,onJump:u})}function ct({groups:t,onJump:n}){return e.jsx("div",{className:"min-h-full border-r border-line bg-bg-elev/30 py-3",children:t.map(s=>e.jsxs("button",{type:"button","data-group-id":s.id,onClick:()=>n(s.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bg-hi transition-colors",title:`jump to ${s.title}`,children:[e.jsx(ye,{name:st[s.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:s.title}),e.jsxs("span",{className:"text-[10px] text-fg-faint font-mono shrink-0",children:[s.setCount,"/",s.total]})]},s.id))})}function dt({id:t,title:n,summary:s,advanced:o,children:r}){const[a,i]=b.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:()=>i(!a),children:[e.jsx("span",{className:"text-fg-faint w-3",children:a?"▾":"▸"}),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:n}),o&&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:s})]})]}),a&&e.jsx("div",{className:"divide-y divide-line/60",children:r})]})}function ut({keyName:t,node:n,info:s,targetScope:o,onOverride:r}){const[a,i]=b.useState(!1),[u,d]=b.useState(!1),c=ce(t),x=n!==void 0,g=(n==null?void 0:n.kind)==="leaf"?n:null,l=(n==null?void 0:n.kind)==="object"||(n==null?void 0:n.kind)==="array",m=s==null?void 0:s.default,h=g&&m!==void 0&&xe(g.value,m),f=yt({isSet:x,leafNode:g,defaultVal:m,isDefault:!!h,node:n}),w=mt(g,m),k=w.length>=2,E=!!g&&!h,N=ue(t,s==null?void 0:s.description);return e.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{onClick:()=>i(!a),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:a?"collapse":"expand",children:a?"▾":"▸"}),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(vt,{kind:f.kind,label:f.label}),k&&e.jsxs("button",{onClick:S=>{S.stopPropagation(),a||i(!0),d(C=>!C)},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 · ",w.map(S=>rt[S]).join(" · ")]}),E&&g&&e.jsx("button",{onClick:S=>{S.stopPropagation(),r(void 0,g.winner)},className:"text-[9px] px-1.5 py-0 rounded border border-line bg-bg-elev text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`reset · delete from ${_[g.winner].label}`,children:"↺ reset"}),(s==null?void 0:s.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"}),(s==null?void 0:s.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"})]}),N&&e.jsx("p",{className:`text-fg-dim text-xs mt-0.5 leading-relaxed ${N.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:N.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:jt(N.text)}),a&&u&&g&&e.jsx(pt,{leaf:g,defaultVal:m,onReset:S=>r(void 0,S)}),a&&e.jsx(xt,{keyName:t,node:n,info:s,targetScope:o,onOverride:S=>r(S)})]}),e.jsx("div",{className:"shrink-0",children:!a&&e.jsx(bt,{node:n,info:s,onSet:S=>{r(S)},disabled:l&&x})})]})})}function mt(t,n){if(!t)return[];const s=new Set;s.add(t.winner);for(const o of t.shadowed)s.add(o.scope);return n!==void 0&&s.add("default"),nt.filter(o=>s.has(o))}function pt({leaf:t,defaultVal:n,onReset:s}){const o={};o[t.winner]={value:t.value,winner:!0};for(const r of t.shadowed)o[r.scope]={value:r.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(r=>{const a=o[r],i=a!==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:_[r].label}),e.jsx("span",{className:`font-mono truncate ${a!=null&&a.winner?"text-accent":"text-fg-dim"}`,children:i?$(a.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),i?e.jsx("button",{onClick:()=>s(r),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 ${_[r].label}`,children:"↺"}):e.jsx("span",{})]},r)}),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:n!==void 0?$(n):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function xt({keyName:t,node:n,info:s,targetScope:o,onOverride:r}){const i=(n==null?void 0:n.kind)==="leaf"?n:null,u=ue(t,s==null?void 0:s.description);return e.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[u&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${u.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:u.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:u.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(s==null?void 0:s.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(s.type)?s.type.join(" | "):s.type})]}),(s==null?void 0:s.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:$(s.default)})]}),(s==null?void 0:s.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:s.enum.map(d=>String(d)).join(" | ")})]}),i&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Current"}),e.jsxs("dd",{className:"font-mono",children:[e.jsx("span",{className:"text-fg-dim",children:$(i.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",_[i.winner].label]})]})]}),i&&i.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:i.shadowed.map((d,c)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[$(d.value)," —"," ",e.jsx("span",{className:"no-underline",children:_[d.scope].label})]},c))})]}),(n==null?void 0:n.kind)==="array"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Accumulated"}),e.jsxs("dd",{className:"text-fg-dim",children:[n.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(ht,{keyName:t,node:n,info:s,onChange:r,targetScope:o})})]})}function ht({node:t,info:n,onChange:s,targetScope:o}){const a=(t==null?void 0:t.kind)==="leaf"?t.value:n==null?void 0:n.default,i=pe(n==null?void 0:n.type);if(i==="boolean"){const u=a===!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:()=>s(d),className:`px-3 py-0.5 text-xs transition-colors ${u===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:["→ ",_[o].label]})]})}return n!=null&&n.enum?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-fg-faint",children:"Choose:"}),n.enum.map(u=>{const d=xe(a,u);return e.jsx("button",{onClick:()=>s(u),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(u)},String(u))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",_[o].label]})]}):i==="integer"||i==="number"?e.jsx(ft,{value:typeof a=="number"?a:void 0,integer:i==="integer",onCommit:s,target:_[o].label}):i==="string"?e.jsx(gt,{value:typeof a=="string"?a:"",onCommit:s,target:_[o].label}):e.jsxs("div",{className:"text-fg-faint",children:["Complex value (",i??"object/array",") — use the"," ",e.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function ft({value:t,integer:n,onCommit:s,target:o}){const[r,a]=b.useState(t!==void 0?String(t):""),i=()=>{const u=n?parseInt(r,10):parseFloat(r);Number.isNaN(u)||s(u)};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:r,onChange:u=>a(u.target.value),onBlur:i,onKeyDown:u=>{u.key==="Enter"&&u.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:i,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",o]})]})}function gt({value:t,onCommit:n,target:s}){const[o,r]=b.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:o,onChange:a=>r(a.target.value),onKeyDown:a=>{a.key==="Enter"&&n(o)},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:()=>n(o),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 → ",s]})]})}function bt({node:t,info:n,onSet:s,disabled:o}){const r=(t==null?void 0:t.kind)==="leaf",a=pe(n==null?void 0:n.type);if(o)return null;if(a==="boolean"){const i=r&&t.value===!0;return e.jsx("button",{onClick:()=>s(!i),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${i?"bg-accent/15 text-accent border-accent/40 hover:bg-accent hover:text-bg":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,title:"toggle",children:i?"on":"off"})}return null}function yt({isSet:t,leafNode:n,defaultVal:s,isDefault:o,node:r}){return t?(r==null?void 0:r.kind)==="array"?{kind:"accumulated",label:`${r.items.length} items`}:(r==null?void 0:r.kind)==="object"?{kind:"set",label:"configured"}:n?o?{kind:"default",label:`= default · ${_[n.winner].label}`}:n.shadowed.length>0?{kind:"override",label:`overriding ${n.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${_[n.winner].label}`}:{kind:"set",label:"configured"}:s!==void 0?{kind:"default",label:`using default: ${$(s)}`}:{kind:"unset",label:"not configured"}}function vt({kind:t,label:n}){const s={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 ${s}`,children:n})}function pe(t){if(t)return Array.isArray(t)?t.find(s=>s!=="null")??t[0]:t}function xe(t,n){return t===n?!0:typeof t!=typeof n?!1:t&&n&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(n):!1}function jt(t){const n=t.trim().split(`
2
+ `)[0],s=n.match(/^([^.!?]+[.!?])/);return s?s[1]:n.length>120?n.slice(0,120)+"…":n}function $(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 n=JSON.stringify(t);return n.length>60?n.slice(0,60)+"…":n}return String(t)}const Q={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 wt({effective:t,onOpenTab:n}){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:le.map(s=>{const o=s.keys.filter(a=>Ne(t,[a])!==null),r=o.length?`${o.length} of ${s.keys.length} keys set (${o.join(", ")})`:"nothing set";return e.jsxs("li",{"data-testid":`owned-summary-${s.id}`,className:"flex items-center gap-2 text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg w-28 shrink-0",children:s.label}),e.jsx("span",{className:"truncate",children:r}),s.tab?e.jsxs("button",{type:"button",onClick:()=>n(s.tab),className:"ml-auto text-accent hover:underline shrink-0",children:["edit in ",s.label," tab →"]}):e.jsxs("span",{className:"ml-auto text-fg-faint shrink-0",children:["managed on the ",s.label," page"]})]},s.id)})})}function kt({scope:t="user"}={}){const n=U(),s=q(p=>p.tabs),o=q(p=>p.activeTabId),r=s.find(p=>p.id===o)??null,a=(r==null?void 0:r.cwd)??null,[i,u]=b.useState("general");ve("settings",p=>{(p==="general"||p==="permissions"||p==="hooks"||p==="raw")&&u(p)});const d=K(se,n,a),c=d[t]??null,x=A(p=>p.files),y=A(p=>p.setDraft),g=A(p=>p.saveJson),l=A(p=>p.revert),[m,h]=b.useState(null),f=b.useMemo(()=>je(we(x,d)),[x,d]),w=re(),k=at({node:f,schema:w}),E=(p,T,M)=>{var W;const G=M??t,L=d[G];if(!L)return;const J=((W=x[L])==null?void 0:W.draftRaw)??"";if(J.trim())try{JSON.parse(J)}catch(F){h(`${L} is not valid JSON (${F instanceof Error?F.message:String(F)}) — fix it in Raw before editing from General.`);return}h(null),window.api.claudeConfig.patch({fileId:"settings",scope:G,cwd:a,keyPath:p,value:T}).catch(F=>D.error(F instanceof Error?F.message:String(F)))};if(!n)return e.jsx(P,{title:"loading…"});const N=c?x[c]:null,S=p=>p!=="user"&&!a,C=e.jsxs("div",{"data-testid":"settings-scope-note",className:"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:Q[t].title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:Q[t].body}),c&&e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:c})]}),v=p=>e.jsx("div",{className:"px-3 py-2",children:e.jsx(V,{path:c??"",keyPath:p})}),j=m&&i!=="raw"?e.jsx("div",{role:"alert",className:"px-3 py-2 border-b border-line text-xs text-red-400",children:m}):null;return e.jsx(R,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(B,{options:[{key:"general",label:"General"},{key:"permissions",label:"Permissions"},{key:"hooks",label:"Hooks"},{key:"raw",label:"Raw"}],active:i,onChange:u}),e.jsx(e.Fragment,{children:e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:i==="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 ↗"})]}),children:i==="general"&&!S(t)?e.jsxs(O,{subnavWidth:192,header:e.jsxs(e.Fragment,{children:[C,j,e.jsx(ot,{cards:k,targetScope:t})]}),subnav:e.jsx(lt,{cards:k}),children:[e.jsx("div",{className:"px-3 pt-2",children:e.jsx(V,{path:c??""})}),e.jsx(wt,{effective:f,onOpenTab:u}),e.jsx(it,{cards:k,targetScope:t,onOverride:E})]}):S(t)?e.jsx(O,{header:e.jsxs(e.Fragment,{children:[C,j]}),children:e.jsx(P,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"})}):c?i==="permissions"?e.jsx(O,{header:e.jsxs(e.Fragment,{children:[C,j,v(["permissions"])]}),children:e.jsx(ae,{scope:t,cwd:a,activePath:c})}):i==="hooks"?e.jsx(ie,{scope:t,cwd:a,path:c,renderLayout:({banners:p,list:T,detail:M})=>e.jsx(O,{subnavWidth:224,header:e.jsxs(e.Fragment,{children:[C,j,v(["hooks"]),p]}),subnav:e.jsx("div",{className:"min-h-full border-r border-line",children:T}),children:M})}):N?e.jsx(O,{header:e.jsxs(e.Fragment,{children:[C,v()]}),footer:e.jsx("div",{className:"border-t border-line bg-bg-elev",children:e.jsx(_e,{dirty:N.dirty,busy:N.busy,parseError:m||N.parseError,lastSavedAt:N.lastSavedAt,leading:N.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{h(null);const p=await g(c);p.ok||h(p.error??"save failed")},onRevert:()=>{h(null),l(c)}})}),children:e.jsx("div",{"data-testid":"settings-raw-editor",className:"h-full overflow-clip",children:e.jsx(ke,{path:c,value:N.draftRaw,onChange:p=>{h(null),y(c,p)}})})}):e.jsx(O,{header:e.jsxs(e.Fragment,{children:[C,j]}),children:e.jsx(P,{title:"resolving…"})}):e.jsx(O,{header:e.jsxs(e.Fragment,{children:[C,j]}),children:e.jsx(P,{title:"resolving…"})})})}const Mt=b.memo(kt);export{Q as SETTINGS_SCOPE_NOTES,Mt as Settings};
@@ -1,4 +1,4 @@
1
- import{aN as Z,R as wo,at as ko,ax as tr}from"./index-CBCdyHbZ.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{aN as Z,R as wo,at as ko,ax as tr}from"./index-BLORXCcT.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.
@@ -1,4 +1,4 @@
1
- import{aN as f,ax as s,a6 as Bt,ac as Kt,b4 as q,ai as Wt,b as Ht,ab as Ut,ay as jt,be as yt,b5 as wt,b8 as T,l as ne,br as Jt,F as Yt,P as Vt,ae as zt,aR as qt,aU as Gt,b9 as Nt}from"./index-CBCdyHbZ.js";import{P as Te}from"./Panel-C7EFG4eU.js";import{L as St}from"./ListDetail-CG50Ul7c.js";import{f as rt,S as $t,m as Qt}from"./Library-R71t6VAB.js";import{a as Qe,u as lt,p as Zt,c as Xt,P as es}from"./ProvenanceBadge-C3KB3ILO.js";import{T as ts}from"./Toggle-DRs80cX-.js";function Ct({filter:e,onFilterChange:t,placeholder:n,summary:a,children:l,primary:r}){const[i,o]=f.useState(!1),h=f.useRef(null),m=f.useRef(null),g=f.useId();return f.useEffect(()=>{if(!i)return;const u=v=>{var b,w;const p=v.target;(b=h.current)!=null&&b.contains(p)||(w=m.current)!=null&&w.contains(p)||o(!1)},x=v=>{v.key==="Escape"&&o(!1)};return window.addEventListener("mousedown",u),window.addEventListener("keydown",x),()=>{window.removeEventListener("mousedown",u),window.removeEventListener("keydown",x)}},[i]),s.jsxs("div",{"data-testid":"extensions-toolbar",className:"relative shrink-0 h-11 flex items-center gap-3 px-3 bg-bg-elev border-b border-line text-xs",children:[s.jsxs("div",{className:"relative shrink-0",children:[s.jsxs("svg",{"aria-hidden":"true",className:"pointer-events-none absolute left-[9px] top-1/2 -translate-y-1/2 text-fg-faint/80",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("path",{d:"m21 21-4.3-4.3"})]}),s.jsx("input",{type:"text","data-testid":"extensions-toolbar-filter",value:e,onChange:u=>t(u.target.value),placeholder:n,"aria-label":n,spellCheck:!1,className:"w-[276px] h-7 pl-[29px] pr-[9px] bg-bg-hi border border-line rounded-md text-xs text-fg placeholder:text-fg-faint/80 focus:outline-none focus:border-fg-faint"})]}),s.jsx("span",{"data-testid":"extensions-toolbar-summary",className:"min-w-0 truncate text-fg-faint",children:a}),l,s.jsxs("button",{ref:h,type:"button","data-testid":r.testId,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?g:void 0,onClick:()=>o(u=>!u),className:"ml-auto shrink-0 h-7 inline-flex items-center gap-1.5 pl-3 pr-2.5 rounded-md bg-accent text-bg-hi text-[12.5px] font-semibold shadow-sm hover:bg-accent/90",children:[r.label,s.jsx("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m6 9 6 6 6-6"})})]}),i&&s.jsx("div",{ref:m,id:g,role:"menu","aria-label":r.label,"data-testid":`${r.testId}-menu`,className:`absolute ${Bt.dialog} right-3 top-[42px] min-w-[210px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[12.5px] text-fg`,children:r.items.map(u=>s.jsx("button",{type:"button",role:"menuitem","data-testid":u.testId,onClick:()=>{o(!1),u.onSelect()},className:"px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev",children:u.label},u.testId))})]})}const ss=2;function be(e){return`${e.source}:${e.pluginKey??e.cwd??""}:${e.name}`}const He=new Map,ns=e=>e instanceof Error?e.message:String(e);async function as(e){try{return await window.api.mcp.checkServer(e)}catch(t){const n=ns(t);return q.error(`MCP check of ${e.name} failed: ${n}`),{ok:!1,status:"failed",error:n,checkedAt:Date.now()}}}const ve=Kt((e,t)=>({results:{},checking:{},check:n=>{const a=be(n),l=He.get(a);if(l)return l;e(i=>({checking:{...i.checking,[a]:!0}}));const r=as(n).then(i=>(He.delete(a),e(o=>{const h={...o.checking};return delete h[a],{results:{...o.results,[a]:i},checking:h}}),i));return He.set(a,r),r},checkAll:async n=>{const a=[...new Map(n.map(i=>[be(i),i])).values()];let l=0;const r=async()=>{for(;l<a.length;)await t().check(a[l++])};await Promise.all(Array.from({length:Math.min(ss,a.length)},r))}})),rs=e=>e.results,ls=e=>e.checking,qe={unchecked:"Not checked",connected:"Connected",failed:"Failed","needs-auth":"Needs auth"},Et={unchecked:"border-[1.5px] border-fg-faint/60",connected:"bg-sage",failed:"bg-red-500","needs-auth":"bg-honey"},is={unchecked:"bg-bg-elev text-fg-dim",connected:"bg-sage/15 text-sage-dark",failed:"bg-red-500/10 text-red-700","needs-auth":"bg-honey/15 text-honey-dark"},os={user:"User scope",project:"Project scope",local:"Local scope"},cs=3e4,ds="••••••••",us=/^[A-Za-z0-9_@%+=:,./-]+$/;function ms(e){return us.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function Ze(e){return(e.type??"stdio")!=="stdio"}function ps(e){return Ze(e)?e.url??"":e.command?[e.command,...e.args??[]].map(ms).join(" "):""}const it=e=>e.replace(/[^A-Za-z0-9_-]/g,"_");function fs(e,t){return`mcp__${it(e)}__${it(t)}`}const Ue="h-7 inline-flex items-center whitespace-nowrap px-[11px] bg-bg-hi border border-line rounded-md text-[12.5px] text-fg hover:border-rule disabled:opacity-50 disabled:hover:border-line",Xe="text-[11px] font-semibold tracking-[.06em] uppercase text-fg-faint",Je="px-3 py-2.5 border border-dashed border-rule rounded-md text-[12.5px] text-fg-faint";function ot({name:e,server:t,scope:n,fileLabel:a,plugin:l,checkRequest:r,provenance:i,onChange:o,editing:h=!1,onEditingChange:m,editor:g}){const u=l!==void 0,x=!u&&h,v=r?be(r):null,p=ve(P=>v===null?void 0:P.results[v]),b=ve(P=>v===null?!1:P.checking[v]===!0),w=ve(P=>P.check);xs(cs,p!==void 0);const C=(p==null?void 0:p.status)??"unchecked",A=Date.now(),J=Ze(t);return s.jsxs("div",{"data-testid":"mcp-detail",className:"flex flex-col gap-[18px] px-6 py-[18px]",children:[s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs("div",{className:"min-w-0 flex flex-col gap-2",children:[s.jsxs("div",{className:"min-w-0 flex items-center gap-3",children:[s.jsx("h2",{"data-testid":"mcp-detail-name",className:"min-w-0 truncate text-[22px] leading-tight font-semibold tracking-[-.01em] text-fg",children:e}),s.jsxs("span",{"data-testid":"mcp-detail-status","data-status":C,title:p&&!p.ok?p.error:void 0,className:`shrink-0 inline-flex items-center gap-1.5 h-[22px] px-[9px] rounded-full text-xs font-semibold ${is[C]}`,children:[s.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 shrink-0 box-border rounded-full ${Et[C]}${b?" animate-pulse":""}`}),qe[C]]}),b?s.jsx("span",{"data-testid":"mcp-detail-checked",className:"shrink-0 text-xs text-fg-faint",children:"checking…"}):p?s.jsxs("span",{"data-testid":"mcp-detail-checked",title:new Date(p.checkedAt).toLocaleString(),className:"shrink-0 text-xs text-fg-faint",children:["checked ",Wt(Math.min(p.checkedAt,A),A)]}):null]}),s.jsxs("div",{"data-testid":"mcp-detail-meta",className:"flex flex-wrap items-center gap-2 text-xs text-fg-faint",children:[s.jsx(Qe,{scope:n,input:i,interactive:!1}),s.jsx("span",{"data-testid":"mcp-detail-transport",className:"inline-flex",children:s.jsx(Ht,{tone:"dim",children:u?"plugin":t.type??"stdio"})}),u?s.jsxs(s.Fragment,{children:[s.jsxs("span",{"data-testid":"mcp-detail-plugin",children:["via the ",l," plugin"]}),s.jsx("span",{"aria-hidden":"true",className:"text-fg-faint/60",children:"·"}),s.jsx("span",{"data-testid":"mcp-detail-readonly",children:"read-only"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{"data-testid":"mcp-detail-scope",children:os[n]}),s.jsx("span",{"aria-hidden":"true",className:"text-fg-faint/60",children:"·"}),s.jsxs("span",{"data-testid":"mcp-detail-keypath",className:"min-w-0 font-mono text-[11.5px] text-fg-dim break-words",children:[a," › mcpServers › ",e]})]})]})]}),s.jsxs("div",{className:"ml-auto shrink-0 flex items-center gap-2",children:[s.jsx("button",{type:"button","data-testid":"mcp-check-again",onClick:()=>{r&&w(r)},disabled:r===null||b,className:Ue,children:b?"Checking…":"Check again"}),u?null:x?s.jsx("button",{type:"button","data-testid":"mcp-edit-done",onClick:()=>m==null?void 0:m(!1),className:Ue,children:"Done"}):s.jsx("button",{type:"button","data-testid":"mcp-edit-json",onClick:()=>m==null?void 0:m(!0),className:Ue,children:"Edit JSON"})]})]}),x?g:s.jsxs(s.Fragment,{children:[s.jsx(hs,{server:t,readOnly:u}),u?null:J?s.jsx(ct,{testId:"mcp-headers",label:"Headers",noun:"header",separator:":",emptyText:"No headers set",values:t.headers??{},onAdd:(P,B)=>o==null?void 0:o({...t,headers:{...t.headers??{},[P]:B}})}):s.jsx(ct,{testId:"mcp-env",label:"Environment",noun:"variable",separator:"=",emptyText:"No variables set",values:t.env??{},onAdd:(P,B)=>o==null?void 0:o({...t,env:{...t.env??{},[P]:B}})}),s.jsx(gs,{serverName:e,result:p})]})]})}function xs(e,t){const[,n]=f.useState(0);f.useEffect(()=>{if(!t)return;const a=window.setInterval(()=>n(l=>l+1),e);return()=>window.clearInterval(a)},[e,t])}function hs({server:e,readOnly:t}){const n=Ze(e),a=ps(e),l=async()=>{await Ut(a)?q.success(n?"URL copied":"Command copied"):q.error(n?"Copy failed — the URL was not copied":"Copy failed — the command was not copied")};return s.jsxs("section",{className:"flex flex-col gap-[7px]",children:[s.jsx("h3",{className:Xe,children:"Command"}),s.jsxs("div",{"data-testid":"mcp-command-box",className:"flex items-center gap-2.5 px-3 py-2.5 bg-bg-hi border border-line rounded-md font-mono text-[13px] text-fg",children:[n?null:s.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-fg-faint/60",children:"$"}),a?s.jsx("span",{"data-testid":"mcp-command",className:"min-w-0 break-words",children:a}):s.jsx("span",{"data-testid":"mcp-command-empty",className:"min-w-0 font-sans text-[12.5px] text-fg-faint",children:t?n?"No URL set.":"No command set.":n?"No URL set — Edit JSON to add one.":"No command set — Edit JSON to add one."}),s.jsx("button",{type:"button","data-testid":"mcp-command-copy",onClick:()=>void l(),disabled:!a,className:"ml-auto shrink-0 font-sans text-xs text-fg-faint hover:text-fg disabled:opacity-50 disabled:hover:text-fg-faint",children:"Copy"})]})]})}function ct({testId:e,label:t,noun:n,separator:a,emptyText:l,values:r,onAdd:i}){const[o,h]=f.useState(()=>new Set),[m,g]=f.useState(!1),[u,x]=f.useState(""),v=f.useRef(null),p=Object.keys(r),b=u.trim(),w=b!==""&&!/\s/.test(b)&&!b.includes(a),C=N=>h(L=>{const G=new Set(L);return G.has(N)?G.delete(N):G.add(N),G}),A=()=>{g(!1),x("")},J=()=>{var N;w&&(i(b,((N=v.current)==null?void 0:N.value)??""),A())},P=N=>{N.key==="Enter"?(N.preventDefault(),J()):N.key==="Escape"&&(N.preventDefault(),A())},B=s.jsxs("button",{type:"button","data-testid":`${e}-add`,onClick:()=>g(!0),className:"shrink-0 text-[12.5px] font-semibold text-accent hover:text-accent-dark",children:["+ Add ",n]});return s.jsxs("section",{"data-testid":e,className:"flex flex-col gap-[7px]",children:[s.jsx("h3",{className:Xe,children:t}),p.length===0&&!m?s.jsxs("div",{"data-testid":`${e}-empty`,className:"flex items-center gap-2.5 px-3 py-2.5 border border-dashed border-rule rounded-md text-[12.5px] text-fg-faint",children:[l,s.jsx("span",{className:"ml-auto",children:B})]}):null,p.length>0?s.jsx("div",{className:"bg-bg-hi border border-line rounded-md divide-y divide-line",children:p.map(N=>{const L=o.has(N);return s.jsxs("div",{"data-testid":`${e}-row-${N}`,className:"flex items-center gap-2.5 px-3 py-2 font-mono text-[12.5px]",children:[s.jsx("span",{className:"shrink-0 font-semibold text-fg",children:N}),s.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-fg-faint/60",children:a}),s.jsx("span",{"data-testid":`${e}-value-${N}`,title:L?void 0:"Hidden — Show reveals it",className:`min-w-0 break-words ${L?"text-fg-dim":"text-fg-faint tracking-wider"}`,children:L?r[N]:ds}),s.jsx("button",{type:"button","data-testid":`${e}-reveal-${N}`,"aria-pressed":L,"aria-label":`${L?"Hide":"Show"} the value of ${N}`,onClick:()=>C(N),className:"ml-auto shrink-0 font-sans text-xs text-fg-faint hover:text-fg",children:L?"Hide":"Show"})]},N)})}):null,m?s.jsxs("div",{"data-testid":`${e}-add-form`,className:"flex items-center gap-2 px-3 py-2 bg-bg-hi border border-line rounded-md",children:[s.jsx("input",{"data-testid":`${e}-new-key`,"aria-label":`New ${n} name`,value:u,onChange:N=>x(N.target.value),onKeyDown:P,placeholder:n==="variable"?"KEY":"Header-Name",spellCheck:!1,autoFocus:!0,className:"w-44 h-7 px-2 bg-bg border border-line rounded font-mono text-xs text-fg"}),s.jsx("span",{"aria-hidden":"true",className:"font-mono text-xs text-fg-faint",children:a}),s.jsx("input",{ref:v,type:"password",autoComplete:"off","data-testid":`${e}-new-value`,"aria-label":`New ${n} value`,onKeyDown:P,placeholder:"value",spellCheck:!1,className:"flex-1 min-w-0 h-7 px-2 bg-bg border border-line rounded font-mono text-xs text-fg"}),s.jsx("button",{type:"button","data-testid":`${e}-add-confirm`,onClick:J,disabled:!w,className:"shrink-0 h-7 px-2.5 rounded-md bg-accent text-bg-hi text-xs font-semibold hover:bg-accent/90 disabled:opacity-50 disabled:hover:bg-accent",children:"Add"}),s.jsx("button",{type:"button","data-testid":`${e}-add-cancel`,onClick:A,className:"shrink-0 h-7 px-2 text-xs text-fg-faint hover:text-fg",children:"Cancel"})]}):p.length>0?s.jsx("div",{children:B}):null]})}function gs({serverName:e,result:t}){return s.jsxs("section",{"data-testid":"mcp-tools",className:"flex flex-col gap-[7px]",children:[s.jsxs("h3",{className:`flex items-baseline gap-2 ${Xe}`,children:["Tools",t!=null&&t.ok?s.jsxs(s.Fragment,{children:[s.jsx("span",{"data-testid":"mcp-tools-count",className:"font-mono font-medium tracking-normal text-fg-faint/60",children:t.tools.length}),s.jsx("span",{className:"font-normal tracking-normal normal-case text-fg-faint/80",children:"from the last check"})]}):null]}),t?t.ok?t.tools.length===0?s.jsx("div",{"data-testid":"mcp-tools-empty",className:Je,children:"The last check listed no tools."}):s.jsx("div",{className:"bg-bg-hi border border-line rounded-md divide-y divide-line",children:t.tools.map((n,a)=>s.jsxs("div",{"data-testid":`mcp-tool-row-${n.name}`,className:"grid grid-cols-[120px_minmax(0,1fr)_auto] items-baseline gap-4 px-3 py-2.5",children:[s.jsx("span",{title:n.name,className:"truncate font-mono text-[12.5px] font-semibold text-fg",children:n.name}),s.jsx("span",{title:n.description||void 0,className:"line-clamp-2 text-[12.5px] text-fg-dim",children:n.description??""}),s.jsx("span",{className:"font-mono text-[11px] text-fg-faint/80",children:fs(e,n.name)})]},`${a}:${n.name}`))}):s.jsxs("div",{"data-testid":"mcp-tools-empty",className:Je,children:[t.status==="needs-auth"?"The last check needs auth":"The last check failed",": ",t.error]}):s.jsx("div",{"data-testid":"mcp-tools-empty",className:Je,children:"Check this server to list its tools."})]})}const et=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,Ye="disable-model-invocation",At=/^\s*disable-model-invocation\s*:/;function bs(e){const t=e.match(et);if(!t)return!1;for(const n of t[1].split(/\r?\n/)){if(!At.test(n))continue;const a=n.slice(n.indexOf(":")+1).trim().toLowerCase();return a==="true"||a==="yes"}return!1}function vs(e){const t=e.trim();return t.length>=2&&(t[0]==='"'&&t[t.length-1]==='"'||t[0]==="'"&&t[t.length-1]==="'")?t.slice(1,-1):t}function de(e){return e.length-e.trimStart().length}function Oe(e){const t=e.match(et);if(!t)return{name:null,description:null,body:e};const n=t[1].split(/\r?\n/),a=t[2]??"";let l=null,r=null;for(let i=0;i<n.length;i++){const o=n[i],h=o.match(/^(\s*)(name|description)\s*:(.*)$/);if(!h)continue;const[,,m,g]=h,u=g.trim(),x=de(o);let v;if(u===""||u===">-"||u===">"||u==="|-"||u==="|"){const p=[];let b=i+1;for(;b<n.length&&n[b].trim()!==""&&de(n[b])>x;)p.push(n[b].trim()),b++;v=p.join(" ")}else v=vs(u);m==="name"?l=v:r=v}return{name:l,description:r,body:a}}function ks(e,t){const n=e.match(et);if(!n){if(!t)return e;const i=e.startsWith(`
1
+ import{aN as f,ax as s,a6 as Bt,ac as Kt,b5 as q,ai as Wt,b as Ht,ab as Ut,ay as jt,bf as yt,b6 as wt,b9 as T,l as ne,bs as Jt,F as Yt,P as Vt,ae as zt,aR as qt,aU as Gt,ba as Nt}from"./index-BLORXCcT.js";import{P as Te}from"./Panel-D7NX5iP8.js";import{L as St}from"./ListDetail-DY53nXya.js";import{f as rt,S as $t,m as Qt}from"./Library-COr79GyT.js";import{a as Qe,u as lt,p as Zt,c as Xt,P as es}from"./ProvenanceBadge-AnwE1p5X.js";import{T as ts}from"./Toggle-CxQO8pGN.js";function Ct({filter:e,onFilterChange:t,placeholder:n,summary:a,children:l,primary:r}){const[i,o]=f.useState(!1),h=f.useRef(null),m=f.useRef(null),g=f.useId();return f.useEffect(()=>{if(!i)return;const u=v=>{var b,w;const p=v.target;(b=h.current)!=null&&b.contains(p)||(w=m.current)!=null&&w.contains(p)||o(!1)},x=v=>{v.key==="Escape"&&o(!1)};return window.addEventListener("mousedown",u),window.addEventListener("keydown",x),()=>{window.removeEventListener("mousedown",u),window.removeEventListener("keydown",x)}},[i]),s.jsxs("div",{"data-testid":"extensions-toolbar",className:"relative shrink-0 h-11 flex items-center gap-3 px-3 bg-bg-elev border-b border-line text-xs",children:[s.jsxs("div",{className:"relative shrink-0",children:[s.jsxs("svg",{"aria-hidden":"true",className:"pointer-events-none absolute left-[9px] top-1/2 -translate-y-1/2 text-fg-faint/80",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("path",{d:"m21 21-4.3-4.3"})]}),s.jsx("input",{type:"text","data-testid":"extensions-toolbar-filter",value:e,onChange:u=>t(u.target.value),placeholder:n,"aria-label":n,spellCheck:!1,className:"w-[276px] h-7 pl-[29px] pr-[9px] bg-bg-hi border border-line rounded-md text-xs text-fg placeholder:text-fg-faint/80 focus:outline-none focus:border-fg-faint"})]}),s.jsx("span",{"data-testid":"extensions-toolbar-summary",className:"min-w-0 truncate text-fg-faint",children:a}),l,s.jsxs("button",{ref:h,type:"button","data-testid":r.testId,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?g:void 0,onClick:()=>o(u=>!u),className:"ml-auto shrink-0 h-7 inline-flex items-center gap-1.5 pl-3 pr-2.5 rounded-md bg-accent text-bg-hi text-[12.5px] font-semibold shadow-sm hover:bg-accent/90",children:[r.label,s.jsx("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m6 9 6 6 6-6"})})]}),i&&s.jsx("div",{ref:m,id:g,role:"menu","aria-label":r.label,"data-testid":`${r.testId}-menu`,className:`absolute ${Bt.dialog} right-3 top-[42px] min-w-[210px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[12.5px] text-fg`,children:r.items.map(u=>s.jsx("button",{type:"button",role:"menuitem","data-testid":u.testId,onClick:()=>{o(!1),u.onSelect()},className:"px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev",children:u.label},u.testId))})]})}const ss=2;function be(e){return`${e.source}:${e.pluginKey??e.cwd??""}:${e.name}`}const He=new Map,ns=e=>e instanceof Error?e.message:String(e);async function as(e){try{return await window.api.mcp.checkServer(e)}catch(t){const n=ns(t);return q.error(`MCP check of ${e.name} failed: ${n}`),{ok:!1,status:"failed",error:n,checkedAt:Date.now()}}}const ve=Kt((e,t)=>({results:{},checking:{},check:n=>{const a=be(n),l=He.get(a);if(l)return l;e(i=>({checking:{...i.checking,[a]:!0}}));const r=as(n).then(i=>(He.delete(a),e(o=>{const h={...o.checking};return delete h[a],{results:{...o.results,[a]:i},checking:h}}),i));return He.set(a,r),r},checkAll:async n=>{const a=[...new Map(n.map(i=>[be(i),i])).values()];let l=0;const r=async()=>{for(;l<a.length;)await t().check(a[l++])};await Promise.all(Array.from({length:Math.min(ss,a.length)},r))}})),rs=e=>e.results,ls=e=>e.checking,qe={unchecked:"Not checked",connected:"Connected",failed:"Failed","needs-auth":"Needs auth"},Et={unchecked:"border-[1.5px] border-fg-faint/60",connected:"bg-sage",failed:"bg-red-500","needs-auth":"bg-honey"},is={unchecked:"bg-bg-elev text-fg-dim",connected:"bg-sage/15 text-sage-dark",failed:"bg-red-500/10 text-red-700","needs-auth":"bg-honey/15 text-honey-dark"},os={user:"User scope",project:"Project scope",local:"Local scope"},cs=3e4,ds="••••••••",us=/^[A-Za-z0-9_@%+=:,./-]+$/;function ms(e){return us.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function Ze(e){return(e.type??"stdio")!=="stdio"}function ps(e){return Ze(e)?e.url??"":e.command?[e.command,...e.args??[]].map(ms).join(" "):""}const it=e=>e.replace(/[^A-Za-z0-9_-]/g,"_");function fs(e,t){return`mcp__${it(e)}__${it(t)}`}const Ue="h-7 inline-flex items-center whitespace-nowrap px-[11px] bg-bg-hi border border-line rounded-md text-[12.5px] text-fg hover:border-rule disabled:opacity-50 disabled:hover:border-line",Xe="text-[11px] font-semibold tracking-[.06em] uppercase text-fg-faint",Je="px-3 py-2.5 border border-dashed border-rule rounded-md text-[12.5px] text-fg-faint";function ot({name:e,server:t,scope:n,fileLabel:a,plugin:l,checkRequest:r,provenance:i,onChange:o,editing:h=!1,onEditingChange:m,editor:g}){const u=l!==void 0,x=!u&&h,v=r?be(r):null,p=ve(P=>v===null?void 0:P.results[v]),b=ve(P=>v===null?!1:P.checking[v]===!0),w=ve(P=>P.check);xs(cs,p!==void 0);const C=(p==null?void 0:p.status)??"unchecked",A=Date.now(),J=Ze(t);return s.jsxs("div",{"data-testid":"mcp-detail",className:"flex flex-col gap-[18px] px-6 py-[18px]",children:[s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs("div",{className:"min-w-0 flex flex-col gap-2",children:[s.jsxs("div",{className:"min-w-0 flex items-center gap-3",children:[s.jsx("h2",{"data-testid":"mcp-detail-name",className:"min-w-0 truncate text-[22px] leading-tight font-semibold tracking-[-.01em] text-fg",children:e}),s.jsxs("span",{"data-testid":"mcp-detail-status","data-status":C,title:p&&!p.ok?p.error:void 0,className:`shrink-0 inline-flex items-center gap-1.5 h-[22px] px-[9px] rounded-full text-xs font-semibold ${is[C]}`,children:[s.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 shrink-0 box-border rounded-full ${Et[C]}${b?" animate-pulse":""}`}),qe[C]]}),b?s.jsx("span",{"data-testid":"mcp-detail-checked",className:"shrink-0 text-xs text-fg-faint",children:"checking…"}):p?s.jsxs("span",{"data-testid":"mcp-detail-checked",title:new Date(p.checkedAt).toLocaleString(),className:"shrink-0 text-xs text-fg-faint",children:["checked ",Wt(Math.min(p.checkedAt,A),A)]}):null]}),s.jsxs("div",{"data-testid":"mcp-detail-meta",className:"flex flex-wrap items-center gap-2 text-xs text-fg-faint",children:[s.jsx(Qe,{scope:n,input:i,interactive:!1}),s.jsx("span",{"data-testid":"mcp-detail-transport",className:"inline-flex",children:s.jsx(Ht,{tone:"dim",children:u?"plugin":t.type??"stdio"})}),u?s.jsxs(s.Fragment,{children:[s.jsxs("span",{"data-testid":"mcp-detail-plugin",children:["via the ",l," plugin"]}),s.jsx("span",{"aria-hidden":"true",className:"text-fg-faint/60",children:"·"}),s.jsx("span",{"data-testid":"mcp-detail-readonly",children:"read-only"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{"data-testid":"mcp-detail-scope",children:os[n]}),s.jsx("span",{"aria-hidden":"true",className:"text-fg-faint/60",children:"·"}),s.jsxs("span",{"data-testid":"mcp-detail-keypath",className:"min-w-0 font-mono text-[11.5px] text-fg-dim break-words",children:[a," › mcpServers › ",e]})]})]})]}),s.jsxs("div",{className:"ml-auto shrink-0 flex items-center gap-2",children:[s.jsx("button",{type:"button","data-testid":"mcp-check-again",onClick:()=>{r&&w(r)},disabled:r===null||b,className:Ue,children:b?"Checking…":"Check again"}),u?null:x?s.jsx("button",{type:"button","data-testid":"mcp-edit-done",onClick:()=>m==null?void 0:m(!1),className:Ue,children:"Done"}):s.jsx("button",{type:"button","data-testid":"mcp-edit-json",onClick:()=>m==null?void 0:m(!0),className:Ue,children:"Edit JSON"})]})]}),x?g:s.jsxs(s.Fragment,{children:[s.jsx(hs,{server:t,readOnly:u}),u?null:J?s.jsx(ct,{testId:"mcp-headers",label:"Headers",noun:"header",separator:":",emptyText:"No headers set",values:t.headers??{},onAdd:(P,B)=>o==null?void 0:o({...t,headers:{...t.headers??{},[P]:B}})}):s.jsx(ct,{testId:"mcp-env",label:"Environment",noun:"variable",separator:"=",emptyText:"No variables set",values:t.env??{},onAdd:(P,B)=>o==null?void 0:o({...t,env:{...t.env??{},[P]:B}})}),s.jsx(gs,{serverName:e,result:p})]})]})}function xs(e,t){const[,n]=f.useState(0);f.useEffect(()=>{if(!t)return;const a=window.setInterval(()=>n(l=>l+1),e);return()=>window.clearInterval(a)},[e,t])}function hs({server:e,readOnly:t}){const n=Ze(e),a=ps(e),l=async()=>{await Ut(a)?q.success(n?"URL copied":"Command copied"):q.error(n?"Copy failed — the URL was not copied":"Copy failed — the command was not copied")};return s.jsxs("section",{className:"flex flex-col gap-[7px]",children:[s.jsx("h3",{className:Xe,children:"Command"}),s.jsxs("div",{"data-testid":"mcp-command-box",className:"flex items-center gap-2.5 px-3 py-2.5 bg-bg-hi border border-line rounded-md font-mono text-[13px] text-fg",children:[n?null:s.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-fg-faint/60",children:"$"}),a?s.jsx("span",{"data-testid":"mcp-command",className:"min-w-0 break-words",children:a}):s.jsx("span",{"data-testid":"mcp-command-empty",className:"min-w-0 font-sans text-[12.5px] text-fg-faint",children:t?n?"No URL set.":"No command set.":n?"No URL set — Edit JSON to add one.":"No command set — Edit JSON to add one."}),s.jsx("button",{type:"button","data-testid":"mcp-command-copy",onClick:()=>void l(),disabled:!a,className:"ml-auto shrink-0 font-sans text-xs text-fg-faint hover:text-fg disabled:opacity-50 disabled:hover:text-fg-faint",children:"Copy"})]})]})}function ct({testId:e,label:t,noun:n,separator:a,emptyText:l,values:r,onAdd:i}){const[o,h]=f.useState(()=>new Set),[m,g]=f.useState(!1),[u,x]=f.useState(""),v=f.useRef(null),p=Object.keys(r),b=u.trim(),w=b!==""&&!/\s/.test(b)&&!b.includes(a),C=N=>h(L=>{const G=new Set(L);return G.has(N)?G.delete(N):G.add(N),G}),A=()=>{g(!1),x("")},J=()=>{var N;w&&(i(b,((N=v.current)==null?void 0:N.value)??""),A())},P=N=>{N.key==="Enter"?(N.preventDefault(),J()):N.key==="Escape"&&(N.preventDefault(),A())},B=s.jsxs("button",{type:"button","data-testid":`${e}-add`,onClick:()=>g(!0),className:"shrink-0 text-[12.5px] font-semibold text-accent hover:text-accent-dark",children:["+ Add ",n]});return s.jsxs("section",{"data-testid":e,className:"flex flex-col gap-[7px]",children:[s.jsx("h3",{className:Xe,children:t}),p.length===0&&!m?s.jsxs("div",{"data-testid":`${e}-empty`,className:"flex items-center gap-2.5 px-3 py-2.5 border border-dashed border-rule rounded-md text-[12.5px] text-fg-faint",children:[l,s.jsx("span",{className:"ml-auto",children:B})]}):null,p.length>0?s.jsx("div",{className:"bg-bg-hi border border-line rounded-md divide-y divide-line",children:p.map(N=>{const L=o.has(N);return s.jsxs("div",{"data-testid":`${e}-row-${N}`,className:"flex items-center gap-2.5 px-3 py-2 font-mono text-[12.5px]",children:[s.jsx("span",{className:"shrink-0 font-semibold text-fg",children:N}),s.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-fg-faint/60",children:a}),s.jsx("span",{"data-testid":`${e}-value-${N}`,title:L?void 0:"Hidden — Show reveals it",className:`min-w-0 break-words ${L?"text-fg-dim":"text-fg-faint tracking-wider"}`,children:L?r[N]:ds}),s.jsx("button",{type:"button","data-testid":`${e}-reveal-${N}`,"aria-pressed":L,"aria-label":`${L?"Hide":"Show"} the value of ${N}`,onClick:()=>C(N),className:"ml-auto shrink-0 font-sans text-xs text-fg-faint hover:text-fg",children:L?"Hide":"Show"})]},N)})}):null,m?s.jsxs("div",{"data-testid":`${e}-add-form`,className:"flex items-center gap-2 px-3 py-2 bg-bg-hi border border-line rounded-md",children:[s.jsx("input",{"data-testid":`${e}-new-key`,"aria-label":`New ${n} name`,value:u,onChange:N=>x(N.target.value),onKeyDown:P,placeholder:n==="variable"?"KEY":"Header-Name",spellCheck:!1,autoFocus:!0,className:"w-44 h-7 px-2 bg-bg border border-line rounded font-mono text-xs text-fg"}),s.jsx("span",{"aria-hidden":"true",className:"font-mono text-xs text-fg-faint",children:a}),s.jsx("input",{ref:v,type:"password",autoComplete:"off","data-testid":`${e}-new-value`,"aria-label":`New ${n} value`,onKeyDown:P,placeholder:"value",spellCheck:!1,className:"flex-1 min-w-0 h-7 px-2 bg-bg border border-line rounded font-mono text-xs text-fg"}),s.jsx("button",{type:"button","data-testid":`${e}-add-confirm`,onClick:J,disabled:!w,className:"shrink-0 h-7 px-2.5 rounded-md bg-accent text-bg-hi text-xs font-semibold hover:bg-accent/90 disabled:opacity-50 disabled:hover:bg-accent",children:"Add"}),s.jsx("button",{type:"button","data-testid":`${e}-add-cancel`,onClick:A,className:"shrink-0 h-7 px-2 text-xs text-fg-faint hover:text-fg",children:"Cancel"})]}):p.length>0?s.jsx("div",{children:B}):null]})}function gs({serverName:e,result:t}){return s.jsxs("section",{"data-testid":"mcp-tools",className:"flex flex-col gap-[7px]",children:[s.jsxs("h3",{className:`flex items-baseline gap-2 ${Xe}`,children:["Tools",t!=null&&t.ok?s.jsxs(s.Fragment,{children:[s.jsx("span",{"data-testid":"mcp-tools-count",className:"font-mono font-medium tracking-normal text-fg-faint/60",children:t.tools.length}),s.jsx("span",{className:"font-normal tracking-normal normal-case text-fg-faint/80",children:"from the last check"})]}):null]}),t?t.ok?t.tools.length===0?s.jsx("div",{"data-testid":"mcp-tools-empty",className:Je,children:"The last check listed no tools."}):s.jsx("div",{className:"bg-bg-hi border border-line rounded-md divide-y divide-line",children:t.tools.map((n,a)=>s.jsxs("div",{"data-testid":`mcp-tool-row-${n.name}`,className:"grid grid-cols-[120px_minmax(0,1fr)_auto] items-baseline gap-4 px-3 py-2.5",children:[s.jsx("span",{title:n.name,className:"truncate font-mono text-[12.5px] font-semibold text-fg",children:n.name}),s.jsx("span",{title:n.description||void 0,className:"line-clamp-2 text-[12.5px] text-fg-dim",children:n.description??""}),s.jsx("span",{className:"font-mono text-[11px] text-fg-faint/80",children:fs(e,n.name)})]},`${a}:${n.name}`))}):s.jsxs("div",{"data-testid":"mcp-tools-empty",className:Je,children:[t.status==="needs-auth"?"The last check needs auth":"The last check failed",": ",t.error]}):s.jsx("div",{"data-testid":"mcp-tools-empty",className:Je,children:"Check this server to list its tools."})]})}const et=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,Ye="disable-model-invocation",At=/^\s*disable-model-invocation\s*:/;function bs(e){const t=e.match(et);if(!t)return!1;for(const n of t[1].split(/\r?\n/)){if(!At.test(n))continue;const a=n.slice(n.indexOf(":")+1).trim().toLowerCase();return a==="true"||a==="yes"}return!1}function vs(e){const t=e.trim();return t.length>=2&&(t[0]==='"'&&t[t.length-1]==='"'||t[0]==="'"&&t[t.length-1]==="'")?t.slice(1,-1):t}function de(e){return e.length-e.trimStart().length}function Oe(e){const t=e.match(et);if(!t)return{name:null,description:null,body:e};const n=t[1].split(/\r?\n/),a=t[2]??"";let l=null,r=null;for(let i=0;i<n.length;i++){const o=n[i],h=o.match(/^(\s*)(name|description)\s*:(.*)$/);if(!h)continue;const[,,m,g]=h,u=g.trim(),x=de(o);let v;if(u===""||u===">-"||u===">"||u==="|-"||u==="|"){const p=[];let b=i+1;for(;b<n.length&&n[b].trim()!==""&&de(n[b])>x;)p.push(n[b].trim()),b++;v=p.join(" ")}else v=vs(u);m==="name"?l=v:r=v}return{name:l,description:r,body:a}}function ks(e,t){const n=e.match(et);if(!n){if(!t)return e;const i=e.startsWith(`
2
2
  `)?"":`
3
3
  `;return`---
4
4
  ${Ye}: true
@@ -1 +1 @@
1
- import{be as p,aN as d,an as g,ax as o,bc as b}from"./index-CBCdyHbZ.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,h as s};
1
+ import{bf as p,aN as d,an as g,ax as o,bd as b}from"./index-BLORXCcT.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,h as s};
@@ -1 +1 @@
1
- import{aN as i,b8 as d,ax as e,a8 as E,b4 as O,be as _,C as B,l as C,ag as P}from"./index-CBCdyHbZ.js";import{P as $}from"./Panel-C7EFG4eU.js";import{S as z,I as H}from"./Library-R71t6VAB.js";import{D as W}from"./DocumentEditorPane-fm6zsnLM.js";import{S as q}from"./SourceChip-uyVMCZc7.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-BzG_KdBC.js";const G=300;function J({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,G);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 K(){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(q,{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(J,{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(W,{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(K);export{se as SystemPrompt};
1
+ import{aN as i,b9 as d,ax as e,a8 as E,b5 as O,bf as _,C as B,l as C,ag as P}from"./index-BLORXCcT.js";import{P as $}from"./Panel-D7NX5iP8.js";import{S as z,I as H}from"./Library-COr79GyT.js";import{D as W}from"./DocumentEditorPane-CgB5IuOY.js";import{S as q}from"./SourceChip-DC5XD8KC.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-CObXxw7b.js";const G=300;function J({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,G);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 K(){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(q,{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(J,{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(W,{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(K);export{se as SystemPrompt};
@@ -1,4 +1,4 @@
1
- import{aS as aa,aN as G,R as Pt,ax as R,N as Nf,at as If,a6 as Rf}from"./index-CBCdyHbZ.js";import"./monaco-editor-BsIlgG7c.js";var zi={exports:{}},$i={};/**
1
+ import{aS as aa,aN as G,R as Pt,ax as R,N as Nf,at as If,a6 as Rf}from"./index-BLORXCcT.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{ax as r}from"./index-CBCdyHbZ.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{ax as r}from"./index-BLORXCcT.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 +1 @@
1
- import{ax as r}from"./index-CBCdyHbZ.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:x})=>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:x},e))})}export{n as V};
1
+ import{ax as r}from"./index-BLORXCcT.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:x})=>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:x},e))})}export{n as V};
@@ -1 +1 @@
1
- import{bs as o,bq as m,aa as j,ax as e,aX as l,bp as b,aA as R}from"./index-CBCdyHbZ.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 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
+ import{bt as o,br as m,aa as j,ax as e,aY as l,bq as b,aA as R}from"./index-BLORXCcT.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 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{bv as s}from"./index-CBCdyHbZ.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{bw as s}from"./index-BLORXCcT.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};