claude-code-session-manager 0.112.0 → 0.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/assets/{AgentLibrary-RwPvEgqm.js → AgentLibrary-DZFM7Lto.js} +2 -2
- package/dist/assets/{Button-36j3PzYv.js → Button-BJVFKdGH.js} +1 -1
- package/dist/assets/{DataModel-DUhANo4l.js → DataModel-CebvcP_y.js} +1 -1
- package/dist/assets/{History-BeZzNjmv.js → History-BwISEUhR.js} +2 -2
- package/dist/assets/{Hooks-iQ8845Hp.js → Hooks-Dac3smYP.js} +3 -3
- package/dist/assets/{Library-DPE1h-1L.js → Library-DTjsUr9W.js} +7 -7
- package/dist/assets/{ListDetail-PStOuQAo.js → ListDetail-B1L5TbjS.js} +1 -1
- package/dist/assets/{MarkdownEditor-DPw-N2-m.js → MarkdownEditor-BFRhWZD4.js} +1 -1
- package/dist/assets/{McpServers-CUyRTNep.js → McpServers-CBjGCMg0.js} +2 -2
- package/dist/assets/Memory-DdLi5fqe.js +8 -0
- package/dist/assets/{Panel-_VZ_uXNg.js → Panel-BQkkkjex.js} +1 -1
- package/dist/assets/{Permissions-PPRmfNbK.js → Permissions-CaACwY0B.js} +3 -3
- package/dist/assets/{Plugins-BFcvfvlx.js → Plugins-DJeBwVoh.js} +2 -2
- package/dist/assets/ProvenanceBadge--N5j8xiK.js +1 -0
- package/dist/assets/{RemoteMachines-D5V0lzgW.js → RemoteMachines-WjWaDHEA.js} +2 -2
- package/dist/assets/{SaveBar-Dw64FVdM.js → SaveBar-DFmOjb4_.js} +1 -1
- package/dist/assets/{Scheduler-C8s_pJ3I.js → Scheduler-Miap6_aY.js} +8 -8
- package/dist/assets/{ScopeSwitcher-D-nKDMAE.js → ScopeSwitcher-CiEujp4L.js} +1 -1
- package/dist/assets/Settings-UGpW4P0j.js +4 -0
- package/dist/assets/{SkillReferenceGraph-BbZFMHim.js → SkillReferenceGraph-BgyAnxGW.js} +1 -1
- package/dist/assets/Skills-BQUpnNfx.js +2 -0
- package/dist/assets/SystemPrompt-CQjOgHGT.js +1 -0
- package/dist/assets/TagLibrary-CTVpoLl0.js +1 -0
- package/dist/assets/{TiptapBody-Cr-hxX8L.js → TiptapBody-BtOcrdRR.js} +1 -1
- package/dist/assets/{Toggle-7WpPzcZH.js → Toggle-Chri4G19.js} +1 -1
- package/dist/assets/{ViewTabs-9lQCRwWJ.js → ViewTabs-BIenDGVv.js} +1 -1
- package/dist/assets/{historyTotals-BrFxw5J1.js → historyTotals-CX8mUxJY.js} +1 -1
- package/dist/assets/{index-CTBpf-26.js → index-AVrhGmUO.js} +163 -163
- package/dist/assets/{index-Dutcsly-.css → index-HpEbvDiE.css} +1 -1
- package/dist/assets/{settingsSchema-Dh5Kl7VO.js → settingsSchema-uqwlznbH.js} +1 -1
- package/dist/assets/{useAgentsDirWatch-CMpx0d04.js → useAgentsDirWatch-BaezRtWw.js} +1 -1
- package/dist/assets/{useRemotePeers-CI2axd-L.js → useRemotePeers-BuFbBqDt.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
- package/plugins/session-manager-dev/skills/send-feedback/SKILL.md +13 -0
- package/scripts/scheduler-mcp-server.cjs +23 -5
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +18 -1
- package/src/main/config.cjs +18 -1
- package/src/main/index.cjs +6 -2
- package/src/main/ipcSchemas.cjs +27 -34
- package/src/main/lib/activeSessions.cjs +13 -0
- package/src/main/lib/claude/rateLimitDetect.cjs +29 -10
- package/src/main/lib/claude/rateLimitWindow.cjs +23 -11
- package/src/main/lib/credentials.cjs +16 -90
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +107 -9
- package/src/main/lib/feedback-remote/humanPromptLedger.cjs +93 -0
- package/src/main/lib/mcpToolCatalog.cjs +9 -3
- package/src/main/lib/memoryDirResolve.cjs +139 -0
- package/src/main/lib/memoryIndex.cjs +98 -0
- package/src/main/lib/prd/depSlugResolve.cjs +16 -1
- package/src/main/lib/scheduler/finalizeReason.cjs +30 -0
- package/src/main/lib/scheduler/flatSweepThrottle.cjs +17 -0
- package/src/main/lib/scheduler/runLogRetention.cjs +34 -13
- package/src/main/lib/scheduler/schedulerBatch.cjs +8 -12
- package/src/main/lib/telemetry/telemetryClient.cjs +8 -4
- package/src/main/lib/util/atomicFs.cjs +42 -0
- package/src/main/lib/util/loopDelay.cjs +1 -1
- package/src/main/memoryAggregate.cjs +15 -8
- package/src/main/memoryTool.cjs +151 -22
- package/src/main/runVerify.cjs +5 -2
- package/src/main/scheduler.cjs +43 -10
- package/src/main/supervisor.cjs +45 -22
- package/src/main/webRemote.cjs +15 -0
- package/src/preload/api.d.ts +47 -52
- package/src/preload/index.cjs +25 -21
- package/dist/assets/Memory-bZ2xjBGy.js +0 -8
- package/dist/assets/ProvenanceBadge-B1WUknak.js +0 -1
- package/dist/assets/Settings-CQSrR4mO.js +0 -4
- package/dist/assets/Skills-Bzyrh6EQ.js +0 -2
- package/dist/assets/SystemPrompt-DP6i3Dx0.js +0 -1
- package/dist/assets/TagLibrary-iip0C6Bl.js +0 -1
- package/src/main/agentMemory.cjs +0 -246
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ap as i,S as d}from"./index-AVrhGmUO.js";function a({scopes:l,active:n,onChange:o,annotate:s}){return i.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:l.map(t=>{const r=d[t],e=s==null?void 0:s(t),c=t===n;return i.jsxs("button",{title:r.hint,onClick:()=>o(t),className:`px-2.5 py-1 text-xs flex items-center gap-1.5 transition-colors ${c?"bg-bg-hi text-fg":"bg-bg-elev text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[i.jsx("span",{children:r.label}),(e==null?void 0:e.dirty)&&i.jsx("span",{className:"w-1 h-1 rounded-full bg-accent",title:"unsaved edits"}),e&&e.exists===!1&&!e.dirty&&i.jsx("span",{className:"w-1 h-1 rounded-full bg-fg-faint",title:"not yet created"})]},t)})})}export{a as S};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{aF as d,ap as e,S as I,A as Q,n as V,X as Oe,a4 as De,aW as ge,be as z,b5 as be,a as F,bf as $e,aY as Me,b9 as Le,b6 as _e,a$ as Fe,c as ie,aD as Ue,b3 as Be,bd as le,aZ as Y,ar as Ge,aw as He,J as Je,H as oe,aN as Ke}from"./index-AVrhGmUO.js";import{P as Ve}from"./Panel-BQkkkjex.js";import{S as We}from"./ScopeSwitcher-CiEujp4L.js";import{S as ve}from"./SaveBar-DFmOjb4_.js";import{u as Xe,s as ce,E as Ye}from"./settingsSchema-uqwlznbH.js";import{V as qe}from"./ViewTabs-BIenDGVv.js";import{T as W}from"./Toggle-Chri4G19.js";import{u as ze,b as J,P as D,E as se,R as ye,a as je,S as ee}from"./useRemotePeers-BuFbBqDt.js";import"./monaco-editor-BsIlgG7c.js";import"./claude-settings-schema-COigsajx.js";const Ze=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle","permissions"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Model allow/override lists, reasoning depth, and fast-mode toggles — machine-wide, with no per-Epic override yet. An Epic's Agent persona model (Agent Library) still wins over Essentials' plain model default.",advanced:!0,keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled","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"]}],Qe={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function we(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((i,a)=>{const r=Qe[i];return r||(a===0?i.charAt(0).toUpperCase()+i.slice(1):i)}).join(" ")}function Ne(t){const s=new Set,n=[];for(const a of Ze){const r=a.keys.filter(o=>t.has(o));r.forEach(o=>s.add(o)),r.length!==0&&n.push({id:a.id,title:a.title,summary:a.summary,advanced:!!a.advanced,keys:r})}const i=Array.from(t).filter(a=>!s.has(a)&&a!=="$schema").sort();return i.length>0&&n.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:i}),n}function et(t,s){return Ne(t).map(n=>({id:n.id,title:n.title,advanced:n.advanced,total:n.keys.length,setCount:n.keys.filter(i=>s.has(i)).length}))}const tt={};function ke(t,s){if(s)return{text:s,authored:!1};const n=tt[t];return n?{text:n,authored:!0}:null}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"],at={user:"user",project:"project",local:"local",default:"default"};function rt({node:t,targetScope:s,onOverride:n,schema:i}){const[a,r]=d.useState(""),[o,p]=d.useState(!1),[u,h]=d.useState(!0),m=t.kind==="object"?t:null,k=m?Object.keys(m.children):[],g=i.rootKeys(),y=new Set([...k,...g]),c=d.useMemo(()=>Ne(y),[Array.from(y).sort().join(",")]),N=d.useMemo(()=>et(y,new Set(k)),[Array.from(y).sort().join(","),k.join(",")]),[R,A]=d.useState(null),v=d.useRef(null),E=f=>{const j=c.find(l=>l.id===f);j!=null&&j.advanced&&!o&&p(!0),A(f)};d.useEffect(()=>{if(!R)return;A(null);const f=v.current,j=document.getElementById(`settings-group-${R}`);if(!f||!j)return;const l=j.getBoundingClientRect().top-f.getBoundingClientRect().top;f.scrollBy({top:l,behavior:"smooth"})},[R]);const C=d.useMemo(()=>c.filter(f=>o||!f.advanced).map(f=>({...f,keys:f.keys.filter(j=>{const l=(m==null?void 0:m.children[j])!==void 0;if(!u&&!l)return!1;if(!a.trim())return!0;const S=i.at([j]);return[j,we(j),(S==null?void 0:S.description)??""].join(" ").toLowerCase().includes(a.toLowerCase())})})).filter(f=>f.keys.length>0),[c,a,o,u,m,i]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:"text-fg-faint",children:["writing overrides to"," ",e.jsx("span",{className:"text-fg-dim font-medium",children:I[s].label})]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:f=>h(f.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:o,onChange:f=>p(f.target.checked),className:"accent-accent"}),"show advanced"]}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:a,onChange:f=>r(f.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(it,{groups:N,onJump:E}),e.jsxs("div",{ref:v,className:"flex-1 overflow-auto py-3",children:[C.map(f=>e.jsx(lt,{id:f.id,title:f.title,summary:f.summary,advanced:f.advanced,children:f.keys.map(j=>{const l=m==null?void 0:m.children[j],S=i.at([j]);return e.jsx(ot,{keyName:j,node:l,info:S,targetScope:s,onOverride:(b,$)=>n([j],b,$)},j)})},f.id)),C.length===0&&e.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',a,'"']})]})]})]})}function it({groups:t,onJump:s}){return e.jsx("nav",{className:"shrink-0 w-48 border-r border-line bg-bg-elev/30 overflow-y-auto py-3",children:t.map(n=>e.jsxs("button",{onClick:()=>s(n.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bg-hi transition-colors",title:`jump to ${n.title}`,children:[e.jsx(Q,{name:st[n.id]??"dot",size:15,className:"text-fg-faint shrink-0"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-fg-dim",children:n.title}),e.jsxs("span",{className:"text-[10px] text-fg-faint font-mono shrink-0",children:[n.setCount,"/",n.total]})]},n.id))})}function lt({id:t,title:s,summary:n,advanced:i,children:a}){const[r,o]=d.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:()=>o(!r),children:[e.jsx("span",{className:"text-fg-faint w-3",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-fg text-base font-semibold",children:s}),i&&e.jsx("span",{className:"text-[9px] px-1.5 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"advanced"})]}),e.jsx("p",{className:"text-fg-dim text-sm mt-0.5",children:n})]})]}),r&&e.jsx("div",{className:"divide-y divide-line/60",children:a})]})}function ot({keyName:t,node:s,info:n,targetScope:i,onOverride:a}){const[r,o]=d.useState(!1),[p,u]=d.useState(!1),h=we(t),m=s!==void 0,g=(s==null?void 0:s.kind)==="leaf"?s:null,y=(s==null?void 0:s.kind)==="object"||(s==null?void 0:s.kind)==="array",c=n==null?void 0:n.default,N=g&&c!==void 0&&Ce(g.value,c),R=ht({isSet:m,leafNode:g,defaultVal:c,isDefault:!!N,node:s}),A=ct(g,c),v=A.length>=2,E=!!g&&!N,C=ke(t,n==null?void 0:n.description);return e.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{onClick:()=>o(!r),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:r?"collapse":"expand",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-fg text-sm",children:h}),e.jsx(gt,{kind:R.kind,label:R.label}),v&&e.jsxs("button",{onClick:f=>{f.stopPropagation(),r||o(!0),u(j=>!j)},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 · ",A.map(f=>at[f]).join(" · ")]}),E&&g&&e.jsx("button",{onClick:f=>{f.stopPropagation(),a(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 ${I[g.winner].label}`,children:"↺ reset"}),(n==null?void 0:n.deprecated)&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"deprecated"}),(n==null?void 0:n.required)&&!m&&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"})]}),C&&e.jsx("p",{className:`text-fg-dim text-xs mt-0.5 leading-relaxed ${C.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:C.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:bt(C.text)}),r&&p&&g&&e.jsx(dt,{leaf:g,defaultVal:c,onReset:f=>a(void 0,f)}),r&&e.jsx(xt,{keyName:t,node:s,info:n,targetScope:i,onOverride:f=>a(f)})]}),e.jsx("div",{className:"shrink-0",children:!r&&e.jsx(ft,{node:s,info:n,onSet:f=>{a(f)},disabled:y&&m})})]})})}function ct(t,s){if(!t)return[];const n=new Set;n.add(t.winner);for(const i of t.shadowed)n.add(i.scope);return s!==void 0&&n.add("default"),nt.filter(i=>n.has(i))}function dt({leaf:t,defaultVal:s,onReset:n}){const i={};i[t.winner]={value:t.value,winner:!0};for(const a of t.shadowed)i[a.scope]={value:a.value,winner:!1};return e.jsxs("div",{className:"mt-2 border border-line rounded bg-bg-elev/40 text-xs",children:[e.jsx("div",{className:"px-2 py-1 text-fg-faint border-b border-line/60",children:"Values across all scopes (winner highlighted · reset removes that scope's value):"}),e.jsxs("div",{className:"divide-y divide-line/60",children:[["user","project","local"].map(a=>{const r=i[a],o=r!==void 0;return e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:I[a].label}),e.jsx("span",{className:`font-mono truncate ${r!=null&&r.winner?"text-accent":"text-fg-dim"}`,children:o?U(r.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),o?e.jsx("button",{onClick:()=>n(a),className:"text-[9px] px-1.5 py-0 rounded border border-line text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`delete this key from ${I[a].label}`,children:"↺"}):e.jsx("span",{})]},a)}),e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:"Default"}),e.jsx("span",{className:"font-mono text-fg-dim truncate",children:s!==void 0?U(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function xt({keyName:t,node:s,info:n,targetScope:i,onOverride:a}){const o=(s==null?void 0:s.kind)==="leaf"?s:null,p=ke(t,n==null?void 0:n.description);return e.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[p&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${p.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:p.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:p.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(n==null?void 0:n.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(n.type)?n.type.join(" | "):n.type})]}),(n==null?void 0:n.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:U(n.default)})]}),(n==null?void 0:n.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:n.enum.map(u=>String(u)).join(" | ")})]}),o&&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:U(o.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",I[o.winner].label]})]})]}),o&&o.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:o.shadowed.map((u,h)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[U(u.value)," —"," ",e.jsx("span",{className:"no-underline",children:I[u.scope].label})]},h))})]}),(s==null?void 0:s.kind)==="array"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Accumulated"}),e.jsxs("dd",{className:"text-fg-dim",children:[s.items.length," items across all scopes"]})]})]}),e.jsx("div",{className:"pt-2 flex items-center gap-2 flex-wrap border-t border-line/60",children:e.jsx(pt,{keyName:t,node:s,info:n,onChange:a,targetScope:i})})]})}function pt({node:t,info:s,onChange:n,targetScope:i}){const r=(t==null?void 0:t.kind)==="leaf"?t.value:s==null?void 0:s.default,o=Se(s==null?void 0:s.type);if(o==="boolean"){const p=r===!0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:[{v:!0,label:"on"},{v:!1,label:"off"}].map(({v:u,label:h})=>e.jsx("button",{onClick:()=>n(u),className:`px-3 py-0.5 text-xs transition-colors ${p===u?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:h},h))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",I[i].label]})]})}return s!=null&&s.enum?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-fg-faint",children:"Choose:"}),s.enum.map(p=>{const u=Ce(r,p);return e.jsx("button",{onClick:()=>n(p),className:`px-2 py-0.5 text-xs rounded border ${u?"bg-accent text-bg border-accent":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,children:String(p)},String(p))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",I[i].label]})]}):o==="integer"||o==="number"?e.jsx(ut,{value:typeof r=="number"?r:void 0,integer:o==="integer",onCommit:n,target:I[i].label}):o==="string"?e.jsx(mt,{value:typeof r=="string"?r:"",onCommit:n,target:I[i].label}):e.jsxs("div",{className:"text-fg-faint",children:["Complex value (",o??"object/array",") — use the"," ",e.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function ut({value:t,integer:s,onCommit:n,target:i}){const[a,r]=d.useState(t!==void 0?String(t):""),o=()=>{const p=s?parseInt(a,10):parseFloat(a);Number.isNaN(p)||n(p)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("input",{type:"number",value:a,onChange:p=>r(p.target.value),onBlur:o,onKeyDown:p=>{p.key==="Enter"&&p.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:o,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",i]})]})}function mt({value:t,onCommit:s,target:n}){const[i,a]=d.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:i,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&s(i)},className:"flex-1 min-w-0 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:()=>s(i),className:"shrink-0 px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",n]})]})}function ft({node:t,info:s,onSet:n,disabled:i}){const a=(t==null?void 0:t.kind)==="leaf",r=Se(s==null?void 0:s.type);if(i)return null;if(r==="boolean"){const o=a&&t.value===!0;return e.jsx("button",{onClick:()=>n(!o),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${o?"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:o?"on":"off"})}return null}function ht({isSet:t,leafNode:s,defaultVal:n,isDefault:i,node:a}){return t?(a==null?void 0:a.kind)==="array"?{kind:"accumulated",label:`${a.items.length} items`}:(a==null?void 0:a.kind)==="object"?{kind:"set",label:"configured"}:s?i?{kind:"default",label:`= default · ${I[s.winner].label}`}:s.shadowed.length>0?{kind:"override",label:`overriding ${s.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${I[s.winner].label}`}:{kind:"set",label:"configured"}:n!==void 0?{kind:"default",label:`using default: ${U(n)}`}:{kind:"unset",label:"not configured"}}function gt({kind:t,label:s}){const n={set:"bg-accent/15 text-accent border-accent/30",default:"bg-bg-hi text-fg-dim border-line",unset:"bg-bg-elev text-fg-faint border-line",override:"bg-purple-950/30 text-purple-400/80 border-purple-900/40",accumulated:"bg-blue-950/30 text-blue-400/80 border-blue-900/40"}[t];return e.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${n}`,children:s})}function Se(t){if(t)return Array.isArray(t)?t.find(n=>n!=="null")??t[0]:t}function Ce(t,s){return t===s?!0:typeof t!=typeof s?!1:t&&s&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(s):!1}function bt(t){const s=t.trim().split(`
|
|
2
|
+
`)[0],n=s.match(/^([^.!?]+[.!?])/);return n?n[1]:s.length>120?s.slice(0,120)+"…":s}function U(t){if(typeof t=="string")return t===""?'""':JSON.stringify(t);if(t===null)return"null";if(t===void 0)return"—";if(typeof t=="object"){const s=JSON.stringify(t);return s.length>60?s.slice(0,60)+"…":s}return String(t)}const vt=1440*60*1e3;function de(t){if(!t)return"never";const s=new Date(t).getTime();return Number.isNaN(s)?"never":new Date(s).toLocaleString()}function xe(t){return t?new Date(t).toLocaleString():"never"}function yt(){return e.jsxs("div",{className:"p-4 max-w-3xl space-y-8 text-sm",children:[e.jsx(jt,{}),e.jsx("hr",{className:"border-line"}),e.jsx(wt,{})]})}function jt(){const[t,s]=d.useState(null),[n,i]=d.useState(null),[a,r]=d.useState(null),[o,p]=d.useState(null),[u,h]=d.useState(!1),[m,k]=d.useState(null),[g,y]=d.useState(null);if(d.useEffect(()=>{let v=!1;return Promise.all([window.api.otel.getConfig(),window.api.otel.status(),window.api.otel.configPath()]).then(([E,C,f])=>{v||(s(E),r(E),i(C),p(f))}).catch(E=>{console.warn("[telemetry] load failed:",E==null?void 0:E.message)}),()=>{v=!0}},[]),!a||!t)return e.jsx(V,{title:"loading…"});const c=JSON.stringify(a)!==JSON.stringify(t),N=(v,E)=>{k(null),r({...a,[v]:E})},R=async()=>{h(!0),k(null);try{const v=await window.api.otel.setConfig(a);!v.ok&&v.error&&k(v.error),s(v.config),r(v.config),i(v.status),y(Date.now())}catch(v){k(v instanceof Error?v.message:String(v))}finally{h(!1)}},A=()=>{k(null),r(t)};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"OpenTelemetry export"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"When enabled, every classified transcript event (tool_use, todo_write, plan, usage, agent_spawn) is mirrored as a 0-duration OTLP/HTTP span. Point this at a local collector (Jaeger, Grafana Tempo, SigNoz, Honeycomb) for cross-session analysis."}),o&&e.jsxs("p",{className:"text-fg-faint text-[11px]",children:["stored at ",e.jsx("span",{className:"font-mono",children:o})]})]}),e.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Export transcripts to OTEL"}),e.jsx("div",{className:"text-fg-faint text-xs",children:"Toggle off to disable all span emission immediately."})]}),e.jsx(W,{checked:a.enabled,onChange:v=>N("enabled",v),label:a.enabled?"on":"off"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"OTLP/HTTP traces endpoint"}),e.jsx("input",{type:"text",value:a.endpoint,onChange:v=>N("endpoint",v.target.value),placeholder:"http://localhost:4318/v1/traces",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsxs("span",{className:"text-fg-dim text-xs",children:["Headers (newline-separated ",e.jsx("span",{className:"font-mono",children:"Key: Value"}),")"]}),e.jsx("textarea",{value:a.headers,onChange:v=>N("headers",v.target.value),placeholder:"x-honeycomb-team: YOUR_API_KEY",rows:3,className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Service name"}),e.jsx("input",{type:"text",value:a.serviceName,onChange:v=>N("serviceName",v.target.value),placeholder:"session-manager",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("div",{className:"flex items-start justify-between gap-3 pt-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Include content (PII)"}),e.jsxs("div",{className:"text-fg-faint text-xs leading-relaxed",children:["Adds tool inputs, plan text, and agent prompts to span attributes. Off by default — matches upstream Claude Code's ",e.jsx("span",{className:"font-mono",children:"OTEL_LOG_USER_PROMPTS"})," opt-in."]})]}),e.jsx(W,{checked:a.includeContent,onChange:v=>N("includeContent",v),label:a.includeContent?"on":"off"})]})]}),n&&e.jsxs("section",{className:"border border-line rounded p-3 text-xs space-y-1",children:[e.jsx("div",{className:"text-fg-dim",children:"Runtime status"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"enabled:"})," ",e.jsx("span",{className:n.enabled?"text-accent":"text-fg-dim",children:String(n.enabled)})]}),n.error&&e.jsxs("div",{className:"text-red-400 break-words",children:[e.jsx("span",{className:"text-fg-faint",children:"error:"})," ",n.error]}),!n.error&&n.enabled&&e.jsx("div",{className:"text-fg-faint",children:"spans batched and exported in the background. Verify by enabling and pointing at a local Jaeger."})]}),e.jsxs("footer",{className:"flex items-center gap-3 pt-2 border-t border-line",children:[e.jsx("button",{onClick:R,disabled:!c||u,className:"px-3 py-1 text-xs rounded bg-accent text-bg disabled:opacity-50 disabled:cursor-not-allowed",children:u?"saving…":"Save"}),e.jsx("button",{onClick:A,disabled:!c||u,className:"px-3 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg disabled:opacity-50 disabled:cursor-not-allowed",children:"Revert"}),m&&e.jsx("span",{className:"text-red-400 text-xs",children:m}),!m&&g&&!c&&e.jsx("span",{className:"text-fg-faint text-xs",children:"saved"})]})]})}function wt(){const[t,s]=d.useState(null),[n,i]=d.useState(null),[a,r]=d.useState("Copy"),[o,p]=d.useState(!1),[u,h]=d.useState(null),[m,k]=d.useState(null),[g,y]=d.useState(null),[c,N]=d.useState(!1),R=()=>{window.api.telemetry.status().then(i).catch(l=>{console.warn("[product-telemetry] status reload failed:",l==null?void 0:l.message)})};if(d.useEffect(()=>{let l=!1;return Promise.all([window.api.telemetry.getConfig(),window.api.telemetry.status()]).then(([S,b])=>{l||(s(S),i(b))}).catch(S=>{console.warn("[product-telemetry] load failed:",S==null?void 0:S.message)}),()=>{l=!0}},[]),!t||!n)return e.jsx(V,{title:"loading…"});const A=async l=>{k(null);try{const S=await window.api.telemetry.setConfig(l);s(S.config),i(S.status)}catch(S){k(S instanceof Error?S.message:String(S))}},v=l=>{A({...t,enabled:l})},E=async()=>{await De(t.installId)?(r("Copied"),setTimeout(()=>r("Copy"),1500)):ge.error("Could not copy install id to the clipboard")},C=async()=>{p(!0),h(null);try{const l=await window.api.telemetry.flushNow();h(`sent ${l.sent.length}, failed ${l.failed.length}`),R()}catch(l){h(l instanceof Error?l.message:String(l))}finally{p(!1)}},f=async()=>{if(c){N(!1);return}try{const l=await window.api.telemetry.recentRecords();y(l),N(!0)}catch(l){console.warn("[product-telemetry] recentRecords failed:",l instanceof Error?l.message:l)}},j=t.lastDailyFlushAt?new Date(t.lastDailyFlushAt).getTime()+vt:null;return e.jsxs("div",{className:"space-y-5","data-testid":"product-telemetry-section",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Product telemetry (bilko.run)"}),e.jsxs("p",{className:"text-fg-dim text-xs leading-relaxed",children:["Anonymous, strictly non-identifying usage/error reporting that helps improve this app. On by default; switchable off in one click. See"," ",e.jsx("span",{className:"font-mono",children:"session-manager-operations/architecture/telemetry.md"})," for the full data model."]})]}),e.jsx(Oe,{cfg:t,onSaved:(l,S)=>{s(l),i(S)}}),e.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Send anonymous product telemetry"}),e.jsx("div",{className:"text-fg-faint text-xs",children:"Sent on start-up, after an update, and once a day. Strictly anonymous — an install id only, never an email, name, or other identifier."})]}),e.jsx(W,{checked:t.enabled,onChange:v,label:t.enabled?"on":"off"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-fg-dim text-xs",children:"Anonymous install id"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",readOnly:!0,value:t.installId,"aria-label":"Anonymous install identifier",className:"flex-1 bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"}),e.jsx("button",{onClick:E,className:"px-2 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg",children:a})]})]}),e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("div",{className:"text-fg-faint",children:"Endpoint"}),e.jsx("div",{className:"font-mono text-fg-dim break-all",children:t.endpoint})]}),e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("div",{className:"text-fg-faint",children:"Send cadence"}),e.jsx("div",{className:"text-fg-dim",children:"on start-up, after an update, and once a day"})]}),m&&e.jsx("div",{className:"text-red-400 text-xs",children:m})]}),n.pendingCount>0&&n.sentCount===0&&e.jsxs("section",{"data-testid":"telemetry-never-delivered-warning",className:"border border-red-400 rounded p-3 text-xs space-y-1 text-red-400",children:[e.jsx("div",{className:"font-medium",children:"Never delivered"}),e.jsxs("div",{className:"leading-relaxed",children:[n.pendingCount," record",n.pendingCount===1?"":"s",' queued but none have ever been sent to bilko.run on this install. Check the endpoint/network, or click "Send now" below.']})]}),e.jsxs("section",{className:"border border-line rounded p-3 text-xs space-y-1.5",children:[e.jsx("div",{className:"text-fg-dim",children:"Runtime status"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"last send:"})," ",xe(n.lastFlushAt)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"next daily send due:"})," ",de(j?new Date(j).toISOString():null)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"queued records:"})," ",n.pendingCount]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"delivered so far:"})," ",n.sentCount]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"de-duplicated:"})," ",n.dedupedAppends]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"evicted:"})," ",n.evictedCount]}),n.backlog&&e.jsxs("div",{className:"text-fg-faint",children:["last backlog drain (",n.backlog.reason,", ",de(n.backlog.ranAt),"):"," ",n.backlog.linesEnqueued," enqueued, ",n.backlog.linesConfirmed," confirmed,"," ",n.backlog.watermarksRewound," watermarks rewound"]}),n.lastError&&e.jsxs("div",{className:"text-red-400 break-words",children:[e.jsx("span",{className:"text-fg-faint",children:"last error:"})," ",n.lastError.message," ","(",xe(n.lastError.at),")"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:C,disabled:o,className:"px-3 py-1 text-xs rounded bg-accent text-bg disabled:opacity-50 disabled:cursor-not-allowed",children:o?"sending…":"Send now"}),u&&e.jsx("span",{className:"text-fg-faint text-xs",children:u})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("button",{onClick:f,className:"px-3 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg",children:c?"Hide last records":"Inspect last records sent"}),c&&e.jsx("pre",{"data-testid":"telemetry-inspector-json",className:"bg-bg border border-line rounded p-2 text-[11px] font-mono overflow-auto max-h-96 whitespace-pre-wrap",children:JSON.stringify(g??[],null,2)})]})]})}const te="relay_client_auth_unavailable",K=t=>(t==null?void 0:t.message)||String(t),Nt=["relay_client_unpaired","token_revoked"],pe={invalid_code:"That code didn't match. Check it and try again.",code_expired:"That code expired. Mint a new one on bilko.run → Desktop clients.",invalid_code_format:"Codes are 8 letters or numbers. Check it and try again.",rate_limited:"Too many tries. Wait a minute and try again.",relay_client_unpaired:"This computer is no longer connected to your account. Enter a new code to reconnect."};function ue(t){return Object.prototype.hasOwnProperty.call(pe,t)?pe[t]:`Pairing failed (${t})`}const me=t=>{const s=/^v?(\d+)\.(\d+)\.(\d+)/.exec(t.trim());return s?[Number(s[1]),Number(s[2]),Number(s[3])]:null};function kt(t,s){const n=me(t),i=me(s);if(!n||!i)return!1;for(let a=0;a<3;a++)if(n[a]!==i[a])return n[a]>i[a];return!1}function St({peer:t,onConnect:s,onRevoke:n,onConfirmSas:i}){var g;const a=t.status==="authenticated",[r,o]=d.useState(null),p=((g=$e())==null?void 0:g.latest)??null;d.useEffect(()=>{if(!a){o(null);return}let y=!1;return window.api.remoteClient.send(t.peerId,"cmd:app:version").then(c=>{y||o(typeof c=="string"?c:null)}).catch(()=>{y||o(null)}),()=>{y=!0}},[t.peerId,a]);const u=r!=null&&p!=null&&kt(p,r),h=t.status==="failed"&&t.reason===te,m=t.status==="connecting",k=new Date(t.pairedAt).toLocaleString();return e.jsxs("div",{className:"space-y-2","data-testid":"remote-machine-row",children:[e.jsx(ye,{testId:"remote-machine",icon:"terminal",title:t.machineName,badge:a?e.jsx(F,{tone:"default",className:"!text-sage !border-sage/40",children:"online"}):void 0,subtitle:`${t.peerId} · last seen ${k}`,action:e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!a&&!h&&t.status!=="pending_sas"&&e.jsx(D,{testId:"remote-machine-connect",disabled:m,onClick:()=>s(t.peerId),children:m?"Connecting…":"Connect"}),e.jsx(je,{testId:"remote-machine-revoke",onClick:()=>n(t.peerId),children:"Revoke"})]})}),r&&e.jsxs("p",{"data-testid":"remote-machine-version",className:"text-[12.5px] leading-snug text-fg-faint",children:["v",r]}),u&&e.jsx("p",{"data-testid":"remote-machine-update-available",className:"text-[12.5px] leading-snug text-fg-faint",children:`Update available on ${t.machineName} (v${r} → v${p}) — update it on that machine`}),h&&e.jsx("p",{"data-testid":"remote-machine-unavailable",className:"text-[12.5px] leading-snug text-fg-faint",children:"The bilko.run relay does not support desktop clients yet"}),t.status==="pending_sas"&&t.sas&&e.jsx(ee,{peer:"other machine",testId:"remote-machine-sas",codeTestId:"remote-machine-sas-code",confirmTestId:"remote-machine-sas-confirm",code:t.sas,onConfirm:()=>i(t.peerId)})]})}function Ct({paired:t,revoked:s,peers:n,onAuthChanged:i,onAdded:a}){const r=z(l=>l.show),[o,p]=d.useState(""),[u,h]=d.useState(!1),[m,k]=d.useState(!1),[g,y]=d.useState(null),[c,N]=d.useState({}),R=async()=>{h(!0);try{const l=await window.api.remoteClient.pair(o.trim());l.ok?(k(!1),p(""),i()):l.error===te?k(!0):r("error",ue(l.error??"unknown"))}catch(l){r("error",K(l))}finally{h(!1)}},A=async()=>{h(!0);try{const l=await window.api.remoteClient.devices();l.ok?y(l.devices??[]):l.error===te?k(!0):r("error",ue(l.error??"unknown"))}catch(l){r("error",K(l))}finally{h(!1)}},v=async l=>{try{await window.api.remoteClient.add(l,c[l]??`Machine ${l.slice(0,8)}`),a()}catch(S){r("error",K(S))}},E=async()=>{try{await window.api.remoteClient.unpair(),y(null),i()}catch(l){r("error",K(l))}},C=m&&e.jsx("p",{"data-testid":"remote-machine-unavailable",className:"text-[12.5px] leading-snug text-fg-faint",children:"The bilko.run relay does not support desktop clients yet"});if(!t)return e.jsxs("div",{className:"space-y-2 mb-3","data-testid":"remote-client-pairing",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{"data-testid":"remote-client-code",value:o,maxLength:8,onChange:l=>p(l.target.value),placeholder:"8-character code",className:"px-2 py-1 text-[13px] rounded border border-line bg-transparent"}),e.jsx(D,{testId:"remote-client-pair",disabled:u||o.trim().length===0,onClick:()=>{R()},children:"Pair"})]}),e.jsx("p",{className:"text-[12.5px] leading-snug text-fg-faint",children:"Mint a desktop code on your phone: Session Manager remote → Desktop clients."}),s&&e.jsx("p",{"data-testid":"remote-client-revoked",className:"text-[12.5px] leading-snug text-fg-faint",children:"This computer was disconnected from your account on bilko.run. Enter a new code to reconnect."}),C]});const f=new Set(n.map(l=>l.deviceId)),j=(g??[]).filter(l=>!f.has(l.deviceId));return e.jsxs("div",{className:"space-y-2 mb-3","data-testid":"remote-client-pairing",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{testId:"remote-client-find",disabled:u,onClick:()=>{A()},children:"Find my devices"}),e.jsx(D,{testId:"remote-client-unpair",kind:"ghost",onClick:()=>{E()},children:"Unpair"})]}),C,g&&j.length===0&&e.jsx(se,{testId:"remote-client-devices-empty",children:"No other devices to add."}),j.map(l=>e.jsxs("div",{"data-testid":"remote-client-device",className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[12.5px] text-fg-faint shrink-0",children:l.email}),e.jsx(F,{tone:"default",className:l.isOnline?"!text-sage !border-sage/40":void 0,children:l.isOnline?"online":"offline"}),e.jsx("input",{"data-testid":"remote-client-name",value:c[l.deviceId]??`Machine ${l.deviceId.slice(0,8)}`,onChange:S=>N(b=>({...b,[l.deviceId]:S.target.value})),className:"px-2 py-1 text-[13px] rounded border border-line bg-transparent min-w-0"}),e.jsx(D,{testId:"remote-client-add",onClick:()=>{v(l.deviceId)},children:"Add"})]},l.deviceId))]})}function Et(){const t=z(c=>c.show),s=be(c=>c.openPanel),[n,i]=d.useState(!1),[a,r]=d.useState(!1),o=d.useCallback(async()=>{try{const c=(await window.api.remoteClient.authStatus()).paired;i(c),c&&r(!1)}catch(c){t("error",K(c))}},[t]),p=d.useCallback(c=>{c.reason&&Nt.includes(c.reason)&&(c.reason==="token_revoked"&&r(!0),o())},[o]),{peers:u,refresh:h,connect:m,confirmSas:k,revoke:g}=ze(p);d.useEffect(()=>{o()},[o]);const y=d.useCallback(c=>g(c),[g]);return e.jsxs("div",{"data-testid":"remote-machines",children:[e.jsx(J,{right:u.length>0?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[11.5px] text-fg-faint",children:[u.length," paired"]}),e.jsx(D,{testId:"remote-machines-open-view",onClick:()=>s("remote"),children:"Open Remote view"})]}):void 0,children:"Remote machines"}),e.jsx(Ct,{paired:n,revoked:a,peers:u,onAuthChanged:()=>{o()},onAdded:()=>{h()}}),u.length===0?e.jsx(se,{testId:"remote-machines-empty",children:"No machines paired yet."}):e.jsx("div",{className:"space-y-2",children:u.map(c=>e.jsx(St,{peer:c,onConnect:m,onRevoke:y,onConfirmSas:k},c.peerId))})]})}function fe({label:t,hint:s,on:n,onChange:i,warn:a,disabled:r,first:o,testId:p}){return e.jsxs("div",{className:`flex items-center justify-between gap-4 px-[18px] py-[15px] ${o?"":"border-t border-rule"} ${r?"opacity-50":""}`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-fg mb-0.5",children:t}),e.jsxs("div",{className:`text-[12.5px] leading-snug flex items-center gap-1.5 ${a?"text-honey-dark":"text-fg-faint"}`,children:[a&&e.jsx("span",{"aria-hidden":!0,children:"⚠"}),s]})]}),e.jsx("span",{"data-testid":p,className:"inline-flex",children:e.jsx(W,{checked:n,onChange:r?()=>{}:i,disabled:r})})]})}function Rt({device:t,online:s,onRevoke:n,revoking:i}){const a=t.lastConnectedAt?new Date(t.lastConnectedAt).toLocaleString():`paired ${new Date(t.issuedAt).toLocaleDateString()}`;return e.jsx(ye,{testId:"settings-remote-device",icon:"wifi",title:t.deviceName,badge:s?e.jsx(F,{tone:"default",className:"!text-sage !border-sage/40",children:"online"}):void 0,subtitle:`${t.deviceId} · last seen ${a}`,action:e.jsx(je,{testId:"settings-remote-revoke",onClick:()=>n(t.deviceId),disabled:i})})}const M=t=>(t==null?void 0:t.message)||String(t);function At(){var re;const t=z(x=>x.show),[s,n]=d.useState(null),[i,a]=d.useState(!0),[r,o]=d.useState(!1),[p,u]=d.useState(!1),[h,m]=d.useState("idle"),[k,g]=d.useState(""),[y,c]=d.useState(null),[N,R]=d.useState(!1),[A,v]=d.useState([]),[E,C]=d.useState(!1),f=d.useRef(null);d.useEffect(()=>{let x=!1;const w=()=>window.api.webRemote.getStatus().then(O=>{x||n(O)}).catch(()=>{});window.api.webRemote.getStatus().then(O=>{x||(n(O),a(!1))}).catch(O=>{x||(t("error",`Remote status: ${M(O)}`),a(!1))});const Ie=window.api.webRemote.onStatus(O=>n(O)),Te=window.api.webRemote.onTokenRevoked(()=>{t("warn","Remote device token was revoked. Re-pair to reconnect."),w()}),Pe=window.api.webRemote.onRevokedAll(({revokedCount:O})=>{t("info",`Panic: all ${O} device(s) revoked and sessions torn down.`),w()});return()=>{x=!0,Ie(),Te(),Pe()}},[t]),d.useEffect(()=>{if(h!=="enter-otp")return;const x=setTimeout(()=>{var w;return(w=f.current)==null?void 0:w.focus()},50);return()=>clearTimeout(x)},[h]);const j=async()=>n(await window.api.webRemote.getStatus()),l=async()=>{if(s){o(!0);try{const x=s.enabled?await window.api.webRemote.disable():await window.api.webRemote.enable();x&&x.ok===!1&&t("error",x.error||"Failed to change remote state."),await j()}catch(x){t("error",`Failed: ${M(x)}`)}finally{o(!1)}}},S=async()=>{if(s){u(!0);try{const x=s.remoteControlEnabled?await window.api.webRemote.disableControl():await window.api.webRemote.enableControl();x&&x.ok===!1&&t("error",x.error||"Failed to change command writes."),await j()}catch(x){t("error",`Failed: ${M(x)}`)}finally{u(!1)}}},b=async()=>{const x=k.trim().toUpperCase();if(!/^[A-Z0-9]{8}$/.test(x)){t("warn","Pairing code must be 8 alphanumeric characters.");return}m("pairing");try{const w=await window.api.webRemote.pair(x);if(!w.ok){t("error",w.error||"Pairing failed."),m("enter-otp");return}t("info","Device paired successfully."),g(""),m("idle"),await j()}catch(w){t("error",`Pairing error: ${M(w)}`),m("enter-otp")}},$=async x=>{c(x);try{const w=await window.api.webRemote.revokeDevice(x);if(!w.ok){t("error",w.error||"Revoke failed.");return}await j()}catch(w){t("error",`Revoke error: ${M(w)}`)}finally{c(null)}},P=async()=>{R(!0);try{const x=await window.api.webRemote.revokeAll();x.ok||t("error",x.error||"Panic revoke failed.")}catch(x){t("error",`Panic revoke error: ${M(x)}`)}finally{R(!1)}},ne=async()=>{if(E){C(!1);return}try{const x=await window.api.webRemote.auditTail(100);if(!x.ok){t("error",`Audit log: ${x.error||"unavailable"}`);return}v(x.lines??[]),C(!0)}catch(x){t("error",`Audit log: ${M(x)}`)}},_=async x=>{try{const w=await window.api.webRemote.confirmSas(x);w!=null&&w.ok||t("error",`SAS confirm failed: ${(w==null?void 0:w.error)??"unexpected state — reconnect the mobile app"}`)}catch(w){t("error",`SAS confirm failed: ${M(w)}`)}};if(i)return e.jsx("div",{className:"p-6 text-fg-faint text-sm",children:"Loading…"});const T=(s==null?void 0:s.enabled)??!1,L=(s==null?void 0:s.remoteControlEnabled)??!1,X=(s==null?void 0:s.connected)??!1,B=(s==null?void 0:s.e2eActive)??!1,Ee=(s==null?void 0:s.e2eAuthenticated)??!1,Re=(s==null?void 0:s.e2eState)??"idle",ae=(s==null?void 0:s.pendingSas)??null,Z=((s==null?void 0:s.clients)??[]).filter(x=>x.state==="pending_sas"&&x.pendingSas),G=(s==null?void 0:s.devices)??[],H=T&&X,Ae=X?((re=G.reduce((x,w)=>w.lastConnectedAt&&(!x||(x.lastConnectedAt??"")<w.lastConnectedAt)?w:x,null))==null?void 0:re.deviceId)??null:null;return e.jsxs("div",{"data-testid":"settings-remote",className:"p-4 max-w-[760px] space-y-[22px]",children:[Z.length>0?Z.map((x,w)=>e.jsxs("div",{"data-testid":"settings-remote-sas-row",children:[Z.length>1&&e.jsx("div",{className:"text-[12px] font-semibold text-fg-dim mb-1",children:x.clientId??"Phone"}),e.jsx(ee,{testId:w===0?"settings-remote-sas":void 0,codeTestId:w===0?"settings-remote-sas-code":void 0,confirmTestId:w===0?"settings-remote-sas-confirm":void 0,code:x.pendingSas,onConfirm:()=>_(x.key)})]},x.key)):ae&&e.jsx(ee,{testId:"settings-remote-sas",codeTestId:"settings-remote-sas-code",confirmTestId:"settings-remote-sas-confirm",code:ae,onConfirm:()=>_()}),Re==="failed"&&e.jsxs("div",{className:"flex items-center gap-3.5 px-5 py-4 rounded-2xl border border-[#eccdbe] bg-[#f8e8e0]",children:[e.jsx("span",{className:"w-4 h-4 rounded-full bg-accent text-white grid place-items-center text-[11px] font-bold shrink-0",children:"!"}),e.jsxs("div",{className:"text-[13px] text-[#9a3f1f]",children:[e.jsx("strong",{className:"font-semibold",children:"E2E key exchange failed."})," ",e.jsx("span",{className:"text-fg-dim",children:"The session key could not be established. Reconnect the mobile app to retry."})]})]}),e.jsxs("div",{className:`flex items-center gap-3.5 px-5 py-4 rounded-2xl border ${H?"border-[#e8cdb9] bg-[#f5e9df]":"border-line bg-bg-hi"}`,children:[e.jsx("span",{className:`w-[38px] h-[38px] rounded-[11px] shrink-0 grid place-items-center ${H?"bg-[#f0d9c8] text-accent":"bg-[#e4ebd6] text-sage"}`,children:e.jsx(Q,{name:H?"wifi":"shield",size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[14.5px] font-semibold text-fg mb-0.5",children:H?"Remote control is active":T?"Remote control is idle":"Remote control is off"}),e.jsx("div",{className:"text-[13px] text-fg-dim leading-snug",children:H?"A web session can send commands to this machine. Revoke below if unexpected.":T&&(s==null?void 0:s.linkState)==="repair-needed"?"The relay no longer recognises this device. Re-pair it with a new code to reconnect.":T?"The relay is on but no device is connected. Pair a device to begin.":"The relay connection is closed — no remote commands are accepted. Enable it below only when you need it."})]}),B&&Ee?e.jsx(F,{tone:"default",className:"!text-sage !border-sage/40",children:"E2E authenticated"}):B?e.jsx(F,{tone:"warn",children:"E2E · awaiting SAS"}):e.jsx(F,{tone:"dim",children:"relay only · not E2E yet"})]}),e.jsxs("div",{children:[e.jsx(J,{children:"Remote control"}),e.jsxs("div",{className:"bg-bg-hi border border-line rounded-2xl overflow-hidden",children:[e.jsx(fe,{first:!0,testId:"settings-remote-enable",label:"Allow remote control from the web",hint:"Master switch. When off, the relay refuses every connection.",on:T,disabled:r,onChange:()=>{r||l()}}),e.jsx(fe,{testId:"settings-remote-control",label:"Allow command writes (pty + scheduler)",hint:L?"A paired device can run shell commands and queue jobs on this machine.":"Paired devices can watch session output but cannot send commands.",warn:L,disabled:!T||p,on:L&&T,onChange:()=>{T&&!p&&S()}})]})]}),e.jsxs("div",{children:[e.jsx(J,{children:"Pair a device"}),h==="idle"?e.jsxs("div",{className:"flex items-center justify-between gap-4 bg-bg-hi border border-line rounded-2xl px-5 py-[18px]",children:[e.jsxs("div",{"data-testid":"settings-remote-pair-hint",className:"text-[13.5px] text-fg-dim leading-relaxed max-w-[420px]",children:["On your phone open ",e.jsx("strong",{className:"text-fg font-semibold",children:"bilko.run/projects/session-manager"}),", sign in, and tap"," ",e.jsx("strong",{className:"text-fg font-semibold",children:"Generate pairing code"}),". Enter the 8-character code here."]}),e.jsx(D,{testId:"settings-remote-pair-start",kind:"soft",icon:"link",onClick:()=>m("enter-otp"),children:"Pair Device…"})]}):e.jsxs("div",{className:"flex items-center gap-5 bg-bg-hi border border-accent/40 rounded-2xl px-6 py-[22px]",children:[e.jsx("span",{className:"w-[52px] h-[52px] rounded-xl bg-bg border border-line grid place-items-center text-accent shrink-0",children:e.jsx(Q,{name:"link",size:24})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[11.5px] font-bold uppercase tracking-[0.8px] text-fg-faint mb-2",children:"Enter the code from your phone"}),e.jsx("input",{ref:f,"data-testid":"settings-remote-otp",value:k,onChange:x=>g(x.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),onKeyDown:x=>{x.key==="Enter"&&b()},maxLength:8,placeholder:"XXXXXXXX",disabled:h==="pairing",className:"w-full bg-transparent border-0 outline-none font-mono text-[30px] font-semibold tracking-[6px] text-fg placeholder:text-fg-faint/40 disabled:opacity-50"})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(D,{testId:"settings-remote-pair-confirm",kind:"soft",onClick:b,disabled:h==="pairing"||k.length<8,children:h==="pairing"?"Pairing…":"Confirm"}),e.jsx(D,{kind:"ghost",onClick:()=>{m("idle"),g("")},disabled:h==="pairing",children:"cancel"})]})]})]}),e.jsxs("div",{children:[e.jsx(J,{right:G.length>0?e.jsxs("span",{className:"text-[11.5px] text-fg-faint",children:[G.length," paired"]}):void 0,children:"Paired devices"}),G.length===0?e.jsx(se,{children:"No devices paired yet."}):e.jsx("div",{className:"space-y-2",children:G.map(x=>e.jsx(Rt,{device:x,online:x.deviceId===Ae,onRevoke:$,revoking:y===x.deviceId},x.deviceId))})]}),e.jsx(Et,{}),e.jsxs("div",{children:[e.jsx(J,{right:e.jsx("button",{"data-testid":"settings-remote-audit-toggle",onClick:ne,className:"text-[12px] text-fg-faint hover:text-fg-dim transition-colors",children:E?"Hide":"Show last 100 · 0600, stays on this machine"}),children:"Audit log"}),E&&e.jsx("div",{className:"bg-bg-hi border border-line rounded-xl overflow-auto max-h-64 mb-2",children:A.length===0?e.jsx("p",{className:"p-4 text-[12.5px] text-fg-faint",children:"No entries today."}):e.jsx("pre",{"data-testid":"settings-remote-audit",className:"p-4 text-[12px] text-fg-dim font-mono whitespace-pre-wrap leading-relaxed",children:A.join(`
|
|
3
|
+
`)})}),e.jsxs("p",{className:"text-[12px] text-fg-faint",children:["Full log at"," ",e.jsx("code",{className:"font-mono text-fg-faint",children:"~/.claude/session-manager/logs/remote-audit-YYYY-MM-DD.log"})," ","(0600, never leaves this machine)"]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 bg-[#f8e8e0] border border-[#eccdbe] rounded-2xl px-5 py-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"w-4 h-4 rounded-full bg-accent text-white grid place-items-center text-[11px] font-bold shrink-0",children:"!"}),e.jsx("span",{className:"text-sm font-semibold text-[#9a3f1f]",children:"Panic — disconnect & revoke everything"})]}),e.jsx("div",{className:"text-[12.5px] text-fg-dim leading-snug max-w-[440px]",children:"Tears down every active session and invalidates all paired-device tokens. Devices must re-pair. Use if you suspect compromise."})]}),e.jsx("button",{"data-testid":"settings-remote-revoke-all",onClick:P,disabled:N,className:"shrink-0 rounded-lg bg-accent text-white px-[18px] py-2 text-[13px] font-semibold hover:opacity-90 disabled:opacity-50 transition-opacity",children:N?"Revoking…":"Revoke all"})]})]})}const q="px-2 py-1 rounded border border-line text-xs text-fg hover:bg-bg-hi disabled:opacity-50";function It(){const t=Me(),s=z(p=>p.show),n=async p=>{try{const h=await p();h&&h.ok===!1&&s("error",h.error??"Update action failed")}catch(u){s("error",u instanceof Error?u.message:String(u))}};if(!t)return null;const{state:i}=t,a=i==="unsupported",r=t.latest?`v${t.latest}`:"—",o=()=>{window.confirm("Installing now will stop all running jobs and terminals. Continue?")&&n(()=>window.api.updater.install(!0))};return e.jsxs("section",{"data-testid":"settings-updates",className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:"Updates"}),e.jsxs("div",{className:"text-fg-dim text-xs flex gap-4",children:[e.jsxs("span",{children:["Current v",t.current]}),e.jsxs("span",{children:["Latest ",r]})]})]}),a?e.jsx("p",{className:"text-fg-faint text-[11px]",children:"Auto-update runs only in the installed Windows app or the Linux AppImage. npx builds update via npx."}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(W,{checked:t.enabled,onChange:p=>void n(()=>window.api.updater.setEnabled(p)),label:"Update automatically"}),e.jsx("button",{type:"button","data-testid":"updates-check",className:q,disabled:i==="checking"||i==="downloading",onClick:()=>void n(()=>window.api.updater.check()),children:"Check for updates"})]}),i==="checking"&&e.jsx("p",{className:"text-fg-dim text-xs",children:"Checking…"}),i==="downloading"&&e.jsxs("p",{className:"text-fg-dim text-xs",children:["Downloading… ",t.progress!=null?`${Math.round(t.progress)}%`:""]}),i==="ready"&&e.jsxs("button",{type:"button","data-testid":"updates-install",className:q,onClick:()=>void n(()=>window.api.updater.install(!1)),children:["Restart to install v",t.latest]}),i==="deferred"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-fg-dim text-xs",children:["Waiting for ",t.busyReason??"work"," to finish"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",className:q,onClick:o,children:"Install now"}),e.jsx("button",{type:"button",className:q,onClick:()=>void n(()=>window.api.updater.cancelDeferred()),children:"Cancel"})]})]}),i==="error"&&e.jsx("p",{className:"text-red-400 text-xs",children:t.error})]})}const Tt={compact:"Compact",roomy:"Roomy"};function Pt(){const{model:t,setModel:s}=Le(),{catalog:n}=_e(null),{density:i,setDensity:a}=Fe();return e.jsxs("div",{className:"p-4 max-w-3xl space-y-5 text-sm",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Session Manager preferences"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"Native app preferences, stored locally — not part of Claude Code's own settings."})]}),e.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Default model for raw sessions"}),e.jsx(ie,{options:Ue(n),value:t,onChange:s,mono:!0}),e.jsx("span",{className:"text-fg-faint text-[11px]",children:"Used when opening a raw interactive session without an explicit per-launch override."})]}),e.jsxs("div",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Density"}),e.jsx(ie,{options:["compact","roomy"],value:i,onChange:r=>a(r),labels:Tt}),e.jsx("span",{className:"text-fg-faint text-[11px]",children:"Compact tightens spacing across the app's chrome; Roomy is the default."})]})]}),e.jsx(It,{})]})}function Ot({cwd:t}){const[s,n]=d.useState(!1),[i,a]=d.useState(!1),[r,o]=d.useState(!1),[p,u]=d.useState(!1);d.useEffect(()=>{var y,c;let g=!1;return n(!1),Promise.resolve((c=(y=window.api.promptSessions)==null?void 0:y.getWorktreeDisabled)==null?void 0:c.call(y,{cwd:t})).then(N=>{g||(a((N==null?void 0:N.disabled)??!1),o((N==null?void 0:N.disabled)??!1),n(!0))},()=>{g||n(!0)}),()=>{g=!0}},[t]);const h=s&&r!==i,m=()=>{var g,y;u(!0),Promise.resolve((y=(g=window.api.promptSessions)==null?void 0:g.setWorktreeDisabled)==null?void 0:y.call(g,{cwd:t,disabled:r})).then(c=>{a((c==null?void 0:c.disabled)??r),o((c==null?void 0:c.disabled)??r)}).catch(c=>ge.error(c instanceof Error?c.message:String(c))).finally(()=>u(!1))},k=()=>o(i);return e.jsxs("div",{"data-testid":"settings-epic-isolation",className:"border-b border-line bg-bg-elev px-3 py-2.5 text-[11.5px] leading-snug",children:[e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx("input",{type:"checkbox",checked:r,disabled:!s||p,onChange:g=>o(g.target.checked),"data-testid":"settings-epic-isolation-checkbox",className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-fg",children:"Disable Epic worktree isolation for this project"}),e.jsxs("span",{className:"block text-fg-dim",children:["Off by default — each active Epic runs in its own isolated ",e.jsx("code",{children:"git worktree"})," (branch"," ",e.jsx("code",{children:"sm-epic/<id>"}),"), merged back to main at an explicit checkpoint. Turning this on makes every new Epic in this project run directly in the shared working tree instead, same as before this feature existed."]})]})]}),h&&e.jsx(ve,{dirty:h,busy:p,onSave:m,onRevert:k})]})}const he={user:{title:"Global settings",body:"This is the real ~/.claude/settings.json on disk — the same file the claude CLI reads on every session it starts. Edits apply machine-wide, to every project and every session."},project:{title:"Project settings",body:"This is the real <project>/.claude/settings.json on disk, checked into git. Edits apply to every current and future session in this project, for anyone who clones it."},local:{title:"Local settings",body:"This is the real <project>/.claude/settings.local.json on disk, gitignored. Edits apply to every current and future session in this project, on this machine only."}};function Dt(){const t=Be(),s=le(b=>b.tabs),n=le(b=>b.activeTabId),i=s.find(b=>b.id===n)??null,a=(i==null?void 0:i.cwd)??null,r=be(b=>b.navFace),o=d.useRef(!1),p=d.useRef(r),[u,h]=d.useState(()=>r==="project"&&a?"project":"user"),[m,k]=d.useState("effective");d.useEffect(()=>{if(p.current!==r){if(p.current=r,o.current){o.current=!1;return}h(r==="project"&&a?"project":"user")}},[r,a]),d.useEffect(()=>{r==="project"&&(m==="telemetry"||m==="remote"||m==="app")&&k("effective")},[r,m]);const g=b=>{o.current=!0,h(b)},y=Xe(oe,t,a),c=y[u]??null,N=Y(b=>b.files),R=Y(b=>b.setDraft),A=Y(b=>b.saveJson),v=Y(b=>b.revert),[E,C]=d.useState(null),f=d.useMemo(()=>Ge(He(N,y)),[N,y]),j=(b,$,P)=>{var B;const _=y[P??u];if(!_)return;C(null);const T=((B=N[_])==null?void 0:B.draftRaw)??"";let L={};if(T.trim())try{L=JSON.parse(T)}catch{L={}}const X=Ke(L,b,$);R(_,JSON.stringify(X,null,2)+`
|
|
4
|
+
`)};if(!t)return e.jsx(V,{title:"loading…"});const l=c?N[c]:null,S=b=>b!=="user"&&!a;return e.jsx(Ve,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(qe,{options:[{key:"effective",label:"Guided"},{key:"tree",label:"Tree"},{key:"raw",label:"Raw"},...r==="home"?[{key:"telemetry",label:"Telemetry"},{key:"remote",label:"Phone remote"},{key:"app",label:"Session Manager"}]:[]],active:m,onChange:k}),m!=="telemetry"&&m!=="remote"&&m!=="app"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx(We,{scopes:oe.scopes,active:u,onChange:g,annotate:b=>{if(S(b))return{exists:!1};const $=y[b];if(!$)return null;const P=N[$];return{exists:(P==null?void 0:P.exists)??!1,dirty:(P==null?void 0:P.dirty)??!1}}}),e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:m==="effective"?`overrides → ${c??"—"}`:c??"—"})]}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"schema reference ↗"})]}),footer:m!=="telemetry"&&m!=="remote"&&m!=="app"&&c&&l?e.jsx(ve,{dirty:l.dirty,busy:l.busy,parseError:E||l.parseError,lastSavedAt:l.lastSavedAt,leading:l.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{C(null);const b=await A(c);b.ok||C(b.error??"save failed")},onRevert:()=>{C(null),v(c)}}):null,children:m==="telemetry"?e.jsx(yt,{}):m==="remote"?e.jsx(At,{}):m==="app"?e.jsx(Pt,{}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"settings-scope-note",className:"sticky top-0 z-10 border-b border-line bg-bg-elev px-3 py-2 text-[11.5px] leading-snug",children:[e.jsx("span",{className:"font-semibold text-fg",children:he[u].title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:he[u].body}),c&&e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:c})]}),u==="project"&&a&&e.jsx(Ot,{cwd:a}),S(u)?e.jsx(V,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"}):m==="effective"?e.jsx(rt,{node:f,targetScope:u,onOverride:j,schema:ce()}):m==="tree"?e.jsx(Ye,{node:f,targetScope:u,onOverride:j,schema:ce()}):c&&l?e.jsx(Je,{path:c,value:l.draftRaw,onChange:b=>{C(null),R(c,b)}}):e.jsx(V,{title:"resolving…"})]})})}const Kt=d.memo(Dt);export{he as SETTINGS_SCOPE_NOTES,Kt as Settings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aF as Z,R as wo,am as ko,ap as tr}from"./index-AVrhGmUO.js";import"./monaco-editor-BsIlgG7c.js";function Ao(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,a,s,u=[],l=!0,f=!1;try{if(a=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(u.push(i.value),u.length!==n);l=!0);}catch(h){f=!0,o=h}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return u}}function Co(e,n,r){return n=zo(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function er(e,n){return To(e)||Ao(e,n)||ci(e,n)||Eo()}function So(e){return Mo(e)||Po(e)||ci(e)||Oo()}function Mo(e){if(Array.isArray(e))return gn(e)}function To(e){if(Array.isArray(e))return e}function Po(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ci(e,n){if(e){if(typeof e=="string")return gn(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gn(e,n)}}function gn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function Oo(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ro(e,n){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function zo(e){var n=Ro(e,"string");return typeof n=="symbol"?n:String(n)}var No=function(n,r){var i=new Set(r);return Object.assign.apply(Object,[{}].concat(So(Object.entries(n).filter(function(o){var a=er(o,1),s=a[0];return!i.has(s)}).map(function(o){var a=er(o,2),s=a[0],u=a[1];return Co({},s,u)}))))};function yn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function Io(e){if(Array.isArray(e))return e}function $o(e){if(Array.isArray(e))return yn(e)}function Do(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function jo(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,a,s,u=[],l=!0,f=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(l=(i=a.call(r)).done)&&(u.push(i.value),u.length!==n);l=!0);}catch(h){f=!0,o=h}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return u}}function Fo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lo(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aF as a,b3 as ce,aX as de,b5 as ue,aW as E,aZ as d,a_ as fe,ap as s,n as T}from"./index-AVrhGmUO.js";import{P as I}from"./Panel-BQkkkjex.js";import{L as me}from"./ListDetail-B1L5TbjS.js";import{M as pe}from"./MarkdownEditor-BFRhWZD4.js";import{S as he}from"./SaveBar-DFmOjb4_.js";import{S as K}from"./ScopeSwitcher-CiEujp4L.js";import{T as xe}from"./Toggle-Chri4G19.js";import{P as Q}from"./ProvenanceBadge--N5j8xiK.js";import{l as ve}from"./listSkills-C1aWKf0T.js";import{S as ge,V}from"./Library-DTjsUr9W.js";import{p as ke,r as je,s as be}from"./skillFrontmatter-Dif5JIg7.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-BJVFKdGH.js";const Se=250,we=2e3;function ye(m,p){return{user:{skills:`${m}/.claude/skills`,commands:`${m}/.claude/commands`},project:p?{skills:`${p}/.claude/skills`,commands:`${p}/.claude/commands`}:null}}function Ce(){const m=ce(),p=de(),x=(p==null?void 0:p.cwd)??null,v=ue(t=>t.navFace),S=a.useRef(!1),B=a.useRef(v),[u,$]=a.useState(()=>v==="project"&&x?"project":"user"),[f,w]=a.useState([]),[o,D]=a.useState(null),[y,L]=a.useState("installed"),[O,Y]=a.useState(""),[q,H]=a.useState([]),[U,F]=a.useState(null),C=a.useMemo(()=>m?ye(m,x):null,[m,x]);a.useEffect(()=>{if(B.current!==v){if(B.current=v,S.current){S.current=!1;return}$(v==="project"&&x?"project":"user")}},[v,x]);const c=a.useMemo(()=>C?u==="user"?C.user:C.project:null,[u,C]),P=a.useRef(0),N=a.useCallback(async()=>{const t=++P.current;if(!c){w([]),H([]);return}const l=[],n=[];try{const e=await ve(c.skills);n.push(...e.errors);for(const r of e.entries)l.push({kind:"skills",scope:u,name:r.name,path:r.path,dir:r.dir,disabled:je(r.text),description:ke(r.text).description??void 0})}catch(e){n.push({path:c.skills,error:e instanceof Error?e.message:String(e)})}try{const e=await window.api.config.listDir(c.commands,{filesOnly:!0});e.ok||n.push({path:c.commands,error:e.error??"failed to list directory"});for(const r of e.entries)r.name.endsWith(".md")&&l.push({kind:"commands",scope:u,name:r.name.replace(/\.md$/,""),path:r.path,dir:null,disabled:!1})}catch(e){n.push({path:c.commands,error:e instanceof Error?e.message:String(e)})}if(P.current===t){for(const e of n)E.error(`Could not read ${e.path}: ${e.error}`);H(n),l.sort((e,r)=>e.kind===r.kind?e.name.localeCompare(r.name):e.kind==="skills"?-1:1),w(l),D(e=>{var r;return l.find(i=>i.path===e)?e:((r=l[0])==null?void 0:r.path)??null})}},[c,u]);a.useEffect(()=>{N()},[N]),a.useEffect(()=>()=>{P.current+=1},[]);const X=a.useRef(N);X.current=N;const Z=a.useRef(f);Z.current=f;const z=a.useRef(o);z.current=o;const g=a.useRef(null),W=a.useRef(!1),A=a.useRef(!1),M=a.useCallback(async()=>{if(W.current){A.current=!0;return}W.current=!0;try{await X.current()}finally{W.current=!1}A.current&&(A.current=!1,M())},[]);a.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const ee=a.useCallback(t=>{var r;const l=z.current,n=l?Z.current.find(i=>i.path===l):null,e=l?(r=d.getState().files[l])==null?void 0:r.lastSavedAt:null;n!=null&&n.dir&&e&&Date.now()-e<we&&(t===n.dir||n.dir.startsWith(`${t}/`))||(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,M()},Se))},[M]);fe(c?[c.skills,c.commands]:[],ee);const b=d(t=>t.files),te=d(t=>t.loadText),se=d(t=>t.setDraft),re=d(t=>t.saveText),ae=d(t=>t.revert),ne=d(t=>t.watchFile),G=d(t=>t.unwatchFile);async function le(t,l){const n=await window.api.config.readText(t.path);if(!n.exists)return;const e=be(n.text,l);if(e===n.text)return;const r=await window.api.config.writeText(t.path,e);if(!r.ok){E.error(r.error??"failed to update skill");return}w(i=>i.map(j=>j.path===t.path?{...j,disabled:l}:j)),d.getState().files[t.path]&&d.getState().loadText(t.path,!0)}async function oe(t){if(!t.dir)return;F(null);const l=await window.api.files.delete(t.dir);if(!l.ok){E.error(l.error??"failed to remove skill");return}E.info(`Removed "${t.name}" — moved to trash`),G(t.path),w(n=>{const e=n.filter(r=>r.path!==t.path);return D(r=>{var i;return r!==t.path?r:((i=e[0])==null?void 0:i.path)??null}),e})}a.useEffect(()=>{if(o)return b[o]||te(o),ne(o),()=>G(o)},[o]);const[ie,R]=a.useState(null);if(!m)return s.jsx(T,{title:"loading…"});if(y==="library")return s.jsx(I,{toolbar:s.jsx(V,{active:y,onChange:L,installedLabel:"Installed",libraryLabel:"Library"}),children:s.jsx(ge,{})});if(u==="project"&&!x)return s.jsx(I,{toolbar:s.jsxs(s.Fragment,{children:[s.jsx(V,{active:y,onChange:L}),s.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),s.jsx(K,{scopes:["user","project"],active:u,onChange:t=>{S.current=!0,$(t)}})]}),children:s.jsx(T,{title:"no active project",hint:"open a tab in a project directory to view project skills & commands"})});const h=f.find(t=>t.path===o)??null,k=o?b[o]:null;return s.jsx(I,{toolbar:s.jsxs(s.Fragment,{children:[s.jsx(V,{active:y,onChange:L}),s.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),s.jsx(K,{scopes:["user","project"],active:u,onChange:t=>{S.current=!0,$(t)}}),s.jsxs("span",{className:"ml-3 text-fg-faint",children:[f.length," ",f.length===1?"item":"items"]}),s.jsx("div",{className:"flex-1"}),h&&s.jsx(Q,{scope:h.scope,input:{type:h.kind==="commands"?"command":"skill",name:h.name}}),s.jsx("span",{className:"ml-2 text-fg-faint truncate",children:(h==null?void 0:h.path)??""})]}),footer:o&&k?s.jsx(he,{dirty:k.dirty,busy:k.busy,parseError:ie,lastSavedAt:k.lastSavedAt,onSave:async()=>{R(null);const t=await re(o);t.ok||R(t.error??"save failed")},onRevert:()=>{R(null),ae(o)}}):null,children:s.jsx(me,{sidebar:s.jsxs("div",{className:"py-1",children:[s.jsx("div",{className:"px-2 pb-1",children:s.jsx("input",{value:O,onChange:t=>Y(t.target.value),placeholder:"filter…",className:"w-full bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"})}),["skills","commands"].map(t=>{const l=O.toLowerCase(),n=f.filter(e=>e.kind===t&&(!l||e.name.toLowerCase().includes(l)));return s.jsxs("div",{className:"mb-3",children:[s.jsx("div",{className:"px-3 py-1 text-xs uppercase tracking-wider text-fg-faint",children:t==="skills"?"Skills":"Slash Commands"}),n.length===0?s.jsx("div",{className:"px-3 py-1 text-xs text-fg-faint italic",children:"none"}):n.map(e=>{var i,j,J;const r=e.kind==="skills";return s.jsxs("div",{className:`w-full px-3 py-1 text-xs flex items-center justify-between gap-2 ${o===e.path?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[s.jsxs("button",{onClick:()=>D(e.path),className:"flex-1 min-w-0 text-left",children:[s.jsxs("div",{className:`truncate ${e.disabled?"line-through opacity-50":""}`,title:e.disabled?"Disabled — Claude will not auto-invoke this skill":void 0,children:[e.kind==="commands"?"/":"",e.name]}),e.description&&s.jsx("div",{className:"truncate text-fg-faint",children:e.description})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(Q,{interactive:!1,scope:e.scope,input:{type:e.kind==="commands"?"command":"skill",name:e.name}}),((i=b[e.path])==null?void 0:i.dirty)&&s.jsx("span",{className:"w-1 h-1 rounded-full bg-accent"}),r&&s.jsx("span",{title:(j=b[e.path])!=null&&j.dirty?"This skill has unsaved edits — save or revert before toggling":void 0,children:s.jsx(xe,{checked:!e.disabled,disabled:!!((J=b[e.path])!=null&&J.dirty),onChange:_=>void le(e,!_)})}),e.kind==="skills"&&U===e.path&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>void oe(e),title:`Remove ${e.name} — moves the folder to trash; reinstall from the Library`,className:"text-[10px] font-semibold text-red-400 hover:text-red-300",children:"confirm"}),s.jsx("button",{onClick:()=>F(null),title:"Cancel",className:"text-[10px] text-fg-faint hover:text-fg",children:"cancel"})]}),e.kind==="skills"&&U!==e.path&&s.jsx("button",{onClick:_=>{_.stopPropagation(),F(e.path)},title:"Remove skill — moves the folder to trash; reinstall from the Library","aria-label":`Remove ${e.name}`,className:"text-fg-faint hover:text-red-400 leading-none px-0.5",children:"✕"})]})]},e.path)})]},t)})]}),detail:o&&k?s.jsx("div",{className:"h-full",children:s.jsx(pe,{path:o,value:k.draftRaw,onChange:t=>{R(null),se(o,t)}})}):f.length===0&&q.length>0?s.jsx("div",{"data-testid":"skills-list-error",children:s.jsx(T,{title:"could not list skills or commands",hint:q.map(t=>`${t.path}: ${t.error}`).join(`
|
|
2
|
+
`)})}):s.jsx(T,{title:f.length===0?"no skills or commands":"select an item"})})})}const Ie=a.memo(Ce);export{Ie as Skills};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aF as i,aZ as g,ap as e,a1 as R,aW as O,b2 as _,an as B,ao as I,aS as V,a6 as $,e as z,h as M,t as D,s as T,l as H,ab as W,b3 as Z,C as q,n as A,aa as G}from"./index-AVrhGmUO.js";import{P as F}from"./Panel-BQkkkjex.js";import{S as J}from"./SaveBar-DFmOjb4_.js";import{f as K,V as P}from"./Library-DTjsUr9W.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-BJVFKdGH.js";import"./listSkills-C1aWKf0T.js";const Q=300;function X({activePath:s,selectedPath:o,onSelect:f}){const[l,a]=i.useState([]),h=i.useRef(0),r=i.useRef(f);r.current=f;const y=g(n=>{var d;return s?(d=n.files[s])==null?void 0:d.diskRaw:void 0}),u=i.useRef(null);if(i.useEffect(()=>{r.current(null)},[s]),i.useEffect(()=>{if(h.current+=1,!s){u.current=null,a([]);return}const n=u.current!==s;u.current=s;let d=!1;const m=()=>{h.current+=1;const b=h.current;window.api.config.parseImports(s).then(v=>{d||h.current!==b||(v.ok?a(v.imports):(a([]),O.error(v.error||"failed to parse @-imports")))})},j=n?null:setTimeout(m,Q);return n&&m(),()=>{d=!0,j&&clearTimeout(j)}},[s,y]),l.length===0||!s)return null;const x=o===s||o===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 · ",l.length+1]}),e.jsxs("button",{type:"button",onClick:()=>f(null),"aria-current":x,"data-testid":"referenced-file-root",className:`w-full text-left px-3 py-2 border-b border-line ${x?"bg-bg-hi text-fg":"text-fg-dim hover:bg-bg"}`,children:[e.jsx("div",{className:"text-[11.5px] font-medium truncate",children:R(s)}),e.jsx("div",{className:"text-[10px] text-fg-faint truncate",title:s,children:"this system prompt"})]}),l.map(n=>{const d=!n.ok||!n.exists,m=o===n.path;return e.jsxs("button",{type:"button",onClick:()=>f(n),"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:R(n.path)}),d&&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:n.path,children:n.path}),e.jsxs("div",{className:"text-[10px] text-fg-faint",children:[n.sizeBytes.toLocaleString()," bytes · ~",n.tokenEstimate.toLocaleString()," tokens"]})]},n.path)})]})}function Y({path:s,value:o,onChange:f,onSave:l,readOnly:a,defaultMode:h,headerRight:r,hideStatusBar:y}){const u=_(),x=B(s),n=I(s),d=V(s),[m,j]=i.useState(()=>a&&n?"preview":h??$(s)),[b,v]=i.useState(!0),[w,L]=i.useState(null),S=i.useRef(null),c=i.useRef(null),k=i.useCallback(t=>{S.current=t},[]),E=i.useCallback(()=>S.current,[]),C=a?n?["preview","edit"]:[]:d?["edit","preview","split"]:n?["edit","preview"]:[],p=n?m:"edit",N=e.jsx(z,{path:s,name:R(s),value:o,onChange:f,onSave:()=>l==null?void 0:l(),onReady:k,onCursor:L,readOnly:a});return e.jsxs("div",{className:"flex flex-col h-full min-h-0","data-testid":"document-editor-pane",children:[e.jsxs("div",{className:"flex items-center gap-1 px-2 h-7 shrink-0 border-b border-line bg-bg-elev",children:[e.jsx("span",{className:"text-[11px] font-medium text-fg truncate",children:R(s)}),a&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide text-fg-faint border border-line",children:"read-only"}),e.jsx("div",{className:"flex-1"}),r,x&&(p==="preview"||p==="split")&&e.jsx("button",{onClick:()=>v(t=>!t),"data-testid":"document-outline-toggle",className:`px-2 py-0.5 text-[10px] border border-line rounded ${b?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,title:"Toggle document outline",children:"Outline"}),C.length>0&&e.jsx("div",{className:"flex items-center ml-1 rounded border border-line overflow-hidden","data-testid":"document-mode-toggle",children:C.map(t=>e.jsx("button",{onClick:()=>j(t),className:`px-2 py-0.5 text-[10px] capitalize transition-colors ${p===t?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,children:t},t))})]}),e.jsx("div",{className:"flex-1 min-h-0",children:p==="split"&&x?e.jsxs("div",{className:"flex h-full",children:[b&&e.jsx(M,{text:o,scrollRef:c}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-line",children:[!a&&e.jsx(D,{getEditor:E}),e.jsx("div",{className:"flex-1 min-h-0",children:N})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(T,{ref:c,text:o,flush:!0,wideMeasure:u.wideMeasure})})]}):p==="preview"&&x?e.jsxs("div",{className:"flex h-full",children:[b&&e.jsx(M,{text:o,scrollRef:c}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(T,{ref:c,text:o,wideMeasure:u.wideMeasure})})]}):x?e.jsxs("div",{className:"flex flex-col h-full",children:[!a&&e.jsx(D,{getEditor:E}),e.jsx("div",{className:"flex-1 min-h-0",children:N})]}):N}),!y&&e.jsx(H,{text:o,cursor:w,language:W(s)||void 0})]})}const U={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 ee(){const s=Z(),[o,f]=i.useState("installed"),l=i.useMemo(()=>s?q.resolve("user",s,null):null,[s]),[a,h]=i.useState(null),r=(a==null?void 0:a.path)??l,y=!!a&&(!a.ok||!a.exists),u=g(t=>t.files),x=g(t=>t.loadText),n=g(t=>t.setDraft),d=g(t=>t.saveText),m=g(t=>t.revert),j=g(t=>t.watchFile),b=g(t=>t.unwatchFile);i.useEffect(()=>{if(l)return x(l,!0),j(l),()=>{b(l)}},[l]),i.useEffect(()=>{if(!(!r||r===l))return x(r,!0),j(r),()=>{b(r)}},[r,l]);const[v,w]=i.useState(null),L=i.useCallback(t=>{w(null),h(t)},[]);if(!s)return e.jsx(A,{title:"loading…"});if(o==="library")return e.jsx(F,{toolbar:e.jsx(P,{active:o,onChange:f,installedLabel:"Editor",libraryLabel:"Presets"}),children:e.jsx(K,{})});const S=l?u[l]:null,c=r?u[r]:null,k=(c==null?void 0:c.draftRaw)??"",E=G(k),C=k.length,p=y,N=async()=>{if(!r)return;w(null);const t=await d(r);t.ok||w(t.error??"save failed")};return e.jsx(F,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(P,{active:o,onChange:f,installedLabel:"Editor",libraryLabel:"Presets"}),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:r??"—"}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-fg-faint",children:[C.toLocaleString()," chars · ~",E.toLocaleString()," tokens"]})]}),footer:r&&c&&!p?e.jsx(J,{dirty:c.dirty,busy:c.busy,parseError:v,lastSavedAt:c.lastSavedAt,leading:c.exists?a?e.jsx("span",{children:"editing an imported file"}):null:e.jsx("span",{children:"file will be created on save"}),onSave:N,onRevert:()=>{w(null),m(r)}}):null,children:l&&S?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:U.title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:U.body}),e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:l})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex",children:[e.jsx(X,{activePath:l,selectedPath:r,onSelect:L}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[p&&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."}),r&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Y,{path:r,value:k,readOnly:p,defaultMode:"split",onChange:t=>{w(null),n(r,t)},onSave:()=>{N()}},r)})]})]})]}):e.jsx(A,{title:"resolving…"})})}const oe=i.memo(ee);export{oe as SystemPrompt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aF as r,V as p,ap as e,n as k,aV as w,aW as b,a0 as y}from"./index-AVrhGmUO.js";import{P}from"./Panel-BQkkkjex.js";import{L as E}from"./ListDetail-B1L5TbjS.js";import{u as S,a as v,t as N}from"./useAgentsDirWatch-BaezRtWw.js";import"./monaco-editor-BsIlgG7c.js";function $(){const[s,i]=r.useState(p[0].tag),[l,g]=r.useState(null),[h,x]=r.useState(!1),c=r.useRef(!0);r.useEffect(()=>()=>{c.current=!1},[]);const f=r.useRef(0),o=async()=>{const t=++f.current;try{const n=await window.api.agents.listPersonas();c.current&&f.current===t&&g(n)}catch(n){if(!c.current||f.current!==t)return;g([]),b.error(n.message||"failed to load agent personas")}};r.useEffect(()=>{o()},[]),r.useEffect(()=>window.api.agents.onChanged(()=>o()),[]),S(null,()=>o());const m=p.find(t=>t.tag===s)??null,a=async(t,n)=>{try{await window.api.agents.savePersona(v(t,{tags:N([...t.tags,n])})),x(!1),await o()}catch(d){b.error(d.message||"failed to assign tag")}},u=async(t,n)=>{try{await window.api.agents.savePersona(v(t,{tags:N(t.tags.filter(d=>d!==n))})),await o()}catch(d){b.error(d.message||"failed to remove tag")}};return e.jsx(P,{toolbar:e.jsxs("span",{className:"text-fg-faint",children:[p.length," tag",p.length===1?"":"s"]}),children:e.jsx(E,{sidebar:e.jsx("div",{className:"py-1",children:p.map(t=>{const n=w(t.tag),d=s===t.tag,j=(l==null?void 0:l.filter(T=>T.tags.includes(t.tag)).length)??0;return e.jsxs("button",{onClick:()=>{i(t.tag),x(!1)},className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 border-l-2 ${d?"bg-bg-hi text-fg border-accent":"text-fg-dim hover:text-fg hover:bg-bg-hi border-transparent"}`,children:[e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-semibold ${n.bg} ${n.text} ${n.border?"border border-current/30":""}`,children:["#",t.tag]}),e.jsx("span",{className:"truncate",children:t.label}),j>0&&e.jsx("span",{className:"ml-auto text-[10.5px] text-fg-faint font-mono shrink-0",children:j})]},t.tag)})}),detail:m?e.jsx(C,{entry:m,personas:l,adding:h,setAdding:x,onAssign:a,onUnassign:u}):e.jsx(k,{title:"select a tag"})})})}const q=r.memo($);function C({entry:s,personas:i,adding:l,setAdding:g,onAssign:h,onUnassign:x}){const c=w(s.tag),f=y(s.tag),o=(i==null?void 0:i.filter(a=>a.tags.includes(s.tag)))??[],m=(i==null?void 0:i.filter(a=>!a.tags.includes(s.tag)))??[];return e.jsxs("div",{className:"p-4 space-y-4 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsxs("span",{className:`px-2 py-1 rounded text-xs font-mono font-semibold ${c.bg} ${c.text} ${c.border?"border border-current/30":""}`,children:["#",s.tag]}),e.jsx("span",{className:"text-sm font-semibold text-fg",children:s.label})]}),e.jsx("div",{className:"text-xs text-fg-dim leading-relaxed",children:s.description}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] uppercase tracking-wide text-fg-faint mb-1.5 font-mono",children:"/develop eagerness"}),e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded border border-line text-fg-dim font-mono",children:s.developEagerness})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] uppercase tracking-wide text-fg-faint mb-1.5 font-mono",children:"develops via"}),e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded border border-line text-fg-dim font-mono",children:s.developsVia})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] uppercase tracking-wide text-fg-faint mb-1.5 font-mono",children:"agents carrying this tag"}),i===null?e.jsx("div",{className:"text-xs text-fg-faint italic",children:"loading…"}):e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.map(a=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-bg-elev border border-line rounded px-2 py-0.5 text-[11px] font-mono text-fg-dim",children:[a.name,e.jsx("button",{onClick:()=>x(a,s.tag),title:"Remove this tag from the agent",className:"text-fg-faint hover:text-fg",children:"×"})]},a.name)),o.length===0&&!l&&e.jsx("span",{className:"text-xs text-fg-faint italic mr-1",children:"no agent carries this tag yet."}),l?m.length>0?e.jsxs("select",{autoFocus:!0,defaultValue:"",onChange:a=>{const u=i.find(t=>t.name===a.target.value);u&&h(u,s.tag)},onBlur:()=>g(!1),className:"bg-bg border border-line rounded px-2 py-0.5 text-[11px] text-fg font-mono",children:[e.jsx("option",{value:"",disabled:!0,children:"pick an agent…"}),m.map(a=>e.jsx("option",{value:a.name,children:a.name},a.name))]}):e.jsx("span",{className:"text-xs text-fg-faint italic",children:"every agent already carries this tag."}):e.jsx("button",{onClick:()=>g(!0),className:"px-2 py-0.5 rounded-full text-[11px] font-mono border border-line text-fg-faint hover:text-fg hover:bg-bg-hi",children:"+ assign agent"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] uppercase tracking-wide text-fg-faint mb-1.5 font-mono",children:"opening framing — sent before the human's goal"}),e.jsx("pre",{className:"text-xs text-fg-dim whitespace-pre-wrap bg-bg-elev border border-line rounded p-3 leading-relaxed font-sans",children:f.initialPromptTemplate})]})]})}export{q as TagLibrary};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aK as aa,aF as G,R as Pt,ap as R,z as Nf,am as If,_ as Rf}from"./index-AVrhGmUO.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{
|
|
1
|
+
import{ap as r}from"./index-AVrhGmUO.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{
|
|
1
|
+
import{ap as r}from"./index-AVrhGmUO.js";function n({options:t,active:o,onChange:i}){return r.jsx("div",{className:"flex rounded border border-line overflow-hidden",children:t.map(({key:e,label:s})=>r.jsx("button",{onClick:()=>i(e),className:`px-2 py-0.5 text-xs ${o===e?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:s},e))})}export{n as V};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bi as s}from"./index-AVrhGmUO.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};
|