claude-code-session-manager 0.130.2 → 0.130.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/bin/cli.cjs +19 -2
  3. package/dist/assets/AgentLibrary-BmrXNwK8.js +2 -0
  4. package/dist/assets/{AppSettings-Bpwynea4.js → AppSettings-Cs4POznd.js} +1 -1
  5. package/dist/assets/{Button-DSoqrxCB.js → Button-UUr5giu8.js} +1 -1
  6. package/dist/assets/DocumentEditorPane-C46Hj0lz.js +1 -0
  7. package/dist/assets/Extensions-B9QdiNOV.js +2 -0
  8. package/dist/assets/{History-DzMo9Otn.js → History-Bndupj87.js} +2 -2
  9. package/dist/assets/{Library-C5wKMTSn.js → Library-DFn0YPIW.js} +5 -5
  10. package/dist/assets/{ListDetail-DDQ1S0yu.js → ListDetail-DjMn8a_3.js} +1 -1
  11. package/dist/assets/{Panel-B-3NWUlv.js → Panel-CIvb-XXN.js} +1 -1
  12. package/dist/assets/ProjectClaudeConfig-BQQRtMdK.js +25 -0
  13. package/dist/assets/{ProvenanceBadge-CUChwz4Z.js → ProvenanceBadge-ej8W2ZIK.js} +1 -1
  14. package/dist/assets/{Scheduler-CkGHMXvo.js → Scheduler-DSVBWqRK.js} +8 -8
  15. package/dist/assets/Settings-DqxUna06.js +2 -0
  16. package/dist/assets/{SkillReferenceGraph-C6JEdypC.js → SkillReferenceGraph-BEMTdxdD.js} +1 -1
  17. package/dist/assets/Skills-DTXehVS7.js +12 -0
  18. package/dist/assets/{SourceChip-DcBNYYhe.js → SourceChip-BrPci8FX.js} +1 -1
  19. package/dist/assets/SystemPrompt-B43hNP0X.js +1 -0
  20. package/dist/assets/{TiptapBody-DiVYC-_O.js → TiptapBody-B-R2Bpda.js} +1 -1
  21. package/dist/assets/{Toggle-Cs3k6I96.js → Toggle-DKb4x1BP.js} +1 -1
  22. package/dist/assets/ViewTabs-CcJdFZgv.js +1 -0
  23. package/dist/assets/{VoiceButton-C3NLotUZ.js → VoiceButton-BSH0UI3u.js} +1 -1
  24. package/dist/assets/{historyTotals-f-E0L9Xw.js → historyTotals-5oUEu_fe.js} +1 -1
  25. package/dist/assets/index-C9w-dVzo.js +3090 -0
  26. package/dist/assets/{index-Bp8XE9A6.css → index-CMCcT2yg.css} +1 -1
  27. package/dist/index.html +2 -2
  28. package/dist-web/app.css +1 -1
  29. package/dist-web/app.js +420 -416
  30. package/package.json +1 -1
  31. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  32. package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +15 -5
  33. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +8 -4
  34. package/src/main/agentLibrary.cjs +81 -29
  35. package/src/main/agentsIpc.cjs +21 -16
  36. package/src/main/build-info.json +4 -4
  37. package/src/main/ipcSchemas.cjs +7 -1
  38. package/src/main/lib/epic/epicWorktreeMerge.cjs +11 -9
  39. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +2 -0
  40. package/src/main/lib/git/gitWorktree.cjs +216 -43
  41. package/src/main/lib/mdNetworkScan.cjs +555 -0
  42. package/src/main/lib/persona-macro/agentPersonaSchema.cjs +18 -5
  43. package/src/main/lib/persona-macro/builtinMacros.cjs +6 -4
  44. package/src/main/lib/persona-macro/macroJobDispatch.cjs +9 -2
  45. package/src/main/lib/scheduler/terminalRunOutcome.cjs +61 -15
  46. package/src/main/projectPages.cjs +32 -7
  47. package/src/main/scheduler/gitTreeGuard.cjs +85 -12
  48. package/src/main/scheduler.cjs +16 -5
  49. package/src/preload/api.d.ts +91 -6
  50. package/src/preload/apiSurface.json +7 -0
  51. package/src/preload/index.cjs +1 -0
  52. package/dist/assets/AgentLibrary-Bfj862qf.js +0 -2
  53. package/dist/assets/Extensions-BziIutWV.js +0 -13
  54. package/dist/assets/Memory-Bq5T33d2.js +0 -25
  55. package/dist/assets/Settings-DGxvyajs.js +0 -2
  56. package/dist/assets/SystemPrompt-CfozyVQx.js +0 -1
  57. package/dist/assets/ViewTabs-DFXH03tb.js +0 -1
  58. package/dist/assets/index-CuAfFXNd.js +0 -3086
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-session-manager",
3
- "version": "0.130.2",
3
+ "version": "0.130.3",
4
4
  "description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
5
5
  "type": "module",
6
6
  "main": "src/main/index.cjs",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "session-manager-dev",
3
3
  "description": "The default end-to-end development skillset for the Claude Code Session Manager: decompose work into scheduler PRDs and track them to a validated finish (/develop), publish releases to npm (/builder), hand a finding to another project on this machine (/send-feedback), and review or drift-check a project's CLAUDE.md/markdown network (/maintaining-md-network). Together with the session-manager scheduler these form a develop → queue → validate → release loop.",
4
- "version": "0.3.5",
4
+ "version": "0.3.6",
5
5
  "author": {
6
6
  "name": "Bilko Bibitkov",
7
7
  "email": "BilkoBibitkov2000@gmail.com",
@@ -22,7 +22,7 @@ node <skill base dir>/scripts/drift-check.cjs --root <repo>
22
22
  | Flag | Meaning |
23
23
  | --- | --- |
24
24
  | `--root <dir>` | Repo to check. Defaults to the current directory. Must be a directory. |
25
- | `--map <path>` | The entry map. Default: the CLAUDE.md or AGENTS.md at the root that holds the maintainer comment (see below). |
25
+ | `--map <path>` | The entry map. Default: the first file that holds the maintainer comment, searched in this order: the root CLAUDE.md, the root AGENTS.md, then the `.md` files those two import directly with at-sign imports (see below). |
26
26
  | `--file <path>` | Check only this file. Repeat for each file. Default: every tracked `.md` file (all `.md` files outside `.git` and `node_modules` when the repo is not git). |
27
27
  | `--exclude <prefix>` | Skip files whose repo-relative path starts with the prefix. Repeat as needed. |
28
28
  | `--checks <list>` | Comma list from `links`, `paths`, `limits`, `contents`. Default: all four. |
@@ -32,14 +32,16 @@ A flag that needs a value fails if the value is missing or starts with `--`.
32
32
 
33
33
  ### Output
34
34
 
35
- One JSON object on stdout:
35
+ One JSON object on stdout, with its keys in this order:
36
36
 
37
37
  - `root`: the resolved repo root.
38
38
  - `map`: the map file used, or null.
39
39
  - `notes`: plain-text caveats, such as `no md-network-map comment found; the 70-line map limit was not applied`. Read it: an empty map means the map limit never ran.
40
- - `checkedFiles`: the repo-relative files checked.
41
40
  - `findings`: a list, sorted by file then line.
42
41
  - `counts`: findings per kind.
42
+ - `checkedFiles`: the repo-relative files checked.
43
+
44
+ `checkedFiles` comes last, so a long file list never hides the findings in a cut-off view of the output.
43
45
 
44
46
  ### Finding kinds
45
47
 
@@ -59,7 +61,7 @@ Rules the script applies:
59
61
  - Site route: a link starting with a single slash that does not exist under the repo root is treated as a website route and skipped. `--strict-paths` turns that skip off.
60
62
  - Ignore marker: a line that contains the marker `<!-- drift-check-ignore -->` is skipped by the link and path checks.
61
63
  - Ellipsis rule: a span with a `...` segment, such as src/.../x.ts, is a placeholder and is skipped.
62
- - Map detection: without `--map`, the script looks for the maintainer comment in the root CLAUDE.md and AGENTS.md, then in the `.md` files they import with at-sign imports. The first file with the comment is the map.
64
+ - Map detection: without `--map`, the script looks for the maintainer comment in the root CLAUDE.md and AGENTS.md, then in the `.md` files inside the repo that they import directly with at-sign imports. Only those direct imports (one hop) are searched, not the files they import in turn. The first file with the comment is the map.
63
65
 
64
66
  ## Path conventions
65
67
 
@@ -180,4 +182,12 @@ The map carries one HTML comment, so the script and the next reviewer can find i
180
182
  <!-- md-network-map owner: <name> last-review: <YYYY-MM-DD> -->
181
183
  ```
182
184
 
183
- Without `--map`, the script looks for this comment in CLAUDE.md, then AGENTS.md, at the repo root. The first file that has it is the map, and it gets the 70-line limit. Update `last-review` in the same commit as each review record. HTML comments are stripped before the model reads the file, so the comment costs no context.
185
+ Put the comment in the map file itself. The map may be an imported file: when the root CLAUDE.md pulls in docs/map.md with an at-sign import, the comment goes in docs/map.md.
186
+
187
+ Without `--map`, the script searches the root CLAUDE.md, then the root AGENTS.md, then the `.md` files those two import directly with at-sign imports. The first file that has the comment is the map, and it gets the 70-line limit.
188
+
189
+ Do not put the comment in a CLAUDE.md that only imports the map. That makes CLAUDE.md the map, so CLAUDE.md plus everything it imports is held to the 70-line limit, and the real map gets no limit of its own. On the Bilko repo, moving the comment from docs/map.md to CLAUDE.md gave a false over-line-limit finding: CLAUDE.md had 45 lines, 93 with its imports, against a limit of 70.
190
+
191
+ Update `last-review` in the same commit as each review record.
192
+
193
+ Claude Code strips block-level HTML comments, such as this one on its own line, from CLAUDE.md and from the files it imports before the model reads them. There the comment costs no context. A tool that returns the raw file text does not strip it: the Read tool, an MCP server, or a script. If a project's tool serves the map to a model, strip the comment in that tool.
@@ -6,7 +6,7 @@
6
6
  * node drift-check.cjs [--root <dir>] [--map <path>] [--file <path>]...
7
7
  * [--exclude <prefix>]... [--checks links,paths,limits,contents] [--strict-paths]
8
8
  *
9
- * Prints one JSON object { root, map, notes, checkedFiles, findings, counts } to stdout.
9
+ * Prints one JSON object { root, map, notes, findings, counts, checkedFiles } to stdout.
10
10
  * Exit 0 = no findings, 1 = findings, 2 = usage error / missing root.
11
11
  */
12
12
 
@@ -377,9 +377,12 @@ function runDriftCheck(options) {
377
377
  findings.sort((x, y) => (x.file < y.file ? -1 : x.file > y.file ? 1 : (x.line || 0) - (y.line || 0)));
378
378
  const counts = {};
379
379
  for (const f of findings) counts[f.kind] = (counts[f.kind] || 0) + 1;
380
- return { root: toPosix(root), map, notes, checkedFiles: docs, findings, counts };
380
+ // checkedFiles last: a long file list must not push findings and counts out of a truncated view.
381
+ return { root: toPosix(root), map, notes, findings, counts, checkedFiles: docs };
381
382
  }
382
383
 
384
+ // Set process.exitCode, never process.exit(): stdout/stderr to a pipe are async on POSIX, and
385
+ // process.exit() drops whatever has not drained (a report cut at the 64 KiB pipe buffer).
383
386
  function main() {
384
387
  let result;
385
388
  try {
@@ -387,12 +390,13 @@ function main() {
387
390
  } catch (err) {
388
391
  if (err instanceof UsageError) {
389
392
  process.stderr.write(`drift-check: ${err.message}\n`);
390
- process.exit(2);
393
+ process.exitCode = 2;
394
+ return;
391
395
  }
392
396
  throw err;
393
397
  }
394
398
  process.stdout.write(JSON.stringify(result, null, 2) + '\n');
395
- process.exit(result.findings.length ? 1 : 0);
399
+ process.exitCode = result.findings.length ? 1 : 0;
396
400
  }
397
401
 
398
402
  module.exports = { runDriftCheck, parseArgs };
@@ -112,26 +112,63 @@ function serializePersona({ name, description, tools, model, effort, color, tags
112
112
  return lines.join('\n') + (body || '').trim() + '\n';
113
113
  }
114
114
 
115
+ /**
116
+ * The cwd form every override key is compared in: repeated `/` collapsed,
117
+ * trailing `/` stripped, root kept as `/`. Same rule as the renderer's
118
+ * `normalizeCwd` (src/renderer/lib/knownProjectAggregate.ts — main must not
119
+ * import renderer code) minus its `trim()`: a cwd with edge whitespace then
120
+ * fails closed as "project not open" instead of resolving to a sibling dir.
121
+ */
122
+ function normalizeCwd(cwd) {
123
+ const collapsed = String(cwd).replace(/\/{2,}/g, '/');
124
+ if (collapsed === '/') return '/';
125
+ return collapsed.replace(/\/+$/, '');
126
+ }
127
+
128
+ /**
129
+ * The open project (`{ cwd, name }` from `openProjects`) whose normalized cwd
130
+ * equals `projectCwd`'s. Matched by cwd, never by folder name — two open
131
+ * projects can share one (`/a/proj`, `/b/proj`). Throws
132
+ * `project not open: <cwd>` for an unknown, empty or non-string value, so an
133
+ * override call can never land in some other project's (or the global) file.
134
+ */
135
+ async function findOpenProject(projectCwd, loadSessions) {
136
+ const key = typeof projectCwd === 'string' && projectCwd !== '' ? normalizeCwd(projectCwd) : null;
137
+ const project = key === null ? undefined : (await openProjects({ loadSessions })).find((p) => p.cwd === key);
138
+ if (!project) throw new Error(`project not open: ${projectCwd}`);
139
+ return project;
140
+ }
141
+
115
142
  /**
116
143
  * Project OVERRIDE write: a frontmatter-only overlay at
117
- * `<cwd>/.claude/agents/<name>.md` carrying ONLY the overridden `model` /
144
+ * `<projectCwd>/.claude/agents/<name>.md` carrying ONLY the overridden `model` /
118
145
  * `effort` keys and no body (lib/persona-macro/personaMerge.cjs inherits everything else
119
- * from the global persona). Keys already in an existing frontmatter-only
146
+ * from the global persona). `projectCwd` must be an OPEN project's cwd (see
147
+ * findOpenProject). Keys already in an existing frontmatter-only
120
148
  * overlay are preserved; an existing overlay that has a BODY is refused so a
121
149
  * full-body overlay is never silently converted. Both keys unset removes the
122
150
  * file (same as `removeOverride`) rather than leaving an empty overlay.
151
+ *
152
+ * Registers the open project's root via `addAllowedRoot` before touching the
153
+ * overlay: config.cjs's validateWrite allows `<root>/.claude/` writes only under
154
+ * a registered root, and a dormant tab (no terminal running — every tab
155
+ * restored after a restart) has no pty-registered one. The cwd has already
156
+ * passed validatePath, so this widens nothing a terminal spawn in that project
157
+ * would not (same precedent as projectBrief.cjs's `allowBriefWrites`). An
158
+ * unknown or empty `projectCwd` throws in findOpenProject first, so nothing is
159
+ * registered for it.
123
160
  */
124
- async function saveOverlay({ name, projectName, model, effort, loadSessions, validatePath, writeTextAtomic }) {
125
- const projects = await openProjects({ loadSessions });
126
- const project = projects.find((p) => p.name === projectName);
127
- if (!project) throw new Error(`project not open: ${projectName}`);
161
+ async function saveOverlay({ name, projectCwd, model, effort, loadSessions, validatePath, writeTextAtomic, addAllowedRoot }) {
162
+ const project = await findOpenProject(projectCwd, loadSessions);
163
+ // Dormant tab = no pty-registered root; see JSDoc + projectBrief.cjs allowBriefWrites.
164
+ addAllowedRoot(validatePath(project.cwd));
128
165
  const target = validatePath(path.join(project.cwd, '.claude', 'agents', `${name}.md`));
129
166
  let preserved = [];
130
167
  try {
131
168
  const rawExisting = await fsp.readFile(target, 'utf8');
132
169
  const existing = splitFrontmatter(rawExisting);
133
170
  if (existing.body.trim() !== '') {
134
- throw new Error(`${name} has a full-body override in ${projectName} — edit ${target} directly; it is not converted to a frontmatter-only override`);
171
+ throw new Error(`${name} has a full-body override in ${project.name} — edit ${target} directly; it is not converted to a frontmatter-only override`);
135
172
  }
136
173
  preserved = extractUnmanagedLines(rawExisting, new Set(['model', 'effort']));
137
174
  } catch (e) {
@@ -142,7 +179,7 @@ async function saveOverlay({ name, projectName, model, effort, loadSessions, val
142
179
  if (v && v !== 'inherit') managedLines.push(`${k}: ${v}`);
143
180
  }
144
181
  if (managedLines.length === 0 && preserved.length === 0) {
145
- await removeOverride({ name, projectName, loadSessions, validatePath });
182
+ await removeOverride({ name, projectCwd: project.cwd, loadSessions, validatePath });
146
183
  return { ok: true, path: target, removed: true };
147
184
  }
148
185
  const lines = ['---', ...managedLines, ...preserved, '---', ''];
@@ -154,9 +191,12 @@ async function saveOverlay({ name, projectName, model, effort, loadSessions, val
154
191
  * Writes a global persona `.md` file — `~/.claude/agents/<name>.md`. Pass
155
192
  * `originalName` when renaming an existing persona so the old file is
156
193
  * removed once the new one is written (no-op if names match). Pass
157
- * `projectName` (an open project) to instead write that project's
158
- * frontmatter-only OVERRIDE of the persona — see saveOverlay; only `model` and
159
- * `effort` are read in that mode.
194
+ * `projectCwd` (an OPEN project's absolute cwd) to instead write that
195
+ * project's frontmatter-only OVERRIDE of the persona — see saveOverlay; only
196
+ * `model` and `effort` are read in that mode. Routing is on
197
+ * `projectCwd !== undefined`, not truthiness: an empty/null cwd throws
198
+ * `project not open` rather than falling through to the global write with the
199
+ * override call's blank description/tools/body.
160
200
  */
161
201
  async function savePersona({
162
202
  name,
@@ -174,17 +214,18 @@ async function savePersona({
174
214
  seedVersion,
175
215
  executorOnly,
176
216
  body,
177
- projectName,
217
+ projectCwd,
178
218
  globalDir = path.join(os.homedir(), '.claude', 'agents'),
179
219
  loadSessions = sessionsStore.load,
180
220
  validatePath = configMgr.validatePath,
181
221
  writeTextAtomic = configMgr.writeTextAtomic,
222
+ addAllowedRoot = configMgr.addAllowedRoot,
182
223
  } = {}) {
183
224
  if (!PERSONA_NAME_RE.test(name || '')) {
184
225
  throw new Error('agent name must be lowercase, hyphenated (e.g. "my-agent")');
185
226
  }
186
- if (projectName) {
187
- return saveOverlay({ name, projectName, model, effort, loadSessions, validatePath, writeTextAtomic });
227
+ if (projectCwd !== undefined) {
228
+ return saveOverlay({ name, projectCwd, model, effort, loadSessions, validatePath, writeTextAtomic, addAllowedRoot });
188
229
  }
189
230
  const target = validatePath(path.join(globalDir, `${name}.md`));
190
231
  // A caller that omits seedVersion/title/projects/action/actionLabel (the
@@ -229,12 +270,19 @@ async function savePersona({
229
270
  return { ok: true, path: target };
230
271
  }
231
272
 
232
- /** Deletes a global persona `.md` file. Idempotent — missing file is not an error. */
273
+ /**
274
+ * Deletes a global persona `.md` file. Idempotent — missing file is not an error.
275
+ * A non-kebab-case `name` (e.g. `../../notes/x`) throws before any path is built,
276
+ * so it can never unlink a `.md` outside `globalDir`.
277
+ */
233
278
  async function deletePersona({
234
279
  name,
235
280
  globalDir = path.join(os.homedir(), '.claude', 'agents'),
236
281
  validatePath = configMgr.validatePath,
237
282
  } = {}) {
283
+ if (!PERSONA_NAME_RE.test(name || '')) {
284
+ throw new Error('agent name must be lowercase, hyphenated (e.g. "my-agent")');
285
+ }
238
286
  const target = validatePath(path.join(globalDir, `${name}.md`));
239
287
  try {
240
288
  await fsp.unlink(target);
@@ -245,19 +293,19 @@ async function deletePersona({
245
293
  }
246
294
 
247
295
  /**
248
- * Drops a project's local override (`<cwd>/.claude/agents/<name>.md`) so the
249
- * global definition applies there again. `projectName` is resolved against
250
- * currently-open tabs (same source `listPersonas` uses for overridingProjects).
296
+ * Drops a project's local override (`<projectCwd>/.claude/agents/<name>.md`)
297
+ * so the global definition applies there again. `projectCwd` is resolved by
298
+ * normalized cwd against currently-open tabs (findOpenProject — the same
299
+ * `openProjects` source `listPersonas` reports each overrideDetails `cwd` from);
300
+ * an unknown or empty cwd throws `project not open` and deletes nothing.
251
301
  */
252
302
  async function removeOverride({
253
303
  name,
254
- projectName,
304
+ projectCwd,
255
305
  loadSessions = sessionsStore.load,
256
306
  validatePath = configMgr.validatePath,
257
307
  } = {}) {
258
- const projects = await openProjects({ loadSessions });
259
- const project = projects.find((p) => p.name === projectName);
260
- if (!project) throw new Error(`project not open: ${projectName}`);
308
+ const project = await findOpenProject(projectCwd, loadSessions);
261
309
  const target = validatePath(path.join(project.cwd, '.claude', 'agents', `${name}.md`));
262
310
  try {
263
311
  await fsp.unlink(target);
@@ -268,9 +316,10 @@ async function removeOverride({
268
316
  }
269
317
 
270
318
  /**
271
- * Currently-open project tabs, deduped by cwd, as `{ cwd, name }` — `name`
272
- * is the last path segment (matches the `projectNameFromCwd` convention used
273
- * by the Scheduler's ProjectTag primitive). `loadSessions` is injectable
319
+ * Currently-open project tabs, deduped by NORMALIZED cwd (normalizeCwd), as
320
+ * `{ cwd, name }` — `cwd` is that normalized form (the override key callers
321
+ * match on); `name` is the last path segment, display-only and never a key
322
+ * (two open projects can share it). `loadSessions` is injectable
274
323
  * (mirrors scheduler.cjs's notifyOriginatingTab) so tests can exercise the
275
324
  * dedup/naming logic without touching the real persisted tabs.json.
276
325
  */
@@ -279,9 +328,11 @@ async function openProjects({ loadSessions = sessionsStore.load } = {}) {
279
328
  const seen = new Set();
280
329
  const projects = [];
281
330
  for (const t of tabs ?? []) {
282
- if (!t || typeof t.cwd !== 'string' || !t.cwd || seen.has(t.cwd)) continue;
283
- seen.add(t.cwd);
284
- projects.push({ cwd: t.cwd, name: path.basename(t.cwd.replace(/\/+$/, '')) || t.cwd });
331
+ if (!t || typeof t.cwd !== 'string' || !t.cwd) continue;
332
+ const cwd = normalizeCwd(t.cwd);
333
+ if (seen.has(cwd)) continue;
334
+ seen.add(cwd);
335
+ projects.push({ cwd, name: path.basename(cwd) || cwd });
285
336
  }
286
337
  return projects;
287
338
  }
@@ -340,7 +391,8 @@ async function listPersonas({
340
391
  const merged = resolveMergedPersona(p.cwd, path.basename(file, '.md'), { validatePath, globalDir });
341
392
  const fields = merged ? Object.keys(merged.provenance).filter((k) => merged.provenance[k] === 'overlay') : [];
342
393
  overrideDetails.push({
343
- project: p.name,
394
+ project: p.name, // display label only
395
+ cwd: p.cwd, // the override key (removeOverride / savePersona's projectCwd)
344
396
  fields,
345
397
  // The project's value for each overridden key (the UI renders global → project).
346
398
  values: merged ? Object.fromEntries(fields.map((k) => [k, merged.fm[k]])) : {},
@@ -2,7 +2,8 @@
2
2
 
3
3
  /**
4
4
  * agentsIpc.cjs — registers the `agents:*` IPC handlers (Agent Library CRUD + persona/model/effort
5
- * resolvers). Moved verbatim out of index.cjs; handler bodies and zod wrappers are unchanged.
5
+ * resolvers). Every handler that takes a payload parses it through ipcSchemas.cjs's
6
+ * `validated(...)` before agentLibrary (or a resolver) sees it.
6
7
  */
7
8
 
8
9
  const { schemas, validated } = require('./ipcSchemas.cjs');
@@ -16,18 +17,22 @@ const { sendIfAlive } = require('./lib/sendToRenderer.cjs');
16
17
  * @param {{ ipcMain: any, getWindow: () => any }} opts
17
18
  */
18
19
  function registerAgentsHandlers({ ipcMain, getWindow }) {
19
- // Agent Library nav page (Home face only): global `~/.claude/agents/*.md`
20
- // personas plus, per currently-open project tab, whether that project
21
- // overlays the same agent name at `<cwd>/.claude/agents/<name>.md`. Read-only.
20
+ // Agent Library nav page (Home face only) — its one read: every global
21
+ // `~/.claude/agents/*.md` persona plus, per currently-open project, that
22
+ // project's override at `<cwd>/.claude/agents/<name>.md` (overrideDetails,
23
+ // keyed by the project's cwd — the `projectCwd` the writes below take).
22
24
  ipcMain.handle('agents:list-personas', () => agentLibrary.listPersonas());
23
- // Agent Library CRUD — global personas only (`~/.claude/agents/*.md`); a
24
- // project's local overlay can only be removed here (removeOverride), never
25
- // created, since Agent Library is a Home-face, machine-wide surface with no
26
- // per-tab cwd context of its own. Each mutation broadcasts `agents:changed`
27
- // so Agent Library and Tag Library — two independently-mounted dockview
28
- // panels, each with its own component-local `listPersonas()` snapshot —
29
- // both refresh off the one file on disk instead of one panel going stale
30
- // after the other edits the agent<->tag relationship.
25
+ // Agent Library CRUD. Global personas (`~/.claude/agents/*.md`) are written
26
+ // by `agents:save-persona` and removed by `agents:delete-persona`. For a
27
+ // per-project override the page picks one of the open projects:
28
+ // `agents:save-persona` with that project's `projectCwd` writes its
29
+ // frontmatter-only override (model/effort only, at
30
+ // `<projectCwd>/.claude/agents/<name>.md`), and `agents:remove-override`
31
+ // with the same `projectCwd` drops it. Each mutation broadcasts
32
+ // `agents:changed` so Agent Library and Tag Library — two independently-
33
+ // mounted dockview panels, each with its own component-local
34
+ // `listPersonas()` snapshot — both refresh off the one file on disk instead
35
+ // of one panel going stale after the other edits the agent<->tag relationship.
31
36
  function broadcastAgentsChanged() {
32
37
  sendIfAlive(getWindow(), 'agents:changed', {});
33
38
  }
@@ -36,16 +41,16 @@ function registerAgentsHandlers({ ipcMain, getWindow }) {
36
41
  broadcastAgentsChanged();
37
42
  return result;
38
43
  }));
39
- ipcMain.handle('agents:delete-persona', async (_e, payload) => {
44
+ ipcMain.handle('agents:delete-persona', validated(schemas.agentsDeletePersona, async (payload) => {
40
45
  const result = await agentLibrary.deletePersona(payload);
41
46
  broadcastAgentsChanged();
42
47
  return result;
43
- });
44
- ipcMain.handle('agents:remove-override', async (_e, payload) => {
48
+ }));
49
+ ipcMain.handle('agents:remove-override', validated(schemas.agentsRemoveOverride, async (payload) => {
45
50
  const result = await agentLibrary.removeOverride(payload);
46
51
  broadcastAgentsChanged();
47
52
  return result;
48
- });
53
+ }));
49
54
  // New Epic AIM composer (epicIntake.ts's `agentBody`/`agentPath`): unlike
50
55
  // list-personas above (global dir only), this honors the project-overlay-
51
56
  // then-global precedence so an Epic's opening prompt carries the persona
@@ -1,8 +1,8 @@
1
1
  {
2
- "version": "0.130.2",
3
- "gitSha": "664aefcb5f51fbfb3e4c341ead029cce9da06edd",
4
- "gitShortSha": "664aefcb",
2
+ "version": "0.130.3",
3
+ "gitSha": "88b96e8764d7f1b455f245e1f742952983cb4459",
4
+ "gitShortSha": "88b96e87",
5
5
  "gitBranch": "HEAD",
6
- "builtAt": "2026-11-07T09:03:19.022Z",
6
+ "builtAt": "2026-11-08T04:03:29.236Z",
7
7
  "dirty": false
8
8
  }
@@ -12,7 +12,7 @@ const path = require('node:path');
12
12
  const { PromptSessionSchema, EpicTagSchema, EpicSourceSchema, EpicIntakeSectionSchema } = require('./lib/promptSessionSchema.cjs');
13
13
  const { PrdWorkTypeSchema } = require('./lib/prd/workTypeLibrary.cjs');
14
14
  const { PERSONA_NAME_RE } = require('./agentLibrary.cjs');
15
- const { AgentPersonaSaveSchema } = require('./lib/persona-macro/agentPersonaSchema.cjs');
15
+ const { AgentPersonaSaveSchema, PersonaNameSchema, ProjectCwdSchema } = require('./lib/persona-macro/agentPersonaSchema.cjs');
16
16
  const { MacroSaveSchema, MacroDeleteSchema, MacroSetProjectSchema, MacroRemoveFromProjectSchema, MacroInputSchema } = require('./lib/persona-macro/macroLibrary.cjs');
17
17
  const { MAX_SLOTS } = require('./lib/scheduler/sessionSlots.cjs');
18
18
 
@@ -663,6 +663,10 @@ const setSessionSlotsSchema = z.object({
663
663
  // Full field-level rules live in lib/persona-macro/agentPersonaSchema.cjs, mirroring
664
664
  // AgentPersonaSaveInput (src/preload/api.d.ts) field-for-field.
665
665
  const agentsSavePersona = AgentPersonaSaveSchema;
666
+ // agents:remove-override — an OPEN project's override, keyed by its absolute cwd (never a folder name).
667
+ const agentsRemoveOverride = z.object({ name: PersonaNameSchema, projectCwd: ProjectCwdSchema }).strict();
668
+ // agents:delete-persona — a kebab-case name only; `.strict()` also bars deletePersona's injectable `globalDir`.
669
+ const agentsDeletePersona = z.object({ name: PersonaNameSchema }).strict();
666
670
  // claudeConfig:read / claudeConfig:patch — mirrors ClaudeConfigReadInput /
667
671
  // ClaudeConfigPatchInput (src/preload/api.d.ts). fileId comes from the registry in
668
672
  // lib/claudeConfig.cjs; `value` absent => delete the key.
@@ -1524,6 +1528,8 @@ module.exports = {
1524
1528
  remoteSessionPrds,
1525
1529
  exchangesList,
1526
1530
  agentsSavePersona,
1531
+ agentsRemoveOverride,
1532
+ agentsDeletePersona,
1527
1533
  claudeConfigRead,
1528
1534
  claudeConfigPatch,
1529
1535
  macrosSave,
@@ -7,12 +7,13 @@
7
7
  * epic-worktree-isolation chain started by PRD 1032/1033).
8
8
  *
9
9
  * This is the ONLY point where that per-Epic isolation resolves back into
10
- * the shared tree — never mid-session (see gitWorktree.cjs's own header
11
- * comment for the ff-only -> merge-commit -> abort-and-flag algorithm this
12
- * reuses verbatim). The single caller is `markCompleted`'s merge-before-archive
13
- * checkpoint (via `attemptMergeToMainInternal` in
14
- * `src/renderer/state/promptSessions.ts`); there is no explicit "merge to
15
- * main" action.
10
+ * the shared tree — never mid-session (see gitWorktree.cjs's `integrateBranch`
11
+ * for the ff-only -> linear replay -> merge-commit fallback -> abort-and-flag
12
+ * algorithm this reuses verbatim, and scheduler-operations.md §5a for every
13
+ * case that still writes a merge commit). The single caller is
14
+ * `markCompleted`'s merge-before-archive checkpoint (via
15
+ * `attemptMergeToMainInternal` in `src/renderer/state/promptSessions.ts`);
16
+ * there is no explicit "merge to main" action.
16
17
  *
17
18
  * On success the worktree checkout is torn down (cleanupEpicWorktree) since
18
19
  * its content now safely lives on the main tree. On a real conflict, the
@@ -53,9 +54,10 @@ async function mergeEpicToMainViaIpc(cwd, epicId, branch, dir, carriedPaths) {
53
54
  console.log(`[epicWorktreeMerge] ${epicId}: needs manual resolution (${outcome.reason})`);
54
55
  return { ok: false, status: 'needs_merge_resolution', reason: outcome.reason };
55
56
  }
56
- // Clean ff-only/merge-commit landing, or a legitimate no-new-commits
57
- // no-op — either way the branch's content is safely reflected (or was
58
- // never ahead), so the checkout has nothing left to guard.
57
+ // Clean landing (ff-only, linear replay, or the merge-commit fallback),
58
+ // or a legitimate no-new-commits no-op — either way the branch's content
59
+ // is safely reflected (or was never ahead), so the checkout has nothing
60
+ // left to guard.
59
61
  await cleanupEpicWorktree({ cwd, dir, branch, keepBranch: false });
60
62
  return { ok: true, status: 'merged', integrated: outcome.integrated };
61
63
  }
@@ -60,6 +60,8 @@ const PATH_FENCED_CHANNELS = Object.freeze({
60
60
  'promptSessions:list-archived': { field: 'cwd', mode: 'root' },
61
61
  'promptSessions:read-archived': { field: 'cwd', mode: 'root' },
62
62
  'promptSessions:read-session-transcript': { field: 'cwd', mode: 'root' },
63
+ // Project Home > Tools > Review MD network link map (main/projectPages.cjs): cwd inside a registered root.
64
+ 'project-pages:md-network': { field: 'cwd', mode: 'root' },
63
65
  })
64
66
 
65
67
  const SECRET_DIRS = new Set(['.ssh', '.gnupg', '.aws', '.kube', '.docker', '.password-store', '.azure', '.terraform.d'])