claude-code-session-manager 0.111.0 → 0.113.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 (290) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/dist/assets/{AgentLibrary-rBO1daqM.js → AgentLibrary-wvrcLGGS.js} +2 -2
  3. package/dist/assets/{Button-DsEYRZg0.js → Button-B6h0F0XT.js} +1 -1
  4. package/dist/assets/{DataModel-D8sbvvBC.js → DataModel-C5pW9E3u.js} +1 -1
  5. package/dist/assets/{History-BEHLtxia.js → History-BV4e8YOM.js} +2 -2
  6. package/dist/assets/{Hooks-CKpvlXrg.js → Hooks-CrFSv4x1.js} +3 -3
  7. package/dist/assets/{Library-CeF4qh9d.js → Library-D-GIt3EY.js} +5 -5
  8. package/dist/assets/{ListDetail-DcfmxPFk.js → ListDetail-Bco_wfs6.js} +1 -1
  9. package/dist/assets/{MarkdownEditor-CvK1pyto.js → MarkdownEditor-C-yHSXNV.js} +1 -1
  10. package/dist/assets/{McpServers-D-h2ihzJ.js → McpServers-CfDekadG.js} +2 -2
  11. package/dist/assets/{Memory-BnF89x8v.js → Memory-CGGLexkR.js} +4 -4
  12. package/dist/assets/{Panel-CQY5zano.js → Panel-DGMEuYYG.js} +1 -1
  13. package/dist/assets/{Permissions-DLukmmsz.js → Permissions-Cx2zjtYZ.js} +3 -3
  14. package/dist/assets/{Plugins-0Pf0OZ4l.js → Plugins-Bc_W3IyR.js} +2 -2
  15. package/dist/assets/ProvenanceBadge-DiKAUR1u.js +1 -0
  16. package/dist/assets/RemoteMachines-8_77-WPD.js +3 -0
  17. package/dist/assets/{SaveBar-DjijiUb0.js → SaveBar-Blpzdq1R.js} +1 -1
  18. package/dist/assets/{Scheduler-Cm3EXZvE.js → Scheduler-Bd70AM4X.js} +9 -9
  19. package/dist/assets/{ScopeSwitcher-B-P-kSfq.js → ScopeSwitcher-wxN0h4YW.js} +1 -1
  20. package/dist/assets/Settings-CQ7DA3zW.js +4 -0
  21. package/dist/assets/{SkillReferenceGraph-Epv2GJmj.js → SkillReferenceGraph-DH1NLOiS.js} +1 -1
  22. package/dist/assets/Skills-CmyRyu4_.js +2 -0
  23. package/dist/assets/SystemPrompt-KAc3UMCd.js +1 -0
  24. package/dist/assets/TagLibrary-C8EvHnpg.js +1 -0
  25. package/dist/assets/{TiptapBody-DAMO3DhO.js → TiptapBody-d423mH6D.js} +1 -1
  26. package/dist/assets/{Toggle-Ba_f7q_m.js → Toggle-D1wsGE9S.js} +1 -1
  27. package/dist/assets/{ViewTabs-CGX6MAhc.js → ViewTabs-CjHw3kGY.js} +1 -1
  28. package/dist/assets/{historyTotals-vgfk8EOL.js → historyTotals-DFHzqLt7.js} +1 -1
  29. package/dist/assets/{index-CPieAFsl.js → index-Ci1u018F.js} +266 -266
  30. package/dist/assets/{settingsSchema-D0FxNrTy.js → settingsSchema-Ctf3pZVI.js} +1 -1
  31. package/dist/assets/{useAgentsDirWatch-DCu6BNYN.js → useAgentsDirWatch-B1NBmOAe.js} +1 -1
  32. package/dist/assets/{useRemotePeers-D4cdJDyh.js → useRemotePeers-BHjSJs9D.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/plugins/session-manager-dev/skills/send-feedback/SKILL.md +13 -0
  42. package/scripts/README.md +3 -3
  43. package/scripts/audit-ops-hygiene.cjs +4 -4
  44. package/scripts/hooks/guard-destructive-git.cjs +4 -4
  45. package/scripts/hooks/guard-inline-implementation.cjs +1 -1
  46. package/scripts/hooks/guard-prd-writes.cjs +2 -2
  47. package/scripts/hooks/lib/guard-destructive-git-policy.cjs +1 -1
  48. package/scripts/mint-epic.cjs +2 -2
  49. package/scripts/scheduler-mcp-server.cjs +27 -9
  50. package/src/main/agentLibrary.cjs +5 -5
  51. package/src/main/agentsIpc.cjs +76 -0
  52. package/src/main/build-info.json +4 -4
  53. package/src/main/chatRunner.cjs +30 -13
  54. package/src/main/config.cjs +20 -3
  55. package/src/main/crashDiagnostics.cjs +2 -2
  56. package/src/main/docEdit.cjs +5 -5
  57. package/src/main/files.cjs +2 -2
  58. package/src/main/git.cjs +1 -1
  59. package/src/main/health.cjs +20 -18
  60. package/src/main/heapSnapshot.cjs +1 -1
  61. package/src/main/historyAggregator.cjs +2 -2
  62. package/src/main/index.cjs +50 -132
  63. package/src/main/ipcSchemas.cjs +13 -10
  64. package/src/main/lib/CLAUDE.md +48 -0
  65. package/src/main/lib/activeSessions.cjs +14 -1
  66. package/src/main/lib/classifyPromptTicket.cjs +2 -2
  67. package/src/main/lib/{agentModelResolve.cjs → claude/agentModelResolve.cjs} +7 -7
  68. package/src/main/lib/{claudeBin.cjs → claude/claudeBin.cjs} +4 -4
  69. package/src/main/lib/{effectiveModelInfo.cjs → claude/effectiveModelInfo.cjs} +9 -9
  70. package/src/main/lib/{modelCatalog.cjs → claude/modelCatalog.cjs} +3 -3
  71. package/src/main/lib/claude/rateLimitDetect.cjs +54 -0
  72. package/src/main/lib/{rateLimitWindow.cjs → claude/rateLimitWindow.cjs} +24 -12
  73. package/src/main/lib/{runClaudeP.cjs → claude/runClaudeP.cjs} +1 -1
  74. package/src/main/lib/credentials.cjs +18 -92
  75. package/src/main/lib/cwdClassify.cjs +1 -1
  76. package/src/main/lib/{activeIndexMerge.cjs → epic/activeIndexMerge.cjs} +3 -3
  77. package/src/main/lib/{activeIndexRebuild.cjs → epic/activeIndexRebuild.cjs} +1 -1
  78. package/src/main/lib/{delegationReadiness.cjs → epic/delegationReadiness.cjs} +21 -29
  79. package/src/main/lib/{epicContextDigest.cjs → epic/epicContextDigest.cjs} +1 -1
  80. package/src/main/lib/{epicDelegationStats.cjs → epic/epicDelegationStats.cjs} +2 -2
  81. package/src/main/lib/{epicMint.cjs → epic/epicMint.cjs} +11 -11
  82. package/src/main/lib/{epicSpawnPlan.cjs → epic/epicSpawnPlan.cjs} +3 -3
  83. package/src/main/lib/{epicStatusMirror.cjs → epic/epicStatusMirror.cjs} +2 -2
  84. package/src/main/lib/{epicTranscriptDiagnostic.cjs → epic/epicTranscriptDiagnostic.cjs} +2 -2
  85. package/src/main/lib/{epicTranscriptPath.cjs → epic/epicTranscriptPath.cjs} +2 -2
  86. package/src/main/lib/{epicValidationHook.cjs → epic/epicValidationHook.cjs} +3 -3
  87. package/src/main/lib/{epicWorktreeBoot.cjs → epic/epicWorktreeBoot.cjs} +1 -1
  88. package/src/main/lib/{epicWorktreeMerge.cjs → epic/epicWorktreeMerge.cjs} +3 -3
  89. package/src/main/lib/{epicWorktreeMint.cjs → epic/epicWorktreeMint.cjs} +3 -3
  90. package/src/main/lib/{epicWorktreeProjectConfig.cjs → epic/epicWorktreeProjectConfig.cjs} +4 -4
  91. package/src/main/lib/{promptSessionsCreateEpic.cjs → epic/promptSessionsCreateEpic.cjs} +4 -4
  92. package/src/main/lib/{crossProjectFeedback.cjs → feedback-remote/crossProjectFeedback.cjs} +114 -16
  93. package/src/main/lib/{customerFeedbackClient.cjs → feedback-remote/customerFeedbackClient.cjs} +3 -3
  94. package/src/main/lib/{customerFeedbackInbox.cjs → feedback-remote/customerFeedbackInbox.cjs} +2 -2
  95. package/src/main/lib/{customerFeedbackIpc.cjs → feedback-remote/customerFeedbackIpc.cjs} +1 -1
  96. package/src/main/lib/feedback-remote/humanPromptLedger.cjs +93 -0
  97. package/src/main/lib/{localAdminHttp.cjs → feedback-remote/localAdminHttp.cjs} +2 -2
  98. package/src/main/lib/{macroAdminRoutes.cjs → feedback-remote/macroAdminRoutes.cjs} +1 -1
  99. package/src/main/lib/{projectHomeAdminRoutes.cjs → feedback-remote/projectHomeAdminRoutes.cjs} +4 -4
  100. package/src/main/lib/{relayClientAuth.cjs → feedback-remote/relayClientAuth.cjs} +2 -2
  101. package/src/main/lib/{remoteClientSessions.cjs → feedback-remote/remoteClientSessions.cjs} +1 -1
  102. package/src/main/lib/{gitWorktree.cjs → git/gitWorktree.cjs} +7 -7
  103. package/src/main/lib/historyRollup.cjs +1 -1
  104. package/src/main/lib/importReferences.cjs +1 -1
  105. package/src/main/lib/machineProfile.cjs +1 -1
  106. package/src/main/lib/mcpToolCatalog.cjs +9 -3
  107. package/src/main/lib/openExternalApp.cjs +1 -1
  108. package/src/main/lib/opsOwnership.cjs +3 -3
  109. package/src/main/lib/{agentPersonaSchema.cjs → persona-macro/agentPersonaSchema.cjs} +2 -2
  110. package/src/main/lib/{macroLibrary.cjs → persona-macro/macroLibrary.cjs} +5 -5
  111. package/src/main/lib/{personaMerge.cjs → persona-macro/personaMerge.cjs} +4 -4
  112. package/src/main/lib/{depSlugResolve.cjs → prd/depSlugResolve.cjs} +16 -1
  113. package/src/main/lib/{prdAdminRoutes.cjs → prd/prdAdminRoutes.cjs} +7 -7
  114. package/src/main/lib/{prdAgentType.cjs → prd/prdAgentType.cjs} +3 -3
  115. package/src/main/lib/{prdCreate.cjs → prd/prdCreate.cjs} +12 -12
  116. package/src/main/lib/{prdDeclaredPaths.cjs → prd/prdDeclaredPaths.cjs} +1 -1
  117. package/src/main/lib/{prdGateFiles.cjs → prd/prdGateFiles.cjs} +1 -1
  118. package/src/main/lib/{prdLocations.cjs → prd/prdLocations.cjs} +2 -2
  119. package/src/main/lib/{prdMigration.cjs → prd/prdMigration.cjs} +3 -3
  120. package/src/main/lib/prereqs.cjs +2 -2
  121. package/src/main/lib/{instanceLock.cjs → process/instanceLock.cjs} +4 -11
  122. package/src/main/lib/{pidAlive.cjs → process/pidAlive.cjs} +1 -1
  123. package/src/main/lib/{procName.cjs → process/procName.cjs} +2 -2
  124. package/src/main/lib/{timeoutShim.cjs → process/timeoutShim.cjs} +1 -1
  125. package/src/main/lib/projectRootResolve.cjs +1 -1
  126. package/src/main/lib/promptSessionSchema.cjs +1 -1
  127. package/src/main/lib/{definitionOfDone.cjs → scheduler/definitionOfDone.cjs} +6 -12
  128. package/src/main/lib/scheduler/finalizeReason.cjs +30 -0
  129. package/src/main/lib/{fixChainDepth.cjs → scheduler/fixChainDepth.cjs} +1 -1
  130. package/src/main/lib/scheduler/flatSweepThrottle.cjs +17 -0
  131. package/src/main/lib/{jobDirtFilter.cjs → scheduler/jobDirtFilter.cjs} +1 -1
  132. package/src/main/lib/{jobSupervisorRecord.cjs → scheduler/jobSupervisorRecord.cjs} +1 -1
  133. package/src/main/lib/{launchFailure.cjs → scheduler/launchFailure.cjs} +2 -2
  134. package/src/main/lib/{queueStore.cjs → scheduler/queueStore.cjs} +6 -6
  135. package/src/main/lib/{quietMachineLease.cjs → scheduler/quietMachineLease.cjs} +1 -1
  136. package/src/main/lib/{rcaReport.cjs → scheduler/rcaReport.cjs} +4 -4
  137. package/src/main/lib/{reaperHelpers.cjs → scheduler/reaperHelpers.cjs} +3 -3
  138. package/src/main/lib/{reservationExpiry.cjs → scheduler/reservationExpiry.cjs} +4 -11
  139. package/src/main/lib/{reviewNotice.cjs → scheduler/reviewNotice.cjs} +1 -1
  140. package/src/main/lib/{runLogRetention.cjs → scheduler/runLogRetention.cjs} +34 -13
  141. package/src/main/lib/{scheduleJobTransitions.cjs → scheduler/scheduleJobTransitions.cjs} +3 -3
  142. package/src/main/lib/{schedulerBatch.cjs → scheduler/schedulerBatch.cjs} +9 -13
  143. package/src/main/lib/{schedulerConfig.cjs → scheduler/schedulerConfig.cjs} +1 -1
  144. package/src/main/lib/{schedulerRuntimeState.cjs → scheduler/schedulerRuntimeState.cjs} +1 -1
  145. package/src/main/lib/{sessionSlots.cjs → scheduler/sessionSlots.cjs} +2 -2
  146. package/src/main/lib/{upgradeDrain.cjs → scheduler/upgradeDrain.cjs} +8 -11
  147. package/src/main/lib/{watchdogHelpers.cjs → scheduler/watchdogHelpers.cjs} +5 -19
  148. package/src/main/lib/{auditLog.cjs → telemetry/auditLog.cjs} +1 -1
  149. package/src/main/lib/{opsErrorLog.cjs → telemetry/opsErrorLog.cjs} +4 -4
  150. package/src/main/lib/{telemetryBacklog.cjs → telemetry/telemetryBacklog.cjs} +4 -4
  151. package/src/main/lib/{telemetryBoot.cjs → telemetry/telemetryBoot.cjs} +1 -1
  152. package/src/main/lib/{telemetryClient.cjs → telemetry/telemetryClient.cjs} +12 -8
  153. package/src/main/lib/{telemetrySettings.cjs → telemetry/telemetrySettings.cjs} +1 -1
  154. package/src/main/lib/{atomicFs.cjs → util/atomicFs.cjs} +42 -0
  155. package/src/main/lib/{loopDelay.cjs → util/loopDelay.cjs} +1 -1
  156. package/src/main/logs.cjs +1 -1
  157. package/src/main/mcpStatus.cjs +2 -2
  158. package/src/main/memoryAggregate.cjs +3 -3
  159. package/src/main/memoryTool.cjs +1 -1
  160. package/src/main/otel.cjs +2 -2
  161. package/src/main/pluginInstall.cjs +29 -3
  162. package/src/main/projectBrief.cjs +6 -6
  163. package/src/main/projectPages.cjs +1 -1
  164. package/src/main/promptSessionEvents.cjs +2 -2
  165. package/src/main/pty.cjs +7 -7
  166. package/src/main/queueOps.cjs +6 -6
  167. package/src/main/remoteClient.cjs +4 -4
  168. package/src/main/remoteClientIpc.cjs +1 -1
  169. package/src/main/runVerify.cjs +6 -3
  170. package/src/main/scheduler/CLAUDE.md +26 -0
  171. package/src/main/scheduler/budget.cjs +576 -0
  172. package/src/main/scheduler/gitTreeGuard.cjs +672 -0
  173. package/src/main/scheduler/prdParser.cjs +4 -4
  174. package/src/main/scheduler/prdPaths.cjs +487 -0
  175. package/src/main/scheduler/reviewLadder.cjs +1011 -0
  176. package/src/main/scheduler/starvation.cjs +390 -0
  177. package/src/main/scheduler.cjs +331 -3320
  178. package/src/main/seedAgentPersonas.cjs +5 -5
  179. package/src/main/seedDevPlugin.cjs +70 -3
  180. package/src/main/seedSchedulerMcp.cjs +2 -2
  181. package/src/main/supervisor.cjs +50 -27
  182. package/src/main/telemetryIpc.cjs +51 -0
  183. package/src/main/transcripts.cjs +3 -3
  184. package/src/main/updaterIpc.cjs +1 -1
  185. package/src/main/usage.cjs +1 -1
  186. package/src/main/watchers.cjs +1 -1
  187. package/src/main/webRemote.cjs +22 -7
  188. package/src/preload/api.d.ts +14 -8
  189. package/src/preload/index.cjs +9 -3
  190. package/dist/assets/ProvenanceBadge-vC7Tj-JP.js +0 -1
  191. package/dist/assets/RemoteMachines-CWnKbFHc.js +0 -3
  192. package/dist/assets/Settings-DYDlp2m_.js +0 -4
  193. package/dist/assets/Skills-DHO0N0C2.js +0 -2
  194. package/dist/assets/SystemPrompt-DxeNofL9.js +0 -1
  195. package/dist/assets/TagLibrary-QOAs7ISO.js +0 -1
  196. package/plugins/session-manager-dev/skills/blog-for-project-feature/0-select/SKILL.md +0 -39
  197. package/plugins/session-manager-dev/skills/blog-for-project-feature/1-research/SKILL.md +0 -37
  198. package/plugins/session-manager-dev/skills/blog-for-project-feature/2-storyboard/SKILL.md +0 -64
  199. package/plugins/session-manager-dev/skills/blog-for-project-feature/3-capture/SKILL.md +0 -52
  200. package/plugins/session-manager-dev/skills/blog-for-project-feature/4-draft-copy/SKILL.md +0 -37
  201. package/plugins/session-manager-dev/skills/blog-for-project-feature/5-illustrate/SKILL.md +0 -50
  202. package/plugins/session-manager-dev/skills/blog-for-project-feature/6-compose/SKILL.md +0 -51
  203. package/plugins/session-manager-dev/skills/blog-for-project-feature/7-review/SKILL.md +0 -54
  204. package/plugins/session-manager-dev/skills/blog-for-project-feature/SKILL.md +0 -144
  205. package/plugins/session-manager-dev/skills/blog-for-project-feature/feature.config.yaml +0 -90
  206. package/plugins/session-manager-dev/skills/discover-features/SKILL.md +0 -95
  207. package/plugins/session-manager-dev/skills/explain-to-me/SKILL.md +0 -205
  208. package/plugins/session-manager-dev/skills/explain-to-me/assets/style-reference.html +0 -163
  209. package/plugins/session-manager-dev/skills/find-opportunity/SKILL.md +0 -83
  210. package/plugins/session-manager-dev/skills/issue-address/0-select/0-fetch-pool/SKILL.md +0 -38
  211. package/plugins/session-manager-dev/skills/issue-address/0-select/1-reject-fixed/SKILL.md +0 -64
  212. package/plugins/session-manager-dev/skills/issue-address/0-select/2-reject-claimed/SKILL.md +0 -71
  213. package/plugins/session-manager-dev/skills/issue-address/0-select/3-rank-impact/SKILL.md +0 -39
  214. package/plugins/session-manager-dev/skills/issue-address/0-select/SKILL.md +0 -75
  215. package/plugins/session-manager-dev/skills/issue-address/1-confirm-open/SKILL.md +0 -39
  216. package/plugins/session-manager-dev/skills/issue-address/2-claim/SKILL.md +0 -57
  217. package/plugins/session-manager-dev/skills/issue-address/3-reproduce/SKILL.md +0 -40
  218. package/plugins/session-manager-dev/skills/issue-address/4-fix/SKILL.md +0 -33
  219. package/plugins/session-manager-dev/skills/issue-address/5-verify/SKILL.md +0 -40
  220. package/plugins/session-manager-dev/skills/issue-address/SKILL.md +0 -120
  221. package/plugins/session-manager-dev/skills/local-project-health/SKILL.md +0 -58
  222. package/plugins/session-manager-dev/skills/memory-sanitation/SKILL.md +0 -147
  223. package/plugins/session-manager-dev/skills/ops-sweep/SKILL.md +0 -137
  224. package/plugins/session-manager-dev/skills/pr-review-sweep/0-fetch/SKILL.md +0 -41
  225. package/plugins/session-manager-dev/skills/pr-review-sweep/1-classify/SKILL.md +0 -56
  226. package/plugins/session-manager-dev/skills/pr-review-sweep/2-check-fixed/SKILL.md +0 -49
  227. package/plugins/session-manager-dev/skills/pr-review-sweep/3-queue/SKILL.md +0 -57
  228. package/plugins/session-manager-dev/skills/pr-review-sweep/4-land-and-resolve/SKILL.md +0 -60
  229. package/plugins/session-manager-dev/skills/pr-review-sweep/SKILL.md +0 -124
  230. package/plugins/session-manager-dev/skills/pr-signal/SKILL.md +0 -67
  231. package/plugins/session-manager-dev/skills/project-status/SKILL.md +0 -243
  232. package/plugins/session-manager-dev/skills/requesting-code-review/SKILL.md +0 -98
  233. package/plugins/session-manager-dev/skills/requesting-code-review/code-reviewer.md +0 -146
  234. package/src/main/lib/rateLimitDetect.cjs +0 -35
  235. /package/src/main/lib/{agentEffortResolve.cjs → claude/agentEffortResolve.cjs} +0 -0
  236. /package/src/main/lib/{claudeCliCaps.cjs → claude/claudeCliCaps.cjs} +0 -0
  237. /package/src/main/lib/{usageCircuit.cjs → claude/usageCircuit.cjs} +0 -0
  238. /package/src/main/lib/{epicSpawnCwd.cjs → epic/epicSpawnCwd.cjs} +0 -0
  239. /package/src/main/lib/{customerFeedbackAdminRoutes.cjs → feedback-remote/customerFeedbackAdminRoutes.cjs} +0 -0
  240. /package/src/main/lib/{remoteE2eCrypto.cjs → feedback-remote/remoteE2eCrypto.cjs} +0 -0
  241. /package/src/main/lib/{branchSweep.cjs → git/branchSweep.cjs} +0 -0
  242. /package/src/main/lib/{gitExec.cjs → git/gitExec.cjs} +0 -0
  243. /package/src/main/lib/{jobWorktree.cjs → git/jobWorktree.cjs} +0 -0
  244. /package/src/main/lib/{jobWorktreeBootLive.cjs → git/jobWorktreeBootLive.cjs} +0 -0
  245. /package/src/main/lib/{jobWorktreeTerminalOrphanLive.cjs → git/jobWorktreeTerminalOrphanLive.cjs} +0 -0
  246. /package/src/main/lib/{builtinMacros.cjs → persona-macro/builtinMacros.cjs} +0 -0
  247. /package/src/main/lib/{personaImportHealth.cjs → persona-macro/personaImportHealth.cjs} +0 -0
  248. /package/src/main/lib/{shippedPersonaSeeds.cjs → persona-macro/shippedPersonaSeeds.cjs} +0 -0
  249. /package/src/main/lib/{planValidator.cjs → prd/planValidator.cjs} +0 -0
  250. /package/src/main/lib/{prdAuthoringSeed.cjs → prd/prdAuthoringSeed.cjs} +0 -0
  251. /package/src/main/lib/{prdDisposition.cjs → prd/prdDisposition.cjs} +0 -0
  252. /package/src/main/lib/{prdFrontmatter.cjs → prd/prdFrontmatter.cjs} +0 -0
  253. /package/src/main/lib/{prdSizing.cjs → prd/prdSizing.cjs} +0 -0
  254. /package/src/main/lib/{workTypeLibrary.cjs → prd/workTypeLibrary.cjs} +0 -0
  255. /package/src/main/lib/{childWithLog.cjs → process/childWithLog.cjs} +0 -0
  256. /package/src/main/lib/{cleanEnv.cjs → process/cleanEnv.cjs} +0 -0
  257. /package/src/main/lib/{defaultShell.cjs → process/defaultShell.cjs} +0 -0
  258. /package/src/main/lib/{killTree.cjs → process/killTree.cjs} +0 -0
  259. /package/src/main/lib/{loginShellPath.cjs → process/loginShellPath.cjs} +0 -0
  260. /package/src/main/lib/{procIdentity.cjs → process/procIdentity.cjs} +0 -0
  261. /package/src/main/lib/{singleInstanceGuard.cjs → process/singleInstanceGuard.cjs} +0 -0
  262. /package/src/main/lib/{smProcNames.cjs → process/smProcNames.cjs} +0 -0
  263. /package/src/main/lib/{timeoutShimScript.cjs → process/timeoutShimScript.cjs} +0 -0
  264. /package/src/main/lib/{winSpawn.cjs → process/winSpawn.cjs} +0 -0
  265. /package/src/main/lib/{adoptedRunSupervisor.cjs → scheduler/adoptedRunSupervisor.cjs} +0 -0
  266. /package/src/main/lib/{dispatchLoop.cjs → scheduler/dispatchLoop.cjs} +0 -0
  267. /package/src/main/lib/{dodDrainHook.cjs → scheduler/dodDrainHook.cjs} +0 -0
  268. /package/src/main/lib/{fixPlanSlug.cjs → scheduler/fixPlanSlug.cjs} +0 -0
  269. /package/src/main/lib/{gateAuthority.cjs → scheduler/gateAuthority.cjs} +0 -0
  270. /package/src/main/lib/{landedSinceRun.cjs → scheduler/landedSinceRun.cjs} +0 -0
  271. /package/src/main/lib/{loadGate.cjs → scheduler/loadGate.cjs} +0 -0
  272. /package/src/main/lib/{needsReviewLedger.cjs → scheduler/needsReviewLedger.cjs} +0 -0
  273. /package/src/main/lib/{queueHealth.cjs → scheduler/queueHealth.cjs} +0 -0
  274. /package/src/main/lib/{queueHistory.cjs → scheduler/queueHistory.cjs} +0 -0
  275. /package/src/main/lib/{scheduleJobSchema.cjs → scheduler/scheduleJobSchema.cjs} +0 -0
  276. /package/src/main/lib/{schedulerPaths.cjs → scheduler/schedulerPaths.cjs} +0 -0
  277. /package/src/main/lib/{terminalRunOutcome.cjs → scheduler/terminalRunOutcome.cjs} +0 -0
  278. /package/src/main/lib/{validationSentinels.cjs → scheduler/validationSentinels.cjs} +0 -0
  279. /package/src/main/lib/{crashTelemetry.cjs → telemetry/crashTelemetry.cjs} +0 -0
  280. /package/src/main/lib/{otlpTraceExporter.cjs → telemetry/otlpTraceExporter.cjs} +0 -0
  281. /package/src/main/lib/{telemetryConsent.cjs → telemetry/telemetryConsent.cjs} +0 -0
  282. /package/src/main/lib/{telemetryCounters.cjs → telemetry/telemetryCounters.cjs} +0 -0
  283. /package/src/main/lib/{encodeCwd.cjs → util/encodeCwd.cjs} +0 -0
  284. /package/src/main/lib/{expandHome.cjs → util/expandHome.cjs} +0 -0
  285. /package/src/main/lib/{extractJson.cjs → util/extractJson.cjs} +0 -0
  286. /package/src/main/lib/{fileTail.cjs → util/fileTail.cjs} +0 -0
  287. /package/src/main/lib/{headTailBuffer.cjs → util/headTailBuffer.cjs} +0 -0
  288. /package/src/main/lib/{kebabCase.cjs → util/kebabCase.cjs} +0 -0
  289. /package/src/main/lib/{lruCache.cjs → util/lruCache.cjs} +0 -0
  290. /package/src/main/lib/{withTimeout.cjs → util/withTimeout.cjs} +0 -0
@@ -19,7 +19,7 @@
19
19
 
20
20
  const { readBody, sendJson } = require('./localAdminHttp.cjs');
21
21
  const { resolveCwd } = require('./projectHomeAdminRoutes.cjs');
22
- const macroLibrary = require('./macroLibrary.cjs');
22
+ const macroLibrary = require('../persona-macro/macroLibrary.cjs');
23
23
 
24
24
  function listHandler(onChanged, libOpts) {
25
25
  return async (_req, res, query) => {
@@ -23,10 +23,10 @@
23
23
  const fs = require('node:fs');
24
24
  const path = require('node:path');
25
25
  const { readBody, sendJson } = require('./localAdminHttp.cjs');
26
- const { resolveProjectContext } = require('./projectRootResolve.cjs');
27
- const { opsPath, OPS_ROOT_DIR } = require('./opsOwnership.cjs');
28
- const config = require('../config.cjs');
29
- const { schemas } = require('../ipcSchemas.cjs');
26
+ const { resolveProjectContext } = require('../projectRootResolve.cjs');
27
+ const { opsPath, OPS_ROOT_DIR } = require('../opsOwnership.cjs');
28
+ const config = require('../../config.cjs');
29
+ const { schemas } = require('../../ipcSchemas.cjs');
30
30
 
31
31
  const MAX_HTML_BYTES = 1024 * 1024;
32
32
  const MAX_DEMO_VIDEO_BYTES = 2 * 1024 * 1024;
@@ -8,8 +8,8 @@
8
8
  const fs = require('node:fs');
9
9
  const https = require('node:https');
10
10
  const path = require('node:path');
11
- const { claudeHome } = require('./schedulerPaths.cjs');
12
- const { writeJsonAtomicSync, readJsonOrSync } = require('./atomicFs.cjs');
11
+ const { claudeHome } = require('../scheduler/schedulerPaths.cjs');
12
+ const { writeJsonAtomicSync, readJsonOrSync } = require('../util/atomicFs.cjs');
13
13
 
14
14
  const RELAY_CLIENT_API_BASE = 'https://bilko.run/api/sm-relay';
15
15
  const REQUEST_TIMEOUT_MS = 15_000;
@@ -9,7 +9,7 @@
9
9
  * which preserves single-client behaviour.
10
10
  */
11
11
 
12
- const { makeState } = require('./e2eStateMachine.cjs')
12
+ const { makeState } = require('../e2eStateMachine.cjs')
13
13
 
14
14
  const LEGACY_CLIENT_KEY = 'legacy'
15
15
  const MAX_KEY_LEN = 64
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * `<cwd>/session-manager-operations/` (PRDs, queue state, run logs, the
18
18
  * active-index.json Epic store) is resolved from a project's cwd by
19
- * lib/prdLocations.cjs, lib/queueStore.cjs, and every prompt-sessions IPC
19
+ * lib/prd/prdLocations.cjs, lib/scheduler/queueStore.cjs, and every prompt-sessions IPC
20
20
  * handler — all of them take `cwd` as an explicit parameter, never
21
21
  * `process.cwd()`. That means the ops root follows WHATEVER cwd value the
22
22
  * caller passes in. A prior incident (recorded in this project's memory as
@@ -53,8 +53,8 @@ const fsp = require('node:fs/promises');
53
53
  const path = require('node:path');
54
54
  const os = require('node:os');
55
55
  const crypto = require('node:crypto');
56
- const { OPS_ROOT_DIR } = require('./opsOwnership.cjs');
57
- const schedulerPaths = require('./schedulerPaths.cjs');
56
+ const { OPS_ROOT_DIR } = require('../opsOwnership.cjs');
57
+ const schedulerPaths = require('../scheduler/schedulerPaths.cjs');
58
58
  const sharedGitExec = require('./gitExec.cjs');
59
59
 
60
60
  // Per-kind configuration. Roots are kept OUTSIDE any project's own tree
@@ -148,7 +148,7 @@ function worktreeRootFor(kind) {
148
148
  function isWorktreeDisabled(kind, cwd) {
149
149
  if (process.env[configFor(kind).disableEnv] === '1') return true;
150
150
  if (kind === 'epic' && cwd) {
151
- const { isEpicWorktreeDisabledForProject } = require('./epicWorktreeProjectConfig.cjs');
151
+ const { isEpicWorktreeDisabledForProject } = require('../epic/epicWorktreeProjectConfig.cjs');
152
152
  if (isEpicWorktreeDisabledForProject(cwd)) return true;
153
153
  }
154
154
  return false;
@@ -169,7 +169,7 @@ function getMaxConcurrentWorktrees(kind) {
169
169
  const raw = Number(process.env[cfg.maxEnv]);
170
170
  if (Number.isFinite(raw) && raw > 0) return Math.floor(raw);
171
171
  if (kind === 'job') {
172
- const sessionSlots = require('./sessionSlots.cjs');
172
+ const sessionSlots = require('../scheduler/sessionSlots.cjs');
173
173
  return Math.max(cfg.defaultMax, sessionSlots.totalSlots());
174
174
  }
175
175
  return cfg.defaultMax;
@@ -1546,7 +1546,7 @@ async function salvageWorktreeDiff({ cwd, outFile }) {
1546
1546
  }
1547
1547
  const patch = await execGit(['diff', 'HEAD', '--binary'], { cwd, timeout: 30_000 });
1548
1548
  if (!patch || !patch.trim()) return { ok: false };
1549
- const { writeTextAtomic } = require('../config.cjs');
1549
+ const { writeTextAtomic } = require('../../config.cjs');
1550
1550
  await writeTextAtomic(outFile, patch);
1551
1551
  return { ok: true, bytes: Buffer.byteLength(patch, 'utf8') };
1552
1552
  } catch {
@@ -1628,7 +1628,7 @@ async function salvageDirtyDelta({ cwd, paths, outFile }) {
1628
1628
  }
1629
1629
  }
1630
1630
  if (!patch.trim()) return { ok: false };
1631
- const { writeTextAtomic } = require('../config.cjs');
1631
+ const { writeTextAtomic } = require('../../config.cjs');
1632
1632
  await writeTextAtomic(outFile, patch);
1633
1633
  return { ok: true, bytes: Buffer.byteLength(patch, 'utf8') };
1634
1634
  } catch {
@@ -28,7 +28,7 @@
28
28
  const path = require('node:path');
29
29
  const config = require('../config.cjs');
30
30
 
31
- const { historyRollupPath } = require('./schedulerPaths.cjs');
31
+ const { historyRollupPath } = require('./scheduler/schedulerPaths.cjs');
32
32
  const COMPACT_THRESHOLD_BYTES = 5 * 1024 * 1024;
33
33
 
34
34
  const TOTALS_MODEL_ID = '';
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  const fs = require('node:fs');
10
- const { walkImports } = require('./personaImportHealth.cjs');
10
+ const { walkImports } = require('./persona-macro/personaImportHealth.cjs');
11
11
 
12
12
  // Maps walkImports' result shape to what the renderer panel needs per file:
13
13
  // resolved path, existence, size, a rough token estimate, and overall health.
@@ -15,7 +15,7 @@
15
15
  const os = require('node:os');
16
16
  const crypto = require('node:crypto');
17
17
  const path = require('node:path');
18
- const claudeBin = require('./claudeBin.cjs');
18
+ const claudeBin = require('./claude/claudeBin.cjs');
19
19
  const { isPackagedApp } = require('./appRuntime.cjs');
20
20
 
21
21
  function resolveElectronApp() {
@@ -243,7 +243,11 @@ const MCP_TOOL_CATALOG = [
243
243
  + '`acceptanceCriteria`; put evidence, symptom and references in `body`. Name the file in THEIR repo '
244
244
  + 'that looks responsible if you know it. When one request is split into several proposals, send '
245
245
  + 'them ALL with one shared `series` {key, title, total} (plus each one\'s `index`) and summarise '
246
- + 'the overall plan in each motivation.',
246
+ + 'the overall plan in each motivation. TWO MODES: (1) agent-initiated (your own idea) = PROPOSED, a '
247
+ + 'human in the receiving project must approve it; pass neither autoStart nor humanRequestQuote. '
248
+ + '(2) human-requested = the human in THIS conversation explicitly asked for the work in that other '
249
+ + 'project: pass `autoStart: true` plus `humanRequestQuote`, copied VERBATIM from their own message, '
250
+ + 'which must name the target project. An unverified request silently falls back to PROPOSED.',
247
251
  whenNotToUse: 'WHEN NOT TO USE IT: for work in the project you are ALREADY in, run /develop inside the Epic you '
248
252
  + 'are already in — this tool refuses toCwd === fromCwd outright.',
249
253
  exampleArgs: {
@@ -258,11 +262,13 @@ const MCP_TOOL_CATALOG = [
258
262
  series: { key: 'shared-admin-api-f', title: 'Shared admin API field F', index: 1, total: 2 },
259
263
  body: 'Symptom: X. Observed while doing Y in session-manager. Expected: Z. Suspected file: <path in their repo>.',
260
264
  },
261
- notes: 'WHAT THIS DOES NOT DO: it does not start anything, queue a PRD, or spend a token. The session '
265
+ notes: 'WHAT THIS DOES NOT DO: it never writes code or queues a PRD itself. Agent-initiated, the session '
262
266
  + 'lands as `proposed` and runs only if a human in the RECEIVING project presses "Approve & start". '
267
+ + 'With a verified autoStart + humanRequestQuote the result status is `auto-approved` and the session '
268
+ + 'starts on its own; otherwise it stays proposed (check the note for the reason). '
263
269
  + 'There is no callback and no reply channel — do not wait for an answer, and do not tell the user '
264
270
  + 'the other project has "been fixed" or "is working on it". Report only that the proposal was '
265
- + 'delivered.',
271
+ + 'delivered, or that the session was auto-approved and is starting.',
266
272
  },
267
273
  {
268
274
  name: 'project_home_write',
@@ -14,7 +14,7 @@ const { execFileSync, spawn } = require('node:child_process');
14
14
  const path = require('node:path');
15
15
  const fsp = require('node:fs/promises');
16
16
  const { shell } = require('electron');
17
- const { cleanChildEnv } = require('./cleanEnv.cjs');
17
+ const { cleanChildEnv } = require('./process/cleanEnv.cjs');
18
18
 
19
19
  // IMAGE_RE — extensions opened in the OS default viewer, not a code editor.
20
20
  // Keep in sync with the comment in index.cjs open-file-in-editor handler.
@@ -24,9 +24,9 @@
24
24
  *
25
25
  * Enforcement points (every write path into the ops root calls assertOpsWrite):
26
26
  * - config.cjs writeTextAtomic / writeBinaryAtomic / writeJson / writeJsonSync
27
- * - lib/epicMint.cjs (raw fs tmp+rename)
28
- * - lib/queueStore.cjs (raw fs tmp+rename)
29
- * - lib/opsErrorLog.cjs (raw fs append, JSONL error log)
27
+ * - lib/epic/epicMint.cjs (raw fs tmp+rename)
28
+ * - lib/scheduler/queueStore.cjs (raw fs tmp+rename)
29
+ * - lib/telemetry/opsErrorLog.cjs (raw fs append, JSONL error log)
30
30
  * Renderer callers declare their writer id through the IPC payload.
31
31
  */
32
32
 
@@ -24,8 +24,8 @@
24
24
 
25
25
  const path = require('node:path');
26
26
  const { z } = require('zod');
27
- const { WorkTypeSchema, LEGACY_WORK_TYPES } = require('./workTypeLibrary.cjs');
28
- const { PERSONA_NAME_RE, ALL_PROJECTS } = require('../agentLibrary.cjs');
27
+ const { WorkTypeSchema, LEGACY_WORK_TYPES } = require('../prd/workTypeLibrary.cjs');
28
+ const { PERSONA_NAME_RE, ALL_PROJECTS } = require('../../agentLibrary.cjs');
29
29
 
30
30
  // Bounded free-text fields — generous for legitimate persona authoring while
31
31
  // still blocking a renderer from writing an effectively-unbounded frontmatter
@@ -38,11 +38,11 @@ const fsp = require('node:fs/promises');
38
38
  const path = require('node:path');
39
39
  const crypto = require('node:crypto');
40
40
  const { z } = require('zod');
41
- const { writeJsonAtomic } = require('./atomicFs.cjs');
42
- const { EpicTagSchema } = require('./promptSessionSchema.cjs');
43
- const { WORK_TYPES } = require('./workTypeLibrary.cjs');
41
+ const { writeJsonAtomic } = require('../util/atomicFs.cjs');
42
+ const { EpicTagSchema } = require('../promptSessionSchema.cjs');
43
+ const { WORK_TYPES } = require('../prd/workTypeLibrary.cjs');
44
44
  const { PERSONA_NAME_RE } = require('./personaMerge.cjs');
45
- const { schedulerHome } = require('./schedulerPaths.cjs');
45
+ const { schedulerHome } = require('../scheduler/schedulerPaths.cjs');
46
46
  const { BUILTIN_MACROS } = require('./builtinMacros.cjs');
47
47
 
48
48
  const ALL_PROJECTS = '*';
@@ -306,7 +306,7 @@ function personasToMacros(personas, now) {
306
306
  /** Returns the migrated macros, or `null` on failure (caller must NOT write). */
307
307
  async function migrateFromPersonas(opts) {
308
308
  try {
309
- const listPersonas = (opts && opts.listPersonas) || require('../agentLibrary.cjs').listPersonas;
309
+ const listPersonas = (opts && opts.listPersonas) || require('../../agentLibrary.cjs').listPersonas;
310
310
  const personas = await listPersonas();
311
311
  return personasToMacros(personas, new Date().toISOString());
312
312
  } catch (err) {
@@ -33,9 +33,9 @@
33
33
  */
34
34
 
35
35
  const fs = require('node:fs');
36
- const { splitFrontmatter } = require('./prdFrontmatter.cjs');
37
- const { resolvePersonaPaths } = require('./epicMint.cjs');
38
- const configMgr = require('../config.cjs');
36
+ const { splitFrontmatter } = require('../prd/prdFrontmatter.cjs');
37
+ const { resolvePersonaPaths } = require('../epic/epicMint.cjs');
38
+ const configMgr = require('../../config.cjs');
39
39
 
40
40
  /** Filename-safe persona name: lowercase, hyphenated, matches the `.md` files on disk. */
41
41
  const PERSONA_NAME_RE = /^[a-z][a-z0-9-]*$/;
@@ -47,7 +47,7 @@ function reportOverlayIssueOnce(cwd, agentType, overlayPath, message) {
47
47
  if (reportedIssues.has(key)) return;
48
48
  reportedIssues.add(key);
49
49
  try {
50
- const { appendError } = require('./opsErrorLog.cjs');
50
+ const { appendError } = require('../telemetry/opsErrorLog.cjs');
51
51
  appendError({
52
52
  cwd,
53
53
  scope: 'personaMerge',
@@ -30,6 +30,21 @@ function resolveDepSlug(depSlug, candidateSlugs) {
30
30
  return candidateSlugs.filter((slug) => bareSlug(slug) === bare);
31
31
  }
32
32
 
33
+ /**
34
+ * Is this dep ROW satisfied? `completed`, or a `skipped` row stamped
35
+ * `needsReviewAutoResolvedSkip` — the bounded needs_review auto-resolve's
36
+ * terminal decision (scheduler.cjs applyNeedsReviewAutoResolve), deliberately
37
+ * not a permanent block. Shared by schedulerBatch.findBlockingDep (dispatch)
38
+ * and runVerify.checkDeps (post-run): when they disagreed, the picker fired a
39
+ * dependent of an auto-skipped row and the verifier downgraded every finished
40
+ * run back to pending on "is skipped (need completed)" — an unbounded billed
41
+ * re-run loop (Bilko-Launch-Kit validator, ~20 runs, 2026-10-11).
42
+ */
43
+ function isSatisfiedDepRow(row) {
44
+ return row?.status === 'completed'
45
+ || (row?.status === 'skipped' && row.needsReviewAutoResolvedSkip === true);
46
+ }
47
+
33
48
  /**
34
49
  * Levenshtein edit distance. O(n*m) in the two strings' lengths — fine here
35
50
  * since it only ever runs over short slug strings (<= 60 chars, PRD_CREATE_SLUG_RE's
@@ -69,4 +84,4 @@ function findNearMatches(depSlug, candidateSlugs, limit = 3) {
69
84
  .map((entry) => entry.slug);
70
85
  }
71
86
 
72
- module.exports = { bareSlug, resolveDepSlug, findNearMatches };
87
+ module.exports = { bareSlug, resolveDepSlug, findNearMatches, isSatisfiedDepRow };
@@ -25,13 +25,13 @@
25
25
  */
26
26
  'use strict';
27
27
 
28
- const { schemas } = require('../ipcSchemas.cjs');
29
- const { readBody, sendJson } = require('./localAdminHttp.cjs');
30
- const { appendAuditEvent } = require('./auditLog.cjs');
31
- const queueOps = require('../queueOps.cjs');
32
- const { MCP_TOOL_CATALOG, MCP_RECIPES } = require('./mcpToolCatalog.cjs');
33
- const { checkDelegationReadiness } = require('./delegationReadiness.cjs');
34
- const { resolveProjectContext } = require('./projectRootResolve.cjs');
28
+ const { schemas } = require('../../ipcSchemas.cjs');
29
+ const { readBody, sendJson } = require('../feedback-remote/localAdminHttp.cjs');
30
+ const { appendAuditEvent } = require('../telemetry/auditLog.cjs');
31
+ const queueOps = require('../../queueOps.cjs');
32
+ const { MCP_TOOL_CATALOG, MCP_RECIPES } = require('../mcpToolCatalog.cjs');
33
+ const { checkDelegationReadiness } = require('../epic/delegationReadiness.cjs');
34
+ const { resolveProjectContext } = require('../projectRootResolve.cjs');
35
35
 
36
36
  function parseJsonBody(raw) {
37
37
  try {
@@ -13,8 +13,8 @@
13
13
  * "available personas" name list surfaced in the write-time rejection error.
14
14
  */
15
15
 
16
- const { personaFileExists, resolvePersonaPaths } = require('./epicMint.cjs');
17
- const { listPersonas } = require('../agentLibrary.cjs');
16
+ const { personaFileExists, resolvePersonaPaths } = require('../epic/epicMint.cjs');
17
+ const { listPersonas } = require('../../agentLibrary.cjs');
18
18
 
19
19
  /** PRD execution's documented default persona (dev-lead.md's own frontmatter role). */
20
20
  const DEFAULT_PRD_AGENT_TYPE = 'dev-lead';
@@ -41,7 +41,7 @@ function reportDanglingAgentTypeOnce(cwd, agentType, deps = {}) {
41
41
  // Required lazily, same rationale as agentModelResolve.cjs's
42
42
  // logDanglingPersonaOnce: pay for this leaf module only on the (rare)
43
43
  // miss path.
44
- const { appendError } = require('./opsErrorLog.cjs');
44
+ const { appendError } = require('../telemetry/opsErrorLog.cjs');
45
45
  appendError({
46
46
  cwd,
47
47
  scope: 'prdAgentType',
@@ -18,22 +18,22 @@
18
18
 
19
19
  const fsp = require('node:fs/promises');
20
20
  const path = require('node:path');
21
- const { schemas, PRD_CREATE_SLUG_RE } = require('../ipcSchemas.cjs');
22
- const { kebabCase } = require('./kebabCase.cjs');
23
- const config = require('../config.cjs');
24
- const { expandHome } = require('./expandHome.cjs');
25
- const { readBody, sendJson } = require('./localAdminHttp.cjs');
26
- const { readActiveIndex } = require('./epicMint.cjs');
27
- const { appendAuditEvent } = require('./auditLog.cjs');
28
- const { resolveProjectContext } = require('./projectRootResolve.cjs');
29
- const { fixChainDepthOf, baseSlugOf } = require('./fixChainDepth.cjs');
21
+ const { schemas, PRD_CREATE_SLUG_RE } = require('../../ipcSchemas.cjs');
22
+ const { kebabCase } = require('../util/kebabCase.cjs');
23
+ const config = require('../../config.cjs');
24
+ const { expandHome } = require('../util/expandHome.cjs');
25
+ const { readBody, sendJson } = require('../feedback-remote/localAdminHttp.cjs');
26
+ const { readActiveIndex } = require('../epic/epicMint.cjs');
27
+ const { appendAuditEvent } = require('../telemetry/auditLog.cjs');
28
+ const { resolveProjectContext } = require('../projectRootResolve.cjs');
29
+ const { fixChainDepthOf, baseSlugOf } = require('../scheduler/fixChainDepth.cjs');
30
30
  const { DEFAULT_PRD_AGENT_TYPE, assertAgentTypeWritable } = require('./prdAgentType.cjs');
31
31
  const { resolveDepSlug, findNearMatches } = require('./depSlugResolve.cjs');
32
- const { isFixPlanSlug } = require('./fixPlanSlug.cjs');
32
+ const { isFixPlanSlug } = require('../scheduler/fixPlanSlug.cjs');
33
33
  const { isIncomplete, resolveChainTerminals, isValidPlanId, mintPlanId, resolveInheritedPlanId } = require('./prdDisposition.cjs');
34
34
  const { sizingWarnings } = require('./prdSizing.cjs');
35
35
  const { validateGate, validateFiles, renderFilesSection, renderGateSection } = require('./prdGateFiles.cjs');
36
- const { resolveGate, parseChain, isNoneGate } = require('./definitionOfDone.cjs');
36
+ const { resolveGate, parseChain, isNoneGate } = require('../scheduler/definitionOfDone.cjs');
37
37
 
38
38
  // A caller-supplied slug that already starts with its own `NN-` (e.g.
39
39
  // "254-perf-x") used to silently become the double-prefixed row
@@ -55,7 +55,7 @@ const SLUG_HAS_NN_PREFIX_RE = /^(\d+)-/;
55
55
  const FIX_CHAIN_DEPTH_CAP = 1;
56
56
 
57
57
  const STANDARDS_PATH = path.join(
58
- __dirname, '..', '..', '..',
58
+ __dirname, '..', '..', '..', '..',
59
59
  'plugins', 'session-manager-dev', 'skills', 'develop', 'standards.md',
60
60
  );
61
61
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  const fs = require('node:fs');
13
13
  const { splitFrontmatter } = require('./prdFrontmatter.cjs');
14
- const { extractSection } = require('./definitionOfDone.cjs');
14
+ const { extractSection } = require('../scheduler/definitionOfDone.cjs');
15
15
 
16
16
  // Backtick-quoted, extension-bearing relative paths, e.g. `src/main/scheduler.cjs`
17
17
  // or `src/main/scheduler.cjs:490` (trailing :line dropped). Requires at least
@@ -15,7 +15,7 @@
15
15
  * No I/O, no scheduler imports — pure string-in, string/array-out.
16
16
  */
17
17
 
18
- const { parseChain, explainChain, isNoneGate } = require('./definitionOfDone.cjs');
18
+ const { parseChain, explainChain, isNoneGate } = require('../scheduler/definitionOfDone.cjs');
19
19
 
20
20
  const GATE_MIN_ENTRIES = 1;
21
21
  const GATE_MAX_ENTRIES = 10;
@@ -27,9 +27,9 @@
27
27
 
28
28
  const fs = require('node:fs');
29
29
  const path = require('node:path');
30
- const { activeProjectCwds, allProjectCwds } = require('./activeSessions.cjs');
30
+ const { activeProjectCwds, allProjectCwds } = require('../activeSessions.cjs');
31
31
 
32
- const { opsPath, OPS_ROOT_DIR } = require('./opsOwnership.cjs');
32
+ const { opsPath, OPS_ROOT_DIR } = require('../opsOwnership.cjs');
33
33
 
34
34
  // Segments UNDER the ops root; the ops root itself is resolved by
35
35
  // opsOwnership.opsPath (PRD 1082) — never joined onto a raw cwd here.
@@ -18,9 +18,9 @@ const fsp = require('node:fs/promises');
18
18
  const path = require('node:path');
19
19
  const { splitFrontmatter, parsePrdFile, serializePrdFile } = require('./prdFrontmatter.cjs');
20
20
  const { resolvePrdWriteDir, resolvePrdsDirs } = require('./prdLocations.cjs');
21
- const { projectQueuePath } = require('./queueStore.cjs');
22
- const { expandHome } = require('./expandHome.cjs');
23
- const atomicFs = require('./atomicFs.cjs');
21
+ const { projectQueuePath } = require('../scheduler/queueStore.cjs');
22
+ const { expandHome } = require('../util/expandHome.cjs');
23
+ const atomicFs = require('../util/atomicFs.cjs');
24
24
 
25
25
  /**
26
26
  * Move every `.md` file in legacyPrdsDir whose frontmatter `cwd` resolves to
@@ -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
  );
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * finalizeReason.cjs — the statusHistory reason for a job's running→terminal
5
+ * finalize transition. Pure; no I/O.
6
+ */
7
+
8
+ /**
9
+ * @param {{
10
+ * effectiveStatus: string,
11
+ * verifyResult?: { verdict?: string, reason?: string } | null,
12
+ * sigtermOverrideReason?: string | null,
13
+ * exitCode?: number | null,
14
+ * }} input
15
+ * @returns {string}
16
+ */
17
+ function finalizeReasonFor({ effectiveStatus, verifyResult, sigtermOverrideReason, exitCode }) {
18
+ if (sigtermOverrideReason) return sigtermOverrideReason;
19
+ if (effectiveStatus === 'completed' && verifyResult?.verdict === 'already_satisfied_on_main') {
20
+ return String(verifyResult.reason);
21
+ }
22
+ if (effectiveStatus === 'needs_review' && verifyResult?.verdict) {
23
+ return verifyResult.reason
24
+ ? `needs_review: ${verifyResult.verdict} — ${verifyResult.reason}`
25
+ : `needs_review: ${verifyResult.verdict}`;
26
+ }
27
+ return `run finished with exit ${exitCode}`;
28
+ }
29
+
30
+ module.exports = { finalizeReasonFor };
@@ -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
 
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ /** Retired flat `scheduler/prds/` sweep runs at most once per hour per process. */
4
+ const FLAT_SWEEP_INTERVAL_MS = 60 * 60 * 1000;
5
+
6
+ /**
7
+ * @param {number} nowMs
8
+ * @param {number | null} lastRunMs null = never ran this process (always run)
9
+ * @param {number} [intervalMs]
10
+ * @returns {boolean}
11
+ */
12
+ function shouldRunFlatSweep(nowMs, lastRunMs, intervalMs = FLAT_SWEEP_INTERVAL_MS) {
13
+ if (lastRunMs === null || lastRunMs === undefined) return true;
14
+ return nowMs - lastRunMs >= intervalMs;
15
+ }
16
+
17
+ module.exports = { shouldRunFlatSweep, FLAT_SWEEP_INTERVAL_MS };