claude-code-session-manager 0.139.0 → 0.140.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +20 -4
  2. package/dist/assets/AppSettings-CMFEM68R.js +2 -0
  3. package/dist/assets/History--JwsFnbn.js +2 -0
  4. package/dist/assets/{HomeClaudeConfig-CGD2Onjv.js → HomeClaudeConfig-ijEXs--3.js} +2 -2
  5. package/dist/assets/{Panel-Csyd9HbD.js → Panel-CALyU0pe.js} +1 -1
  6. package/dist/assets/{ProjectClaudeConfig-C-jlYpC_.js → ProjectClaudeConfig-sdlA-fUb.js} +1 -1
  7. package/dist/assets/Scheduler-YT3j8SUa.js +16 -0
  8. package/dist/assets/{SkillReferenceGraph-DcscPXAG.js → SkillReferenceGraph-CxAuwhNN.js} +1 -1
  9. package/dist/assets/{Skills-BpGRKOcY.js → Skills-DtRzghn5.js} +26 -26
  10. package/dist/assets/{TiptapBody-DSU3769X.js → TiptapBody-DApeu7x8.js} +1 -1
  11. package/dist/assets/{ViewTabs-C0PRZx4_.js → ViewTabs-B7qLXRAH.js} +1 -1
  12. package/dist/assets/{VoiceButton-D2rMurNg.js → VoiceButton-DtStfv1H.js} +1 -1
  13. package/dist/assets/{historyTotals-TcIQs2sh.js → historyTotals-ydfnwepc.js} +1 -1
  14. package/dist/assets/index-CtxruO1L.js +3121 -0
  15. package/dist/assets/{index-BCySPdtU.css → index-DKXdXfka.css} +1 -1
  16. package/dist/index.html +2 -2
  17. package/dist-web/app.css +1 -1
  18. package/dist-web/app.js +423 -426
  19. package/package.json +5 -2
  20. package/plugins/AGENTS.md +60 -0
  21. package/plugins/CLAUDE.md +1 -60
  22. package/plugins/session-manager-dev/skills/develop/SKILL.md +26 -19
  23. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
  24. package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
  25. package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
  26. package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
  27. package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
  28. package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
  29. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
  30. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
  31. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
  32. package/scripts/README.md +1 -0
  33. package/scripts/hooks/guard-tool-risk.cjs +91 -0
  34. package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
  35. package/scripts/ops-sweep.cjs +53 -23
  36. package/scripts/scheduler-mcp-server.cjs +200 -18
  37. package/src/main/build-info.json +4 -4
  38. package/src/main/config.cjs +112 -8
  39. package/src/main/docEdit.cjs +6 -1
  40. package/src/main/files.cjs +7 -27
  41. package/src/main/health.cjs +48 -15
  42. package/src/main/historyAggregator.cjs +88 -5
  43. package/src/main/historyDashboard.cjs +69 -4
  44. package/src/main/index.cjs +56 -2
  45. package/src/main/ipcSchemas.cjs +112 -16
  46. package/src/main/lib/AGENTS.md +54 -0
  47. package/src/main/lib/CLAUDE.md +1 -54
  48. package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
  49. package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
  50. package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
  51. package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
  52. package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
  53. package/src/main/lib/claude/effectiveModelInfo.cjs +90 -20
  54. package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
  55. package/src/main/lib/claude/personaToolScope.cjs +12 -6
  56. package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
  57. package/src/main/lib/claude/runClaudeP.cjs +6 -1
  58. package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
  59. package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
  60. package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
  61. package/src/main/lib/ephemeralCwd.cjs +37 -2
  62. package/src/main/lib/epic/delegationReadiness.cjs +42 -9
  63. package/src/main/lib/epic/epicAdminRoutes.cjs +25 -5
  64. package/src/main/lib/epic/epicOutsideRead.cjs +118 -1
  65. package/src/main/lib/epic/epicOutsideState.cjs +2 -2
  66. package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
  67. package/src/main/lib/epic/epicValidationHook.cjs +24 -4
  68. package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
  69. package/src/main/lib/externalContract.cjs +31 -5
  70. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +55 -1
  71. package/src/main/lib/feedback-remote/crossProjectReply.cjs +106 -11
  72. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +47 -19
  73. package/src/main/lib/feedback-remote/needsYouStore.cjs +6 -2
  74. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
  75. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
  76. package/src/main/lib/git/branchSweep.cjs +209 -4
  77. package/src/main/lib/git/gitWorktree.cjs +41 -5
  78. package/src/main/lib/guardShims.cjs +1 -1
  79. package/src/main/lib/historyRollup.cjs +26 -0
  80. package/src/main/lib/insideHome.cjs +27 -1
  81. package/src/main/lib/mcpToolCatalog.cjs +122 -12
  82. package/src/main/lib/mdDocCensus.cjs +59 -78
  83. package/src/main/lib/mdDocRefs.cjs +71 -93
  84. package/src/main/lib/mdNetworkScan.cjs +245 -250
  85. package/src/main/lib/mdReviewRecord.cjs +22 -9
  86. package/src/main/lib/memoryMdNetwork.cjs +5 -12
  87. package/src/main/lib/opsOwnership.cjs +18 -2
  88. package/src/main/lib/opsRetentionSettings.cjs +28 -4
  89. package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
  90. package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
  91. package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
  92. package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
  93. package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
  94. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
  95. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  96. package/src/main/lib/prd/depSlugResolve.cjs +104 -4
  97. package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
  98. package/src/main/lib/prd/prdCreate.cjs +351 -23
  99. package/src/main/lib/prd/prdDisposition.cjs +11 -2
  100. package/src/main/lib/prd/prdFrontmatter.cjs +96 -3
  101. package/src/main/lib/process/loginItem.cjs +171 -0
  102. package/src/main/lib/process/loginItemPlan.cjs +193 -0
  103. package/src/main/lib/project-pages/playerBridge.cjs +4 -0
  104. package/src/main/lib/project-pages/videoReview.cjs +268 -0
  105. package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
  106. package/src/main/lib/scheduler/cpuSample.cjs +131 -4
  107. package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
  108. package/src/main/lib/scheduler/loadGate.cjs +24 -6
  109. package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
  110. package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
  111. package/src/main/lib/scheduler/queueStore.cjs +7 -0
  112. package/src/main/lib/scheduler/rcaReport.cjs +21 -1
  113. package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
  114. package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
  115. package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
  116. package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
  117. package/src/main/lib/scheduler/schedulerPaths.cjs +3 -0
  118. package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
  119. package/src/main/lib/scheduler/validationQuality.cjs +282 -0
  120. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
  121. package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
  122. package/src/main/lib/tasks/taskIpc.cjs +80 -0
  123. package/src/main/lib/tasks/taskLedger.cjs +502 -0
  124. package/src/main/lib/tasks/taskRun.cjs +313 -0
  125. package/src/main/lib/tasks/taskSwitch.cjs +120 -0
  126. package/src/main/loginItemIpc.cjs +35 -0
  127. package/src/main/loopEfficiencyHandlers.cjs +10 -1
  128. package/src/main/projectPages.cjs +6 -15
  129. package/src/main/promptSessionEvents.cjs +9 -1
  130. package/src/main/queueOps.cjs +260 -3
  131. package/src/main/runVerify.cjs +53 -25
  132. package/src/main/scheduler/AGENTS.md +26 -0
  133. package/src/main/scheduler/CLAUDE.md +1 -26
  134. package/src/main/scheduler/budget.cjs +239 -9
  135. package/src/main/scheduler/cancelDependents.cjs +154 -0
  136. package/src/main/scheduler/prdParser.cjs +4 -1
  137. package/src/main/scheduler/starvation.cjs +20 -18
  138. package/src/main/scheduler.cjs +745 -64
  139. package/src/main/supervisor.cjs +5 -1
  140. package/src/main/templates/PRD_AUTHORING.md +6 -1
  141. package/src/main/validationQualityHandlers.cjs +199 -0
  142. package/src/main/webRemote.cjs +10 -2
  143. package/src/preload/api.d.ts +364 -21
  144. package/src/preload/apiSurface.json +89 -10
  145. package/src/preload/index.cjs +23 -2
  146. package/src/seed/agents/validator.md +19 -8
  147. package/dist/assets/AppSettings-CUfWY9vN.js +0 -2
  148. package/dist/assets/History-DDnqaLyw.js +0 -2
  149. package/dist/assets/Scheduler-NLs08fx7.js +0 -16
  150. package/dist/assets/index-C-d0DCre.js +0 -3124
@@ -18,6 +18,7 @@ const { spawn, execFileSync } = require('node:child_process');
18
18
  const { ipcMain } = require('electron');
19
19
  const { resolveClaudeBin, claudeSpawnTarget } = require('./lib/claude/claudeBin.cjs');
20
20
  const { headlessPermissionArgs, ensureCliCapsProbed } = require('./lib/claude/claudeCliCaps.cjs');
21
+ const { buildJobSandboxSettings } = require('./lib/claude/jobSandboxPolicy.cjs');
21
22
  const { withProcRole } = require('./lib/process/cleanEnv.cjs');
22
23
  const { feedChildStdin } = require('./lib/process/childStdin.cjs');
23
24
  const schedulerPaths = require('./lib/scheduler/schedulerPaths.cjs');
@@ -247,13 +248,16 @@ async function runProbe(claudeBin, prompt) {
247
248
  let child;
248
249
  try {
249
250
  const target = claudeSpawnTarget('aux', 'supervisor', claudeBin);
251
+ // No spawn cwd is set, so the child inherits process.cwd() — the sandbox roots there.
252
+ const sandboxDir = process.cwd();
253
+ const sandbox = buildJobSandboxSettings({ agentType: 'aux', worktreeDir: sandboxDir, projectRoot: sandboxDir, homeDir: os.homedir(), tmpDir: os.tmpdir(), deps: { available: false, missing: [] } });
250
254
  child = spawn(target.command, [
251
255
  '-p',
252
256
  '--model', 'claude-haiku-5-5',
253
257
  '--no-session-persistence',
254
258
  '--output-format', 'json',
255
259
  '--max-budget-usd', '0.50',
256
- '--dangerously-skip-permissions',
260
+ ...sandbox.argv,
257
261
  ...headlessPermissionArgs(),
258
262
  '--strict-mcp-config',
259
263
  '--allowedTools', 'Bash',
@@ -1,4 +1,4 @@
1
- <!-- PRD_AUTHORING.md v21 -->
1
+ <!-- PRD_AUTHORING.md v23 -->
2
2
  # PRD Authoring Guide — Scheduler Safety Rules
3
3
 
4
4
  Rule: every PRD you queue follows the rules below.
@@ -75,6 +75,11 @@ Rule: every PRD needs these fields.
75
75
 
76
76
  `planId` is written by the API, never by you. It groups PRDs into the plan (wave) they belong to: an `append` PRD, or one with an explicit `dependsOn`, inherits the `planId` of the PRD it attaches behind; a fresh PRD mints a new one. The Scheduler groups a plan card as a validate PRD (slug `validate-*`) plus everything it depends on, titled by that PRD's title.
77
77
 
78
+ Records: a validate PRD's record, and the ship/deploy record of a release or deploy PRD, is written to `session-manager-operations/plan-records/<epic-id>/<slug>.md` — machine-local runtime state the scheduler copies to the main checkout and prunes `planRecordsDays` after the Epic completes. A record is never committed and never force-added (`git add -f`); don't list it in `# Files` or a commit step. Why: records used to be committed under `reviews/validation/`, and they piled up in every project with no cleanup.
79
+
80
+ Rule: a PRD that must call a tool marked `irreversible`, `money` or `public` names it in `riskTools` on `scheduler_create_prd` (at most 20 rules, the marks' syntax, e.g. `["Bash(npm publish:*)"]`). Name only what the work needs; a Task can never be cleared.
81
+ Why: the headless job's guard-tool-risk hook refuses an uncleared marked tool. Marks, lookup order and limits: Session Manager's `session-manager-operations/architecture/tool-risk.md`.
82
+
78
83
  Artifact-only PRDs (`deliverable: artifact` + `artifactPaths: [...]`) — use this ONLY when every deliverable is a file the repo deliberately git-excludes, so "no commit" is the correct outcome, not a miss.
79
84
  1. Every artifact path is listed in `artifactPaths` and is relative, never `..`.
80
85
  2. Each file must be non-empty and written during the run window — the verifier stat-checks it on disk.
@@ -0,0 +1,199 @@
1
+ /**
2
+ * validationQualityHandlers.cjs — `history:validation-quality` IPC and
3
+ * GET /admin/validation-quality?cwd=<abs>. Gathers each project's Epic
4
+ * verdict events (active index + archived Epic files) and scheduler rows
5
+ * (queue + the project's own history shard, which carry `fixes`) and feeds
6
+ * the pure calculator in lib/scheduler/validationQuality.cjs.
7
+ *
8
+ * Zero-scan: the IPC never enumerates ~/.claude/projects (lib/CLAUDE.md). Its
9
+ * project list is the cwd values of the scheduler rows, and those same cwds
10
+ * are the registered roots handed to the archive readers, so the archive
11
+ * path never falls back to defaultProjectRoots' allProjectCwds scan.
12
+ *
13
+ * Read-only; every gather resolves { ok: false, error } instead of throwing.
14
+ */
15
+
16
+ 'use strict';
17
+
18
+ const path = require('path');
19
+ const { computeValidationQuality } = require('./lib/scheduler/validationQuality.cjs');
20
+
21
+ const HISTORY_ROWS_PER_PROJECT = 500;
22
+
23
+ /** @param {unknown} e */
24
+ const errText = (e) => (e instanceof Error ? e.message : String(e));
25
+ /** @param {unknown} v */
26
+ const isObj = (v) => v != null && typeof v === 'object' && !Array.isArray(v);
27
+ /** @param {string} p */
28
+ const norm = (p) => path.resolve(String(p)).replace(/[\\/]+$/, '');
29
+
30
+ /** Default loaders — required lazily so tests can inject fixtures. */
31
+ const defaults = {
32
+ /** Every live queue row (scheduler's merged queue read). */
33
+ async loadQueueJobs() {
34
+ const state = await require('./lib/scheduler/queueStore.cjs').readMerged();
35
+ return Array.isArray(state && state.jobs) ? state.jobs : [];
36
+ },
37
+ /** Newest federated history rows — only used to discover project cwds. */
38
+ async loadRecentHistory() {
39
+ return require('./lib/scheduler/queueHistory.cjs').readHistory({ limit: HISTORY_ROWS_PER_PROJECT });
40
+ },
41
+ /** One project's own history shard (newest-first, bounded tail). */
42
+ /** @param {string} cwd */
43
+ loadProjectHistory(cwd) {
44
+ const { readHistoryFileTailSync } = require('./lib/scheduler/queueHistory.cjs');
45
+ const { projectHistoryPath } = require('./lib/scheduler/queueStore.cjs');
46
+ return readHistoryFileTailSync(projectHistoryPath(cwd), { maxRows: HISTORY_ROWS_PER_PROJECT });
47
+ },
48
+ };
49
+
50
+ /** Terminal history rows only (skip needs_review ledger lines, which carry a `kind`). */
51
+ function isHistoryJobRow(r) {
52
+ return isObj(r) && typeof r.slug === 'string' && typeof r.cwd === 'string' && !('kind' in r && r.kind);
53
+ }
54
+
55
+ /**
56
+ * Epic verdict events of one project: open Epics' chains from the active
57
+ * index, plus every archived Epic's events. Unreadable files are skipped.
58
+ * @param {string} cwd @param {() => string[]} projectRoots
59
+ */
60
+ function epicsOf(cwd, projectRoots) {
61
+ const { readActiveIndex } = require('./lib/epic/epicMint.cjs');
62
+ const { listArchived, readArchived } = require('./promptSessionsIpc.cjs');
63
+ /** @type {Map<string, any[]>} */
64
+ const byId = new Map();
65
+ try {
66
+ const index = readActiveIndex(cwd);
67
+ for (const [epicId, chain] of Object.entries(isObj(index.events) ? index.events : {})) {
68
+ if (Array.isArray(chain)) byId.set(epicId, chain.slice());
69
+ }
70
+ } catch { /* no active index */ }
71
+ let ids = [];
72
+ try {
73
+ const listed = listArchived(cwd, { projectRoots });
74
+ ids = listed && Array.isArray(listed.ids) ? listed.ids : [];
75
+ } catch { /* unregistered or unreadable */ }
76
+ for (const epicId of ids) {
77
+ try {
78
+ const res = readArchived(cwd, epicId, { projectRoots });
79
+ const events = res && res.exists && isObj(res.data) && Array.isArray(res.data.events) ? res.data.events : [];
80
+ byId.set(epicId, [...(byId.get(epicId) || []), ...events]);
81
+ } catch { /* skip this archive */ }
82
+ }
83
+ return [...byId].map(([epicId, events]) => ({ cwd, epicId, events }));
84
+ }
85
+
86
+ /**
87
+ * Rows of the given projects: live queue rows + each project's history shard.
88
+ * Queue rows come first so a slug's live row wins over its archived copy.
89
+ */
90
+ function rowsFor(cwds, queueJobs, loadProjectHistory) {
91
+ const want = new Set(cwds);
92
+ const rows = [];
93
+ for (const j of queueJobs) if (isObj(j) && typeof j.cwd === 'string' && want.has(norm(j.cwd))) rows.push({ ...j, cwd: norm(j.cwd) });
94
+ for (const cwd of cwds) {
95
+ let hist = [];
96
+ try { hist = loadProjectHistory(cwd) || []; } catch { /* no shard */ }
97
+ for (const r of hist) if (isHistoryJobRow(r) && norm(r.cwd) === cwd) rows.push({ ...r, cwd });
98
+ }
99
+ return rows;
100
+ }
101
+
102
+ /**
103
+ * One project (cwd given) or every project that has scheduler rows (no cwd).
104
+ * @param {{ cwd?: string, nowMs?: number, projectRoots?: () => string[], loadQueueJobs?: () => Promise<any[]> | any[], loadRecentHistory?: () => Promise<any[]> | any[], loadProjectHistory?: (cwd: string) => any[] }} [opts]
105
+ * @returns {Promise<{ ok: true, projects: any[] } | { ok: false, error: string }>}
106
+ */
107
+ async function gatherValidationQuality(opts = {}) {
108
+ try {
109
+ const o = isObj(opts) ? opts : {};
110
+ const now = typeof o.nowMs === 'number' && Number.isFinite(o.nowMs) ? o.nowMs : Date.now();
111
+ const loadQueueJobs = o.loadQueueJobs || defaults.loadQueueJobs;
112
+ const loadRecentHistory = o.loadRecentHistory || defaults.loadRecentHistory;
113
+ const loadProjectHistory = o.loadProjectHistory || defaults.loadProjectHistory;
114
+
115
+ const queueJobs = (await loadQueueJobs()) || [];
116
+ /** @type {string[]} */
117
+ let cwds;
118
+ if (o.cwd !== undefined) {
119
+ if (typeof o.cwd !== 'string' || !path.isAbsolute(o.cwd)) return { ok: false, error: 'cwd must be an absolute path' };
120
+ cwds = [norm(o.cwd)];
121
+ } else {
122
+ const seen = new Set();
123
+ for (const j of queueJobs) if (isObj(j) && typeof j.cwd === 'string' && path.isAbsolute(j.cwd)) seen.add(norm(j.cwd));
124
+ let recent = [];
125
+ try { recent = (await loadRecentHistory()) || []; } catch { /* queue rows alone */ }
126
+ for (const r of recent) if (isHistoryJobRow(r) && path.isAbsolute(r.cwd)) seen.add(norm(r.cwd));
127
+ cwds = [...seen].sort();
128
+ }
129
+ // The rows' own cwds are the registered roots for the IPC (no machine scan);
130
+ // the admin route passes its own registration source.
131
+ const projectRoots = o.projectRoots || (() => cwds);
132
+
133
+ const rows = rowsFor(cwds, queueJobs, loadProjectHistory);
134
+ const epics = cwds.flatMap((cwd) => epicsOf(cwd, projectRoots));
135
+ // A project with no rows and no Epic still gets its (empty) row.
136
+ for (const cwd of cwds) if (!epics.some((e) => e.cwd === cwd)) epics.push({ cwd, epicId: '', events: [] });
137
+ const { projects } = computeValidationQuality({ epics, rows, nowMs: now });
138
+ return { ok: true, projects };
139
+ } catch (e) {
140
+ return { ok: false, error: errText(e) };
141
+ }
142
+ }
143
+
144
+ /**
145
+ * GET /admin/validation-quality?cwd=<abs>
146
+ * → 200 { ok: true, project } | 400 missing/relative cwd | 404 unregistered project
147
+ * | 500 { ok: false, error } when the gather fails.
148
+ * @param {{ registerRoute: Function }} adminHttp
149
+ * @param {{ projectRoots?: () => string[], nowMs?: () => number, loadQueueJobs?: () => any, loadProjectHistory?: (cwd: string) => any[] }} [deps]
150
+ */
151
+ function registerAdminRoute(adminHttp, deps = {}) {
152
+ const { sendJson } = require('./lib/feedback-remote/localAdminHttp.cjs');
153
+ adminHttp.registerRoute('GET', '/admin/validation-quality', async (/** @type {any} */ _req, /** @type {any} */ res, /** @type {any} */ query) => {
154
+ const cwd = query && typeof query.get === 'function' ? query.get('cwd') : null;
155
+ if (typeof cwd !== 'string' || !cwd || !path.isAbsolute(cwd)) {
156
+ sendJson(res, 400, { ok: false, error: 'cwd must be an absolute path' });
157
+ return;
158
+ }
159
+ const root = norm(cwd);
160
+ try {
161
+ require('./lib/opsOwnership.cjs').opsPath(root);
162
+ } catch (e) {
163
+ sendJson(res, 400, { ok: false, error: errText(e) });
164
+ return;
165
+ }
166
+ const { listArchived, defaultProjectRoots } = require('./promptSessionsIpc.cjs');
167
+ const projectRoots = deps.projectRoots || defaultProjectRoots;
168
+ try {
169
+ listArchived(root, { projectRoots });
170
+ } catch {
171
+ sendJson(res, 404, { ok: false, error: 'not a registered project' });
172
+ return;
173
+ }
174
+ const out = await gatherValidationQuality({
175
+ cwd: root,
176
+ nowMs: deps.nowMs ? deps.nowMs() : Date.now(),
177
+ projectRoots,
178
+ loadQueueJobs: deps.loadQueueJobs,
179
+ loadProjectHistory: deps.loadProjectHistory,
180
+ });
181
+ if (!out.ok) {
182
+ sendJson(res, 500, out);
183
+ return;
184
+ }
185
+ const project = out.projects.find((p) => p.cwd === root) || out.projects[0] || null;
186
+ sendJson(res, 200, { ok: true, project });
187
+ });
188
+ }
189
+
190
+ /**
191
+ * @param {{ ipcMain?: { handle: Function }, gather?: typeof gatherValidationQuality }} [deps]
192
+ */
193
+ function registerValidationQualityHandlers(deps = {}) {
194
+ const ipc = deps.ipcMain || require('electron').ipcMain;
195
+ const gather = deps.gather || gatherValidationQuality;
196
+ ipc.handle('history:validation-quality', async () => gather({ nowMs: Date.now() }));
197
+ }
198
+
199
+ module.exports = { gatherValidationQuality, registerValidationQualityHandlers, registerAdminRoute };
@@ -1218,6 +1218,12 @@ function respond(msgId, payload, typeOverride, client) {
1218
1218
  }
1219
1219
  }
1220
1220
 
1221
+ // A 'project-video' macro is a background Video tool run only from the desktop's
1222
+ // Project Home ▸ Video — the phone remote neither lists nor starts one.
1223
+ function isRemoteMacro(macro) {
1224
+ return macro.surface !== 'project-video';
1225
+ }
1226
+
1221
1227
  // Lazy-loaded dispatch map — avoids circular require at module load time.
1222
1228
  let _dispatchMap = null;
1223
1229
 
@@ -1410,7 +1416,7 @@ function getDispatchMap() {
1410
1416
  projects: tabs.map((t) => ({ cwd: t.cwd, title: t.label })),
1411
1417
  agents: personas.map((a) => ({ name: a.name, description: a.description })),
1412
1418
  tags: EpicTagSchema.options,
1413
- macros: await macroLibrary.listMacros(),
1419
+ macros: (await macroLibrary.listMacros()).filter(isRemoteMacro),
1414
1420
  macroInputs: true,
1415
1421
  };
1416
1422
  },
@@ -1430,7 +1436,9 @@ function getDispatchMap() {
1430
1436
  const macroLibrary = require('./lib/persona-macro/macroLibrary.cjs');
1431
1437
  const macros = await macroLibrary.listMacros();
1432
1438
  const macro = macros.find((m) => m.id === parsed.macroId);
1433
- if (!macro || !macroLibrary.macroVisibleIn(macro, parsed.cwd)) throw new Error('unknown macro');
1439
+ if (!macro || !isRemoteMacro(macro) || !macroLibrary.macroVisibleIn(macro, parsed.cwd)) {
1440
+ throw new Error('unknown macro');
1441
+ }
1434
1442
  const result = macroLibrary.renderMacroPrompt(parsed.prompt, macro.inputs, parsed.inputs ?? {});
1435
1443
  if (!result.ok) throw new Error(result.error);
1436
1444
  prompt = result.prompt;