claude-code-session-manager 0.141.0 → 0.142.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 (200) hide show
  1. package/README.md +80 -70
  2. package/bin/cli.cjs +11 -0
  3. package/dist/assets/AppSettings-BcZgIvvY.js +2 -0
  4. package/dist/assets/{History-DJMiuXyK.js → History-DpZuJXi1.js} +1 -1
  5. package/dist/assets/HomeClaudeConfig-D32ZJtU-.js +3 -0
  6. package/dist/assets/{Panel-Bf1Cf8UL.js → Panel-BjdJjhqt.js} +1 -1
  7. package/dist/assets/{ProjectClaudeConfig-BWPpypf9.js → ProjectClaudeConfig-BTClYV6i.js} +7 -7
  8. package/dist/assets/Scheduler-DPobKx1Z.js +16 -0
  9. package/dist/assets/{SkillReferenceGraph-Ba4TkX2C.js → SkillReferenceGraph-Cqyu4mef.js} +1 -1
  10. package/dist/assets/{Skills-C1v91GEO.js → Skills-vv0noNVI.js} +5 -5
  11. package/dist/assets/{TiptapBody-BrcWVpiW.js → TiptapBody-CXi8Pvut.js} +1 -1
  12. package/dist/assets/Toggle-CiYCWLjh.js +1 -0
  13. package/dist/assets/{VoiceButton-qivnDV6K.js → VoiceButton-4NKKd1sC.js} +1 -1
  14. package/dist/assets/{historyTotals-CMCPTKqC.js → historyTotals-DDunb8Ch.js} +1 -1
  15. package/dist/assets/index-Cn5E9958.js +3133 -0
  16. package/dist/assets/{index-DKXdXfka.css → index-DVHIHoJf.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/dist-web/app.css +1 -1
  19. package/dist-web/app.js +496 -484
  20. package/package.json +4 -2
  21. package/plugins/AGENTS.md +4 -3
  22. package/plugins/session-manager-dev/hooks/hooks.json +15 -0
  23. package/plugins/session-manager-dev/hooks/residue-check.cjs +241 -0
  24. package/plugins/session-manager-dev/skills/develop/SKILL.md +52 -18
  25. package/plugins/session-manager-dev/skills/develop/standards.md +3 -2
  26. package/scripts/README.md +1 -0
  27. package/scripts/hooks/guard-tool-risk.cjs +5 -1
  28. package/scripts/hooks/lib/guard-tool-risk-policy.cjs +158 -1
  29. package/scripts/scheduler-mcp-server.cjs +732 -110
  30. package/src/main/adminRouteRegistry.cjs +59 -0
  31. package/src/main/agentLibrary.cjs +72 -4
  32. package/src/main/agentsIpc.cjs +3 -2
  33. package/src/main/build-info.json +4 -4
  34. package/src/main/chatRunner.cjs +231 -16
  35. package/src/main/config.cjs +30 -0
  36. package/src/main/docEdit.cjs +4 -2
  37. package/src/main/health.cjs +91 -0
  38. package/src/main/index.cjs +98 -48
  39. package/src/main/ipcSchemas.cjs +161 -8
  40. package/src/main/lib/AGENTS.md +1 -1
  41. package/src/main/lib/chatBootRecovery.cjs +2 -0
  42. package/src/main/lib/claude/agentModelResolve.cjs +51 -25
  43. package/src/main/lib/claude/agentSnapshot.cjs +186 -0
  44. package/src/main/lib/claude/environmentProfiles.cjs +242 -0
  45. package/src/main/lib/claude/jobSandboxPolicy.cjs +241 -33
  46. package/src/main/lib/claude/personaToolScope.cjs +82 -31
  47. package/src/main/lib/claude/runClaudeP.cjs +4 -2
  48. package/src/main/lib/claude/toolRiskMarks.cjs +41 -1
  49. package/src/main/lib/claude/usageCircuit.cjs +49 -21
  50. package/src/main/lib/claude/vaultRefs.cjs +277 -0
  51. package/src/main/lib/demo-video-kit/capture.cjs +282 -12
  52. package/src/main/lib/demo-video-kit/cast.md +43 -0
  53. package/src/main/lib/demo-video-kit/character.cjs +722 -30
  54. package/src/main/lib/demo-video-kit/checks.cjs +120 -1
  55. package/src/main/lib/demo-video-kit/export.cjs +218 -0
  56. package/src/main/lib/demo-video-kit/frames.cjs +104 -9
  57. package/src/main/lib/demo-video-kit/kind-marketing.md +121 -0
  58. package/src/main/lib/demo-video-kit/kind-tiktok.md +99 -0
  59. package/src/main/lib/demo-video-kit/kokoroSay.cjs +205 -0
  60. package/src/main/lib/demo-video-kit/project-home-html.md +43 -0
  61. package/src/main/lib/demo-video-kit/resumableRun.cjs +298 -0
  62. package/src/main/lib/demo-video-kit/seedKit.cjs +3 -3
  63. package/src/main/lib/demo-video-kit/voiceLane.cjs +233 -0
  64. package/src/main/lib/demo-video-kit/voiceLibrary.cjs +312 -0
  65. package/src/main/lib/epic/artifactAdminRoutes.cjs +211 -0
  66. package/src/main/lib/epic/artifactIpc.cjs +153 -0
  67. package/src/main/lib/epic/artifactNotice.cjs +72 -0
  68. package/src/main/lib/epic/artifactRetention.cjs +310 -0
  69. package/src/main/lib/epic/artifactStore.cjs +392 -0
  70. package/src/main/lib/epic/delegationReadiness.cjs +76 -2
  71. package/src/main/lib/epic/epicAgentRefresh.cjs +97 -0
  72. package/src/main/lib/epic/epicEventLog.cjs +214 -0
  73. package/src/main/lib/epic/epicMint.cjs +43 -1
  74. package/src/main/lib/epic/epicOutsideRead.cjs +1 -0
  75. package/src/main/lib/epic/epicOutsideState.cjs +18 -4
  76. package/src/main/lib/epic/epicPurge.cjs +347 -0
  77. package/src/main/lib/epic/epicReopen.cjs +5 -2
  78. package/src/main/lib/epic/epicSettle.cjs +4 -13
  79. package/src/main/lib/epic/epicSpawnPlan.cjs +57 -4
  80. package/src/main/lib/epic/epicStatusMirror.cjs +34 -1
  81. package/src/main/lib/epic/epicTransitions.cjs +139 -0
  82. package/src/main/lib/epic/epicValidationHook.cjs +81 -2
  83. package/src/main/lib/epic/guardSpawnSettings.cjs +3 -2
  84. package/src/main/lib/externalContract.cjs +37 -4
  85. package/src/main/lib/feedback-remote/crossProjectReply.cjs +389 -126
  86. package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -3
  87. package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +11 -6
  88. package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +26 -1
  89. package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +5 -2
  90. package/src/main/lib/feedback-remote/feedbackBoxDrain.cjs +409 -0
  91. package/src/main/lib/feedback-remote/feedbackBoxKeys.cjs +218 -0
  92. package/src/main/lib/feedback-remote/feedbackEnvelope.cjs +163 -0
  93. package/src/main/lib/feedback-remote/feedbackRelayClient.cjs +164 -0
  94. package/src/main/lib/feedback-remote/feedbackReport.cjs +234 -0
  95. package/src/main/lib/feedback-remote/feedbackSeal.cjs +217 -0
  96. package/src/main/lib/feedback-remote/localAdminHttp.cjs +108 -2
  97. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +2 -1
  98. package/src/main/lib/feedback-remote/needsYouIpc.cjs +17 -0
  99. package/src/main/lib/feedback-remote/needsYouStore.cjs +177 -6
  100. package/src/main/lib/feedback-remote/pendingReplies.cjs +189 -0
  101. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +188 -10
  102. package/src/main/lib/feedback-remote/serviceClient.cjs +429 -0
  103. package/src/main/lib/feedback-remote/serviceMcpSession.cjs +252 -0
  104. package/src/main/lib/feedback-remote/serviceMcpTools.cjs +284 -0
  105. package/src/main/lib/feedback-remote/servicePairings.cjs +313 -0
  106. package/src/main/lib/feedback-remote/serviceStdioBridge.cjs +290 -0
  107. package/src/main/lib/feedback-remote/siteFeedbackAdminRoutes.cjs +295 -0
  108. package/src/main/lib/feedback-remote/siteFeedbackInbox.cjs +598 -0
  109. package/src/main/lib/feedback-remote/siteFeedbackIpc.cjs +86 -0
  110. package/src/main/lib/feedback-remote/siteFeedbackService.cjs +477 -0
  111. package/src/main/lib/git/worktreeDeps.cjs +77 -2
  112. package/src/main/lib/mcpToolCatalog.cjs +304 -28
  113. package/src/main/lib/opsOwnership.cjs +29 -1
  114. package/src/main/lib/opsRetentionSettings.cjs +27 -5
  115. package/src/main/lib/persona-macro/builtinMacros.cjs +7 -2
  116. package/src/main/lib/persona-macro/macroJobDispatch.cjs +52 -8
  117. package/src/main/lib/persona-macro/macroJobIpc.cjs +16 -6
  118. package/src/main/lib/persona-macro/macroLibrary.cjs +49 -7
  119. package/src/main/lib/persona-macro/personaFrontmatterSchema.cjs +83 -0
  120. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +3 -0
  121. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +263 -0
  122. package/src/main/lib/phaseProjection.cjs +103 -0
  123. package/src/main/lib/prd/depSlugResolve.cjs +4 -13
  124. package/src/main/lib/prd/prdBodyPatch.cjs +12 -17
  125. package/src/main/lib/prd/prdCreate.cjs +41 -5
  126. package/src/main/lib/prd/prdCriteria.cjs +225 -0
  127. package/src/main/lib/prd/prdFrontmatter.cjs +43 -3
  128. package/src/main/lib/prd/prdGateFiles.cjs +125 -49
  129. package/src/main/lib/prd/prdSizing.cjs +3 -1
  130. package/src/main/lib/process/cleanEnv.cjs +52 -1
  131. package/src/main/lib/process/leftoverRenice.cjs +178 -0
  132. package/src/main/lib/process/memoryScope.cjs +31 -3
  133. package/src/main/lib/project-pages/pagesLibrary.cjs +72 -6
  134. package/src/main/lib/project-pages/videoReviewIpc.cjs +3 -2
  135. package/src/main/lib/project-pages/voiceAdminRoutes.cjs +175 -0
  136. package/src/main/lib/project-pages/voicePreview.cjs +196 -0
  137. package/src/main/lib/project-pages/voicesIpc.cjs +186 -0
  138. package/src/main/lib/promptSessionSchema.cjs +6 -0
  139. package/src/main/lib/scheduler/cancelledRow.cjs +57 -0
  140. package/src/main/lib/scheduler/cpuSample.cjs +133 -42
  141. package/src/main/lib/scheduler/criteriaChecks.cjs +169 -0
  142. package/src/main/lib/scheduler/definitionOfDone.cjs +44 -5
  143. package/src/main/lib/scheduler/jobMemoryStats.cjs +313 -0
  144. package/src/main/lib/scheduler/loadGate.cjs +82 -4
  145. package/src/main/lib/scheduler/planRecordHarvest.cjs +32 -2
  146. package/src/main/lib/scheduler/prdOutcomeRecord.cjs +133 -0
  147. package/src/main/lib/scheduler/runLogRetention.cjs +42 -1
  148. package/src/main/lib/scheduler/scheduleJobSchema.cjs +5 -0
  149. package/src/main/lib/scheduler/scheduleJobTransitions.cjs +47 -0
  150. package/src/main/lib/scheduler/schedulerConfig.cjs +47 -0
  151. package/src/main/lib/scheduler/schedulerPaths.cjs +0 -3
  152. package/src/main/lib/scheduler/schedulerRuntimeState.cjs +50 -1
  153. package/src/main/lib/scheduler/sessionSlots.cjs +5 -1
  154. package/src/main/lib/scheduler/slotsRoute.cjs +237 -0
  155. package/src/main/lib/scheduler/toolClearance.cjs +258 -0
  156. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +140 -10
  157. package/src/main/lib/tasks/memoryConsolidation.cjs +300 -0
  158. package/src/main/lib/tasks/mitigationReview.cjs +294 -0
  159. package/src/main/lib/tasks/taskAdminRoutes.cjs +312 -22
  160. package/src/main/lib/tasks/taskIpc.cjs +22 -18
  161. package/src/main/lib/tasks/taskLedger.cjs +147 -25
  162. package/src/main/lib/tasks/taskRun.cjs +186 -17
  163. package/src/main/lib/tasks/taskSwitch.cjs +85 -12
  164. package/src/main/lib/tasks/taskSwitchRoute.cjs +172 -0
  165. package/src/main/lib/telemetry/auditEvents.cjs +207 -6
  166. package/src/main/lib/telemetry/eventsAdminRoutes.cjs +198 -6
  167. package/src/main/lib/telemetry/webhookDelivery.cjs +205 -0
  168. package/src/main/lib/telemetry/webhookRegistry.cjs +281 -0
  169. package/src/main/lib/toolUseClassify.cjs +181 -0
  170. package/src/main/lib/util/smfileRange.cjs +77 -0
  171. package/src/main/projectPages.cjs +3 -1
  172. package/src/main/promptSessionEvents.cjs +5 -0
  173. package/src/main/pty.cjs +68 -0
  174. package/src/main/queueOps.cjs +32 -13
  175. package/src/main/runVerify.cjs +74 -9
  176. package/src/main/scheduler/AGENTS.md +1 -0
  177. package/src/main/scheduler/budget.cjs +6 -5
  178. package/src/main/scheduler/prdParser.cjs +46 -13
  179. package/src/main/scheduler/reviewLadder.cjs +9 -25
  180. package/src/main/scheduler/utilizationHold.cjs +101 -0
  181. package/src/main/scheduler.cjs +1414 -189
  182. package/src/main/templates/PRD_AUTHORING.md +5 -2
  183. package/src/main/webRemote.cjs +463 -6
  184. package/src/preload/api.d.ts +529 -38
  185. package/src/preload/apiSurface.json +209 -7
  186. package/src/preload/index.cjs +46 -1
  187. package/src/seed/agents/architect.md +6 -1
  188. package/src/seed/agents/blender-artist.md +2 -1
  189. package/src/seed/agents/competitive-analyst.md +3 -1
  190. package/src/seed/agents/competitive-researcher.md +2 -1
  191. package/src/seed/agents/demo-video-builder.md +87 -83
  192. package/src/seed/agents/dev-lead.md +3 -3
  193. package/src/seed/agents/project-home-builder.md +9 -31
  194. package/src/seed/agents/validator.md +9 -10
  195. package/dist/assets/AppSettings-DExeJhqQ.js +0 -2
  196. package/dist/assets/HomeClaudeConfig-CTp2tkZ4.js +0 -3
  197. package/dist/assets/Scheduler-cyr61UAC.js +0 -16
  198. package/dist/assets/ViewTabs-DXhOWFG0.js +0 -1
  199. package/dist/assets/index-B2TQz3nd.js +0 -3121
  200. package/src/main/lib/epic/epicStateWatcher.cjs +0 -157
@@ -0,0 +1,392 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * artifactStore.cjs — the per-project Artifacts store. THE ONLY WRITER of a
5
+ * project's `session-manager-operations/artifacts/` namespace (writer id
6
+ * 'artifacts' in lib/opsOwnership.cjs; runtime, self-ignored).
7
+ *
8
+ * Files an agent makes for human review (videos, images, docs, data) are
9
+ * copied out of the job/Epic worktree into the MAIN project's ops root so they
10
+ * survive worktree teardown and show in the File Explorer without a merge.
11
+ *
12
+ * Layout:
13
+ * artifacts/<epic-id>/<name> Epic-owned artifacts
14
+ * artifacts/<epic-id>/index.json that owner's ledger
15
+ * artifacts/_tasks/<task-id>/<name> Task-owned artifacts (+ index.json)
16
+ * Ledger: { version: 1, entries: [{ name, title, kind, size, sha256, createdAt,
17
+ * producer: { epicId, prdSlug, sessionId, taskId } }] }.
18
+ *
19
+ * Never overwrites: a name collision gets a -2, -3, ... suffix. All writes for
20
+ * one owner folder (name pick, copy, ledger read-modify-write) are serialized
21
+ * by an in-process promise lock. publishArtifact/ingestDir never throw — every
22
+ * refusal is a returned { ok:false, error } / skipped reason.
23
+ *
24
+ * Retention: artifactsDays after the owning Epic completes (pruning lives in a
25
+ * sibling module).
26
+ */
27
+
28
+ const fs = require('node:fs');
29
+ const path = require('node:path');
30
+ const crypto = require('node:crypto');
31
+ const { opsPath, checkOpsWrite, assertOpsWrite } = require('../opsOwnership.cjs');
32
+ const { writeJsonAtomic, readJsonOrSync } = require('../util/atomicFs.cjs');
33
+
34
+ const NAMESPACE = 'artifacts';
35
+ const WRITER = 'artifacts';
36
+ const TASKS_DIR = '_tasks';
37
+ const LEDGER = 'index.json';
38
+ const MAX_BYTES = 2 * 1024 * 1024 * 1024; // 2 GiB
39
+ const MAX_INGEST_FILES = 200;
40
+ const MAX_TITLE_CHARS = 500;
41
+ const EPIC_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
42
+ const TASK_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
43
+ const RUN_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
44
+ const KINDS = Object.freeze(['video', 'audio', 'image', 'doc', 'data', 'other']);
45
+
46
+ const EXT_KIND = Object.freeze({
47
+ video: ['mp4', 'webm', 'mov', 'mkv', 'avi', 'm4v'],
48
+ audio: ['mp3', 'wav', 'ogg', 'flac', 'm4a', 'aac', 'opus'],
49
+ image: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'bmp', 'avif', 'ico'],
50
+ doc: ['md', 'txt', 'pdf', 'html', 'htm', 'docx', 'doc', 'rtf', 'pptx', 'odt'],
51
+ data: ['json', 'jsonl', 'csv', 'tsv', 'xml', 'yaml', 'yml', 'xlsx', 'sqlite', 'db', 'parquet'],
52
+ });
53
+ /** @type {Map<string, string>} */
54
+ const KIND_BY_EXT = new Map();
55
+ for (const [kind, exts] of Object.entries(EXT_KIND)) for (const e of exts) KIND_BY_EXT.set(e, kind);
56
+
57
+ /** owner folder abs path → tail of its lock chain. */
58
+ const locks = new Map();
59
+
60
+ function errMsg(e) {
61
+ return e && e.message ? e.message : String(e);
62
+ }
63
+
64
+ function inferKind(name) {
65
+ const ext = path.extname(name).slice(1).toLowerCase();
66
+ return KIND_BY_EXT.get(ext) || 'other';
67
+ }
68
+
69
+ /** Safe file name from a source basename: no separators, no leading dot, bounded. */
70
+ function safeName(base) {
71
+ let n = String(base).replace(/[^A-Za-z0-9._ -]/g, '_').replace(/^[.\s]+/, '').trim();
72
+ if (n.length > 200) {
73
+ const ext = path.extname(n).slice(0, 20);
74
+ n = n.slice(0, 200 - ext.length) + ext;
75
+ }
76
+ return n || 'artifact';
77
+ }
78
+
79
+ /** First free name in `dir`: name, name-2.ext, name-3.ext, ... (index.json is reserved). */
80
+ function freeName(dir, name, fsImpl) {
81
+ const ext = path.extname(name);
82
+ const stem = ext ? name.slice(0, -ext.length) : name;
83
+ for (let i = 1; i < 100000; i += 1) {
84
+ const candidate = i === 1 ? name : `${stem}-${i}${ext}`;
85
+ if (candidate === LEDGER) continue;
86
+ if (!fsImpl.existsSync(path.join(dir, candidate))) return candidate;
87
+ }
88
+ throw new Error('no free artifact name');
89
+ }
90
+
91
+ function isUnder(child, root) {
92
+ const rel = path.relative(root, child);
93
+ return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));
94
+ }
95
+
96
+ function sha256File(file, fsImpl) {
97
+ return new Promise((resolve, reject) => {
98
+ const hash = crypto.createHash('sha256');
99
+ const stream = (fsImpl.createReadStream || fs.createReadStream)(file);
100
+ stream.on('error', reject);
101
+ stream.on('data', (chunk) => hash.update(chunk));
102
+ stream.on('end', () => resolve(hash.digest('hex')));
103
+ });
104
+ }
105
+
106
+ /** Run `fn` after every earlier holder of `key`'s lock. */
107
+ function withLock(key, fn) {
108
+ const prev = locks.get(key) || Promise.resolve();
109
+ const next = prev.catch(() => {}).then(fn);
110
+ locks.set(key, next);
111
+ const cleanup = () => { if (locks.get(key) === next) locks.delete(key); };
112
+ next.then(cleanup, cleanup);
113
+ return next;
114
+ }
115
+
116
+ /** Owner id + folder segments, or an error string. */
117
+ function ownerOf(epicId, taskId) {
118
+ const hasEpic = epicId !== undefined && epicId !== null && epicId !== '';
119
+ const hasTask = taskId !== undefined && taskId !== null && taskId !== '';
120
+ if (hasEpic === hasTask) return { error: 'exactly one of epicId or taskId is required' };
121
+ if (hasEpic) {
122
+ if (typeof epicId !== 'string' || !EPIC_ID_RE.test(epicId)) return { error: 'unsafe epicId' };
123
+ return { ownerId: epicId, segs: [epicId] };
124
+ }
125
+ if (typeof taskId !== 'string' || !TASK_ID_RE.test(taskId)) return { error: 'unsafe taskId' };
126
+ return { ownerId: `${TASKS_DIR}/${taskId}`, segs: [TASKS_DIR, taskId] };
127
+ }
128
+
129
+ /**
130
+ * Read a ledger's entries; missing, empty, corrupt or entries-not-an-array → [].
131
+ * Reads through readJsonOrSync (real fs), so it takes no fsImpl.
132
+ */
133
+ function readLedger(file) {
134
+ const parsed = readJsonOrSync(file, null);
135
+ const entries = Array.isArray(parsed) ? parsed : parsed && Array.isArray(parsed.entries) ? parsed.entries : null;
136
+ if (!entries) return [];
137
+ return entries.filter((e) => e && typeof e === 'object' && typeof e.name === 'string');
138
+ }
139
+
140
+ function cleanProducer(producer, epicId, taskId) {
141
+ const p = producer && typeof producer === 'object' ? producer : {};
142
+ const str = (v) => (typeof v === 'string' && v ? v.slice(0, 200) : null);
143
+ return {
144
+ epicId: str(p.epicId) || str(epicId),
145
+ prdSlug: str(p.prdSlug),
146
+ sessionId: str(p.sessionId),
147
+ taskId: str(p.taskId) || str(taskId),
148
+ };
149
+ }
150
+
151
+ /**
152
+ * publishArtifact({ projectRoot, epicId, taskId, srcPath, title, kind, producer,
153
+ * allowedRoots, fsImpl, appendEvent })
154
+ * → Promise<{ ok: true, storedPath, entry } | { ok: false, error }>
155
+ * Never rejects.
156
+ */
157
+ async function publishArtifact({
158
+ projectRoot, epicId, taskId, srcPath, title, kind, producer, allowedRoots,
159
+ fsImpl = fs, appendEvent = null,
160
+ } = {}) {
161
+ try {
162
+ const owner = ownerOf(epicId, taskId);
163
+ if (owner.error) return { ok: false, error: owner.error };
164
+ if (typeof projectRoot !== 'string' || !path.isAbsolute(projectRoot)) {
165
+ return { ok: false, error: 'projectRoot must be an absolute path' };
166
+ }
167
+ if (typeof srcPath !== 'string' || !path.isAbsolute(srcPath)) {
168
+ return { ok: false, error: 'srcPath must be an absolute path' };
169
+ }
170
+ if (kind !== undefined && kind !== null && !KINDS.includes(kind)) {
171
+ return { ok: false, error: `kind must be one of ${KINDS.join(', ')}` };
172
+ }
173
+
174
+ let st;
175
+ try { st = fsImpl.lstatSync(srcPath); } catch (e) { return { ok: false, error: `source unreadable: ${errMsg(e)}` }; }
176
+ if (st.isSymbolicLink()) return { ok: false, error: 'source is a symlink' };
177
+ if (!st.isFile()) return { ok: false, error: 'source is not a regular file' };
178
+ if (st.size > MAX_BYTES) return { ok: false, error: `oversize (${st.size} > ${MAX_BYTES} bytes)` };
179
+
180
+ let realSrc;
181
+ try { realSrc = fsImpl.realpathSync(srcPath); } catch (e) { return { ok: false, error: `source unresolvable: ${errMsg(e)}` }; }
182
+ const roots = (Array.isArray(allowedRoots) && allowedRoots.length ? allowedRoots : [projectRoot])
183
+ .filter((r) => typeof r === 'string' && path.isAbsolute(r))
184
+ .map((r) => { try { return fsImpl.realpathSync(r); } catch { return null; } })
185
+ .filter(Boolean);
186
+ if (!roots.some((r) => isUnder(realSrc, /** @type {string} */ (r)))) {
187
+ return { ok: false, error: 'source is outside every allowed root' };
188
+ }
189
+
190
+ let destDir;
191
+ let nsDir;
192
+ try {
193
+ destDir = path.resolve(opsPath(projectRoot, NAMESPACE, ...owner.segs));
194
+ nsDir = path.resolve(opsPath(projectRoot, NAMESPACE));
195
+ } catch (e) {
196
+ return { ok: false, error: `destination refused: ${errMsg(e)}` };
197
+ }
198
+ if (isUnder(realSrc, destDir)) return { ok: false, error: 'source is already inside the artifacts store' };
199
+ const resolvedRoot = path.dirname(path.dirname(nsDir));
200
+ const ledgerFile = path.join(destDir, LEDGER);
201
+
202
+ return await withLock(destDir, async () => {
203
+ fsImpl.mkdirSync(destDir, { recursive: true });
204
+ const name = freeName(destDir, safeName(path.basename(srcPath)), fsImpl);
205
+ const dest = path.join(destDir, name);
206
+ const verdict = checkOpsWrite(dest, WRITER);
207
+ if (!verdict.ok) return { ok: false, error: `write refused: ${verdict.error}` };
208
+ assertOpsWrite(dest, WRITER);
209
+ assertOpsWrite(ledgerFile, WRITER);
210
+
211
+ const tmp = `${dest}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
212
+ let sha256;
213
+ let size;
214
+ try {
215
+ fsImpl.copyFileSync(realSrc, tmp, fs.constants.COPYFILE_FICLONE);
216
+ size = fsImpl.statSync(tmp).size;
217
+ if (size > MAX_BYTES) throw new Error(`oversize after copy (${size} > ${MAX_BYTES} bytes)`);
218
+ sha256 = await sha256File(tmp, fsImpl);
219
+ if (fsImpl.existsSync(dest)) throw new Error('destination appeared during copy');
220
+ fsImpl.renameSync(tmp, dest);
221
+ } catch (e) {
222
+ try { fsImpl.unlinkSync(tmp); } catch { /* never created or already gone */ }
223
+ return { ok: false, error: `copy failed: ${errMsg(e)}` };
224
+ }
225
+
226
+ const entry = {
227
+ name,
228
+ title: (typeof title === 'string' && title.trim() ? title.trim() : name).slice(0, MAX_TITLE_CHARS),
229
+ kind: kind || inferKind(name),
230
+ size,
231
+ sha256,
232
+ createdAt: new Date().toISOString(),
233
+ producer: cleanProducer(producer, epicId, taskId),
234
+ };
235
+ try {
236
+ const entries = readLedger(ledgerFile);
237
+ entries.push(entry);
238
+ await writeJsonAtomic(ledgerFile, { version: 1, entries });
239
+ } catch (e) {
240
+ try { fsImpl.unlinkSync(dest); } catch { /* best effort: keep store and ledger in step */ }
241
+ return { ok: false, error: `ledger write failed: ${errMsg(e)}` };
242
+ }
243
+
244
+ if (owner.segs[0] !== TASKS_DIR) {
245
+ try {
246
+ const append = appendEvent || require('./epicEventLog.cjs').appendEpicEvent;
247
+ await append(projectRoot, epicId, {
248
+ kind: 'artifact.published',
249
+ name: entry.name,
250
+ title: entry.title,
251
+ artifactKind: entry.kind,
252
+ size: entry.size,
253
+ path: path.relative(resolvedRoot, dest).split(path.sep).join('/'),
254
+ });
255
+ } catch (e) {
256
+ console.error('[artifactStore] artifact.published event append failed', epicId, name, errMsg(e));
257
+ }
258
+ }
259
+ return { ok: true, storedPath: dest, entry };
260
+ });
261
+ } catch (e) {
262
+ return { ok: false, error: `publish failed: ${errMsg(e)}` };
263
+ }
264
+ }
265
+
266
+ /**
267
+ * ingestDir({ projectRoot, epicId, taskId, srcDir, producer, allowedRoots, minAgeMs, fsImpl, appendEvent })
268
+ * → Promise<{ published: { srcPath, storedPath, entry }[], skipped: { path, reason }[] }>
269
+ * Publishes every regular file directly in srcDir (non-recursive, max 200),
270
+ * deleting each source only after its copy succeeded. Never rejects.
271
+ * minAgeMs (default 0) skips any file modified within the last minAgeMs as
272
+ * 'still being written', so a periodic sweep never moves a half-written file.
273
+ */
274
+ async function ingestDir({
275
+ projectRoot, epicId, taskId, srcDir, producer, allowedRoots, minAgeMs = 0, fsImpl = fs, appendEvent = null,
276
+ } = {}) {
277
+ /** @type {{ srcPath: string, storedPath: string, entry: object }[]} */
278
+ const published = [];
279
+ /** @type {{ path: string, reason: string }[]} */
280
+ const skipped = [];
281
+ try {
282
+ if (typeof srcDir !== 'string' || !path.isAbsolute(srcDir)) {
283
+ skipped.push({ path: String(srcDir), reason: 'srcDir must be an absolute path' });
284
+ return { published, skipped };
285
+ }
286
+ let names;
287
+ try {
288
+ const st = fsImpl.lstatSync(srcDir);
289
+ if (!st.isDirectory()) {
290
+ skipped.push({ path: srcDir, reason: 'srcDir is not a directory' });
291
+ return { published, skipped };
292
+ }
293
+ names = fsImpl.readdirSync(srcDir).map(String).sort();
294
+ } catch (e) {
295
+ if (e && e.code === 'ENOENT') return { published, skipped };
296
+ skipped.push({ path: srcDir, reason: `cannot list srcDir: ${errMsg(e)}` });
297
+ return { published, skipped };
298
+ }
299
+ const roots = Array.isArray(allowedRoots) && allowedRoots.length ? allowedRoots : [srcDir];
300
+ const minAge = Number.isFinite(minAgeMs) && minAgeMs > 0 ? minAgeMs : 0;
301
+ const cutoff = Date.now() - minAge;
302
+ let count = 0;
303
+ for (const name of names) {
304
+ const src = path.join(srcDir, name);
305
+ try {
306
+ const st = fsImpl.lstatSync(src);
307
+ if (st.isSymbolicLink()) { skipped.push({ path: src, reason: 'symlink' }); continue; }
308
+ if (st.isDirectory()) { skipped.push({ path: src, reason: 'directory' }); continue; }
309
+ if (!st.isFile()) { skipped.push({ path: src, reason: 'not a regular file' }); continue; }
310
+ if (minAge > 0 && st.mtimeMs > cutoff) { skipped.push({ path: src, reason: 'still being written' }); continue; }
311
+ if (count >= MAX_INGEST_FILES) { skipped.push({ path: src, reason: `over the ${MAX_INGEST_FILES}-file limit` }); continue; }
312
+ count += 1;
313
+ const res = await publishArtifact({
314
+ projectRoot, epicId, taskId, srcPath: src, producer, allowedRoots: roots, fsImpl, appendEvent,
315
+ });
316
+ if (!res.ok) { skipped.push({ path: src, reason: res.error }); continue; }
317
+ published.push({ srcPath: src, storedPath: res.storedPath, entry: res.entry });
318
+ try { fsImpl.unlinkSync(src); } catch (e) {
319
+ console.error('[artifactStore] could not delete ingested source', src, errMsg(e));
320
+ }
321
+ } catch (e) {
322
+ skipped.push({ path: src, reason: `ingest failed: ${errMsg(e)}` });
323
+ }
324
+ }
325
+ } catch (e) {
326
+ skipped.push({ path: String(srcDir), reason: `ingest failed: ${errMsg(e)}` });
327
+ }
328
+ return { published, skipped };
329
+ }
330
+
331
+ /**
332
+ * listArtifacts(projectRoot, { fsImpl }) → entries newest first, each with
333
+ * `ownerId` (an Epic id, or `_tasks/<task-id>`). A missing or corrupt ledger
334
+ * contributes [] for that owner. Never throws.
335
+ */
336
+ function listArtifacts(projectRoot, { fsImpl = fs } = {}) {
337
+ /** @type {object[]} */
338
+ const out = [];
339
+ let nsDir;
340
+ try { nsDir = opsPath(projectRoot, NAMESPACE); } catch { return out; }
341
+ const dirsIn = (dir) => {
342
+ try {
343
+ return fsImpl.readdirSync(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => String(d.name));
344
+ } catch { return []; }
345
+ };
346
+ /** @type {{ ownerId: string, dir: string }[]} */
347
+ const owners = [];
348
+ for (const name of dirsIn(nsDir)) {
349
+ if (name === TASKS_DIR) {
350
+ for (const t of dirsIn(path.join(nsDir, TASKS_DIR))) {
351
+ if (TASK_ID_RE.test(t)) owners.push({ ownerId: `${TASKS_DIR}/${t}`, dir: path.join(nsDir, TASKS_DIR, t) });
352
+ }
353
+ } else if (EPIC_ID_RE.test(name)) {
354
+ owners.push({ ownerId: name, dir: path.join(nsDir, name) });
355
+ }
356
+ }
357
+ for (const { ownerId, dir } of owners) {
358
+ for (const e of readLedger(path.join(dir, LEDGER))) out.push({ ...e, ownerId });
359
+ }
360
+ const t = (e) => { const v = Date.parse(e.createdAt); return Number.isFinite(v) ? v : 0; };
361
+ out.sort((a, b) => t(b) - t(a));
362
+ return out;
363
+ }
364
+
365
+ /**
366
+ * stagingDirFor({ runId }) → <worktreeBase>/artifact-staging/<runId>, created
367
+ * mode 0700. Throws on an unsafe runId.
368
+ */
369
+ function stagingDirFor({ runId } = {}) {
370
+ if (typeof runId !== 'string' || !RUN_ID_RE.test(runId)) {
371
+ throw new Error(`artifactStore.stagingDirFor: unsafe runId "${runId}"`);
372
+ }
373
+ const { worktreeBase } = require('../scheduler/schedulerPaths.cjs');
374
+ const dir = path.join(worktreeBase(), 'artifact-staging', runId);
375
+ fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
376
+ try { fs.chmodSync(dir, 0o700); } catch { /* best effort */ }
377
+ return dir;
378
+ }
379
+
380
+ module.exports = {
381
+ publishArtifact,
382
+ ingestDir,
383
+ listArtifacts,
384
+ stagingDirFor,
385
+ inferKind,
386
+ MAX_BYTES,
387
+ MAX_INGEST_FILES,
388
+ KINDS,
389
+ EPIC_ID_RE,
390
+ TASK_ID_RE,
391
+ RUN_ID_RE,
392
+ };
@@ -26,6 +26,8 @@ const { shimPath: guardShimPath, resolveShimTarget, ensureGuardShimsOrError } =
26
26
  const { resolveProjectRoot } = require('../opsOwnership.cjs');
27
27
  const { nodeShellCommand } = require('../appRuntime.cjs');
28
28
  const { readJsonOrSync } = require('../util/atomicFs.cjs');
29
+ const { sandboxDependencies, sandboxInstallHint } = require('../claude/jobSandboxPolicy.cjs');
30
+ const { environmentEnforcementStatus } = require('../scheduler/schedulerConfig.cjs');
29
31
 
30
32
  const SCHEDULER_MCP_NAME = 'session-manager-scheduler';
31
33
  const DEV_PLUGIN_ENABLED_KEY = 'session-manager-dev@session-manager';
@@ -445,6 +447,76 @@ function checkAgentPersonas({ cwd, homeDir }) {
445
447
  };
446
448
  }
447
449
 
450
+ /** First executable `name` on PATH, or null. */
451
+ function whichOnPath(name) {
452
+ const dirs = String(process.env.PATH || '').split(path.delimiter).filter(Boolean);
453
+ for (const dir of dirs) {
454
+ const candidate = path.join(dir, name);
455
+ try { fs.accessSync(candidate, fs.constants.X_OK); return candidate; } catch { /* next */ }
456
+ }
457
+ return null;
458
+ }
459
+
460
+ /** A local-timezone calendar date, e.g. "Nov 30, 2026". */
461
+ function formatLocalDate(ms) {
462
+ return new Date(ms).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' });
463
+ }
464
+
465
+ /**
466
+ * Can headless jobs get the OS sandbox their environment requires? A machine
467
+ * runs a report-only week first (schedulerConfig.environmentEnforcementStatus,
468
+ * PRD 3942); from `enforceFrom` a job whose environment needs it (dev-lead,
469
+ * validator) parks 'environment_unavailable: <missing>' when bwrap/socat
470
+ * (linux) or sandbox-exec (macOS) is missing — so during the week the banner
471
+ * names the date enforcement starts and the packages to install, and under
472
+ * 'enforce' it is a failure. `sandboxDeps` / `platform` / `mode` /
473
+ * `enforceFrom` are injectable for tests; with no `mode` both come from the
474
+ * scheduler config.
475
+ * @param {{ sandboxDeps?: { available: boolean, missing?: string[] }|null, platform?: string, mode?: string, enforceFrom?: number|null }} [opts]
476
+ */
477
+ function checkJobSandbox({ sandboxDeps = null, platform = process.platform, mode, enforceFrom = null } = {}) {
478
+ const base = { id: 'job-sandbox', label: 'OS sandbox packages installed for headless jobs' };
479
+ let deps = sandboxDeps;
480
+ if (!deps) {
481
+ try { deps = sandboxDependencies({ platform, which: whichOnPath }); } catch (e) {
482
+ deps = { available: false, missing: [`sandbox dependency probe failed: ${(e && e.message) || e}`] };
483
+ }
484
+ }
485
+ let effectiveMode;
486
+ let from = enforceFrom;
487
+ if (mode === 'report' || mode === 'enforce') {
488
+ effectiveMode = mode;
489
+ } else {
490
+ const status = environmentEnforcementStatus();
491
+ effectiveMode = status.mode;
492
+ from = status.enforceFrom;
493
+ }
494
+ const date = effectiveMode === 'report' && typeof from === 'number' && Number.isFinite(from) ? formatLocalDate(from) : null;
495
+ if (deps.available) {
496
+ const detail = date
497
+ ? `OS sandbox dependencies present — report mode until enforcement starts ${date}`
498
+ : 'OS sandbox dependencies present';
499
+ return { ...base, ok: true, detail, fix: null };
500
+ }
501
+ const missing = Array.isArray(deps.missing) && deps.missing.length ? deps.missing : ['unknown'];
502
+ const hint = sandboxInstallHint({ platform, missing });
503
+ const fix = hint.packages.length
504
+ ? `Install ${hint.packages.join(', ')}${hint.command ? ` (${hint.command})` : ''}${date ? ` before ${date}` : ''}, then restart Session Manager`
505
+ : `Run Session Manager on Linux (bubblewrap + socat) or macOS (sandbox-exec)`;
506
+ if (effectiveMode === 'report') {
507
+ const detail = date
508
+ ? `missing: ${missing.join(', ')} — report mode until ${date}: jobs fall back to tool rules now; from ${date} headless dev-lead and validator jobs will park with environment_unavailable until installed`
509
+ : `missing: ${missing.join(', ')} — report mode: jobs fall back to tool rules`;
510
+ return { ...base, ok: true, warn: true, detail, fix };
511
+ }
512
+ return {
513
+ ...base,
514
+ ok: false,
515
+ detail: `missing: ${missing.join(', ')} — dev-lead and validator jobs park with environment_unavailable until installed`,
516
+ fix,
517
+ };
518
+ }
519
+
448
520
  /**
449
521
  * Pull a guard script's path out of a hook `command` string.
450
522
  *
@@ -717,7 +789,7 @@ async function installSelfScheduleGuard({ cwd, homeDir = os.homedir(), skipShimE
717
789
  }
718
790
 
719
791
  /**
720
- * Runs all eight delegation-readiness checks for `cwd`. Every filesystem read
792
+ * Runs all ten delegation-readiness checks for `cwd`. Every filesystem read
721
793
  * is wrapped (readJsonOrSync / try-catch) so a missing or unparseable file
722
794
  * yields ok:false with a detail, never a thrown exception. Async because
723
795
  * scheduler-mcp-live genuinely spawns a process and waits on it (bounded by
@@ -725,7 +797,7 @@ async function installSelfScheduleGuard({ cwd, homeDir = os.homedir(), skipShimE
725
797
  * callers — the New Epic banner, session_manager_help — don't each pay for
726
798
  * a fresh spawn).
727
799
  */
728
- async function checkDelegationReadiness({ cwd, homeDir = os.homedir() }) {
800
+ async function checkDelegationReadiness({ cwd, homeDir = os.homedir(), sandboxDeps = null, sandboxPlatform, environmentMode }) {
729
801
  const schedulerMcpCheck = checkSchedulerMcp({ cwd, homeDir });
730
802
  const schedulerMcpLiveCheck = await checkSchedulerMcpLive({ cwd, homeDir, schedulerMcpCheck });
731
803
 
@@ -742,6 +814,7 @@ async function checkDelegationReadiness({ cwd, homeDir = os.homedir() }) {
742
814
  checkDestructiveGitGuard({ cwd, homeDir }),
743
815
  checkInlineImplementationGuard({ cwd, homeDir }),
744
816
  checkSelfScheduleGuard({ cwd, homeDir }),
817
+ checkJobSandbox({ sandboxDeps, platform: sandboxPlatform, mode: environmentMode }),
745
818
  ].map((c) => ({ fixAction: null, warn: false, ...c }));
746
819
 
747
820
  return {
@@ -895,6 +968,7 @@ module.exports = {
895
968
  checkDevPlugin,
896
969
  DEV_PLUGIN_REINSTALL_FIX,
897
970
  checkDelegationReadiness,
971
+ checkJobSandbox,
898
972
  ensureGuardsInstalled,
899
973
  logAutoInstallEvent,
900
974
  clearGuardsInstalledCache,
@@ -0,0 +1,97 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * epicAgentRefresh.cjs — the ONLY path by which a live persona edit reaches an existing Epic.
5
+ *
6
+ * An Epic minted with an agentType pins its persona as an AgentSnapshot (epicMint.cjs's
7
+ * AGENT SNAPSHOT PIN); every later turn builds from that snapshot, so an edit to the persona
8
+ * file reaches only NEW Epics. refreshEpicAgentSnapshot is the explicit, audited action that
9
+ * re-snapshots the persona (same agentType + packs) and re-stamps the Epic's agentSnapshotId.
10
+ * One audit record { kind: 'epic_agent_snapshot_updated', epicId, from, to } per change; an
11
+ * unchanged persona (same content id) is a no-op that writes nothing.
12
+ *
13
+ * Electron-free at load; electron/config/ipcSchemas are required lazily in the register fn.
14
+ */
15
+
16
+ const { activeIndexPath, readActiveIndex, writeActiveIndex, withPathLock } = require('./epicMint.cjs');
17
+ const { mirrorEpicStatus } = require('./epicStatusMirror.cjs');
18
+ const { appendAuditEvent } = require('../telemetry/auditLog.cjs');
19
+
20
+ const AUDIT_KIND = 'epic_agent_snapshot_updated';
21
+
22
+ const fail = (code, message) => ({ ok: false, code, message });
23
+
24
+ function readRow(cwd, epicId) {
25
+ const index = readActiveIndex(cwd);
26
+ return Object.prototype.hasOwnProperty.call(index.sessions, epicId) ? index.sessions[epicId] : null;
27
+ }
28
+
29
+ /**
30
+ * @param {{ cwd: string, epicId: string, deps?: object }} opts
31
+ * @returns {Promise<
32
+ * | { ok: true, changed: boolean, from: string|null, to: string, session: object }
33
+ * | { ok: false, code: string, message: string }>}
34
+ */
35
+ async function refreshEpicAgentSnapshot({ cwd, epicId, deps = {} } = {}) {
36
+ if (typeof cwd !== 'string' || !cwd || typeof epicId !== 'string' || !epicId) {
37
+ return fail('invalid_args', 'cwd and epicId are required.');
38
+ }
39
+ const row = readRow(cwd, epicId);
40
+ if (!row) return fail('not_found', `No open Epic ${epicId} in ${cwd}.`);
41
+ if (!row.agentType) return fail('no_agent_type', `Epic ${epicId} has no agentType to snapshot.`);
42
+ if (row.agentCli) return fail('not_pinnable', `Epic ${epicId} runs a non-Claude agent CLI; it loads no persona.`);
43
+
44
+ const agentSnapshot = require('../claude/agentSnapshot.cjs');
45
+ const build = deps.buildAgentSnapshot || agentSnapshot.buildAgentSnapshot;
46
+ const built = await build({
47
+ cwd,
48
+ agentType: row.agentType,
49
+ packs: Array.isArray(row.packs) ? row.packs : [],
50
+ deps: deps.snapshotDeps || {},
51
+ });
52
+ if (built.refusal) return fail(built.refusal.code, built.refusal.detail);
53
+
54
+ const from = typeof row.agentSnapshotId === 'string' ? row.agentSnapshotId : null;
55
+ if (built.id === from) return { ok: true, changed: false, from, to: built.id, session: row };
56
+
57
+ // Write-once + content-addressed: an id another Epic already pinned is a no-op write.
58
+ const write = deps.writeAgentSnapshot || agentSnapshot.writeAgentSnapshot;
59
+ await write(cwd, built.snapshot);
60
+
61
+ let result;
62
+ try {
63
+ result = await withPathLock(activeIndexPath(cwd), async () => {
64
+ const index = readActiveIndex(cwd);
65
+ const current = Object.prototype.hasOwnProperty.call(index.sessions, epicId) ? index.sessions[epicId] : null;
66
+ if (!current) return fail('not_found', `Epic ${epicId} disappeared before it could be re-stamped.`);
67
+ const prior = typeof current.agentSnapshotId === 'string' ? current.agentSnapshotId : null;
68
+ if (prior === built.id) return { ok: true, changed: false, from: prior, to: built.id, session: current };
69
+ const session = { ...current, agentSnapshotId: built.id };
70
+ index.sessions[epicId] = session;
71
+ writeActiveIndex(cwd, index);
72
+ mirrorEpicStatus(cwd, epicId, { session });
73
+ return { ok: true, changed: true, from: prior, to: built.id, session };
74
+ });
75
+ } catch (err) {
76
+ return fail('write_failed', `Could not re-stamp Epic ${epicId}: ${err && err.message ? err.message : err}`);
77
+ }
78
+ if (result.ok && result.changed) {
79
+ appendAuditEvent(AUDIT_KIND, { cwd, epicId, from: result.from, to: result.to }, deps.auditOpts || {});
80
+ }
81
+ return result;
82
+ }
83
+
84
+ function registerEpicAgentRefreshHandlers() {
85
+ const { ipcMain } = require('electron');
86
+ const { validatePath } = require('../../config.cjs');
87
+ const { schemas: s, validated: v } = require('../../ipcSchemas.cjs');
88
+ ipcMain.handle(
89
+ 'epic:refresh-agent-snapshot',
90
+ v(s.epicRefreshAgentSnapshot, ({ cwd, epicId }) => {
91
+ validatePath(cwd);
92
+ return refreshEpicAgentSnapshot({ cwd, epicId });
93
+ }),
94
+ );
95
+ }
96
+
97
+ module.exports = { refreshEpicAgentSnapshot, registerEpicAgentRefreshHandlers, AUDIT_KIND };