claude-code-session-manager 0.110.0 → 0.112.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 (283) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/dist/assets/{AgentLibrary-Cm6MrOnF.js → AgentLibrary-RwPvEgqm.js} +2 -2
  3. package/dist/assets/{Button-CGVncJ6a.js → Button-36j3PzYv.js} +1 -1
  4. package/dist/assets/{DataModel-C3hlMoa8.js → DataModel-DUhANo4l.js} +1 -1
  5. package/dist/assets/{History-CTyfGNKn.js → History-BeZzNjmv.js} +2 -2
  6. package/dist/assets/{Hooks-BXxCBibx.js → Hooks-iQ8845Hp.js} +3 -3
  7. package/dist/assets/{Library-aCs7zxAg.js → Library-DPE1h-1L.js} +6 -6
  8. package/dist/assets/{ListDetail-B9Hqk1_f.js → ListDetail-PStOuQAo.js} +1 -1
  9. package/dist/assets/{MarkdownEditor-Djfgp32k.js → MarkdownEditor-DPw-N2-m.js} +1 -1
  10. package/dist/assets/{McpServers-8HQC6QgR.js → McpServers-CUyRTNep.js} +2 -2
  11. package/dist/assets/{Memory-c4SVE3l2.js → Memory-bZ2xjBGy.js} +3 -3
  12. package/dist/assets/{Panel-BEQTwE4z.js → Panel-_VZ_uXNg.js} +1 -1
  13. package/dist/assets/{Permissions-BaYzgZtc.js → Permissions-PPRmfNbK.js} +3 -3
  14. package/dist/assets/{Plugins-DnXsVau7.js → Plugins-BFcvfvlx.js} +2 -2
  15. package/dist/assets/{ProvenanceBadge-CT2vWps1.js → ProvenanceBadge-B1WUknak.js} +1 -1
  16. package/dist/assets/RemoteMachines-D5V0lzgW.js +3 -0
  17. package/dist/assets/{SaveBar-DwcHt3iR.js → SaveBar-Dw64FVdM.js} +1 -1
  18. package/dist/assets/{Scheduler-D6Gcuo0M.js → Scheduler-C8s_pJ3I.js} +9 -9
  19. package/dist/assets/{ScopeSwitcher-CgvWDc9Y.js → ScopeSwitcher-D-nKDMAE.js} +1 -1
  20. package/dist/assets/{Settings-CJoogVAB.js → Settings-CQSrR4mO.js} +4 -4
  21. package/dist/assets/{SkillReferenceGraph-4fq01kxq.js → SkillReferenceGraph-BbZFMHim.js} +1 -1
  22. package/dist/assets/{Skills-BU4ZX4h4.js → Skills-Bzyrh6EQ.js} +1 -1
  23. package/dist/assets/SystemPrompt-DP6i3Dx0.js +1 -0
  24. package/dist/assets/TagLibrary-iip0C6Bl.js +1 -0
  25. package/dist/assets/{TiptapBody-DVyBsfsT.js → TiptapBody-Cr-hxX8L.js} +1 -1
  26. package/dist/assets/Toggle-7WpPzcZH.js +1 -0
  27. package/dist/assets/{ViewTabs-BLHjKUv-.js → ViewTabs-9lQCRwWJ.js} +1 -1
  28. package/dist/assets/{historyTotals-BXDd3EzP.js → historyTotals-BrFxw5J1.js} +1 -1
  29. package/dist/assets/{index-CuiU3I-8.js → index-CTBpf-26.js} +250 -249
  30. package/dist/assets/{settingsSchema-DD4bc5cT.js → settingsSchema-Dh5Kl7VO.js} +1 -1
  31. package/dist/assets/{useAgentsDirWatch-DMQ_XZtr.js → useAgentsDirWatch-CMpx0d04.js} +1 -1
  32. package/dist/assets/{useRemotePeers-C9NfteSD.js → useRemotePeers-CI2axd-L.js} +1 -1
  33. package/dist/index.html +1 -1
  34. package/package.json +3 -2
  35. package/plugins/CLAUDE.md +5 -8
  36. package/plugins/session-manager-dev/.claude-plugin/plugin.json +3 -6
  37. package/plugins/session-manager-dev/skills/builder/1-classify-and-bump/SKILL.md +2 -2
  38. package/plugins/session-manager-dev/skills/builder/SKILL.md +2 -3
  39. package/plugins/session-manager-dev/skills/develop/SKILL.md +1 -1
  40. package/plugins/session-manager-dev/skills/develop/standards.md +3 -3
  41. package/scripts/README.md +3 -3
  42. package/scripts/audit-ops-hygiene.cjs +4 -4
  43. package/scripts/hooks/guard-destructive-git.cjs +4 -4
  44. package/scripts/hooks/guard-inline-implementation.cjs +1 -1
  45. package/scripts/hooks/guard-prd-writes.cjs +2 -2
  46. package/scripts/hooks/lib/guard-destructive-git-policy.cjs +1 -1
  47. package/scripts/mint-epic.cjs +2 -2
  48. package/scripts/scheduler-mcp-server.cjs +4 -4
  49. package/src/main/agentLibrary.cjs +5 -5
  50. package/src/main/agentsIpc.cjs +76 -0
  51. package/src/main/build-info.json +4 -4
  52. package/src/main/chatRunner.cjs +12 -12
  53. package/src/main/config.cjs +2 -2
  54. package/src/main/crashDiagnostics.cjs +2 -2
  55. package/src/main/docEdit.cjs +5 -5
  56. package/src/main/files.cjs +2 -2
  57. package/src/main/git.cjs +1 -1
  58. package/src/main/health.cjs +20 -18
  59. package/src/main/heapSnapshot.cjs +1 -1
  60. package/src/main/historyAggregator.cjs +2 -2
  61. package/src/main/index.cjs +44 -132
  62. package/src/main/ipcSchemas.cjs +10 -10
  63. package/src/main/lib/CLAUDE.md +48 -0
  64. package/src/main/lib/activeSessions.cjs +1 -1
  65. package/src/main/lib/classifyPromptTicket.cjs +2 -2
  66. package/src/main/lib/{agentModelResolve.cjs → claude/agentModelResolve.cjs} +7 -7
  67. package/src/main/lib/{claudeBin.cjs → claude/claudeBin.cjs} +4 -4
  68. package/src/main/lib/{effectiveModelInfo.cjs → claude/effectiveModelInfo.cjs} +9 -9
  69. package/src/main/lib/{modelCatalog.cjs → claude/modelCatalog.cjs} +3 -3
  70. package/src/main/lib/{rateLimitDetect.cjs → claude/rateLimitDetect.cjs} +1 -1
  71. package/src/main/lib/{rateLimitWindow.cjs → claude/rateLimitWindow.cjs} +1 -1
  72. package/src/main/lib/{runClaudeP.cjs → claude/runClaudeP.cjs} +1 -1
  73. package/src/main/lib/credentials.cjs +3 -3
  74. package/src/main/lib/cwdClassify.cjs +1 -1
  75. package/src/main/lib/{activeIndexMerge.cjs → epic/activeIndexMerge.cjs} +3 -3
  76. package/src/main/lib/{activeIndexRebuild.cjs → epic/activeIndexRebuild.cjs} +1 -1
  77. package/src/main/lib/{delegationReadiness.cjs → epic/delegationReadiness.cjs} +21 -29
  78. package/src/main/lib/{epicContextDigest.cjs → epic/epicContextDigest.cjs} +1 -1
  79. package/src/main/lib/{epicDelegationStats.cjs → epic/epicDelegationStats.cjs} +2 -2
  80. package/src/main/lib/{epicMint.cjs → epic/epicMint.cjs} +11 -11
  81. package/src/main/lib/{epicSpawnPlan.cjs → epic/epicSpawnPlan.cjs} +3 -3
  82. package/src/main/lib/{epicStatusMirror.cjs → epic/epicStatusMirror.cjs} +2 -2
  83. package/src/main/lib/{epicTranscriptDiagnostic.cjs → epic/epicTranscriptDiagnostic.cjs} +2 -2
  84. package/src/main/lib/{epicTranscriptPath.cjs → epic/epicTranscriptPath.cjs} +2 -2
  85. package/src/main/lib/{epicValidationHook.cjs → epic/epicValidationHook.cjs} +3 -3
  86. package/src/main/lib/{epicWorktreeBoot.cjs → epic/epicWorktreeBoot.cjs} +1 -1
  87. package/src/main/lib/{epicWorktreeMerge.cjs → epic/epicWorktreeMerge.cjs} +3 -3
  88. package/src/main/lib/{epicWorktreeMint.cjs → epic/epicWorktreeMint.cjs} +3 -3
  89. package/src/main/lib/{epicWorktreeProjectConfig.cjs → epic/epicWorktreeProjectConfig.cjs} +4 -4
  90. package/src/main/lib/{promptSessionsCreateEpic.cjs → epic/promptSessionsCreateEpic.cjs} +4 -4
  91. package/src/main/lib/{crossProjectFeedback.cjs → feedback-remote/crossProjectFeedback.cjs} +7 -7
  92. package/src/main/lib/{customerFeedbackClient.cjs → feedback-remote/customerFeedbackClient.cjs} +3 -3
  93. package/src/main/lib/{customerFeedbackInbox.cjs → feedback-remote/customerFeedbackInbox.cjs} +2 -2
  94. package/src/main/lib/{customerFeedbackIpc.cjs → feedback-remote/customerFeedbackIpc.cjs} +1 -1
  95. package/src/main/lib/{localAdminHttp.cjs → feedback-remote/localAdminHttp.cjs} +2 -2
  96. package/src/main/lib/{macroAdminRoutes.cjs → feedback-remote/macroAdminRoutes.cjs} +1 -1
  97. package/src/main/lib/{projectHomeAdminRoutes.cjs → feedback-remote/projectHomeAdminRoutes.cjs} +4 -4
  98. package/src/main/lib/{relayClientAuth.cjs → feedback-remote/relayClientAuth.cjs} +2 -2
  99. package/src/main/lib/{remoteClientSessions.cjs → feedback-remote/remoteClientSessions.cjs} +1 -1
  100. package/src/main/lib/{gitWorktree.cjs → git/gitWorktree.cjs} +7 -7
  101. package/src/main/lib/historyRollup.cjs +1 -1
  102. package/src/main/lib/importReferences.cjs +1 -1
  103. package/src/main/lib/machineProfile.cjs +1 -1
  104. package/src/main/lib/openExternalApp.cjs +1 -1
  105. package/src/main/lib/opsOwnership.cjs +3 -3
  106. package/src/main/lib/{agentPersonaSchema.cjs → persona-macro/agentPersonaSchema.cjs} +2 -2
  107. package/src/main/lib/{builtinMacros.cjs → persona-macro/builtinMacros.cjs} +2 -2
  108. package/src/main/lib/{macroLibrary.cjs → persona-macro/macroLibrary.cjs} +5 -5
  109. package/src/main/lib/{personaMerge.cjs → persona-macro/personaMerge.cjs} +4 -4
  110. package/src/main/lib/{shippedPersonaSeeds.cjs → persona-macro/shippedPersonaSeeds.cjs} +11 -0
  111. package/src/main/lib/{prdAdminRoutes.cjs → prd/prdAdminRoutes.cjs} +7 -7
  112. package/src/main/lib/{prdAgentType.cjs → prd/prdAgentType.cjs} +3 -3
  113. package/src/main/lib/{prdCreate.cjs → prd/prdCreate.cjs} +12 -12
  114. package/src/main/lib/{prdDeclaredPaths.cjs → prd/prdDeclaredPaths.cjs} +1 -1
  115. package/src/main/lib/{prdGateFiles.cjs → prd/prdGateFiles.cjs} +1 -1
  116. package/src/main/lib/{prdLocations.cjs → prd/prdLocations.cjs} +2 -2
  117. package/src/main/lib/{prdMigration.cjs → prd/prdMigration.cjs} +3 -3
  118. package/src/main/lib/prereqs.cjs +2 -2
  119. package/src/main/lib/{instanceLock.cjs → process/instanceLock.cjs} +4 -11
  120. package/src/main/lib/{pidAlive.cjs → process/pidAlive.cjs} +1 -1
  121. package/src/main/lib/{procName.cjs → process/procName.cjs} +2 -2
  122. package/src/main/lib/{timeoutShim.cjs → process/timeoutShim.cjs} +1 -1
  123. package/src/main/lib/projectRootResolve.cjs +1 -1
  124. package/src/main/lib/promptSessionSchema.cjs +1 -1
  125. package/src/main/lib/{definitionOfDone.cjs → scheduler/definitionOfDone.cjs} +6 -12
  126. package/src/main/lib/{fixChainDepth.cjs → scheduler/fixChainDepth.cjs} +1 -1
  127. package/src/main/lib/{jobDirtFilter.cjs → scheduler/jobDirtFilter.cjs} +1 -1
  128. package/src/main/lib/{jobSupervisorRecord.cjs → scheduler/jobSupervisorRecord.cjs} +1 -1
  129. package/src/main/lib/{launchFailure.cjs → scheduler/launchFailure.cjs} +2 -2
  130. package/src/main/lib/{queueStore.cjs → scheduler/queueStore.cjs} +6 -6
  131. package/src/main/lib/{quietMachineLease.cjs → scheduler/quietMachineLease.cjs} +1 -1
  132. package/src/main/lib/{rcaReport.cjs → scheduler/rcaReport.cjs} +4 -4
  133. package/src/main/lib/{reaperHelpers.cjs → scheduler/reaperHelpers.cjs} +3 -3
  134. package/src/main/lib/{reservationExpiry.cjs → scheduler/reservationExpiry.cjs} +4 -11
  135. package/src/main/lib/{reviewNotice.cjs → scheduler/reviewNotice.cjs} +1 -1
  136. package/src/main/lib/{scheduleJobTransitions.cjs → scheduler/scheduleJobTransitions.cjs} +3 -3
  137. package/src/main/lib/{schedulerBatch.cjs → scheduler/schedulerBatch.cjs} +2 -2
  138. package/src/main/lib/{schedulerConfig.cjs → scheduler/schedulerConfig.cjs} +1 -1
  139. package/src/main/lib/{schedulerRuntimeState.cjs → scheduler/schedulerRuntimeState.cjs} +1 -1
  140. package/src/main/lib/{sessionSlots.cjs → scheduler/sessionSlots.cjs} +2 -2
  141. package/src/main/lib/{upgradeDrain.cjs → scheduler/upgradeDrain.cjs} +8 -11
  142. package/src/main/lib/{watchdogHelpers.cjs → scheduler/watchdogHelpers.cjs} +5 -19
  143. package/src/main/lib/{auditLog.cjs → telemetry/auditLog.cjs} +1 -1
  144. package/src/main/lib/{opsErrorLog.cjs → telemetry/opsErrorLog.cjs} +4 -4
  145. package/src/main/lib/{telemetryBacklog.cjs → telemetry/telemetryBacklog.cjs} +4 -4
  146. package/src/main/lib/{telemetryBoot.cjs → telemetry/telemetryBoot.cjs} +1 -1
  147. package/src/main/lib/{telemetryClient.cjs → telemetry/telemetryClient.cjs} +4 -4
  148. package/src/main/lib/{telemetrySettings.cjs → telemetry/telemetrySettings.cjs} +1 -1
  149. package/src/main/logs.cjs +1 -1
  150. package/src/main/mcpStatus.cjs +2 -2
  151. package/src/main/memoryAggregate.cjs +3 -3
  152. package/src/main/memoryTool.cjs +1 -1
  153. package/src/main/otel.cjs +2 -2
  154. package/src/main/pluginInstall.cjs +29 -3
  155. package/src/main/projectBrief.cjs +6 -6
  156. package/src/main/projectPages.cjs +1 -1
  157. package/src/main/promptSessionEvents.cjs +2 -2
  158. package/src/main/pty.cjs +7 -7
  159. package/src/main/queueOps.cjs +6 -6
  160. package/src/main/remoteClient.cjs +4 -4
  161. package/src/main/remoteClientIpc.cjs +1 -1
  162. package/src/main/runVerify.cjs +1 -1
  163. package/src/main/scheduler/CLAUDE.md +26 -0
  164. package/src/main/scheduler/budget.cjs +576 -0
  165. package/src/main/scheduler/gitTreeGuard.cjs +672 -0
  166. package/src/main/scheduler/prdParser.cjs +4 -4
  167. package/src/main/scheduler/prdPaths.cjs +487 -0
  168. package/src/main/scheduler/reviewLadder.cjs +1011 -0
  169. package/src/main/scheduler/starvation.cjs +390 -0
  170. package/src/main/scheduler.cjs +289 -3311
  171. package/src/main/seedAgentPersonas.cjs +5 -5
  172. package/src/main/seedDevPlugin.cjs +70 -3
  173. package/src/main/seedSchedulerMcp.cjs +2 -2
  174. package/src/main/supervisor.cjs +5 -5
  175. package/src/main/telemetryIpc.cjs +51 -0
  176. package/src/main/transcripts.cjs +3 -3
  177. package/src/main/updaterIpc.cjs +1 -1
  178. package/src/main/usage.cjs +1 -1
  179. package/src/main/watchers.cjs +1 -1
  180. package/src/main/webRemote.cjs +7 -7
  181. package/src/preload/api.d.ts +8 -8
  182. package/src/preload/index.cjs +3 -3
  183. package/src/seed/agents/demo-video-builder.md +62 -19
  184. package/dist/assets/RemoteMachines-DHJZfdJC.js +0 -3
  185. package/dist/assets/SystemPrompt-BCEyMSEq.js +0 -1
  186. package/dist/assets/TagLibrary-m3It8Oal.js +0 -1
  187. package/dist/assets/Toggle-In_AExPV.js +0 -1
  188. package/plugins/session-manager-dev/skills/blog-for-project-feature/0-select/SKILL.md +0 -39
  189. package/plugins/session-manager-dev/skills/blog-for-project-feature/1-research/SKILL.md +0 -37
  190. package/plugins/session-manager-dev/skills/blog-for-project-feature/2-storyboard/SKILL.md +0 -64
  191. package/plugins/session-manager-dev/skills/blog-for-project-feature/3-capture/SKILL.md +0 -52
  192. package/plugins/session-manager-dev/skills/blog-for-project-feature/4-draft-copy/SKILL.md +0 -37
  193. package/plugins/session-manager-dev/skills/blog-for-project-feature/5-illustrate/SKILL.md +0 -50
  194. package/plugins/session-manager-dev/skills/blog-for-project-feature/6-compose/SKILL.md +0 -51
  195. package/plugins/session-manager-dev/skills/blog-for-project-feature/7-review/SKILL.md +0 -54
  196. package/plugins/session-manager-dev/skills/blog-for-project-feature/SKILL.md +0 -144
  197. package/plugins/session-manager-dev/skills/blog-for-project-feature/feature.config.yaml +0 -90
  198. package/plugins/session-manager-dev/skills/discover-features/SKILL.md +0 -95
  199. package/plugins/session-manager-dev/skills/explain-to-me/SKILL.md +0 -205
  200. package/plugins/session-manager-dev/skills/explain-to-me/assets/style-reference.html +0 -163
  201. package/plugins/session-manager-dev/skills/find-opportunity/SKILL.md +0 -83
  202. package/plugins/session-manager-dev/skills/issue-address/0-select/0-fetch-pool/SKILL.md +0 -38
  203. package/plugins/session-manager-dev/skills/issue-address/0-select/1-reject-fixed/SKILL.md +0 -64
  204. package/plugins/session-manager-dev/skills/issue-address/0-select/2-reject-claimed/SKILL.md +0 -71
  205. package/plugins/session-manager-dev/skills/issue-address/0-select/3-rank-impact/SKILL.md +0 -39
  206. package/plugins/session-manager-dev/skills/issue-address/0-select/SKILL.md +0 -75
  207. package/plugins/session-manager-dev/skills/issue-address/1-confirm-open/SKILL.md +0 -39
  208. package/plugins/session-manager-dev/skills/issue-address/2-claim/SKILL.md +0 -57
  209. package/plugins/session-manager-dev/skills/issue-address/3-reproduce/SKILL.md +0 -40
  210. package/plugins/session-manager-dev/skills/issue-address/4-fix/SKILL.md +0 -33
  211. package/plugins/session-manager-dev/skills/issue-address/5-verify/SKILL.md +0 -40
  212. package/plugins/session-manager-dev/skills/issue-address/SKILL.md +0 -120
  213. package/plugins/session-manager-dev/skills/local-project-health/SKILL.md +0 -58
  214. package/plugins/session-manager-dev/skills/memory-sanitation/SKILL.md +0 -147
  215. package/plugins/session-manager-dev/skills/ops-sweep/SKILL.md +0 -137
  216. package/plugins/session-manager-dev/skills/pr-review-sweep/0-fetch/SKILL.md +0 -41
  217. package/plugins/session-manager-dev/skills/pr-review-sweep/1-classify/SKILL.md +0 -56
  218. package/plugins/session-manager-dev/skills/pr-review-sweep/2-check-fixed/SKILL.md +0 -49
  219. package/plugins/session-manager-dev/skills/pr-review-sweep/3-queue/SKILL.md +0 -57
  220. package/plugins/session-manager-dev/skills/pr-review-sweep/4-land-and-resolve/SKILL.md +0 -60
  221. package/plugins/session-manager-dev/skills/pr-review-sweep/SKILL.md +0 -124
  222. package/plugins/session-manager-dev/skills/pr-signal/SKILL.md +0 -67
  223. package/plugins/session-manager-dev/skills/project-status/SKILL.md +0 -243
  224. package/plugins/session-manager-dev/skills/requesting-code-review/SKILL.md +0 -98
  225. package/plugins/session-manager-dev/skills/requesting-code-review/code-reviewer.md +0 -146
  226. /package/src/main/lib/{agentEffortResolve.cjs → claude/agentEffortResolve.cjs} +0 -0
  227. /package/src/main/lib/{claudeCliCaps.cjs → claude/claudeCliCaps.cjs} +0 -0
  228. /package/src/main/lib/{usageCircuit.cjs → claude/usageCircuit.cjs} +0 -0
  229. /package/src/main/lib/{epicSpawnCwd.cjs → epic/epicSpawnCwd.cjs} +0 -0
  230. /package/src/main/lib/{customerFeedbackAdminRoutes.cjs → feedback-remote/customerFeedbackAdminRoutes.cjs} +0 -0
  231. /package/src/main/lib/{remoteE2eCrypto.cjs → feedback-remote/remoteE2eCrypto.cjs} +0 -0
  232. /package/src/main/lib/{branchSweep.cjs → git/branchSweep.cjs} +0 -0
  233. /package/src/main/lib/{gitExec.cjs → git/gitExec.cjs} +0 -0
  234. /package/src/main/lib/{jobWorktree.cjs → git/jobWorktree.cjs} +0 -0
  235. /package/src/main/lib/{jobWorktreeBootLive.cjs → git/jobWorktreeBootLive.cjs} +0 -0
  236. /package/src/main/lib/{jobWorktreeTerminalOrphanLive.cjs → git/jobWorktreeTerminalOrphanLive.cjs} +0 -0
  237. /package/src/main/lib/{personaImportHealth.cjs → persona-macro/personaImportHealth.cjs} +0 -0
  238. /package/src/main/lib/{depSlugResolve.cjs → prd/depSlugResolve.cjs} +0 -0
  239. /package/src/main/lib/{planValidator.cjs → prd/planValidator.cjs} +0 -0
  240. /package/src/main/lib/{prdAuthoringSeed.cjs → prd/prdAuthoringSeed.cjs} +0 -0
  241. /package/src/main/lib/{prdDisposition.cjs → prd/prdDisposition.cjs} +0 -0
  242. /package/src/main/lib/{prdFrontmatter.cjs → prd/prdFrontmatter.cjs} +0 -0
  243. /package/src/main/lib/{prdSizing.cjs → prd/prdSizing.cjs} +0 -0
  244. /package/src/main/lib/{workTypeLibrary.cjs → prd/workTypeLibrary.cjs} +0 -0
  245. /package/src/main/lib/{childWithLog.cjs → process/childWithLog.cjs} +0 -0
  246. /package/src/main/lib/{cleanEnv.cjs → process/cleanEnv.cjs} +0 -0
  247. /package/src/main/lib/{defaultShell.cjs → process/defaultShell.cjs} +0 -0
  248. /package/src/main/lib/{killTree.cjs → process/killTree.cjs} +0 -0
  249. /package/src/main/lib/{loginShellPath.cjs → process/loginShellPath.cjs} +0 -0
  250. /package/src/main/lib/{procIdentity.cjs → process/procIdentity.cjs} +0 -0
  251. /package/src/main/lib/{singleInstanceGuard.cjs → process/singleInstanceGuard.cjs} +0 -0
  252. /package/src/main/lib/{smProcNames.cjs → process/smProcNames.cjs} +0 -0
  253. /package/src/main/lib/{timeoutShimScript.cjs → process/timeoutShimScript.cjs} +0 -0
  254. /package/src/main/lib/{winSpawn.cjs → process/winSpawn.cjs} +0 -0
  255. /package/src/main/lib/{adoptedRunSupervisor.cjs → scheduler/adoptedRunSupervisor.cjs} +0 -0
  256. /package/src/main/lib/{dispatchLoop.cjs → scheduler/dispatchLoop.cjs} +0 -0
  257. /package/src/main/lib/{dodDrainHook.cjs → scheduler/dodDrainHook.cjs} +0 -0
  258. /package/src/main/lib/{fixPlanSlug.cjs → scheduler/fixPlanSlug.cjs} +0 -0
  259. /package/src/main/lib/{gateAuthority.cjs → scheduler/gateAuthority.cjs} +0 -0
  260. /package/src/main/lib/{landedSinceRun.cjs → scheduler/landedSinceRun.cjs} +0 -0
  261. /package/src/main/lib/{loadGate.cjs → scheduler/loadGate.cjs} +0 -0
  262. /package/src/main/lib/{needsReviewLedger.cjs → scheduler/needsReviewLedger.cjs} +0 -0
  263. /package/src/main/lib/{queueHealth.cjs → scheduler/queueHealth.cjs} +0 -0
  264. /package/src/main/lib/{queueHistory.cjs → scheduler/queueHistory.cjs} +0 -0
  265. /package/src/main/lib/{runLogRetention.cjs → scheduler/runLogRetention.cjs} +0 -0
  266. /package/src/main/lib/{scheduleJobSchema.cjs → scheduler/scheduleJobSchema.cjs} +0 -0
  267. /package/src/main/lib/{schedulerPaths.cjs → scheduler/schedulerPaths.cjs} +0 -0
  268. /package/src/main/lib/{terminalRunOutcome.cjs → scheduler/terminalRunOutcome.cjs} +0 -0
  269. /package/src/main/lib/{validationSentinels.cjs → scheduler/validationSentinels.cjs} +0 -0
  270. /package/src/main/lib/{crashTelemetry.cjs → telemetry/crashTelemetry.cjs} +0 -0
  271. /package/src/main/lib/{otlpTraceExporter.cjs → telemetry/otlpTraceExporter.cjs} +0 -0
  272. /package/src/main/lib/{telemetryConsent.cjs → telemetry/telemetryConsent.cjs} +0 -0
  273. /package/src/main/lib/{telemetryCounters.cjs → telemetry/telemetryCounters.cjs} +0 -0
  274. /package/src/main/lib/{atomicFs.cjs → util/atomicFs.cjs} +0 -0
  275. /package/src/main/lib/{encodeCwd.cjs → util/encodeCwd.cjs} +0 -0
  276. /package/src/main/lib/{expandHome.cjs → util/expandHome.cjs} +0 -0
  277. /package/src/main/lib/{extractJson.cjs → util/extractJson.cjs} +0 -0
  278. /package/src/main/lib/{fileTail.cjs → util/fileTail.cjs} +0 -0
  279. /package/src/main/lib/{headTailBuffer.cjs → util/headTailBuffer.cjs} +0 -0
  280. /package/src/main/lib/{kebabCase.cjs → util/kebabCase.cjs} +0 -0
  281. /package/src/main/lib/{loopDelay.cjs → util/loopDelay.cjs} +0 -0
  282. /package/src/main/lib/{lruCache.cjs → util/lruCache.cjs} +0 -0
  283. /package/src/main/lib/{withTimeout.cjs → util/withTimeout.cjs} +0 -0
@@ -11,8 +11,8 @@ const fs = require('node:fs');
11
11
  const path = require('node:path');
12
12
  const { promisify } = require('node:util');
13
13
  const childProcess = require('node:child_process');
14
- const { pathWithUserBins } = require('./cleanEnv.cjs');
15
- const { resolveClaudeBin } = require('./claudeBin.cjs');
14
+ const { pathWithUserBins } = require('./process/cleanEnv.cjs');
15
+ const { resolveClaudeBin } = require('./claude/claudeBin.cjs');
16
16
  const { readCredentials } = require('./credentials.cjs');
17
17
 
18
18
  const PROBE_TIMEOUT_MS = 5000;
@@ -28,9 +28,9 @@
28
28
  const fs = require('node:fs');
29
29
  const path = require('node:path');
30
30
  const { identity, isDifferentProcess } = require('./procIdentity.cjs');
31
- const { instanceLockPath } = require('./schedulerPaths.cjs');
32
- const { appendAuditEvent } = require('./auditLog.cjs');
33
- const { pidAlive: pidAliveCore } = require('./pidAlive.cjs');
31
+ const { instanceLockPath } = require('../scheduler/schedulerPaths.cjs');
32
+ const { appendAuditEvent } = require('../telemetry/auditLog.cjs');
33
+ const { pidAlive } = require('./pidAlive.cjs');
34
34
 
35
35
  // Env override is for unit tests only (isolates the lock from the real
36
36
  // ~/.claude of the machine running the suite).
@@ -39,13 +39,6 @@ function lockPath() {
39
39
  || instanceLockPath();
40
40
  }
41
41
 
42
- // Thin alias over pidAlive.cjs's shared pidAlive() — kept as its own named
43
- // export (rather than inlining the require at every call site) so existing
44
- // imports of `pidAlive` from this module keep working unchanged.
45
- function pidAlive(pid) {
46
- return pidAliveCore(pid);
47
- }
48
-
49
42
  function readLock() {
50
43
  try {
51
44
  const raw = fs.readFileSync(lockPath(), 'utf8');
@@ -121,4 +114,4 @@ function releaseSchedulerOwnership() {
121
114
  } catch { /* nothing to release */ }
122
115
  }
123
116
 
124
- module.exports = { acquireSchedulerOwnership, releaseSchedulerOwnership, pidAlive, lockPath };
117
+ module.exports = { acquireSchedulerOwnership, releaseSchedulerOwnership, lockPath };
@@ -6,7 +6,7 @@
6
6
  * Four independent copies of this exact check had drifted apart:
7
7
  * reaperHelpers.cjs's claudePidAlive (bug: caught EPERM and returned false,
8
8
  * never crediting a pid it couldn't signal but which demonstrably exists),
9
- * watchdogHelpers.cjs's isPidAlive, reservationExpiry.cjs's defaultPidAlive,
9
+ * watchdogHelpers.cjs's old pid check, reservationExpiry.cjs's old one,
10
10
  * and instanceLock.cjs's pidAlive (these three already treated EPERM as
11
11
  * alive, but each reimplemented the same three lines). This module is now
12
12
  * the one place the rule lives; the others re-export thin aliases so every
@@ -27,7 +27,7 @@
27
27
  const fs = require('node:fs');
28
28
  const path = require('node:path');
29
29
 
30
- const { procnamesRoot } = require('./schedulerPaths.cjs');
30
+ const { procnamesRoot } = require('../scheduler/schedulerPaths.cjs');
31
31
  const MAX_ALIAS_LEN = 15; // Linux TASK_COMM_LEN (16) minus NUL
32
32
  const MAX_LABEL_LEN = 120;
33
33
 
@@ -37,7 +37,7 @@ function resolveBare(bin) {
37
37
  if (path.isAbsolute(bin)) return bin;
38
38
  try {
39
39
  // Lazy: openExternalApp requires 'electron', unavailable outside the app.
40
- const { findCommand } = require('./openExternalApp.cjs');
40
+ const { findCommand } = require('../openExternalApp.cjs');
41
41
  const found = findCommand(bin);
42
42
  return found && path.isAbsolute(found) ? found : null;
43
43
  } catch { return null; }
@@ -22,7 +22,7 @@
22
22
  const fs = require('node:fs');
23
23
  const os = require('node:os');
24
24
  const path = require('node:path');
25
- const { writeTextAtomic, addAllowedRoot } = require('../config.cjs');
25
+ const { writeTextAtomic, addAllowedRoot } = require('../../config.cjs');
26
26
 
27
27
  function shimDir(homeDir = os.homedir()) {
28
28
  return path.join(homeDir, '.claude', 'session-manager', 'bin');
@@ -35,7 +35,7 @@
35
35
 
36
36
  const path = require('node:path');
37
37
  const { projectRootOf, allProjectCwds } = require('./activeSessions.cjs');
38
- const { readActiveIndex } = require('./epicMint.cjs');
38
+ const { readActiveIndex } = require('./epic/epicMint.cjs');
39
39
  const { isEphemeralCwd } = require('./ephemeralCwd.cjs');
40
40
 
41
41
  /**
@@ -14,7 +14,7 @@
14
14
  'use strict';
15
15
 
16
16
  const { z } = require('zod');
17
- const { WorkTypeSchema, LEGACY_WORK_TYPES } = require('./workTypeLibrary.cjs');
17
+ const { WorkTypeSchema, LEGACY_WORK_TYPES } = require('./prd/workTypeLibrary.cjs');
18
18
 
19
19
  // Mirrors EpicTag (src/renderer/lib/tagLibrary.ts:10) — the Epic-level
20
20
  // mission tag. Epic tag and PRD tag (ipcSchemas.cjs's scheduleRetagPrd `tag`
@@ -12,11 +12,11 @@ const fs = require('node:fs');
12
12
  const os = require('node:os');
13
13
  const path = require('node:path');
14
14
  const { spawn, spawnSync } = require('node:child_process');
15
- const { splitFrontmatter } = require('./prdFrontmatter.cjs');
16
- const { resolvePrdWriteDir } = require('./prdLocations.cjs');
15
+ const { splitFrontmatter } = require('../prd/prdFrontmatter.cjs');
16
+ const { resolvePrdWriteDir } = require('../prd/prdLocations.cjs');
17
17
  const schedulerPaths = require('./schedulerPaths.cjs');
18
- const atomicFs = require('./atomicFs.cjs');
19
- const { resolveSpawn } = require('./winSpawn.cjs');
18
+ const atomicFs = require('../util/atomicFs.cjs');
19
+ const { resolveSpawn } = require('../process/winSpawn.cjs');
20
20
 
21
21
  // Regex identifying meta/dod slugs that must NOT influence the batchKey.
22
22
  // This is the load-bearing loop-avoidance filter: when the gate job itself
@@ -648,12 +648,6 @@ function flagRiskySurfaces(jobs, { prdsDir, gitTimeoutMs = 10_000 } = {}) {
648
648
  return results;
649
649
  }
650
650
 
651
- // ─── Atomic write helper ───────────────────────────────────────────────────────
652
- // Delegates to atomicFs.cjs's tmp+rename recipe (pure-node, no Electron import).
653
- function _writeFileAtomic(absPath, text) {
654
- atomicFs.writeTextAtomicSync(absPath, text);
655
- }
656
-
657
651
  const STATUS_EMOJI = { pass: '✅', fail: '❌', unverifiable: '⚠️' };
658
652
 
659
653
  /**
@@ -751,7 +745,7 @@ function writeReport(key, { acResults = [], riskFlags = [], runsDir } = {}) {
751
745
  ].join('\n');
752
746
 
753
747
  fs.mkdirSync(dir, { recursive: true });
754
- _writeFileAtomic(reportPath, report);
748
+ atomicFs.writeTextAtomicSync(reportPath, report);
755
749
 
756
750
  return reportPath;
757
751
  }
@@ -882,7 +876,7 @@ function readWatermark(runsDir = schedulerPaths.runsDir()) {
882
876
  */
883
877
  function writeWatermark(lastFinishedAt, runsDir = schedulerPaths.runsDir()) {
884
878
  fs.mkdirSync(runsDir, { recursive: true });
885
- _writeFileAtomic(
879
+ atomicFs.writeTextAtomicSync(
886
880
  path.join(runsDir, WATERMARK_FILENAME),
887
881
  JSON.stringify({ lastFinishedAt }, null, 2)
888
882
  );
@@ -10,7 +10,7 @@
10
10
  * since segments are compared for exact equality after splitting on '-'.
11
11
  *
12
12
  * No filesystem access, no scheduler.cjs dependency — safe to require from
13
- * lib/prdCreate.cjs without pulling in the scheduler module graph.
13
+ * lib/prd/prdCreate.cjs without pulling in the scheduler module graph.
14
14
  */
15
15
  'use strict';
16
16
 
@@ -33,7 +33,7 @@
33
33
  * rather than a second hardcoded literal — this file matches git-porcelain
34
34
  * RELATIVE paths, never builds an fs path, so opsPath() itself doesn't apply.
35
35
  */
36
- const { OPS_ROOT_DIR: OPS_ROOT_SEGMENT } = require('./opsOwnership.cjs');
36
+ const { OPS_ROOT_DIR: OPS_ROOT_SEGMENT } = require('../opsOwnership.cjs');
37
37
 
38
38
  /** True when `p` lives under an app-owned operations root. Pure. */
39
39
  function isAppOwnedChurn(p) {
@@ -20,7 +20,7 @@
20
20
  const fs = require('node:fs');
21
21
  const path = require('node:path');
22
22
  const { writeJsonAtomicSync } = require('./queueStore.cjs');
23
- const { isDifferentProcess } = require('./procIdentity.cjs');
23
+ const { isDifferentProcess } = require('../process/procIdentity.cjs');
24
24
 
25
25
  const SUFFIX = '.supervisor.json';
26
26
  const META_SUFFIX = '.meta.json';
@@ -39,8 +39,8 @@
39
39
 
40
40
  const fs = require('node:fs');
41
41
  const path = require('node:path');
42
- const { readTail } = require('./fileTail.cjs');
43
- const atomicFs = require('./atomicFs.cjs');
42
+ const { readTail } = require('../util/fileTail.cjs');
43
+ const atomicFs = require('../util/atomicFs.cjs');
44
44
 
45
45
  const LAUNCH_FAILURE_KINDS = Object.freeze({
46
46
  /** HTTP 400 naming a thinking/effort/config parameter the model rejects — the issue-#11 signature. */
@@ -32,9 +32,9 @@ const fs = require('node:fs');
32
32
  const fsp = require('node:fs/promises');
33
33
  const path = require('node:path');
34
34
  const crypto = require('node:crypto');
35
- const { allProjectCwds, activeProjectCwds, bustProjectCwdCache } = require('./activeSessions.cjs');
36
- const { classifyCwd } = require('./cwdClassify.cjs');
37
- const { assertOpsWrite, resolveOpsRoot, OPS_ROOT_DIR } = require('./opsOwnership.cjs');
35
+ const { allProjectCwds, activeProjectCwds, bustProjectCwdCache } = require('../activeSessions.cjs');
36
+ const { classifyCwd } = require('../cwdClassify.cjs');
37
+ const { assertOpsWrite, resolveOpsRoot, OPS_ROOT_DIR } = require('../opsOwnership.cjs');
38
38
  const { ScheduleJobSchema } = require('./scheduleJobSchema.cjs');
39
39
  const schedulerPaths = require('./schedulerPaths.cjs');
40
40
 
@@ -238,11 +238,11 @@ function shapeMachine(data) {
238
238
  // classifyQueueStarvation's header for why the two must never merge.
239
239
  lastDispatchAttemptAt: data.lastDispatchAttemptAt ?? null,
240
240
  paused: data.paused ?? null,
241
- // Upgrade-drain state (lib/upgradeDrain.cjs): deliberately NOT part of
241
+ // Upgrade-drain state (lib/scheduler/upgradeDrain.cjs): deliberately NOT part of
242
242
  // `paused`, so a rate-limit pause can neither overwrite it nor have the
243
243
  // manual-clear cooldown swallow it.
244
244
  drain: data.drain && typeof data.drain === 'object' ? data.drain : null,
245
- // Launch circuit breaker (lib/launchFailure.cjs): per-persona blocks and
245
+ // Launch circuit breaker (lib/scheduler/launchFailure.cjs): per-persona blocks and
246
246
  // the degraded-mode env a persona is currently launching with. Machine
247
247
  // state, not per-project: the broken thing is the installed CLI.
248
248
  launchBlocks: data.launchBlocks && typeof data.launchBlocks === 'object' ? data.launchBlocks : {},
@@ -315,7 +315,7 @@ const PAUSED_HINT_RE = /"paused"|resumeAt/;
315
315
 
316
316
  function logMachineStateRecovery({ level, message, meta }) {
317
317
  try {
318
- const { appendError } = require('./opsErrorLog.cjs');
318
+ const { appendError } = require('../telemetry/opsErrorLog.cjs');
319
319
  appendError({ cwd: schedulerPaths.machineStateLogCwd(), scope: 'scheduler', level, message, meta });
320
320
  } catch { /* durable logging must never block recovery */ }
321
321
  console.error(`[queueStore] ${message}`);
@@ -12,7 +12,7 @@
12
12
  */
13
13
  'use strict';
14
14
 
15
- const { appendAuditEvent } = require('./auditLog.cjs');
15
+ const { appendAuditEvent } = require('../telemetry/auditLog.cjs');
16
16
  const { isProvablyDead, DEFAULT_GRACE_MS } = require('./reservationExpiry.cjs');
17
17
 
18
18
  // slug of the job currently holding the lease, or null.
@@ -32,10 +32,10 @@
32
32
 
33
33
  const fs = require('node:fs');
34
34
  const path = require('node:path');
35
- const { splitFrontmatter } = require('./prdFrontmatter.cjs');
36
- const { readTail } = require('./fileTail.cjs');
37
- const { resolvePrdWriteDir } = require('./prdLocations.cjs');
38
- const atomicFs = require('./atomicFs.cjs');
35
+ const { splitFrontmatter } = require('../prd/prdFrontmatter.cjs');
36
+ const { readTail } = require('../util/fileTail.cjs');
37
+ const { resolvePrdWriteDir } = require('../prd/prdLocations.cjs');
38
+ const atomicFs = require('../util/atomicFs.cjs');
39
39
 
40
40
  // ─── VERDICT_LABELS — deliberate duplicate ──────────────────────────────────
41
41
  // Mirrors src/renderer/components/tabs/scheduler/sched-primitives.tsx:123-131.
@@ -9,9 +9,9 @@
9
9
 
10
10
  const fs = require('node:fs');
11
11
  const path = require('node:path');
12
- const { readTail } = require('./fileTail.cjs');
13
- const { detectRateLimitInLog } = require('./rateLimitDetect.cjs');
14
- const { pidAlive } = require('./pidAlive.cjs');
12
+ const { readTail } = require('../util/fileTail.cjs');
13
+ const { detectRateLimitInLog } = require('../claude/rateLimitDetect.cjs');
14
+ const { pidAlive } = require('../process/pidAlive.cjs');
15
15
 
16
16
  /**
17
17
  * Return true if pid is alive AND its cmdline looks like a claude process.
@@ -9,27 +9,20 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
- const { pidAlive } = require('./pidAlive.cjs');
12
+ const { pidAlive } = require('../process/pidAlive.cjs');
13
13
 
14
14
  const DEFAULT_GRACE_MS = 10 * 60 * 1000;
15
15
 
16
- // Thin alias over pidAlive.cjs's shared pidAlive() — kept as its own named
17
- // export (rather than inlining the require at every call site) so existing
18
- // imports of `defaultPidAlive` from this module keep working unchanged.
19
- function defaultPidAlive(pid) {
20
- return pidAlive(pid);
21
- }
22
-
23
16
  /**
24
17
  * @param {{ claimedAt: number, pid: number|null }} res
25
18
  * @param {{ live: boolean, pidAlive?: (pid:number)=>boolean, now: number, graceMs?: number }} ctx
26
19
  */
27
- function isProvablyDead(res, { live, pidAlive = defaultPidAlive, now, graceMs = DEFAULT_GRACE_MS }) {
20
+ function isProvablyDead(res, { live, pidAlive: isAlive = pidAlive, now, graceMs = DEFAULT_GRACE_MS }) {
28
21
  if (live) return false;
29
22
  // Made after the pass began (i.e. this tick) — never expire it.
30
23
  if (!Number.isFinite(res.claimedAt) || res.claimedAt > now) return false;
31
- if (Number.isInteger(res.pid) && res.pid > 0) return !pidAlive(res.pid);
24
+ if (Number.isInteger(res.pid) && res.pid > 0) return !isAlive(res.pid);
32
25
  return now - res.claimedAt > graceMs;
33
26
  }
34
27
 
35
- module.exports = { isProvablyDead, defaultPidAlive, DEFAULT_GRACE_MS };
28
+ module.exports = { isProvablyDead, DEFAULT_GRACE_MS };
@@ -43,7 +43,7 @@ const DEFAULT_HOLD_MINUTES = 240;
43
43
  // `NN-`) — reused here, not reimplemented, so formatReviewNotice's "blocks"
44
44
  // wording can never disagree with what actually holds a dependent `pending`
45
45
  // row in the real queue.
46
- const { bareSlug } = require('./depSlugResolve.cjs');
46
+ const { bareSlug } = require('../prd/depSlugResolve.cjs');
47
47
 
48
48
  /**
49
49
  * buildReviewNotice({ job, report, epicId, now, prior }) → ReviewNotice
@@ -30,8 +30,8 @@
30
30
  */
31
31
  'use strict';
32
32
 
33
- const { appendAuditEvent } = require('./auditLog.cjs');
34
- const telemetryCounters = require('./telemetryCounters.cjs');
33
+ const { appendAuditEvent } = require('../telemetry/auditLog.cjs');
34
+ const telemetryCounters = require('../telemetry/telemetryCounters.cjs');
35
35
  const queueHistory = require('./queueHistory.cjs');
36
36
  const { buildNeedsReviewEntryLine, buildNeedsReviewResolutionLine } = require('./needsReviewLedger.cjs');
37
37
 
@@ -42,7 +42,7 @@ const { buildNeedsReviewEntryLine, buildNeedsReviewResolutionLine } = require('.
42
42
  const FINISH_STATUSES = new Set(['completed', 'failed', 'skipped', 'needs_review']);
43
43
 
44
44
  // Bounded so queue.json (mutation cost, broadcast payload, pickNextBatch
45
- // scan) stays small — same rationale as lib/queueHistory.cjs's retention
45
+ // scan) stays small — same rationale as lib/scheduler/queueHistory.cjs's retention
46
46
  // window.
47
47
  const STATUS_HISTORY_CAP = 20;
48
48
 
@@ -15,7 +15,7 @@
15
15
  const path = require('node:path');
16
16
  const os = require('node:os');
17
17
  const { projectJobCap, quietMachineWaitMs } = require('./schedulerConfig.cjs');
18
- const { bareSlug } = require('./depSlugResolve.cjs');
18
+ const { bareSlug } = require('../prd/depSlugResolve.cjs');
19
19
 
20
20
  const DEFAULT_PROJECT_CWD = path.join(os.homedir(), 'Projects', 'session-manager');
21
21
 
@@ -250,7 +250,7 @@ function pickForProject(projectJobs, runningSlugsInProject, slots, heldSlugs = n
250
250
  // (evaluated before this function is ever called) is the only path that
251
251
  // can fire one, since dispatching one is a whole-tick, all-projects
252
252
  // exclusive decision this per-project function can't see.
253
- // Launch-gate holds (lib/launchFailure.cjs, issue #11): a pending row
253
+ // Launch-gate holds (lib/scheduler/launchFailure.cjs, issue #11): a pending row
254
254
  // whose launch persona is circuit-broken is NOT a candidate this tick and
255
255
  // must not shadow a pickable sibling behind it. It still gets a per-row
256
256
  // hold record so the Queue UI says why it is waiting.
@@ -68,7 +68,7 @@ module.exports = {
68
68
  RECONCILE_SLOW_PASS_MS: 2_000,
69
69
  // Terminal (completed/failed) jobs older than this move from queue.json's
70
70
  // hot jobs[] into the append-only history.jsonl sidecar. See
71
- // src/main/lib/queueHistory.cjs.
71
+ // src/main/lib/scheduler/queueHistory.cjs.
72
72
  HISTORY_RETENTION_MS: 7 * 24 * 60 * 60_000,
73
73
  // Cadence for the in-app intraday refresher that keeps TODAY's History
74
74
  // rollup line current (see historyAggregator.cjs's refreshIntradayToday).
@@ -7,7 +7,7 @@
7
7
  */
8
8
  'use strict';
9
9
 
10
- const { appendAuditEvent } = require('./auditLog.cjs');
10
+ const { appendAuditEvent } = require('../telemetry/auditLog.cjs');
11
11
  const { isProvablyDead, DEFAULT_GRACE_MS } = require('./reservationExpiry.cjs');
12
12
 
13
13
  const investigations = new Map(); // slug -> { claimedAt, pid }
@@ -27,8 +27,8 @@ const crypto = require('node:crypto');
27
27
  const fs = require('node:fs');
28
28
  const path = require('node:path');
29
29
  const { sessionSlotsConfigPath } = require('./schedulerPaths.cjs');
30
- const { appendAuditEvent } = require('./auditLog.cjs');
31
- const atomicFs = require('./atomicFs.cjs');
30
+ const { appendAuditEvent } = require('../telemetry/auditLog.cjs');
31
+ const atomicFs = require('../util/atomicFs.cjs');
32
32
  const { isProvablyDead, DEFAULT_GRACE_MS } = require('./reservationExpiry.cjs');
33
33
 
34
34
  const MIN_SLOTS = 0;
@@ -24,7 +24,7 @@
24
24
  const fs = require('node:fs');
25
25
  const path = require('node:path');
26
26
  const schedulerPaths = require('./schedulerPaths.cjs');
27
- const atomicFs = require('./atomicFs.cjs');
27
+ const atomicFs = require('../util/atomicFs.cjs');
28
28
 
29
29
  // Observed max job run is 240 min; 4 h converts a stuck drain to an abort.
30
30
  const DEFAULT_DRAIN_DEADLINE_MS = 4 * 60 * 60_000;
@@ -32,11 +32,8 @@ const DEFAULT_DRAIN_DEADLINE_MS = 4 * 60 * 60_000;
32
32
  // relaunch is picked up by the watchdog again.
33
33
  const RESTARTING_MARKER_TTL_MS = 5 * 60_000;
34
34
 
35
- function writeJsonAtomicSync(file, value) {
36
- atomicFs.writeJsonAtomicSync(file, value);
37
- }
38
-
39
- function readJsonSafe(file) {
35
+ /** Object-or-null view over atomicFs.readJsonOrSync (arrays/scalars → null). */
36
+ function readJsonObject(file) {
40
37
  const v = atomicFs.readJsonOrSync(file, null);
41
38
  return v && typeof v === 'object' ? v : null;
42
39
  }
@@ -44,7 +41,7 @@ function readJsonSafe(file) {
44
41
  // ---------- request file ----------
45
42
 
46
43
  function readRestartRequest(file = schedulerPaths.restartRequestPath()) {
47
- return readJsonSafe(file);
44
+ return readJsonObject(file);
48
45
  }
49
46
 
50
47
  /**
@@ -60,7 +57,7 @@ function requestRestart({ reason, requestedBy } = {}, { file = schedulerPaths.re
60
57
  requestedBy: typeof requestedBy === 'string' && requestedBy ? requestedBy : 'unknown',
61
58
  requestedAt: new Date(now).toISOString(),
62
59
  };
63
- writeJsonAtomicSync(file, request);
60
+ atomicFs.writeJsonAtomicSync(file, request);
64
61
  return request;
65
62
  }
66
63
 
@@ -69,7 +66,7 @@ function stampDrainCompleted(now = Date.now(), file = schedulerPaths.restartRequ
69
66
  const existing = readRestartRequest(file);
70
67
  if (!existing) return null;
71
68
  const stamped = { ...existing, drainCompletedAt: new Date(now).toISOString() };
72
- writeJsonAtomicSync(file, stamped);
69
+ atomicFs.writeJsonAtomicSync(file, stamped);
73
70
  return stamped;
74
71
  }
75
72
 
@@ -151,7 +148,7 @@ function installedBuildDiffers({ running, installed } = {}) {
151
148
  // ---------- restarting marker (watchdog) ----------
152
149
 
153
150
  function markRestarting({ file = schedulerPaths.restartingMarkerPath(), now = Date.now(), ttlMs = RESTARTING_MARKER_TTL_MS } = {}) {
154
- writeJsonAtomicSync(file, { pid: process.pid, at: now, expiresAt: now + ttlMs });
151
+ atomicFs.writeJsonAtomicSync(file, { pid: process.pid, at: now, expiresAt: now + ttlMs });
155
152
  }
156
153
 
157
154
  function clearRestartingMarker(file = schedulerPaths.restartingMarkerPath()) {
@@ -160,7 +157,7 @@ function clearRestartingMarker(file = schedulerPaths.restartingMarkerPath()) {
160
157
 
161
158
  /** True while the marker exists and has not expired (bounded lifetime). */
162
159
  function isRestartingMarkerActive({ file = schedulerPaths.restartingMarkerPath(), now = Date.now() } = {}) {
163
- const m = readJsonSafe(file);
160
+ const m = readJsonObject(file);
164
161
  return Boolean(m) && typeof m.expiresAt === 'number' && now < m.expiresAt;
165
162
  }
166
163
 
@@ -7,9 +7,9 @@ const fs = require('node:fs');
7
7
  const path = require('node:path');
8
8
  const schedulerPaths = require('./schedulerPaths.cjs');
9
9
  const { isRestartingMarkerActive } = require('./upgradeDrain.cjs');
10
- const { pidAlive: pidAliveCore } = require('./pidAlive.cjs');
11
- const atomicFs = require('./atomicFs.cjs');
12
- const { isPackagedApp } = require('./appRuntime.cjs');
10
+ const { pidAlive } = require('../process/pidAlive.cjs');
11
+ const atomicFs = require('../util/atomicFs.cjs');
12
+ const { isPackagedApp } = require('../appRuntime.cjs');
13
13
 
14
14
 
15
15
 
@@ -142,19 +142,6 @@ function evaluateDispatchLiveness(entry, now = Date.now(), { deadMs = DEFAULT_DI
142
142
  return { dead: true, reason: 'dispatch-dead' };
143
143
  }
144
144
 
145
- /**
146
- * isPidAlive(pid) → boolean
147
- *
148
- * Thin alias over pidAlive.cjs's shared pidAlive() — single source of truth
149
- * for the "is this recorded pid still alive" check used by
150
- * checkAppLiveness's defense-in-depth relaunch gate. Kept as a named export
151
- * here (rather than inlining the require at every call site) so existing
152
- * imports of `isPidAlive` from this module keep working unchanged.
153
- */
154
- function isPidAlive(pid) {
155
- return pidAliveCore(pid);
156
- }
157
-
158
145
  // Offline queue.json reconciliation (orphaned 'running' jobs whose pid died
159
146
  // while Electron wasn't running) used to live here as reconcileQueueOffline().
160
147
  // PRD 686 moved that responsibility into src/main/scheduler.cjs's own boot
@@ -188,7 +175,7 @@ function checkAppLiveness({
188
175
  return { alive: true, reason: 'heartbeat-fresh' };
189
176
  }
190
177
  const last = readLastHeartbeat(heartbeatPath);
191
- if (last !== null && typeof last.pid === 'number' && isPidAlive(last.pid)) {
178
+ if (last !== null && typeof last.pid === 'number' && pidAlive(last.pid)) {
192
179
  return { alive: true, reason: 'pid-alive-heartbeat-stale' };
193
180
  }
194
181
  return { alive: false, reason: 'stale-and-dead' };
@@ -408,7 +395,7 @@ function releaseLock(lockPath) {
408
395
  * dependency fails inside maybeFinalizeHistory's try/catch, not at require
409
396
  * time for the whole watchdog script. */
410
397
  function defaultFinalizeClosedDays(opts) {
411
- const { finalizeClosedDays } = require('../historyAggregator.cjs');
398
+ const { finalizeClosedDays } = require('../../historyAggregator.cjs');
412
399
  return finalizeClosedDays(opts);
413
400
  }
414
401
 
@@ -470,7 +457,6 @@ module.exports = {
470
457
  readLastHeartbeatTs,
471
458
  heartbeatFresh,
472
459
  evaluateDispatchLiveness,
473
- isPidAlive,
474
460
  localDateStr,
475
461
  maybeFinalizeHistory,
476
462
  tryAcquireLock,
@@ -18,7 +18,7 @@
18
18
  const fs = require('node:fs');
19
19
  const path = require('node:path');
20
20
 
21
- const { auditLogPath } = require('./schedulerPaths.cjs');
21
+ const { auditLogPath } = require('../scheduler/schedulerPaths.cjs');
22
22
 
23
23
  /**
24
24
  * Best-effort identity of the process making this call — there is no
@@ -14,8 +14,8 @@
14
14
  const fs = require('node:fs');
15
15
  const os = require('node:os');
16
16
  const path = require('node:path');
17
- const { assertOpsWrite } = require('./opsOwnership.cjs');
18
- const { isEphemeralCwd } = require('./ephemeralCwd.cjs');
17
+ const { assertOpsWrite } = require('../opsOwnership.cjs');
18
+ const { isEphemeralCwd } = require('../ephemeralCwd.cjs');
19
19
 
20
20
  // Same redaction policy as logs.cjs's sanitizeMeta — kept independent (not
21
21
  // shared/required) so this module has no dependency on the Electron `app`
@@ -33,7 +33,7 @@ function sanitizeMeta(meta) {
33
33
  }
34
34
 
35
35
  function logsDir(cwd) {
36
- const { opsPath } = require('./opsOwnership.cjs');
36
+ const { opsPath } = require('../opsOwnership.cjs');
37
37
  return opsPath(cwd, 'logs');
38
38
  }
39
39
 
@@ -108,7 +108,7 @@ function writeLocalLine({ cwd, scope, level, tabId, epicId, tags, message, meta
108
108
  function reportToTelemetry({ cwd, scope, level, tabId, epicId, tags, message }) {
109
109
  try {
110
110
  const telemetryClient = require('./telemetryClient.cjs');
111
- const { projectRootOf } = require('./activeSessions.cjs');
111
+ const { projectRootOf } = require('../activeSessions.cjs');
112
112
  const normalizedCwd = projectRootOf(cwd) || cwd;
113
113
  const autoTags = [
114
114
  `scope:${scope || 'unknown'}`,
@@ -70,7 +70,7 @@ const os = require('node:os');
70
70
  const path = require('node:path');
71
71
  const crypto = require('node:crypto');
72
72
 
73
- const config = require('../config.cjs');
73
+ const config = require('../../config.cjs');
74
74
 
75
75
  const DEFAULT_LIMIT = 500;
76
76
  const RETENTION_DAYS = 30;
@@ -97,9 +97,9 @@ function watermarksPath() {
97
97
 
98
98
  function resolveDeps(deps = {}) {
99
99
  return {
100
- sessionsStore: deps.sessionsStore || require('../sessionsStore.cjs'),
101
- isEphemeralCwd: deps.isEphemeralCwd || require('./ephemeralCwd.cjs').isEphemeralCwd,
102
- resolveProjectContext: deps.resolveProjectContext || require('./projectRootResolve.cjs').resolveProjectContext,
100
+ sessionsStore: deps.sessionsStore || require('../../sessionsStore.cjs'),
101
+ isEphemeralCwd: deps.isEphemeralCwd || require('../ephemeralCwd.cjs').isEphemeralCwd,
102
+ resolveProjectContext: deps.resolveProjectContext || require('../projectRootResolve.cjs').resolveProjectContext,
103
103
  telemetryClient: deps.telemetryClient || require('./telemetryClient.cjs'),
104
104
  opsErrorLog: deps.opsErrorLog || require('./opsErrorLog.cjs'),
105
105
  config: deps.config || config,
@@ -22,7 +22,7 @@ function resolveDeps(deps = {}) {
22
22
  return {
23
23
  telemetrySettings: deps.telemetrySettings || require('./telemetrySettings.cjs'),
24
24
  telemetryClient: deps.telemetryClient || require('./telemetryClient.cjs'),
25
- buildMachineProfile: deps.buildMachineProfile || require('./machineProfile.cjs').buildMachineProfile,
25
+ buildMachineProfile: deps.buildMachineProfile || require('../machineProfile.cjs').buildMachineProfile,
26
26
  telemetryCounters: deps.telemetryCounters || require('./telemetryCounters.cjs'),
27
27
  };
28
28
  }
@@ -20,7 +20,7 @@
20
20
  * returned promise resolves once accepted/dropped, but callers are free to
21
21
  * not await it). Telemetry failing must stay invisible to the user.
22
22
  *
23
- * Single-writer precedent (../lib/instanceLock.cjs): this module assumes the
23
+ * Single-writer precedent (../lib/process/instanceLock.cjs): this module assumes the
24
24
  * app's main process is the only writer of the queue/sent-set files for a
25
25
  * given machine. It does not itself arbitrate multiple OS processes.
26
26
  *
@@ -35,9 +35,9 @@ const os = require('node:os');
35
35
  const path = require('node:path');
36
36
  const crypto = require('node:crypto');
37
37
 
38
- const config = require('../config.cjs');
38
+ const config = require('../../config.cjs');
39
39
  const telemetrySettings = require('./telemetrySettings.cjs');
40
- const machineProfile = require('./machineProfile.cjs');
40
+ const machineProfile = require('../machineProfile.cjs');
41
41
 
42
42
  const MAX_BATCH = 50;
43
43
  const QUEUE_CAP_COUNT = 5000;
@@ -104,7 +104,7 @@ const S = {
104
104
  */
105
105
  function logWarn(message, meta) {
106
106
  try {
107
- const fn = S.logger || require('../logs.cjs').writeLine;
107
+ const fn = S.logger || require('../../logs.cjs').writeLine;
108
108
  fn({ scope: 'telemetry', level: 'warn', message, meta });
109
109
  } catch { /* logs unavailable outside an Electron runtime */ }
110
110
  }
@@ -26,7 +26,7 @@ const fsp = require('node:fs/promises');
26
26
  const path = require('node:path');
27
27
  const os = require('node:os');
28
28
  const crypto = require('node:crypto');
29
- const config = require('../config.cjs');
29
+ const config = require('../../config.cjs');
30
30
 
31
31
  const SCHEMA_VERSION = 1;
32
32
  const DAY_MS = 24 * 60 * 60 * 1000;
package/src/main/logs.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const { app, ipcMain } = require('electron');
2
2
  const fs = require('node:fs');
3
3
  const path = require('node:path');
4
- const opsErrorLog = require('./lib/opsErrorLog.cjs');
4
+ const opsErrorLog = require('./lib/telemetry/opsErrorLog.cjs');
5
5
 
6
6
  // Rolling daily files under <userData>/logs/. Anything mtime'd older than
7
7
  // RETENTION_MS is pruned at boot; we never compact mid-session, since the