claude-code-session-manager 0.83.0 → 0.85.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-B-OM-4gk.js → AgentLibrary-Bkv-HcP1.js} +1 -1
- package/dist/assets/{DataModel-BC6ppcBr.js → DataModel-DRH-Ty20.js} +1 -1
- package/dist/assets/{History-D3Qw2BWn.js → History-CfRhT1Im.js} +2 -2
- package/dist/assets/{Hooks-OxBQ0nIc.js → Hooks-wEmh_U6c.js} +1 -1
- package/dist/assets/{HostBilko-BNFC6bNZ.js → HostBilko-D_t7Rbi7.js} +1 -1
- package/dist/assets/{Library-DAMyrUtY.js → Library-CpArQ-OJ.js} +1 -1
- package/dist/assets/{ListDetail-BwywrpvE.js → ListDetail-pjaKYs84.js} +1 -1
- package/dist/assets/{MarkdownEditor-HEwjN1bp.js → MarkdownEditor-Xc141kjj.js} +1 -1
- package/dist/assets/{McpServers-D1VZF7Ix.js → McpServers-ftqaV3kn.js} +1 -1
- package/dist/assets/{Memory-CgYJ_QqD.js → Memory-ChMWkNd0.js} +6 -6
- package/dist/assets/{Panel-dTNWC59Q.js → Panel-D9Kr40Ai.js} +1 -1
- package/dist/assets/{Permissions-qI_NKi1b.js → Permissions-DKoNVgzj.js} +1 -1
- package/dist/assets/{Plugins-DZ0_CHiF.js → Plugins-BtChISho.js} +2 -2
- package/dist/assets/{ProvenanceBadge-B2i_uxCu.js → ProvenanceBadge-DBA5EcYy.js} +1 -1
- package/dist/assets/{SaveBar-4tNMCjUd.js → SaveBar-I0_dWNTX.js} +1 -1
- package/dist/assets/{Scheduler-CUen18Gc.js → Scheduler-CbES7MC8.js} +7 -7
- package/dist/assets/{ScopeSwitcher-Co3tkLTT.js → ScopeSwitcher-5GTEveb2.js} +1 -1
- package/dist/assets/Settings-BX3FElXk.js +3 -0
- package/dist/assets/{SkillReferenceGraph-BKcHtMPc.js → SkillReferenceGraph-DNBFGrYE.js} +1 -1
- package/dist/assets/{Skills-DHb4INtF.js → Skills-DJB6-bBM.js} +2 -2
- package/dist/assets/SystemPrompt-BiDDrJUA.js +1 -0
- package/dist/assets/{TagLibrary-xLP5dJvh.js → TagLibrary-_Wrevtop.js} +1 -1
- package/dist/assets/{TiptapBody-T-ULTjK4.js → TiptapBody-OWWXdLRy.js} +1 -1
- package/dist/assets/{Toggle-B-5M2hGe.js → Toggle-B122N0HL.js} +1 -1
- package/dist/assets/{index-CYhdtisq.css → index-CDo9xBR9.css} +1 -1
- package/dist/assets/{index-CzAxC432.js → index-DhvuQL4C.js} +316 -314
- package/dist/assets/{settingsSchema-C_nsemcF.js → settingsSchema-sGoCTd7J.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +4 -1
- package/scripts/hooks/guard-destructive-git.cjs +514 -0
- package/scripts/hooks/guard-inline-implementation.cjs +219 -0
- package/scripts/hooks/guard-prd-writes.cjs +200 -0
- package/src/main/__tests__/epicMintTelemetryTap.test.cjs +64 -0
- package/src/main/__tests__/health-delegation-chain.test.cjs +2 -1
- package/src/main/__tests__/health-queue-dispatch.test.cjs +84 -0
- package/src/main/__tests__/health-usage-poller.test.cjs +97 -0
- package/src/main/__tests__/health-worktree-cap-blocked.test.cjs +65 -0
- package/src/main/__tests__/opsErrorLogTelemetryTap.test.cjs +149 -0
- package/src/main/__tests__/pollLoop-dispatch-on-failure.test.cjs +120 -0
- package/src/main/__tests__/promptSessionTranscript.test.cjs +0 -0
- package/src/main/__tests__/queue-starvation-dispatch-driver.test.cjs +143 -0
- package/src/main/__tests__/rateLimitPollerStreak.test.cjs +79 -0
- package/src/main/__tests__/scheduleJobTransitionsTelemetryTap.test.cjs +72 -0
- package/src/main/__tests__/scheduler-inplace-salvage.test.cjs +74 -0
- package/src/main/__tests__/scheduler-job-overrun.test.cjs +58 -0
- package/src/main/__tests__/scheduler-notify-originating-tab-transcript.test.cjs +1 -0
- package/src/main/__tests__/scheduler-periodic-reverify-guard.test.cjs +134 -2
- package/src/main/__tests__/scheduler-reap-dead-running-jobs.test.cjs +33 -0
- package/src/main/__tests__/scheduler-stuck-failed-escalation.test.cjs +136 -0
- package/src/main/__tests__/telemetryClient.test.cjs +242 -1
- package/src/main/__tests__/telemetryContract.test.cjs +930 -0
- package/src/main/crashDiagnostics.cjs +29 -1
- package/src/main/health.cjs +197 -3
- package/src/main/index.cjs +65 -6
- package/src/main/ipcSchemas.cjs +19 -2
- package/src/main/lib/__tests__/crashTelemetry.test.cjs +103 -0
- package/src/main/lib/__tests__/delegationReadiness.test.cjs +302 -4
- package/src/main/lib/__tests__/fixtures/scheduler-machine.json.corrupt-1789147548 +34 -0
- package/src/main/lib/__tests__/gitWorktree.test.cjs +413 -1
- package/src/main/lib/__tests__/jobWorktreeBootLive.test.cjs +71 -0
- package/src/main/lib/__tests__/queueStoreAtomicWrite.test.cjs +88 -0
- package/src/main/lib/__tests__/queueStoreMachineStateRecovery.test.cjs +123 -0
- package/src/main/lib/__tests__/reaperHelpers.test.cjs +58 -0
- package/src/main/lib/__tests__/telemetryBacklog.test.cjs +626 -0
- package/src/main/lib/__tests__/telemetryBoot.test.cjs +123 -0
- package/src/main/lib/__tests__/telemetryConsent.test.cjs +136 -0
- package/src/main/lib/__tests__/telemetryCounters.test.cjs +57 -0
- package/src/main/lib/__tests__/telemetryCountersMetadataColumn.test.cjs +95 -0
- package/src/main/lib/crashTelemetry.cjs +37 -0
- package/src/main/lib/delegationReadiness.cjs +119 -1
- package/src/main/lib/epicMint.cjs +2 -0
- package/src/main/lib/gitWorktree.cjs +427 -17
- package/src/main/lib/jobWorktree.cjs +2 -1
- package/src/main/lib/jobWorktreeBootLive.cjs +51 -0
- package/src/main/lib/jobWorktreeTerminalOrphanLive.cjs +68 -0
- package/src/main/lib/opsErrorLog.cjs +78 -25
- package/src/main/lib/queueStore.cjs +241 -22
- package/src/main/lib/reaperHelpers.cjs +23 -1
- package/src/main/lib/scheduleJobSchema.cjs +7 -0
- package/src/main/lib/scheduleJobTransitions.cjs +12 -0
- package/src/main/lib/telemetryBacklog.cjs +601 -0
- package/src/main/lib/telemetryBoot.cjs +76 -0
- package/src/main/lib/telemetryClient.cjs +150 -5
- package/src/main/lib/telemetryConsent.cjs +34 -0
- package/src/main/lib/telemetryCounters.cjs +45 -0
- package/src/main/promptSessionTranscript.cjs +0 -0
- package/src/main/pty.cjs +2 -0
- package/src/main/scheduler.cjs +481 -33
- package/src/preload/api.d.ts +84 -4
- package/src/preload/index.cjs +9 -0
- package/dist/assets/Settings-DXVgKLUx.js +0 -3
- package/dist/assets/SystemPrompt-BjqFOHSk.js +0 -1
package/src/preload/api.d.ts
CHANGED
|
@@ -355,21 +355,23 @@ export interface DelegationReadinessCheck {
|
|
|
355
355
|
| 'dev-plugin'
|
|
356
356
|
| 'agent-personas'
|
|
357
357
|
| 'prd-write-guard'
|
|
358
|
-
| 'destructive-git-guard'
|
|
358
|
+
| 'destructive-git-guard'
|
|
359
|
+
| 'inline-implementation-guard';
|
|
359
360
|
label: string;
|
|
360
361
|
ok: boolean;
|
|
361
362
|
detail: string;
|
|
362
363
|
fix: string | null;
|
|
363
364
|
/** Non-null when Session Manager can install this fix itself, one press. */
|
|
364
|
-
fixAction: 'install-prd-write-guard' | 'install-destructive-git-guard' | null;
|
|
365
|
+
fixAction: 'install-prd-write-guard' | 'install-destructive-git-guard' | 'install-inline-implementation-guard' | null;
|
|
365
366
|
/** True when ok:true is a WARNING (still passing, but worth a human's attention) — today only scheduler-mcp-project-duplicate. */
|
|
366
367
|
warn?: boolean;
|
|
367
368
|
/** True when this check didn't run because a precondition (another check) already failed — reported ok:true, not a failure. */
|
|
368
369
|
skipped?: boolean;
|
|
369
370
|
}
|
|
370
371
|
|
|
371
|
-
/** Result of installPrdWriteGuard
|
|
372
|
-
* (delegationReadiness.cjs) — the
|
|
372
|
+
/** Result of installPrdWriteGuard, installDestructiveGitGuard, and
|
|
373
|
+
* installInlineImplementationGuard alike (delegationReadiness.cjs) — the
|
|
374
|
+
* three installers share one contract. */
|
|
373
375
|
export interface InstallGuardResult {
|
|
374
376
|
ok: boolean;
|
|
375
377
|
action: 'installed' | 'repaired' | 'already-installed' | 'error';
|
|
@@ -415,6 +417,70 @@ export interface OtelSetConfigResult {
|
|
|
415
417
|
status: OtelStatus;
|
|
416
418
|
}
|
|
417
419
|
|
|
420
|
+
// Product telemetry (bilko.run) — anonymous, on-by-default, opt-out. See
|
|
421
|
+
// session-manager-operations/architecture/telemetry.md for the data model.
|
|
422
|
+
export interface TelemetryConfig {
|
|
423
|
+
enabled: boolean;
|
|
424
|
+
installId: string;
|
|
425
|
+
endpoint: string;
|
|
426
|
+
noticeAckedAt: string | null;
|
|
427
|
+
lastMachineReportAt: string | null;
|
|
428
|
+
lastMachineReportVersion: string;
|
|
429
|
+
lastDailyFlushAt: string | null;
|
|
430
|
+
schemaVersion: 1;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export interface TelemetryLastError {
|
|
434
|
+
status: number;
|
|
435
|
+
message: string;
|
|
436
|
+
at: number;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export interface TelemetryBacklogSummary {
|
|
440
|
+
projectsScanned: number;
|
|
441
|
+
filesScanned: number;
|
|
442
|
+
linesEnqueued: number;
|
|
443
|
+
linesConfirmed: number;
|
|
444
|
+
linesSkipped: number;
|
|
445
|
+
filesCompleted: number;
|
|
446
|
+
watermarksRewound: number;
|
|
447
|
+
reason: string;
|
|
448
|
+
ranAt: string;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export interface TelemetryStatus {
|
|
452
|
+
pendingCount: number;
|
|
453
|
+
sentCount: number;
|
|
454
|
+
dedupedAppends: number;
|
|
455
|
+
evictedCount: number;
|
|
456
|
+
disabledForProcess: boolean;
|
|
457
|
+
consecutiveFailures: number;
|
|
458
|
+
backoffUntil: number;
|
|
459
|
+
profileBuildCount: number;
|
|
460
|
+
lastError: TelemetryLastError | null;
|
|
461
|
+
lastFlushAt: number | null;
|
|
462
|
+
lastFlushReason: string | null;
|
|
463
|
+
backlog: TelemetryBacklogSummary | null;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export interface TelemetrySetConfigResult {
|
|
467
|
+
ok: boolean;
|
|
468
|
+
config: TelemetryConfig;
|
|
469
|
+
status: TelemetryStatus;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export interface TelemetryRecentRecord {
|
|
473
|
+
recordId: string;
|
|
474
|
+
channel: 'event' | 'log' | 'error';
|
|
475
|
+
wire: Record<string, unknown>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export interface TelemetryFlushResult {
|
|
479
|
+
sent: string[];
|
|
480
|
+
failed: string[];
|
|
481
|
+
reason: string;
|
|
482
|
+
}
|
|
483
|
+
|
|
418
484
|
export type ScheduleFirePolicy = 'manual' | 'on-reset' | 'when-available';
|
|
419
485
|
|
|
420
486
|
export interface ScheduleConfig {
|
|
@@ -565,6 +631,11 @@ export interface ScheduleJob {
|
|
|
565
631
|
quarantinedTo?: string;
|
|
566
632
|
quarantinedCommit?: string;
|
|
567
633
|
quarantinedPaths?: string[];
|
|
634
|
+
/** Stamped by findOverrunningJobs' escalation while status is 'running' —
|
|
635
|
+
* a running job whose elapsed time exceeds JOB_OVERRUN_FACTOR × its own
|
|
636
|
+
* PRD's estimateMinutes. Advisory only; re-stamped in place every sweep,
|
|
637
|
+
* cleared on finish/reap/reset (scheduler.cjs). */
|
|
638
|
+
overrun?: { ratio: number; ranMs: number; estimateMinutes: number; at: string };
|
|
568
639
|
}
|
|
569
640
|
|
|
570
641
|
export interface LeakedDescendant {
|
|
@@ -1485,6 +1556,7 @@ export interface SessionManagerAPI {
|
|
|
1485
1556
|
delegationReadiness: (cwd: string) => Promise<DelegationReadiness>;
|
|
1486
1557
|
installPrdWriteGuard: (cwd: string) => Promise<InstallGuardResult>;
|
|
1487
1558
|
installDestructiveGitGuard: (cwd: string) => Promise<InstallGuardResult>;
|
|
1559
|
+
installInlineImplementationGuard: (cwd: string) => Promise<InstallGuardResult>;
|
|
1488
1560
|
onNewSession: (handler: () => void) => () => void;
|
|
1489
1561
|
onRebootSession: (handler: () => void) => () => void;
|
|
1490
1562
|
archiveProject: (encoded: string) => Promise<{ ok: boolean; error?: string }>;
|
|
@@ -1609,6 +1681,14 @@ export interface SessionManagerAPI {
|
|
|
1609
1681
|
status: () => Promise<OtelStatus>;
|
|
1610
1682
|
configPath: () => Promise<string>;
|
|
1611
1683
|
};
|
|
1684
|
+
telemetry: {
|
|
1685
|
+
getConfig: () => Promise<TelemetryConfig>;
|
|
1686
|
+
setConfig: (cfg: TelemetryConfig) => Promise<TelemetrySetConfigResult>;
|
|
1687
|
+
status: () => Promise<TelemetryStatus>;
|
|
1688
|
+
configPath: () => Promise<string>;
|
|
1689
|
+
recentRecords: () => Promise<TelemetryRecentRecord[]>;
|
|
1690
|
+
flushNow: () => Promise<TelemetryFlushResult>;
|
|
1691
|
+
};
|
|
1612
1692
|
diagnostics: {
|
|
1613
1693
|
/** Rejects unless the main process has SM_HEAP_SNAPSHOT=1 set. */
|
|
1614
1694
|
takeHeapSnapshot: () => Promise<{ filePath: string; bytes: number | null; ms: number }>;
|
package/src/preload/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ contextBridge.exposeInMainWorld('api', {
|
|
|
25
25
|
delegationReadiness: (cwd) => ipcRenderer.invoke('app:delegation-readiness', { cwd }),
|
|
26
26
|
installPrdWriteGuard: (cwd) => ipcRenderer.invoke('app:install-prd-write-guard', { cwd }),
|
|
27
27
|
installDestructiveGitGuard: (cwd) => ipcRenderer.invoke('app:install-destructive-git-guard', { cwd }),
|
|
28
|
+
installInlineImplementationGuard: (cwd) => ipcRenderer.invoke('app:install-inline-implementation-guard', { cwd }),
|
|
28
29
|
onNewSession: (handler) => {
|
|
29
30
|
const listener = () => handler();
|
|
30
31
|
ipcRenderer.on('app:new-session', listener);
|
|
@@ -183,6 +184,14 @@ contextBridge.exposeInMainWorld('api', {
|
|
|
183
184
|
status: () => ipcRenderer.invoke('otel:status'),
|
|
184
185
|
configPath: () => ipcRenderer.invoke('otel:config-path'),
|
|
185
186
|
},
|
|
187
|
+
telemetry: {
|
|
188
|
+
getConfig: () => ipcRenderer.invoke('telemetry:get-config'),
|
|
189
|
+
setConfig: (cfg) => ipcRenderer.invoke('telemetry:set-config', cfg),
|
|
190
|
+
status: () => ipcRenderer.invoke('telemetry:status'),
|
|
191
|
+
configPath: () => ipcRenderer.invoke('telemetry:config-path'),
|
|
192
|
+
recentRecords: () => ipcRenderer.invoke('telemetry:recent-records'),
|
|
193
|
+
flushNow: () => ipcRenderer.invoke('telemetry:flush-now'),
|
|
194
|
+
},
|
|
186
195
|
// Diagnostic only — no handler is registered unless the main process was
|
|
187
196
|
// launched with SM_HEAP_SNAPSHOT=1, so this rejects by default.
|
|
188
197
|
diagnostics: {
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{ag as d,a7 as e,S,a as Z,j as M,aB as Y,R as Q,aq as X,aw as ee,aE as $,ay as te,at as R,J as se,V as ae,w as F}from"./index-CzAxC432.js";import{P as ne}from"./Panel-dTNWC59Q.js";import{S as re}from"./ScopeSwitcher-Co3tkLTT.js";import{S as J}from"./SaveBar-4tNMCjUd.js";import{u as le,m as ie,p as oe,a as G,E as ce,s as de}from"./settingsSchema-C_nsemcF.js";import{T as U}from"./Toggle-B-5M2hGe.js";import"./monaco-editor-BW5C4Iv1.js";const ue=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle","permissions"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Model allow/override lists, reasoning depth, and fast-mode toggles — machine-wide, with no per-Epic override yet. An Epic's Agent persona model (Agent Library) still wins over Essentials' plain model default.",advanced:!0,keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],pe={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function B(a){return a.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((l,n)=>{const r=pe[l];return r||(n===0?l.charAt(0).toUpperCase()+l.slice(1):l)}).join(" ")}function K(a){const s=new Set,t=[];for(const n of ue){const r=n.keys.filter(i=>a.has(i));r.forEach(i=>s.add(i)),r.length!==0&&t.push({id:n.id,title:n.title,summary:n.summary,advanced:!!n.advanced,keys:r})}const l=Array.from(a).filter(n=>!s.has(n)&&n!=="$schema").sort();return l.length>0&&t.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:l}),t}function xe(a,s){return K(a).map(t=>({id:t.id,title:t.title,advanced:t.advanced,total:t.keys.length,setCount:t.keys.filter(l=>s.has(l)).length}))}const me={};function V(a,s){if(s)return{text:s,authored:!1};const t=me[a];return t?{text:t,authored:!0}:null}const fe={essentials:"star",git:"link",memory:"memory",model:"sparkle",interface:"eye",updates:"reload",env:"keys",hooks:"hooks",mcp:"mcp",plugins:"plugins",filesystem:"folder",login:"lock",feedback:"send",advanced:"shield",other:"dot"},ge=["user","project","local","default"],he={user:"user",project:"project",local:"local",default:"default"};function be({node:a,targetScope:s,onOverride:t,schema:l}){const[n,r]=d.useState(""),[i,p]=d.useState(!1),[x,v]=d.useState(!0),u=a.kind==="object"?a:null,N=u?Object.keys(u.children):[],g=l.rootKeys(),b=new Set([...N,...g]),c=d.useMemo(()=>K(b),[Array.from(b).sort().join(",")]),h=d.useMemo(()=>xe(b,new Set(N)),[Array.from(b).sort().join(","),N.join(",")]),[C,E]=d.useState(null),m=d.useRef(null),k=o=>{const y=c.find(j=>j.id===o);y!=null&&y.advanced&&!i&&p(!0),E(o)};d.useEffect(()=>{if(!C)return;E(null);const o=m.current,y=document.getElementById(`settings-group-${C}`);if(!o||!y)return;const j=y.getBoundingClientRect().top-o.getBoundingClientRect().top;o.scrollBy({top:j,behavior:"smooth"})},[C]);const w=d.useMemo(()=>c.filter(o=>i||!o.advanced).map(o=>({...o,keys:o.keys.filter(y=>{const j=(u==null?void 0:u.children[y])!==void 0;if(!x&&!j)return!1;if(!n.trim())return!0;const T=l.at([y]);return[y,B(y),(T==null?void 0:T.description)??""].join(" ").toLowerCase().includes(n.toLowerCase())})})).filter(o=>o.keys.length>0),[c,n,i,x,u,l]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:"text-fg-faint",children:["writing overrides to"," ",e.jsx("span",{className:"text-fg-dim font-medium",children:S[s].label})]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:o=>v(o.target.checked),className:"accent-accent"}),"show not-yet-configured"]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:o=>p(o.target.checked),className:"accent-accent"}),"show advanced"]}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:n,onChange:o=>r(o.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(ye,{groups:h,onJump:k}),e.jsxs("div",{ref:m,className:"flex-1 overflow-auto py-3",children:[w.map(o=>e.jsx(ve,{id:o.id,title:o.title,summary:o.summary,advanced:o.advanced,children:o.keys.map(y=>{const j=u==null?void 0:u.children[y],T=l.at([y]);return e.jsx(je,{keyName:y,node:j,info:T,targetScope:s,onOverride:(f,P)=>t([y],f,P)},y)})},o.id)),w.length===0&&e.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',n,'"']})]})]})]})}function ye({groups:a,onJump:s}){return e.jsx("nav",{className:"shrink-0 w-48 border-r border-line bg-bg-elev/30 overflow-y-auto py-3",children:a.map(t=>e.jsxs("button",{onClick:()=>s(t.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bg-hi transition-colors",title:`jump to ${t.title}`,children:[e.jsx(Z,{name:fe[t.id]??"dot",size:15,className:"text-fg-faint shrink-0"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-fg-dim",children:t.title}),e.jsxs("span",{className:"text-[10px] text-fg-faint font-mono shrink-0",children:[t.setCount,"/",t.total]})]},t.id))})}function ve({id:a,title:s,summary:t,advanced:l,children:n}){const[r,i]=d.useState(!0);return e.jsxs("section",{id:`settings-group-${a}`,className:"mx-4 mb-4 rounded-lg border border-line shadow-sm bg-bg-elev/50 overflow-hidden",children:[e.jsxs("header",{className:"px-4 py-3 bg-bg-elev cursor-pointer hover:bg-bg-hi flex items-center gap-3 border-b border-line",onClick:()=>i(!r),children:[e.jsx("span",{className:"text-fg-faint w-3",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-fg text-base font-semibold",children:s}),l&&e.jsx("span",{className:"text-[9px] px-1.5 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"advanced"})]}),e.jsx("p",{className:"text-fg-dim text-sm mt-0.5",children:t})]})]}),r&&e.jsx("div",{className:"divide-y divide-line/60",children:n})]})}function je({keyName:a,node:s,info:t,targetScope:l,onOverride:n}){const[r,i]=d.useState(!1),[p,x]=d.useState(!1),v=B(a),u=s!==void 0,g=(s==null?void 0:s.kind)==="leaf"?s:null,b=(s==null?void 0:s.kind)==="object"||(s==null?void 0:s.kind)==="array",c=t==null?void 0:t.default,h=g&&c!==void 0&&z(g.value,c),C=Oe({isSet:u,leafNode:g,defaultVal:c,isDefault:!!h,node:s}),E=Ne(g,c),m=E.length>=2,k=!!g&&!h,w=V(a,t==null?void 0:t.description);return e.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{onClick:()=>i(!r),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:r?"collapse":"expand",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-fg text-sm",children:v}),e.jsx(Pe,{kind:C.kind,label:C.label}),m&&e.jsxs("button",{onClick:o=>{o.stopPropagation(),r||i(!0),x(y=>!y)},className:"text-[9px] px-1.5 py-0 rounded border border-blue-900/40 bg-blue-950/30 text-blue-300/90 uppercase tracking-wide hover:bg-blue-900/40",title:"this key is defined in multiple scopes — click to expand",children:["drift · ",E.map(o=>he[o]).join(" · ")]}),k&&g&&e.jsx("button",{onClick:o=>{o.stopPropagation(),n(void 0,g.winner)},className:"text-[9px] px-1.5 py-0 rounded border border-line bg-bg-elev text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`reset · delete from ${S[g.winner].label}`,children:"↺ reset"}),(t==null?void 0:t.deprecated)&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"deprecated"}),(t==null?void 0:t.required)&&!u&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-red-900/40 bg-red-950/30 text-red-400/80 uppercase tracking-wide",children:"required"})]}),w&&e.jsx("p",{className:`text-fg-dim text-xs mt-0.5 leading-relaxed ${w.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:w.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:Ae(w.text)}),r&&p&&g&&e.jsx(we,{leaf:g,defaultVal:c,onReset:o=>n(void 0,o)}),r&&e.jsx(ke,{keyName:a,node:s,info:t,targetScope:l,onOverride:o=>n(o)})]}),e.jsx("div",{className:"shrink-0",children:!r&&e.jsx(Te,{node:s,info:t,onSet:o=>{n(o)},disabled:b&&u})})]})})}function Ne(a,s){if(!a)return[];const t=new Set;t.add(a.winner);for(const l of a.shadowed)t.add(l.scope);return s!==void 0&&t.add("default"),ge.filter(l=>t.has(l))}function we({leaf:a,defaultVal:s,onReset:t}){const l={};l[a.winner]={value:a.value,winner:!0};for(const n of a.shadowed)l[n.scope]={value:n.value,winner:!1};return e.jsxs("div",{className:"mt-2 border border-line rounded bg-bg-elev/40 text-xs",children:[e.jsx("div",{className:"px-2 py-1 text-fg-faint border-b border-line/60",children:"Values across all scopes (winner highlighted · reset removes that scope's value):"}),e.jsxs("div",{className:"divide-y divide-line/60",children:[["user","project","local"].map(n=>{const r=l[n],i=r!==void 0;return e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:S[n].label}),e.jsx("span",{className:`font-mono truncate ${r!=null&&r.winner?"text-accent":"text-fg-dim"}`,children:i?A(r.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),i?e.jsx("button",{onClick:()=>t(n),className:"text-[9px] px-1.5 py-0 rounded border border-line text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`delete this key from ${S[n].label}`,children:"↺"}):e.jsx("span",{})]},n)}),e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:"Default"}),e.jsx("span",{className:"font-mono text-fg-dim truncate",children:s!==void 0?A(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function ke({keyName:a,node:s,info:t,targetScope:l,onOverride:n}){const i=(s==null?void 0:s.kind)==="leaf"?s:null,p=V(a,t==null?void 0:t.description);return e.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[p&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${p.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:p.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:p.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(t==null?void 0:t.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(t.type)?t.type.join(" | "):t.type})]}),(t==null?void 0:t.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:A(t.default)})]}),(t==null?void 0:t.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:t.enum.map(x=>String(x)).join(" | ")})]}),i&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Current"}),e.jsxs("dd",{className:"font-mono",children:[e.jsx("span",{className:"text-fg-dim",children:A(i.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",S[i.winner].label]})]})]}),i&&i.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:i.shadowed.map((x,v)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[A(x.value)," —"," ",e.jsx("span",{className:"no-underline",children:S[x.scope].label})]},v))})]}),(s==null?void 0:s.kind)==="array"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Accumulated"}),e.jsxs("dd",{className:"text-fg-dim",children:[s.items.length," items across all scopes"]})]})]}),e.jsx("div",{className:"pt-2 flex items-center gap-2 flex-wrap border-t border-line/60",children:e.jsx(Se,{keyName:a,node:s,info:t,onChange:n,targetScope:l})})]})}function Se({node:a,info:s,onChange:t,targetScope:l}){const r=(a==null?void 0:a.kind)==="leaf"?a.value:s==null?void 0:s.default,i=W(s==null?void 0:s.type);if(i==="boolean"){const p=r===!0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:[{v:!0,label:"on"},{v:!1,label:"off"}].map(({v:x,label:v})=>e.jsx("button",{onClick:()=>t(x),className:`px-3 py-0.5 text-xs transition-colors ${p===x?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:v},v))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[l].label]})]})}return s!=null&&s.enum?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-fg-faint",children:"Choose:"}),s.enum.map(p=>{const x=z(r,p);return e.jsx("button",{onClick:()=>t(p),className:`px-2 py-0.5 text-xs rounded border ${x?"bg-accent text-bg border-accent":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,children:String(p)},String(p))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[l].label]})]}):i==="integer"||i==="number"?e.jsx(Ce,{value:typeof r=="number"?r:void 0,integer:i==="integer",onCommit:t,target:S[l].label}):i==="string"?e.jsx(Ee,{value:typeof r=="string"?r:"",onCommit:t,target:S[l].label}):e.jsxs("div",{className:"text-fg-faint",children:["Complex value (",i??"object/array",") — use the"," ",e.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function Ce({value:a,integer:s,onCommit:t,target:l}){const[n,r]=d.useState(a!==void 0?String(a):""),i=()=>{const p=s?parseInt(n,10):parseFloat(n);Number.isNaN(p)||t(p)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("input",{type:"number",value:n,onChange:p=>r(p.target.value),onBlur:i,onKeyDown:p=>{p.key==="Enter"&&p.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:i,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",l]})]})}function Ee({value:a,onCommit:s,target:t}){const[l,n]=d.useState(a);return e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"text-fg-faint shrink-0",children:"Set to:"}),e.jsx("input",{type:"text",value:l,onChange:r=>n(r.target.value),onKeyDown:r=>{r.key==="Enter"&&s(l)},className:"flex-1 min-w-0 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:()=>s(l),className:"shrink-0 px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",t]})]})}function Te({node:a,info:s,onSet:t,disabled:l}){const n=(a==null?void 0:a.kind)==="leaf",r=W(s==null?void 0:s.type);if(l)return null;if(r==="boolean"){const i=n&&a.value===!0;return e.jsx("button",{onClick:()=>t(!i),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${i?"bg-accent/15 text-accent border-accent/40 hover:bg-accent hover:text-bg":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,title:"toggle",children:i?"on":"off"})}return null}function Oe({isSet:a,leafNode:s,defaultVal:t,isDefault:l,node:n}){return a?(n==null?void 0:n.kind)==="array"?{kind:"accumulated",label:`${n.items.length} items`}:(n==null?void 0:n.kind)==="object"?{kind:"set",label:"configured"}:s?l?{kind:"default",label:`= default · ${S[s.winner].label}`}:s.shadowed.length>0?{kind:"override",label:`overriding ${s.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${S[s.winner].label}`}:{kind:"set",label:"configured"}:t!==void 0?{kind:"default",label:`using default: ${A(t)}`}:{kind:"unset",label:"not configured"}}function Pe({kind:a,label:s}){const t={set:"bg-accent/15 text-accent border-accent/30",default:"bg-bg-hi text-fg-dim border-line",unset:"bg-bg-elev text-fg-faint border-line",override:"bg-purple-950/30 text-purple-400/80 border-purple-900/40",accumulated:"bg-blue-950/30 text-blue-400/80 border-blue-900/40"}[a];return e.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${t}`,children:s})}function W(a){if(a)return Array.isArray(a)?a.find(t=>t!=="null")??a[0]:a}function z(a,s){return a===s?!0:typeof a!=typeof s?!1:a&&s&&typeof a=="object"?JSON.stringify(a)===JSON.stringify(s):!1}function Ae(a){const s=a.trim().split(`
|
|
2
|
-
`)[0],t=s.match(/^([^.!?]+[.!?])/);return t?t[1]:s.length>120?s.slice(0,120)+"…":s}function A(a){if(typeof a=="string")return a===""?'""':JSON.stringify(a);if(a===null)return"null";if(a===void 0)return"—";if(typeof a=="object"){const s=JSON.stringify(a);return s.length>60?s.slice(0,60)+"…":s}return String(a)}function Re(){const[a,s]=d.useState(null),[t,l]=d.useState(null),[n,r]=d.useState(null),[i,p]=d.useState(null),[x,v]=d.useState(!1),[u,N]=d.useState(null),[g,b]=d.useState(null);if(d.useEffect(()=>{let m=!1;return Promise.all([window.api.otel.getConfig(),window.api.otel.status(),window.api.otel.configPath()]).then(([k,w,o])=>{m||(s(k),r(k),l(w),p(o))}).catch(k=>{console.warn("[telemetry] load failed:",k==null?void 0:k.message)}),()=>{m=!0}},[]),!n||!a)return e.jsx(M,{title:"loading…"});const c=JSON.stringify(n)!==JSON.stringify(a),h=(m,k)=>{N(null),r({...n,[m]:k})},C=async()=>{v(!0),N(null);try{const m=await window.api.otel.setConfig(n);!m.ok&&m.error&&N(m.error),s(m.config),r(m.config),l(m.status),b(Date.now())}catch(m){N(m instanceof Error?m.message:String(m))}finally{v(!1)}},E=()=>{N(null),r(a)};return e.jsxs("div",{className:"p-4 max-w-3xl space-y-5 text-sm",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Telemetry — OpenTelemetry export"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"When enabled, every classified transcript event (tool_use, todo_write, plan, usage, agent_spawn) is mirrored as a 0-duration OTLP/HTTP span. Point this at a local collector (Jaeger, Grafana Tempo, SigNoz, Honeycomb) for cross-session analysis."}),i&&e.jsxs("p",{className:"text-fg-faint text-[11px]",children:["stored at ",e.jsx("span",{className:"font-mono",children:i})]})]}),e.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Export transcripts to OTEL"}),e.jsx("div",{className:"text-fg-faint text-xs",children:"Toggle off to disable all span emission immediately."})]}),e.jsx(U,{checked:n.enabled,onChange:m=>h("enabled",m),label:n.enabled?"on":"off"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"OTLP/HTTP traces endpoint"}),e.jsx("input",{type:"text",value:n.endpoint,onChange:m=>h("endpoint",m.target.value),placeholder:"http://localhost:4318/v1/traces",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsxs("span",{className:"text-fg-dim text-xs",children:["Headers (newline-separated ",e.jsx("span",{className:"font-mono",children:"Key: Value"}),")"]}),e.jsx("textarea",{value:n.headers,onChange:m=>h("headers",m.target.value),placeholder:"x-honeycomb-team: YOUR_API_KEY",rows:3,className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Service name"}),e.jsx("input",{type:"text",value:n.serviceName,onChange:m=>h("serviceName",m.target.value),placeholder:"session-manager",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("div",{className:"flex items-start justify-between gap-3 pt-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Include content (PII)"}),e.jsxs("div",{className:"text-fg-faint text-xs leading-relaxed",children:["Adds tool inputs, plan text, and agent prompts to span attributes. Off by default — matches upstream Claude Code's ",e.jsx("span",{className:"font-mono",children:"OTEL_LOG_USER_PROMPTS"})," opt-in."]})]}),e.jsx(U,{checked:n.includeContent,onChange:m=>h("includeContent",m),label:n.includeContent?"on":"off"})]})]}),t&&e.jsxs("section",{className:"border border-line rounded p-3 text-xs space-y-1",children:[e.jsx("div",{className:"text-fg-dim",children:"Runtime status"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"enabled:"})," ",e.jsx("span",{className:t.enabled?"text-accent":"text-fg-dim",children:String(t.enabled)})]}),t.error&&e.jsxs("div",{className:"text-red-400 break-words",children:[e.jsx("span",{className:"text-fg-faint",children:"error:"})," ",t.error]}),!t.error&&t.enabled&&e.jsx("div",{className:"text-fg-faint",children:"spans batched and exported in the background. Verify by enabling and pointing at a local Jaeger."})]}),e.jsxs("footer",{className:"flex items-center gap-3 pt-2 border-t border-line",children:[e.jsx("button",{onClick:C,disabled:!c||x,className:"px-3 py-1 text-xs rounded bg-accent text-bg disabled:opacity-50 disabled:cursor-not-allowed",children:x?"saving…":"Save"}),e.jsx("button",{onClick:E,disabled:!c||x,className:"px-3 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg disabled:opacity-50 disabled:cursor-not-allowed",children:"Revert"}),u&&e.jsx("span",{className:"text-red-400 text-xs",children:u}),!u&&g&&!c&&e.jsx("span",{className:"text-fg-faint text-xs",children:"saved"})]})]})}function Me(){const{model:a,setModel:s}=Y();return e.jsxs("div",{className:"p-4 max-w-3xl space-y-5 text-sm",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Session Manager preferences"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"Native app preferences, stored locally — not part of Claude Code's own settings."})]}),e.jsx("section",{className:"border border-line rounded p-3 space-y-3",children:e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Default model for raw sessions"}),e.jsx("select",{value:a,onChange:t=>s(t.target.value),className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs",children:Q.map(t=>e.jsx("option",{value:t,children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsx("span",{className:"text-fg-faint text-[11px]",children:"Used when opening a raw interactive session without an explicit per-launch override."})]})})]})}function Ie({cwd:a}){const[s,t]=d.useState(!1),[l,n]=d.useState(!1),[r,i]=d.useState(!1),[p,x]=d.useState(!1);d.useEffect(()=>{var b,c;let g=!1;return t(!1),Promise.resolve((c=(b=window.api.promptSessions)==null?void 0:b.getWorktreeDisabled)==null?void 0:c.call(b,{cwd:a})).then(h=>{g||(n((h==null?void 0:h.disabled)??!1),i((h==null?void 0:h.disabled)??!1),t(!0))},()=>{g||t(!0)}),()=>{g=!0}},[a]);const v=s&&r!==l,u=()=>{var g,b;x(!0),Promise.resolve((b=(g=window.api.promptSessions)==null?void 0:g.setWorktreeDisabled)==null?void 0:b.call(g,{cwd:a,disabled:r})).then(c=>{n((c==null?void 0:c.disabled)??r),i((c==null?void 0:c.disabled)??r)}).catch(c=>X.error(c instanceof Error?c.message:String(c))).finally(()=>x(!1))},N=()=>i(l);return e.jsxs("div",{"data-testid":"settings-epic-isolation",className:"border-b border-line bg-bg-elev px-3 py-2.5 text-[11.5px] leading-snug",children:[e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx("input",{type:"checkbox",checked:r,disabled:!s||p,onChange:g=>i(g.target.checked),"data-testid":"settings-epic-isolation-checkbox",className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-fg",children:"Disable Epic worktree isolation for this project"}),e.jsxs("span",{className:"block text-fg-dim",children:["Off by default — each active Epic runs in its own isolated ",e.jsx("code",{children:"git worktree"})," (branch"," ",e.jsx("code",{children:"sm-epic/<id>"}),"), merged back to main at an explicit checkpoint. Turning this on makes every new Epic in this project run directly in the shared working tree instead, same as before this feature existed."]})]})]}),v&&e.jsx(J,{dirty:v,busy:p,onSave:u,onRevert:N})]})}const H={user:{title:"Global settings",body:"This is the real ~/.claude/settings.json on disk — the same file the claude CLI reads on every session it starts. Edits apply machine-wide, to every project and every session."},project:{title:"Project settings",body:"This is the real <project>/.claude/settings.json on disk, checked into git. Edits apply to every current and future session in this project, for anyone who clones it."},local:{title:"Local settings",body:"This is the real <project>/.claude/settings.local.json on disk, gitignored. Edits apply to every current and future session in this project, on this machine only."}};function Le(){const a=ee(),s=$(f=>f.tabs),t=$(f=>f.activeTabId),l=s.find(f=>f.id===t)??null,n=(l==null?void 0:l.cwd)??null,r=te(f=>f.navFace),i=d.useRef(!1),p=d.useRef(r),[x,v]=d.useState(()=>r==="project"&&n?"project":"user"),[u,N]=d.useState("effective");d.useEffect(()=>{if(p.current!==r){if(p.current=r,i.current){i.current=!1;return}v(r==="project"&&n?"project":"user")}},[r,n]),d.useEffect(()=>{r==="project"&&(u==="telemetry"||u==="app")&&N("effective")},[r,u]);const g=f=>{i.current=!0,v(f)},b=le(F,a,n),c=b[x]??null,h=R(f=>f.files),C=R(f=>f.setDraft),E=R(f=>f.saveJson),m=R(f=>f.revert),[k,w]=d.useState(null),o=d.useMemo(()=>ie(oe(h,b)),[h,b]),y=(f,P,O)=>{var _;const I=b[O??x];if(!I)return;w(null);const D=((_=h[I])==null?void 0:_.draftRaw)??"";let L={};if(D.trim())try{L=JSON.parse(D)}catch{L={}}const q=de(L,f,P);C(I,JSON.stringify(q,null,2)+`
|
|
3
|
-
`)};if(!a)return e.jsx(M,{title:"loading…"});const j=c?h[c]:null,T=f=>f!=="user"&&!n;return e.jsx(ne,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(ae,{options:[{key:"effective",label:"Guided"},{key:"tree",label:"Tree"},{key:"raw",label:"Raw"},...r==="home"?[{key:"telemetry",label:"Telemetry"},{key:"app",label:"Session Manager"}]:[]],active:u,onChange:N}),u!=="telemetry"&&u!=="app"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx(re,{scopes:F.scopes,active:x,onChange:g,annotate:f=>{if(T(f))return{exists:!1};const P=b[f];if(!P)return null;const O=h[P];return{exists:(O==null?void 0:O.exists)??!1,dirty:(O==null?void 0:O.dirty)??!1}}}),e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:u==="effective"?`overrides → ${c??"—"}`:c??"—"})]}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"schema reference ↗"})]}),footer:u!=="telemetry"&&u!=="app"&&c&&j?e.jsx(J,{dirty:j.dirty,busy:j.busy,parseError:k||j.parseError,lastSavedAt:j.lastSavedAt,leading:j.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{w(null);const f=await E(c);f.ok||w(f.error??"save failed")},onRevert:()=>{w(null),m(c)}}):null,children:u==="telemetry"?e.jsx(Re,{}):u==="app"?e.jsx(Me,{}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"settings-scope-note",className:"sticky top-0 z-10 border-b border-line bg-bg-elev px-3 py-2 text-[11.5px] leading-snug",children:[e.jsx("span",{className:"font-semibold text-fg",children:H[x].title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:H[x].body}),c&&e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:c})]}),x==="project"&&n&&e.jsx(Ie,{cwd:n}),T(x)?e.jsx(M,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"}):u==="effective"?e.jsx(be,{node:o,targetScope:x,onOverride:y,schema:G()}):u==="tree"?e.jsx(ce,{node:o,targetScope:x,onOverride:y,schema:G()}):c&&j?e.jsx(se,{path:c,value:j.draftRaw,onChange:f=>{w(null),C(c,f)}}):e.jsx(M,{title:"resolving…"})]})})}const Be=d.memo(Le);export{H as SETTINGS_SCOPE_NOTES,Be as Settings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ag as l,aq as $,a7 as e,av as B,a5 as I,a6 as V,am as _,N as z,c as q,e as L,o as M,M as D,h as H,U as G,aw as J,C as K,at as h,j as P}from"./index-CzAxC432.js";import{P as T}from"./Panel-dTNWC59Q.js";import{S as Q}from"./SaveBar-4tNMCjUd.js";import{f as W,V as U}from"./Library-DAMyrUtY.js";import"./monaco-editor-BW5C4Iv1.js";function A(t){return t.split("/").pop()||t}function X({activePath:t,selectedPath:o,onSelect:f}){const[n,i]=l.useState([]),m=l.useRef(0),r=l.useRef(f);if(r.current=f,l.useEffect(()=>{if(m.current+=1,r.current(null),!t){i([]);return}const a=m.current;let x=!1;return window.api.config.parseImports(t).then(c=>{x||m.current!==a||(c.ok?i(c.imports):(i([]),$.error(c.error||"failed to parse @-imports")))}),()=>{x=!0}},[t]),n.length===0||!t)return null;const b=o===t||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 · ",n.length+1]}),e.jsxs("button",{type:"button",onClick:()=>f(null),"aria-current":b,"data-testid":"referenced-file-root",className:`w-full text-left px-3 py-2 border-b border-line ${b?"bg-bg-hi text-fg":"text-fg-dim hover:bg-bg"}`,children:[e.jsx("div",{className:"text-[11.5px] font-medium truncate",children:A(t)}),e.jsx("div",{className:"text-[10px] text-fg-faint truncate",title:t,children:"this system prompt"})]}),n.map(a=>{const x=!a.ok||!a.exists,c=o===a.path;return e.jsxs("button",{type:"button",onClick:()=>f(a),"aria-current":c,"data-testid":"referenced-file-row",className:`w-full text-left px-3 py-2 border-b border-line last:border-b-0 ${c?"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:A(a.path)}),x&&e.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide text-amber-400/90 border border-amber-400/30","data-testid":"referenced-file-missing",children:"missing"})]}),e.jsx("div",{className:"text-[10px] text-fg-faint truncate",title:a.path,children:a.path}),e.jsxs("div",{className:"text-[10px] text-fg-faint",children:[a.sizeBytes.toLocaleString()," bytes · ~",a.tokenEstimate.toLocaleString()," tokens"]})]},a.path)})]})}function F(t){return t.split("/").filter(Boolean).pop()||t}function Y({path:t,value:o,onChange:f,onSave:n,readOnly:i,defaultMode:m,headerRight:r,hideStatusBar:b}){const a=B(),x=I(t),c=V(t),S=_(t),[E,w]=l.useState(()=>i&&c?"preview":m??z(t)),[g,C]=l.useState(!0),[p,R]=l.useState(null),N=l.useRef(null),d=l.useRef(null),v=l.useCallback(s=>{N.current=s},[]),y=l.useCallback(()=>N.current,[]),k=i?c?["preview","edit"]:[]:S?["edit","preview","split"]:c?["edit","preview"]:[],u=c?E:"edit",j=e.jsx(q,{path:t,name:F(t),value:o,onChange:f,onSave:()=>n==null?void 0:n(),onReady:v,onCursor:R,readOnly:i});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:F(t)}),i&&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&&(u==="preview"||u==="split")&&e.jsx("button",{onClick:()=>C(s=>!s),"data-testid":"document-outline-toggle",className:`px-2 py-0.5 text-[10px] border border-line rounded ${g?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,title:"Toggle document outline",children:"Outline"}),k.length>0&&e.jsx("div",{className:"flex items-center ml-1 rounded border border-line overflow-hidden","data-testid":"document-mode-toggle",children:k.map(s=>e.jsx("button",{onClick:()=>w(s),className:`px-2 py-0.5 text-[10px] capitalize transition-colors ${u===s?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,children:s},s))})]}),e.jsx("div",{className:"flex-1 min-h-0",children:u==="split"&&x?e.jsxs("div",{className:"flex h-full",children:[g&&e.jsx(L,{text:o,scrollRef:d}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-line",children:[!i&&e.jsx(M,{getEditor:y}),e.jsx("div",{className:"flex-1 min-h-0",children:j})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(D,{ref:d,text:o,flush:!0,wideMeasure:a.wideMeasure})})]}):u==="preview"&&x?e.jsxs("div",{className:"flex h-full",children:[g&&e.jsx(L,{text:o,scrollRef:d}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(D,{ref:d,text:o,wideMeasure:a.wideMeasure})})]}):x?e.jsxs("div",{className:"flex flex-col h-full",children:[!i&&e.jsx(M,{getEditor:y}),e.jsx("div",{className:"flex-1 min-h-0",children:j})]}):j}),!b&&e.jsx(H,{text:o,cursor:p,language:G(t)||void 0})]})}const O={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 Z(t){return Math.round(t.length/4)}function ee(){const t=J(),[o,f]=l.useState("installed"),n=l.useMemo(()=>t?K.resolve("user",t,null):null,[t]),[i,m]=l.useState(null),r=(i==null?void 0:i.path)??n,b=!!i&&(!i.ok||!i.exists),a=h(s=>s.files),x=h(s=>s.loadText),c=h(s=>s.setDraft),S=h(s=>s.saveText),E=h(s=>s.revert),w=h(s=>s.watchFile),g=h(s=>s.unwatchFile);l.useEffect(()=>{if(n)return x(n,!0),w(n),()=>{g(n)}},[n]),l.useEffect(()=>{if(!(!r||r===n))return x(r,!0),w(r),()=>{g(r)}},[r,n]);const[C,p]=l.useState(null),R=l.useCallback(s=>{p(null),m(s)},[]);if(!t)return e.jsx(P,{title:"loading…"});if(o==="library")return e.jsx(T,{toolbar:e.jsx(U,{active:o,onChange:f,installedLabel:"Editor",libraryLabel:"Presets"}),children:e.jsx(W,{})});const N=n?a[n]:null,d=r?a[r]:null,v=(d==null?void 0:d.draftRaw)??"",y=Z(v),k=v.length,u=b,j=async()=>{if(!r)return;p(null);const s=await S(r);s.ok||p(s.error??"save failed")};return e.jsx(T,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(U,{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:[k.toLocaleString()," chars · ~",y.toLocaleString()," tokens"]})]}),footer:r&&d&&!u?e.jsx(Q,{dirty:d.dirty,busy:d.busy,parseError:C,lastSavedAt:d.lastSavedAt,leading:d.exists?i?e.jsx("span",{children:"editing an imported file"}):null:e.jsx("span",{children:"file will be created on save"}),onSave:j,onRevert:()=>{p(null),E(r)}}):null,children:n&&N?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:O.title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:O.body}),e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:n})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex",children:[e.jsx(X,{activePath:n,selectedPath:r,onSelect:R}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[u&&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:v,readOnly:u,defaultMode:"split",onChange:s=>{p(null),c(r,s)},onSave:()=>{j()}},r)})]})]})]}):e.jsx(P,{title:"resolving…"})})}const ie=l.memo(ee);export{ie as SystemPrompt};
|