claude-code-session-manager 0.71.0 → 0.73.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/dist/assets/{AgentLibrary-B1lh6YEM.js → AgentLibrary-BowrgaXK.js} +1 -1
- package/dist/assets/{History-B1jNdKFk.js → History-B8rJXcxk.js} +1 -1
- package/dist/assets/{Hooks-BWHFkF7z.js → Hooks-D-KzXjDk.js} +1 -1
- package/dist/assets/{HostBilko-CYQt0b-t.js → HostBilko-BSJhBE9I.js} +1 -1
- package/dist/assets/{Library-DZVKlOBQ.js → Library-CtqgqUc6.js} +1 -1
- package/dist/assets/{ListDetail-rBF1ZQv8.js → ListDetail-D7k4TXvO.js} +1 -1
- package/dist/assets/{MarkdownEditor-zS0QmHxL.js → MarkdownEditor-DFm0I9B_.js} +1 -1
- package/dist/assets/{McpServers-BA54nZee.js → McpServers-DDK04FMq.js} +1 -1
- package/dist/assets/{Memory-DN97rjG5.js → Memory-B1p59Mas.js} +1 -1
- package/dist/assets/{Panel-DLn9L0Cv.js → Panel-BJpqcDzp.js} +1 -1
- package/dist/assets/{Permissions-BnDRq-EM.js → Permissions-CFC3RusZ.js} +1 -1
- package/dist/assets/{Plugins-aPC4a4Bi.js → Plugins-TeCQMr6X.js} +2 -2
- package/dist/assets/{ProvenanceBadge-Bc1gskID.js → ProvenanceBadge-BfIzSRrY.js} +1 -1
- package/dist/assets/{SaveBar-CjvWkRaQ.js → SaveBar-7SmNcZB-.js} +1 -1
- package/dist/assets/{Scheduler-86oyi_P2.js → Scheduler-B9ovEniK.js} +1 -1
- package/dist/assets/{ScopeSwitcher-DJvnhSk3.js → ScopeSwitcher-KmemfTLa.js} +1 -1
- package/dist/assets/Settings-CxZijd66.js +3 -0
- package/dist/assets/{SkillReferenceGraph-CZjMRk3z.js → SkillReferenceGraph-BhACzgW7.js} +1 -1
- package/dist/assets/{Skills-EueUDa9X.js → Skills-CFZU6ltE.js} +1 -1
- package/dist/assets/{SystemPrompt-BQQudmyk.js → SystemPrompt-3tHpyoge.js} +1 -1
- package/dist/assets/{TagLibrary-BEAqaJlp.js → TagLibrary-BoJHe-aY.js} +1 -1
- package/dist/assets/{TiptapBody-DKmVDGB5.js → TiptapBody-DzlxVXaw.js} +1 -1
- package/dist/assets/{Toggle-B7Qb5e2O.js → Toggle-DKmoif0X.js} +1 -1
- package/dist/assets/{index-l-hKv9ou.js → index-Dtv0whpT.js} +671 -671
- package/dist/assets/{index-CNmekpRK.css → index-N_v_4fqC.css} +1 -1
- package/dist/assets/{settingsSchema-DEW4x9LG.js → settingsSchema-CW-0QfXi.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/scripts/lib/activeSessions.cjs +10 -1
- package/src/main/__tests__/chatRunner-epic-worktree-execcwd.test.cjs +125 -0
- package/src/main/__tests__/pty-epic-worktree-spawn-cwd.test.cjs +156 -0
- package/src/main/__tests__/queueOpsArchiveDestination.test.cjs +65 -0
- package/src/main/__tests__/stop-signal-anchor.test.cjs +75 -0
- package/src/main/chatRunner.cjs +11 -1
- package/src/main/index.cjs +12 -6
- package/src/main/ipcSchemas.cjs +35 -0
- package/src/main/lib/__tests__/epicSpawnCwd.test.cjs +193 -0
- package/src/main/lib/__tests__/epicWorktreeBoot.test.cjs +136 -0
- package/src/main/lib/__tests__/epicWorktreeMerge.test.cjs +130 -0
- package/src/main/lib/__tests__/epicWorktreeMint.test.cjs +115 -0
- package/src/main/lib/__tests__/epicWorktreeProjectConfig.test.cjs +79 -0
- package/src/main/lib/__tests__/gitWorktree.test.cjs +400 -0
- package/src/main/lib/__tests__/opsRootAbsoluteCwd.test.cjs +126 -0
- package/src/main/lib/__tests__/terminalRunOutcome.test.cjs +82 -0
- package/src/main/lib/epicSpawnCwd.cjs +95 -0
- package/src/main/lib/epicWorktreeBoot.cjs +49 -0
- package/src/main/lib/epicWorktreeMerge.cjs +63 -0
- package/src/main/lib/epicWorktreeMint.cjs +54 -0
- package/src/main/lib/epicWorktreeProjectConfig.cjs +102 -0
- package/src/main/lib/gitWorktree.cjs +446 -0
- package/src/main/lib/jobWorktree.cjs +36 -293
- package/src/main/lib/promptSessionSchema.cjs +15 -0
- package/src/main/lib/queueStore.cjs +18 -0
- package/src/main/lib/terminalRunOutcome.cjs +14 -2
- package/src/main/pty.cjs +11 -1
- package/src/main/queueOps.cjs +40 -12
- package/src/main/scheduler.cjs +14 -0
- package/src/preload/api.d.ts +59 -0
- package/src/preload/index.cjs +22 -0
- package/dist/assets/Settings-B7_1p_xA.js +0 -3
package/src/preload/api.d.ts
CHANGED
|
@@ -1650,6 +1650,19 @@ export interface SessionManagerAPI {
|
|
|
1650
1650
|
* additive step 1 of a two-PRD chain; a later PRD routes
|
|
1651
1651
|
* createPromptSession through this. */
|
|
1652
1652
|
create: (payload: PromptSessionsCreateEpicPayload) => Promise<PromptSessionsCreateEpicResult>;
|
|
1653
|
+
/** Creates this Epic's isolated `git worktree` checkout
|
|
1654
|
+
* (lib/epicWorktreeMint.cjs) — resolves to the `worktree` field shape on
|
|
1655
|
+
* success, or null on any failure (never rejects). */
|
|
1656
|
+
createWorktree: (payload: PromptSessionsCreateWorktreePayload) => Promise<PromptSessionsCreateWorktreeResult | null>;
|
|
1657
|
+
/** Folds an Epic's isolated git worktree branch back into its owning
|
|
1658
|
+
* project's main tree (lib/epicWorktreeMerge.cjs) — the ONLY point
|
|
1659
|
+
* where PRD 1033's per-Epic isolation resolves back into the shared
|
|
1660
|
+
* tree. Never rejects. */
|
|
1661
|
+
mergeToMain: (payload: PromptSessionsMergeToMainPayload) => Promise<PromptSessionsMergeToMainResult>;
|
|
1662
|
+
/** Reads the per-project "disable Epic worktree isolation" UI toggle. */
|
|
1663
|
+
getWorktreeDisabled: (payload: PromptSessionsGetWorktreeDisabledPayload) => Promise<PromptSessionsGetWorktreeDisabledResult>;
|
|
1664
|
+
/** Writes the per-project "disable Epic worktree isolation" UI toggle. */
|
|
1665
|
+
setWorktreeDisabled: (payload: PromptSessionsSetWorktreeDisabledPayload) => Promise<PromptSessionsSetWorktreeDisabledResult>;
|
|
1653
1666
|
};
|
|
1654
1667
|
}
|
|
1655
1668
|
|
|
@@ -1696,6 +1709,52 @@ export interface PromptSessionsCreateEpicResult {
|
|
|
1696
1709
|
session: Record<string, unknown>;
|
|
1697
1710
|
}
|
|
1698
1711
|
|
|
1712
|
+
// ─────────────────────────────────── PromptSessions create-worktree (main-side createEpicWorktree)
|
|
1713
|
+
export interface PromptSessionsCreateWorktreePayload {
|
|
1714
|
+
cwd: string;
|
|
1715
|
+
epicId: string;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
export interface PromptSessionsCreateWorktreeResult {
|
|
1719
|
+
dir: string;
|
|
1720
|
+
branch: string;
|
|
1721
|
+
baseCwd: string;
|
|
1722
|
+
status: 'active' | 'needs_merge_resolution' | 'merged' | 'disabled';
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
// ─────────────────────────────────── PromptSessions merge-to-main (main-side integrateEpicBranch)
|
|
1726
|
+
export interface PromptSessionsMergeToMainPayload {
|
|
1727
|
+
cwd: string;
|
|
1728
|
+
epicId: string;
|
|
1729
|
+
branch: string;
|
|
1730
|
+
dir: string;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
export interface PromptSessionsMergeToMainResult {
|
|
1734
|
+
ok: boolean;
|
|
1735
|
+
status: 'merged' | 'needs_merge_resolution';
|
|
1736
|
+
integrated?: boolean;
|
|
1737
|
+
reason?: string;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
// ─────────────────────────────────── PromptSessions per-project worktree-isolation toggle
|
|
1741
|
+
export interface PromptSessionsGetWorktreeDisabledPayload {
|
|
1742
|
+
cwd: string;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
export interface PromptSessionsGetWorktreeDisabledResult {
|
|
1746
|
+
disabled: boolean;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
export interface PromptSessionsSetWorktreeDisabledPayload {
|
|
1750
|
+
cwd: string;
|
|
1751
|
+
disabled: boolean;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
export interface PromptSessionsSetWorktreeDisabledResult {
|
|
1755
|
+
disabled: boolean;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1699
1758
|
// ─────────────────────────────────── PromptSession event-appended broadcast
|
|
1700
1759
|
|
|
1701
1760
|
export interface PromptSessionEventAppendedPayload {
|
package/src/preload/index.cjs
CHANGED
|
@@ -417,5 +417,27 @@ contextBridge.exposeInMainWorld('api', {
|
|
|
417
417
|
* additive step 1 of a two-PRD chain; a later PRD routes
|
|
418
418
|
* createPromptSession through this. */
|
|
419
419
|
create: (payload) => ipcRenderer.invoke('promptSessions:create-epic', payload),
|
|
420
|
+
/** Creates this Epic's isolated `git worktree` checkout (main-side
|
|
421
|
+
* gitWorktree.cjs's createEpicWorktree) — called fire-and-forget from
|
|
422
|
+
* approveProposed at the proposed->active transition. Resolves to the
|
|
423
|
+
* `worktree` field shape on success, or null (not a repo / dirty base
|
|
424
|
+
* tree / disabled / cap reached) — never rejects. */
|
|
425
|
+
createWorktree: (payload) => ipcRenderer.invoke('promptSessions:create-worktree', payload),
|
|
426
|
+
/** Folds an Epic's isolated git worktree branch back into its owning
|
|
427
|
+
* project's main tree (main-side gitWorktree.cjs's integrateEpicBranch,
|
|
428
|
+
* via lib/epicWorktreeMerge.cjs) — the ONLY point where PRD 1033's
|
|
429
|
+
* per-Epic isolation resolves back into the shared tree. Never rejects:
|
|
430
|
+
* resolves `{ ok: true, status: 'merged', integrated }` on a clean
|
|
431
|
+
* merge (worktree cleaned up), or `{ ok: false, status:
|
|
432
|
+
* 'needs_merge_resolution', reason }` on a real conflict (branch +
|
|
433
|
+
* worktree dir left intact for manual resolution). */
|
|
434
|
+
mergeToMain: (payload) => ipcRenderer.invoke('promptSessions:merge-to-main', payload),
|
|
435
|
+
/** Reads the per-project "disable Epic worktree isolation" UI toggle
|
|
436
|
+
* (main-side epicWorktreeProjectConfig.cjs). */
|
|
437
|
+
getWorktreeDisabled: (payload) => ipcRenderer.invoke('promptSessions:get-worktree-disabled', payload),
|
|
438
|
+
/** Writes the per-project "disable Epic worktree isolation" UI toggle —
|
|
439
|
+
* the UI-reachable equivalent of setting SM_EPIC_WORKTREE_DISABLE=1 for
|
|
440
|
+
* just this one project rather than machine-wide. */
|
|
441
|
+
setWorktreeDisabled: (payload) => ipcRenderer.invoke('promptSessions:set-worktree-disabled', payload),
|
|
420
442
|
},
|
|
421
443
|
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a5 as p,_ as e,S,a as q,g as M,ap as Z,R as Y,ak as Q,as as $,am as X,ah as R,J as ee,V as te,r as F}from"./index-l-hKv9ou.js";import{P as se}from"./Panel-DLn9L0Cv.js";import{S as ae}from"./ScopeSwitcher-DJvnhSk3.js";import{S as re}from"./SaveBar-CjvWkRaQ.js";import{u as ne,m as le,p as ie,a as G,E as oe,s as ce}from"./settingsSchema-DEW4x9LG.js";import{T as U}from"./Toggle-B7Qb5e2O.js";import"./monaco-editor-BW5C4Iv1.js";const de=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle","permissions"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Model allow/override lists, reasoning depth, and fast-mode toggles — machine-wide, with no per-Epic override yet. An Epic's Agent persona model (Agent Library) still wins over Essentials' plain model default.",advanced:!0,keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],ue={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function J(a){return a.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((l,r)=>{const n=ue[l];return n||(r===0?l.charAt(0).toUpperCase()+l.slice(1):l)}).join(" ")}function B(a){const s=new Set,t=[];for(const r of de){const n=r.keys.filter(i=>a.has(i));n.forEach(i=>s.add(i)),n.length!==0&&t.push({id:r.id,title:r.title,summary:r.summary,advanced:!!r.advanced,keys:n})}const l=Array.from(a).filter(r=>!s.has(r)&&r!=="$schema").sort();return l.length>0&&t.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:l}),t}function pe(a,s){return B(a).map(t=>({id:t.id,title:t.title,advanced:t.advanced,total:t.keys.length,setCount:t.keys.filter(l=>s.has(l)).length}))}const xe={};function K(a,s){if(s)return{text:s,authored:!1};const t=xe[a];return t?{text:t,authored:!0}:null}const me={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"},fe=["user","project","local","default"],ge={user:"user",project:"project",local:"local",default:"default"};function he({node:a,targetScope:s,onOverride:t,schema:l}){const[r,n]=p.useState(""),[i,x]=p.useState(!1),[m,j]=p.useState(!0),u=a.kind==="object"?a:null,k=u?Object.keys(u.children):[],h=l.rootKeys(),N=new Set([...k,...h]),f=p.useMemo(()=>B(N),[Array.from(N).sort().join(",")]),b=p.useMemo(()=>pe(N,new Set(k)),[Array.from(N).sort().join(","),k.join(",")]),[C,E]=p.useState(null),c=p.useRef(null),w=o=>{const g=f.find(y=>y.id===o);g!=null&&g.advanced&&!i&&x(!0),E(o)};p.useEffect(()=>{if(!C)return;E(null);const o=c.current,g=document.getElementById(`settings-group-${C}`);if(!o||!g)return;const y=g.getBoundingClientRect().top-o.getBoundingClientRect().top;o.scrollBy({top:y,behavior:"smooth"})},[C]);const v=p.useMemo(()=>f.filter(o=>i||!o.advanced).map(o=>({...o,keys:o.keys.filter(g=>{const y=(u==null?void 0:u.children[g])!==void 0;if(!m&&!y)return!1;if(!r.trim())return!0;const T=l.at([g]);return[g,J(g),(T==null?void 0:T.description)??""].join(" ").toLowerCase().includes(r.toLowerCase())})})).filter(o=>o.keys.length>0),[f,r,i,m,u,l]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:"text-fg-faint",children:["writing overrides to"," ",e.jsx("span",{className:"text-fg-dim font-medium",children:S[s].label})]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:o=>j(o.target.checked),className:"accent-accent"}),"show not-yet-configured"]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:o=>x(o.target.checked),className:"accent-accent"}),"show advanced"]}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:r,onChange:o=>n(o.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(be,{groups:b,onJump:w}),e.jsxs("div",{ref:c,className:"flex-1 overflow-auto py-3",children:[v.map(o=>e.jsx(ye,{id:o.id,title:o.title,summary:o.summary,advanced:o.advanced,children:o.keys.map(g=>{const y=u==null?void 0:u.children[g],T=l.at([g]);return e.jsx(ve,{keyName:g,node:y,info:T,targetScope:s,onOverride:(d,P)=>t([g],d,P)},g)})},o.id)),v.length===0&&e.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',r,'"']})]})]})]})}function be({groups:a,onJump:s}){return e.jsx("nav",{className:"shrink-0 w-48 border-r border-line bg-bg-elev/30 overflow-y-auto py-3",children:a.map(t=>e.jsxs("button",{onClick:()=>s(t.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bg-hi transition-colors",title:`jump to ${t.title}`,children:[e.jsx(q,{name:me[t.id]??"dot",size:15,className:"text-fg-faint shrink-0"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-fg-dim",children:t.title}),e.jsxs("span",{className:"text-[10px] text-fg-faint font-mono shrink-0",children:[t.setCount,"/",t.total]})]},t.id))})}function ye({id:a,title:s,summary:t,advanced:l,children:r}){const[n,i]=p.useState(!0);return e.jsxs("section",{id:`settings-group-${a}`,className:"mx-4 mb-4 rounded-lg border border-line shadow-sm bg-bg-elev/50 overflow-hidden",children:[e.jsxs("header",{className:"px-4 py-3 bg-bg-elev cursor-pointer hover:bg-bg-hi flex items-center gap-3 border-b border-line",onClick:()=>i(!n),children:[e.jsx("span",{className:"text-fg-faint w-3",children:n?"▾":"▸"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-fg text-base font-semibold",children:s}),l&&e.jsx("span",{className:"text-[9px] px-1.5 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"advanced"})]}),e.jsx("p",{className:"text-fg-dim text-sm mt-0.5",children:t})]})]}),n&&e.jsx("div",{className:"divide-y divide-line/60",children:r})]})}function ve({keyName:a,node:s,info:t,targetScope:l,onOverride:r}){const[n,i]=p.useState(!1),[x,m]=p.useState(!1),j=J(a),u=s!==void 0,h=(s==null?void 0:s.kind)==="leaf"?s:null,N=(s==null?void 0:s.kind)==="object"||(s==null?void 0:s.kind)==="array",f=t==null?void 0:t.default,b=h&&f!==void 0&&z(h.value,f),C=Te({isSet:u,leafNode:h,defaultVal:f,isDefault:!!b,node:s}),E=je(h,f),c=E.length>=2,w=!!h&&!b,v=K(a,t==null?void 0:t.description);return e.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{onClick:()=>i(!n),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:n?"collapse":"expand",children:n?"▾":"▸"}),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:j}),e.jsx(Oe,{kind:C.kind,label:C.label}),c&&e.jsxs("button",{onClick:o=>{o.stopPropagation(),n||i(!0),m(g=>!g)},className:"text-[9px] px-1.5 py-0 rounded border border-blue-900/40 bg-blue-950/30 text-blue-300/90 uppercase tracking-wide hover:bg-blue-900/40",title:"this key is defined in multiple scopes — click to expand",children:["drift · ",E.map(o=>ge[o]).join(" · ")]}),w&&h&&e.jsx("button",{onClick:o=>{o.stopPropagation(),r(void 0,h.winner)},className:"text-[9px] px-1.5 py-0 rounded border border-line bg-bg-elev text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`reset · delete from ${S[h.winner].label}`,children:"↺ reset"}),(t==null?void 0:t.deprecated)&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"deprecated"}),(t==null?void 0:t.required)&&!u&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-red-900/40 bg-red-950/30 text-red-400/80 uppercase tracking-wide",children:"required"})]}),v&&e.jsx("p",{className:`text-fg-dim text-xs mt-0.5 leading-relaxed ${v.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:v.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:Pe(v.text)}),n&&x&&h&&e.jsx(Ne,{leaf:h,defaultVal:f,onReset:o=>r(void 0,o)}),n&&e.jsx(we,{keyName:a,node:s,info:t,targetScope:l,onOverride:o=>r(o)})]}),e.jsx("div",{className:"shrink-0",children:!n&&e.jsx(Ee,{node:s,info:t,onSet:o=>{r(o)},disabled:N&&u})})]})})}function je(a,s){if(!a)return[];const t=new Set;t.add(a.winner);for(const l of a.shadowed)t.add(l.scope);return s!==void 0&&t.add("default"),fe.filter(l=>t.has(l))}function Ne({leaf:a,defaultVal:s,onReset:t}){const l={};l[a.winner]={value:a.value,winner:!0};for(const r of a.shadowed)l[r.scope]={value:r.value,winner:!1};return e.jsxs("div",{className:"mt-2 border border-line rounded bg-bg-elev/40 text-xs",children:[e.jsx("div",{className:"px-2 py-1 text-fg-faint border-b border-line/60",children:"Values across all scopes (winner highlighted · reset removes that scope's value):"}),e.jsxs("div",{className:"divide-y divide-line/60",children:[["user","project","local"].map(r=>{const n=l[r],i=n!==void 0;return e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:S[r].label}),e.jsx("span",{className:`font-mono truncate ${n!=null&&n.winner?"text-accent":"text-fg-dim"}`,children:i?A(n.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),i?e.jsx("button",{onClick:()=>t(r),className:"text-[9px] px-1.5 py-0 rounded border border-line text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`delete this key from ${S[r].label}`,children:"↺"}):e.jsx("span",{})]},r)}),e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:"Default"}),e.jsx("span",{className:"font-mono text-fg-dim truncate",children:s!==void 0?A(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function we({keyName:a,node:s,info:t,targetScope:l,onOverride:r}){const i=(s==null?void 0:s.kind)==="leaf"?s:null,x=K(a,t==null?void 0:t.description);return e.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[x&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${x.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:x.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:x.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(t==null?void 0:t.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(t.type)?t.type.join(" | "):t.type})]}),(t==null?void 0:t.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:A(t.default)})]}),(t==null?void 0:t.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:t.enum.map(m=>String(m)).join(" | ")})]}),i&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Current"}),e.jsxs("dd",{className:"font-mono",children:[e.jsx("span",{className:"text-fg-dim",children:A(i.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",S[i.winner].label]})]})]}),i&&i.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:i.shadowed.map((m,j)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[A(m.value)," —"," ",e.jsx("span",{className:"no-underline",children:S[m.scope].label})]},j))})]}),(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(ke,{keyName:a,node:s,info:t,onChange:r,targetScope:l})})]})}function ke({node:a,info:s,onChange:t,targetScope:l}){const n=(a==null?void 0:a.kind)==="leaf"?a.value:s==null?void 0:s.default,i=V(s==null?void 0:s.type);if(i==="boolean"){const x=n===!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:m,label:j})=>e.jsx("button",{onClick:()=>t(m),className:`px-3 py-0.5 text-xs transition-colors ${x===m?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:j},j))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[l].label]})]})}return s!=null&&s.enum?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-fg-faint",children:"Choose:"}),s.enum.map(x=>{const m=z(n,x);return e.jsx("button",{onClick:()=>t(x),className:`px-2 py-0.5 text-xs rounded border ${m?"bg-accent text-bg border-accent":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,children:String(x)},String(x))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[l].label]})]}):i==="integer"||i==="number"?e.jsx(Se,{value:typeof n=="number"?n:void 0,integer:i==="integer",onCommit:t,target:S[l].label}):i==="string"?e.jsx(Ce,{value:typeof n=="string"?n:"",onCommit:t,target:S[l].label}):e.jsxs("div",{className:"text-fg-faint",children:["Complex value (",i??"object/array",") — use the"," ",e.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function Se({value:a,integer:s,onCommit:t,target:l}){const[r,n]=p.useState(a!==void 0?String(a):""),i=()=>{const x=s?parseInt(r,10):parseFloat(r);Number.isNaN(x)||t(x)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("input",{type:"number",value:r,onChange:x=>n(x.target.value),onBlur:i,onKeyDown:x=>{x.key==="Enter"&&x.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:i,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",l]})]})}function Ce({value:a,onCommit:s,target:t}){const[l,r]=p.useState(a);return e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"text-fg-faint shrink-0",children:"Set to:"}),e.jsx("input",{type:"text",value:l,onChange:n=>r(n.target.value),onKeyDown:n=>{n.key==="Enter"&&s(l)},className:"flex-1 min-w-0 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:()=>s(l),className:"shrink-0 px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",t]})]})}function Ee({node:a,info:s,onSet:t,disabled:l}){const r=(a==null?void 0:a.kind)==="leaf",n=V(s==null?void 0:s.type);if(l)return null;if(n==="boolean"){const i=r&&a.value===!0;return e.jsx("button",{onClick:()=>t(!i),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${i?"bg-accent/15 text-accent border-accent/40 hover:bg-accent hover:text-bg":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,title:"toggle",children:i?"on":"off"})}return null}function Te({isSet:a,leafNode:s,defaultVal:t,isDefault:l,node:r}){return a?(r==null?void 0:r.kind)==="array"?{kind:"accumulated",label:`${r.items.length} items`}:(r==null?void 0:r.kind)==="object"?{kind:"set",label:"configured"}:s?l?{kind:"default",label:`= default · ${S[s.winner].label}`}:s.shadowed.length>0?{kind:"override",label:`overriding ${s.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${S[s.winner].label}`}:{kind:"set",label:"configured"}:t!==void 0?{kind:"default",label:`using default: ${A(t)}`}:{kind:"unset",label:"not configured"}}function Oe({kind:a,label:s}){const t={set:"bg-accent/15 text-accent border-accent/30",default:"bg-bg-hi text-fg-dim border-line",unset:"bg-bg-elev text-fg-faint border-line",override:"bg-purple-950/30 text-purple-400/80 border-purple-900/40",accumulated:"bg-blue-950/30 text-blue-400/80 border-blue-900/40"}[a];return e.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${t}`,children:s})}function V(a){if(a)return Array.isArray(a)?a.find(t=>t!=="null")??a[0]:a}function z(a,s){return a===s?!0:typeof a!=typeof s?!1:a&&s&&typeof a=="object"?JSON.stringify(a)===JSON.stringify(s):!1}function Pe(a){const s=a.trim().split(`
|
|
2
|
-
`)[0],t=s.match(/^([^.!?]+[.!?])/);return t?t[1]:s.length>120?s.slice(0,120)+"…":s}function A(a){if(typeof a=="string")return a===""?'""':JSON.stringify(a);if(a===null)return"null";if(a===void 0)return"—";if(typeof a=="object"){const s=JSON.stringify(a);return s.length>60?s.slice(0,60)+"…":s}return String(a)}function Ae(){const[a,s]=p.useState(null),[t,l]=p.useState(null),[r,n]=p.useState(null),[i,x]=p.useState(null),[m,j]=p.useState(!1),[u,k]=p.useState(null),[h,N]=p.useState(null);if(p.useEffect(()=>{let c=!1;return Promise.all([window.api.otel.getConfig(),window.api.otel.status(),window.api.otel.configPath()]).then(([w,v,o])=>{c||(s(w),n(w),l(v),x(o))}).catch(w=>{console.warn("[telemetry] load failed:",w==null?void 0:w.message)}),()=>{c=!0}},[]),!r||!a)return e.jsx(M,{title:"loading…"});const f=JSON.stringify(r)!==JSON.stringify(a),b=(c,w)=>{k(null),n({...r,[c]:w})},C=async()=>{j(!0),k(null);try{const c=await window.api.otel.setConfig(r);!c.ok&&c.error&&k(c.error),s(c.config),n(c.config),l(c.status),N(Date.now())}catch(c){k(c instanceof Error?c.message:String(c))}finally{j(!1)}},E=()=>{k(null),n(a)};return e.jsxs("div",{className:"p-4 max-w-3xl space-y-5 text-sm",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Telemetry — OpenTelemetry export"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"When enabled, every classified transcript event (tool_use, todo_write, plan, usage, agent_spawn) is mirrored as a 0-duration OTLP/HTTP span. Point this at a local collector (Jaeger, Grafana Tempo, SigNoz, Honeycomb) for cross-session analysis."}),i&&e.jsxs("p",{className:"text-fg-faint text-[11px]",children:["stored at ",e.jsx("span",{className:"font-mono",children:i})]})]}),e.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Export transcripts to OTEL"}),e.jsx("div",{className:"text-fg-faint text-xs",children:"Toggle off to disable all span emission immediately."})]}),e.jsx(U,{checked:r.enabled,onChange:c=>b("enabled",c),label:r.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:r.endpoint,onChange:c=>b("endpoint",c.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:r.headers,onChange:c=>b("headers",c.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:r.serviceName,onChange:c=>b("serviceName",c.target.value),placeholder:"session-manager",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("div",{className:"flex items-start justify-between gap-3 pt-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Include content (PII)"}),e.jsxs("div",{className:"text-fg-faint text-xs leading-relaxed",children:["Adds tool inputs, plan text, and agent prompts to span attributes. Off by default — matches upstream Claude Code's ",e.jsx("span",{className:"font-mono",children:"OTEL_LOG_USER_PROMPTS"})," opt-in."]})]}),e.jsx(U,{checked:r.includeContent,onChange:c=>b("includeContent",c),label:r.includeContent?"on":"off"})]})]}),t&&e.jsxs("section",{className:"border border-line rounded p-3 text-xs space-y-1",children:[e.jsx("div",{className:"text-fg-dim",children:"Runtime status"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"enabled:"})," ",e.jsx("span",{className:t.enabled?"text-accent":"text-fg-dim",children:String(t.enabled)})]}),t.error&&e.jsxs("div",{className:"text-red-400 break-words",children:[e.jsx("span",{className:"text-fg-faint",children:"error:"})," ",t.error]}),!t.error&&t.enabled&&e.jsx("div",{className:"text-fg-faint",children:"spans batched and exported in the background. Verify by enabling and pointing at a local Jaeger."})]}),e.jsxs("footer",{className:"flex items-center gap-3 pt-2 border-t border-line",children:[e.jsx("button",{onClick:C,disabled:!f||m,className:"px-3 py-1 text-xs rounded bg-accent text-bg disabled:opacity-50 disabled:cursor-not-allowed",children:m?"saving…":"Save"}),e.jsx("button",{onClick:E,disabled:!f||m,className:"px-3 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg disabled:opacity-50 disabled:cursor-not-allowed",children:"Revert"}),u&&e.jsx("span",{className:"text-red-400 text-xs",children:u}),!u&&h&&!f&&e.jsx("span",{className:"text-fg-faint text-xs",children:"saved"})]})]})}function Re(){const{model:a,setModel:s}=Z();return e.jsxs("div",{className:"p-4 max-w-3xl space-y-5 text-sm",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Session Manager preferences"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"Native app preferences, stored locally — not part of Claude Code's own settings."})]}),e.jsx("section",{className:"border border-line rounded p-3 space-y-3",children:e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Default model for raw sessions"}),e.jsx("select",{value:a,onChange:t=>s(t.target.value),className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs",children:Y.map(t=>e.jsx("option",{value:t,children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsx("span",{className:"text-fg-faint text-[11px]",children:"Used when opening a raw interactive session without an explicit per-launch override."})]})})]})}const H={user:{title:"Global settings",body:"This is the real ~/.claude/settings.json on disk — the same file the claude CLI reads on every session it starts. Edits apply machine-wide, to every project and every session."},project:{title:"Project settings",body:"This is the real <project>/.claude/settings.json on disk, checked into git. Edits apply to every current and future session in this project, for anyone who clones it."},local:{title:"Local settings",body:"This is the real <project>/.claude/settings.local.json on disk, gitignored. Edits apply to every current and future session in this project, on this machine only."}};function Me(){const a=Q(),s=$(d=>d.tabs),t=$(d=>d.activeTabId),l=s.find(d=>d.id===t)??null,r=(l==null?void 0:l.cwd)??null,n=X(d=>d.navFace),i=p.useRef(!1),x=p.useRef(n),[m,j]=p.useState(()=>n==="project"&&r?"project":"user"),[u,k]=p.useState("effective");p.useEffect(()=>{if(x.current!==n){if(x.current=n,i.current){i.current=!1;return}j(n==="project"&&r?"project":"user")}},[n,r]),p.useEffect(()=>{n==="project"&&(u==="telemetry"||u==="app")&&k("effective")},[n,u]);const h=d=>{i.current=!0,j(d)},N=ne(F,a,r),f=N[m]??null,b=R(d=>d.files),C=R(d=>d.setDraft),E=R(d=>d.saveJson),c=R(d=>d.revert),[w,v]=p.useState(null),o=p.useMemo(()=>le(ie(b,N)),[b,N]),g=(d,P,O)=>{var D;const I=N[O??m];if(!I)return;v(null);const _=((D=b[I])==null?void 0:D.draftRaw)??"";let L={};if(_.trim())try{L=JSON.parse(_)}catch{L={}}const W=ce(L,d,P);C(I,JSON.stringify(W,null,2)+`
|
|
3
|
-
`)};if(!a)return e.jsx(M,{title:"loading…"});const y=f?b[f]:null,T=d=>d!=="user"&&!r;return e.jsx(se,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(te,{options:[{key:"effective",label:"Guided"},{key:"tree",label:"Tree"},{key:"raw",label:"Raw"},...n==="home"?[{key:"telemetry",label:"Telemetry"},{key:"app",label:"Session Manager"}]:[]],active:u,onChange:k}),u!=="telemetry"&&u!=="app"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx(ae,{scopes:F.scopes,active:m,onChange:h,annotate:d=>{if(T(d))return{exists:!1};const P=N[d];if(!P)return null;const O=b[P];return{exists:(O==null?void 0:O.exists)??!1,dirty:(O==null?void 0:O.dirty)??!1}}}),e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:u==="effective"?`overrides → ${f??"—"}`:f??"—"})]}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"schema reference ↗"})]}),footer:u!=="telemetry"&&u!=="app"&&f&&y?e.jsx(re,{dirty:y.dirty,busy:y.busy,parseError:w||y.parseError,lastSavedAt:y.lastSavedAt,leading:y.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{v(null);const d=await E(f);d.ok||v(d.error??"save failed")},onRevert:()=>{v(null),c(f)}}):null,children:u==="telemetry"?e.jsx(Ae,{}):u==="app"?e.jsx(Re,{}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"settings-scope-note",className:"sticky top-0 z-10 border-b border-line bg-bg-elev px-3 py-2 text-[11.5px] leading-snug",children:[e.jsx("span",{className:"font-semibold text-fg",children:H[m].title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:H[m].body}),f&&e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:f})]}),T(m)?e.jsx(M,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"}):u==="effective"?e.jsx(he,{node:o,targetScope:m,onOverride:g,schema:G()}):u==="tree"?e.jsx(oe,{node:o,targetScope:m,onOverride:g,schema:G()}):f&&y?e.jsx(ee,{path:f,value:y.draftRaw,onChange:d=>{v(null),C(f,d)}}):e.jsx(M,{title:"resolving…"})]})})}const He=p.memo(Me);export{H as SETTINGS_SCOPE_NOTES,He as Settings};
|