claude-code-session-manager 0.138.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 (194) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +352 -79
  3. package/dist/assets/AppSettings-CMFEM68R.js +2 -0
  4. package/dist/assets/History--JwsFnbn.js +2 -0
  5. package/dist/assets/HomeClaudeConfig-ijEXs--3.js +3 -0
  6. package/dist/assets/{Panel-CeDiyuNn.js → Panel-CALyU0pe.js} +1 -1
  7. package/dist/assets/ProjectClaudeConfig-sdlA-fUb.js +26 -0
  8. package/dist/assets/Scheduler-YT3j8SUa.js +16 -0
  9. package/dist/assets/{SkillReferenceGraph-CFMK8NJh.js → SkillReferenceGraph-CxAuwhNN.js} +1 -1
  10. package/dist/assets/Skills-DtRzghn5.js +67 -0
  11. package/dist/assets/{TiptapBody-D1kTj-tn.js → TiptapBody-DApeu7x8.js} +60 -54
  12. package/dist/assets/ViewTabs-B7qLXRAH.js +1 -0
  13. package/dist/assets/{VoiceButton-CZeyPM31.js → VoiceButton-DtStfv1H.js} +1 -1
  14. package/dist/assets/{historyTotals-B00l64Jw.js → historyTotals-ydfnwepc.js} +1 -1
  15. package/dist/assets/index-CtxruO1L.js +3121 -0
  16. package/dist/assets/{index-62tyjEQB.css → index-DKXdXfka.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/dist-web/app.css +1 -1
  19. package/dist-web/app.js +467 -451
  20. package/package.json +17 -6
  21. package/plugins/AGENTS.md +60 -0
  22. package/plugins/CLAUDE.md +1 -60
  23. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  24. package/plugins/session-manager-dev/skills/builder/SKILL.md +12 -4
  25. package/plugins/session-manager-dev/skills/builder/scripts/publish-preflight.cjs +255 -0
  26. package/plugins/session-manager-dev/skills/develop/SKILL.md +36 -22
  27. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
  28. package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
  29. package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
  30. package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
  31. package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
  32. package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
  33. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
  34. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
  35. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
  36. package/scripts/README.md +2 -0
  37. package/scripts/hooks/guard-tool-risk.cjs +91 -0
  38. package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
  39. package/scripts/ops-sweep.cjs +53 -23
  40. package/scripts/scheduler-mcp-server.cjs +360 -35
  41. package/src/main/build-info.json +4 -4
  42. package/src/main/chatRunner.cjs +2 -2
  43. package/src/main/config.cjs +112 -8
  44. package/src/main/docEdit.cjs +6 -1
  45. package/src/main/exchanges.cjs +70 -5
  46. package/src/main/files.cjs +7 -27
  47. package/src/main/health.cjs +48 -15
  48. package/src/main/historyAggregator.cjs +172 -63
  49. package/src/main/historyDashboard.cjs +87 -17
  50. package/src/main/index.cjs +78 -4
  51. package/src/main/ipcSchemas.cjs +233 -20
  52. package/src/main/lib/AGENTS.md +54 -0
  53. package/src/main/lib/CLAUDE.md +1 -54
  54. package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
  55. package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
  56. package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
  57. package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
  58. package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
  59. package/src/main/lib/claude/effectiveModelInfo.cjs +92 -22
  60. package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
  61. package/src/main/lib/claude/modelPricing.cjs +148 -0
  62. package/src/main/lib/claude/personaToolScope.cjs +12 -6
  63. package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
  64. package/src/main/lib/claude/runClaudeP.cjs +6 -1
  65. package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
  66. package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
  67. package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
  68. package/src/main/lib/ephemeralCwd.cjs +37 -2
  69. package/src/main/lib/epic/delegationReadiness.cjs +42 -9
  70. package/src/main/lib/epic/epicAdminRoutes.cjs +121 -0
  71. package/src/main/lib/epic/epicJobReceipt.cjs +87 -0
  72. package/src/main/lib/epic/epicOutsideRead.cjs +423 -0
  73. package/src/main/lib/epic/epicOutsideState.cjs +233 -0
  74. package/src/main/lib/epic/epicSettle.cjs +1 -1
  75. package/src/main/lib/epic/epicStateWatcher.cjs +157 -0
  76. package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
  77. package/src/main/lib/epic/epicValidationHook.cjs +24 -4
  78. package/src/main/lib/epic/externalRef.cjs +37 -0
  79. package/src/main/lib/epic/externalRefIndex.cjs +136 -0
  80. package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
  81. package/src/main/lib/epic/restorableSessions.cjs +151 -17
  82. package/src/main/lib/epic/transcriptUsage.cjs +197 -0
  83. package/src/main/lib/externalContract.cjs +137 -0
  84. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +176 -5
  85. package/src/main/lib/feedback-remote/crossProjectReply.cjs +186 -9
  86. package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -6
  87. package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +50 -8
  88. package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +218 -4
  89. package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +19 -3
  90. package/src/main/lib/feedback-remote/feedbackImages.cjs +171 -0
  91. package/src/main/lib/feedback-remote/localAdminHttp.cjs +11 -10
  92. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +167 -21
  93. package/src/main/lib/feedback-remote/needsYouAdminRoutes.cjs +133 -0
  94. package/src/main/lib/feedback-remote/needsYouIpc.cjs +50 -0
  95. package/src/main/lib/feedback-remote/needsYouStore.cjs +285 -0
  96. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
  97. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
  98. package/src/main/lib/git/branchSweep.cjs +209 -4
  99. package/src/main/lib/git/gitWorktree.cjs +41 -5
  100. package/src/main/lib/guardShims.cjs +1 -1
  101. package/src/main/lib/historyRollup.cjs +58 -5
  102. package/src/main/lib/insideHome.cjs +27 -1
  103. package/src/main/lib/mcpToolCatalog.cjs +232 -25
  104. package/src/main/lib/mdDocCensus.cjs +59 -78
  105. package/src/main/lib/mdDocRefs.cjs +71 -93
  106. package/src/main/lib/mdNetworkScan.cjs +245 -250
  107. package/src/main/lib/mdReviewRecord.cjs +22 -9
  108. package/src/main/lib/memoryMdNetwork.cjs +5 -12
  109. package/src/main/lib/opsOwnership.cjs +18 -2
  110. package/src/main/lib/opsRetentionSettings.cjs +28 -4
  111. package/src/main/lib/persona-macro/agentAdminRoutes.cjs +121 -0
  112. package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
  113. package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
  114. package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
  115. package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
  116. package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
  117. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
  118. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  119. package/src/main/lib/prd/depSlugResolve.cjs +104 -4
  120. package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
  121. package/src/main/lib/prd/prdCreate.cjs +351 -23
  122. package/src/main/lib/prd/prdDisposition.cjs +11 -2
  123. package/src/main/lib/prd/prdFrontmatter.cjs +96 -3
  124. package/src/main/lib/process/loginItem.cjs +171 -0
  125. package/src/main/lib/process/loginItemPlan.cjs +193 -0
  126. package/src/main/lib/project-pages/playerBridge.cjs +4 -0
  127. package/src/main/lib/project-pages/videoReview.cjs +268 -0
  128. package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
  129. package/src/main/lib/promptSessionSchema.cjs +4 -0
  130. package/src/main/lib/remoteTranscriptTail.cjs +32 -1
  131. package/src/main/lib/scheduler/cpuSample.cjs +131 -4
  132. package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
  133. package/src/main/lib/scheduler/loadGate.cjs +24 -6
  134. package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
  135. package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
  136. package/src/main/lib/scheduler/queueStore.cjs +7 -0
  137. package/src/main/lib/scheduler/rcaReport.cjs +21 -1
  138. package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
  139. package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
  140. package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
  141. package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
  142. package/src/main/lib/scheduler/schedulerPaths.cjs +12 -0
  143. package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
  144. package/src/main/lib/scheduler/validationQuality.cjs +282 -0
  145. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
  146. package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
  147. package/src/main/lib/tasks/taskIpc.cjs +80 -0
  148. package/src/main/lib/tasks/taskLedger.cjs +502 -0
  149. package/src/main/lib/tasks/taskRun.cjs +313 -0
  150. package/src/main/lib/tasks/taskSwitch.cjs +120 -0
  151. package/src/main/lib/telemetry/auditEvents.cjs +176 -0
  152. package/src/main/lib/telemetry/eventsAdminRoutes.cjs +45 -0
  153. package/src/main/loginItemIpc.cjs +35 -0
  154. package/src/main/loopEfficiencyHandlers.cjs +11 -2
  155. package/src/main/projectPages.cjs +6 -15
  156. package/src/main/promptSessionEvents.cjs +9 -1
  157. package/src/main/queueOps.cjs +260 -3
  158. package/src/main/runVerify.cjs +53 -25
  159. package/src/main/scheduler/AGENTS.md +26 -0
  160. package/src/main/scheduler/CLAUDE.md +1 -26
  161. package/src/main/scheduler/budget.cjs +239 -9
  162. package/src/main/scheduler/cancelDependents.cjs +154 -0
  163. package/src/main/scheduler/prdParser.cjs +4 -1
  164. package/src/main/scheduler/starvation.cjs +20 -18
  165. package/src/main/scheduler.cjs +774 -64
  166. package/src/main/supervisor.cjs +5 -1
  167. package/src/main/templates/PRD_AUTHORING.md +7 -1
  168. package/src/main/transcripts.cjs +62 -7
  169. package/src/main/validationQualityHandlers.cjs +199 -0
  170. package/src/main/webRemote.cjs +132 -20
  171. package/src/preload/api.d.ts +434 -28
  172. package/src/preload/apiSurface.cjs +7 -0
  173. package/src/preload/apiSurface.json +485 -81
  174. package/src/preload/index.cjs +38 -5
  175. package/src/seed/agents/validator.md +19 -8
  176. package/dist/assets/AgentLibrary-C1d_D7uQ.js +0 -2
  177. package/dist/assets/AppSettings-CgDhqrsU.js +0 -2
  178. package/dist/assets/Button-Bk23rEnZ.js +0 -1
  179. package/dist/assets/DocumentEditorPane-BqY5Nq6W.js +0 -1
  180. package/dist/assets/Extensions-CXem-uwI.js +0 -2
  181. package/dist/assets/History-BwO3coo4.js +0 -2
  182. package/dist/assets/Library-BDV69fSe.js +0 -32
  183. package/dist/assets/ListDetail-CD-Fm6mh.js +0 -1
  184. package/dist/assets/ProjectClaudeConfig-NjdKdwe8.js +0 -25
  185. package/dist/assets/ProvenanceBadge-Bu8NmI_R.js +0 -1
  186. package/dist/assets/Scheduler-CkhTvG7C.js +0 -16
  187. package/dist/assets/Settings-COT34hBF.js +0 -2
  188. package/dist/assets/Skills-BgexoUkQ.js +0 -29
  189. package/dist/assets/SourceChip-BXjcdeb1.js +0 -1
  190. package/dist/assets/SystemPrompt-CeeH3EeW.js +0 -1
  191. package/dist/assets/Toggle-CENi19iK.js +0 -1
  192. package/dist/assets/ViewTabs-DDBb0x96.js +0 -1
  193. package/dist/assets/claude-settings-schema-COigsajx.js +0 -3
  194. package/dist/assets/index-CgCxpunJ.js +0 -3116
@@ -0,0 +1,313 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * taskRun.cjs — run ONE headless `claude -p` for a Task.
5
+ *
6
+ * The Task primitive's spawn half. Explicit --model and --effort, the caller's
7
+ * runtime flags passed through unchanged, the prompt on stdin (never argv —
8
+ * E2BIG), and a structured result: exit, stdout, parsed JSON envelope, usage
9
+ * and quota state.
10
+ *
11
+ * Deliberately NOT here:
12
+ * - slot acquisition (lib/scheduler/sessionSlots.cjs) — the route holds the slot;
13
+ * - a persona body — `--system-prompt` is passed only when the caller gives one,
14
+ * and it REPLACES the system prompt (never --append-system-prompt);
15
+ * - ledger writes / HTTP.
16
+ *
17
+ * Spawn pattern mirrors lib/claude/runClaudeP.cjs (resolveClaudeBin,
18
+ * claudeSpawnTarget, feedChildStdin) inside a memory scope like chatRunner.cjs.
19
+ */
20
+
21
+ const path = require('node:path');
22
+ const os = require('node:os');
23
+ const { spawn: nodeSpawn } = require('node:child_process');
24
+ const { resolveClaudeBin, claudeSpawnTarget } = require('../claude/claudeBin.cjs');
25
+ const { headlessPermissionArgs, ensureCliCapsProbed } = require('../claude/claudeCliCaps.cjs');
26
+ const { detectRateLimitInText } = require('../claude/rateLimitDetect.cjs');
27
+ const { feedChildStdin } = require('../process/childStdin.cjs');
28
+ const { withProcRole } = require('../process/cleanEnv.cjs');
29
+ const { killTree, detachedSpawnOpts } = require('../process/killTree.cjs');
30
+ const memoryScope = require('../process/memoryScope.cjs');
31
+ const { writeToolRiskGuardSettingsFile } = require('../epic/guardSpawnSettings.cjs');
32
+ const { buildJobSandboxSettings } = require('../claude/jobSandboxPolicy.cjs');
33
+
34
+ const MAX_STDOUT_BYTES = 8 * 1024 * 1024;
35
+ const STDERR_TAIL_BYTES = 16 * 1024;
36
+ const MAX_ARG_BYTES = 100 * 1024;
37
+ const PROC_ROLE = 'aux';
38
+ const PROC_DETAIL = 'task';
39
+
40
+ function nonEmptyString(v) {
41
+ return typeof v === 'string' && v.trim() !== '';
42
+ }
43
+
44
+ /**
45
+ * Build the claude argv for a Task. Pure (reads only the cached CLI-caps probe
46
+ * via headlessPermissionArgs()). Never includes the prompt.
47
+ *
48
+ * @param {{ model: string, effort: string, runtime?: Record<string, any>, projectCwd?: string }} o
49
+ * @returns {string[]}
50
+ */
51
+ function buildTaskArgs({ model, effort, runtime, projectCwd } = /** @type {any} */ ({})) {
52
+ if (!nonEmptyString(model)) throw new Error('buildTaskArgs: model is required');
53
+ if (!nonEmptyString(effort)) throw new Error('buildTaskArgs: effort is required');
54
+ const rt = runtime && typeof runtime === 'object' ? runtime : {};
55
+ const base = typeof projectCwd === 'string' && projectCwd ? projectCwd : process.cwd();
56
+
57
+ const args = ['-p', '--model', model, '--effort', effort];
58
+ if (nonEmptyString(rt.sessionId)) args.push('--session-id', rt.sessionId);
59
+ if (nonEmptyString(rt.resume)) args.push('--resume', rt.resume);
60
+ if (!(rt.persistSession === true || nonEmptyString(rt.resume))) args.push('--no-session-persistence');
61
+ if (typeof rt.settingSources === 'string') args.push('--setting-sources', rt.settingSources);
62
+ if (rt.strictMcpConfig === true) args.push('--strict-mcp-config');
63
+ if (rt.maxTurns !== undefined && rt.maxTurns !== null) args.push('--max-turns', String(rt.maxTurns));
64
+ if (typeof rt.systemPrompt === 'string') args.push('--system-prompt', rt.systemPrompt);
65
+ if (rt.dangerouslySkipPermissions === true) {
66
+ // Tool-rules level of the job sandbox policy: bypass kept, home secrets denied.
67
+ // '--settings' takes one value, so it sits here, not in the variadic block below.
68
+ const root = path.resolve(base);
69
+ const policy = buildJobSandboxSettings({
70
+ agentType: 'task', worktreeDir: root, projectRoot: root,
71
+ homeDir: os.homedir(), tmpDir: os.tmpdir(), deps: { available: false, missing: [] },
72
+ });
73
+ args.push(...policy.argv, ...headlessPermissionArgs());
74
+ }
75
+
76
+ // Variadic flags last-but-one: a following flag (--output-format) always ends their list.
77
+ const mcp = rt.mcpConfig === undefined || rt.mcpConfig === null
78
+ ? null
79
+ : (Array.isArray(rt.mcpConfig) ? rt.mcpConfig : [rt.mcpConfig]);
80
+ if (mcp && mcp.length) args.push('--mcp-config', ...mcp.map((p) => path.resolve(base, String(p))));
81
+ if (Array.isArray(rt.allowedTools)) args.push('--allowedTools', rt.allowedTools.join(','));
82
+ if (Array.isArray(rt.tools)) args.push('--tools', rt.tools.join(','));
83
+
84
+ if (rt.outputFormat === 'stream-json') args.push('--output-format', 'stream-json', '--verbose');
85
+ else args.push('--output-format', 'json');
86
+
87
+ for (const a of args) {
88
+ if (Buffer.byteLength(a, 'utf8') > MAX_ARG_BYTES) {
89
+ const err = /** @type {Error & { code?: string }} */ (new Error(`buildTaskArgs: an argv element exceeds ${MAX_ARG_BYTES} bytes`));
90
+ err.code = 'argv_too_large';
91
+ throw err;
92
+ }
93
+ }
94
+ return args;
95
+ }
96
+
97
+ /**
98
+ * baseEnv + the three Task markers. No other caller env is ever added.
99
+ * @param {Record<string, any>} runtime
100
+ * @param {Record<string, string|undefined>} baseEnv
101
+ */
102
+ function buildTaskEnv(runtime, baseEnv) {
103
+ const env = withProcRole({ ...(baseEnv || {}), SM_KG_INTERNAL: '1' }, PROC_ROLE);
104
+ if (runtime && runtime.disableAutoMemory === true) env.CLAUDE_CODE_DISABLE_AUTO_MEMORY = '1';
105
+ return env;
106
+ }
107
+
108
+ /**
109
+ * Load guard-tool-risk into a Task run: '--settings', <path> right after '-p'
110
+ * (ahead of every variadic flag) and SM_TOOL_RISK_HEADLESS='1' (no clearance —
111
+ * a Task has no PRD riskTools). A null path returns the inputs unchanged.
112
+ * Pure: never mutates args/env.
113
+ *
114
+ * @param {{ args: string[], env: Record<string, string|undefined>, settingsPath: string|null }} o
115
+ */
116
+ function withToolRiskGuard({ args, env, settingsPath }) {
117
+ if (typeof settingsPath !== 'string' || !settingsPath) return { args, env };
118
+ const a = Array.isArray(args) ? args.slice() : [];
119
+ const at = a[0] === '-p' ? 1 : 0;
120
+ a.splice(at, 0, '--settings', settingsPath);
121
+ return { args: a, env: { ...(env || {}), SM_TOOL_RISK_HEADLESS: '1' } };
122
+ }
123
+
124
+ /** Parse json stdout, or the last stream-json `type: 'result'` line. */
125
+ function parseEnvelope(stdout) {
126
+ const text = String(stdout || '').trim();
127
+ if (!text) return null;
128
+ try {
129
+ const v = JSON.parse(text);
130
+ if (v && typeof v === 'object' && !Array.isArray(v)) return v;
131
+ if (Array.isArray(v)) {
132
+ for (let i = v.length - 1; i >= 0; i--) if (v[i] && v[i].type === 'result') return v[i];
133
+ }
134
+ } catch { /* stream-json: fall through */ }
135
+ const lines = text.split('\n');
136
+ for (let i = lines.length - 1; i >= 0; i--) {
137
+ const t = lines[i].trim();
138
+ if (!t || t[0] !== '{') continue;
139
+ try {
140
+ const ev = JSON.parse(t);
141
+ if (ev && ev.type === 'result') return ev;
142
+ } catch { /* partial line */ }
143
+ }
144
+ return null;
145
+ }
146
+
147
+ /** resetsAt of the last rejected rate_limit_event, as an ISO string, else null. */
148
+ function parseResetsAt(stdout) {
149
+ let out = null;
150
+ for (const line of String(stdout || '').split('\n')) {
151
+ const t = line.trim();
152
+ if (!t || t[0] !== '{') continue;
153
+ let ev;
154
+ try { ev = JSON.parse(t); } catch { continue; }
155
+ if (!ev || ev.type !== 'rate_limit_event' || !ev.rate_limit_info) continue;
156
+ if (ev.rate_limit_info.status !== 'rejected') continue;
157
+ const r = Number(ev.rate_limit_info.resetsAt);
158
+ if (Number.isFinite(r) && r > 0) out = new Date(r < 1e12 ? r * 1000 : r).toISOString();
159
+ }
160
+ return out;
161
+ }
162
+
163
+ /** Text form of an envelope for callers that want `--output-format text` stdout. */
164
+ function textStdoutFor(envelope) {
165
+ const r = envelope && typeof envelope.result === 'string' ? envelope.result : '';
166
+ return `${r}\n`;
167
+ }
168
+
169
+ /**
170
+ * Spawn claude, feed the prompt on stdin, capture. Resolves — never throws.
171
+ *
172
+ * @param {{ args: string[], env: Record<string, string|undefined>, prompt: string, cwd: string,
173
+ * timeoutMs?: number, signal?: AbortSignal, onSpawn?: (pid: number) => void }} o
174
+ */
175
+ async function runTask({ args, env, prompt, cwd, timeoutMs = 600_000, signal, onSpawn, deps = {} } = /** @type {any} */ ({})) {
176
+ const startedAt = Date.now();
177
+ const base = () => ({
178
+ status: /** @type {string} */ ('spawn_failed'),
179
+ exitCode: null,
180
+ signal: null,
181
+ stdout: '',
182
+ stderrTail: '',
183
+ envelope: null,
184
+ usage: null,
185
+ modelUsage: null,
186
+ cliCostUsd: null,
187
+ numTurns: null,
188
+ sessionId: null,
189
+ durationMs: 0,
190
+ quota: { rateLimited: false, resetsAt: null },
191
+ });
192
+ try { await ensureCliCapsProbed(); } catch { /* probe is best effort */ }
193
+ if (signal && signal.aborted) return { ...base(), status: 'caller_gone', durationMs: Date.now() - startedAt };
194
+
195
+ // guard-tool-risk (PRD scheduler-tool-risk-wiring): a null settings path
196
+ // never blocks the run — log one line and spawn without it.
197
+ const writeRiskSettings = deps.writeToolRiskGuardSettingsFile || writeToolRiskGuardSettingsFile;
198
+ let settingsPath = null;
199
+ try { settingsPath = await writeRiskSettings({ homeDir: os.homedir() }); } catch { settingsPath = null; }
200
+ if (!settingsPath) console.warn('[taskRun] tool-risk guard settings unavailable; running the Task without guard-tool-risk');
201
+ ({ args, env } = withToolRiskGuard({ args, env, settingsPath }));
202
+
203
+ return new Promise((resolve) => {
204
+ let settled = false;
205
+ let child = null;
206
+ let timer = null;
207
+ let onAbort = null;
208
+ let killedFor = null; // 'timeout' | 'caller_gone'
209
+ let stdout = '';
210
+ let stdoutBytes = 0;
211
+ let stderrTail = '';
212
+
213
+ const finish = (r) => {
214
+ if (settled) return;
215
+ settled = true;
216
+ if (timer) clearTimeout(timer);
217
+ if (signal && onAbort) { try { signal.removeEventListener('abort', onAbort); } catch { /* */ } }
218
+ resolve({ ...r, durationMs: Date.now() - startedAt });
219
+ };
220
+ const kill = (why) => {
221
+ if (killedFor || !child) return;
222
+ killedFor = why;
223
+ if (!killTree(child.pid, 'SIGKILL')) { try { child.kill('SIGKILL'); } catch { /* already dead */ } }
224
+ };
225
+
226
+ try {
227
+ const bin = resolveClaudeBin();
228
+ let target = claudeSpawnTarget(PROC_ROLE, PROC_DETAIL, bin, args);
229
+ let spawnArgs = target.args || args;
230
+ const limits = memoryScope.memoryLimitsFor({ totalRamMb: Math.floor(os.totalmem() / 1048576) });
231
+ if (limits && memoryScope.scopeSupported()) {
232
+ const unit = `sm-task-${process.pid}-${Date.now()}-${Math.floor(Math.random() * 1e6)}`;
233
+ const wrapped = memoryScope.wrapInMemoryScope({ command: target.command, args: spawnArgs, unit, limits });
234
+ // argv0 cannot pass through systemd-run — dropped on the wrapped path only.
235
+ target = { ...target, command: wrapped.command, argv0: undefined };
236
+ spawnArgs = wrapped.args;
237
+ }
238
+ child = nodeSpawn(target.command, spawnArgs, {
239
+ cwd,
240
+ env,
241
+ stdio: ['pipe', 'pipe', 'pipe'],
242
+ ...(target.argv0 ? { argv0: target.argv0 } : {}),
243
+ ...(target.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}),
244
+ ...detachedSpawnOpts(),
245
+ });
246
+ } catch (e) {
247
+ finish({ ...base(), status: 'spawn_failed', stderrTail: String((e && e.message) || e) });
248
+ return;
249
+ }
250
+
251
+ child.on('error', (e) => {
252
+ // Spawn-time failure (ENOENT, EACCES): no 'close' with a real exit follows reliably.
253
+ if (child.pid === undefined || child.exitCode === null) {
254
+ finish({ ...base(), status: 'spawn_failed', stdout, stderrTail: (stderrTail + String((e && e.message) || e)).slice(-STDERR_TAIL_BYTES) });
255
+ }
256
+ });
257
+
258
+ if (child.pid !== undefined) {
259
+ try { if (typeof onSpawn === 'function') onSpawn(child.pid); } catch { /* caller hook must not break the run */ }
260
+ }
261
+
262
+ child.stdout.on('data', (d) => {
263
+ if (stdoutBytes >= MAX_STDOUT_BYTES) return;
264
+ const room = MAX_STDOUT_BYTES - stdoutBytes;
265
+ const buf = Buffer.isBuffer(d) ? d : Buffer.from(String(d));
266
+ const take = buf.length > room ? buf.subarray(0, room) : buf;
267
+ stdout += take.toString('utf8');
268
+ stdoutBytes += take.length;
269
+ });
270
+ child.stderr.on('data', (d) => {
271
+ stderrTail += String(d);
272
+ if (stderrTail.length > STDERR_TAIL_BYTES) stderrTail = stderrTail.slice(-STDERR_TAIL_BYTES);
273
+ });
274
+
275
+ feedChildStdin(child, String(prompt == null ? '' : prompt));
276
+
277
+ if (Number.isFinite(timeoutMs) && timeoutMs > 0) {
278
+ timer = setTimeout(() => kill('timeout'), timeoutMs);
279
+ }
280
+ if (signal) {
281
+ onAbort = () => kill('caller_gone');
282
+ signal.addEventListener('abort', onAbort, { once: true });
283
+ }
284
+
285
+ child.on('close', (code, sig) => {
286
+ const envelope = parseEnvelope(stdout);
287
+ const rateLimited = detectRateLimitInText(stdout)
288
+ || (envelope ? detectRateLimitInText(JSON.stringify(envelope)) : false);
289
+ let status;
290
+ if (killedFor) status = killedFor;
291
+ else if (rateLimited) status = 'rate_limited';
292
+ else if (code !== 0 || (envelope && envelope.is_error === true) || sig) status = 'error';
293
+ else status = 'ok';
294
+ finish({
295
+ status,
296
+ exitCode: typeof code === 'number' ? code : null,
297
+ signal: sig || null,
298
+ stdout,
299
+ stderrTail,
300
+ envelope,
301
+ usage: (envelope && envelope.usage) || null,
302
+ modelUsage: (envelope && envelope.modelUsage) || null,
303
+ cliCostUsd: envelope && typeof envelope.total_cost_usd === 'number' ? envelope.total_cost_usd : null,
304
+ numTurns: envelope && typeof envelope.num_turns === 'number' ? envelope.num_turns : null,
305
+ sessionId: (envelope && typeof envelope.session_id === 'string' && envelope.session_id) || null,
306
+ durationMs: 0,
307
+ quota: { rateLimited, resetsAt: rateLimited ? parseResetsAt(stdout) : null },
308
+ });
309
+ });
310
+ });
311
+ }
312
+
313
+ module.exports = { buildTaskArgs, buildTaskEnv, withToolRiskGuard, runTask, textStdoutFor, parseEnvelope, MAX_STDOUT_BYTES, STDERR_TAIL_BYTES, MAX_ARG_BYTES };
@@ -0,0 +1,120 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * taskSwitch.cjs — the per-project human switch 'Scripts may run Tasks'.
5
+ *
6
+ * One MACHINE-LEVEL file (schedulerPaths.taskSwitchesPath(), beside the slot
7
+ * config) keyed by absolute project cwd (normalized with path.resolve):
8
+ * { "v": 1, "projects": { "/abs/cwd": { "enabled": true, "changedAt": "ISO" } } }
9
+ * It lives outside every project ops root, so opsOwnership does not govern it.
10
+ *
11
+ * Readers: the Task admin route (refuses with 403 while a project is off), the
12
+ * history surface (finds projects with Task ledgers from listTaskProjects()
13
+ * instead of scanning ~/.claude/projects), and the held interactive slot (on
14
+ * only while anyTaskSwitchOn()).
15
+ *
16
+ * HUMAN-ONLY WRITER: the switch is a human decision. Only the renderer IPC
17
+ * handler (tasks/taskIpc.cjs) may call setTaskSwitch. No admin route, MCP tool,
18
+ * script or agent-facing surface may write it — a script that could flip its
19
+ * own permission would make the switch meaningless.
20
+ *
21
+ * Switching off keeps the entry (enabled:false + changedAt) so the project
22
+ * stays listed. Reads are cached by file mtime (one statSync per read); a
23
+ * missing or corrupt file reads as all-off and never throws.
24
+ */
25
+
26
+ const fs = require('node:fs');
27
+ const path = require('node:path');
28
+ const { taskSwitchesPath } = require('../scheduler/schedulerPaths.cjs');
29
+ const atomicFs = require('../util/atomicFs.cjs');
30
+
31
+ const VERSION = 1;
32
+
33
+ /** @type {{ file: string, mtimeMs: number, data: Record<string, { enabled: boolean, changedAt: string }> } | null} */
34
+ let cache = null;
35
+
36
+ function normalizeCwd(cwd) {
37
+ if (typeof cwd !== 'string' || cwd.trim() === '') return null;
38
+ return path.resolve(cwd);
39
+ }
40
+
41
+ /** Keep only well-formed entries; anything else reads as absent (off). */
42
+ function sanitize(parsed) {
43
+ const out = {};
44
+ const projects = parsed && typeof parsed === 'object' ? parsed.projects : null;
45
+ if (!projects || typeof projects !== 'object' || Array.isArray(projects)) return out;
46
+ for (const [cwd, entry] of Object.entries(projects)) {
47
+ if (!entry || typeof entry !== 'object') continue;
48
+ out[path.resolve(cwd)] = {
49
+ enabled: entry.enabled === true,
50
+ changedAt: typeof entry.changedAt === 'string' ? entry.changedAt : '',
51
+ };
52
+ }
53
+ return out;
54
+ }
55
+
56
+ function readAll() {
57
+ let file;
58
+ try {
59
+ file = taskSwitchesPath();
60
+ } catch {
61
+ return {};
62
+ }
63
+ let mtimeMs;
64
+ try {
65
+ mtimeMs = fs.statSync(file).mtimeMs;
66
+ } catch {
67
+ cache = null;
68
+ return {};
69
+ }
70
+ if (cache && cache.file === file && cache.mtimeMs === mtimeMs) return cache.data;
71
+ const data = sanitize(atomicFs.readJsonOrSync(file, null));
72
+ cache = { file, mtimeMs, data };
73
+ return data;
74
+ }
75
+
76
+ /** True only when `cwd`'s switch is explicitly on. Never throws. */
77
+ function isTaskSwitchOn(cwd) {
78
+ const key = normalizeCwd(cwd);
79
+ if (!key) return false;
80
+ const entry = readAll()[key];
81
+ return !!(entry && entry.enabled);
82
+ }
83
+
84
+ /**
85
+ * HUMAN-ONLY: call from the renderer IPC handler (taskIpc.cjs) and nowhere else.
86
+ * Records { enabled, changedAt }; switching off keeps the entry.
87
+ */
88
+ function setTaskSwitch(cwd, on) {
89
+ const key = normalizeCwd(cwd);
90
+ if (!key) throw new Error('setTaskSwitch: cwd must be a non-empty string');
91
+ const projects = { ...readAll() };
92
+ projects[key] = { enabled: on === true, changedAt: new Date().toISOString() };
93
+ const file = taskSwitchesPath();
94
+ fs.mkdirSync(path.dirname(file), { recursive: true });
95
+ atomicFs.writeJsonAtomicSync(file, { v: VERSION, projects });
96
+ cache = null;
97
+ return { cwd: key, ...projects[key] };
98
+ }
99
+
100
+ /** Every project that ever had the switch set, on or off. */
101
+ function listTaskProjects() {
102
+ return Object.entries(readAll()).map(([cwd, e]) => ({ cwd, enabled: e.enabled, changedAt: e.changedAt }));
103
+ }
104
+
105
+ /** True while at least one project has the switch on. */
106
+ function anyTaskSwitchOn() {
107
+ return Object.values(readAll()).some((e) => e.enabled);
108
+ }
109
+
110
+ function _resetForTests() {
111
+ cache = null;
112
+ }
113
+
114
+ module.exports = {
115
+ isTaskSwitchOn,
116
+ setTaskSwitch,
117
+ listTaskProjects,
118
+ anyTaskSwitchOn,
119
+ _resetForTests,
120
+ };
@@ -0,0 +1,176 @@
1
+ /**
2
+ * auditEvents.cjs — cursor reader over the audit log for outside apps.
3
+ *
4
+ * readEventsAfter({ after, kinds, limit, target }) → { events, next, more, gap }.
5
+ *
6
+ * Cursor = `<at of the last row handed out>~<count of rows with exactly that at
7
+ * already handed out>`. "Handed out" means scanned: next advances past every row
8
+ * this call looked at, matching or not, so rows sharing one timestamp are never
9
+ * skipped or repeated. `after` absent → no events, next = newest live row (start
10
+ * from now). `after === 'start'` → from the first row of the live file.
11
+ *
12
+ * The live file is read with readTail in a growing window (1 MB, doubling) until
13
+ * the window's first row is strictly before the cursor's at (so the whole group of
14
+ * rows sharing the cursor's at is visible) or the whole file is covered. Only when
15
+ * the cursor is at or before the live file's first row is the newest rotated
16
+ * archive (`audit-log-YYYY-MM.jsonl.gz`, same folder) unzipped in memory and its
17
+ * rows prepended — unless its compressed size exceeds MAX_ARCHIVE_GZ_BYTES (or the
18
+ * maxArchiveGzBytes option), in which case it is skipped and gap is true.
19
+ * gap = the cursor predates the oldest row still readable.
20
+ *
21
+ * Assumes rows are appended in non-decreasing `at` order (they are: appendAuditEvent
22
+ * stamps `now` at append time). Rows that fail to parse or lack a string `at` are skipped.
23
+ */
24
+ 'use strict';
25
+
26
+ const fs = require('node:fs');
27
+ const path = require('node:path');
28
+ const zlib = require('node:zlib');
29
+
30
+ const { auditLogPath, readTail } = require('./auditLog.cjs');
31
+
32
+ const OUTSIDE_EVENT_KINDS = Object.freeze(['epic_state_changed', 'job_transition', 'epic_cross_project_reply', 'needs_you_answered']);
33
+ const DEFAULT_KINDS = Object.freeze(['epic_state_changed']);
34
+ const DEFAULT_LIMIT = 100;
35
+ const MAX_LIMIT = 500;
36
+ const INITIAL_WINDOW = 1024 * 1024;
37
+ /** Largest compressed archive loadArchive will unzip in memory; a bigger one is skipped (gap true). */
38
+ const MAX_ARCHIVE_GZ_BYTES = 16 * 1024 * 1024;
39
+ const START = 'start';
40
+ const CURSOR_RE = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z)~(\d+)$/;
41
+ const CURSOR_FORM = "expected '<ISO timestamp>~<count>' (e.g. 2026-11-01T00:00:00.000Z~1) or 'start'";
42
+ /** `code` of the Error parseCursor throws for a malformed cursor. */
43
+ const INVALID_AUDIT_CURSOR = 'INVALID_AUDIT_CURSOR';
44
+
45
+ /** @param {unknown} after */
46
+ function parseCursor(after) {
47
+ if (after === START) return { start: true, at: '', n: 0 };
48
+ const m = typeof after === 'string' ? CURSOR_RE.exec(after) : null;
49
+ if (!m) {
50
+ const err = /** @type {Error & { code: string }} */ (new Error(`invalid audit cursor ${JSON.stringify(after)}: ${CURSOR_FORM}`));
51
+ err.code = INVALID_AUDIT_CURSOR;
52
+ throw err;
53
+ }
54
+ return { start: false, at: m[1], n: Number(m[2]) };
55
+ }
56
+
57
+ /** @param {string[]} lines */
58
+ function parseRows(lines) {
59
+ const rows = [];
60
+ for (const line of lines) {
61
+ let r;
62
+ try { r = JSON.parse(line); } catch { continue; }
63
+ if (r && typeof r === 'object' && !Array.isArray(r) && typeof r.at === 'string') rows.push(r);
64
+ }
65
+ return rows;
66
+ }
67
+
68
+ function fileSize(target) {
69
+ try { return fs.statSync(target).size; } catch { return 0; }
70
+ }
71
+
72
+ /**
73
+ * Live rows, widening the tail window until its first row is strictly before
74
+ * `boundaryAt` (or the whole file is read). `boundaryAt === null` → whole file.
75
+ * @returns {{ rows: object[], whole: boolean }}
76
+ */
77
+ function loadLive(target, boundaryAt, initialWindow) {
78
+ let win = Math.max(1, initialWindow);
79
+ for (;;) {
80
+ const size = fileSize(target);
81
+ const whole = boundaryAt === null || win >= size;
82
+ const rows = parseRows(readTail(whole ? Math.max(size, 1) : win, target));
83
+ if (whole) return { rows, whole: true };
84
+ if (rows.length && rows[0].at < boundaryAt) return { rows, whole: false };
85
+ win *= 2;
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Newest rotated archive's rows (in memory). rows = [] when none / unreadable;
91
+ * skipped = true when its compressed size is over `maxGzBytes` (never read).
92
+ * @returns {{ rows: object[], skipped: boolean }}
93
+ */
94
+ function loadArchive(target, maxGzBytes) {
95
+ const dir = path.dirname(target);
96
+ const base = path.basename(target, path.extname(target));
97
+ const re = new RegExp(`^${base.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}-\\d{4}-\\d{2}\\.jsonl\\.gz$`);
98
+ let names;
99
+ const none = { rows: [], skipped: false };
100
+ try { names = fs.readdirSync(dir).filter((f) => re.test(f)).sort(); } catch { return none; }
101
+ if (!names.length) return none;
102
+ const file = path.join(dir, names[names.length - 1]);
103
+ try {
104
+ if (fs.statSync(file).size > maxGzBytes) return { rows: [], skipped: true };
105
+ return { rows: parseRows(zlib.gunzipSync(fs.readFileSync(file)).toString('utf8').split('\n').filter(Boolean)), skipped: false };
106
+ } catch { return none; }
107
+ }
108
+
109
+ /** Annotate each row with its 1-based occurrence among rows sharing its `at`. */
110
+ function withOrdinals(rows) {
111
+ const out = [];
112
+ let prevAt = null;
113
+ let k = 0;
114
+ for (const r of rows) {
115
+ k = r.at === prevAt ? k + 1 : 1;
116
+ prevAt = r.at;
117
+ out.push({ row: r, ord: k });
118
+ }
119
+ return out;
120
+ }
121
+
122
+ const cursorOf = (at, n) => `${at}~${n}`;
123
+
124
+ /**
125
+ * @param {{ after?: string, kinds?: string[], limit?: number, target?: string, initialWindow?: number, maxArchiveGzBytes?: number }} [opts]
126
+ * @returns {{ events: object[], next: string, more: boolean, gap: boolean }}
127
+ */
128
+ function readEventsAfter({ after, kinds, limit, target, initialWindow, maxArchiveGzBytes } = {}) {
129
+ const file = target ?? auditLogPath();
130
+ const maxGz = Number.isFinite(maxArchiveGzBytes) && maxArchiveGzBytes >= 0 ? maxArchiveGzBytes : MAX_ARCHIVE_GZ_BYTES;
131
+ const win = Number.isFinite(initialWindow) && initialWindow > 0 ? initialWindow : INITIAL_WINDOW;
132
+ const kindSet = new Set(Array.isArray(kinds) && kinds.length ? kinds : DEFAULT_KINDS);
133
+ const lim = Number.isInteger(limit) && limit > 0 ? Math.min(limit, MAX_LIMIT) : DEFAULT_LIMIT;
134
+
135
+ if (after === undefined || after === null) {
136
+ const probe = parseRows(readTail(Math.min(win, 64 * 1024), file));
137
+ if (!probe.length && fileSize(file) === 0) return { events: [], next: START, more: false, gap: false };
138
+ const lastAt = probe.length ? probe[probe.length - 1].at : null;
139
+ const { rows } = loadLive(file, lastAt, win);
140
+ if (!rows.length) return { events: [], next: START, more: false, gap: false };
141
+ const ords = withOrdinals(rows);
142
+ const last = ords[ords.length - 1];
143
+ return { events: [], next: cursorOf(last.row.at, last.ord), more: false, gap: false };
144
+ }
145
+
146
+ const cur = parseCursor(after);
147
+ let gap = false;
148
+ let rows;
149
+ if (cur.start) {
150
+ rows = loadLive(file, null, win).rows;
151
+ } else {
152
+ const live = loadLive(file, cur.at, win);
153
+ rows = live.rows;
154
+ if (live.whole && (!rows.length || cur.at <= rows[0].at)) {
155
+ const archive = loadArchive(file, maxGz);
156
+ rows = archive.rows.concat(rows);
157
+ gap = archive.skipped || (rows.length > 0 && cur.at < rows[0].at);
158
+ }
159
+ }
160
+
161
+ const events = [];
162
+ let more = false;
163
+ let next = cur.start ? START : cursorOf(cur.at, cur.n);
164
+ for (const { row, ord } of withOrdinals(rows)) {
165
+ if (!cur.start && (row.at < cur.at || (row.at === cur.at && ord <= cur.n))) continue;
166
+ if (kindSet.has(row.kind)) {
167
+ if (events.length >= lim) { more = true; break; }
168
+ const { caller: _caller, ...rest } = row;
169
+ events.push(rest);
170
+ }
171
+ next = cursorOf(row.at, ord);
172
+ }
173
+ return { events, next, more, gap };
174
+ }
175
+
176
+ module.exports = { OUTSIDE_EVENT_KINDS, readEventsAfter, CURSOR_FORM, INVALID_AUDIT_CURSOR, MAX_ARCHIVE_GZ_BYTES };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * eventsAdminRoutes.cjs — read-only admin HTTP route over auditEvents.cjs's
3
+ * cursor reader, so an outside script can ask for the events after its saved
4
+ * cursor instead of polling every Epic.
5
+ *
6
+ * GET /admin/events?after=<cursor|start>&kinds=<k1,k2>&limit=<1..500>
7
+ * → 200 { ok: true, events, next, more, gap }
8
+ * → 400 { ok: false, error: 'invalid query', details } for an unknown kind,
9
+ * an out-of-range limit, or a cursor readEventsAfter rejects.
10
+ *
11
+ * Writes no file and no audit row. Auth/loopback binding are the injected
12
+ * localAdminHttp.cjs transport's job (see index.cjs).
13
+ */
14
+ 'use strict';
15
+
16
+ const { schemas } = require('../../ipcSchemas.cjs');
17
+ const { sendJson } = require('../feedback-remote/localAdminHttp.cjs');
18
+ const { readEventsAfter, INVALID_AUDIT_CURSOR } = require('./auditEvents.cjs');
19
+
20
+ /** @param {{ registerRoute: Function }} adminHttp */
21
+ function registerAdminRoute(adminHttp) {
22
+ adminHttp.registerRoute('GET', '/admin/events', async (req, res, query) => {
23
+ let input;
24
+ try {
25
+ input = schemas.adminListEventsQuery.parse(Object.fromEntries(query ?? []));
26
+ } catch (e) {
27
+ sendJson(res, 400, { ok: false, error: 'invalid query', details: e?.issues ?? e?.message });
28
+ return;
29
+ }
30
+ let result;
31
+ try {
32
+ result = readEventsAfter({ after: input.after, kinds: input.kinds, limit: input.limit });
33
+ } catch (e) {
34
+ if (e instanceof Error && /** @type {Error & { code?: unknown }} */ (e).code === INVALID_AUDIT_CURSOR) {
35
+ sendJson(res, 400, { ok: false, error: 'invalid query', details: e.message });
36
+ return;
37
+ }
38
+ throw e;
39
+ }
40
+ const { events, next, more, gap } = result;
41
+ sendJson(res, 200, { ok: true, events, next, more, gap });
42
+ });
43
+ }
44
+
45
+ module.exports = { registerAdminRoute };