@amsterdamdatalabs/enact-operator 0.1.2

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 (377) hide show
  1. package/README.md +33 -0
  2. package/dist/index.d.ts +24 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +24 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lanes/autopilot/index.d.ts +95 -0
  7. package/dist/lanes/autopilot/index.d.ts.map +1 -0
  8. package/dist/lanes/autopilot/index.js +499 -0
  9. package/dist/lanes/autopilot/index.js.map +1 -0
  10. package/dist/lanes/ralph/index.d.ts +118 -0
  11. package/dist/lanes/ralph/index.d.ts.map +1 -0
  12. package/dist/lanes/ralph/index.js +680 -0
  13. package/dist/lanes/ralph/index.js.map +1 -0
  14. package/dist/lanes/team/index.d.ts +110 -0
  15. package/dist/lanes/team/index.d.ts.map +1 -0
  16. package/dist/lanes/team/index.js +748 -0
  17. package/dist/lanes/team/index.js.map +1 -0
  18. package/dist/lanes/team/roles.d.ts +15 -0
  19. package/dist/lanes/team/roles.d.ts.map +1 -0
  20. package/dist/lanes/team/roles.js +89 -0
  21. package/dist/lanes/team/roles.js.map +1 -0
  22. package/dist/lanes/ultrawork/burst.d.ts +69 -0
  23. package/dist/lanes/ultrawork/burst.d.ts.map +1 -0
  24. package/dist/lanes/ultrawork/burst.js +254 -0
  25. package/dist/lanes/ultrawork/burst.js.map +1 -0
  26. package/dist/lanes/ultrawork/index.d.ts +159 -0
  27. package/dist/lanes/ultrawork/index.d.ts.map +1 -0
  28. package/dist/lanes/ultrawork/index.js +919 -0
  29. package/dist/lanes/ultrawork/index.js.map +1 -0
  30. package/dist/lanes/ultrawork/phases.d.ts +57 -0
  31. package/dist/lanes/ultrawork/phases.d.ts.map +1 -0
  32. package/dist/lanes/ultrawork/phases.js +116 -0
  33. package/dist/lanes/ultrawork/phases.js.map +1 -0
  34. package/dist/mcp/activation.d.ts +5 -0
  35. package/dist/mcp/activation.d.ts.map +1 -0
  36. package/dist/mcp/activation.js +234 -0
  37. package/dist/mcp/activation.js.map +1 -0
  38. package/dist/mcp/cli.d.ts +11 -0
  39. package/dist/mcp/cli.d.ts.map +1 -0
  40. package/dist/mcp/cli.js +140 -0
  41. package/dist/mcp/cli.js.map +1 -0
  42. package/dist/mcp/continuation.d.ts +5 -0
  43. package/dist/mcp/continuation.d.ts.map +1 -0
  44. package/dist/mcp/continuation.js +360 -0
  45. package/dist/mcp/continuation.js.map +1 -0
  46. package/dist/mcp/jobs.d.ts +5 -0
  47. package/dist/mcp/jobs.d.ts.map +1 -0
  48. package/dist/mcp/jobs.js +212 -0
  49. package/dist/mcp/jobs.js.map +1 -0
  50. package/dist/mcp/laneSupport.d.ts +19 -0
  51. package/dist/mcp/laneSupport.d.ts.map +1 -0
  52. package/dist/mcp/laneSupport.js +21 -0
  53. package/dist/mcp/laneSupport.js.map +1 -0
  54. package/dist/mcp/lanes/autopilot.d.ts +5 -0
  55. package/dist/mcp/lanes/autopilot.d.ts.map +1 -0
  56. package/dist/mcp/lanes/autopilot.js +227 -0
  57. package/dist/mcp/lanes/autopilot.js.map +1 -0
  58. package/dist/mcp/lanes/ralph.d.ts +5 -0
  59. package/dist/mcp/lanes/ralph.d.ts.map +1 -0
  60. package/dist/mcp/lanes/ralph.js +392 -0
  61. package/dist/mcp/lanes/ralph.js.map +1 -0
  62. package/dist/mcp/lanes/team.d.ts +5 -0
  63. package/dist/mcp/lanes/team.d.ts.map +1 -0
  64. package/dist/mcp/lanes/team.js +413 -0
  65. package/dist/mcp/lanes/team.js.map +1 -0
  66. package/dist/mcp/lanes/ultrawork.d.ts +5 -0
  67. package/dist/mcp/lanes/ultrawork.d.ts.map +1 -0
  68. package/dist/mcp/lanes/ultrawork.js +497 -0
  69. package/dist/mcp/lanes/ultrawork.js.map +1 -0
  70. package/dist/mcp/linkage.d.ts +5 -0
  71. package/dist/mcp/linkage.d.ts.map +1 -0
  72. package/dist/mcp/linkage.js +126 -0
  73. package/dist/mcp/linkage.js.map +1 -0
  74. package/dist/mcp/planning.d.ts +5 -0
  75. package/dist/mcp/planning.d.ts.map +1 -0
  76. package/dist/mcp/planning.js +584 -0
  77. package/dist/mcp/planning.js.map +1 -0
  78. package/dist/mcp/rpcTransport.d.ts +17 -0
  79. package/dist/mcp/rpcTransport.d.ts.map +1 -0
  80. package/dist/mcp/rpcTransport.js +90 -0
  81. package/dist/mcp/rpcTransport.js.map +1 -0
  82. package/dist/mcp/schemas/ralphVerify.d.ts +32 -0
  83. package/dist/mcp/schemas/ralphVerify.d.ts.map +1 -0
  84. package/dist/mcp/schemas/ralphVerify.js +20 -0
  85. package/dist/mcp/schemas/ralphVerify.js.map +1 -0
  86. package/dist/mcp/server.d.ts +5 -0
  87. package/dist/mcp/server.d.ts.map +1 -0
  88. package/dist/mcp/server.js +176 -0
  89. package/dist/mcp/server.js.map +1 -0
  90. package/dist/mcp/system.d.ts +5 -0
  91. package/dist/mcp/system.d.ts.map +1 -0
  92. package/dist/mcp/system.js +445 -0
  93. package/dist/mcp/system.js.map +1 -0
  94. package/dist/mcp/toolFilter.d.ts +2 -0
  95. package/dist/mcp/toolFilter.d.ts.map +1 -0
  96. package/dist/mcp/toolFilter.js +2 -0
  97. package/dist/mcp/toolFilter.js.map +1 -0
  98. package/dist/mcp/toolPartitions.d.ts +20 -0
  99. package/dist/mcp/toolPartitions.d.ts.map +1 -0
  100. package/dist/mcp/toolPartitions.js +280 -0
  101. package/dist/mcp/toolPartitions.js.map +1 -0
  102. package/dist/mcp/toolRuntime.d.ts +9 -0
  103. package/dist/mcp/toolRuntime.d.ts.map +1 -0
  104. package/dist/mcp/toolRuntime.js +179 -0
  105. package/dist/mcp/toolRuntime.js.map +1 -0
  106. package/dist/mcp/workflow.d.ts +12 -0
  107. package/dist/mcp/workflow.d.ts.map +1 -0
  108. package/dist/mcp/workflow.js +723 -0
  109. package/dist/mcp/workflow.js.map +1 -0
  110. package/dist/operator/hooks/hookDispatcher.d.ts +39 -0
  111. package/dist/operator/hooks/hookDispatcher.d.ts.map +1 -0
  112. package/dist/operator/hooks/hookDispatcher.js +58 -0
  113. package/dist/operator/hooks/hookDispatcher.js.map +1 -0
  114. package/dist/operator/hooks/hookGating.d.ts +28 -0
  115. package/dist/operator/hooks/hookGating.d.ts.map +1 -0
  116. package/dist/operator/hooks/hookGating.js +61 -0
  117. package/dist/operator/hooks/hookGating.js.map +1 -0
  118. package/dist/operator/hooks/hooks.d.ts +20 -0
  119. package/dist/operator/hooks/hooks.d.ts.map +1 -0
  120. package/dist/operator/hooks/hooks.js +124 -0
  121. package/dist/operator/hooks/hooks.js.map +1 -0
  122. package/dist/operator/hooks/toolGuardHooks.d.ts +86 -0
  123. package/dist/operator/hooks/toolGuardHooks.d.ts.map +1 -0
  124. package/dist/operator/hooks/toolGuardHooks.js +163 -0
  125. package/dist/operator/hooks/toolGuardHooks.js.map +1 -0
  126. package/dist/operator/hud.d.ts +115 -0
  127. package/dist/operator/hud.d.ts.map +1 -0
  128. package/dist/operator/hud.js +229 -0
  129. package/dist/operator/hud.js.map +1 -0
  130. package/dist/operator/missions.d.ts +125 -0
  131. package/dist/operator/missions.d.ts.map +1 -0
  132. package/dist/operator/missions.js +304 -0
  133. package/dist/operator/missions.js.map +1 -0
  134. package/dist/operator/operatorCore.d.ts +11 -0
  135. package/dist/operator/operatorCore.d.ts.map +1 -0
  136. package/dist/operator/operatorCore.js +9 -0
  137. package/dist/operator/operatorCore.js.map +1 -0
  138. package/dist/operator/operatorRuntimeCore.d.ts +17 -0
  139. package/dist/operator/operatorRuntimeCore.d.ts.map +1 -0
  140. package/dist/operator/operatorRuntimeCore.js +17 -0
  141. package/dist/operator/operatorRuntimeCore.js.map +1 -0
  142. package/dist/operator/runtime.d.ts +74 -0
  143. package/dist/operator/runtime.d.ts.map +1 -0
  144. package/dist/operator/runtime.js +357 -0
  145. package/dist/operator/runtime.js.map +1 -0
  146. package/dist/shared/core/bootstrap.d.ts +16 -0
  147. package/dist/shared/core/bootstrap.d.ts.map +1 -0
  148. package/dist/shared/core/bootstrap.js +77 -0
  149. package/dist/shared/core/bootstrap.js.map +1 -0
  150. package/dist/shared/core/contract.d.ts +71 -0
  151. package/dist/shared/core/contract.d.ts.map +1 -0
  152. package/dist/shared/core/contract.js +452 -0
  153. package/dist/shared/core/contract.js.map +1 -0
  154. package/dist/shared/core/events.d.ts +57 -0
  155. package/dist/shared/core/events.d.ts.map +1 -0
  156. package/dist/shared/core/events.js +36 -0
  157. package/dist/shared/core/events.js.map +1 -0
  158. package/dist/shared/core/jobs.d.ts +46 -0
  159. package/dist/shared/core/jobs.d.ts.map +1 -0
  160. package/dist/shared/core/jobs.js +137 -0
  161. package/dist/shared/core/jobs.js.map +1 -0
  162. package/dist/shared/core/json.d.ts +12 -0
  163. package/dist/shared/core/json.d.ts.map +1 -0
  164. package/dist/shared/core/json.js +52 -0
  165. package/dist/shared/core/json.js.map +1 -0
  166. package/dist/shared/core/layoutMigration.d.ts +11 -0
  167. package/dist/shared/core/layoutMigration.d.ts.map +1 -0
  168. package/dist/shared/core/layoutMigration.js +56 -0
  169. package/dist/shared/core/layoutMigration.js.map +1 -0
  170. package/dist/shared/core/lifecycle.d.ts +61 -0
  171. package/dist/shared/core/lifecycle.d.ts.map +1 -0
  172. package/dist/shared/core/lifecycle.js +123 -0
  173. package/dist/shared/core/lifecycle.js.map +1 -0
  174. package/dist/shared/core/packagePaths.d.ts +2 -0
  175. package/dist/shared/core/packagePaths.d.ts.map +1 -0
  176. package/dist/shared/core/packagePaths.js +9 -0
  177. package/dist/shared/core/packagePaths.js.map +1 -0
  178. package/dist/shared/core/terminology.d.ts +38 -0
  179. package/dist/shared/core/terminology.d.ts.map +1 -0
  180. package/dist/shared/core/terminology.js +54 -0
  181. package/dist/shared/core/terminology.js.map +1 -0
  182. package/dist/shared/core/types.d.ts +30 -0
  183. package/dist/shared/core/types.d.ts.map +1 -0
  184. package/dist/shared/core/types.js +2 -0
  185. package/dist/shared/core/types.js.map +1 -0
  186. package/dist/shared/diagnostics/doctor.d.ts +19 -0
  187. package/dist/shared/diagnostics/doctor.d.ts.map +1 -0
  188. package/dist/shared/diagnostics/doctor.js +82 -0
  189. package/dist/shared/diagnostics/doctor.js.map +1 -0
  190. package/dist/shared/diagnostics/hostRollout.d.ts +16 -0
  191. package/dist/shared/diagnostics/hostRollout.d.ts.map +1 -0
  192. package/dist/shared/diagnostics/hostRollout.js +78 -0
  193. package/dist/shared/diagnostics/hostRollout.js.map +1 -0
  194. package/dist/shared/observability/emit.d.ts +3 -0
  195. package/dist/shared/observability/emit.d.ts.map +1 -0
  196. package/dist/shared/observability/emit.js +17 -0
  197. package/dist/shared/observability/emit.js.map +1 -0
  198. package/dist/shared/observability/testWorkspace.d.ts +4 -0
  199. package/dist/shared/observability/testWorkspace.d.ts.map +1 -0
  200. package/dist/shared/observability/testWorkspace.js +35 -0
  201. package/dist/shared/observability/testWorkspace.js.map +1 -0
  202. package/dist/shared/state/installRegistry.d.ts +22 -0
  203. package/dist/shared/state/installRegistry.d.ts.map +1 -0
  204. package/dist/shared/state/installRegistry.js +51 -0
  205. package/dist/shared/state/installRegistry.js.map +1 -0
  206. package/dist/shared/state/session.d.ts +18 -0
  207. package/dist/shared/state/session.d.ts.map +1 -0
  208. package/dist/shared/state/session.js +127 -0
  209. package/dist/shared/state/session.js.map +1 -0
  210. package/dist/shared/state/state.d.ts +16 -0
  211. package/dist/shared/state/state.d.ts.map +1 -0
  212. package/dist/shared/state/state.js +91 -0
  213. package/dist/shared/state/state.js.map +1 -0
  214. package/dist/shared/state/tasks.d.ts +113 -0
  215. package/dist/shared/state/tasks.d.ts.map +1 -0
  216. package/dist/shared/state/tasks.js +274 -0
  217. package/dist/shared/state/tasks.js.map +1 -0
  218. package/dist/shared/workflow/activation/activeSkill.d.ts +46 -0
  219. package/dist/shared/workflow/activation/activeSkill.d.ts.map +1 -0
  220. package/dist/shared/workflow/activation/activeSkill.js +158 -0
  221. package/dist/shared/workflow/activation/activeSkill.js.map +1 -0
  222. package/dist/shared/workflow/activation/gateProfiles.d.ts +26 -0
  223. package/dist/shared/workflow/activation/gateProfiles.d.ts.map +1 -0
  224. package/dist/shared/workflow/activation/gateProfiles.js +102 -0
  225. package/dist/shared/workflow/activation/gateProfiles.js.map +1 -0
  226. package/dist/shared/workflow/activation/modeMatrix.d.ts +28 -0
  227. package/dist/shared/workflow/activation/modeMatrix.d.ts.map +1 -0
  228. package/dist/shared/workflow/activation/modeMatrix.js +91 -0
  229. package/dist/shared/workflow/activation/modeMatrix.js.map +1 -0
  230. package/dist/shared/workflow/activation/skillActivation.d.ts +74 -0
  231. package/dist/shared/workflow/activation/skillActivation.d.ts.map +1 -0
  232. package/dist/shared/workflow/activation/skillActivation.js +485 -0
  233. package/dist/shared/workflow/activation/skillActivation.js.map +1 -0
  234. package/dist/shared/workflow/activation/skillVariant.d.ts +18 -0
  235. package/dist/shared/workflow/activation/skillVariant.d.ts.map +1 -0
  236. package/dist/shared/workflow/activation/skillVariant.js +44 -0
  237. package/dist/shared/workflow/activation/skillVariant.js.map +1 -0
  238. package/dist/shared/workflow/authority/authority.d.ts +34 -0
  239. package/dist/shared/workflow/authority/authority.d.ts.map +1 -0
  240. package/dist/shared/workflow/authority/authority.js +64 -0
  241. package/dist/shared/workflow/authority/authority.js.map +1 -0
  242. package/dist/shared/workflow/closure/closureManifest.d.ts +39 -0
  243. package/dist/shared/workflow/closure/closureManifest.d.ts.map +1 -0
  244. package/dist/shared/workflow/closure/closureManifest.js +62 -0
  245. package/dist/shared/workflow/closure/closureManifest.js.map +1 -0
  246. package/dist/shared/workflow/closure/closureRequirements.d.ts +12 -0
  247. package/dist/shared/workflow/closure/closureRequirements.d.ts.map +1 -0
  248. package/dist/shared/workflow/closure/closureRequirements.js +30 -0
  249. package/dist/shared/workflow/closure/closureRequirements.js.map +1 -0
  250. package/dist/shared/workflow/closure/contractParity.d.ts +24 -0
  251. package/dist/shared/workflow/closure/contractParity.d.ts.map +1 -0
  252. package/dist/shared/workflow/closure/contractParity.js +238 -0
  253. package/dist/shared/workflow/closure/contractParity.js.map +1 -0
  254. package/dist/shared/workflow/closure/contractParityContext.d.ts +8 -0
  255. package/dist/shared/workflow/closure/contractParityContext.d.ts.map +1 -0
  256. package/dist/shared/workflow/closure/contractParityContext.js +50 -0
  257. package/dist/shared/workflow/closure/contractParityContext.js.map +1 -0
  258. package/dist/shared/workflow/closure/scopeGuard.d.ts +11 -0
  259. package/dist/shared/workflow/closure/scopeGuard.d.ts.map +1 -0
  260. package/dist/shared/workflow/closure/scopeGuard.js +69 -0
  261. package/dist/shared/workflow/closure/scopeGuard.js.map +1 -0
  262. package/dist/shared/workflow/closure/ultragoalArtifact.d.ts +13 -0
  263. package/dist/shared/workflow/closure/ultragoalArtifact.d.ts.map +1 -0
  264. package/dist/shared/workflow/closure/ultragoalArtifact.js +31 -0
  265. package/dist/shared/workflow/closure/ultragoalArtifact.js.map +1 -0
  266. package/dist/shared/workflow/closure/workflowReconcile.d.ts +70 -0
  267. package/dist/shared/workflow/closure/workflowReconcile.d.ts.map +1 -0
  268. package/dist/shared/workflow/closure/workflowReconcile.js +267 -0
  269. package/dist/shared/workflow/closure/workflowReconcile.js.map +1 -0
  270. package/dist/shared/workflow/continuation/continuation.d.ts +109 -0
  271. package/dist/shared/workflow/continuation/continuation.d.ts.map +1 -0
  272. package/dist/shared/workflow/continuation/continuation.js +550 -0
  273. package/dist/shared/workflow/continuation/continuation.js.map +1 -0
  274. package/dist/shared/workflow/continuation/continuationEventReservations.d.ts +17 -0
  275. package/dist/shared/workflow/continuation/continuationEventReservations.d.ts.map +1 -0
  276. package/dist/shared/workflow/continuation/continuationEventReservations.js +88 -0
  277. package/dist/shared/workflow/continuation/continuationEventReservations.js.map +1 -0
  278. package/dist/shared/workflow/continuation/continuationFollowUp.d.ts +114 -0
  279. package/dist/shared/workflow/continuation/continuationFollowUp.d.ts.map +1 -0
  280. package/dist/shared/workflow/continuation/continuationFollowUp.js +330 -0
  281. package/dist/shared/workflow/continuation/continuationFollowUp.js.map +1 -0
  282. package/dist/shared/workflow/continuation/continuationOrchestrator.d.ts +66 -0
  283. package/dist/shared/workflow/continuation/continuationOrchestrator.d.ts.map +1 -0
  284. package/dist/shared/workflow/continuation/continuationOrchestrator.js +144 -0
  285. package/dist/shared/workflow/continuation/continuationOrchestrator.js.map +1 -0
  286. package/dist/shared/workflow/continuation/hookContinuation.d.ts +44 -0
  287. package/dist/shared/workflow/continuation/hookContinuation.d.ts.map +1 -0
  288. package/dist/shared/workflow/continuation/hookContinuation.js +85 -0
  289. package/dist/shared/workflow/continuation/hookContinuation.js.map +1 -0
  290. package/dist/shared/workflow/continuation/stopPolicy.d.ts +38 -0
  291. package/dist/shared/workflow/continuation/stopPolicy.d.ts.map +1 -0
  292. package/dist/shared/workflow/continuation/stopPolicy.js +435 -0
  293. package/dist/shared/workflow/continuation/stopPolicy.js.map +1 -0
  294. package/dist/shared/workflow/continuation/stopVerdict.d.ts +31 -0
  295. package/dist/shared/workflow/continuation/stopVerdict.d.ts.map +1 -0
  296. package/dist/shared/workflow/continuation/stopVerdict.js +98 -0
  297. package/dist/shared/workflow/continuation/stopVerdict.js.map +1 -0
  298. package/dist/shared/workflow/delegation/delegatedSession.d.ts +118 -0
  299. package/dist/shared/workflow/delegation/delegatedSession.d.ts.map +1 -0
  300. package/dist/shared/workflow/delegation/delegatedSession.js +496 -0
  301. package/dist/shared/workflow/delegation/delegatedSession.js.map +1 -0
  302. package/dist/shared/workflow/delegation/delegationPrompt.d.ts +3 -0
  303. package/dist/shared/workflow/delegation/delegationPrompt.d.ts.map +1 -0
  304. package/dist/shared/workflow/delegation/delegationPrompt.js +15 -0
  305. package/dist/shared/workflow/delegation/delegationPrompt.js.map +1 -0
  306. package/dist/shared/workflow/delegation/sessionTasks.d.ts +40 -0
  307. package/dist/shared/workflow/delegation/sessionTasks.d.ts.map +1 -0
  308. package/dist/shared/workflow/delegation/sessionTasks.js +73 -0
  309. package/dist/shared/workflow/delegation/sessionTasks.js.map +1 -0
  310. package/dist/shared/workflow/delegation/subagentRuntime.d.ts +26 -0
  311. package/dist/shared/workflow/delegation/subagentRuntime.d.ts.map +1 -0
  312. package/dist/shared/workflow/delegation/subagentRuntime.js +231 -0
  313. package/dist/shared/workflow/delegation/subagentRuntime.js.map +1 -0
  314. package/dist/shared/workflow/delivery/adoAuxiliaryRuntime.d.ts +79 -0
  315. package/dist/shared/workflow/delivery/adoAuxiliaryRuntime.d.ts.map +1 -0
  316. package/dist/shared/workflow/delivery/adoAuxiliaryRuntime.js +166 -0
  317. package/dist/shared/workflow/delivery/adoAuxiliaryRuntime.js.map +1 -0
  318. package/dist/shared/workflow/delivery/finalWave.d.ts +57 -0
  319. package/dist/shared/workflow/delivery/finalWave.d.ts.map +1 -0
  320. package/dist/shared/workflow/delivery/finalWave.js +123 -0
  321. package/dist/shared/workflow/delivery/finalWave.js.map +1 -0
  322. package/dist/shared/workflow/delivery/lifecyclePushMap.d.ts +68 -0
  323. package/dist/shared/workflow/delivery/lifecyclePushMap.d.ts.map +1 -0
  324. package/dist/shared/workflow/delivery/lifecyclePushMap.js +82 -0
  325. package/dist/shared/workflow/delivery/lifecyclePushMap.js.map +1 -0
  326. package/dist/shared/workflow/delivery/prSidecar.d.ts +7 -0
  327. package/dist/shared/workflow/delivery/prSidecar.d.ts.map +1 -0
  328. package/dist/shared/workflow/delivery/prSidecar.js +4 -0
  329. package/dist/shared/workflow/delivery/prSidecar.js.map +1 -0
  330. package/dist/shared/workflow/delivery/reviewStaleness.d.ts +37 -0
  331. package/dist/shared/workflow/delivery/reviewStaleness.d.ts.map +1 -0
  332. package/dist/shared/workflow/delivery/reviewStaleness.js +94 -0
  333. package/dist/shared/workflow/delivery/reviewStaleness.js.map +1 -0
  334. package/dist/shared/workflow/planning/hyperplan.d.ts +40 -0
  335. package/dist/shared/workflow/planning/hyperplan.d.ts.map +1 -0
  336. package/dist/shared/workflow/planning/hyperplan.js +133 -0
  337. package/dist/shared/workflow/planning/hyperplan.js.map +1 -0
  338. package/dist/shared/workflow/planning/notepad.d.ts +17 -0
  339. package/dist/shared/workflow/planning/notepad.d.ts.map +1 -0
  340. package/dist/shared/workflow/planning/notepad.js +84 -0
  341. package/dist/shared/workflow/planning/notepad.js.map +1 -0
  342. package/dist/shared/workflow/planning/planFormat.d.ts +3 -0
  343. package/dist/shared/workflow/planning/planFormat.d.ts.map +1 -0
  344. package/dist/shared/workflow/planning/planFormat.js +14 -0
  345. package/dist/shared/workflow/planning/planFormat.js.map +1 -0
  346. package/package.json +155 -0
  347. package/runtime/hooks/_continuation.mjs +2 -0
  348. package/runtime/hooks/_lib.mjs +2 -0
  349. package/runtime/hooks/_toolGuards.mjs +2 -0
  350. package/runtime/hooks/lanes/resolveSkillActivation.mjs +241 -0
  351. package/runtime/hooks/lanes/user-prompt-submit.mjs +326 -0
  352. package/runtime/hooks/layout-dir.mjs +2 -0
  353. package/runtime/hooks/lifecycle/pre-compact.mjs +121 -0
  354. package/runtime/hooks/lifecycle/session-start.mjs +356 -0
  355. package/runtime/hooks/lifecycle/stop.mjs +223 -0
  356. package/runtime/hooks/observability.mjs +2 -0
  357. package/runtime/hooks/post-tool-use-failure.mjs +5 -0
  358. package/runtime/hooks/post-tool-use.mjs +4 -0
  359. package/runtime/hooks/pre-compact.mjs +4 -0
  360. package/runtime/hooks/pre-tool-use.mjs +4 -0
  361. package/runtime/hooks/resolveSkillActivation.mjs +4 -0
  362. package/runtime/hooks/root-dir.mjs +2 -0
  363. package/runtime/hooks/session-start.mjs +4 -0
  364. package/runtime/hooks/shared/_continuation.mjs +341 -0
  365. package/runtime/hooks/shared/_lib.mjs +60 -0
  366. package/runtime/hooks/shared/_toolGuards.mjs +237 -0
  367. package/runtime/hooks/shared/config.mjs +143 -0
  368. package/runtime/hooks/shared/layout-dir.mjs +12 -0
  369. package/runtime/hooks/shared/observability.mjs +257 -0
  370. package/runtime/hooks/shared/root-dir.mjs +9 -0
  371. package/runtime/hooks/stop.mjs +4 -0
  372. package/runtime/hooks/subagent-tracker.mjs +4 -0
  373. package/runtime/hooks/subagents/subagent-tracker.mjs +106 -0
  374. package/runtime/hooks/tools/post-tool-use-failure.mjs +251 -0
  375. package/runtime/hooks/tools/post-tool-use.mjs +205 -0
  376. package/runtime/hooks/tools/pre-tool-use.mjs +268 -0
  377. package/runtime/hooks/user-prompt-submit.mjs +4 -0
@@ -0,0 +1,88 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { layoutPath, readJson, writeJson } from '../../../operator/operatorCore.js';
3
+ const CONTINUATION_EVENT_RESERVATION_SCHEMA_VERSION = 1;
4
+ function now() {
5
+ return new Date().toISOString();
6
+ }
7
+ function continuationEventReservationFile(root) {
8
+ return layoutPath(root, 'state', 'continuation-event-reservations.json');
9
+ }
10
+ function defaultContinuationEventReservationState() {
11
+ return {
12
+ schemaVersion: CONTINUATION_EVENT_RESERVATION_SCHEMA_VERSION,
13
+ updatedAt: now(),
14
+ entries: {},
15
+ };
16
+ }
17
+ function readContinuationEventReservationState(root) {
18
+ const path = continuationEventReservationFile(root);
19
+ if (!existsSync(path)) {
20
+ return defaultContinuationEventReservationState();
21
+ }
22
+ const loaded = readJson(path, defaultContinuationEventReservationState());
23
+ return {
24
+ ...defaultContinuationEventReservationState(),
25
+ ...loaded,
26
+ schemaVersion: CONTINUATION_EVENT_RESERVATION_SCHEMA_VERSION,
27
+ entries: typeof loaded.entries === 'object' && loaded.entries !== null ? loaded.entries : {},
28
+ };
29
+ }
30
+ function writeContinuationEventReservationState(root, state) {
31
+ const next = {
32
+ ...state,
33
+ schemaVersion: CONTINUATION_EVENT_RESERVATION_SCHEMA_VERSION,
34
+ updatedAt: now(),
35
+ };
36
+ writeJson(continuationEventReservationFile(root), next);
37
+ return next;
38
+ }
39
+ function pruneExpiredContinuationEventReservations(state, nowMs) {
40
+ const entries = Object.fromEntries(Object.entries(state.entries).filter(([, value]) => Date.parse(value.expiresAt) > nowMs));
41
+ return { ...state, entries };
42
+ }
43
+ export function reserveContinuationEvent(root, input) {
44
+ const nowMs = input.nowMs ?? Date.now();
45
+ const nowIso = new Date(nowMs).toISOString();
46
+ const ttlMs = Math.max(1_000, input.ttlMs ?? 90_000);
47
+ const expiresAt = new Date(nowMs + ttlMs).toISOString();
48
+ const current = pruneExpiredContinuationEventReservations(readContinuationEventReservationState(root), nowMs);
49
+ const existing = current.entries[input.key];
50
+ if (existing) {
51
+ const remainingMs = Math.max(0, Date.parse(existing.expiresAt) - nowMs);
52
+ writeContinuationEventReservationState(root, current);
53
+ return {
54
+ reserved: false,
55
+ key: existing.key,
56
+ source: existing.source,
57
+ reservedAt: existing.reservedAt,
58
+ expiresAt: existing.expiresAt,
59
+ remainingMs,
60
+ };
61
+ }
62
+ const entry = {
63
+ key: input.key,
64
+ source: input.source,
65
+ reservedAt: nowIso,
66
+ expiresAt,
67
+ metadata: input.metadata,
68
+ };
69
+ const next = {
70
+ ...current,
71
+ entries: {
72
+ ...current.entries,
73
+ [input.key]: entry,
74
+ },
75
+ };
76
+ writeContinuationEventReservationState(root, next);
77
+ return {
78
+ reserved: true,
79
+ key: entry.key,
80
+ source: entry.source,
81
+ reservedAt: entry.reservedAt,
82
+ expiresAt: entry.expiresAt,
83
+ };
84
+ }
85
+ export function clearContinuationEventReservations(root) {
86
+ writeContinuationEventReservationState(root, defaultContinuationEventReservationState());
87
+ }
88
+ //# sourceMappingURL=continuationEventReservations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continuationEventReservations.js","sourceRoot":"","sources":["../../../../src/shared/workflow/continuation/continuationEventReservations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE7E,MAAM,6CAA6C,GAAG,CAAU,CAAC;AAyBjE,SAAS,GAAG;IACV,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC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AAE,KAAK,CAAC,MAAM;QACpB,UAAU,EAAE,MAAM;QAClB,SAAS;QACT,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC;IACF,MAAM,IAAI,GAAsC;QAC9C,GAAG,OAAO;QACV,OAAO,EAAE;YACP,GAAG,OAAO,CAAC,OAAO;YAClB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK;SACnB;KACF,CAAC;IACF,sCAAsC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnD,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,IAAY;IAC7D,sCAAsC,CAAC,IAAI,EAAE,wCAAwC,EAAE,CAAC,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,114 @@
1
+ export type FollowUpTrigger = 'stop-deny' | 'session-idle' | 'post-tool-failure' | 'recovery' | 'subagent-stop' | 'team-message' | 'team-resume';
2
+ export type FollowUpStatus = 'queued' | 'replayed' | 'suppressed' | 'acknowledged' | 'expired';
3
+ export type FollowUpLane = 'ralph' | 'ultrawork' | 'autopilot' | 'team' | 'none';
4
+ export declare const DEFAULT_FOLLOW_UP_QUEUE_TTL_MS: number;
5
+ export interface ContinuationFollowUpItem {
6
+ id: string;
7
+ sessionId: string | null;
8
+ dedupeKey: string;
9
+ trigger: FollowUpTrigger;
10
+ status: FollowUpStatus;
11
+ lane: FollowUpLane;
12
+ laneId: string | null;
13
+ prompt: string;
14
+ createdAt: string;
15
+ expiresAt: string;
16
+ lastReplayedAt: string | null;
17
+ lastReplaySessionId: string | null;
18
+ acknowledgedAt: string | null;
19
+ suppressReason: string | null;
20
+ metadata: Record<string, unknown>;
21
+ }
22
+ interface FollowUpQueueState {
23
+ schemaVersion: 1;
24
+ updatedAt: string;
25
+ items: ContinuationFollowUpItem[];
26
+ }
27
+ export declare function pruneExpiredContinuationFollowUps(root: string, atMs?: number): FollowUpQueueState;
28
+ export interface EnqueueContinuationFollowUpInput {
29
+ sessionId: string | null;
30
+ dedupeKey: string;
31
+ trigger: FollowUpTrigger;
32
+ lane: FollowUpLane;
33
+ laneId: string | null;
34
+ prompt: string;
35
+ queueTtlMs?: number;
36
+ nowMs?: number;
37
+ metadata?: Record<string, unknown>;
38
+ }
39
+ export type EnqueueContinuationFollowUpResult = {
40
+ outcome: 'queued';
41
+ item: ContinuationFollowUpItem;
42
+ } | {
43
+ outcome: 'suppressed';
44
+ reason: string;
45
+ existingId: string;
46
+ };
47
+ export declare function enqueueContinuationFollowUp(root: string, input: EnqueueContinuationFollowUpInput): EnqueueContinuationFollowUpResult;
48
+ export interface RefreshContinuationFollowUpInput {
49
+ dedupeKey: string;
50
+ prompt?: string;
51
+ queueTtlMs?: number;
52
+ nowMs?: number;
53
+ }
54
+ export declare function refreshContinuationFollowUp(root: string, input: RefreshContinuationFollowUpInput): ContinuationFollowUpItem | null;
55
+ export interface ReserveFollowUpReplayInput {
56
+ followUpId: string;
57
+ sessionId: string | null;
58
+ replayReservationTtlMs?: number;
59
+ nowMs?: number;
60
+ }
61
+ export interface ReserveFollowUpReplayResult {
62
+ reserved: boolean;
63
+ item: ContinuationFollowUpItem | null;
64
+ reinjectionText: string | null;
65
+ reason?: string;
66
+ }
67
+ export declare function reserveFollowUpReplay(root: string, input: ReserveFollowUpReplayInput): ReserveFollowUpReplayResult;
68
+ export declare function markFollowUpReplayed(root: string, followUpId: string, sessionId: string | null): ContinuationFollowUpItem | null;
69
+ export interface AcknowledgeContinuationFollowUpInput {
70
+ followUpId?: string;
71
+ dedupeKey?: string;
72
+ continuationId?: string;
73
+ sessionId?: string | null;
74
+ lane?: FollowUpLane;
75
+ reason: string;
76
+ source: string;
77
+ }
78
+ export declare function acknowledgeContinuationFollowUp(root: string, input: AcknowledgeContinuationFollowUpInput): {
79
+ acknowledged: ContinuationFollowUpItem[];
80
+ };
81
+ export declare function acknowledgeContinuationFollowUpsOnProgress(root: string, input: {
82
+ lane: FollowUpLane;
83
+ sessionId: string | null;
84
+ reason: string;
85
+ source: string;
86
+ }): void;
87
+ export declare function readContinuationFollowUpQueue(root: string): {
88
+ items: ContinuationFollowUpItem[];
89
+ counts: Record<FollowUpStatus, number>;
90
+ };
91
+ export declare function findQueuedFollowUpsForSession(root: string, sessionId: string | null): ContinuationFollowUpItem[];
92
+ export declare function findHeadQueuedFollowUp(root: string, trigger?: FollowUpTrigger): ContinuationFollowUpItem | null;
93
+ export declare function pickFollowUpForReplay(root: string, lane: FollowUpLane, sessionId: string | null): ContinuationFollowUpItem | null;
94
+ export declare function buildStopDenyDedupeKey(input: {
95
+ sessionId: string | null;
96
+ lane: FollowUpLane;
97
+ laneId: string | null;
98
+ blockerFingerprint: string;
99
+ }): string;
100
+ export declare function buildSessionIdleDedupeKey(input: {
101
+ sessionId: string | null;
102
+ lane: FollowUpLane;
103
+ laneId: string | null;
104
+ }): string;
105
+ export declare function buildPostToolFailureDedupeKey(input: {
106
+ sessionId: string | null;
107
+ toolName: string;
108
+ }): string;
109
+ export declare function buildTeamMessageFollowUpDedupeKey(teamId: string, messageId: string): string;
110
+ export declare function buildSubagentStopFollowUpDedupeKey(sessionId: string | null, agentId: string, outcome: string): string;
111
+ export declare function buildDelegatedFollowUpDedupeKey(continuationId: string, trigger: string): string;
112
+ export declare function fingerprintBlockers(blockers: string[]): string;
113
+ export {};
114
+ //# sourceMappingURL=continuationFollowUp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continuationFollowUp.d.ts","sourceRoot":"","sources":["../../../../src/shared/workflow/continuation/continuationFollowUp.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,cAAc,GACd,mBAAmB,GACnB,UAAU,GACV,eAAe,GACf,cAAc,GACd,aAA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EAAE,MAAM,GAAG,IAAI,GACvB,wBAAwB,GAAG,IAAI,CAYjC;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,GAAG,MAAM,CAIT;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,GAAG,MAAM,CAIT;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAG3G;AAED,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3F;AAED,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGrH;AAED,wBAAgB,+BAA+B,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/F;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAO9D"}
@@ -0,0 +1,330 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { existsSync } from 'node:fs';
3
+ import { layoutPath, readJson, writeJson } from '../../../operator/operatorCore.js';
4
+ import { appendLedger } from '../../../operator/runtime.js';
5
+ import { reserveContinuationEvent } from '../../../shared/workflow/continuation/continuationEventReservations.js';
6
+ const QUEUE_SCHEMA_VERSION = 1;
7
+ export const DEFAULT_FOLLOW_UP_QUEUE_TTL_MS = 4 * 60 * 60 * 1000;
8
+ function now() {
9
+ return new Date().toISOString();
10
+ }
11
+ function followUpQueueFile(root) {
12
+ return layoutPath(root, 'state', 'continuation-follow-up-queue.json');
13
+ }
14
+ function defaultQueue() {
15
+ return {
16
+ schemaVersion: QUEUE_SCHEMA_VERSION,
17
+ updatedAt: now(),
18
+ items: [],
19
+ };
20
+ }
21
+ function readQueue(root) {
22
+ const path = followUpQueueFile(root);
23
+ if (!existsSync(path)) {
24
+ return defaultQueue();
25
+ }
26
+ const loaded = readJson(path, defaultQueue());
27
+ return {
28
+ ...defaultQueue(),
29
+ ...loaded,
30
+ schemaVersion: QUEUE_SCHEMA_VERSION,
31
+ items: Array.isArray(loaded.items) ? loaded.items : [],
32
+ };
33
+ }
34
+ function writeQueue(root, state) {
35
+ const next = {
36
+ ...state,
37
+ schemaVersion: QUEUE_SCHEMA_VERSION,
38
+ updatedAt: now(),
39
+ };
40
+ writeJson(followUpQueueFile(root), next);
41
+ return next;
42
+ }
43
+ function ledgerFollowUp(root, action, detail, metadata) {
44
+ appendLedger(root, {
45
+ kind: 'session',
46
+ action,
47
+ detail,
48
+ actor: 'enact-operator-continuation',
49
+ metadata,
50
+ });
51
+ }
52
+ function nowMs() {
53
+ return Date.now();
54
+ }
55
+ export function pruneExpiredContinuationFollowUps(root, atMs = nowMs()) {
56
+ const q = readQueue(root);
57
+ let changed = false;
58
+ const items = q.items.map((item) => {
59
+ if (item.status === 'acknowledged' || item.status === 'suppressed' || item.status === 'expired') {
60
+ return item;
61
+ }
62
+ if (Date.parse(item.expiresAt) <= atMs) {
63
+ changed = true;
64
+ ledgerFollowUp(root, 'continuation_followup_expired', `Follow-up ${item.id} expired`, {
65
+ followUpId: item.id,
66
+ trigger: item.trigger,
67
+ dedupeKey: item.dedupeKey,
68
+ sessionId: item.sessionId,
69
+ lane: item.lane,
70
+ });
71
+ return { ...item, status: 'expired', suppressReason: 'ttl-expired' };
72
+ }
73
+ return item;
74
+ });
75
+ if (!changed) {
76
+ return q;
77
+ }
78
+ return writeQueue(root, { ...q, items });
79
+ }
80
+ export function enqueueContinuationFollowUp(root, input) {
81
+ const at = input.nowMs ?? nowMs();
82
+ let q = pruneExpiredContinuationFollowUps(root, at);
83
+ const ttl = input.queueTtlMs ?? DEFAULT_FOLLOW_UP_QUEUE_TTL_MS;
84
+ const expiresAt = new Date(at + ttl).toISOString();
85
+ const active = q.items.find((i) => i.dedupeKey === input.dedupeKey
86
+ && (i.status === 'queued' || i.status === 'replayed')
87
+ && Date.parse(i.expiresAt) > at);
88
+ if (active) {
89
+ ledgerFollowUp(root, 'continuation_followup_suppressed', `Duplicate follow-up enqueue for ${input.dedupeKey}`, {
90
+ followUpId: active.id,
91
+ trigger: input.trigger,
92
+ dedupeKey: input.dedupeKey,
93
+ sessionId: input.sessionId,
94
+ lane: input.lane,
95
+ });
96
+ return { outcome: 'suppressed', reason: 'duplicate-dedupe-key-active', existingId: active.id };
97
+ }
98
+ const item = {
99
+ id: `followup_${randomUUID().replace(/-/g, '').slice(0, 16)}`,
100
+ sessionId: input.sessionId,
101
+ dedupeKey: input.dedupeKey,
102
+ trigger: input.trigger,
103
+ status: 'queued',
104
+ lane: input.lane,
105
+ laneId: input.laneId,
106
+ prompt: input.prompt,
107
+ createdAt: new Date(at).toISOString(),
108
+ expiresAt,
109
+ lastReplayedAt: null,
110
+ lastReplaySessionId: null,
111
+ acknowledgedAt: null,
112
+ suppressReason: null,
113
+ metadata: input.metadata ?? {},
114
+ };
115
+ q = writeQueue(root, { ...q, items: [...q.items, item] });
116
+ ledgerFollowUp(root, 'continuation_followup_queued', `Follow-up queued (${input.trigger})`, {
117
+ followUpId: item.id,
118
+ trigger: item.trigger,
119
+ dedupeKey: item.dedupeKey,
120
+ sessionId: item.sessionId,
121
+ lane: item.lane,
122
+ });
123
+ return { outcome: 'queued', item };
124
+ }
125
+ export function refreshContinuationFollowUp(root, input) {
126
+ const at = input.nowMs ?? nowMs();
127
+ let q = pruneExpiredContinuationFollowUps(root, at);
128
+ const idx = q.items.findIndex((i) => i.dedupeKey === input.dedupeKey && (i.status === 'queued' || i.status === 'replayed'));
129
+ if (idx < 0) {
130
+ return null;
131
+ }
132
+ const cur = q.items[idx];
133
+ const ttl = input.queueTtlMs ?? DEFAULT_FOLLOW_UP_QUEUE_TTL_MS;
134
+ const nextItem = {
135
+ ...cur,
136
+ expiresAt: new Date(at + ttl).toISOString(),
137
+ prompt: input.prompt ?? cur.prompt,
138
+ status: 'queued',
139
+ suppressReason: null,
140
+ };
141
+ const items = [...q.items];
142
+ items[idx] = nextItem;
143
+ writeQueue(root, { ...q, items });
144
+ return nextItem;
145
+ }
146
+ export function reserveFollowUpReplay(root, input) {
147
+ const at = input.nowMs ?? nowMs();
148
+ pruneExpiredContinuationFollowUps(root, at);
149
+ const q = readQueue(root);
150
+ const item = q.items.find((i) => i.id === input.followUpId);
151
+ if (!item) {
152
+ return { reserved: false, item: null, reinjectionText: null, reason: 'not-found' };
153
+ }
154
+ if (item.status !== 'queued' && item.status !== 'replayed') {
155
+ return { reserved: false, item, reinjectionText: null, reason: `status-${item.status}` };
156
+ }
157
+ if (Date.parse(item.expiresAt) <= at) {
158
+ return { reserved: false, item, reinjectionText: null, reason: 'expired' };
159
+ }
160
+ const sid = input.sessionId ?? 'none';
161
+ if (item.lastReplaySessionId === sid && item.lastReplayedAt) {
162
+ return { reserved: false, item, reinjectionText: null, reason: 'already-replayed-this-session' };
163
+ }
164
+ const reservation = reserveContinuationEvent(root, {
165
+ key: `followup-replay:${input.followUpId}:${sid}`,
166
+ source: 'continuation-follow-up-replay',
167
+ ttlMs: input.replayReservationTtlMs ?? 90_000,
168
+ nowMs: at,
169
+ metadata: { followUpId: input.followUpId },
170
+ });
171
+ if (!reservation.reserved) {
172
+ return { reserved: false, item, reinjectionText: null, reason: 'hook-reservation-deduped' };
173
+ }
174
+ const reinjectionText = `[Operator follow-up reinjection] ${item.prompt}`;
175
+ return { reserved: true, item, reinjectionText };
176
+ }
177
+ export function markFollowUpReplayed(root, followUpId, sessionId) {
178
+ const q = readQueue(root);
179
+ const idx = q.items.findIndex((i) => i.id === followUpId);
180
+ if (idx < 0) {
181
+ return null;
182
+ }
183
+ const cur = q.items[idx];
184
+ const sid = sessionId ?? 'none';
185
+ const nextItem = {
186
+ ...cur,
187
+ status: 'replayed',
188
+ lastReplayedAt: now(),
189
+ lastReplaySessionId: sid,
190
+ };
191
+ const items = [...q.items];
192
+ items[idx] = nextItem;
193
+ writeQueue(root, { ...q, items });
194
+ ledgerFollowUp(root, 'continuation_followup_replayed', `Follow-up ${followUpId} replayed`, {
195
+ followUpId,
196
+ trigger: cur.trigger,
197
+ dedupeKey: cur.dedupeKey,
198
+ sessionId: cur.sessionId,
199
+ lane: cur.lane,
200
+ replaySessionId: sessionId,
201
+ });
202
+ return nextItem;
203
+ }
204
+ export function acknowledgeContinuationFollowUp(root, input) {
205
+ const q = readQueue(root);
206
+ const acknowledged = [];
207
+ const items = q.items.map((item) => {
208
+ if (item.status === 'acknowledged' || item.status === 'expired') {
209
+ return item;
210
+ }
211
+ let match = false;
212
+ if (input.followUpId) {
213
+ match = item.id === input.followUpId;
214
+ }
215
+ else if (input.dedupeKey) {
216
+ match = item.dedupeKey === input.dedupeKey;
217
+ }
218
+ else if (input.continuationId) {
219
+ match =
220
+ (item.status === 'queued' || item.status === 'replayed')
221
+ && item.metadata?.continuationId === input.continuationId;
222
+ }
223
+ else if (input.lane !== undefined) {
224
+ match =
225
+ item.lane === input.lane
226
+ && (input.sessionId === undefined || item.sessionId === input.sessionId || (input.sessionId === null && item.sessionId === null));
227
+ }
228
+ if (!match) {
229
+ return item;
230
+ }
231
+ const next = {
232
+ ...item,
233
+ status: 'acknowledged',
234
+ acknowledgedAt: now(),
235
+ suppressReason: null,
236
+ metadata: { ...item.metadata, ackReason: input.reason, ackSource: input.source },
237
+ };
238
+ acknowledged.push(next);
239
+ ledgerFollowUp(root, 'continuation_followup_acknowledged', `Follow-up ${item.id} acknowledged`, {
240
+ followUpId: item.id,
241
+ trigger: item.trigger,
242
+ dedupeKey: item.dedupeKey,
243
+ sessionId: item.sessionId,
244
+ lane: item.lane,
245
+ reason: input.reason,
246
+ source: input.source,
247
+ });
248
+ return next;
249
+ });
250
+ writeQueue(root, { ...q, items });
251
+ return { acknowledged };
252
+ }
253
+ export function acknowledgeContinuationFollowUpsOnProgress(root, input) {
254
+ acknowledgeContinuationFollowUp(root, {
255
+ lane: input.lane,
256
+ sessionId: input.sessionId,
257
+ reason: input.reason,
258
+ source: input.source,
259
+ });
260
+ }
261
+ export function readContinuationFollowUpQueue(root) {
262
+ const q = pruneExpiredContinuationFollowUps(root);
263
+ const counts = {
264
+ queued: 0,
265
+ replayed: 0,
266
+ suppressed: 0,
267
+ acknowledged: 0,
268
+ expired: 0,
269
+ };
270
+ for (const item of q.items) {
271
+ counts[item.status] += 1;
272
+ }
273
+ return { items: q.items, counts };
274
+ }
275
+ export function findQueuedFollowUpsForSession(root, sessionId) {
276
+ pruneExpiredContinuationFollowUps(root);
277
+ const q = readQueue(root);
278
+ return q.items.filter((i) => (i.status === 'queued' || i.status === 'replayed')
279
+ && (i.sessionId === sessionId || (sessionId === null && i.sessionId === null)));
280
+ }
281
+ export function findHeadQueuedFollowUp(root, trigger) {
282
+ pruneExpiredContinuationFollowUps(root);
283
+ const q = readQueue(root);
284
+ const candidates = q.items.filter((i) => (i.status === 'queued' || i.status === 'replayed')
285
+ && (!trigger || i.trigger === trigger));
286
+ return candidates.sort((a, b) => Date.parse(a.createdAt) - Date.parse(b.createdAt))[0] ?? null;
287
+ }
288
+ export function pickFollowUpForReplay(root, lane, sessionId) {
289
+ pruneExpiredContinuationFollowUps(root);
290
+ const q = readQueue(root);
291
+ const at = nowMs();
292
+ const candidates = q.items.filter((i) => (i.status === 'queued' || i.status === 'replayed')
293
+ && i.lane === lane
294
+ && Date.parse(i.expiresAt) > at
295
+ && (sessionId === null || i.sessionId === null || i.sessionId === sessionId));
296
+ return candidates.sort((a, b) => Date.parse(a.createdAt) - Date.parse(b.createdAt))[0] ?? null;
297
+ }
298
+ export function buildStopDenyDedupeKey(input) {
299
+ const sid = input.sessionId ?? 'none';
300
+ const lid = input.laneId ?? 'none';
301
+ return `followup:stop-deny:${sid}:${input.lane}:${lid}:${input.blockerFingerprint}`;
302
+ }
303
+ export function buildSessionIdleDedupeKey(input) {
304
+ const sid = input.sessionId ?? 'none';
305
+ const lid = input.laneId ?? 'none';
306
+ return `followup:session-idle:${sid}:${input.lane}:${lid}`;
307
+ }
308
+ export function buildPostToolFailureDedupeKey(input) {
309
+ const sid = input.sessionId ?? 'none';
310
+ return `followup:post-tool-failure:${sid}:${input.toolName}:escalated`;
311
+ }
312
+ export function buildTeamMessageFollowUpDedupeKey(teamId, messageId) {
313
+ return `followup:team-message:${teamId}:${messageId}`;
314
+ }
315
+ export function buildSubagentStopFollowUpDedupeKey(sessionId, agentId, outcome) {
316
+ const sid = sessionId ?? 'none';
317
+ return `followup:subagent-stop:${sid}:${agentId}:${outcome}`;
318
+ }
319
+ export function buildDelegatedFollowUpDedupeKey(continuationId, trigger) {
320
+ return `followup:deleg:${continuationId}:${trigger}`;
321
+ }
322
+ export function fingerprintBlockers(blockers) {
323
+ const s = blockers.join('|').slice(0, 200);
324
+ let h = 0;
325
+ for (let i = 0; i < s.length; i += 1) {
326
+ h = (h * 31 + s.charCodeAt(i)) | 0;
327
+ }
328
+ return `fp_${(h >>> 0).toString(16)}`;
329
+ }
330
+ //# sourceMappingURL=continuationFollowUp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continuationFollowUp.js","sourceRoot":"","sources":["../../../../src/shared/workflow/continuation/continuationFollowUp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAA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M,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Atlas-equivalent continuation orchestrator (Plan 12).
3
+ *
4
+ * TWIN note: runtime/hooks/_continuation.mjs is the runtime .mjs twin of this file.
5
+ * If logic changes here it MUST be reflected in _continuation.mjs, and vice-versa.
6
+ * The .mjs twin replicates isManualTaskCloseLedgerKind and isProtectedOperatorStatePath
7
+ * inline (those are TS-only; cannot be imported into .mjs at runtime).
8
+ *
9
+ * Single integration sink that wires together all five predecessor surfaces so
10
+ * active tasks, delegated sessions, and background work survive idle / stop /
11
+ * compaction boundaries.
12
+ *
13
+ * Per INV-031 the main enact-agent decides and orchestrates; runtime executes
14
+ * explicit graph nodes only. This module is therefore legitimately
15
+ * exported-only: the agent runtime (session-start.mjs / pre-compact.mjs hooks
16
+ * and the MCP operator tools) is the authoritative external caller. It is NOT
17
+ * dead code — it is the integration sink those callers import at runtime.
18
+ *
19
+ * Predecessor surfaces wired here:
20
+ * Slice 1 (subagent-tracker): recordSubagentStartedOnContinuation /
21
+ * recordSubagentStoppedOnContinuation — now reliable because
22
+ * subagent-tracker.mjs no longer crashes on SubagentStart/SubagentStop.
23
+ * Slice 2 (pre-compact): hasPendingLocalTasks — detects compaction survivors
24
+ * written by pre-compact.mjs's compaction-context.json write path.
25
+ * Slice 8 (protected-state): all state reads route through the Operator-owned
26
+ * broker (readContinuationState, readDelegatedSessionsState) rather than
27
+ * raw fs access.
28
+ * Slice 9 (team-transforms): captureActiveWorkflows + team-mailbox injection
29
+ * and role-gating layer is applied before re-enqueueing team work.
30
+ * Slice 10 (close-vocabulary): readContinuationFollowUpQueue /
31
+ * enqueueContinuationFollowUp — unified close-event vocabulary so both
32
+ * Factory workitem_manual_close and Operator task_manual_close unblock the
33
+ * follow-up queue.
34
+ */
35
+ import { recordSubagentStartedOnContinuation, recordSubagentStoppedOnContinuation } from '../../../shared/workflow/continuation/continuation.js';
36
+ import { type ActiveWorkflowSnapshot } from '../../../shared/workflow/continuation/hookContinuation.js';
37
+ import { type DelegatedSessionResumePlan } from '../../../shared/workflow/delegation/delegatedSession.js';
38
+ export type ContinuationTrigger = 'idle' | 'stop' | 'compaction';
39
+ export interface ContinuationOrchestrationResult {
40
+ trigger: ContinuationTrigger;
41
+ capturedAt: string;
42
+ /** Active workflow snapshot (Slice 9 — captureActiveWorkflows). */
43
+ activeWorkflows: ActiveWorkflowSnapshot;
44
+ /** Pending session-scoped task IDs re-enqueued into continuation state (gap closed by this orchestrator). */
45
+ pendingSessionTaskIds: string[];
46
+ /** Resume plans for stale/active delegated sessions (gap closed by this orchestrator). */
47
+ delegatedSessionResumePlans: DelegatedSessionResumePlan[];
48
+ /** Whether compaction survivors were detected via hasPendingLocalTasks (Slice 2). */
49
+ hasCompactionSurvivors: boolean;
50
+ /** Number of follow-up items enqueued into the close-vocabulary queue (Slice 10). */
51
+ followUpQueuedCount: number;
52
+ /** Subagent IDs currently tracked as active on continuation state (Slice 1). */
53
+ activeSubagentIds: string[];
54
+ }
55
+ /**
56
+ * Orchestrate continuation state across an idle / stop / compaction boundary.
57
+ *
58
+ * This is the single integration sink referenced by the atlas plan.
59
+ */
60
+ export declare function orchestrateContinuation(root: string, trigger: ContinuationTrigger): ContinuationOrchestrationResult;
61
+ /**
62
+ * Convenience re-exports so callers can use the Slice 1 subagent lifecycle
63
+ * surfaces through the orchestrator module without a separate import.
64
+ */
65
+ export { recordSubagentStartedOnContinuation, recordSubagentStoppedOnContinuation };
66
+ //# sourceMappingURL=continuationOrchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continuationOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/shared/workflow/continuation/continuationOrchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAKL,mCAAmC,EACnC,mCAAmC,EACpC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAKzH,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,kDAAkD,CAAC;AAe1D,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;AAEjE,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,eAAe,EAAE,sBAAsB,CAAC;IACxC,6GAA6G;IAC7G,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,0FAA0F;IAC1F,2BAA2B,EAAE,0BAA0B,EAAE,CAAC;IAC1D,qFAAqF;IACrF,sBAAsB,EAAE,OAAO,CAAC;IAChC,qFAAqF;IACrF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gFAAgF;IAChF,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,mBAAmB,GAC3B,+BAA+B,CAgHjC;AAED;;;GAGG;AACH,OAAO,EAAE,mCAAmC,EAAE,mCAAmC,EAAE,CAAC"}