claude-code-session-manager 0.132.0 → 0.133.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/assets/{AgentLibrary-C09MlPFx.js → AgentLibrary-BTIBmZkM.js} +2 -2
- package/dist/assets/{AppSettings-DvDKsCnD.js → AppSettings-DwnfV9-4.js} +2 -2
- package/dist/assets/{Button-BzG_KdBC.js → Button-CObXxw7b.js} +1 -1
- package/dist/assets/DocumentEditorPane-CgB5IuOY.js +1 -0
- package/dist/assets/{Extensions-DgxKT_OZ.js → Extensions-Fuhshcl6.js} +2 -2
- package/dist/assets/{History-Nd3bKjBq.js → History-DbUV4jxK.js} +2 -2
- package/dist/assets/{Library-R71t6VAB.js → Library-COr79GyT.js} +1 -1
- package/dist/assets/{ListDetail-CG50Ul7c.js → ListDetail-DY53nXya.js} +1 -1
- package/dist/assets/{Panel-C7EFG4eU.js → Panel-D7NX5iP8.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-J92iNEGC.js → ProjectClaudeConfig-DuWzM8qA.js} +1 -1
- package/dist/assets/{ProvenanceBadge-C3KB3ILO.js → ProvenanceBadge-AnwE1p5X.js} +1 -1
- package/dist/assets/{Scheduler-DeYBA7uc.js → Scheduler-BHfx0rXd.js} +9 -9
- package/dist/assets/Settings-tt0VZCyz.js +2 -0
- package/dist/assets/{SkillReferenceGraph-D7bt3fyB.js → SkillReferenceGraph-D_rxqWgq.js} +1 -1
- package/dist/assets/{Skills-GpxtUrFP.js → Skills-BVQPJZaF.js} +1 -1
- package/dist/assets/{SourceChip-uyVMCZc7.js → SourceChip-DC5XD8KC.js} +1 -1
- package/dist/assets/{SystemPrompt-Cv25uFSM.js → SystemPrompt-XnvP0_cS.js} +1 -1
- package/dist/assets/{TiptapBody-uP8fJkbM.js → TiptapBody-B_TNEADm.js} +1 -1
- package/dist/assets/{Toggle-DRs80cX-.js → Toggle-CxQO8pGN.js} +1 -1
- package/dist/assets/{ViewTabs-BDkvvzJ8.js → ViewTabs-CEjnWPD9.js} +1 -1
- package/dist/assets/{VoiceButton-Cmtz2sQt.js → VoiceButton-B-6gdmKe.js} +1 -1
- package/dist/assets/{historyTotals-DHwAXunq.js → historyTotals-dT8vcKzX.js} +1 -1
- package/dist/assets/{index-oXqzajWV.css → index-5QIl5Kcd.css} +1 -1
- package/dist/assets/index-BLORXCcT.js +3111 -0
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +427 -413
- package/package.json +4 -2
- package/scripts/README.md +1 -0
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +77 -14
- package/src/main/index.cjs +13 -0
- package/src/main/ipcSchemas.cjs +54 -0
- package/src/main/lib/CLAUDE.md +2 -0
- package/src/main/lib/agent-cli/adapters/antigravity.cjs +147 -0
- package/src/main/lib/agent-cli/adapters/codex.cjs +170 -0
- package/src/main/lib/agent-cli/adapters/cursor.cjs +138 -0
- package/src/main/lib/agent-cli/adapters/gemini.cjs +119 -0
- package/src/main/lib/agent-cli/adapters/opencode.cjs +117 -0
- package/src/main/lib/agent-cli/agentCliEvents.cjs +94 -0
- package/src/main/lib/agent-cli/agentCliIpc.cjs +109 -0
- package/src/main/lib/agent-cli/agentCliRegistry.cjs +213 -0
- package/src/main/lib/agent-cli/agentCliSessionStore.cjs +152 -0
- package/src/main/lib/agent-cli/agentCliTurn.cjs +99 -0
- package/src/main/lib/app-preview/appPreviewIpc.cjs +125 -0
- package/src/main/lib/app-preview/appPreviewManager.cjs +317 -0
- package/src/main/lib/app-preview/appPreviewScripts.cjs +106 -0
- package/src/main/lib/app-preview/appPreviewSweep.cjs +92 -0
- package/src/main/lib/chatBootRecovery.cjs +41 -1
- package/src/main/lib/claude/agentEffortResolve.cjs +11 -3
- package/src/main/lib/epic/activeIndexMerge.cjs +25 -2
- package/src/main/lib/epic/archivedTranscript.cjs +39 -6
- package/src/main/lib/epic/epicChanges.cjs +466 -0
- package/src/main/lib/epic/epicMint.cjs +45 -1
- package/src/main/lib/epic/epicReopen.cjs +8 -2
- package/src/main/lib/epic/epicSpawnPlan.cjs +12 -0
- package/src/main/lib/epic/epicWorktreeMerge.cjs +39 -4
- package/src/main/lib/epic/promptSessionsCreateEpic.cjs +9 -4
- package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +2 -0
- package/src/main/lib/git/gitExec.cjs +9 -1
- package/src/main/lib/git/gitWorktree.cjs +94 -0
- package/src/main/lib/git/unifiedDiff.cjs +207 -0
- package/src/main/lib/mdDocCensus.cjs +364 -0
- package/src/main/lib/mdDocRefs.cjs +249 -0
- package/src/main/lib/mdNetworkScan.cjs +158 -15
- package/src/main/lib/persona-macro/macroJobDispatch.cjs +4 -1
- package/src/main/lib/persona-macro/macroJobIpc.cjs +1 -1
- package/src/main/lib/prd/prdCreate.cjs +7 -2
- package/src/main/lib/prd/prdFrontmatter.cjs +10 -3
- package/src/main/lib/promptSessionSchema.cjs +6 -0
- package/src/main/lib/remoteTranscriptTail.cjs +23 -4
- package/src/main/lib/scheduler/landedSinceRun.cjs +2 -1
- package/src/main/lib/scheduler/scheduleJobSchema.cjs +2 -0
- package/src/main/lib/scheduler/schedulerPaths.cjs +3 -0
- package/src/main/projectPages.cjs +14 -3
- package/src/main/scheduler/gitTreeGuard.cjs +2 -1
- package/src/main/scheduler/prdParser.cjs +2 -1
- package/src/main/scheduler.cjs +7 -2
- package/src/main/transcripts.cjs +18 -4
- package/src/main/webRemote.cjs +10 -5
- package/src/preload/api.d.ts +147 -2
- package/src/preload/apiSurface.json +56 -0
- package/src/preload/index.cjs +22 -0
- package/dist/assets/DocumentEditorPane-fm6zsnLM.js +0 -1
- package/dist/assets/Settings-B6r7N4v-.js +0 -2
- package/dist/assets/index-CBCdyHbZ.js +0 -3097
package/src/main/webRemote.cjs
CHANGED
|
@@ -628,11 +628,13 @@ async function tailLines(filePath, fromOffset) {
|
|
|
628
628
|
async function pollSessionWatcher(w) {
|
|
629
629
|
// The transcript may not exist yet (new session) or may live under another
|
|
630
630
|
// project/worktree encoding: re-resolve while the watched file is missing.
|
|
631
|
+
// An agent-CLI (non-Claude) Epic's transcript lives under agentCliSessionStore.
|
|
631
632
|
if (!fs.existsSync(w.filePath)) {
|
|
632
633
|
try {
|
|
633
|
-
const
|
|
634
|
+
const agentPath = require('./lib/remoteTranscriptTail.cjs').agentCliTranscriptPath(w.sessionId);
|
|
635
|
+
const next = agentPath ?? require('./transcripts.cjs').transcriptPath(w.cwd, w.sessionId);
|
|
634
636
|
if (next && next !== w.filePath) {
|
|
635
|
-
validatePath(next);
|
|
637
|
+
if (!agentPath) validatePath(next);
|
|
636
638
|
w.filePath = next;
|
|
637
639
|
w.offset = null;
|
|
638
640
|
w.inode = undefined;
|
|
@@ -674,11 +676,14 @@ async function pollSessionWatcher(w) {
|
|
|
674
676
|
|
|
675
677
|
function startSessionWatch(tabId, cwd, sessionId = tabId) {
|
|
676
678
|
if (_sessionWatchers.has(tabId)) return;
|
|
677
|
-
const
|
|
679
|
+
const claudePath = require('./transcripts.cjs').transcriptPath(cwd, sessionId);
|
|
678
680
|
// Defense in depth: the schema restricts tabId charset, but re-validate the
|
|
679
681
|
// FINAL joined path against the home-dir boundary (validatePath resolves
|
|
680
682
|
// symlinks + rejects escapes) before any fs read. Throws → dispatch drops it.
|
|
681
|
-
validatePath(
|
|
683
|
+
validatePath(claudePath);
|
|
684
|
+
// Agent-CLI Epics: the store builds this path from a UUID-validated id under
|
|
685
|
+
// its own state root (never throws — a bad id resolves to null).
|
|
686
|
+
const filePath = require('./lib/remoteTranscriptTail.cjs').agentCliTranscriptPath(sessionId) ?? claudePath;
|
|
682
687
|
const w = {
|
|
683
688
|
tabId, cwd, sessionId, filePath,
|
|
684
689
|
offset: null, // null → first poll reads a bounded tail then tracks EOF
|
|
@@ -1212,7 +1217,7 @@ function getDispatchMap() {
|
|
|
1212
1217
|
if (!filePath || !sessionId) return { messages: [], hasMore: false, nextBefore: null };
|
|
1213
1218
|
validatePath(filePath);
|
|
1214
1219
|
const exchanges = await listExchanges({ cwd: parsed.cwd, sessionId, limit: limit + 1, offset: before });
|
|
1215
|
-
const tail = before === 0 ? await readRecentChatMessages(filePath, { limit: 30 }) : [];
|
|
1220
|
+
const tail = before === 0 ? await readRecentChatMessages(filePath, { limit: 30, claudeSessionId: sessionId }) : [];
|
|
1216
1221
|
return buildRemoteConversation({ exchanges, tail, limit, before });
|
|
1217
1222
|
},
|
|
1218
1223
|
|
package/src/preload/api.d.ts
CHANGED
|
@@ -309,6 +309,37 @@ export interface McpCatalogResult {
|
|
|
309
309
|
export type AgentPersonaTag = 'feature' | 'bug' | 'discussion' | 'build' | 'project-home-builder' | 'art' | 'portfolio';
|
|
310
310
|
|
|
311
311
|
/** One declared `{{name}}` argument of a macro prompt (macroLibrary.cjs `MacroInputSchema`). */
|
|
312
|
+
export type AppPreviewStatus = 'starting' | 'running' | 'failed' | 'stopped';
|
|
313
|
+
|
|
314
|
+
/** One Epic's dev-server preview. cwd = project root, dir = folder the dev command runs in,
|
|
315
|
+
* command = the script text from package.json, startedAt = ISO time. */
|
|
316
|
+
export interface AppPreviewState {
|
|
317
|
+
epicId: string;
|
|
318
|
+
cwd: string;
|
|
319
|
+
dir: string;
|
|
320
|
+
script: string;
|
|
321
|
+
command: string;
|
|
322
|
+
port: number;
|
|
323
|
+
url: string | null;
|
|
324
|
+
status: AppPreviewStatus;
|
|
325
|
+
error: string | null;
|
|
326
|
+
pid: number | null;
|
|
327
|
+
startedAt: string;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export interface AppPreviewScript {
|
|
331
|
+
name: string;
|
|
332
|
+
command: string;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export type AppPreviewScriptsResult =
|
|
336
|
+
| { ok: true; dir: string; inWorktree: boolean; scripts: AppPreviewScript[]; suggested: string | null }
|
|
337
|
+
| { ok: false; error: string };
|
|
338
|
+
|
|
339
|
+
export type AppPreviewStartResult =
|
|
340
|
+
| { ok: true; state: AppPreviewState }
|
|
341
|
+
| { ok: false; error: string };
|
|
342
|
+
|
|
312
343
|
export interface MacroInput {
|
|
313
344
|
name: string;
|
|
314
345
|
label: string;
|
|
@@ -328,6 +359,9 @@ export interface MacroJobDispatchInput {
|
|
|
328
359
|
macroId: string;
|
|
329
360
|
epicId: string;
|
|
330
361
|
extraInstructions?: string;
|
|
362
|
+
/** Per-launch effort chosen in the high-effort cost dialog: one of low, medium, high, xhigh, max;
|
|
363
|
+
* main refuses anything else. Omitted = the persona's own effort. */
|
|
364
|
+
effort?: string;
|
|
331
365
|
}
|
|
332
366
|
|
|
333
367
|
export type MacroJobDispatchResult =
|
|
@@ -397,6 +431,23 @@ export interface MacroSaveInput {
|
|
|
397
431
|
autoStartTargets?: string[];
|
|
398
432
|
}
|
|
399
433
|
|
|
434
|
+
/** One `agentCli.detect` row — a non-Claude agent CLI and whether it is installed. */
|
|
435
|
+
export interface AgentCliDetectRow {
|
|
436
|
+
id: 'codex' | 'gemini' | 'antigravity' | 'cursor' | 'opencode';
|
|
437
|
+
label: string;
|
|
438
|
+
installed: boolean;
|
|
439
|
+
path: string | null;
|
|
440
|
+
version: string | null;
|
|
441
|
+
install: string | null;
|
|
442
|
+
docs: string;
|
|
443
|
+
login: string | null;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** `agentCli.terminalCommand` result: a single-quoted shell line, or why there is none. */
|
|
447
|
+
export type AgentCliTerminalCommandResult =
|
|
448
|
+
| { ok: true; command: string }
|
|
449
|
+
| { ok: false; message: string };
|
|
450
|
+
|
|
400
451
|
/** One global `~/.claude/agents/<name>.md` persona, per the Agent Library nav page. */
|
|
401
452
|
export interface AgentPersona {
|
|
402
453
|
name: string;
|
|
@@ -1684,7 +1735,11 @@ export interface MdNetworkOrphan {
|
|
|
1684
1735
|
/** Broken links come first (in walk order), then orphan groups (by folder). */
|
|
1685
1736
|
export type MdNetworkFinding = MdNetworkBrokenLink | MdNetworkOrphan;
|
|
1686
1737
|
|
|
1687
|
-
/**
|
|
1738
|
+
/**
|
|
1739
|
+
* A project's markdown link network, mapped from its root CLAUDE.md, plus a per-doc
|
|
1740
|
+
* census of every tracked .md (role, size, git recency, dead/stale refs, code mentions).
|
|
1741
|
+
* Orphan findings leave out docs the census puts in a record collection.
|
|
1742
|
+
*/
|
|
1688
1743
|
export interface MdNetwork {
|
|
1689
1744
|
ok: true;
|
|
1690
1745
|
/** The root doc, 'CLAUDE.md'. */
|
|
@@ -1699,11 +1754,27 @@ export interface MdNetwork {
|
|
|
1699
1754
|
links: number;
|
|
1700
1755
|
/** Top-level folders holding reachable docs, each with a trailing slash, sorted. */
|
|
1701
1756
|
scopes: string[];
|
|
1757
|
+
/** Every tracked .md; docs left unread past the 2000 cap have `lines`/`bytes` null. A failed git call adds a `warnings` entry, never an error. */
|
|
1758
|
+
census: MdCensus;
|
|
1702
1759
|
}
|
|
1703
1760
|
|
|
1704
1761
|
/** `{ ok: false, error }` when there is nothing to map or the scan failed (not a git repo, no root CLAUDE.md, an ephemeral cwd). */
|
|
1705
1762
|
export type MdNetworkResult = MdNetwork | { ok: false; error: string };
|
|
1706
1763
|
|
|
1764
|
+
// ────────────────────────────────────────────── Project Pages: markdown doc census
|
|
1765
|
+
// Mirrors the JSDoc typedefs in src/main/lib/mdDocCensus.cjs.
|
|
1766
|
+
// Every path is repo-relative POSIX; folder strings end with '/'.
|
|
1767
|
+
|
|
1768
|
+
/** How agents meet a doc: 'map' = the root + its @-imports; 'scoped' = another CLAUDE.md / AGENTS.md / CLAUDE.local.md; 'agent' = .claude/, skills/, plugin agents/commands; 'record' = in a record collection and unreachable; 'doc' = anything else. */
|
|
1769
|
+
export type MdDocRole = 'map' | 'scoped' | 'agent' | 'record' | 'doc';
|
|
1770
|
+
|
|
1771
|
+
export interface MdDoc { path: string; role: MdDocRole; depth: number | null; lines: number | null; bytes: number | null; lastCommitMs: number | null; commits: number; linkedFrom: number; codeRefs: number; codeRefFiles: string[]; deadRefs: string[]; changedSince: { path: string; ms: number }[]; collection: string | null; }
|
|
1772
|
+
|
|
1773
|
+
/** A folder of machine-written, write-once, unlinked docs (e.g. validation records). */
|
|
1774
|
+
export interface MdRecordCollection { folder: string; docs: number; linked: number; lastCommitMs: number | null; source: 'heuristic' | 'override'; }
|
|
1775
|
+
|
|
1776
|
+
export interface MdCensus { docs: MdDoc[]; collections: MdRecordCollection[]; counts: { tracked: number; network: number; records: number; unlinked: number; byRole: Record<MdDocRole, number> }; gitWindow: { commits: number; oldestMs: number | null }; warnings: string[]; }
|
|
1777
|
+
|
|
1707
1778
|
// ────────────────────────────────────────────── Competitor matrix
|
|
1708
1779
|
// Mirrors CompetitiveMatrixSchema in src/main/lib/project-pages/competitiveMatrix.cjs — keep field-for-field.
|
|
1709
1780
|
|
|
@@ -1824,6 +1895,52 @@ export interface GitFileStatus {
|
|
|
1824
1895
|
workTreeStatus: string;
|
|
1825
1896
|
}
|
|
1826
1897
|
|
|
1898
|
+
/** One line of a unified-diff hunk. `oldNo`/`newNo` are null on the side the line doesn't exist. */
|
|
1899
|
+
export interface DiffLine {
|
|
1900
|
+
kind: 'add' | 'del' | 'ctx';
|
|
1901
|
+
oldNo: number | null;
|
|
1902
|
+
newNo: number | null;
|
|
1903
|
+
text: string;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
export interface DiffHunk {
|
|
1907
|
+
header: string;
|
|
1908
|
+
oldStart: number;
|
|
1909
|
+
oldLines: number;
|
|
1910
|
+
newStart: number;
|
|
1911
|
+
newLines: number;
|
|
1912
|
+
lines: DiffLine[];
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
export interface DiffFile {
|
|
1916
|
+
path: string;
|
|
1917
|
+
oldPath: string | null;
|
|
1918
|
+
status: 'added' | 'deleted' | 'modified' | 'renamed';
|
|
1919
|
+
binary: boolean;
|
|
1920
|
+
additions: number;
|
|
1921
|
+
deletions: number;
|
|
1922
|
+
hunks: DiffHunk[];
|
|
1923
|
+
truncated: boolean;
|
|
1924
|
+
tooLarge?: boolean;
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
/** One reviewable slice of an Epic's changes: the session's own worktree work, or one landed PRD. */
|
|
1928
|
+
export interface EpicChangeSection {
|
|
1929
|
+
kind: 'session' | 'prd';
|
|
1930
|
+
key: string;
|
|
1931
|
+
label: string;
|
|
1932
|
+
slug?: string;
|
|
1933
|
+
base: string | null;
|
|
1934
|
+
head: string | null;
|
|
1935
|
+
live: boolean;
|
|
1936
|
+
files: DiffFile[];
|
|
1937
|
+
error?: string;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
export type EpicChanges =
|
|
1941
|
+
| { ok: true; epicId: string; status: string; sections: EpicChangeSection[]; truncated: boolean }
|
|
1942
|
+
| { ok: false; reason: string };
|
|
1943
|
+
|
|
1827
1944
|
export interface GitStatusResult {
|
|
1828
1945
|
branch: string;
|
|
1829
1946
|
ahead: number;
|
|
@@ -2142,6 +2259,13 @@ export interface SessionManagerAPI {
|
|
|
2142
2259
|
/** Desktop-only: the web remote is denied it (apiSurface remote: deny) — it spawns the server. */
|
|
2143
2260
|
checkServer: (req: McpCheckRequest) => Promise<McpCheckResult>;
|
|
2144
2261
|
};
|
|
2262
|
+
/** Non-Claude agent CLIs (main-side registry + adapters). Desktop-only: not exposed to the web remote. */
|
|
2263
|
+
agentCli: {
|
|
2264
|
+
/** One row per non-Claude CLI; cached 60 s in main unless `refresh`. Never rejects. */
|
|
2265
|
+
detect: (payload?: { refresh?: boolean }) => Promise<AgentCliDetectRow[]>;
|
|
2266
|
+
/** The exact shell line (no trailing CR) the Epic Terminal pane types to launch/resume this Epic's CLI. */
|
|
2267
|
+
terminalCommand: (payload: { cwd: string; claudeSessionId: string }) => Promise<AgentCliTerminalCommandResult>;
|
|
2268
|
+
};
|
|
2145
2269
|
agents: {
|
|
2146
2270
|
listPersonas: () => Promise<AgentPersona[]>;
|
|
2147
2271
|
savePersona: (payload: AgentPersonaSaveInput) => Promise<{ ok: boolean; path: string }>;
|
|
@@ -2206,6 +2330,18 @@ export interface SessionManagerAPI {
|
|
|
2206
2330
|
/** Fires after any save/delete/setProject — re-fetch list(). */
|
|
2207
2331
|
onChanged: (handler: () => void) => () => void;
|
|
2208
2332
|
};
|
|
2333
|
+
appPreview: {
|
|
2334
|
+
/** The Epic's package.json scripts (dir = worktree when it has one) plus a suggested dev script. */
|
|
2335
|
+
scripts: (payload: { cwd: string; epicId: string }) => Promise<AppPreviewScriptsResult>;
|
|
2336
|
+
/** Spawns the Epic's dev script on a free port after the user confirmed it; desktop only. */
|
|
2337
|
+
start: (payload: { cwd: string; epicId: string; script: string }) => Promise<AppPreviewStartResult>;
|
|
2338
|
+
/** Stops the Epic's preview process, if any. */
|
|
2339
|
+
stop: (payload: { epicId: string }) => Promise<{ ok: true }>;
|
|
2340
|
+
/** Every tracked preview, one per Epic. */
|
|
2341
|
+
list: () => Promise<AppPreviewState[]>;
|
|
2342
|
+
/** Fires on every preview state change with the new state. */
|
|
2343
|
+
onChanged(handler: (state: AppPreviewState) => void): () => void;
|
|
2344
|
+
};
|
|
2209
2345
|
models: {
|
|
2210
2346
|
/** Live model/effort catalog (`modelCatalog.cjs`'s `resolveModelCatalog`). Never rejects from
|
|
2211
2347
|
* the resolver itself — a failed probe degrades down cache → floor and sets `degraded`.
|
|
@@ -2523,7 +2659,7 @@ export interface SessionManagerAPI {
|
|
|
2523
2659
|
/** Read the project-pages library (knowledge/<id>/ pages and videos/<id>/ videos, each with its meta) as a `ProjectPagesGetResult`; empty lists if nothing exists yet. Never fires an LLM call. */
|
|
2524
2660
|
get: (cwd: string) => Promise<ProjectPagesGetResult>;
|
|
2525
2661
|
/** Map the project's markdown link network from its root CLAUDE.md (read-only, bounded, no LLM) for the Tools pane. Scans on every call — no watcher, no cache. `ok:false` (with `error`) for a cwd `get` answers with empty lists (tmpdir / linked worktree), a folder that is not a git repo, or no root CLAUDE.md; rejects on an invalid cwd, like `get`. */
|
|
2526
|
-
mdNetwork: (payload: { cwd: string }) => Promise<MdNetworkResult>;
|
|
2662
|
+
mdNetwork: (payload: { cwd: string; recordFolders?: string[]; docFolders?: string[] }) => Promise<MdNetworkResult>;
|
|
2527
2663
|
/** Read the saved Competitor matrix (project-pages/matrix/matrix.json) — read-only; writes go through project_matrix_write. */
|
|
2528
2664
|
matrix: (payload: { cwd: string }) => Promise<CompetitorMatrixResult>;
|
|
2529
2665
|
/** Start pushing `onChanged` events for this cwd's output dir. Refcounted per cwd; `ok:false` (reason 'ephemeral'|'invalid-cwd') means no live updates are possible, not an error. */
|
|
@@ -2554,6 +2690,11 @@ export interface SessionManagerAPI {
|
|
|
2554
2690
|
* Read-only, no new writer — reads zero on any missing/unreadable state, never throws. */
|
|
2555
2691
|
get: (cwd: string, epicId: string, claudeSessionId?: string | null) => Promise<{ prdsQueued: number; inlineEdits: number }>;
|
|
2556
2692
|
};
|
|
2693
|
+
epicChanges: {
|
|
2694
|
+
/** Read-only diff of an Epic's changes, sectioned by session pin and per-PRD landed commit.
|
|
2695
|
+
* Never throws for a missing Epic/worktree — resolves `{ ok: false, reason }`. */
|
|
2696
|
+
get: (args: { cwd: string; epicId: string }) => Promise<EpicChanges>;
|
|
2697
|
+
};
|
|
2557
2698
|
auditLog: {
|
|
2558
2699
|
/** Append one Epic-lifecycle audit event to ~/.claude/session-manager/audit-log.jsonl.
|
|
2559
2700
|
* Kind allowlist is enforced main-side (ipcSchemas.cjs) — this channel is
|
|
@@ -2751,6 +2892,10 @@ export interface PromptSessionsCreateEpicPayload {
|
|
|
2751
2892
|
}>;
|
|
2752
2893
|
/** Adopt an existing CLI session of this project instead of minting one. */
|
|
2753
2894
|
restoreSessionId?: string;
|
|
2895
|
+
/** Agent CLI driving this Epic; absent = Claude Code. Non-Claude forces developLoop false and refuses restore. */
|
|
2896
|
+
agentCli?: 'claude' | 'codex' | 'gemini' | 'antigravity' | 'cursor' | 'opencode';
|
|
2897
|
+
/** Model for a non-Claude CLI; absent = that CLI's default. */
|
|
2898
|
+
agentCliModel?: string;
|
|
2754
2899
|
}
|
|
2755
2900
|
|
|
2756
2901
|
export interface PromptSessionsCreateEpicResult {
|
|
@@ -356,6 +356,20 @@
|
|
|
356
356
|
"kind": "invoke",
|
|
357
357
|
"remote": "deny"
|
|
358
358
|
},
|
|
359
|
+
{
|
|
360
|
+
"ns": "agentCli",
|
|
361
|
+
"method": "detect",
|
|
362
|
+
"channel": "agentCli:detect",
|
|
363
|
+
"kind": "invoke",
|
|
364
|
+
"remote": "deny"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"ns": "agentCli",
|
|
368
|
+
"method": "terminalCommand",
|
|
369
|
+
"channel": "agentCli:terminal-command",
|
|
370
|
+
"kind": "invoke",
|
|
371
|
+
"remote": "deny"
|
|
372
|
+
},
|
|
359
373
|
{
|
|
360
374
|
"ns": "agents",
|
|
361
375
|
"method": "listPersonas",
|
|
@@ -475,6 +489,41 @@
|
|
|
475
489
|
"kind": "on",
|
|
476
490
|
"remote": "read"
|
|
477
491
|
},
|
|
492
|
+
{
|
|
493
|
+
"ns": "appPreview",
|
|
494
|
+
"method": "scripts",
|
|
495
|
+
"channel": "appPreview:scripts",
|
|
496
|
+
"kind": "invoke",
|
|
497
|
+
"remote": "deny"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"ns": "appPreview",
|
|
501
|
+
"method": "start",
|
|
502
|
+
"channel": "appPreview:start",
|
|
503
|
+
"kind": "invoke",
|
|
504
|
+
"remote": "deny"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"ns": "appPreview",
|
|
508
|
+
"method": "stop",
|
|
509
|
+
"channel": "appPreview:stop",
|
|
510
|
+
"kind": "invoke",
|
|
511
|
+
"remote": "mutate"
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"ns": "appPreview",
|
|
515
|
+
"method": "list",
|
|
516
|
+
"channel": "appPreview:list",
|
|
517
|
+
"kind": "invoke",
|
|
518
|
+
"remote": "read"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"ns": "appPreview",
|
|
522
|
+
"method": "onChanged",
|
|
523
|
+
"channel": "appPreview:changed",
|
|
524
|
+
"kind": "on",
|
|
525
|
+
"remote": "read"
|
|
526
|
+
},
|
|
478
527
|
{
|
|
479
528
|
"ns": "models",
|
|
480
529
|
"method": "catalog",
|
|
@@ -1448,6 +1497,13 @@
|
|
|
1448
1497
|
"kind": "invoke",
|
|
1449
1498
|
"remote": "read"
|
|
1450
1499
|
},
|
|
1500
|
+
{
|
|
1501
|
+
"ns": "epicChanges",
|
|
1502
|
+
"method": "get",
|
|
1503
|
+
"channel": "epicChanges:get",
|
|
1504
|
+
"kind": "invoke",
|
|
1505
|
+
"remote": "read"
|
|
1506
|
+
},
|
|
1451
1507
|
{
|
|
1452
1508
|
"ns": "auditLog",
|
|
1453
1509
|
"method": "append",
|
package/src/preload/index.cjs
CHANGED
|
@@ -121,6 +121,11 @@ contextBridge.exposeInMainWorld('api', {
|
|
|
121
121
|
// Desktop-only (apiSurface remote: deny) — main spawns the named server's configured command.
|
|
122
122
|
checkServer: (req) => ipcRenderer.invoke('mcp:check-server', req),
|
|
123
123
|
},
|
|
124
|
+
// Non-Claude agent CLIs (desktop-only; apiSurface remote: deny).
|
|
125
|
+
agentCli: {
|
|
126
|
+
detect: (payload) => ipcRenderer.invoke('agentCli:detect', payload),
|
|
127
|
+
terminalCommand: (payload) => ipcRenderer.invoke('agentCli:terminal-command', payload),
|
|
128
|
+
},
|
|
124
129
|
agents: {
|
|
125
130
|
listPersonas: () => ipcRenderer.invoke('agents:list-personas'),
|
|
126
131
|
savePersona: (payload) => ipcRenderer.invoke('agents:save-persona', payload),
|
|
@@ -153,6 +158,18 @@ contextBridge.exposeInMainWorld('api', {
|
|
|
153
158
|
return () => ipcRenderer.removeListener('macros:changed', listener);
|
|
154
159
|
},
|
|
155
160
|
},
|
|
161
|
+
appPreview: {
|
|
162
|
+
scripts: (payload) => ipcRenderer.invoke('appPreview:scripts', payload),
|
|
163
|
+
start: (payload) => ipcRenderer.invoke('appPreview:start', payload),
|
|
164
|
+
stop: (payload) => ipcRenderer.invoke('appPreview:stop', payload),
|
|
165
|
+
list: () => ipcRenderer.invoke('appPreview:list'),
|
|
166
|
+
// Fired on every preview state change; forwards the AppPreviewState payload.
|
|
167
|
+
onChanged: (handler) => {
|
|
168
|
+
const listener = (_e, state) => handler(state);
|
|
169
|
+
ipcRenderer.on('appPreview:changed', listener);
|
|
170
|
+
return () => ipcRenderer.removeListener('appPreview:changed', listener);
|
|
171
|
+
},
|
|
172
|
+
},
|
|
156
173
|
models: {
|
|
157
174
|
catalog: (payload) => ipcRenderer.invoke('models:catalog', payload),
|
|
158
175
|
},
|
|
@@ -420,6 +437,11 @@ contextBridge.exposeInMainWorld('api', {
|
|
|
420
437
|
get: (cwd, epicId, claudeSessionId) =>
|
|
421
438
|
ipcRenderer.invoke('epicDelegationStats:get', { cwd, epicId, claudeSessionId: claudeSessionId ?? null }),
|
|
422
439
|
},
|
|
440
|
+
epicChanges: {
|
|
441
|
+
// ONE payload object ({ cwd, epicId }) — the web remote forwards renderer
|
|
442
|
+
// args unchanged to handler(event, ...args) and validated() reads one payload.
|
|
443
|
+
get: (args) => ipcRenderer.invoke('epicChanges:get', args),
|
|
444
|
+
},
|
|
423
445
|
auditLog: {
|
|
424
446
|
append: (kind, fields) => ipcRenderer.invoke('auditLog:append', { kind, ...fields }),
|
|
425
447
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bd as $,au as z,av as B,b0 as V,aN as i,ad as q,ax as e,f as y,a8 as b,i as g,s as j,r as w,j as A,ah as F}from"./index-CBCdyHbZ.js";function H({path:s,value:r,onChange:v,onSave:c,readOnly:l,defaultMode:N,headerRight:k,hideStatusBar:M}){const u=$(),o=z(s),a=B(s),R=V(s),[E,C]=i.useState(()=>l&&a?"preview":N??q(s)),[x,P]=i.useState(!0),[S,D]=i.useState(null),m=i.useRef(null),d=i.useRef(null),T=i.useCallback(t=>{m.current=t},[]),p=i.useCallback(()=>m.current,[]),h=l?a?["preview","edit"]:[]:R?["edit","preview","split"]:a?["edit","preview"]:[],n=a?E:"edit",f=e.jsx(y,{path:s,name:b(s),value:r,onChange:v,onSave:()=>c==null?void 0:c(),onReady:T,onCursor:D,readOnly:l});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:b(s)}),l&&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"}),k,o&&(n==="preview"||n==="split")&&e.jsx("button",{onClick:()=>P(t=>!t),"data-testid":"document-outline-toggle",className:`px-2 py-0.5 text-[10px] border border-line rounded ${x?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,title:"Toggle document outline",children:"Outline"}),h.length>0&&e.jsx("div",{className:"flex items-center ml-1 rounded border border-line overflow-hidden","data-testid":"document-mode-toggle",children:h.map(t=>e.jsx("button",{onClick:()=>C(t),className:`px-2 py-0.5 text-[10px] capitalize transition-colors ${n===t?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,children:t},t))})]}),e.jsx("div",{className:"flex-1 min-h-0",children:n==="split"&&o?e.jsxs("div",{className:"flex h-full",children:[x&&e.jsx(g,{text:r,scrollRef:d}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-line",children:[!l&&e.jsx(j,{getEditor:p}),e.jsx("div",{className:"flex-1 min-h-0",children:f})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(w,{ref:d,text:r,flush:!0,wideMeasure:u.wideMeasure})})]}):n==="preview"&&o?e.jsxs("div",{className:"flex h-full",children:[x&&e.jsx(g,{text:r,scrollRef:d}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(w,{ref:d,text:r,wideMeasure:u.wideMeasure})})]}):o?e.jsxs("div",{className:"flex flex-col h-full",children:[!l&&e.jsx(j,{getEditor:p}),e.jsx("div",{className:"flex-1 min-h-0",children:f})]}):f}),!M&&e.jsx(A,{text:r,cursor:S,language:F(s)||void 0})]})}export{H as D};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b8 as T,ax as e,b4 as R,aN as y,be as L,b5 as V,bg as z,bn as H,w as le,l as C,a4 as ce,v as de,T as Y,S,a as ue,bp as B,bj as pe,aB as me,aF as xe,J as he,as as fe}from"./index-CBCdyHbZ.js";import{P as F}from"./Panel-C7EFG4eU.js";import{P as ge,H as be,S as ye}from"./Library-R71t6VAB.js";import{S as I}from"./SourceChip-uyVMCZc7.js";import{V as U}from"./ViewTabs-BDkvvzJ8.js";import{r as Z}from"./claude-settings-schema-COigsajx.js";import{L as je}from"./ListDetail-CG50Ul7c.js";import{a as ve}from"./ProvenanceBadge-C3KB3ILO.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-BzG_KdBC.js";function ke(t){const s=t??{},n={...s.$defs??{},...s.definitions??{}},r=i=>{if(!i)return{};if(!i.$ref)return l(i);const u=/^#\/(\$defs|definitions)\/(.+)$/.exec(i.$ref);if(!u)return l(i);const h=n[u[2]];return h?r({...h,...p(i)}):l(i)},a=new Set(["__proto__","constructor","prototype"]),o=i=>{if(!i)return{};const u={};for(const[h,f]of Object.entries(i))a.has(h)||(u[h]=f);return u},l=i=>{if(!i.allOf||i.allOf.length===0)return i;const u={...i};delete u.allOf;for(const h of i.allOf){const f=r(h);Object.assign(u,{properties:{...o(u.properties),...o(f.properties)},required:we([...u.required??[],...f.required??[]])}),!u.description&&f.description&&(u.description=f.description),u.default===void 0&&f.default!==void 0&&(u.default=f.default),!u.type&&f.type&&(u.type=f.type)}return u},p=i=>{const{$ref:u,...h}=i;return h},d=(i,u)=>{let h=r(i);for(const f of u){if(!h)return null;if(/^\d+$/.test(f)){const k=Array.isArray(h.items)?h.items[Number(f)]:h.items;h=k?r(k):null;continue}const N=h.properties;if(N&&!a.has(f)&&f in N){h=r(N[f]);continue}const g=h.additionalProperties;if(g&&typeof g=="object"){h=r(g);continue}return null}return h},c=(i,u,h)=>{if(!i)return null;const f={};if(i.description&&(f.description=i.description),i.type&&(f.type=i.type),i.default!==void 0&&(f.default=i.default),i.enum&&(f.enum=i.enum),i.const!==void 0&&(f.const=i.const),i.deprecated&&(f.deprecated=!0),i.examples&&(f.examples=i.examples),i.properties&&(f.knownChildren=Object.keys(i.properties)),h&&(u!=null&&u.includes(h))&&(f.required=!0),i.items&&!Array.isArray(i.items)){const N=r(i.items),g=c(N,void 0,null);g&&(f.itemsInfo=g)}return(i.additionalProperties===!0||typeof i.additionalProperties=="object")&&(f.open=!0),f},x=i=>u=>{if(u.length===0)return c(r(i),void 0,null);const h=d(i,u.slice(0,-1));if(!h)return null;const f=u[u.length-1],N=d(h,[f]);return c(N,h.required,f)},v=i=>{const u=r(i);return Object.keys(u.properties??{})},j=i=>({at:x(i),rootKeys:()=>v(i),rootedAt:u=>{const h=d(i,u);return j(h??{})}});return j(s)}function we(t){return Array.from(new Set(t))}let D=null;function Q(){return D||(D=ke(Z)),D}const Ne=["allow","deny","ask"],K="This settings file has invalid JSON. Fix it in the Settings raw editor first; Permissions will not overwrite it.";function Se(t){if(t.trim()==="")return{perms:{},full:{},err:null};try{const s=JSON.parse(t);if(s===null||typeof s!="object"||Array.isArray(s))return{perms:{},full:{},err:"settings file is not a JSON object"};const n=s;return{perms:n.permissions??{},full:n,err:null}}catch(s){return{perms:{},full:{},err:s.message}}}function Ce({scope:t="user"}={}){const s=L(),n=V(),r=(n==null?void 0:n.cwd)??null,a=z(i=>i.navFace),[o,l]=y.useState("rules");y.useEffect(()=>{a==="project"&&o==="presets"&&l("rules")},[a,o]);const d=H(le,s,r)[t]??null,c=T(i=>i.files),x=e.jsx(U,{options:[{key:"rules",label:"Rules"},...a==="home"?[{key:"presets",label:"Presets"}]:[]],active:o,onChange:l});if(!s)return e.jsx(C,{title:"loading…"});if(o==="presets")return e.jsx(F,{toolbar:x,children:e.jsx(ge,{})});const v=i=>i!=="user"&&!r,j=d?c[d]:null;return e.jsx(F,{toolbar:e.jsxs(e.Fragment,{children:[x,e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:d??"—"}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings#permissions",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"rule syntax ↗"})]}),children:v(t)?e.jsx(C,{title:"no active project",hint:"open a tab in a project directory to edit project or local permissions"}):d&&j?e.jsx(X,{scope:t,cwd:r,activePath:d}):e.jsx(C,{title:"resolving…"})})}y.memo(Ce);function X({scope:t,cwd:s,activePath:n}){const r=T(c=>c.files[n]),{perms:a,err:o}=r?Se(r.draftRaw):{perms:{},err:null},l=(c,x)=>{if(o){R.error(K);return}window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:s,keyPath:["permissions",c],value:x}).catch(v=>R.error(v instanceof Error?v.message:String(v)))},p=(c,x)=>{const v=x.trim();if(!v)return;const j=a[c]??[];j.includes(v)||l(c,[...j,v])},d=(c,x)=>{const v=a[c]??[];l(c,v.filter((j,i)=>i!==x))};return e.jsxs("div",{className:"p-4 space-y-5 max-w-3xl",children:[o&&e.jsxs("div",{role:"alert",className:"text-xs text-red-400 border border-red-400/40 rounded px-3 py-2",children:[K," (",o,")"]}),e.jsx(_e,{value:a.defaultMode??"default",onChange:c=>l("defaultMode",c)}),Ne.map(c=>e.jsx(Ee,{list:c,rules:a[c]??[],disabled:!!o,onAdd:x=>p(c,x),onRemove:x=>d(c,x)},c)),e.jsx(Pe,{dirs:a.additionalDirectories??[],disabled:!!o,onChange:c=>l("additionalDirectories",c)})]})}function _e({value:t,onChange:s}){var o;const r=(((o=Q().at(["permissions","defaultMode"]))==null?void 0:o.enum)??[]).filter(l=>typeof l=="string"),a=t&&!r.includes(t)?[...r,t]:r;return e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs text-fg uppercase tracking-wider mb-2",children:"Default Mode"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:a.map(l=>e.jsx("button",{onClick:()=>s(l),className:`px-2.5 py-1 text-xs transition-colors ${t===l?"bg-bg-hi text-fg":"bg-bg-elev text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:l},l))})]})}function Ee({list:t,rules:s,onAdd:n,onRemove:r,disabled:a}){const[o,l]=y.useState(""),p=t==="allow"?"text-green-400":t==="deny"?"text-red-400":"text-yellow-400";return e.jsxs("section",{children:[e.jsx("h3",{className:`text-xs uppercase tracking-wider mb-2 ${p}`,children:t}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("input",{value:o,disabled:a,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(n(o),l(""))},placeholder:t==="allow"?"e.g. Bash(ls:*) or Read(~/.claude/**)":"e.g. Write(/etc/**)",className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg placeholder-fg-faint"}),e.jsx("button",{onClick:()=>{n(o),l("")},disabled:a||!o.trim(),className:"px-2.5 py-1 border border-line rounded text-xs text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40",children:"add"})]}),s.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no rules"}):e.jsx("ul",{className:"space-y-0.5",children:s.map((d,c)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs font-mono bg-bg-elev border border-line rounded px-2 py-1",children:[e.jsx("span",{className:"flex-1 text-fg-dim truncate",children:d}),e.jsx("button",{onClick:()=>r(c),className:"text-fg-faint hover:text-red-400",title:"remove",children:"×"})]},`${c}-${d}`))})]})}function Pe({dirs:t,onChange:s,disabled:n}){const[r,a]=y.useState("");return e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs text-fg uppercase tracking-wider mb-2",children:"Additional Directories"}),e.jsx("div",{className:"flex gap-2 mb-2",children:e.jsx("input",{value:r,disabled:n,onChange:o=>a(o.target.value),onKeyDown:o=>{o.key==="Enter"&&r.trim()&&(s([...t,r.trim()]),a(""))},placeholder:"/absolute/path/to/dir",className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg placeholder-fg-faint"})}),e.jsx("ul",{className:"space-y-0.5",children:t.map((o,l)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs font-mono bg-bg-elev border border-line rounded px-2 py-1",children:[e.jsx("span",{className:"flex-1 text-fg-dim truncate",children:o}),e.jsx("button",{onClick:()=>s(t.filter((p,d)=>d!==l)),className:"text-fg-faint hover:text-red-400",children:"×"})]},`${l}-${o}`))})]})}const Te={UserPromptSubmit:{when:"Fires just before the user prompt is sent to the model.",payload:"{ prompt: string }",example:"Block submission if the prompt mentions a secret."},UserPromptExpansion:{when:"Fires when a slash command expands into its final prompt text.",payload:"{ command: string, expanded: string }",example:"Audit which slash commands actually run, post-expansion."},PreToolUse:{when:"Fires before any tool runs. Can block the call.",payload:"{ tool_name: string, tool_input: object }",example:'matcher="Bash" — block dangerous shell commands.'},PostToolUse:{when:"Fires after a tool completes successfully.",payload:"{ tool_name: string, tool_input: object, tool_result: string }",example:'matcher="Write|Edit" — run a linter on changed files.'},PostToolUseFailure:{when:"Fires after a tool errors out (non-zero exit, exception, or refusal).",payload:"{ tool_name: string, tool_input: object, error: string }",example:"Pipe failed Bash runs into a desktop notification."},PostToolBatch:{when:"Fires once after a parallel batch of tool calls all complete.",payload:"{ tool_uses: Array<{ tool_name, tool_input, tool_result? }> }",example:"Aggregate file-edit batches into a single commit message."},Stop:{when:"Fires when the model emits end_turn.",payload:"{ stop_reason: string, output_tokens: number }",example:"Play a chime when the agent finishes a long task."},StopFailure:{when:"Fires when a turn aborts without end_turn (rate-limit, network, OOM).",payload:'{ reason: "rate_limit"|"network"|"oom"|"killed"|string }',example:"Auto-resume on transient failures."},SessionStart:{when:"Fires once when a session boots (claude or claude -p).",payload:'{ source: "startup"|"resume", model: string, agent_type: string }',example:"Inject a project-specific system prompt addendum."},SessionEnd:{when:"Fires once when the session terminates.",payload:'{ reason: "user_quit"|"timeout"|"error"|string }',example:"Persist transcript summary to ~/.claude/projects/<>."},Setup:{when:"Fires during interactive setup (claude /setup, /init).",payload:'{ mode: "init"|"reconfigure"|string }'},PreCompact:{when:"Fires before transcript compaction runs.",payload:'{ transcript_path: string, trigger: "manual"|"auto" }',example:"Snapshot the pre-compact transcript for later diffing."},PostCompact:{when:"Fires after compaction; the active transcript is the compacted one.",payload:'{ transcript_path: string, trigger: "manual"|"auto" }'},InstructionsLoaded:{when:"Fires after CLAUDE.md and any imported memory files are loaded.",payload:'{ source: "session_start"|"reload" }'},Notification:{when:"Fires when Claude Code emits a desktop notification.",payload:"{ title: string, message: string }",example:"Forward to your own notify-send / osascript pipeline."},PermissionRequest:{when:"Fires when a tool needs user permission (per the permissions block).",payload:"{ tool_name: string, tool_input?: object }",example:"Auto-allow npm test invocations."},PermissionDenied:{when:"Fires when the user (or policy) denies a permission request.",payload:"{ tool_name: string, retry: boolean }",example:"Track which tools the user habitually rejects."},SubagentStart:{when:"Fires when a subagent (Task tool) spawns.",payload:"{ agent_type: string }",example:'matcher="security-reviewer" — log every security scan.'},SubagentStop:{when:"Fires when a subagent finishes.",payload:'{ agent_type: string, reason: "end_turn"|"error"|string }'},TeammateIdle:{when:"Fires when a teammate agent goes idle (waiting for input).",payload:"{ teammate_id?: string }"},TaskCreated:{when:"Fires when a new Task is created via the Task tool.",payload:"{ task: { description: string, ...} }",example:"Track each spawned task in an external queue."},TaskCompleted:{when:"Fires when a Task completes (success or failure).",payload:"{ task: { description: string, ...} }"},ConfigChange:{when:"Fires when settings.json (any scope) is mutated mid-session.",payload:'{ source: "user_settings"|"project_settings"|"local_settings" }',example:"Reload tooling that depends on env vars on config change."},CwdChanged:{when:"Fires when the working directory changes (e.g. agent cd-ing).",payload:"{ old_cwd: string, new_cwd: string }",example:"Refresh project-scoped indexers when cwd drifts."},FileChanged:{when:"Fires when a watched file outside Claude Code's edits changes.",payload:'{ file_path: string, change_type: "modified"|"created"|"deleted" }',example:"Re-run typecheck when any .ts file changes."},WorktreeCreate:{when:"Fires after a git worktree is created via /worktree or subagent isolation.",payload:"{ worktree_path?: string, branch?: string }"},WorktreeRemove:{when:"Fires after a git worktree is removed.",payload:"{ worktree_path?: string }"},Elicitation:{when:"Fires when Claude asks the user a multiple-choice question.",payload:'{ action: "accept"|"reject", ...}'},ElicitationResult:{when:"Fires after the user resolves an elicitation prompt.",payload:"{ choice?: string }"}},ee=["UserPromptSubmit","UserPromptExpansion","PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Stop","StopFailure","SessionStart","SessionEnd","Setup","PreCompact","PostCompact","InstructionsLoaded","Notification","PermissionRequest","PermissionDenied","SubagentStart","SubagentStop","TeammateIdle","TaskCreated","TaskCompleted","ConfigChange","CwdChanged","FileChanged","WorktreeCreate","WorktreeRemove","Elicitation","ElicitationResult"],Fe=new Set(ee),Oe=["command","http","prompt","agent","mcp_tool"],Ae={UserPromptSubmit:{prompt:"hello"},UserPromptExpansion:{command:"/example",expanded:"hello"},PreToolUse:{tool_name:"Bash",tool_input:{command:"ls"}},PostToolUse:{tool_name:"Bash",tool_input:{command:"ls"},tool_result:""},PostToolUseFailure:{tool_name:"Bash",tool_input:{command:"ls"},error:""},PostToolBatch:{tool_uses:[]},Stop:{stop_reason:"end_turn",output_tokens:0},StopFailure:{reason:"rate_limit"},SessionStart:{source:"startup",model:"",agent_type:""},SessionEnd:{reason:"user_quit"},Setup:{mode:"init"},PreCompact:{transcript_path:"",trigger:"manual"},PostCompact:{transcript_path:"",trigger:"manual"},InstructionsLoaded:{source:"session_start"},Notification:{title:"test",message:"test notification"},PermissionRequest:{tool_name:"Bash"},PermissionDenied:{tool_name:"Bash",retry:!1},SubagentStart:{agent_type:"general-purpose"},SubagentStop:{agent_type:"general-purpose",reason:"end_turn"},TeammateIdle:{},TaskCreated:{task:{description:""}},TaskCompleted:{task:{description:""}},ConfigChange:{source:"user_settings"},CwdChanged:{old_cwd:"",new_cwd:""},FileChanged:{file_path:"",change_type:"modified"},WorktreeCreate:{},WorktreeRemove:{},Elicitation:{action:"accept"},ElicitationResult:{}},J="This settings file has invalid JSON. Fix it in the Settings raw editor first; Hooks will not overwrite it.";function Me(t){if(t.trim()==="")return{full:{},hooks:{},err:null};try{const s=JSON.parse(t);if(s===null||typeof s!="object"||Array.isArray(s))return{full:{},hooks:{},err:"settings file is not a JSON object"};const n=s;return{full:n,hooks:n.hooks??{},err:null}}catch(s){return{full:{},hooks:{},err:s.message}}}function Re(t,s){return(t[s]??[]).reduce((n,r)=>{var a;return n+(((a=r.hooks)==null?void 0:a.length)??0)},0)}function $e({scope:t="user"}={}){const s=L(),n=V(),r=(n==null?void 0:n.cwd)??null,a=z(x=>x.navFace),[o,l]=y.useState("events");y.useEffect(()=>{a==="project"&&o==="library"&&l("events")},[a,o]);const d=H(Y,s,r)[t]??null,c=e.jsx(U,{options:[{key:"events",label:"Events"},...a==="home"?[{key:"library",label:"Library"}]:[]],active:o,onChange:l});return s?o==="library"?e.jsx(F,{toolbar:c,children:e.jsx(be,{})}):t!=="user"&&!r?e.jsx(F,{toolbar:e.jsx(e.Fragment,{children:c}),children:e.jsx(C,{title:"no active project"})}):d?e.jsx(F,{toolbar:e.jsxs(e.Fragment,{children:[c,e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:d}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/hooks",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"hook reference ↗"})]}),children:e.jsx(te,{scope:t,cwd:r,path:d})}):e.jsx(C,{title:"loading…"}):e.jsx(C,{title:"loading…"})}function te({scope:t,cwd:s,path:n}){const[r,a]=y.useState("PreToolUse"),[o,l]=y.useState(null),p=(g,k)=>{window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:s,keyPath:g,value:k}).catch(m=>R.error(m instanceof Error?m.message:String(m)))},d=T(g=>g.files[n]),{hooks:c,err:x}=d?Me(d.draftRaw):{hooks:{},err:null},v=Object.keys(c).filter(g=>!Fe.has(g)),j=v.reduce((g,k)=>g+(c[k]??[]).reduce((m,b)=>{var w;return m+(((w=b.hooks)==null?void 0:w.length)??0)},0),0),i=(g,k)=>{if(x){R.error(J);return}p(["hooks",g],k)},u=c[r]??[],h=()=>{i(r,[...u,{matcher:"",hooks:[{type:"command",command:""}]}])},f=(g,k)=>{const m=u.slice();m[g]=k,i(r,m)},N=g=>{i(r,u.filter((k,m)=>m!==g))};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full",children:[x?e.jsxs("div",{role:"alert",className:"px-3 py-2 border-b border-line text-xs text-red-400",children:[J," (",x,")"]}):null,j>0?e.jsxs("div",{className:"px-3 py-2 border-b border-line text-xs bg-bg-elev text-fg-dim",children:[e.jsx("span",{className:"text-yellow-400",children:"⚠"})," ",j," hook(s) configured under unknown event names: ",e.jsx("span",{className:"font-mono text-fg",children:v.join(", ")}),e.jsx("span",{className:"text-fg-faint",children:" · these are ignored by Claude Code 2026; edit settings.json directly to remove."})]}):null,e.jsx(je,{sidebarWidth:"14rem",sidebar:e.jsx("div",{className:"py-1",children:ee.map(g=>{const k=Re(c,g),m=Te[g],b=m?e.jsxs("span",{className:"block space-y-1",children:[e.jsx("span",{className:"block text-fg",children:m.when}),e.jsxs("span",{className:"block text-fg-faint font-mono",children:["payload: ",m.payload]}),m.example?e.jsxs("span",{className:"block text-fg-faint italic",children:["e.g. ",m.example]}):null]}):e.jsx("span",{className:"text-fg-faint italic",children:"no documentation yet"});return e.jsx("div",{className:"[&>span]:w-full",children:e.jsx(ce,{content:b,align:"bottom-center",children:e.jsxs("button",{onClick:()=>a(g),title:m==null?void 0:m.when,className:`w-full text-left px-3 py-1 text-xs ${r===g?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate",children:g}),k>0&&e.jsx("span",{className:"text-accent shrink-0 ml-2",children:k})]}),m?e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 font-normal truncate",children:m.when}):e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 italic font-normal truncate",children:"no documentation yet"})]})})},g)})}),detail:e.jsxs("div",{className:"p-4 space-y-3 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-fg",children:r}),e.jsx("button",{onClick:h,disabled:!!x,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:"+ add group"})]}),u.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no hooks for this event"}):u.map((g,k)=>e.jsx(Ie,{group:g,jsonInvalid:!!x,onChange:m=>f(k,m),onRemove:()=>N(k),onTestFire:m=>l({event:r,matcher:g.matcher??"",command:m.command??""})},k))]})})]}),o?e.jsx(Be,{event:o.event,matcher:o.matcher,command:o.command,onClose:()=>l(null)}):null]})}y.memo($e);function M({value:t,onCommit:s,onDraft:n,...r}){const[a,o]=y.useState(t);y.useEffect(()=>o(t),[t]);const l=()=>{a!==t&&s(a)};return e.jsx("input",{...r,value:a,onChange:p=>{o(p.target.value),n==null||n(p.target.value)},onBlur:l,onKeyDown:p=>{p.key==="Enter"&&l()}})}function Ie({group:t,jsonInvalid:s,onChange:n,onRemove:r,onTestFire:a}){const o=()=>n({...t,hooks:[...t.hooks??[],{type:"command",command:""}]}),l=(d,c)=>{const x=t.hooks.slice();x[d]=c,n({...t,hooks:x})},p=d=>n({...t,hooks:t.hooks.filter((c,x)=>x!==d)});return e.jsxs("div",{className:"border border-line rounded p-3 bg-bg-elev space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-fg-faint w-16",children:"matcher"}),e.jsx(M,{value:t.matcher??"",disabled:s,onCommit:d=>n({...t,matcher:d}),placeholder:"tool name regex or exact match (optional)",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("button",{onClick:r,disabled:s,className:"text-fg-faint hover:text-red-400 text-xs disabled:opacity-40",title:"remove group",children:"× group"})]}),(t.hooks??[]).map((d,c)=>e.jsx(Le,{rule:d,jsonInvalid:s,onChange:x=>l(c,x),onRemove:()=>p(c),onTestFire:()=>a(d)},c)),e.jsx("button",{onClick:o,disabled:s,className:"text-xs text-fg-faint hover:text-fg disabled:opacity-40",children:"+ add hook"})]})}function De(t){var n,r,a;const s=((r=(n=Z.$defs)==null?void 0:n.hookCommand)==null?void 0:r.anyOf)??[];for(const o of s){const l=o.properties;if(((a=l==null?void 0:l.type)==null?void 0:a.const)!==t)continue;const p=l.timeout;if(typeof(p==null?void 0:p.default)=="number")return p.default;const d=/default:\s*(\d+)/.exec((p==null?void 0:p.description)??"");return d?Number(d[1]):null}return null}function G(t){return/^\d+$/.test(t.trim())&&Number(t)>0?Number(t):null}function Le({rule:t,jsonInvalid:s,onChange:n,onRemove:r,onTestFire:a}){const o=i=>({command:"e.g. node ./scripts/lint.js $FILE",http:"e.g. https://hooks.example.com/notify",prompt:"e.g. Review this change for security issues",agent:"e.g. security-reviewer",mcp_tool:"e.g. mcp__server__tool"})[i],l=t.type==="command"?"command":t.type==="http"?"url":t.type==="prompt"?"prompt":t.type==="mcp_tool"?"mcpTool":"agent",p=t[l]??"",d=(t.args??[]).join(" "),[c,x]=y.useState(null),v=De(t.type),j={type:"hook",name:p||t.type,command:t.type==="command"?t.command:void 0,url:t.type==="http"?t.url:void 0};return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:t.type,disabled:s,onChange:i=>n({type:i.target.value}),className:"bg-bg border border-line rounded px-1 py-0.5 text-xs text-fg",children:Oe.map(i=>e.jsx("option",{value:i,children:i},i))}),e.jsx(ve,{interactive:!1,input:j}),e.jsx(M,{value:p,disabled:s,onCommit:i=>n({...t,[l]:i}),placeholder:o(t.type),className:`flex-1 bg-bg border rounded px-2 py-0.5 text-xs text-fg font-mono ${s?"border-red-500/70":p.trim()?"border-line":"border-yellow-600/50"}`}),s?e.jsx("span",{className:"text-red-400 text-xs",title:"The enclosing settings.json is malformed; fix the JSON before editing.",children:"× invalid"}):null,e.jsx(M,{value:t.timeout!=null?String(t.timeout):"",disabled:s,"aria-label":"timeout (seconds)","aria-invalid":c?!0:void 0,title:c??"Timeout in seconds",onDraft:i=>{x(!i.trim()||G(i)!=null?null:"Timeout must be a positive whole number of seconds")},onCommit:i=>{if(!i.trim()){n({...t,timeout:void 0});return}const u=G(i);u!=null&&n({...t,timeout:u})},placeholder:v!=null?`${v} (seconds)`:"seconds",className:`w-24 bg-bg border rounded px-2 py-0.5 text-xs text-fg ${c?"border-red-500/70":"border-line"}`}),c?e.jsx("span",{role:"alert",className:"text-red-400 text-xs",children:c}):null,t.type==="command"?e.jsx("button",{onClick:a,disabled:s||!p.trim(),className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",title:"Run this command with a fake event payload",children:"test fire"}):null,e.jsx("button",{onClick:r,disabled:s,className:"text-fg-faint hover:text-red-400 text-xs disabled:opacity-40",children:"×"})]}),t.type==="command"?e.jsxs("div",{className:"flex items-center gap-2 pl-[3.75rem]",children:[e.jsx("span",{className:"text-xs text-fg-faint w-12",children:"args"}),e.jsx(M,{value:d,disabled:s,onCommit:i=>n({...t,args:i.trim()?i.split(/\s+/).filter(Boolean):void 0}),placeholder:"argv array (v2.1.139+ exec form, no shell)",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"})]}):null,e.jsxs("div",{className:"flex items-center gap-2 pl-[3.75rem]",children:[e.jsx("span",{className:"text-xs text-fg-faint w-12",children:"term"}),e.jsx(M,{value:t.terminalSequence??"",disabled:s,onCommit:i=>n({...t,terminalSequence:i||void 0}),placeholder:"terminalSequence — e.g. \\\\a (bell), v2.1.141+",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"})]})]})}function He(t){return JSON.stringify(Ae[t]??{},null,2)}function Ue(t,s){if(!t.trim())return{matched:!0,target:null,note:"empty matcher → matches all"};const n=s&&typeof s=="object"&&"tool_name"in s?String(s.tool_name??""):null;if(n==null)return{matched:!1,target:null,note:"payload has no tool_name to match against"};try{return{matched:new RegExp(`^(?:${t})$`).test(n),target:n}}catch{return{matched:t===n,target:n,note:"matcher not valid regex; fell back to exact match"}}}function Be({event:t,matcher:s,command:n,onClose:r}){const[a,o]=y.useState(()=>He(t)),[l,p]=y.useState(!1),[d,c]=y.useState(null),[x,v]=y.useState(null);let j=null;try{JSON.parse(a)}catch(u){j=u.message}const i=async()=>{p(!0),c(null);let u=null;try{u=JSON.parse(a)}catch{}v(Ue(s,u));try{const h=await window.api.app.testFireHook({command:n,payload:a,timeoutMs:5e3});c(h)}finally{p(!1)}};return e.jsx(de,{open:!0,onClose:r,title:`Test fire — ${t}`,children:e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"resolved command"}),e.jsx("div",{className:"font-mono text-fg bg-bg border border-line rounded px-2 py-1 break-all",children:n})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"matcher"}),e.jsx("div",{className:"font-mono text-fg bg-bg border border-line rounded px-2 py-1",children:s||e.jsx("span",{className:"text-fg-faint",children:"(empty — matches all)"})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-fg-faint",children:"fake event payload (stdin)"}),j?e.jsxs("span",{className:"text-red-400",children:["× ",j]}):null]}),e.jsx("textarea",{value:a,onChange:u=>o(u.target.value),rows:8,className:`w-full bg-bg border rounded px-2 py-1 font-mono text-fg ${j?"border-red-500/70":"border-line"}`})]}),x?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"matcher result"}),e.jsxs("div",{className:"font-mono",children:[e.jsx("span",{className:x.matched?"text-green-400":"text-red-400",children:x.matched?"✓ match":"✗ no match"}),x.target!=null?e.jsxs("span",{className:"text-fg-dim",children:[' · target tool_name="',x.target,'"']}):null,x.note?e.jsx("div",{className:"text-fg-faint",children:x.note}):null]})]}):null,d?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-fg-faint",children:["exit ",d.exitCode," · ",d.durationMs,"ms"]}),d.stdout?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"stdout"}),e.jsx("pre",{className:"bg-bg border border-line rounded p-2 font-mono text-fg whitespace-pre-wrap break-all max-h-40 overflow-auto",children:d.stdout})]}):null,d.stderr?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"stderr"}),e.jsx("pre",{className:"bg-bg border border-line rounded p-2 font-mono text-red-300 whitespace-pre-wrap break-all max-h-40 overflow-auto",children:d.stderr})]}):null]}):null,e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[e.jsx("button",{onClick:r,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"close"}),e.jsx("button",{onClick:i,disabled:l||!!j||!n.trim(),className:"px-2 py-0.5 text-xs border border-line rounded text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:l?"running…":"run"})]})]})})}const se=[{id:"permissions",label:"Permissions",tab:"permissions",keys:["permissions"]},{id:"hooks",label:"Hooks",tab:"hooks",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",label:"MCP Servers",tab:null,keys:["enabledMcpjsonServers","disabledMcpjsonServers","enableAllProjectMcpServers"]},{id:"plugins",label:"Plugins",tab:null,keys:["enabledPlugins"]}],q=new Set(se.flatMap(t=>t.keys)),Ke=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Model allow/override lists, reasoning depth, and fast-mode toggles — machine-wide, with no per-Epic override yet. An Epic's Agent persona model (Agent Library) still wins over Essentials' plain model default.",advanced:!0,keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled","fallbackModel","enforceAvailableModels","teammateDefaultModel","advisorModel"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],Je={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function ne(t){return t.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((r,a)=>{const o=Je[r];return o||(a===0?r.charAt(0).toUpperCase()+r.slice(1):r)}).join(" ")}function re(t){const s=new Set,n=[];for(const a of Ke){const o=a.keys.filter(l=>t.has(l)&&!q.has(l));o.forEach(l=>s.add(l)),o.length!==0&&n.push({id:a.id,title:a.title,summary:a.summary,advanced:!!a.advanced,keys:o})}const r=Array.from(t).filter(a=>!s.has(a)&&a!=="$schema"&&!q.has(a)).sort();return r.length>0&&n.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:r}),n}function Ge(t,s){return re(t).map(n=>({id:n.id,title:n.title,advanced:n.advanced,total:n.keys.length,setCount:n.keys.filter(r=>s.has(r)).length}))}const qe={};function ae(t,s){if(s)return{text:s,authored:!1};const n=qe[t];return n?{text:n,authored:!0}:null}const We={essentials:"star",git:"link",memory:"memory",model:"sparkle",interface:"eye",updates:"reload",env:"keys",hooks:"hooks",mcp:"mcp",plugins:"plugins",filesystem:"folder",login:"lock",feedback:"send",advanced:"shield",other:"dot"},Ve=["user","project","local","default"],ze={user:"user",project:"project",local:"local",default:"default"};function Ye({node:t,targetScope:s,onOverride:n,schema:r}){const[a,o]=y.useState(""),[l,p]=y.useState(!1),[d,c]=y.useState(!0),x=t.kind==="object"?t:null,v=x?Object.keys(x.children):[],j=r.rootKeys(),i=new Set([...v,...j]),u=y.useMemo(()=>re(i),[Array.from(i).sort().join(",")]),h=y.useMemo(()=>Ge(i,new Set(v)),[Array.from(i).sort().join(","),v.join(",")]),[f,N]=y.useState(null),g=y.useRef(null),k=b=>{const w=u.find(_=>_.id===b);w!=null&&w.advanced&&!l&&p(!0),N(b)};y.useEffect(()=>{if(!f)return;N(null);const b=g.current,w=document.getElementById(`settings-group-${f}`);if(!b||!w)return;const _=w.getBoundingClientRect().top-b.getBoundingClientRect().top;b.scrollBy({top:_,behavior:"smooth"})},[f]);const m=y.useMemo(()=>u.filter(b=>l||!b.advanced).map(b=>({...b,keys:b.keys.filter(w=>{const _=(x==null?void 0:x.children[w])!==void 0;if(!d&&!_)return!1;if(!a.trim())return!0;const E=r.at([w]);return[w,ne(w),(E==null?void 0:E.description)??""].join(" ").toLowerCase().includes(a.toLowerCase())})})).filter(b=>b.keys.length>0),[u,a,l,d,x,r]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:"text-fg-faint",children:["writing overrides to"," ",e.jsx("span",{className:"text-fg-dim font-medium",children:S[s].label})]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:d,onChange:b=>c(b.target.checked),className:"accent-accent"}),"show not-yet-configured"]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:l,onChange:b=>p(b.target.checked),className:"accent-accent"}),"show advanced"]}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:a,onChange:b=>o(b.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(Ze,{groups:h,onJump:k}),e.jsxs("div",{ref:g,className:"flex-1 overflow-auto py-3",children:[m.map(b=>e.jsx(Qe,{id:b.id,title:b.title,summary:b.summary,advanced:b.advanced,children:b.keys.map(w=>{const _=x==null?void 0:x.children[w],E=r.at([w]);return e.jsx(Xe,{keyName:w,node:_,info:E,targetScope:s,onOverride:(A,$)=>n([w],A,$)},w)})},b.id)),m.length===0&&e.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',a,'"']})]})]})]})}function Ze({groups:t,onJump:s}){return e.jsx("nav",{className:"shrink-0 w-48 border-r border-line bg-bg-elev/30 overflow-y-auto py-3",children:t.map(n=>e.jsxs("button",{onClick:()=>s(n.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bg-hi transition-colors",title:`jump to ${n.title}`,children:[e.jsx(ue,{name:We[n.id]??"dot",size:15,className:"text-fg-faint shrink-0"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-fg-dim",children:n.title}),e.jsxs("span",{className:"text-[10px] text-fg-faint font-mono shrink-0",children:[n.setCount,"/",n.total]})]},n.id))})}function Qe({id:t,title:s,summary:n,advanced:r,children:a}){const[o,l]=y.useState(!0);return e.jsxs("section",{id:`settings-group-${t}`,className:"mx-4 mb-4 rounded-lg border border-line shadow-sm bg-bg-elev/50 overflow-hidden",children:[e.jsxs("header",{className:"px-4 py-3 bg-bg-elev cursor-pointer hover:bg-bg-hi flex items-center gap-3 border-b border-line",onClick:()=>l(!o),children:[e.jsx("span",{className:"text-fg-faint w-3",children:o?"▾":"▸"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-fg text-base font-semibold",children:s}),r&&e.jsx("span",{className:"text-[9px] px-1.5 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"advanced"})]}),e.jsx("p",{className:"text-fg-dim text-sm mt-0.5",children:n})]})]}),o&&e.jsx("div",{className:"divide-y divide-line/60",children:a})]})}function Xe({keyName:t,node:s,info:n,targetScope:r,onOverride:a}){const[o,l]=y.useState(!1),[p,d]=y.useState(!1),c=ne(t),x=s!==void 0,j=(s==null?void 0:s.kind)==="leaf"?s:null,i=(s==null?void 0:s.kind)==="object"||(s==null?void 0:s.kind)==="array",u=n==null?void 0:n.default,h=j&&u!==void 0&&ie(j.value,u),f=it({isSet:x,leafNode:j,defaultVal:u,isDefault:!!h,node:s}),N=et(j,u),g=N.length>=2,k=!!j&&!h,m=ae(t,n==null?void 0:n.description);return e.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{onClick:()=>l(!o),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:o?"collapse":"expand",children:o?"▾":"▸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-fg text-sm",children:c}),e.jsx(lt,{kind:f.kind,label:f.label}),g&&e.jsxs("button",{onClick:b=>{b.stopPropagation(),o||l(!0),d(w=>!w)},className:"text-[9px] px-1.5 py-0 rounded border border-blue-900/40 bg-blue-950/30 text-blue-300/90 uppercase tracking-wide hover:bg-blue-900/40",title:"this key is defined in multiple scopes — click to expand",children:["drift · ",N.map(b=>ze[b]).join(" · ")]}),k&&j&&e.jsx("button",{onClick:b=>{b.stopPropagation(),a(void 0,j.winner)},className:"text-[9px] px-1.5 py-0 rounded border border-line bg-bg-elev text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`reset · delete from ${S[j.winner].label}`,children:"↺ reset"}),(n==null?void 0:n.deprecated)&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"deprecated"}),(n==null?void 0:n.required)&&!x&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-red-900/40 bg-red-950/30 text-red-400/80 uppercase tracking-wide",children:"required"})]}),m&&e.jsx("p",{className:`text-fg-dim text-xs mt-0.5 leading-relaxed ${m.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:m.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:ct(m.text)}),o&&p&&j&&e.jsx(tt,{leaf:j,defaultVal:u,onReset:b=>a(void 0,b)}),o&&e.jsx(st,{keyName:t,node:s,info:n,targetScope:r,onOverride:b=>a(b)})]}),e.jsx("div",{className:"shrink-0",children:!o&&e.jsx(ot,{node:s,info:n,onSet:b=>{a(b)},disabled:i&&x})})]})})}function et(t,s){if(!t)return[];const n=new Set;n.add(t.winner);for(const r of t.shadowed)n.add(r.scope);return s!==void 0&&n.add("default"),Ve.filter(r=>n.has(r))}function tt({leaf:t,defaultVal:s,onReset:n}){const r={};r[t.winner]={value:t.value,winner:!0};for(const a of t.shadowed)r[a.scope]={value:a.value,winner:!1};return e.jsxs("div",{className:"mt-2 border border-line rounded bg-bg-elev/40 text-xs",children:[e.jsx("div",{className:"px-2 py-1 text-fg-faint border-b border-line/60",children:"Values across all scopes (winner highlighted · reset removes that scope's value):"}),e.jsxs("div",{className:"divide-y divide-line/60",children:[["user","project","local"].map(a=>{const o=r[a],l=o!==void 0;return e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:S[a].label}),e.jsx("span",{className:`font-mono truncate ${o!=null&&o.winner?"text-accent":"text-fg-dim"}`,children:l?O(o.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),l?e.jsx("button",{onClick:()=>n(a),className:"text-[9px] px-1.5 py-0 rounded border border-line text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`delete this key from ${S[a].label}`,children:"↺"}):e.jsx("span",{})]},a)}),e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:"Default"}),e.jsx("span",{className:"font-mono text-fg-dim truncate",children:s!==void 0?O(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function st({keyName:t,node:s,info:n,targetScope:r,onOverride:a}){const l=(s==null?void 0:s.kind)==="leaf"?s:null,p=ae(t,n==null?void 0:n.description);return e.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[p&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${p.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:p.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:p.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(n==null?void 0:n.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(n.type)?n.type.join(" | "):n.type})]}),(n==null?void 0:n.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:O(n.default)})]}),(n==null?void 0:n.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:n.enum.map(d=>String(d)).join(" | ")})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Current"}),e.jsxs("dd",{className:"font-mono",children:[e.jsx("span",{className:"text-fg-dim",children:O(l.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",S[l.winner].label]})]})]}),l&&l.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:l.shadowed.map((d,c)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[O(d.value)," —"," ",e.jsx("span",{className:"no-underline",children:S[d.scope].label})]},c))})]}),(s==null?void 0:s.kind)==="array"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Accumulated"}),e.jsxs("dd",{className:"text-fg-dim",children:[s.items.length," items across all scopes"]})]})]}),e.jsx("div",{className:"pt-2 flex items-center gap-2 flex-wrap border-t border-line/60",children:e.jsx(nt,{keyName:t,node:s,info:n,onChange:a,targetScope:r})})]})}function nt({node:t,info:s,onChange:n,targetScope:r}){const o=(t==null?void 0:t.kind)==="leaf"?t.value:s==null?void 0:s.default,l=oe(s==null?void 0:s.type);if(l==="boolean"){const p=o===!0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:[{v:!0,label:"on"},{v:!1,label:"off"}].map(({v:d,label:c})=>e.jsx("button",{onClick:()=>n(d),className:`px-3 py-0.5 text-xs transition-colors ${p===d?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:c},c))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[r].label]})]})}return s!=null&&s.enum?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-fg-faint",children:"Choose:"}),s.enum.map(p=>{const d=ie(o,p);return e.jsx("button",{onClick:()=>n(p),className:`px-2 py-0.5 text-xs rounded border ${d?"bg-accent text-bg border-accent":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,children:String(p)},String(p))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",S[r].label]})]}):l==="integer"||l==="number"?e.jsx(rt,{value:typeof o=="number"?o:void 0,integer:l==="integer",onCommit:n,target:S[r].label}):l==="string"?e.jsx(at,{value:typeof o=="string"?o:"",onCommit:n,target:S[r].label}):e.jsxs("div",{className:"text-fg-faint",children:["Complex value (",l??"object/array",") — use the"," ",e.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function rt({value:t,integer:s,onCommit:n,target:r}){const[a,o]=y.useState(t!==void 0?String(t):""),l=()=>{const p=s?parseInt(a,10):parseFloat(a);Number.isNaN(p)||n(p)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("input",{type:"number",value:a,onChange:p=>o(p.target.value),onBlur:l,onKeyDown:p=>{p.key==="Enter"&&p.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:l,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",r]})]})}function at({value:t,onCommit:s,target:n}){const[r,a]=y.useState(t);return e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"text-fg-faint shrink-0",children:"Set to:"}),e.jsx("input",{type:"text",value:r,onChange:o=>a(o.target.value),onKeyDown:o=>{o.key==="Enter"&&s(r)},className:"flex-1 min-w-0 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:()=>s(r),className:"shrink-0 px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",n]})]})}function ot({node:t,info:s,onSet:n,disabled:r}){const a=(t==null?void 0:t.kind)==="leaf",o=oe(s==null?void 0:s.type);if(r)return null;if(o==="boolean"){const l=a&&t.value===!0;return e.jsx("button",{onClick:()=>n(!l),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${l?"bg-accent/15 text-accent border-accent/40 hover:bg-accent hover:text-bg":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,title:"toggle",children:l?"on":"off"})}return null}function it({isSet:t,leafNode:s,defaultVal:n,isDefault:r,node:a}){return t?(a==null?void 0:a.kind)==="array"?{kind:"accumulated",label:`${a.items.length} items`}:(a==null?void 0:a.kind)==="object"?{kind:"set",label:"configured"}:s?r?{kind:"default",label:`= default · ${S[s.winner].label}`}:s.shadowed.length>0?{kind:"override",label:`overriding ${s.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${S[s.winner].label}`}:{kind:"set",label:"configured"}:n!==void 0?{kind:"default",label:`using default: ${O(n)}`}:{kind:"unset",label:"not configured"}}function lt({kind:t,label:s}){const n={set:"bg-accent/15 text-accent border-accent/30",default:"bg-bg-hi text-fg-dim border-line",unset:"bg-bg-elev text-fg-faint border-line",override:"bg-purple-950/30 text-purple-400/80 border-purple-900/40",accumulated:"bg-blue-950/30 text-blue-400/80 border-blue-900/40"}[t];return e.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${n}`,children:s})}function oe(t){if(t)return Array.isArray(t)?t.find(n=>n!=="null")??t[0]:t}function ie(t,s){return t===s?!0:typeof t!=typeof s?!1:t&&s&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(s):!1}function ct(t){const s=t.trim().split(`
|
|
2
|
-
`)[0],n=s.match(/^([^.!?]+[.!?])/);return n?n[1]:s.length>120?s.slice(0,120)+"…":s}function O(t){if(typeof t=="string")return t===""?'""':JSON.stringify(t);if(t===null)return"null";if(t===void 0)return"—";if(typeof t=="object"){const s=JSON.stringify(t);return s.length>60?s.slice(0,60)+"…":s}return String(t)}const W={user:{title:"Global settings",body:"This is the real ~/.claude/settings.json on disk — the same file the claude CLI reads on every session it starts. Edits apply machine-wide, to every project and every session."},project:{title:"Project settings",body:"This is the real <project>/.claude/settings.json on disk, checked into git. Edits apply to every current and future session in this project, for anyone who clones it."},local:{title:"Local settings",body:"This is the real <project>/.claude/settings.local.json on disk, gitignored. Edits apply to every current and future session in this project, on this machine only."}};function dt({effective:t,onOpenTab:s}){return e.jsx("ul",{"data-testid":"settings-owned-summaries",className:"px-3 py-2 space-y-1 text-[11.5px] border-b border-line",children:se.map(n=>{const r=n.keys.filter(o=>fe(t,[o])!==null),a=r.length?`${r.length} of ${n.keys.length} keys set (${r.join(", ")})`:"nothing set";return e.jsxs("li",{"data-testid":`owned-summary-${n.id}`,className:"flex items-center gap-2 text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg w-28 shrink-0",children:n.label}),e.jsx("span",{className:"truncate",children:a}),n.tab?e.jsxs("button",{type:"button",onClick:()=>s(n.tab),className:"ml-auto text-accent hover:underline shrink-0",children:["edit in ",n.label," tab →"]}):e.jsxs("span",{className:"ml-auto text-fg-faint shrink-0",children:["managed on the ",n.label," page"]})]},n.id)})})}function ut({scope:t="user"}={}){const s=L(),n=B(m=>m.tabs),r=B(m=>m.activeTabId),a=n.find(m=>m.id===r)??null,o=(a==null?void 0:a.cwd)??null,[l,p]=y.useState("general");pe("settings",m=>{(m==="general"||m==="permissions"||m==="hooks"||m==="raw")&&p(m)});const d=H(Y,s,o),c=d[t]??null,x=T(m=>m.files),v=T(m=>m.setDraft),j=T(m=>m.saveJson),i=T(m=>m.revert),[u,h]=y.useState(null),f=y.useMemo(()=>me(xe(x,d)),[x,d]),N=(m,b,w)=>{var $;const _=w??t,E=d[_];if(!E)return;const A=(($=x[E])==null?void 0:$.draftRaw)??"";if(A.trim())try{JSON.parse(A)}catch(P){h(`${E} is not valid JSON (${P instanceof Error?P.message:String(P)}) — fix it in Raw before editing from General.`);return}h(null),window.api.claudeConfig.patch({fileId:"settings",scope:_,cwd:o,keyPath:m,value:b}).catch(P=>R.error(P instanceof Error?P.message:String(P)))};if(!s)return e.jsx(C,{title:"loading…"});const g=c?x[c]:null,k=m=>m!=="user"&&!o;return e.jsx(F,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(U,{options:[{key:"general",label:"General"},{key:"permissions",label:"Permissions"},{key:"hooks",label:"Hooks"},{key:"raw",label:"Raw"}],active:l,onChange:p}),e.jsx(e.Fragment,{children:e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:l==="general"?`overrides → ${c??"—"}`:c??"—"})}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"schema reference ↗"})]}),footer:l==="raw"&&c&&g?e.jsx(ye,{dirty:g.dirty,busy:g.busy,parseError:u||g.parseError,lastSavedAt:g.lastSavedAt,leading:g.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{h(null);const m=await j(c);m.ok||h(m.error??"save failed")},onRevert:()=>{h(null),i(c)}}):null,children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"settings-scope-note",className:"sticky top-0 z-10 border-b border-line bg-bg-elev px-3 py-2 text-[11.5px] leading-snug",children:[e.jsx("span",{className:"font-semibold text-fg",children:W[t].title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:W[t].body}),c&&e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:c})]}),u&&l!=="raw"&&e.jsx("div",{role:"alert",className:"px-3 py-2 border-b border-line text-xs text-red-400",children:u}),k(t)?e.jsx(C,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"}):l==="general"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-2",children:e.jsx(I,{path:c??""})}),e.jsx(dt,{effective:f,onOpenTab:p}),e.jsx(Ye,{node:f,targetScope:t,onOverride:N,schema:Q()})]}):l==="permissions"?c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-2",children:e.jsx(I,{path:c,keyPath:["permissions"]})}),e.jsx(X,{scope:t,cwd:o,activePath:c})]}):e.jsx(C,{title:"resolving…"}):l==="hooks"?c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-2",children:e.jsx(I,{path:c,keyPath:["hooks"]})}),e.jsx(te,{scope:t,cwd:o,path:c})]}):e.jsx(C,{title:"resolving…"}):c&&g?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-2",children:e.jsx(I,{path:c})}),e.jsx(he,{path:c,value:g.draftRaw,onChange:m=>{h(null),v(c,m)}})]}):e.jsx(C,{title:"resolving…"})]})})}const kt=y.memo(ut);export{W as SETTINGS_SCOPE_NOTES,kt as Settings};
|