@nubl/maestro 0.0.1 → 0.1.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 (398) hide show
  1. package/README.md +55 -2
  2. package/dist/config.json.example +30 -0
  3. package/dist/maestro/adapters/fake/fake-harness-adapter.d.ts +24 -0
  4. package/dist/maestro/adapters/fake/fake-harness-adapter.d.ts.map +1 -0
  5. package/dist/maestro/adapters/fake/fake-harness-adapter.js +210 -0
  6. package/dist/maestro/adapters/fake/fake-harness-adapter.js.map +1 -0
  7. package/dist/maestro/adapters/pi/accept-groups.d.ts +35 -0
  8. package/dist/maestro/adapters/pi/accept-groups.d.ts.map +1 -0
  9. package/dist/maestro/adapters/pi/accept-groups.js +70 -0
  10. package/dist/maestro/adapters/pi/accept-groups.js.map +1 -0
  11. package/dist/maestro/adapters/pi/accept-runner.d.ts +37 -0
  12. package/dist/maestro/adapters/pi/accept-runner.d.ts.map +1 -0
  13. package/dist/maestro/adapters/pi/accept-runner.js +161 -0
  14. package/dist/maestro/adapters/pi/accept-runner.js.map +1 -0
  15. package/dist/maestro/adapters/pi/activity-file.d.ts +39 -0
  16. package/dist/maestro/adapters/pi/activity-file.d.ts.map +1 -0
  17. package/dist/maestro/adapters/pi/activity-file.js +454 -0
  18. package/dist/maestro/adapters/pi/activity-file.js.map +1 -0
  19. package/dist/maestro/adapters/pi/child/accept-check.d.ts +24 -0
  20. package/dist/maestro/adapters/pi/child/accept-check.d.ts.map +1 -0
  21. package/dist/maestro/adapters/pi/child/accept-check.js +82 -0
  22. package/dist/maestro/adapters/pi/child/accept-check.js.map +1 -0
  23. package/dist/maestro/adapters/pi/child/declared-skills.d.ts +51 -0
  24. package/dist/maestro/adapters/pi/child/declared-skills.d.ts.map +1 -0
  25. package/dist/maestro/adapters/pi/child/declared-skills.js +148 -0
  26. package/dist/maestro/adapters/pi/child/declared-skills.js.map +1 -0
  27. package/dist/maestro/adapters/pi/child/done-nudge.d.ts +38 -0
  28. package/dist/maestro/adapters/pi/child/done-nudge.d.ts.map +1 -0
  29. package/dist/maestro/adapters/pi/child/done-nudge.js +77 -0
  30. package/dist/maestro/adapters/pi/child/done-nudge.js.map +1 -0
  31. package/dist/maestro/adapters/pi/child/entry.d.ts +3 -0
  32. package/dist/maestro/adapters/pi/child/entry.d.ts.map +1 -0
  33. package/dist/maestro/adapters/pi/child/entry.js +3 -0
  34. package/dist/maestro/adapters/pi/child/entry.js.map +1 -0
  35. package/dist/maestro/adapters/pi/child/protocol.d.ts +56 -0
  36. package/dist/maestro/adapters/pi/child/protocol.d.ts.map +1 -0
  37. package/dist/maestro/adapters/pi/child/protocol.js +510 -0
  38. package/dist/maestro/adapters/pi/child/protocol.js.map +1 -0
  39. package/dist/maestro/adapters/pi/completion.d.ts +45 -0
  40. package/dist/maestro/adapters/pi/completion.d.ts.map +1 -0
  41. package/dist/maestro/adapters/pi/completion.js +295 -0
  42. package/dist/maestro/adapters/pi/completion.js.map +1 -0
  43. package/dist/maestro/adapters/pi/launch-command.d.ts +27 -0
  44. package/dist/maestro/adapters/pi/launch-command.d.ts.map +1 -0
  45. package/dist/maestro/adapters/pi/launch-command.js +75 -0
  46. package/dist/maestro/adapters/pi/launch-command.js.map +1 -0
  47. package/dist/maestro/adapters/pi/launch-operations.d.ts +78 -0
  48. package/dist/maestro/adapters/pi/launch-operations.d.ts.map +1 -0
  49. package/dist/maestro/adapters/pi/launch-operations.js +270 -0
  50. package/dist/maestro/adapters/pi/launch-operations.js.map +1 -0
  51. package/dist/maestro/adapters/pi/launch-resume.d.ts +4 -0
  52. package/dist/maestro/adapters/pi/launch-resume.d.ts.map +1 -0
  53. package/dist/maestro/adapters/pi/launch-resume.js +183 -0
  54. package/dist/maestro/adapters/pi/launch-resume.js.map +1 -0
  55. package/dist/maestro/adapters/pi/launch.d.ts +148 -0
  56. package/dist/maestro/adapters/pi/launch.d.ts.map +1 -0
  57. package/dist/maestro/adapters/pi/launch.js +655 -0
  58. package/dist/maestro/adapters/pi/launch.js.map +1 -0
  59. package/dist/maestro/adapters/pi/model-registry.d.ts +3 -0
  60. package/dist/maestro/adapters/pi/model-registry.d.ts.map +1 -0
  61. package/dist/maestro/adapters/pi/model-registry.js +29 -0
  62. package/dist/maestro/adapters/pi/model-registry.js.map +1 -0
  63. package/dist/maestro/adapters/pi/pi-harness-adapter.d.ts +95 -0
  64. package/dist/maestro/adapters/pi/pi-harness-adapter.d.ts.map +1 -0
  65. package/dist/maestro/adapters/pi/pi-harness-adapter.js +549 -0
  66. package/dist/maestro/adapters/pi/pi-harness-adapter.js.map +1 -0
  67. package/dist/maestro/adapters/pi/process-identity.d.ts +92 -0
  68. package/dist/maestro/adapters/pi/process-identity.d.ts.map +1 -0
  69. package/dist/maestro/adapters/pi/process-identity.js +248 -0
  70. package/dist/maestro/adapters/pi/process-identity.js.map +1 -0
  71. package/dist/maestro/adapters/pi/process-tree.d.ts +48 -0
  72. package/dist/maestro/adapters/pi/process-tree.d.ts.map +1 -0
  73. package/dist/maestro/adapters/pi/process-tree.js +69 -0
  74. package/dist/maestro/adapters/pi/process-tree.js.map +1 -0
  75. package/dist/maestro/adapters/pi/script-shell.d.ts +40 -0
  76. package/dist/maestro/adapters/pi/script-shell.d.ts.map +1 -0
  77. package/dist/maestro/adapters/pi/script-shell.js +43 -0
  78. package/dist/maestro/adapters/pi/script-shell.js.map +1 -0
  79. package/dist/maestro/adapters/pi/session.d.ts +207 -0
  80. package/dist/maestro/adapters/pi/session.d.ts.map +1 -0
  81. package/dist/maestro/adapters/pi/session.js +714 -0
  82. package/dist/maestro/adapters/pi/session.js.map +1 -0
  83. package/dist/maestro/adapters/pi/task-model-init.d.ts +4 -0
  84. package/dist/maestro/adapters/pi/task-model-init.d.ts.map +1 -0
  85. package/dist/maestro/adapters/pi/task-model-init.js +47 -0
  86. package/dist/maestro/adapters/pi/task-model-init.js.map +1 -0
  87. package/dist/maestro/core/accept.d.ts +150 -0
  88. package/dist/maestro/core/accept.d.ts.map +1 -0
  89. package/dist/maestro/core/accept.js +243 -0
  90. package/dist/maestro/core/accept.js.map +1 -0
  91. package/dist/maestro/core/activity.d.ts +4 -0
  92. package/dist/maestro/core/activity.d.ts.map +1 -0
  93. package/dist/maestro/core/activity.js +18 -0
  94. package/dist/maestro/core/activity.js.map +1 -0
  95. package/dist/maestro/core/child-busy.d.ts +14 -0
  96. package/dist/maestro/core/child-busy.d.ts.map +1 -0
  97. package/dist/maestro/core/child-busy.js +14 -0
  98. package/dist/maestro/core/child-busy.js.map +1 -0
  99. package/dist/maestro/core/config/guidelines-config.d.ts +8 -0
  100. package/dist/maestro/core/config/guidelines-config.d.ts.map +1 -0
  101. package/dist/maestro/core/config/guidelines-config.js +60 -0
  102. package/dist/maestro/core/config/guidelines-config.js.map +1 -0
  103. package/dist/maestro/core/config/herdr-config.d.ts +13 -0
  104. package/dist/maestro/core/config/herdr-config.d.ts.map +1 -0
  105. package/dist/maestro/core/config/herdr-config.js +65 -0
  106. package/dist/maestro/core/config/herdr-config.js.map +1 -0
  107. package/dist/maestro/core/config/model-config.d.ts +92 -0
  108. package/dist/maestro/core/config/model-config.d.ts.map +1 -0
  109. package/dist/maestro/core/config/model-config.js +522 -0
  110. package/dist/maestro/core/config/model-config.js.map +1 -0
  111. package/dist/maestro/core/config/outcome-ledger-config.d.ts +8 -0
  112. package/dist/maestro/core/config/outcome-ledger-config.d.ts.map +1 -0
  113. package/dist/maestro/core/config/outcome-ledger-config.js +49 -0
  114. package/dist/maestro/core/config/outcome-ledger-config.js.map +1 -0
  115. package/dist/maestro/core/config/pane-config.d.ts +15 -0
  116. package/dist/maestro/core/config/pane-config.d.ts.map +1 -0
  117. package/dist/maestro/core/config/pane-config.js +101 -0
  118. package/dist/maestro/core/config/pane-config.js.map +1 -0
  119. package/dist/maestro/core/config/persistent-config.d.ts +7 -0
  120. package/dist/maestro/core/config/persistent-config.d.ts.map +1 -0
  121. package/dist/maestro/core/config/persistent-config.js +72 -0
  122. package/dist/maestro/core/config/persistent-config.js.map +1 -0
  123. package/dist/maestro/core/config/role-config.d.ts +7 -0
  124. package/dist/maestro/core/config/role-config.d.ts.map +1 -0
  125. package/dist/maestro/core/config/role-config.js +74 -0
  126. package/dist/maestro/core/config/role-config.js.map +1 -0
  127. package/dist/maestro/core/config/spawning-config.d.ts +7 -0
  128. package/dist/maestro/core/config/spawning-config.d.ts.map +1 -0
  129. package/dist/maestro/core/config/spawning-config.js +65 -0
  130. package/dist/maestro/core/config/spawning-config.js.map +1 -0
  131. package/dist/maestro/core/config/supervision-config.d.ts +7 -0
  132. package/dist/maestro/core/config/supervision-config.d.ts.map +1 -0
  133. package/dist/maestro/core/config/supervision-config.js +69 -0
  134. package/dist/maestro/core/config/supervision-config.js.map +1 -0
  135. package/dist/maestro/core/config/task-model-init.d.ts +118 -0
  136. package/dist/maestro/core/config/task-model-init.d.ts.map +1 -0
  137. package/dist/maestro/core/config/task-model-init.js +168 -0
  138. package/dist/maestro/core/config/task-model-init.js.map +1 -0
  139. package/dist/maestro/core/config/task-model-types.d.ts +36 -0
  140. package/dist/maestro/core/config/task-model-types.d.ts.map +1 -0
  141. package/dist/maestro/core/config/task-model-types.js +17 -0
  142. package/dist/maestro/core/config/task-model-types.js.map +1 -0
  143. package/dist/maestro/core/config/type-guards.d.ts +22 -0
  144. package/dist/maestro/core/config/type-guards.d.ts.map +1 -0
  145. package/dist/maestro/core/config/type-guards.js +31 -0
  146. package/dist/maestro/core/config/type-guards.js.map +1 -0
  147. package/dist/maestro/core/deadline.d.ts +11 -0
  148. package/dist/maestro/core/deadline.d.ts.map +1 -0
  149. package/dist/maestro/core/deadline.js +30 -0
  150. package/dist/maestro/core/deadline.js.map +1 -0
  151. package/dist/maestro/core/declared-skills.d.ts +16 -0
  152. package/dist/maestro/core/declared-skills.d.ts.map +1 -0
  153. package/dist/maestro/core/declared-skills.js +52 -0
  154. package/dist/maestro/core/declared-skills.js.map +1 -0
  155. package/dist/maestro/core/delegation-depth.d.ts +38 -0
  156. package/dist/maestro/core/delegation-depth.d.ts.map +1 -0
  157. package/dist/maestro/core/delegation-depth.js +59 -0
  158. package/dist/maestro/core/delegation-depth.js.map +1 -0
  159. package/dist/maestro/core/git-environment.d.ts +3 -0
  160. package/dist/maestro/core/git-environment.d.ts.map +1 -0
  161. package/dist/maestro/core/git-environment.js +29 -0
  162. package/dist/maestro/core/git-environment.js.map +1 -0
  163. package/dist/maestro/core/harness-adapter.d.ts +89 -0
  164. package/dist/maestro/core/harness-adapter.d.ts.map +1 -0
  165. package/dist/maestro/core/harness-adapter.js +2 -0
  166. package/dist/maestro/core/harness-adapter.js.map +1 -0
  167. package/dist/maestro/core/host-text.d.ts +49 -0
  168. package/dist/maestro/core/host-text.d.ts.map +1 -0
  169. package/dist/maestro/core/host-text.js +106 -0
  170. package/dist/maestro/core/host-text.js.map +1 -0
  171. package/dist/maestro/core/index.d.ts +4 -0
  172. package/dist/maestro/core/index.d.ts.map +1 -0
  173. package/dist/maestro/core/index.js +2 -0
  174. package/dist/maestro/core/index.js.map +1 -0
  175. package/dist/maestro/core/lifecycle.d.ts +16 -0
  176. package/dist/maestro/core/lifecycle.d.ts.map +1 -0
  177. package/dist/maestro/core/lifecycle.js +429 -0
  178. package/dist/maestro/core/lifecycle.js.map +1 -0
  179. package/dist/maestro/core/opened-primary-workspace.d.ts +31 -0
  180. package/dist/maestro/core/opened-primary-workspace.d.ts.map +1 -0
  181. package/dist/maestro/core/opened-primary-workspace.js +49 -0
  182. package/dist/maestro/core/opened-primary-workspace.js.map +1 -0
  183. package/dist/maestro/core/platform-support.d.ts +15 -0
  184. package/dist/maestro/core/platform-support.d.ts.map +1 -0
  185. package/dist/maestro/core/platform-support.js +23 -0
  186. package/dist/maestro/core/platform-support.js.map +1 -0
  187. package/dist/maestro/core/realpath-without-opening.d.ts +9 -0
  188. package/dist/maestro/core/realpath-without-opening.d.ts.map +1 -0
  189. package/dist/maestro/core/realpath-without-opening.js +45 -0
  190. package/dist/maestro/core/realpath-without-opening.js.map +1 -0
  191. package/dist/maestro/core/roles/discovery.d.ts +64 -0
  192. package/dist/maestro/core/roles/discovery.d.ts.map +1 -0
  193. package/dist/maestro/core/roles/discovery.js +422 -0
  194. package/dist/maestro/core/roles/discovery.js.map +1 -0
  195. package/dist/maestro/core/routing.d.ts +115 -0
  196. package/dist/maestro/core/routing.d.ts.map +1 -0
  197. package/dist/maestro/core/routing.js +449 -0
  198. package/dist/maestro/core/routing.js.map +1 -0
  199. package/dist/maestro/core/script-launch.d.ts +47 -0
  200. package/dist/maestro/core/script-launch.d.ts.map +1 -0
  201. package/dist/maestro/core/script-launch.js +102 -0
  202. package/dist/maestro/core/script-launch.js.map +1 -0
  203. package/dist/maestro/core/shell.d.ts +2 -0
  204. package/dist/maestro/core/shell.d.ts.map +1 -0
  205. package/dist/maestro/core/shell.js +4 -0
  206. package/dist/maestro/core/shell.js.map +1 -0
  207. package/dist/maestro/core/specialist-notice.d.ts +36 -0
  208. package/dist/maestro/core/specialist-notice.d.ts.map +1 -0
  209. package/dist/maestro/core/specialist-notice.js +41 -0
  210. package/dist/maestro/core/specialist-notice.js.map +1 -0
  211. package/dist/maestro/core/status.d.ts +87 -0
  212. package/dist/maestro/core/status.d.ts.map +1 -0
  213. package/dist/maestro/core/status.js +369 -0
  214. package/dist/maestro/core/status.js.map +1 -0
  215. package/dist/maestro/core/supervision.d.ts +56 -0
  216. package/dist/maestro/core/supervision.d.ts.map +1 -0
  217. package/dist/maestro/core/supervision.js +249 -0
  218. package/dist/maestro/core/supervision.js.map +1 -0
  219. package/dist/maestro/core/surface-provider.d.ts +200 -0
  220. package/dist/maestro/core/surface-provider.d.ts.map +1 -0
  221. package/dist/maestro/core/surface-provider.js +71 -0
  222. package/dist/maestro/core/surface-provider.js.map +1 -0
  223. package/dist/maestro/core/types.d.ts +388 -0
  224. package/dist/maestro/core/types.d.ts.map +1 -0
  225. package/dist/maestro/core/types.js +2 -0
  226. package/dist/maestro/core/types.js.map +1 -0
  227. package/dist/maestro/core/undelivered-children.d.ts +27 -0
  228. package/dist/maestro/core/undelivered-children.d.ts.map +1 -0
  229. package/dist/maestro/core/undelivered-children.js +31 -0
  230. package/dist/maestro/core/undelivered-children.js.map +1 -0
  231. package/dist/maestro/core/wake.d.ts +32 -0
  232. package/dist/maestro/core/wake.d.ts.map +1 -0
  233. package/dist/maestro/core/wake.js +125 -0
  234. package/dist/maestro/core/wake.js.map +1 -0
  235. package/dist/maestro/core/worktree-cleanup.d.ts +75 -0
  236. package/dist/maestro/core/worktree-cleanup.d.ts.map +1 -0
  237. package/dist/maestro/core/worktree-cleanup.js +278 -0
  238. package/dist/maestro/core/worktree-cleanup.js.map +1 -0
  239. package/dist/maestro/core/worktree.d.ts +50 -0
  240. package/dist/maestro/core/worktree.d.ts.map +1 -0
  241. package/dist/maestro/core/worktree.js +23 -0
  242. package/dist/maestro/core/worktree.js.map +1 -0
  243. package/dist/maestro/engine.d.ts +5 -0
  244. package/dist/maestro/engine.d.ts.map +1 -0
  245. package/dist/maestro/engine.js +5 -0
  246. package/dist/maestro/engine.js.map +1 -0
  247. package/dist/maestro/pi/child.d.ts +8 -0
  248. package/dist/maestro/pi/child.d.ts.map +1 -0
  249. package/dist/maestro/pi/child.js +8 -0
  250. package/dist/maestro/pi/child.js.map +1 -0
  251. package/dist/maestro/pi/extension.d.ts +10 -0
  252. package/dist/maestro/pi/extension.d.ts.map +1 -0
  253. package/dist/maestro/pi/extension.js +8 -0
  254. package/dist/maestro/pi/extension.js.map +1 -0
  255. package/dist/maestro/pi/subagents-index.d.ts +9 -0
  256. package/dist/maestro/pi/subagents-index.d.ts.map +1 -0
  257. package/dist/maestro/pi/subagents-index.js +9 -0
  258. package/dist/maestro/pi/subagents-index.js.map +1 -0
  259. package/dist/maestro/pi.d.ts +9 -0
  260. package/dist/maestro/pi.d.ts.map +1 -0
  261. package/dist/maestro/pi.js +7 -0
  262. package/dist/maestro/pi.js.map +1 -0
  263. package/dist/maestro/runtime/accept-recheck.d.ts +32 -0
  264. package/dist/maestro/runtime/accept-recheck.d.ts.map +1 -0
  265. package/dist/maestro/runtime/accept-recheck.js +92 -0
  266. package/dist/maestro/runtime/accept-recheck.js.map +1 -0
  267. package/dist/maestro/runtime/delegated-marker.d.ts +112 -0
  268. package/dist/maestro/runtime/delegated-marker.d.ts.map +1 -0
  269. package/dist/maestro/runtime/delegated-marker.js +200 -0
  270. package/dist/maestro/runtime/delegated-marker.js.map +1 -0
  271. package/dist/maestro/runtime/host-surface-binding.d.ts +25 -0
  272. package/dist/maestro/runtime/host-surface-binding.d.ts.map +1 -0
  273. package/dist/maestro/runtime/host-surface-binding.js +2 -0
  274. package/dist/maestro/runtime/host-surface-binding.js.map +1 -0
  275. package/dist/maestro/runtime/index.d.ts +10 -0
  276. package/dist/maestro/runtime/index.d.ts.map +1 -0
  277. package/dist/maestro/runtime/index.js +6 -0
  278. package/dist/maestro/runtime/index.js.map +1 -0
  279. package/dist/maestro/runtime/pi-persistent-io.d.ts +7 -0
  280. package/dist/maestro/runtime/pi-persistent-io.d.ts.map +1 -0
  281. package/dist/maestro/runtime/pi-persistent-io.js +64 -0
  282. package/dist/maestro/runtime/pi-persistent-io.js.map +1 -0
  283. package/dist/maestro/runtime/pi-run-session-types.d.ts +328 -0
  284. package/dist/maestro/runtime/pi-run-session-types.d.ts.map +1 -0
  285. package/dist/maestro/runtime/pi-run-session-types.js +2 -0
  286. package/dist/maestro/runtime/pi-run-session-types.js.map +1 -0
  287. package/dist/maestro/runtime/pi-run-session.d.ts +12 -0
  288. package/dist/maestro/runtime/pi-run-session.d.ts.map +1 -0
  289. package/dist/maestro/runtime/pi-run-session.js +809 -0
  290. package/dist/maestro/runtime/pi-run-session.js.map +1 -0
  291. package/dist/maestro/runtime/run-session.d.ts +129 -0
  292. package/dist/maestro/runtime/run-session.d.ts.map +1 -0
  293. package/dist/maestro/runtime/run-session.js +680 -0
  294. package/dist/maestro/runtime/run-session.js.map +1 -0
  295. package/dist/maestro/runtime/surface-retention.d.ts +3 -0
  296. package/dist/maestro/runtime/surface-retention.d.ts.map +1 -0
  297. package/dist/maestro/runtime/surface-retention.js +5 -0
  298. package/dist/maestro/runtime/surface-retention.js.map +1 -0
  299. package/dist/maestro/runtime/task-model-init.d.ts +34 -0
  300. package/dist/maestro/runtime/task-model-init.d.ts.map +1 -0
  301. package/dist/maestro/runtime/task-model-init.js +78 -0
  302. package/dist/maestro/runtime/task-model-init.js.map +1 -0
  303. package/dist/maestro/runtime/worktree-operations.d.ts +31 -0
  304. package/dist/maestro/runtime/worktree-operations.d.ts.map +1 -0
  305. package/dist/maestro/runtime/worktree-operations.js +633 -0
  306. package/dist/maestro/runtime/worktree-operations.js.map +1 -0
  307. package/dist/maestro/surfaces/fake/fake-surface-provider.d.ts +54 -0
  308. package/dist/maestro/surfaces/fake/fake-surface-provider.d.ts.map +1 -0
  309. package/dist/maestro/surfaces/fake/fake-surface-provider.js +231 -0
  310. package/dist/maestro/surfaces/fake/fake-surface-provider.js.map +1 -0
  311. package/dist/maestro/testing/harness-adapter.conformance.d.ts +31 -0
  312. package/dist/maestro/testing/harness-adapter.conformance.d.ts.map +1 -0
  313. package/dist/maestro/testing/harness-adapter.conformance.js +181 -0
  314. package/dist/maestro/testing/harness-adapter.conformance.js.map +1 -0
  315. package/dist/maestro/testing/index.d.ts +5 -0
  316. package/dist/maestro/testing/index.d.ts.map +1 -0
  317. package/dist/maestro/testing/index.js +5 -0
  318. package/dist/maestro/testing/index.js.map +1 -0
  319. package/dist/maestro/testing/surface-provider.conformance.d.ts +20 -0
  320. package/dist/maestro/testing/surface-provider.conformance.d.ts.map +1 -0
  321. package/dist/maestro/testing/surface-provider.conformance.js +167 -0
  322. package/dist/maestro/testing/surface-provider.conformance.js.map +1 -0
  323. package/dist/pi-extension/subagents/catalog.d.ts +70 -0
  324. package/dist/pi-extension/subagents/catalog.d.ts.map +1 -0
  325. package/dist/pi-extension/subagents/catalog.js +231 -0
  326. package/dist/pi-extension/subagents/catalog.js.map +1 -0
  327. package/dist/pi-extension/subagents/config-path.d.ts +6 -0
  328. package/dist/pi-extension/subagents/config-path.d.ts.map +1 -0
  329. package/dist/pi-extension/subagents/config-path.js +21 -0
  330. package/dist/pi-extension/subagents/config-path.js.map +1 -0
  331. package/dist/pi-extension/subagents/control-tools.d.ts +21 -0
  332. package/dist/pi-extension/subagents/control-tools.d.ts.map +1 -0
  333. package/dist/pi-extension/subagents/control-tools.js +150 -0
  334. package/dist/pi-extension/subagents/control-tools.js.map +1 -0
  335. package/dist/pi-extension/subagents/controls.d.ts +52 -0
  336. package/dist/pi-extension/subagents/controls.d.ts.map +1 -0
  337. package/dist/pi-extension/subagents/controls.js +173 -0
  338. package/dist/pi-extension/subagents/controls.js.map +1 -0
  339. package/dist/pi-extension/subagents/deferred-tools.d.ts +43 -0
  340. package/dist/pi-extension/subagents/deferred-tools.d.ts.map +1 -0
  341. package/dist/pi-extension/subagents/deferred-tools.js +67 -0
  342. package/dist/pi-extension/subagents/deferred-tools.js.map +1 -0
  343. package/dist/pi-extension/subagents/delivery.d.ts +22 -0
  344. package/dist/pi-extension/subagents/delivery.d.ts.map +1 -0
  345. package/dist/pi-extension/subagents/delivery.js +365 -0
  346. package/dist/pi-extension/subagents/delivery.js.map +1 -0
  347. package/dist/pi-extension/subagents/extension.d.ts +100 -0
  348. package/dist/pi-extension/subagents/extension.d.ts.map +1 -0
  349. package/dist/pi-extension/subagents/extension.js +367 -0
  350. package/dist/pi-extension/subagents/extension.js.map +1 -0
  351. package/dist/pi-extension/subagents/launch-tools.d.ts +33 -0
  352. package/dist/pi-extension/subagents/launch-tools.d.ts.map +1 -0
  353. package/dist/pi-extension/subagents/launch-tools.js +373 -0
  354. package/dist/pi-extension/subagents/launch-tools.js.map +1 -0
  355. package/dist/pi-extension/subagents/launch.d.ts +86 -0
  356. package/dist/pi-extension/subagents/launch.d.ts.map +1 -0
  357. package/dist/pi-extension/subagents/launch.js +133 -0
  358. package/dist/pi-extension/subagents/launch.js.map +1 -0
  359. package/dist/pi-extension/subagents/model-registry.d.ts +13 -0
  360. package/dist/pi-extension/subagents/model-registry.d.ts.map +1 -0
  361. package/dist/pi-extension/subagents/model-registry.js +52 -0
  362. package/dist/pi-extension/subagents/model-registry.js.map +1 -0
  363. package/dist/pi-extension/subagents/observation.d.ts +38 -0
  364. package/dist/pi-extension/subagents/observation.d.ts.map +1 -0
  365. package/dist/pi-extension/subagents/observation.js +168 -0
  366. package/dist/pi-extension/subagents/observation.js.map +1 -0
  367. package/dist/pi-extension/subagents/persistent.d.ts +72 -0
  368. package/dist/pi-extension/subagents/persistent.d.ts.map +1 -0
  369. package/dist/pi-extension/subagents/persistent.js +322 -0
  370. package/dist/pi-extension/subagents/persistent.js.map +1 -0
  371. package/dist/pi-extension/subagents/presentation-hooks.d.ts +25 -0
  372. package/dist/pi-extension/subagents/presentation-hooks.d.ts.map +1 -0
  373. package/dist/pi-extension/subagents/presentation-hooks.js +2 -0
  374. package/dist/pi-extension/subagents/presentation-hooks.js.map +1 -0
  375. package/dist/pi-extension/subagents/presentation.d.ts +149 -0
  376. package/dist/pi-extension/subagents/presentation.d.ts.map +1 -0
  377. package/dist/pi-extension/subagents/presentation.js +419 -0
  378. package/dist/pi-extension/subagents/presentation.js.map +1 -0
  379. package/dist/pi-extension/subagents/state.d.ts +183 -0
  380. package/dist/pi-extension/subagents/state.d.ts.map +1 -0
  381. package/dist/pi-extension/subagents/state.js +92 -0
  382. package/dist/pi-extension/subagents/state.js.map +1 -0
  383. package/dist/pi-extension/subagents/task-models.d.ts +9 -0
  384. package/dist/pi-extension/subagents/task-models.d.ts.map +1 -0
  385. package/dist/pi-extension/subagents/task-models.js +293 -0
  386. package/dist/pi-extension/subagents/task-models.js.map +1 -0
  387. package/dist/pi-extension/subagents/tool-boundary.d.ts +16 -0
  388. package/dist/pi-extension/subagents/tool-boundary.d.ts.map +1 -0
  389. package/dist/pi-extension/subagents/tool-boundary.js +53 -0
  390. package/dist/pi-extension/subagents/tool-boundary.js.map +1 -0
  391. package/dist/pi-extension/subagents/worktree-tools.d.ts +16 -0
  392. package/dist/pi-extension/subagents/worktree-tools.d.ts.map +1 -0
  393. package/dist/pi-extension/subagents/worktree-tools.js +185 -0
  394. package/dist/pi-extension/subagents/worktree-tools.js.map +1 -0
  395. package/dist/provenance.json +5 -0
  396. package/package.json +540 -27
  397. package/index.d.ts +0 -1
  398. package/index.js +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../../maestro/core/worktree.ts"],"names":[],"mappings":"AAiDA,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IACnD,OAAO,CACN,KAAK,CAAC,OAAO,KAAK,CAAC;QACnB,KAAK,CAAC,IAAI,KAAK,cAAc;QAC7B,KAAK,CAAC,KAAK,KAAK,oBAAoB,CACpC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CACpC,QAAoB,EACpB,KAAiB,EACjB,SAAiB;IAEjB,OAAO;QACN,GAAG,QAAQ;QACX,GAAG,KAAK;QACR,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,oBAAoB;QAC3B,SAAS;KACT,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAClC,QAAgB,EAChB,SAAkB;IAElB,OAAO,SAAS;QACf,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,QAAQ,KAAK,CAAC;YACf,CAAC,CAAC,kBAAkB;YACpB,CAAC,CAAC,QAAQ,CAAC;AACd,CAAC","sourcesContent":["import type { JsonObject } from \"./config/type-guards.ts\";\n\nexport interface WorktreeLaunch {\n\tpath: string;\n\tworkspaceId: string;\n\tpaneId: string;\n\tbranch: string;\n\tbaseRef: string;\n\tbaseSha: string;\n\tmanifestFile: string;\n\tsessionFile?: string;\n\tsourceSessionFile?: string;\n\thandoffMessage?: string;\n\t/** Non-fatal provisioning problems reported with the launch. */\n\tdiagnostics?: string[];\n}\n\nexport interface FailedWorktreeManifest extends JsonObject {\n\tstate: \"failed\";\n\tid: string;\n\tname: string;\n\tsourceCwd: string;\n\tbranch: string;\n\tbaseRef: string;\n\tbaseSha: string;\n\tcreatedAt: number;\n\tpath?: string;\n\tworkspaceId?: string;\n\terror?: string;\n}\n\nexport interface WorktreeHandoff extends WorktreeLaunch {\n\theadSha: string | null;\n\tcommitsAhead: number | null;\n\tclean: boolean | null;\n\tconflicted: boolean | null;\n\tchangedFiles: string[] | null;\n\tuntrackedFiles: string[] | null;\n\tgitError?: string;\n}\n\nexport type WorktreeResultState =\n\t| \"running\"\n\t| \"ready_for_review\"\n\t| \"failed\"\n\t| \"needs_help\"\n\t| \"cancelled\"\n\t| \"removed\";\n\nexport function isWorktreeManifest(value: JsonObject): boolean {\n\treturn (\n\t\tvalue.version === 1 &&\n\t\tvalue.kind === \"worktree-run\" &&\n\t\tvalue.owner === \"pi-herdr-subagents\"\n\t);\n}\n\nexport function mergeWorktreeManifest(\n\texisting: JsonObject,\n\tvalue: JsonObject,\n\tupdatedAt: number,\n): JsonObject {\n\treturn {\n\t\t...existing,\n\t\t...value,\n\t\tversion: 1,\n\t\tkind: \"worktree-run\",\n\t\towner: \"pi-herdr-subagents\",\n\t\tupdatedAt,\n\t};\n}\n\nexport function worktreeResultState(\n\texitCode: number,\n\tneedsHelp: boolean,\n): WorktreeResultState {\n\treturn needsHelp\n\t\t? \"needs_help\"\n\t\t: exitCode === 0\n\t\t\t? \"ready_for_review\"\n\t\t\t: \"failed\";\n}\n\n/** Launch and completion consume effects supplied by the runtime composition. */\nexport interface WorktreeOperations {\n\tresolveGitCommit(cwd: string, ref: string): Promise<string>;\n\tresolveWorktreeProvisionCwd(sourceCwd: string): Promise<string>;\n\twriteWorktreeManifest(path: string, value: JsonObject): void;\n\tcaptureWorktreeHandoff(worktree: WorktreeLaunch): Promise<WorktreeHandoff>;\n\tpersistWorktreeResult(\n\t\tworktree: WorktreeLaunch,\n\t\tstate: WorktreeResultState,\n\t\thandoff?: WorktreeHandoff,\n\t): void;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ /** Generic owner facade. Importing this module does not initialize a harness. */
2
+ export * from "./core/index.ts";
3
+ export * from "./runtime/run-session.ts";
4
+ export { defaultRetainSurface } from "./runtime/surface-retention.ts";
5
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../maestro/engine.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Generic owner facade. Importing this module does not initialize a harness. */
2
+ export * from "./core/index.js";
3
+ export * from "./runtime/run-session.js";
4
+ export { defaultRetainSurface } from "./runtime/surface-retention.js";
5
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../maestro/engine.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["/** Generic owner facade. Importing this module does not initialize a harness. */\nexport * from \"./core/index.ts\";\nexport * from \"./runtime/run-session.ts\";\nexport { defaultRetainSurface } from \"./runtime/surface-retention.ts\";\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Child protocol facade (`@nubl/maestro/pi/child`). The default export is the
3
+ * protocol-only child extension, the same instance the emitted launch entry
4
+ * (`DEFAULT_CHILD_ENTRY_PATH`) loads. A terminal host's child wrapper calls
5
+ * `createChildExtension(renderWidget)` with its presentation hook instead.
6
+ */
7
+ export { createChildExtension, default, type ChildPresentationHook, } from "../adapters/pi/child/protocol.ts";
8
+ //# sourceMappingURL=child.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child.d.ts","sourceRoot":"","sources":["../../../maestro/pi/child.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,oBAAoB,EACpB,OAAO,EACP,KAAK,qBAAqB,GAC1B,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Child protocol facade (`@nubl/maestro/pi/child`). The default export is the
3
+ * protocol-only child extension, the same instance the emitted launch entry
4
+ * (`DEFAULT_CHILD_ENTRY_PATH`) loads. A terminal host's child wrapper calls
5
+ * `createChildExtension(renderWidget)` with its presentation hook instead.
6
+ */
7
+ export { createChildExtension, default, } from "../adapters/pi/child/protocol.js";
8
+ //# sourceMappingURL=child.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child.js","sourceRoot":"","sources":["../../../maestro/pi/child.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,oBAAoB,EACpB,OAAO,GAEP,MAAM,kCAAkC,CAAC","sourcesContent":["/**\n * Child protocol facade (`@nubl/maestro/pi/child`). The default export is the\n * protocol-only child extension, the same instance the emitted launch entry\n * (`DEFAULT_CHILD_ENTRY_PATH`) loads. A terminal host's child wrapper calls\n * `createChildExtension(renderWidget)` with its presentation hook instead.\n */\nexport {\n\tcreateChildExtension,\n\tdefault,\n\ttype ChildPresentationHook,\n} from \"../adapters/pi/child/protocol.ts\";\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Callable Pi composition entry (`@nubl/maestro/pi/extension`). The default
3
+ * export is `createPiExtension` itself: a host wrapper calls it with explicit
4
+ * host options once per Pi load. It is not a zero-config extension, so a host
5
+ * never lists this module as a Pi extension path.
6
+ */
7
+ export { createPiExtension, createPiExtension as default, type PiHostOptions, } from "../../pi-extension/subagents/extension.ts";
8
+ export type { PiPresentationHooks, PiToolRenderers, } from "../../pi-extension/subagents/presentation-hooks.ts";
9
+ export type { HostSurfaceBinding } from "../runtime/host-surface-binding.ts";
10
+ //# sourceMappingURL=extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../maestro/pi/extension.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,iBAAiB,EACjB,iBAAiB,IAAI,OAAO,EAC5B,KAAK,aAAa,GAClB,MAAM,2CAA2C,CAAC;AACnD,YAAY,EACX,mBAAmB,EACnB,eAAe,GACf,MAAM,oDAAoD,CAAC;AAC5D,YAAY,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Callable Pi composition entry (`@nubl/maestro/pi/extension`). The default
3
+ * export is `createPiExtension` itself: a host wrapper calls it with explicit
4
+ * host options once per Pi load. It is not a zero-config extension, so a host
5
+ * never lists this module as a Pi extension path.
6
+ */
7
+ export { createPiExtension, createPiExtension as default, } from "../../pi-extension/subagents/extension.js";
8
+ //# sourceMappingURL=extension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.js","sourceRoot":"","sources":["../../../maestro/pi/extension.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,iBAAiB,EACjB,iBAAiB,IAAI,OAAO,GAE5B,MAAM,2CAA2C,CAAC","sourcesContent":["/**\n * Callable Pi composition entry (`@nubl/maestro/pi/extension`). The default\n * export is `createPiExtension` itself: a host wrapper calls it with explicit\n * host options once per Pi load. It is not a zero-config extension, so a host\n * never lists this module as a Pi extension path.\n */\nexport {\n\tcreatePiExtension,\n\tcreatePiExtension as default,\n\ttype PiHostOptions,\n} from \"../../pi-extension/subagents/extension.ts\";\nexport type {\n\tPiPresentationHooks,\n\tPiToolRenderers,\n} from \"../../pi-extension/subagents/presentation-hooks.ts\";\nexport type { HostSurfaceBinding } from \"../runtime/host-surface-binding.ts\";\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Internal-compat counterpart of the upstream terminal entry
3
+ * (`@nubl/maestro/pi/subagents/index`): the same named helpers, and a default
4
+ * export that delegates to the factory. Unlike the terminal entry it creates no
5
+ * extension instance, so it has no `__test__`, widgets or renderers; the host
6
+ * calls `createPiExtension` with its own binding and presentation.
7
+ */
8
+ export { cleanupSubagentsForShutdown, createPiExtension, createPiExtension as default, hasWorkingSubagents, selectCompletionApi, shouldAdvanceToFallback, shouldDeliverSubagentCompletion, shouldPreserveSubagentsOnShutdown, } from "../../pi-extension/subagents/extension.ts";
9
+ //# sourceMappingURL=subagents-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagents-index.d.ts","sourceRoot":"","sources":["../../../maestro/pi/subagents-index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACN,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,IAAI,OAAO,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,+BAA+B,EAC/B,iCAAiC,GACjC,MAAM,2CAA2C,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Internal-compat counterpart of the upstream terminal entry
3
+ * (`@nubl/maestro/pi/subagents/index`): the same named helpers, and a default
4
+ * export that delegates to the factory. Unlike the terminal entry it creates no
5
+ * extension instance, so it has no `__test__`, widgets or renderers; the host
6
+ * calls `createPiExtension` with its own binding and presentation.
7
+ */
8
+ export { cleanupSubagentsForShutdown, createPiExtension, createPiExtension as default, hasWorkingSubagents, selectCompletionApi, shouldAdvanceToFallback, shouldDeliverSubagentCompletion, shouldPreserveSubagentsOnShutdown, } from "../../pi-extension/subagents/extension.js";
9
+ //# sourceMappingURL=subagents-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagents-index.js","sourceRoot":"","sources":["../../../maestro/pi/subagents-index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACN,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,IAAI,OAAO,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,+BAA+B,EAC/B,iCAAiC,GACjC,MAAM,2CAA2C,CAAC","sourcesContent":["/**\n * Internal-compat counterpart of the upstream terminal entry\n * (`@nubl/maestro/pi/subagents/index`): the same named helpers, and a default\n * export that delegates to the factory. Unlike the terminal entry it creates no\n * extension instance, so it has no `__test__`, widgets or renderers; the host\n * calls `createPiExtension` with its own binding and presentation.\n */\nexport {\n\tcleanupSubagentsForShutdown,\n\tcreatePiExtension,\n\tcreatePiExtension as default,\n\thasWorkingSubagents,\n\tselectCompletionApi,\n\tshouldAdvanceToFallback,\n\tshouldDeliverSubagentCompletion,\n\tshouldPreserveSubagentsOnShutdown,\n} from \"../../pi-extension/subagents/extension.ts\";\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Pi composition facade (`@nubl/maestro/pi`). A host calls `createPiExtension`
3
+ * once per Pi load with its HostSurfaceBinding and PiPresentationHooks; the
4
+ * package registers nothing by itself and discovers no provider.
5
+ */
6
+ export { createPiExtension, type PiHostOptions, } from "../pi-extension/subagents/extension.ts";
7
+ export type { PiPresentationHooks, PiToolRenderers, } from "../pi-extension/subagents/presentation-hooks.ts";
8
+ export type { HostSurfaceBinding } from "./runtime/host-surface-binding.ts";
9
+ //# sourceMappingURL=pi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../maestro/pi.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACN,iBAAiB,EACjB,KAAK,aAAa,GAClB,MAAM,wCAAwC,CAAC;AAChD,YAAY,EACX,mBAAmB,EACnB,eAAe,GACf,MAAM,iDAAiD,CAAC;AACzD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Pi composition facade (`@nubl/maestro/pi`). A host calls `createPiExtension`
3
+ * once per Pi load with its HostSurfaceBinding and PiPresentationHooks; the
4
+ * package registers nothing by itself and discovers no provider.
5
+ */
6
+ export { createPiExtension, } from "../pi-extension/subagents/extension.js";
7
+ //# sourceMappingURL=pi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.js","sourceRoot":"","sources":["../../maestro/pi.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACN,iBAAiB,GAEjB,MAAM,wCAAwC,CAAC","sourcesContent":["/**\n * Pi composition facade (`@nubl/maestro/pi`). A host calls `createPiExtension`\n * once per Pi load with its HostSurfaceBinding and PiPresentationHooks; the\n * package registers nothing by itself and discovers no provider.\n */\nexport {\n\tcreatePiExtension,\n\ttype PiHostOptions,\n} from \"../pi-extension/subagents/extension.ts\";\nexport type {\n\tPiPresentationHooks,\n\tPiToolRenderers,\n} from \"../pi-extension/subagents/presentation-hooks.ts\";\nexport type { HostSurfaceBinding } from \"./runtime/host-surface-binding.ts\";\n"]}
@@ -0,0 +1,32 @@
1
+ import { buildOutcomeLedgerLine, type AcceptOutcome, type AcceptSpec, type OutcomeLedgerLine } from "../core/accept.ts";
2
+ import type { CompletionEvidence, RunResult } from "../core/types.ts";
3
+ import type { WorktreeHandoff } from "../core/worktree.ts";
4
+ import type { AcceptRunner } from "../adapters/pi/accept-runner.ts";
5
+ import type { AcceptCheckOwner } from "../adapters/pi/accept-groups.ts";
6
+ import type { FinalizeControl } from "./run-session.ts";
7
+ export interface ParentAcceptInput {
8
+ spec: AcceptSpec;
9
+ result: RunResult;
10
+ evidence: CompletionEvidence | undefined;
11
+ exitCode: number;
12
+ /** The child's checkout: the worktree root or its ordinary cwd. */
13
+ cwd: string | undefined;
14
+ /** Captured before the re-check; its file lists reveal changed check files. */
15
+ worktree: WorktreeHandoff | undefined;
16
+ control: FinalizeControl;
17
+ runner: AcceptRunner;
18
+ /** Stops this check at shutdown (`accept-groups.ts`). */
19
+ owner?: AcceptCheckOwner;
20
+ }
21
+ /**
22
+ * Re-run the check only for a completed, uncancelled, exit-0, non-ping
23
+ * result. A cancel that wins during it, or a parent shutdown, makes the
24
+ * verdict `skipped` whatever the check returned: the kernel is authoritative.
25
+ */
26
+ export declare function runParentAcceptCheck(input: ParentAcceptInput): Promise<AcceptOutcome>;
27
+ /** How one model attempt ended, for its outcome-ledger line. */
28
+ export declare function ledgerOutcome(result: RunResult, evidence: CompletionEvidence | undefined, exitCode: number, cancelledInCheck: boolean): OutcomeLedgerLine["outcome"];
29
+ export declare function outcomeLedgerFile(configDir: string): string;
30
+ /** Best effort: a ledger failure never changes or delays a delivery. */
31
+ export declare function appendOutcomeLedger(file: string, input: Parameters<typeof buildOutcomeLedgerLine>[0]): OutcomeLedgerLine | undefined;
32
+ //# sourceMappingURL=accept-recheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accept-recheck.d.ts","sourceRoot":"","sources":["../../../maestro/runtime/accept-recheck.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,sBAAsB,EAKtB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAkBxD,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,+EAA+E;IAC/E,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAC;IACtC,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,yDAAyD;IACzD,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACzC,KAAK,EAAE,iBAAiB,GACtB,OAAO,CAAC,aAAa,CAAC,CAqCxB;AAED,gEAAgE;AAChE,wBAAgB,aAAa,CAC5B,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,kBAAkB,GAAG,SAAS,EACxC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,OAAO,GACvB,iBAAiB,CAAC,SAAS,CAAC,CAK9B;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,GACjD,iBAAiB,GAAG,SAAS,CAS/B"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * The parent's accept re-check and the outcome ledger. The re-check alone
3
+ * produces `accepted`, `rejected` and `error`; the child's report is evidence.
4
+ */
5
+ import { appendFileSync, mkdirSync } from "node:fs";
6
+ import { dirname, join } from "node:path";
7
+ import { buildOutcomeLedgerLine, changedCheckFiles, OUTCOME_LEDGER_FILE, skippedOutcome, verdictFromCommand, } from "../core/accept.js";
8
+ /** Why a requested check did not run; undefined when the run completed naturally. */
9
+ function skipReason(result, evidence, exitCode) {
10
+ if (result.cancellation)
11
+ return "cancelled";
12
+ if (result.outcome === "killed")
13
+ return "stopped before completion";
14
+ if (evidence?.ping || result.outcome === "help")
15
+ return "help request";
16
+ if (evidence?.errorMessage)
17
+ return "provider error";
18
+ if (!evidence)
19
+ return "run failed";
20
+ if (result.outcome !== "completed" || exitCode !== 0)
21
+ return `exit code ${exitCode}`;
22
+ return undefined;
23
+ }
24
+ /**
25
+ * Re-run the check only for a completed, uncancelled, exit-0, non-ping
26
+ * result. A cancel that wins during it, or a parent shutdown, makes the
27
+ * verdict `skipped` whatever the check returned: the kernel is authoritative.
28
+ */
29
+ export async function runParentAcceptCheck(input) {
30
+ const { spec, worktree } = input;
31
+ const reason = skipReason(input.result, input.evidence, input.exitCode);
32
+ let outcome;
33
+ if (reason)
34
+ outcome = skippedOutcome(spec, reason);
35
+ else {
36
+ const cwd = input.cwd;
37
+ const command = cwd
38
+ ? await input.control.cancellable((signal) => input.runner({
39
+ run: spec.run,
40
+ cwd,
41
+ timeoutMs: spec.timeoutSec * 1000,
42
+ signal,
43
+ owner: input.owner,
44
+ }))
45
+ : { kind: "cwd-missing", output: "" };
46
+ const interruption = cwd ? input.control.interruption() : undefined;
47
+ if (interruption === "cancelled")
48
+ outcome = skippedOutcome(spec, "cancelled");
49
+ else if (interruption === "suppressed")
50
+ outcome = skippedOutcome(spec, "parent shut down");
51
+ else
52
+ outcome = verdictFromCommand(command, spec, input.evidence?.accept);
53
+ if (cwd)
54
+ outcome.cwd = cwd;
55
+ // Other writers and the user may share an ordinary checkout.
56
+ if (outcome.verdict !== "skipped" && !worktree)
57
+ outcome.sharedCheckout = true;
58
+ }
59
+ if (worktree) {
60
+ const changed = changedCheckFiles(spec.paths, [
61
+ ...(worktree.changedFiles ?? []),
62
+ ...(worktree.untrackedFiles ?? []),
63
+ ]);
64
+ if (changed.length)
65
+ outcome.changedCheckFiles = changed;
66
+ }
67
+ return outcome;
68
+ }
69
+ /** How one model attempt ended, for its outcome-ledger line. */
70
+ export function ledgerOutcome(result, evidence, exitCode, cancelledInCheck) {
71
+ if (result.cancellation || cancelledInCheck || result.outcome === "killed")
72
+ return "cancelled";
73
+ if (evidence?.ping)
74
+ return "help";
75
+ return exitCode === 0 ? "completed" : "failed";
76
+ }
77
+ export function outcomeLedgerFile(configDir) {
78
+ return join(configDir, "herdr-agents", OUTCOME_LEDGER_FILE);
79
+ }
80
+ /** Best effort: a ledger failure never changes or delays a delivery. */
81
+ export function appendOutcomeLedger(file, input) {
82
+ try {
83
+ const line = buildOutcomeLedgerLine(input);
84
+ mkdirSync(dirname(file), { recursive: true });
85
+ appendFileSync(file, `${JSON.stringify(line)}\n`, "utf8");
86
+ return line;
87
+ }
88
+ catch {
89
+ return undefined;
90
+ }
91
+ }
92
+ //# sourceMappingURL=accept-recheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accept-recheck.js","sourceRoot":"","sources":["../../../maestro/runtime/accept-recheck.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACN,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,GAIlB,MAAM,mBAAmB,CAAC;AAO3B,qFAAqF;AACrF,SAAS,UAAU,CAClB,MAAiB,EACjB,QAAwC,EACxC,QAAgB;IAEhB,IAAI,MAAM,CAAC,YAAY;QAAE,OAAO,WAAW,CAAC;IAC5C,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,2BAA2B,CAAC;IACpE,IAAI,QAAQ,EAAE,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,MAAM;QAAE,OAAO,cAAc,CAAC;IACvE,IAAI,QAAQ,EAAE,YAAY;QAAE,OAAO,gBAAgB,CAAC;IACpD,IAAI,CAAC,QAAQ;QAAE,OAAO,YAAY,CAAC;IACnC,IAAI,MAAM,CAAC,OAAO,KAAK,WAAW,IAAI,QAAQ,KAAK,CAAC;QACnD,OAAO,aAAa,QAAQ,EAAE,CAAC;IAChC,OAAO,SAAS,CAAC;AAClB,CAAC;AAiBD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,KAAwB;IAExB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACjC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxE,IAAI,OAAsB,CAAC;IAC3B,IAAI,MAAM;QAAE,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SAC9C,CAAC;QACL,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACtB,MAAM,OAAO,GAAG,GAAG;YAClB,CAAC,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,EAAE,CAC3C,KAAK,CAAC,MAAM,CAAC;gBACZ,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,GAAG;gBACH,SAAS,EAAE,IAAI,CAAC,UAAU,GAAG,IAAI;gBACjC,MAAM;gBACN,KAAK,EAAE,KAAK,CAAC,KAAK;aAClB,CAAC,CACF;YACF,CAAC,CAAC,EAAE,IAAI,EAAE,aAAsB,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAChD,MAAM,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACpE,IAAI,YAAY,KAAK,WAAW;YAC/B,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;aACxC,IAAI,YAAY,KAAK,YAAY;YACrC,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;;YAC/C,OAAO,GAAG,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACzE,IAAI,GAAG;YAAE,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;QAC3B,6DAA6D;QAC7D,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,QAAQ;YAC7C,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAChC,CAAC;IACD,IAAI,QAAQ,EAAE,CAAC;QACd,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE;YAC7C,GAAG,CAAC,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC;YAChC,GAAG,CAAC,QAAQ,CAAC,cAAc,IAAI,EAAE,CAAC;SAClC,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,MAAM;YAAE,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC;IACzD,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,aAAa,CAC5B,MAAiB,EACjB,QAAwC,EACxC,QAAgB,EAChB,gBAAyB;IAEzB,IAAI,MAAM,CAAC,YAAY,IAAI,gBAAgB,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ;QACzE,OAAO,WAAW,CAAC;IACpB,IAAI,QAAQ,EAAE,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,OAAO,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IAClD,OAAO,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,mBAAmB,CAAC,CAAC;AAC7D,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,mBAAmB,CAClC,IAAY,EACZ,KAAmD;IAEnD,IAAI,CAAC;QACJ,MAAM,IAAI,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC3C,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,cAAc,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["/**\n * The parent's accept re-check and the outcome ledger. The re-check alone\n * produces `accepted`, `rejected` and `error`; the child's report is evidence.\n */\nimport { appendFileSync, mkdirSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport {\n\tbuildOutcomeLedgerLine,\n\tchangedCheckFiles,\n\tOUTCOME_LEDGER_FILE,\n\tskippedOutcome,\n\tverdictFromCommand,\n\ttype AcceptOutcome,\n\ttype AcceptSpec,\n\ttype OutcomeLedgerLine,\n} from \"../core/accept.ts\";\nimport type { CompletionEvidence, RunResult } from \"../core/types.ts\";\nimport type { WorktreeHandoff } from \"../core/worktree.ts\";\nimport type { AcceptRunner } from \"../adapters/pi/accept-runner.ts\";\nimport type { AcceptCheckOwner } from \"../adapters/pi/accept-groups.ts\";\nimport type { FinalizeControl } from \"./run-session.ts\";\n\n/** Why a requested check did not run; undefined when the run completed naturally. */\nfunction skipReason(\n\tresult: RunResult,\n\tevidence: CompletionEvidence | undefined,\n\texitCode: number,\n): string | undefined {\n\tif (result.cancellation) return \"cancelled\";\n\tif (result.outcome === \"killed\") return \"stopped before completion\";\n\tif (evidence?.ping || result.outcome === \"help\") return \"help request\";\n\tif (evidence?.errorMessage) return \"provider error\";\n\tif (!evidence) return \"run failed\";\n\tif (result.outcome !== \"completed\" || exitCode !== 0)\n\t\treturn `exit code ${exitCode}`;\n\treturn undefined;\n}\n\nexport interface ParentAcceptInput {\n\tspec: AcceptSpec;\n\tresult: RunResult;\n\tevidence: CompletionEvidence | undefined;\n\texitCode: number;\n\t/** The child's checkout: the worktree root or its ordinary cwd. */\n\tcwd: string | undefined;\n\t/** Captured before the re-check; its file lists reveal changed check files. */\n\tworktree: WorktreeHandoff | undefined;\n\tcontrol: FinalizeControl;\n\trunner: AcceptRunner;\n\t/** Stops this check at shutdown (`accept-groups.ts`). */\n\towner?: AcceptCheckOwner;\n}\n\n/**\n * Re-run the check only for a completed, uncancelled, exit-0, non-ping\n * result. A cancel that wins during it, or a parent shutdown, makes the\n * verdict `skipped` whatever the check returned: the kernel is authoritative.\n */\nexport async function runParentAcceptCheck(\n\tinput: ParentAcceptInput,\n): Promise<AcceptOutcome> {\n\tconst { spec, worktree } = input;\n\tconst reason = skipReason(input.result, input.evidence, input.exitCode);\n\tlet outcome: AcceptOutcome;\n\tif (reason) outcome = skippedOutcome(spec, reason);\n\telse {\n\t\tconst cwd = input.cwd;\n\t\tconst command = cwd\n\t\t\t? await input.control.cancellable((signal) =>\n\t\t\t\t\tinput.runner({\n\t\t\t\t\t\trun: spec.run,\n\t\t\t\t\t\tcwd,\n\t\t\t\t\t\ttimeoutMs: spec.timeoutSec * 1000,\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\towner: input.owner,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: { kind: \"cwd-missing\" as const, output: \"\" };\n\t\tconst interruption = cwd ? input.control.interruption() : undefined;\n\t\tif (interruption === \"cancelled\")\n\t\t\toutcome = skippedOutcome(spec, \"cancelled\");\n\t\telse if (interruption === \"suppressed\")\n\t\t\toutcome = skippedOutcome(spec, \"parent shut down\");\n\t\telse outcome = verdictFromCommand(command, spec, input.evidence?.accept);\n\t\tif (cwd) outcome.cwd = cwd;\n\t\t// Other writers and the user may share an ordinary checkout.\n\t\tif (outcome.verdict !== \"skipped\" && !worktree)\n\t\t\toutcome.sharedCheckout = true;\n\t}\n\tif (worktree) {\n\t\tconst changed = changedCheckFiles(spec.paths, [\n\t\t\t...(worktree.changedFiles ?? []),\n\t\t\t...(worktree.untrackedFiles ?? []),\n\t\t]);\n\t\tif (changed.length) outcome.changedCheckFiles = changed;\n\t}\n\treturn outcome;\n}\n\n/** How one model attempt ended, for its outcome-ledger line. */\nexport function ledgerOutcome(\n\tresult: RunResult,\n\tevidence: CompletionEvidence | undefined,\n\texitCode: number,\n\tcancelledInCheck: boolean,\n): OutcomeLedgerLine[\"outcome\"] {\n\tif (result.cancellation || cancelledInCheck || result.outcome === \"killed\")\n\t\treturn \"cancelled\";\n\tif (evidence?.ping) return \"help\";\n\treturn exitCode === 0 ? \"completed\" : \"failed\";\n}\n\nexport function outcomeLedgerFile(configDir: string): string {\n\treturn join(configDir, \"herdr-agents\", OUTCOME_LEDGER_FILE);\n}\n\n/** Best effort: a ledger failure never changes or delays a delivery. */\nexport function appendOutcomeLedger(\n\tfile: string,\n\tinput: Parameters<typeof buildOutcomeLedgerLine>[0],\n): OutcomeLedgerLine | undefined {\n\ttry {\n\t\tconst line = buildOutcomeLedgerLine(input);\n\t\tmkdirSync(dirname(file), { recursive: true });\n\t\tappendFileSync(file, `${JSON.stringify(line)}\\n`, \"utf8\");\n\t\treturn line;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"]}
@@ -0,0 +1,112 @@
1
+ /** Structural transport results; the terminal host supplies socket callbacks. */
2
+ export type PaneTokenOutcome = "answered" | "pane-missing" | "failed";
3
+ export type PaneAgentSessionRead = {
4
+ kind: "session";
5
+ path?: string;
6
+ } | {
7
+ kind: "none";
8
+ } | {
9
+ kind: "pane-missing";
10
+ } | {
11
+ kind: "failed";
12
+ reason: string;
13
+ };
14
+ /** The pane token the Pi Herdr Agents Sidebar plugin reads. */
15
+ export declare const DELEGATED_MARKER_TOKEN = "piha_delegated_v1";
16
+ /** Recently classified as a delegated child; never proof of a live occupant. */
17
+ export declare const DELEGATED_MARKER_VALUE = "live";
18
+ /** One stable source: a pane accepts sequenced reports from at most 32. */
19
+ export declare const DELEGATED_MARKER_SOURCE = "pi-herdr-agents";
20
+ /** Bounds a leftover marker after the last write Herdr applied, not liveness. */
21
+ export declare const DELEGATED_MARKER_TTL_MS = 15000;
22
+ /**
23
+ * Renewal rides on supervision observations: the 4.8s reconciliation, or
24
+ * 1s fallback polling. Both leave several renewals inside one TTL.
25
+ */
26
+ export declare const DELEGATED_MARKER_RENEW_MS = 4000;
27
+ /**
28
+ * Consecutive failed renewal reads or writes before a live marker stops; its
29
+ * TTL ends it. Discovery instead retries until its window ends.
30
+ */
31
+ export declare const DELEGATED_MARKER_MAX_FAILURES = 3;
32
+ /** How long a new marker waits for Herdr to report the child's session. */
33
+ export declare const DELEGATED_MARKER_DISCOVERY_MS = 15000;
34
+ export declare const DELEGATED_MARKER_DISCOVERY_POLL_MS = 250;
35
+ export type MarkerWriter = (write: {
36
+ paneId: string;
37
+ seq: number;
38
+ live: boolean;
39
+ }) => Promise<PaneTokenOutcome>;
40
+ /** The agent session Herdr currently stores for a pane. */
41
+ export type MarkerSessionReader = (paneId: string) => Promise<PaneAgentSessionRead>;
42
+ type MarkerState = {
43
+ kind: "pending";
44
+ } | {
45
+ kind: "live";
46
+ lastSentAt: number;
47
+ } | {
48
+ kind: "retired";
49
+ };
50
+ /**
51
+ * This parent process's marker writes. Every pane shares one sequence that
52
+ * starts at wall-clock microseconds, so a restarted parent still outranks
53
+ * its predecessor's writes unless the clock moved backwards.
54
+ */
55
+ export declare class DelegatedMarkers {
56
+ readonly write: MarkerWriter;
57
+ readonly readSession: MarkerSessionReader;
58
+ readonly now: () => number;
59
+ readonly sleep: (ms: number) => Promise<void>;
60
+ private lastSeq;
61
+ constructor(options: {
62
+ write: MarkerWriter;
63
+ readSession: MarkerSessionReader;
64
+ now?: () => number;
65
+ sleep?: (ms: number) => Promise<void>;
66
+ });
67
+ /**
68
+ * A marker for one launched child. It publishes only once Herdr reports
69
+ * the child's own session file for its pane; until then it never writes.
70
+ */
71
+ attach(child: {
72
+ surface: string;
73
+ sessionFile: string;
74
+ }): DelegatedMarker;
75
+ nextSeq(): number;
76
+ }
77
+ /**
78
+ * One child's marker. Writes are serialized: at most one renewal is queued or
79
+ * in flight, followed by at most one clear. Renewal continues only while
80
+ * Herdr reports the child's session file for the pane. Herdr drops that
81
+ * session when the child exits or another agent takes the pane, so a later
82
+ * occupant never inherits the marker's renewal. With Herdr 0.9.4 or later a
83
+ * suspended child (Ctrl-Z) keeps its session, also after it resumes with fg,
84
+ * until it exits, so its marker stays live meanwhile.
85
+ */
86
+ export declare class DelegatedMarker {
87
+ readonly paneId: string;
88
+ readonly sessionFile: string;
89
+ private readonly owner;
90
+ private state;
91
+ private sentLive;
92
+ private renewalQueued;
93
+ private failures;
94
+ private queue;
95
+ private readonly discovery;
96
+ constructor(owner: DelegatedMarkers, paneId: string, sessionFile: string);
97
+ get kind(): MarkerState["kind"];
98
+ /** Resolves once discovery ends and every write queued by then settles. */
99
+ settled(): Promise<void>;
100
+ /** Called on each supervision observation; renews at most every 4s. */
101
+ renew(): void;
102
+ /** Idempotent. Clears the token if any live write may have reached Herdr. */
103
+ retire(): void;
104
+ private discover;
105
+ private renewal;
106
+ private owns;
107
+ private read;
108
+ private fail;
109
+ private send;
110
+ }
111
+ export {};
112
+ //# sourceMappingURL=delegated-marker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegated-marker.d.ts","sourceRoot":"","sources":["../../../maestro/runtime/delegated-marker.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,200 @@
1
+ /** The pane token the Pi Herdr Agents Sidebar plugin reads. */
2
+ export const DELEGATED_MARKER_TOKEN = "piha_delegated_v1";
3
+ /** Recently classified as a delegated child; never proof of a live occupant. */
4
+ export const DELEGATED_MARKER_VALUE = "live";
5
+ /** One stable source: a pane accepts sequenced reports from at most 32. */
6
+ export const DELEGATED_MARKER_SOURCE = "pi-herdr-agents";
7
+ /** Bounds a leftover marker after the last write Herdr applied, not liveness. */
8
+ export const DELEGATED_MARKER_TTL_MS = 15_000;
9
+ /**
10
+ * Renewal rides on supervision observations: the 4.8s reconciliation, or
11
+ * 1s fallback polling. Both leave several renewals inside one TTL.
12
+ */
13
+ export const DELEGATED_MARKER_RENEW_MS = 4_000;
14
+ /**
15
+ * Consecutive failed renewal reads or writes before a live marker stops; its
16
+ * TTL ends it. Discovery instead retries until its window ends.
17
+ */
18
+ export const DELEGATED_MARKER_MAX_FAILURES = 3;
19
+ /** How long a new marker waits for Herdr to report the child's session. */
20
+ export const DELEGATED_MARKER_DISCOVERY_MS = 15_000;
21
+ export const DELEGATED_MARKER_DISCOVERY_POLL_MS = 250;
22
+ function unrefSleep(ms) {
23
+ // Discovery must never hold the parent process open.
24
+ return new Promise((resolve) => setTimeout(resolve, ms).unref());
25
+ }
26
+ /**
27
+ * This parent process's marker writes. Every pane shares one sequence that
28
+ * starts at wall-clock microseconds, so a restarted parent still outranks
29
+ * its predecessor's writes unless the clock moved backwards.
30
+ */
31
+ export class DelegatedMarkers {
32
+ write;
33
+ readSession;
34
+ now;
35
+ sleep;
36
+ lastSeq = 0;
37
+ constructor(options) {
38
+ this.write = options.write;
39
+ this.readSession = options.readSession;
40
+ this.now = options.now ?? Date.now;
41
+ this.sleep = options.sleep ?? unrefSleep;
42
+ }
43
+ /**
44
+ * A marker for one launched child. It publishes only once Herdr reports
45
+ * the child's own session file for its pane; until then it never writes.
46
+ */
47
+ attach(child) {
48
+ return new DelegatedMarker(this, child.surface, child.sessionFile);
49
+ }
50
+ nextSeq() {
51
+ this.lastSeq = Math.max(this.lastSeq + 1, this.now() * 1000);
52
+ return this.lastSeq;
53
+ }
54
+ }
55
+ /**
56
+ * One child's marker. Writes are serialized: at most one renewal is queued or
57
+ * in flight, followed by at most one clear. Renewal continues only while
58
+ * Herdr reports the child's session file for the pane. Herdr drops that
59
+ * session when the child exits or another agent takes the pane, so a later
60
+ * occupant never inherits the marker's renewal. With Herdr 0.9.4 or later a
61
+ * suspended child (Ctrl-Z) keeps its session, also after it resumes with fg,
62
+ * until it exits, so its marker stays live meanwhile.
63
+ */
64
+ export class DelegatedMarker {
65
+ paneId;
66
+ sessionFile;
67
+ owner;
68
+ state = { kind: "pending" };
69
+ sentLive = false;
70
+ renewalQueued = false;
71
+ failures = 0;
72
+ queue = Promise.resolve();
73
+ discovery;
74
+ constructor(owner, paneId, sessionFile) {
75
+ this.owner = owner;
76
+ this.paneId = paneId;
77
+ this.sessionFile = sessionFile;
78
+ this.discovery = this.discover();
79
+ }
80
+ get kind() {
81
+ return this.state.kind;
82
+ }
83
+ /** Resolves once discovery ends and every write queued by then settles. */
84
+ async settled() {
85
+ await this.discovery;
86
+ for (let seen; seen !== this.queue;) {
87
+ seen = this.queue;
88
+ await seen;
89
+ }
90
+ }
91
+ /** Called on each supervision observation; renews at most every 4s. */
92
+ renew() {
93
+ const state = this.state;
94
+ const at = this.owner.now();
95
+ if (state.kind !== "live" ||
96
+ this.renewalQueued ||
97
+ at - state.lastSentAt < DELEGATED_MARKER_RENEW_MS)
98
+ return;
99
+ state.lastSentAt = at;
100
+ this.renewalQueued = true;
101
+ this.queue = this.queue.then(() => this.renewal());
102
+ }
103
+ /** Idempotent. Clears the token if any live write may have reached Herdr. */
104
+ retire() {
105
+ if (this.state.kind === "retired")
106
+ return;
107
+ this.state = { kind: "retired" };
108
+ if (this.sentLive)
109
+ this.queue = this.queue.then(() => this.send(false));
110
+ }
111
+ async discover() {
112
+ const deadline = this.owner.now() + DELEGATED_MARKER_DISCOVERY_MS;
113
+ for (;;) {
114
+ if (this.state.kind !== "pending")
115
+ return;
116
+ const read = await this.read();
117
+ if (this.state.kind !== "pending")
118
+ return;
119
+ if (this.owns(read)) {
120
+ this.state = { kind: "live", lastSentAt: this.owner.now() };
121
+ this.queue = this.queue.then(() => this.send(true));
122
+ return;
123
+ }
124
+ if (read.kind === "pane-missing" || this.owner.now() >= deadline) {
125
+ this.state = { kind: "retired" };
126
+ return;
127
+ }
128
+ await this.owner.sleep(DELEGATED_MARKER_DISCOVERY_POLL_MS);
129
+ }
130
+ }
131
+ async renewal() {
132
+ // The guard holds until this renewal's read and write settle, so a slow
133
+ // renewal never lets another queue behind it.
134
+ try {
135
+ // A renewal queued before retirement is dropped, never sent after it.
136
+ if (this.state.kind !== "live")
137
+ return;
138
+ const read = await this.read();
139
+ if (this.state.kind !== "live")
140
+ return;
141
+ if (this.owns(read))
142
+ await this.send(true);
143
+ else if (read.kind === "pane-missing")
144
+ this.state = { kind: "retired" };
145
+ else if (read.kind === "failed")
146
+ this.fail();
147
+ // No session or another one: the child exited or the pane was reused.
148
+ else
149
+ this.retire();
150
+ }
151
+ finally {
152
+ this.renewalQueued = false;
153
+ }
154
+ }
155
+ owns(read) {
156
+ return read.kind === "session" && read.path === this.sessionFile;
157
+ }
158
+ async read() {
159
+ try {
160
+ return await this.owner.readSession(this.paneId);
161
+ }
162
+ catch (error) {
163
+ return {
164
+ kind: "failed",
165
+ reason: error instanceof Error ? error.message : String(error),
166
+ };
167
+ }
168
+ }
169
+ fail() {
170
+ if (++this.failures >= DELEGATED_MARKER_MAX_FAILURES)
171
+ this.retire();
172
+ }
173
+ async send(live) {
174
+ if (live && this.state.kind !== "live")
175
+ return;
176
+ if (live)
177
+ this.sentLive = true;
178
+ let outcome;
179
+ try {
180
+ outcome = await this.owner.write({
181
+ paneId: this.paneId,
182
+ seq: this.owner.nextSeq(),
183
+ live,
184
+ });
185
+ }
186
+ catch {
187
+ outcome = "failed";
188
+ }
189
+ // A late result never revives or reclassifies a retired marker.
190
+ if (!live || this.state.kind !== "live")
191
+ return;
192
+ if (outcome === "answered")
193
+ this.failures = 0;
194
+ else if (outcome === "pane-missing")
195
+ this.state = { kind: "retired" };
196
+ else
197
+ this.fail();
198
+ }
199
+ }
200
+ //# sourceMappingURL=delegated-marker.js.map