dsh-pstack 0.3.0-beta.1 → 0.3.1

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 (544) hide show
  1. package/README.md +122 -76
  2. package/README.zh.md +116 -70
  3. package/assets/agent-presets.png +0 -0
  4. package/assets/plugin-configure.png +0 -0
  5. package/assets/plugin-recommended.png +0 -0
  6. package/assets/plugin-roles.png +0 -0
  7. package/assets/session-preset.png +0 -0
  8. package/cordis.patch.yml +332 -24
  9. package/dist/budget.d.mts +82 -0
  10. package/dist/budget.mjs +293 -0
  11. package/dist/catalogue-wgVaGeUx.d.mts +27 -0
  12. package/dist/catalogue.d.mts +2 -0
  13. package/dist/catalogue.mjs +116 -0
  14. package/dist/client.js +4072 -0
  15. package/dist/index.d.mts +2 -87
  16. package/dist/index.mjs +3 -394
  17. package/dist/models.d.mts +11 -40
  18. package/dist/models.mjs +47 -107
  19. package/dist/paths.d.mts +13 -0
  20. package/dist/paths.mjs +26 -0
  21. package/dist/poteto-mode.d.mts +37 -0
  22. package/dist/poteto-mode.mjs +61 -0
  23. package/dist/preset-copy.d.mts +12 -0
  24. package/dist/preset-copy.mjs +64 -0
  25. package/dist/preset.d.mts +31 -0
  26. package/dist/preset.mjs +51 -0
  27. package/dist/pstack/docs/harness/dsh.md +40 -40
  28. package/dist/pstack/plugin.json +21 -0
  29. package/dist/pstack/skills/poteto-mode/scripts/bootstrap.ts +62 -0
  30. package/dist/pstack/skills/poteto-mode/scripts/bun.lock +67 -0
  31. package/dist/pstack/skills/poteto-mode/scripts/check-plan.mjs +70 -83
  32. package/dist/pstack/skills/poteto-mode/scripts/{check-plan.test.mjs → check-plan.test.ts} +24 -42
  33. package/dist/pstack/skills/poteto-mode/scripts/package.json +16 -0
  34. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.test.ts +224 -0
  35. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.ts +223 -0
  36. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +129 -0
  37. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.test.ts +498 -0
  38. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.ts +726 -0
  39. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.test.ts +482 -0
  40. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.ts +842 -0
  41. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/render.ts +169 -0
  42. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/tsconfig.json +13 -0
  43. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/types.compile.ts +93 -0
  44. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/types.ts +414 -0
  45. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/watch-pr +6 -0
  46. package/dist/pstack/skills/poteto-mode/scripts/worktree-audit.sh +134 -0
  47. package/dist/pstack/skills/show-me-your-work/scripts/log.sh +42 -0
  48. package/dist/pstack/skills/statechart/scripts/backends/cfg.ts +33 -0
  49. package/dist/pstack/skills/statechart/scripts/backends/mermaid.ts +201 -0
  50. package/dist/pstack/skills/statechart/scripts/backends/plain-text.ts +72 -0
  51. package/dist/pstack/skills/statechart/scripts/backends/report.ts +177 -0
  52. package/dist/pstack/skills/statechart/scripts/frontends/config.ts +276 -0
  53. package/dist/pstack/skills/statechart/scripts/frontends/dot.ts +74 -0
  54. package/dist/pstack/skills/statechart/scripts/frontends/marks.ts +93 -0
  55. package/dist/pstack/skills/statechart/scripts/frontends/messages.ts +52 -0
  56. package/dist/pstack/skills/statechart/scripts/frontends/spec.ts +114 -0
  57. package/dist/pstack/skills/statechart/scripts/frontends/trace.ts +24 -0
  58. package/dist/pstack/skills/statechart/scripts/frontends/value.ts +166 -0
  59. package/dist/pstack/skills/statechart/scripts/frontends/verdict.ts +40 -0
  60. package/dist/pstack/skills/statechart/scripts/frontends/view.ts +119 -0
  61. package/dist/pstack/skills/statechart/scripts/ir.ts +547 -0
  62. package/dist/pstack/skills/statechart/scripts/package.json +11 -0
  63. package/dist/pstack/skills/statechart/scripts/passes/annotate.ts +128 -0
  64. package/dist/pstack/skills/statechart/scripts/passes/label.ts +269 -0
  65. package/dist/pstack/skills/statechart/scripts/passes/lift.ts +85 -0
  66. package/dist/pstack/skills/statechart/scripts/passes/loop-check.ts +68 -0
  67. package/dist/pstack/skills/statechart/scripts/passes/paths.ts +60 -0
  68. package/dist/pstack/skills/statechart/scripts/passes/reach.ts +135 -0
  69. package/dist/pstack/skills/statechart/scripts/passes/region-check.ts +97 -0
  70. package/dist/pstack/skills/statechart/scripts/passes/regions.ts +295 -0
  71. package/dist/pstack/skills/statechart/scripts/pipeline.ts +76 -0
  72. package/dist/pstack/skills/statechart/scripts/run.ts +481 -0
  73. package/dist/pstack/skills/statechart/scripts/statechart +29 -0
  74. package/dist/pstack/skills/statechart/scripts/statechart.ts +164 -0
  75. package/dist/pstack/skills/statechart/scripts/test/ConfigOracle.java +63 -0
  76. package/dist/pstack/skills/statechart/scripts/test/chart.test.ts +1210 -0
  77. package/dist/pstack/skills/statechart/scripts/test/charts/Braces.mmd +7 -0
  78. package/dist/pstack/skills/statechart/scripts/test/charts/Escapes.mmd +11 -0
  79. package/dist/pstack/skills/statechart/scripts/test/charts/Phases.mmd +29 -0
  80. package/dist/pstack/skills/statechart/scripts/test/cli.test.ts +1314 -0
  81. package/dist/pstack/skills/statechart/scripts/test/config-fuzz.test.ts +263 -0
  82. package/dist/pstack/skills/statechart/scripts/test/corpus/Counter/ChartRun.out +57 -0
  83. package/dist/pstack/skills/statechart/scripts/test/corpus/Counter/Counter.cfg +3 -0
  84. package/dist/pstack/skills/statechart/scripts/test/corpus/Counter/Counter.tla +10 -0
  85. package/dist/pstack/skills/statechart/scripts/test/corpus/Counter/chart.mmd +9 -0
  86. package/dist/pstack/skills/statechart/scripts/test/corpus/Counter/graph.dot +16 -0
  87. package/dist/pstack/skills/statechart/scripts/test/corpus/Counter/report.md +7 -0
  88. package/dist/pstack/skills/statechart/scripts/test/corpus/Counter/sany.out +2 -0
  89. package/dist/pstack/skills/statechart/scripts/test/corpus/Counter/verdict-1.out +49 -0
  90. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/ChartRun.out +60 -0
  91. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.cfg +4 -0
  92. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.tla +22 -0
  93. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/chart.mmd +26 -0
  94. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/graph.dot +19 -0
  95. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/report.md +20 -0
  96. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/sany.out +2 -0
  97. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.exit +1 -0
  98. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.out +56 -0
  99. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.exit +1 -0
  100. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.out +82 -0
  101. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterAction/verdict-3.out +57 -0
  102. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/ChartRun.out +59 -0
  103. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.cfg +3 -0
  104. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.tla +11 -0
  105. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/chart.mmd +22 -0
  106. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/graph.dot +16 -0
  107. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/report.md +17 -0
  108. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/sany.out +2 -0
  109. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.exit +1 -0
  110. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.out +56 -0
  111. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.exit +1 -0
  112. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.out +77 -0
  113. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/ChartRun.out +69 -0
  114. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.cfg +2 -0
  115. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.tla +11 -0
  116. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/chart.mmd +85 -0
  117. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/graph.dot +70 -0
  118. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/report.md +12 -0
  119. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/sany.out +2 -0
  120. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.exit +1 -0
  121. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.out +67 -0
  122. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterFan/verdict-2.out +57 -0
  123. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.exit +1 -0
  124. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.out +85 -0
  125. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.cfg +6 -0
  126. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.tla +13 -0
  127. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/chart.mmd +5 -0
  128. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/graph.dot +10 -0
  129. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/report.md +31 -0
  130. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/sany.out +2 -0
  131. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.exit +1 -0
  132. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.out +64 -0
  133. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.exit +1 -0
  134. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.out +77 -0
  135. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/ChartRun.out +55 -0
  136. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.cfg +3 -0
  137. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.tla +10 -0
  138. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/chart.mmd +12 -0
  139. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/graph.dot +6 -0
  140. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/report.md +12 -0
  141. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/sany.out +2 -0
  142. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.exit +1 -0
  143. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.out +33 -0
  144. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-2.out +54 -0
  145. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/ChartRun.out +54 -0
  146. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.cfg +3 -0
  147. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.tla +10 -0
  148. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/chart.mmd +1 -0
  149. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/graph.dot +6 -0
  150. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/report.md +7 -0
  151. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/sany.out +2 -0
  152. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInitPastHolds/verdict-1.out +46 -0
  153. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/ChartRun.out +59 -0
  154. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.cfg +2 -0
  155. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.tla +10 -0
  156. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/CounterSteps.tla +6 -0
  157. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/chart.mmd +17 -0
  158. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/graph.dot +15 -0
  159. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/report.md +14 -0
  160. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/sany.out +3 -0
  161. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.exit +1 -0
  162. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.out +78 -0
  163. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/ChartRun.out +59 -0
  164. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.cfg +3 -0
  165. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.tla +19 -0
  166. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/chart.mmd +26 -0
  167. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/graph.dot +22 -0
  168. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/report.md +12 -0
  169. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/sany.out +2 -0
  170. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.exit +1 -0
  171. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.out +58 -0
  172. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterJump/verdict-2.out +57 -0
  173. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterLoop/ChartRun.out +57 -0
  174. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.cfg +2 -0
  175. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.tla +11 -0
  176. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterLoop/chart.mmd +17 -0
  177. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterLoop/graph.dot +15 -0
  178. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterLoop/report.md +14 -0
  179. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterLoop/sany.out +2 -0
  180. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.exit +1 -0
  181. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.out +76 -0
  182. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/ChartRun.out +59 -0
  183. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.cfg +3 -0
  184. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.tla +11 -0
  185. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/chart.mmd +19 -0
  186. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/graph.dot +10 -0
  187. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/report.md +15 -0
  188. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/sany.out +2 -0
  189. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.exit +1 -0
  190. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.out +56 -0
  191. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.exit +1 -0
  192. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.out +67 -0
  193. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/ChartRun.out +62 -0
  194. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.cfg +6 -0
  195. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.tla +24 -0
  196. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/Moves.tla +5 -0
  197. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/chart.mmd +22 -0
  198. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/graph.dot +10 -0
  199. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/report.md +23 -0
  200. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/sany.out +3 -0
  201. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.exit +1 -0
  202. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.out +58 -0
  203. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.exit +1 -0
  204. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.out +66 -0
  205. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.exit +1 -0
  206. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.out +74 -0
  207. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterRules/verdict-4.out +59 -0
  208. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/ChartRun.out +58 -0
  209. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.cfg +3 -0
  210. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.tla +15 -0
  211. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/chart.mmd +18 -0
  212. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/graph.dot +13 -0
  213. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/report.md +11 -0
  214. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/sany.out +2 -0
  215. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.exit +1 -0
  216. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.out +33 -0
  217. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStart/verdict-2.out +57 -0
  218. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStop/ChartRun.out +57 -0
  219. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.cfg +3 -0
  220. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.tla +15 -0
  221. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStop/chart.mmd +7 -0
  222. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStop/graph.dot +13 -0
  223. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStop/report.md +6 -0
  224. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStop/sany.out +2 -0
  225. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterStop/verdict-1.out +49 -0
  226. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/ChartRun.out +61 -0
  227. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.cfg +4 -0
  228. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.tla +14 -0
  229. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/chart.mmd +30 -0
  230. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/graph.dot +19 -0
  231. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/report.md +27 -0
  232. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/sany.out +2 -0
  233. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.exit +1 -0
  234. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.out +56 -0
  235. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.exit +1 -0
  236. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.out +64 -0
  237. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.exit +1 -0
  238. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.out +87 -0
  239. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTie/verdict-4.out +57 -0
  240. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/ChartRun.out +60 -0
  241. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.cfg +3 -0
  242. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.tla +12 -0
  243. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/chart.mmd +23 -0
  244. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/graph.dot +19 -0
  245. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/report.md +11 -0
  246. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/sany.out +2 -0
  247. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.exit +1 -0
  248. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.out +56 -0
  249. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-2.out +57 -0
  250. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/ChartRun.out +61 -0
  251. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/CounterView.cfg +4 -0
  252. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/CounterView.tla +14 -0
  253. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/chart.mmd +23 -0
  254. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/graph.dot +19 -0
  255. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/report.md +27 -0
  256. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/sany.out +2 -0
  257. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-1.exit +1 -0
  258. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-1.out +56 -0
  259. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-2.exit +1 -0
  260. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-2.out +64 -0
  261. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-3.exit +1 -0
  262. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-3.out +87 -0
  263. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/verdict-4.out +57 -0
  264. package/dist/pstack/skills/statechart/scripts/test/corpus/CounterView/view.mjs +1 -0
  265. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/ChartRun.out +59 -0
  266. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/DieHard.cfg +4 -0
  267. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/DieHard.tla +38 -0
  268. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/chart.mmd +92 -0
  269. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/graph.dot +126 -0
  270. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/report.md +17 -0
  271. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/sany.out +2 -0
  272. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/verdict-1.exit +1 -0
  273. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/verdict-1.out +91 -0
  274. package/dist/pstack/skills/statechart/scripts/test/corpus/DieHard/verdict-2.out +57 -0
  275. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/ChartRun.out +61 -0
  276. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.cfg +6 -0
  277. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.tla +11 -0
  278. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/chart.mmd +22 -0
  279. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/graph.dot +16 -0
  280. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/report.md +25 -0
  281. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/sany.out +2 -0
  282. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.exit +1 -0
  283. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.out +56 -0
  284. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.exit +1 -0
  285. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.out +64 -0
  286. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.exit +1 -0
  287. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.out +64 -0
  288. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.exit +1 -0
  289. package/dist/pstack/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.out +77 -0
  290. package/dist/pstack/skills/statechart/scripts/test/corpus/HiddenClock/ChartRun.out +57 -0
  291. package/dist/pstack/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.cfg +4 -0
  292. package/dist/pstack/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.tla +11 -0
  293. package/dist/pstack/skills/statechart/scripts/test/corpus/HiddenClock/chart.mmd +13 -0
  294. package/dist/pstack/skills/statechart/scripts/test/corpus/HiddenClock/graph.dot +12 -0
  295. package/dist/pstack/skills/statechart/scripts/test/corpus/HiddenClock/report.md +11 -0
  296. package/dist/pstack/skills/statechart/scripts/test/corpus/HiddenClock/sany.out +2 -0
  297. package/dist/pstack/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.exit +1 -0
  298. package/dist/pstack/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.out +72 -0
  299. package/dist/pstack/skills/statechart/scripts/test/corpus/Login/ChartRun.out +57 -0
  300. package/dist/pstack/skills/statechart/scripts/test/corpus/Login/Login.cfg +3 -0
  301. package/dist/pstack/skills/statechart/scripts/test/corpus/Login/Login.tla +62 -0
  302. package/dist/pstack/skills/statechart/scripts/test/corpus/Login/chart.mmd +27 -0
  303. package/dist/pstack/skills/statechart/scripts/test/corpus/Login/graph.dot +40 -0
  304. package/dist/pstack/skills/statechart/scripts/test/corpus/Login/report.md +7 -0
  305. package/dist/pstack/skills/statechart/scripts/test/corpus/Login/sany.out +1 -0
  306. package/dist/pstack/skills/statechart/scripts/test/corpus/Login/verdict-1.out +47 -0
  307. package/dist/pstack/skills/statechart/scripts/test/corpus/Login/view.mjs +1 -0
  308. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/ChartRun.out +57 -0
  309. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.cfg +2 -0
  310. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.tla +64 -0
  311. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/chart.mmd +28 -0
  312. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/graph.dot +37 -0
  313. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/report.md +8 -0
  314. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/sany.out +1 -0
  315. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/verdict-1.out +47 -0
  316. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginGuarded/view.mjs +1 -0
  317. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/ChartRun.out +60 -0
  318. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.cfg +3 -0
  319. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.tla +64 -0
  320. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/chart.mmd +44 -0
  321. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/graph.dot +58 -0
  322. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/report.md +17 -0
  323. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/sany.out +1 -0
  324. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.exit +1 -0
  325. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.out +83 -0
  326. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/verdict-2.out +57 -0
  327. package/dist/pstack/skills/statechart/scripts/test/corpus/LoginParallel/view.mjs +1 -0
  328. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/ChartRun.out +60 -0
  329. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.cfg +3 -0
  330. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.tla +103 -0
  331. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/chart.mmd +43 -0
  332. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/graph.dot +93 -0
  333. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/report.md +14 -0
  334. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/sany.out +1 -0
  335. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.exit +1 -0
  336. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.out +59 -0
  337. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-2.out +72 -0
  338. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayer/view.mjs +3 -0
  339. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/ChartRun.out +57 -0
  340. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.cfg +2 -0
  341. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.tla +100 -0
  342. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/chart.mmd +31 -0
  343. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/graph.dot +85 -0
  344. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/report.md +9 -0
  345. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/sany.out +1 -0
  346. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/verdict-1.out +47 -0
  347. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerFixed/view.mjs +3 -0
  348. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/ChartRun.out +59 -0
  349. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayer.tla +103 -0
  350. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.cfg +3 -0
  351. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.tla +6 -0
  352. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/chart.mmd +42 -0
  353. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/graph.dot +93 -0
  354. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/report.md +19 -0
  355. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/sany.out +2 -0
  356. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.exit +1 -0
  357. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.out +61 -0
  358. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-2.out +59 -0
  359. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-3.out +61 -0
  360. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.exit +1 -0
  361. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.out +66 -0
  362. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.exit +1 -0
  363. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.out +58 -0
  364. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-6.out +49 -0
  365. package/dist/pstack/skills/statechart/scripts/test/corpus/MediaPlayerProps/view.mjs +3 -0
  366. package/dist/pstack/skills/statechart/scripts/test/corpus/PickWorker/ChartRun.out +57 -0
  367. package/dist/pstack/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.cfg +6 -0
  368. package/dist/pstack/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.tla +11 -0
  369. package/dist/pstack/skills/statechart/scripts/test/corpus/PickWorker/chart.mmd +5 -0
  370. package/dist/pstack/skills/statechart/scripts/test/corpus/PickWorker/graph.dot +11 -0
  371. package/dist/pstack/skills/statechart/scripts/test/corpus/PickWorker/report.md +7 -0
  372. package/dist/pstack/skills/statechart/scripts/test/corpus/PickWorker/sany.out +5 -0
  373. package/dist/pstack/skills/statechart/scripts/test/corpus/PickWorker/verdict-1.out +70 -0
  374. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/ChartRun.out +61 -0
  375. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/Shadow.cfg +4 -0
  376. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/Shadow.tla +11 -0
  377. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/ShadowLib.tla +6 -0
  378. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/ShadowSub.tla +3 -0
  379. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/chart.mmd +9 -0
  380. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/graph.dot +16 -0
  381. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/report.md +8 -0
  382. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/sany.out +4 -0
  383. package/dist/pstack/skills/statechart/scripts/test/corpus/Shadow/verdict-1.out +65 -0
  384. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/ChartRun.out +59 -0
  385. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.cfg +2 -0
  386. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.tla +9 -0
  387. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/chart.mmd +23 -0
  388. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/graph.dot +17 -0
  389. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/report.md +15 -0
  390. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/sany.out +1 -0
  391. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.exit +1 -0
  392. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.out +65 -0
  393. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.exit +1 -0
  394. package/dist/pstack/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.out +75 -0
  395. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/ChartRun.out +69 -0
  396. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.cfg +3 -0
  397. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.tla +75 -0
  398. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/chart.mmd +60 -0
  399. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/graph.dot +297 -0
  400. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/report.md +20 -0
  401. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/sany.out +1 -0
  402. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.exit +1 -0
  403. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.out +95 -0
  404. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/verdict-2.out +57 -0
  405. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhase/view.mjs +1 -0
  406. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/ChartRun.out +57 -0
  407. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.cfg +3 -0
  408. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.tla +75 -0
  409. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/chart.mmd +37 -0
  410. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/graph.dot +223 -0
  411. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/report.md +11 -0
  412. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/sany.out +1 -0
  413. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/verdict-1.out +47 -0
  414. package/dist/pstack/skills/statechart/scripts/test/corpus/TwoPhaseFixed/view.mjs +1 -0
  415. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.exit +1 -0
  416. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.out +75 -0
  417. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.cfg +5 -0
  418. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.tla +11 -0
  419. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/chart.mmd +18 -0
  420. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/graph.dot +14 -0
  421. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/report.md +29 -0
  422. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/sany.out +2 -0
  423. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.exit +1 -0
  424. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.out +64 -0
  425. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.exit +1 -0
  426. package/dist/pstack/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.out +75 -0
  427. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/ChartRun.out +58 -0
  428. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.cfg +2 -0
  429. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.tla +8 -0
  430. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/chart.mmd +22 -0
  431. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/graph.dot +16 -0
  432. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/report.md +15 -0
  433. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/sany.out +2 -0
  434. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.exit +1 -0
  435. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.out +56 -0
  436. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.exit +1 -0
  437. package/dist/pstack/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.out +77 -0
  438. package/dist/pstack/skills/statechart/scripts/test/corpus.test.ts +403 -0
  439. package/dist/pstack/skills/statechart/scripts/test/differential.test.ts +565 -0
  440. package/dist/pstack/skills/statechart/scripts/test/grid/Grid.cfg +2 -0
  441. package/dist/pstack/skills/statechart/scripts/test/grid/Grid.tla +9 -0
  442. package/dist/pstack/skills/statechart/scripts/test/grid/sany.out +2 -0
  443. package/dist/pstack/skills/statechart/scripts/test/java.ts +63 -0
  444. package/dist/pstack/skills/statechart/scripts/test/labels.ts +643 -0
  445. package/dist/pstack/skills/statechart/scripts/test/messages.test.ts +212 -0
  446. package/dist/pstack/skills/statechart/scripts/test/pipeline.test.ts +270 -0
  447. package/dist/pstack/skills/statechart/scripts/test/plain-tlc.test.ts +255 -0
  448. package/dist/pstack/skills/statechart/scripts/test/render.test.ts +81 -0
  449. package/dist/pstack/skills/statechart/scripts/test/tlc-out.test.ts +90 -0
  450. package/dist/pstack/skills/statechart/scripts/test/tlc.ts +158 -0
  451. package/dist/pstack/skills/statechart/scripts/tsconfig.json +11 -0
  452. package/dist/pstack/skills/statechart/scripts/worker.ts +35 -0
  453. package/dist/readonly.d.mts +3 -0
  454. package/dist/readonly.mjs +9 -0
  455. package/dist/role-catalog.d.mts +11 -24
  456. package/dist/role-catalog.mjs +17 -32
  457. package/dist/role-config.d.mts +41 -0
  458. package/dist/role-config.mjs +112 -0
  459. package/dist/role-editor.d.mts +25 -0
  460. package/dist/role-editor.mjs +372 -0
  461. package/dist/role-file-CIVHnhBg.d.mts +53 -0
  462. package/dist/role-file.d.mts +2 -0
  463. package/dist/role-file.mjs +121 -0
  464. package/dist/{role-manifest-8OERX9-s.d.mts → role-manifest-D1npMjqZ.d.mts} +21 -10
  465. package/dist/role-manifest.d.mts +2 -0
  466. package/dist/{role-manifest-79cnFfDM.mjs → role-manifest.mjs} +20 -16
  467. package/dist/role-remote.d.mts +23 -0
  468. package/dist/role-remote.mjs +106 -0
  469. package/dist/{roles.d.mts → role-service.d.mts} +8 -4
  470. package/dist/role-service.mjs +43 -0
  471. package/dist/role-wire.d.mts +54 -0
  472. package/dist/role-wire.mjs +127 -0
  473. package/dist/route-7SqXDYrL.d.mts +36 -0
  474. package/dist/route.d.mts +2 -0
  475. package/dist/route.mjs +78 -0
  476. package/dist/skill.d.mts +9 -23
  477. package/dist/skill.mjs +28 -37
  478. package/dist/skills/authored/docs-drift/SKILL.md +4 -4
  479. package/dist/skills/authored/docs-drift/SKILL.zh.md +4 -4
  480. package/dist/skills/vendored/control-cli/SKILL.md +109 -0
  481. package/dist/skills/vendored/control-ui/SKILL.md +109 -0
  482. package/dist/skills/vendored/deslop/SKILL.md +22 -0
  483. package/dist/subagent.d.mts +60 -169
  484. package/dist/subagent.mjs +344 -587
  485. package/dist/wire-error-D_r-UW4w.d.mts +5 -0
  486. package/dist/wire-error.d.mts +2 -0
  487. package/dist/wire-error.mjs +9 -0
  488. package/locale/en.json +1 -1
  489. package/package.json +51 -35
  490. package/assets/pstack-config-entry.png +0 -0
  491. package/dist/client.mjs +0 -2482
  492. package/dist/client.mjs.map +0 -1
  493. package/dist/host-contract-CUPSpeNk.d.mts +0 -22
  494. package/dist/paths-yji9SNak.mjs +0 -47
  495. package/dist/pstack/skills/poteto-mode/scripts/expect.mjs +0 -254
  496. package/dist/pstack/skills/poteto-mode/scripts/support.mjs +0 -93
  497. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.mjs +0 -123
  498. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +0 -217
  499. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.mjs +0 -119
  500. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.mjs +0 -626
  501. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.test.mjs +0 -521
  502. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.mjs +0 -657
  503. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +0 -523
  504. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/render.mjs +0 -106
  505. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/types.mjs +0 -9
  506. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +0 -5
  507. package/dist/pstack/skills/poteto-mode/scripts/worktree-audit.mjs +0 -668
  508. package/dist/pstack/skills/poteto-mode/scripts/worktree-audit.test.mjs +0 -134
  509. package/dist/pstack/skills/show-me-your-work/scripts/log.mjs +0 -106
  510. package/dist/pstack/skills/show-me-your-work/scripts/log.test.mjs +0 -56
  511. package/dist/pstack/skills/statechart/scripts/backends/cfg.mjs +0 -31
  512. package/dist/pstack/skills/statechart/scripts/backends/mermaid.mjs +0 -186
  513. package/dist/pstack/skills/statechart/scripts/backends/plain-text.mjs +0 -62
  514. package/dist/pstack/skills/statechart/scripts/backends/report.mjs +0 -84
  515. package/dist/pstack/skills/statechart/scripts/frontends/config.mjs +0 -268
  516. package/dist/pstack/skills/statechart/scripts/frontends/dot.mjs +0 -67
  517. package/dist/pstack/skills/statechart/scripts/frontends/marks.mjs +0 -94
  518. package/dist/pstack/skills/statechart/scripts/frontends/messages.mjs +0 -48
  519. package/dist/pstack/skills/statechart/scripts/frontends/spec.mjs +0 -101
  520. package/dist/pstack/skills/statechart/scripts/frontends/trace.mjs +0 -39
  521. package/dist/pstack/skills/statechart/scripts/frontends/value.mjs +0 -180
  522. package/dist/pstack/skills/statechart/scripts/frontends/verdict.mjs +0 -40
  523. package/dist/pstack/skills/statechart/scripts/frontends/view.mjs +0 -99
  524. package/dist/pstack/skills/statechart/scripts/ir.mjs +0 -277
  525. package/dist/pstack/skills/statechart/scripts/passes/annotate.mjs +0 -92
  526. package/dist/pstack/skills/statechart/scripts/passes/label.mjs +0 -210
  527. package/dist/pstack/skills/statechart/scripts/passes/lift.mjs +0 -84
  528. package/dist/pstack/skills/statechart/scripts/passes/loop-check.mjs +0 -47
  529. package/dist/pstack/skills/statechart/scripts/passes/paths.mjs +0 -72
  530. package/dist/pstack/skills/statechart/scripts/passes/reach.mjs +0 -135
  531. package/dist/pstack/skills/statechart/scripts/passes/region-check.mjs +0 -82
  532. package/dist/pstack/skills/statechart/scripts/passes/regions.mjs +0 -268
  533. package/dist/pstack/skills/statechart/scripts/pipeline.mjs +0 -72
  534. package/dist/pstack/skills/statechart/scripts/run.mjs +0 -440
  535. package/dist/pstack/skills/statechart/scripts/statechart.mjs +0 -155
  536. package/dist/pstack/skills/statechart/scripts/statechart.test.mjs +0 -198
  537. package/dist/pstack/skills/statechart/scripts/worker.mjs +0 -31
  538. package/dist/remote.d.mts +0 -27
  539. package/dist/remote.mjs +0 -235
  540. package/dist/role-config-a4JpVdc-.mjs +0 -379
  541. package/dist/role-wire-CAJsVA6e.d.mts +0 -54
  542. package/dist/roles.mjs +0 -293
  543. package/dist/script.d.mts +0 -91
  544. package/dist/script.mjs +0 -485
package/dist/subagent.mjs CHANGED
@@ -1,352 +1,138 @@
1
- import { a as POTETO_MODE_SKILL_PATH } from "./paths-yji9SNak.mjs";
2
- import { a as selectRoleRoutes, i as resolveDshHome, n as readRoleConfiguration, r as requireRole, t as modelsFilePath } from "./role-config-a4JpVdc-.mjs";
1
+ import { POTETO_MODE_SKILL_PATH } from "./paths.mjs";
2
+ import { modelsFilePath, readRoleConfiguration, requireRole, resolveDshHome, selectRoutes } from "./role-config.mjs";
3
+ import { isRoute } from "./route.mjs";
3
4
  import { isAbsolute, join, relative, resolve } from "node:path";
4
5
  import { existsSync, statSync } from "node:fs";
5
- // src/internal/effort.ts
6
- /** Model-facing name of the child's own control. */
7
- const SET_EFFORT_TOOL = "set_reasoning_effort";
8
- /**
9
- * Resolve the route a child's effort will actually apply to: an explicit route wins,
10
- * then the session's live request header, then the creation-time options.
11
- */
12
- function resolveEffortTarget(agent, route) {
13
- const explicit = route?.kind === "route" ? route : void 0;
14
- const header = agent?.session.requestHeader()?.config;
15
- const provider = explicit?.provider ?? header?.provider ?? agent?.options.provider;
16
- const model = explicit?.model ?? header?.model ?? agent?.options.model;
17
- return provider !== void 0 && model !== void 0 ? {
18
- provider,
19
- model
20
- } : void 0;
21
- }
22
- async function advertisedEfforts(llm, target, signal) {
23
- return (await llm.resolveModelInfo(target.provider, target.model, signal)).reasoning?.efforts.map((entry) => entry.id) ?? [];
24
- }
25
- /** Validate one effort against the route a child will actually request. */
26
- async function validateEffortFor(llm, route, effort, parent, signal) {
27
- const target = resolveEffortTarget(parent, route);
28
- if (target === void 0) throw new Error("cannot resolve the child provider/model route for reasoningEffort. Pass `role` with an exact route, or run the delegation from a session that has already made a request.");
29
- let efforts;
30
- try {
31
- efforts = await advertisedEfforts(llm, target, signal);
32
- } catch (error) {
33
- throw new Error(`route ${target.provider}/${target.model} could not be resolved for reasoningEffort: ${describeError$1(error)}`, { cause: error });
34
- }
35
- if (efforts.length === 0) throw new Error(`${target.provider}/${target.model} advertises no reasoning efforts, so it cannot take reasoningEffort "${effort}". Omit the argument and let the adapter use its own default.`);
36
- if (!efforts.includes(effort)) throw new Error(`${target.provider}/${target.model} does not support reasoning effort "${effort}". It supports: ${efforts.join(", ")}.`);
37
- }
38
- /**
39
- * Install the effort control on one live child.
40
- *
41
- * Registration is child-scoped, so the tool disposes with the child. A successful
42
- * call records the choice through `agent.model.select()`, which DSH applies when
43
- * it prepares the next step. `agent/request` is deliberately not used: DSH
44
- * deprecated it for model and effort changes and rejects a request that disagrees
45
- * with the selection fixed during step preparation.
46
- */
47
- function installEffortControl(child, llm) {
48
- return child.ctx.tools.register(defineSetEffortTool(child, llm));
49
- }
50
- function defineSetEffortTool(child, llm) {
51
- return {
52
- name: SET_EFFORT_TOOL,
53
- description: [
54
- "Change your reasoning effort for future model requests.",
55
- "Use it when the task turns out harder or more routine than the role line assumed: raise it for subtle design, concurrency, or algorithm work, lower it once the remaining work is mechanical.",
56
- "The change applies from your next step; a request already in flight is unaffected, and it lasts for the rest of this child's life."
57
- ].join(" "),
58
- parameters: {
59
- type: "object",
60
- additionalProperties: false,
61
- properties: { effort: {
62
- type: "string",
63
- description: "The reasoning effort to use from your next step onward. Use one of the values this model advertises; the call rejects an unknown one and lists the real values."
64
- } },
65
- required: ["effort"]
66
- },
67
- output: {
68
- schema: { type: "string" },
69
- render: (_args, value) => [{
70
- type: "text",
71
- text: typeof value === "string" ? value : JSON.stringify(value)
72
- }]
73
- },
74
- isConcurrencySafe: () => false,
75
- async execute(rawArgs, exec) {
76
- const args = rawArgs;
77
- const value = typeof args.effort === "string" ? args.effort.trim() : "";
78
- if (value === "") throw new Error("set_reasoning_effort needs a non-empty `effort`. Pass the exact token this model advertises; an empty value would silently re-enable the adapter default.");
79
- const agent = exec.agent ?? child;
80
- const target = resolveEffortTarget(agent);
81
- if (target === void 0) throw new Error("this child has no resolved provider/model route, so reasoning effort cannot be validated against the live adapter metadata");
82
- let efforts;
83
- try {
84
- efforts = await advertisedEfforts(llm, target, exec.signal);
85
- } catch (error) {
86
- throw new Error(`${target.provider}/${target.model} could not be resolved for reasoning effort: ${describeError$1(error)}`, { cause: error });
87
- }
88
- if (efforts.length === 0) throw new Error(`${target.provider}/${target.model} advertises no reasoning efforts, so this child has none to change. Your current effort stays as it is.`);
89
- if (!efforts.includes(value)) throw new Error(`${target.provider}/${target.model} does not support reasoning effort "${value}", so nothing changed. It supports: ${efforts.join(", ")}.`);
90
- agent.model.select({
91
- provider: target.provider,
92
- model: target.model,
93
- reasoningEffort: value
94
- });
95
- return `reasoning effort set to "${value}". It applies from your next step; the request already in flight is unaffected.`;
96
- }
97
- };
98
- }
99
- /** The `agentOptions` one (route, effort override) pair contributes. */
100
- function agentOptionsFor(route, effortOverride) {
101
- const effort = effortOverride ?? (route.kind === "route" ? route.effort : void 0);
102
- if (route.kind === "inherit") return effort === void 0 ? void 0 : { reasoningEffort: effort };
103
- return {
104
- provider: route.provider,
105
- model: route.model,
106
- ...effort === void 0 ? {} : { reasoningEffort: effort }
107
- };
108
- }
109
- /** The effort a plan entry will actually run at, override included. */
110
- function effectiveEffort(route, effortOverride) {
111
- return effortOverride ?? (route.kind === "route" ? route.effort : void 0);
112
- }
113
- function describeError$1(error) {
114
- if (error instanceof Error) {
115
- const code = error.code;
116
- return typeof code === "string" ? `${error.message} (${code})` : error.message;
117
- }
118
- return String(error);
119
- }
120
6
  // src/subagent.ts
121
7
  /**
122
8
  * `pstack_subagent`: pstack's delegation entry point.
123
9
  *
124
- * One call plans one or more fresh children, validates every route and effort before the
125
- * first child starts, then starts them through `ctx.subagents.startActivation` with
126
- * parent delivery. Results arrive as completion notices; this module never polls.
10
+ * One call resolves the role file, validates every route and effort before the
11
+ * first child starts, then starts one fresh child per selected route through
12
+ * `ctx.subagents.startActivation`. Results arrive as completion notices; this
13
+ * tool never polls.
127
14
  */
128
- /** Cordis row name, used by Loader diagnostics. */
129
15
  const name = "pstack-subagent";
130
- /**
131
- * Delegation needs the tool registry, the subagent registry, the LLM adapters, and the
132
- * session directory. `agents` is not here: it is optional and read per call, so a
133
- * profile without it still delegates and the child simply keeps its starting effort.
134
- */
135
16
  const inject = [
136
17
  "tools",
137
18
  "subagents",
138
19
  "llm",
139
20
  "workingDirectory"
140
21
  ];
141
- /** Model-facing tool name. */
142
22
  const TOOL_NAME = "pstack_subagent";
143
- /** Backend used when the row does not name one. */
144
- const DEFAULT_SUBAGENT_PROVIDER = "spawn";
145
- /** The child kinds this tool knows how to brief. */
23
+ /** Default backend when the row does not name one. */
24
+ const DEFAULT_PROVIDER = "spawn";
25
+ /** Child kinds this tool can brief. */
146
26
  const AGENT_KINDS = [
147
27
  "poteto-agent",
148
28
  "comment-sicko",
29
+ "readonly",
149
30
  "general"
150
31
  ];
151
- const DEFAULT_CONFIG = { provider: DEFAULT_SUBAGENT_PROVIDER };
152
- /**
153
- * Depth a child runs at when a call omits `maxDepth` or passes an unusable value.
154
- *
155
- * A child is always at least depth 1 (it is one level below its parent), so this is the
156
- * smallest value that can start a child while forbidding it from delegating further.
157
- */
158
- const DEFAULT_CHILD_MAX_DEPTH = 1;
159
- /** Raised for a configuration or argument problem, before any child starts. */
160
- var DelegationError = class extends Error {
161
- constructor(message) {
162
- super(message);
163
- this.name = "DelegationError";
164
- }
165
- };
166
- /** Raised when a child starts but a later entry in the same call fails. */
167
- var PartialDelegationError = class extends DelegationError {
168
- startedChildren;
169
- constructor(message, startedChildren) {
170
- super(message);
171
- this.name = "PartialDelegationError";
172
- this.startedChildren = startedChildren;
173
- }
32
+ /** Preset id for each independently composed child kind. */
33
+ const AGENT_PRESETS = {
34
+ "poteto-agent": "poteto-agent",
35
+ "comment-sicko": "comment-sicko",
36
+ readonly: "readonly"
174
37
  };
175
- function isNonEmptyString(value) {
176
- return typeof value === "string" && value.trim() !== "";
177
- }
178
- function isNonNegativeSafeInteger(value) {
179
- return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
180
- }
181
- /**
182
- * Validate the row configuration without a Schemastery dependency.
183
- *
184
- * A typo must fail at activation rather than at the first delegation, and an omitted
185
- * `config` must be valid. Cordis passes the raw mapping because this row exports no
186
- * `Config` object; callers that object as `config` are still checked here.
187
- */
38
+ const DEFAULT_CONFIG = { provider: DEFAULT_PROVIDER };
39
+ /** Validate the row's own config; omitted config uses the default provider. */
188
40
  function normalizeConfig(value) {
189
41
  if (value === void 0 || value === null) return DEFAULT_CONFIG;
190
42
  if (typeof value !== "object" || Array.isArray(value)) throw new Error("pstack-subagent: config must be a mapping");
191
43
  const record = value;
192
44
  for (const key of Object.keys(record)) if (key !== "provider" && key !== "maxDepth") throw new Error(`pstack-subagent: unknown config field "${key}"`);
193
45
  const provider = record["provider"];
194
- if (provider !== void 0 && !isNonEmptyString(provider)) throw new Error("pstack-subagent: provider must be a non-empty string");
46
+ if (provider !== void 0 && (typeof provider !== "string" || provider.trim() === "")) throw new Error("pstack-subagent: provider must be a non-empty string");
195
47
  const maxDepth = record["maxDepth"];
196
- if (maxDepth !== void 0 && !isNonNegativeSafeInteger(maxDepth)) throw new Error("pstack-subagent: maxDepth must be a non-negative safe integer");
48
+ if (maxDepth !== void 0 && !isDepth(maxDepth)) throw new Error("pstack-subagent: maxDepth must be a positive safe integer");
197
49
  return {
198
- provider: isNonEmptyString(provider) ? provider : DEFAULT_SUBAGENT_PROVIDER,
199
- ...isNonNegativeSafeInteger(maxDepth) ? { maxDepth } : {}
50
+ provider: typeof provider === "string" ? provider : DEFAULT_PROVIDER,
51
+ ...maxDepth === void 0 ? {} : { maxDepth }
200
52
  };
201
53
  }
202
- /** The preset id behind each pstack agent kind. `general` joins the parent preset. */
203
- const AGENT_PRESETS = {
204
- "poteto-agent": "poteto-agent",
205
- "comment-sicko": "comment-sicko"
206
- };
207
- /** The preset a child of this kind must mount, or undefined to join the parent preset. */
208
- function agentPresetFor(agent) {
209
- return agent === "general" ? void 0 : AGENT_PRESETS[agent];
210
- }
211
- /** Compose the self-contained prompt one child receives. */
212
- function composeChildPrompt(input) {
213
- const sections = [];
214
- const injected = input.injectedPaths ?? [];
215
- if (injected.length > 0) sections.push([
216
- "Absolute paths injected by `pstack_subagent`. Read them directly; do not search a plugin directory.",
217
- "",
218
- ...injected.map((entry) => `- ${entry.label}: \`${entry.path}\``)
219
- ].join("\n"));
220
- if (sections.length === 0) return input.task;
221
- sections.push(`Task:\n\n${input.task}`);
222
- return sections.join("\n\n---\n\n");
223
- }
224
- const DELEGATION_ARGUMENT_KEYS = [
225
- "description",
226
- "prompt",
227
- "agent",
228
- "role",
229
- "roleIndex",
230
- "reasoningEffort",
231
- "cwd",
232
- "maxDepth"
233
- ];
234
- /**
235
- * Keys a call must pass. `maxDepth` is accepted but not required: a missing or unusable
236
- * value resolves to `DEFAULT_CHILD_MAX_DEPTH` instead of forcing the caller to guess an
237
- * integer, which is where the reflexive `0` came from.
238
- */
239
- const REQUIRED_DELEGATION_ARGUMENT_KEYS = [
240
- "description",
241
- "prompt",
242
- "agent",
243
- "role",
244
- "roleIndex",
245
- "reasoningEffort",
246
- "cwd"
247
- ];
248
- /** Validate every required model-facing argument. Null declines an optional setting. */
54
+ /** Validate every model-facing argument before doing any Host call. */
249
55
  function parseDelegationArgs(raw) {
250
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new DelegationError("arguments must be an object");
56
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new Error("pstack_subagent arguments must be an object");
251
57
  const record = raw;
252
- for (const key of REQUIRED_DELEGATION_ARGUMENT_KEYS) if (!Object.hasOwn(record, key)) throw new DelegationError(`missing required argument "${key}"; every argument except maxDepth must be passed explicitly`);
253
- for (const key of Object.keys(record)) if (!DELEGATION_ARGUMENT_KEYS.includes(key)) throw new DelegationError(`unknown argument "${key}"; accepted arguments are ${DELEGATION_ARGUMENT_KEYS.join(", ")}`);
58
+ const known = /* @__PURE__ */ new Set([
59
+ "description",
60
+ "prompt",
61
+ "agent",
62
+ "role",
63
+ "roleIndex",
64
+ "reasoningEffort",
65
+ "cwd",
66
+ "maxDepth"
67
+ ]);
68
+ for (const key of Object.keys(record)) if (!known.has(key)) throw new Error(`unknown pstack_subagent argument "${key}"`);
69
+ for (const key of [
70
+ "description",
71
+ "prompt",
72
+ "agent",
73
+ "role",
74
+ "roleIndex",
75
+ "reasoningEffort",
76
+ "cwd"
77
+ ]) if (!Object.hasOwn(record, key)) throw new Error(`missing required argument "${key}"`);
254
78
  const description = record["description"];
255
- if (!isNonEmptyString(description)) throw new DelegationError("description must be a non-empty string: it becomes the child label");
256
79
  const prompt = record["prompt"];
257
- if (!isNonEmptyString(prompt)) throw new DelegationError("prompt must be a non-empty string");
258
80
  const agent = record["agent"];
259
- if (typeof agent !== "string" || !AGENT_KINDS.includes(agent)) throw new DelegationError(`agent must be one of ${AGENT_KINDS.join(", ")}; choose explicitly, and never pass a DSH agent preset id.`);
260
81
  const role = record["role"];
261
- if (role !== null && !isNonEmptyString(role)) throw new DelegationError("role must be a non-empty string or null");
262
- const cwd = record["cwd"];
263
- if (cwd !== null && !isNonEmptyString(cwd)) throw new DelegationError("cwd must be a non-empty string or null");
264
- const rawMaxDepth = record["maxDepth"];
265
- const maxDepth = rawMaxDepth === void 0 ? null : rawMaxDepth;
266
- if (maxDepth !== null && !isNonNegativeSafeInteger(maxDepth)) throw new DelegationError("maxDepth must be a non-negative safe integer, or null/omitted");
267
82
  const roleIndex = record["roleIndex"];
268
- if (roleIndex !== null && !isNonNegativeSafeInteger(roleIndex)) throw new DelegationError("roleIndex must be a non-negative safe integer or null");
269
- if (roleIndex !== null && role === null) throw new DelegationError("roleIndex requires a non-null role");
270
- const requestedEffort = record["reasoningEffort"];
271
- if (requestedEffort !== null && !isNonEmptyString(requestedEffort)) throw new DelegationError("reasoningEffort must be a non-empty string or null");
272
- if (typeof requestedEffort === "string" && /\s/.test(requestedEffort.trim())) throw new DelegationError(`reasoningEffort ${JSON.stringify(requestedEffort)} contains whitespace. An effort is one token, exactly as the model advertises it.`);
83
+ const reasoningEffort = record["reasoningEffort"];
84
+ const cwd = record["cwd"];
85
+ const maxDepth = record["maxDepth"];
86
+ if (typeof description !== "string" || description.trim() === "") throw new Error("description must be a non-empty string");
87
+ if (typeof prompt !== "string" || prompt.trim() === "") throw new Error("prompt must be a non-empty string");
88
+ if (typeof agent !== "string" || !AGENT_KINDS.includes(agent)) throw new Error(`agent must be one of: ${AGENT_KINDS.join(", ")}`);
89
+ if (role !== null && (typeof role !== "string" || role.trim() === "")) throw new Error("role must be a non-empty string or null");
90
+ if (roleIndex !== null && !isNonNegativeInteger(roleIndex)) throw new Error("roleIndex must be a non-negative integer or null");
91
+ if (roleIndex !== null && role === null) throw new Error("roleIndex requires a non-null role");
92
+ if (reasoningEffort !== null) {
93
+ if (typeof reasoningEffort !== "string" || reasoningEffort.trim() === "") throw new Error("reasoningEffort must be a non-empty string or null");
94
+ if (/\s/.test(reasoningEffort.trim())) throw new Error("reasoningEffort must be one token, exactly as the model advertises it");
95
+ }
96
+ if (cwd !== null && (typeof cwd !== "string" || cwd.trim() === "")) throw new Error("cwd must be a non-empty string or null");
97
+ if (maxDepth !== void 0 && maxDepth !== null && !isDepth(maxDepth)) throw new Error("maxDepth must be a positive safe integer or null");
273
98
  return {
274
- description,
275
- prompt,
99
+ description: description.trim(),
100
+ prompt: prompt.trim(),
276
101
  agent,
277
102
  role,
278
- cwd,
279
- maxDepth,
280
103
  roleIndex,
281
- reasoningEffort: requestedEffort?.trim() ?? null
104
+ reasoningEffort: typeof reasoningEffort === "string" ? reasoningEffort.trim() : null,
105
+ cwd: typeof cwd === "string" ? cwd.trim() : null,
106
+ maxDepth: maxDepth === void 0 ? null : maxDepth
282
107
  };
283
108
  }
284
- /** Route text as reported to the model. */
285
- function routeLabel(route, effortOverride) {
286
- const effort = effectiveEffort(route, effortOverride);
287
- const base = route.kind === "inherit" ? "inherit-parent" : `${route.provider}/${route.model}`;
288
- return effort === void 0 ? base : `${base} [${effort}]`;
289
- }
290
- /** Take the smallest of the requested depth, this row's cap, and the Host setting. */
291
- function resolveDelegationDepth(configured, requested, hostLimit) {
292
- if (requested !== void 0 && requested !== null && !isNonNegativeSafeInteger(requested)) throw new DelegationError("maxDepth must be a non-negative safe integer or null");
293
- if (configured !== void 0 && requested !== void 0 && requested !== null && requested > configured) throw new DelegationError(`maxDepth ${requested} exceeds this row's configured cap of ${configured}. Lower the request or raise \`pstack-subagent\` config.maxDepth.`);
294
- const candidates = [
295
- configured,
296
- requested,
297
- hostLimit
298
- ].filter((value) => value !== void 0 && value !== null);
299
- return candidates.length === 0 ? void 0 : Math.min(...candidates);
300
- }
301
- /**
302
- * Turn the per-call `maxDepth` request into an effective depth request.
303
- *
304
- * A child is always at least depth 1, so `0` can never start one: it is reported and
305
- * replaced with `DEFAULT_CHILD_MAX_DEPTH` rather than failing the whole call. Omitting
306
- * `maxDepth` (null) also uses the default, so a caller never has to guess an integer.
307
- */
308
- function requestedChildDepth(requested, diagnostics) {
309
- if (requested === null) return 1;
310
- if (requested === 0) {
311
- diagnostics.push(`maxDepth 0 cannot start a child (the child itself is depth 1), so this call used 1. Omit maxDepth for that default, or pass 1 or more.`);
312
- return 1;
313
- }
314
- return requested;
315
- }
316
- /** Resolve the role file, routes, prompt, and depth into one plan. Pure of service calls. */
109
+ /** Resolve the role file, child routes, prompt, and depth before activation starts. */
317
110
  function planDelegation(args, runtime, config = DEFAULT_CONFIG) {
318
- const rolePath = modelsFilePath(runtime.dshHome);
319
- const roleFile = readRoleConfiguration(rolePath);
320
- if (roleFile.status === "unreadable") throw new DelegationError(`the pstack role file at ${rolePath} exists but cannot be read (${roleFile.reason}). Fix its permissions or delete it, which makes every role inherit the parent route.`);
111
+ const path = modelsFilePath(runtime.dshHome);
112
+ const roleFile = readRoleConfiguration(path);
113
+ if (roleFile.status === "unreadable") throw new Error(`the pstack role file at ${path} exists but cannot be read (${roleFile.reason}). Fix its permissions or delete it to let every role inherit the parent route.`);
321
114
  const diagnostics = [];
322
- if (roleFile.status === "loaded") for (const issue of roleFile.issues) diagnostics.push(`${rolePath}${issue.line === void 0 ? "" : `:${issue.line}`}: ${issue.message}`);
115
+ if (roleFile.status === "loaded") for (const issue of roleFile.issues) diagnostics.push(`${path}${issue.line === void 0 ? "" : `:${issue.line}`}: ${issue.message}`);
323
116
  let selection;
324
- let roleSpec;
325
117
  if (args.role !== null) {
326
- roleSpec = requireRole(args.role);
327
- const entry = roleFile.status === "loaded" ? roleFile.roles.get(roleSpec.key) : void 0;
328
- selection = selectRoleRoutes(roleSpec, entry, args.roleIndex ?? void 0);
329
- }
330
- const routes = selection?.routes ?? [{ kind: "inherit" }];
331
- const roleName = roleSpec?.key ?? "(none)";
332
- if (selection !== void 0) {
333
- if (!selection.configured) diagnostics.push(`role "${selection.role.key}" has no line in ${rolePath}, so it inherits the parent route. Add a line to route it explicitly.`);
334
- if (selection.mode === "selected") diagnostics.push(`role "${selection.role.key}" holds ${selection.total} entries and is not an automatic panel; entry ${(selection.roleIndex ?? 0) + 1} was selected. Pass \`roleIndex\` to choose another.`);
335
- if (selection.role.key === "swarm workers") diagnostics.push("role \"swarm workers\" is a list, not a panel: its first entry is the default route for every worker, and `roleIndex` gives one race arm another entry. Each worker still needs its own pstack_subagent call.");
118
+ const spec = requireRole(args.role);
119
+ const entry = roleFile.status === "loaded" ? roleFile.roles.get(spec.key) : void 0;
120
+ selection = selectRoutes(spec, entry, args.roleIndex ?? void 0);
121
+ if (!selection.configured) diagnostics.push(`role "${spec.key}" has no line in ${path}, so it inherits the parent route`);
122
+ if (selection.mode === "selected") diagnostics.push(`role "${spec.key}" has ${selection.total} entries; entry ${(selection.roleIndex ?? 0) + 1} was selected`);
336
123
  }
337
- const prompt = composeChildPrompt({
338
- injectedPaths: args.agent === "poteto-agent" ? [{
339
- label: "`poteto-mode` SKILL.md",
340
- path: POTETO_MODE_SKILL_PATH
341
- }] : [],
342
- task: args.prompt
343
- });
344
- const agentPreset = agentPresetFor(args.agent);
345
- const depth = resolveDelegationDepth(config.maxDepth, requestedChildDepth(args.maxDepth, diagnostics), void 0);
124
+ const routes = selection?.routes ?? [{
125
+ kind: "inherit",
126
+ alias: "inherit-parent"
127
+ }];
128
+ const roleName = selection?.role.key ?? "(none)";
129
+ const agentPreset = args.agent === "general" ? void 0 : AGENT_PRESETS[args.agent];
130
+ const prompt = args.agent === "poteto-agent" ? injectPotetoModePath(args.prompt, runtime.potetoModeSkillPath) : args.prompt;
131
+ const hostDepth = runtime.subagents.resolveMaxDepth(config.maxDepth);
132
+ const depth = resolveChildDepth(args.maxDepth, config, hostDepth);
346
133
  const total = routes.length;
347
134
  const children = routes.map((route, index) => {
348
- const agentOptions = agentOptionsFor(route, args.reasoningEffort ?? void 0);
349
- const effort = effectiveEffort(route, args.reasoningEffort ?? void 0);
135
+ const effort = args.reasoningEffort ?? (route.kind === "route" ? route.effort : void 0);
350
136
  return {
351
137
  index,
352
138
  total,
@@ -354,296 +140,202 @@ function planDelegation(args, runtime, config = DEFAULT_CONFIG) {
354
140
  agent: args.agent,
355
141
  role: roleName,
356
142
  route,
357
- routeLabel: routeLabel(route, args.reasoningEffort ?? void 0),
358
- ...effort === void 0 ? {} : { effort },
359
- ...agentOptions === void 0 ? {} : { agentOptions },
143
+ routeLabel: formatRoute(route, args.reasoningEffort ?? void 0),
144
+ ...isRoute(route) || effort !== void 0 ? { agentOptions: agentOptionsFor(route, effort) } : {},
360
145
  ...agentPreset === void 0 ? {} : { agentPreset },
361
146
  ...args.cwd === null ? {} : { cwd: args.cwd },
362
147
  ...depth === void 0 ? {} : { maxDepth: depth }
363
148
  };
364
149
  });
365
- if (args.reasoningEffort !== null) {
366
- const overwritten = routes.filter((route) => route.kind === "route" && route.effort !== void 0 && route.effort !== args.reasoningEffort);
367
- if (overwritten.length > 0) diagnostics.push(`reasoningEffort "${args.reasoningEffort}" overrides the effort this call's role line names (${overwritten.map((route) => routeLabel(route)).join(", ")}). The role line is a starting level; pass no reasoningEffort to keep it.`);
150
+ if (selection?.mode === "panel" && children.length > 1) {
151
+ const distinct = new Set(children.map((child) => child.routeLabel));
152
+ if (distinct.size === 1) diagnostics.push(`all ${children.length} entries of panel "${roleName}" resolve to ${[...distinct][0]}, so they are not a cross-model panel`);
368
153
  }
369
- addPanelDiagnostics(children, roleName, selection, rolePath, diagnostics);
370
154
  return {
371
- agent: args.agent,
372
- prompt,
373
155
  provider: config.provider,
374
156
  role: roleName,
375
- mode: selection?.mode ?? "single",
376
- ...selection?.roleIndex === void 0 ? {} : { roleIndex: selection.roleIndex },
377
- roleTotal: selection?.total ?? 1,
378
- ...args.reasoningEffort === null ? {} : { reasoningEffort: args.reasoningEffort },
157
+ prompt,
379
158
  children,
380
159
  diagnostics
381
160
  };
382
161
  }
383
- function addPanelDiagnostics(children, roleName, selection, rolePath, diagnostics) {
384
- if (selection === void 0 || selection.mode !== "panel") return;
385
- if (children.length === 1) {
386
- diagnostics.push(`panel "${roleName}" has one configured entry, so this call started one child and claims no model diversity. Add entries to ${rolePath} for a real panel.`);
387
- return;
388
- }
389
- const distinct = new Set(children.map((child) => child.routeLabel));
390
- if (distinct.size > 1) return;
391
- diagnostics.push(`all ${children.length} entries of panel "${roleName}" resolve to the same route (${[...distinct][0]}), so these children are not a cross-model review.`);
392
- }
393
- /** Check the backend can enforce what this call asks for. */
394
- function assertProviderCapabilities(capabilities, providerName, asks) {
395
- const missing = [];
396
- if (asks.agentOptions && !capabilities.agentOptions) missing.push("agentOptions");
397
- if (asks.agentPreset && !capabilities.agentPreset) missing.push("agentPreset");
398
- if (asks.maxDepth && !capabilities.depthLimit) missing.push("maxDepth");
399
- if (missing.length === 0) return;
400
- throw new DelegationError(`subagent provider "${providerName}" does not support ${missing.join(", ")}. Change the route to \`inherit-parent\`, drop the unsupported argument, or configure a backend that supports it.`);
401
- }
402
- /**
403
- * Validate every route and effort before anything starts. An inherit-parent entry with
404
- * no effort carries no agentOptions and is skipped; an override on an inherit route is
405
- * validated against the parent's live route.
406
- */
407
- async function preflightRoutes(llm, parent, children, roleName, effortOverride, signal) {
408
- for (const child of children) {
409
- if (child.agentOptions === void 0) continue;
410
- if (child.route.kind === "inherit") {
411
- const effort = effortOverride;
412
- try {
413
- await validateEffortFor(llm, void 0, effort, parent, signal);
414
- } catch (error) {
415
- throw new DelegationError(`role ${roleName} inherits the parent route, and reasoningEffort "${effort}" failed preflight there: ${describeError(error)} Pass null for reasoningEffort, or name a role whose line holds an exact route.`);
416
- }
417
- continue;
418
- }
419
- const route = child.route;
420
- try {
421
- await llm.resolveCallConfig({
422
- provider: route.provider,
423
- model: route.model,
424
- ...child.effort === void 0 ? {} : { reasoningEffort: child.effort }
425
- }, signal);
426
- } catch (error) {
427
- throw new DelegationError(`role ${roleName} resolves to ${child.routeLabel}, which failed route preflight: ${describeError(error)}. Check the route in ${modelsFilePath("$DSH_HOME")} against the providers this deployment serves.`);
428
- }
429
- }
430
- }
431
- /**
432
- * Resolve and validate one child's `cwd`.
433
- *
434
- * A child may run inside the session directory or inside an explicitly separate Git
435
- * worktree. Anything else is refused: this tool does not create isolation, so it will
436
- * not promise one.
437
- */
438
- function resolveChildCwd(requested, sessionRoot) {
439
- if (requested === void 0) return void 0;
440
- const resolved = isAbsolute(requested) ? resolve(requested) : resolve(sessionRoot, requested);
441
- let isDirectory = false;
442
- try {
443
- isDirectory = statSync(resolved).isDirectory();
444
- } catch {
445
- isDirectory = false;
446
- }
447
- if (!isDirectory) throw new DelegationError(`cwd ${resolved} does not exist or is not a directory`);
448
- if (isWithin(sessionRoot, resolved) || isGitWorktree(resolved)) return resolved;
449
- throw new DelegationError(`cwd ${resolved} is outside this session's directory (${sessionRoot}) and is not a separate Git worktree. Pass a path inside the session directory, or create a worktree first and pass its checkout.`);
450
- }
451
- function isWithin(root, target) {
452
- const rel = relative(root, target);
453
- return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
454
- }
455
- function isGitWorktree(directory) {
456
- return existsSync(join(directory, ".git"));
457
- }
458
- /**
459
- * Start the planned children. Everything rejectable has already been rejected; a
460
- * failure at entry N keeps children 1..N-1 running and reports their ids.
461
- */
462
- async function startPlannedChildren(parent, plan, runtime, config, signal) {
162
+ /** Start every planned child after one final capability and route check. */
163
+ async function startPlannedChildren(parent, plan, runtime, signal) {
463
164
  const provider = runtime.subagents.getProvider(plan.provider);
464
165
  if (provider === void 0) {
465
166
  const available = runtime.subagents.list();
466
- throw new DelegationError(`subagent provider "${plan.provider}" is not registered; registered providers: ${available.length === 0 ? "(none)" : available.join(", ")}.`);
167
+ throw new Error(`subagent provider "${plan.provider}" is not registered; available providers: ${available.length === 0 ? "(none)" : available.join(", ")}`);
467
168
  }
468
- const hostLimit = runtime.subagents.resolveMaxDepth(config.maxDepth);
469
- const effectiveDepth = resolveDelegationDepth(config.maxDepth, plan.children[0]?.maxDepth, hostLimit);
470
- assertProviderCapabilities(provider.capabilities, plan.provider, {
471
- agentOptions: plan.children.some((child) => child.agentOptions !== void 0),
472
- agentPreset: plan.children.some((child) => child.agentPreset !== void 0),
473
- maxDepth: effectiveDepth !== void 0
474
- });
169
+ assertCapabilities(provider.capabilities, plan);
475
170
  const sessionRoot = await runtime.workingDirectory.ensure(parent, signal);
476
171
  const children = plan.children.map((child) => ({
477
172
  ...child,
478
- ...effectiveDepth === void 0 ? {} : { maxDepth: effectiveDepth },
479
- cwd: resolveChildCwd(child.cwd, sessionRoot)
173
+ ...child.cwd === void 0 ? {} : { cwd: resolveChildCwd(child.cwd, sessionRoot) }
480
174
  }));
481
- await preflightRoutes(runtime.llm, parent, children, plan.role, plan.reasoningEffort, signal);
482
- if (runtime.subagents.getProvider(plan.provider) !== provider) throw new DelegationError(`subagent provider "${plan.provider}" changed while the child routes were being resolved; retry the delegation`);
483
- const started = [];
484
- const diagnostics = [...plan.diagnostics];
485
- for (const child of children) {
175
+ await preflightRoutes(runtime.llm, parent, children, signal);
176
+ const records = [];
177
+ for (const child of children) try {
486
178
  signal.throwIfAborted();
487
- try {
488
- const activation = await runtime.subagents.startActivation({
489
- provider: plan.provider,
490
- label: child.label,
491
- request: {
492
- prompt: [{
493
- type: "text",
494
- text: plan.prompt
495
- }],
496
- parent,
497
- ...child.agentPreset === void 0 ? {} : { agentPreset: child.agentPreset },
498
- ...child.cwd === void 0 ? {} : { cwd: child.cwd },
499
- ...child.agentOptions === void 0 ? {} : { agentOptions: child.agentOptions },
500
- ...child.maxDepth === void 0 ? {} : { maxDepth: child.maxDepth }
501
- },
502
- signal,
503
- delivery: "parent"
504
- });
505
- const target = runtime.agents === void 0 ? void 0 : runtime.agents.get(activation.childId);
506
- if (target === void 0) diagnostics.push(`child ${activation.childId} has no live local Agent handle, so it cannot change its own reasoning effort with \`${SET_EFFORT_TOOL}\`. It runs at ${child.effort === void 0 ? "the adapter default" : `"${child.effort}"`} for its whole life.`);
507
- else installEffortControl(target, runtime.llm);
508
- started.push({
509
- childId: activation.childId,
510
- label: child.label,
511
- agent: child.agent,
512
- role: child.role,
513
- route: child.routeLabel,
514
- ...child.effort === void 0 ? {} : { effort: child.effort },
179
+ const activation = await runtime.subagents.startActivation({
180
+ provider: plan.provider,
181
+ label: child.label,
182
+ request: {
183
+ prompt: [{
184
+ type: "text",
185
+ text: plan.prompt
186
+ }],
187
+ parent,
188
+ ...child.agentPreset === void 0 ? {} : { agentPreset: child.agentPreset },
189
+ ...child.cwd === void 0 ? {} : { cwd: child.cwd },
190
+ ...child.agentOptions === void 0 ? {} : { agentOptions: child.agentOptions },
515
191
  ...child.maxDepth === void 0 ? {} : { maxDepth: child.maxDepth }
516
- });
517
- } catch (error) {
518
- if (started.length === 0) throw new DelegationError(`starting the ${plan.role === "(none)" ? "child" : `"${plan.role}" child`} "${child.label}" (${child.routeLabel}) failed: ${describeError(error)}`);
519
- throw new PartialDelegationError(`starting entry ${child.index + 1} of ${child.total} for role "${plan.role}" (${child.label}, ${child.routeLabel}) failed: ${describeError(error)}. The ${started.length} already started: ${started.map((record) => `${record.childId} (${record.label})`).join(", ")}. Those children are still running and are not rolled back.`, started);
520
- }
192
+ },
193
+ signal,
194
+ delivery: "parent"
195
+ });
196
+ records.push(recordFor(child, activation));
197
+ } catch (error) {
198
+ if (records.length === 0) throw error;
199
+ return {
200
+ kind: "partial",
201
+ children: records,
202
+ diagnostics: plan.diagnostics,
203
+ failure: {
204
+ index: child.index,
205
+ total: child.total,
206
+ label: child.label,
207
+ routeLabel: child.routeLabel,
208
+ reason: describeError(error)
209
+ }
210
+ };
521
211
  }
522
212
  return {
523
- kind: started.length === 1 ? "activation" : "activations",
524
- children: started,
525
- diagnostics
213
+ kind: records.length === 1 ? "activation" : "activations",
214
+ children: records,
215
+ diagnostics: plan.diagnostics
216
+ };
217
+ }
218
+ /** Complete delegation: plan, check, start. */
219
+ async function delegate(parent, args, runtime, config, signal) {
220
+ return startPlannedChildren(parent, planDelegation(args, runtime, config), runtime, signal);
221
+ }
222
+ function apply(ctx, rawConfig) {
223
+ const config = normalizeConfig(rawConfig);
224
+ const runtime = {
225
+ subagents: ctx.subagents,
226
+ llm: ctx.llm,
227
+ workingDirectory: ctx.workingDirectory,
228
+ dshHome: resolveDshHome(),
229
+ potetoModeSkillPath: POTETO_MODE_SKILL_PATH
526
230
  };
231
+ ctx.tools.register(createPstackSubagentTool(runtime, config));
527
232
  }
528
- /** Full delegation: plan, validate, start. */
529
- async function delegate(parent, args, runtime, config = DEFAULT_CONFIG, signal = new AbortController().signal) {
530
- return startPlannedChildren(parent, planDelegation(args, runtime, config), runtime, config, signal);
233
+ /** Build the model-facing tool. Exported for tests. */
234
+ function createPstackSubagentTool(runtime, config = DEFAULT_CONFIG) {
235
+ return {
236
+ name: TOOL_NAME,
237
+ description: TOOL_DESCRIPTION,
238
+ parameters: {
239
+ type: "object",
240
+ additionalProperties: false,
241
+ properties: {
242
+ description: {
243
+ type: "string",
244
+ description: "A short 3-5 word label for the child, shown in notices."
245
+ },
246
+ prompt: {
247
+ type: "string",
248
+ description: "The complete, self-contained brief. The child does not see this conversation."
249
+ },
250
+ agent: {
251
+ type: "string",
252
+ enum: [...AGENT_KINDS],
253
+ description: "Child preset: \"poteto-agent\" for pstack implementation, \"comment-sicko\" for comment review, \"readonly\" for a sandbox-enforced read-only researcher, or \"general\" to join the parent preset."
254
+ },
255
+ role: {
256
+ type: ["string", "null"],
257
+ description: "pstack role key. It selects the child's route and effort; null inherits the parent route."
258
+ },
259
+ roleIndex: {
260
+ type: ["integer", "null"],
261
+ description: "Entry index for a list role that is not an automatic panel. Null selects the first entry; omit only through null."
262
+ },
263
+ reasoningEffort: {
264
+ type: ["string", "null"],
265
+ description: "One advertised reasoning-effort token for this call, or null to keep the role's starting effort."
266
+ },
267
+ cwd: {
268
+ type: ["string", "null"],
269
+ description: "Initial child working directory inside this session or a separate Git worktree; null inherits the session directory."
270
+ },
271
+ maxDepth: {
272
+ type: ["integer", "null"],
273
+ minimum: 1,
274
+ description: "Optional delegation-depth cap. Omit or null to use the configured row and Host cap; explicit values must be at least 1 and cannot exceed that cap."
275
+ }
276
+ },
277
+ required: [
278
+ "description",
279
+ "prompt",
280
+ "agent",
281
+ "role",
282
+ "roleIndex",
283
+ "reasoningEffort",
284
+ "cwd"
285
+ ]
286
+ },
287
+ output: {
288
+ schema: OUTPUT_SCHEMA,
289
+ render: (_args, value) => [{
290
+ type: "text",
291
+ text: renderDelegation(value)
292
+ }]
293
+ },
294
+ isConcurrencySafe: () => true,
295
+ async execute(rawArgs, exec) {
296
+ if (exec.agent === void 0) throw new Error("pstack_subagent requires a calling Agent");
297
+ return delegate(exec.agent, parseDelegationArgs(rawArgs), runtime, config, exec.signal);
298
+ }
299
+ };
531
300
  }
532
301
  const TOOL_DESCRIPTION = [
533
302
  "Delegate self-contained work to one or more fresh child agents.",
534
303
  "",
535
- "Every argument is required except maxDepth. Pass null for role, roleIndex, reasoningEffort,",
536
- "or cwd when that setting is not used. Choose agent explicitly. maxDepth is optional: omit it",
537
- "(or pass null) for the safe default of 1, where the child exists but cannot start its own",
538
- "children; pass 2 or more, within this row's configured cap, to let it delegate further. A 0 is",
539
- "treated as 1, because a child is already depth 1 and 0 can never start one.",
540
- "",
541
- "Returns the id of every child it started plus the route each one resolved. The children run",
542
- "in the background: their results arrive later as completion notices in this conversation.",
543
- "Never wait or poll for them, and keep working on something useful meanwhile.",
304
+ "Every argument is required except maxDepth. Pass null for role, roleIndex, reasoningEffort, or cwd when unused. Choose agent explicitly.",
544
305
  "",
545
- "`agent` picks a DSH agent preset: `poteto-agent` mounts the pstack implementation delegate",
546
- "and receives the absolute path of the poteto-mode instructions; `comment-sicko` mounts the",
547
- "read-only comment reviewer; `general` joins the parent preset with no pstack persona.",
306
+ "Omit `maxDepth` to use the configured row and Host delegation cap; an explicit value cannot exceed that cap.",
548
307
  "",
549
- "`role` selects a configured pstack role and therefore the child's model route and reasoning",
550
- "effort. The role names come from the pstack role manifest, not this schema. Null inherits the",
551
- "parent route. Automatic panel roles start one child per configured entry.",
308
+ "`agent` picks a DSH agent preset: `poteto-agent` mounts the pstack implementation delegate and receives the absolute path of the poteto-mode instructions; `comment-sicko` mounts the comment reviewer; `readonly` mounts a read-only research preset with the sandbox policy set to read-only; `general` joins the parent preset.",
552
309
  "",
553
- "`reasoningEffort` raises or lowers the effort for this delegation alone, using a token the",
554
- "target model advertises. An unsupported value fails the call before any child starts,",
555
- "including every entry of a panel. Null keeps the role line's starting effort. A running child",
556
- "can change its own effort with `set_reasoning_effort`, which applies from its next step.",
310
+ "`role` selects a configured pstack role and therefore the child's model route and starting effort. Null inherits the parent route. Automatic panel roles start one child per configured entry; `pstack_roles` reports which roles accept `roleIndex`.",
557
311
  "",
558
- "Every prompt is a fresh child that does not see this conversation, so include everything it",
559
- "needs. A child's own summary is not evidence: review its diff or artifacts yourself."
312
+ "Returns every child id with its resolved route. Results arrive as completion notices; do not poll."
560
313
  ].join("\n");
561
- function buildParameters() {
562
- return {
563
- type: "object",
564
- additionalProperties: false,
565
- properties: {
566
- description: {
567
- type: "string",
568
- description: "A short 3-5 word label for the child, shown in list_agents and its notices."
569
- },
570
- prompt: {
571
- type: "string",
572
- description: "The complete, self-contained brief. The child does not see this conversation, so include the task, every prior directive, and the paths or branches it needs."
573
- },
574
- agent: {
575
- type: "string",
576
- enum: [...AGENT_KINDS],
577
- description: "Required child preset: \"poteto-agent\" for pstack implementation delegates, \"comment-sicko\" for the read-only comment reviewer, or \"general\" to join the parent preset."
578
- },
579
- role: {
580
- type: ["string", "null"],
581
- description: "Required pstack role key, matched exactly. It selects the child's model route and effort. Null inherits the parent route."
582
- },
583
- cwd: {
584
- type: ["string", "null"],
585
- description: "Required initial working directory, inside this session's directory or a separate Git worktree. Relative paths resolve against this session's directory. Null inherits the session directory."
586
- },
587
- maxDepth: {
588
- type: ["integer", "null"],
589
- description: "Optional delegation-depth cap for the child. Omit or pass null for the safe default of 1 (the child exists but cannot start its own children). Pass 2 or more, within this row's configured cap, to let it delegate further. 0 is treated as 1: a child is already depth 1, so 0 can never start one."
590
- },
591
- roleIndex: {
592
- type: ["integer", "null"],
593
- description: "Required entry index for a list-valued role that is not an automatic panel, 0 or greater. Requires a non-null role. Null selects the first entry. Call `pstack_roles` to see which roles accept an index."
594
- },
595
- reasoningEffort: {
596
- type: ["string", "null"],
597
- description: "Required reasoning-effort override for every child this call starts. Use one token the target model advertises, or null to keep the role line's starting effort. An unknown token fails the whole call before any child starts."
598
- }
599
- },
600
- required: [...REQUIRED_DELEGATION_ARGUMENT_KEYS]
601
- };
602
- }
603
314
  const OUTPUT_SCHEMA = {
604
315
  type: "object",
605
316
  additionalProperties: false,
606
317
  properties: {
607
318
  kind: {
608
319
  type: "string",
609
- enum: ["activation", "activations"],
610
- description: "How many children this call started."
320
+ enum: [
321
+ "activation",
322
+ "activations",
323
+ "partial"
324
+ ]
611
325
  },
612
326
  children: {
613
327
  type: "array",
614
- description: "One record per started child, in start order.",
615
328
  items: {
616
329
  type: "object",
617
330
  additionalProperties: false,
618
331
  properties: {
619
- childId: {
620
- type: "string",
621
- description: "The child session id."
622
- },
623
- label: {
624
- type: "string",
625
- description: "The label this call gave the child."
626
- },
627
- agent: {
628
- type: "string",
629
- description: "The child brief type."
630
- },
631
- role: {
632
- type: "string",
633
- description: "The role key, or `(none)`."
634
- },
635
- route: {
636
- type: "string",
637
- description: "`inherit-parent` or `<provider>/<model> [effort]`."
638
- },
639
- effort: {
640
- type: "string",
641
- description: "The reasoning effort this child runs at, when one applies."
642
- },
643
- maxDepth: {
644
- type: "integer",
645
- description: "The delegation-depth cap the child received."
646
- }
332
+ childId: { type: "string" },
333
+ label: { type: "string" },
334
+ agent: { type: "string" },
335
+ role: { type: "string" },
336
+ route: { type: "string" },
337
+ effort: { type: "string" },
338
+ maxDepth: { type: "integer" }
647
339
  },
648
340
  required: [
649
341
  "childId",
@@ -656,8 +348,25 @@ const OUTPUT_SCHEMA = {
656
348
  },
657
349
  diagnostics: {
658
350
  type: "array",
659
- description: "Configuration notes, including a panel whose entries share one route.",
660
351
  items: { type: "string" }
352
+ },
353
+ failure: {
354
+ type: "object",
355
+ additionalProperties: false,
356
+ properties: {
357
+ index: { type: "integer" },
358
+ total: { type: "integer" },
359
+ label: { type: "string" },
360
+ routeLabel: { type: "string" },
361
+ reason: { type: "string" }
362
+ },
363
+ required: [
364
+ "index",
365
+ "total",
366
+ "label",
367
+ "routeLabel",
368
+ "reason"
369
+ ]
661
370
  }
662
371
  },
663
372
  required: [
@@ -666,62 +375,110 @@ const OUTPUT_SCHEMA = {
666
375
  "diagnostics"
667
376
  ]
668
377
  };
669
- /** Render one delegation result for the model. */
670
- function renderDelegationResult(result) {
378
+ function renderDelegation(result) {
671
379
  const lines = [
672
- result.kind === "activation" ? `started 1 child: ${result.children[0]?.childId ?? "(none)"}` : `started ${result.children.length} children:`,
380
+ result.kind === "partial" ? `started ${result.children.length} of ${result.failure.total} children; entry ${result.failure.index + 1} failed: ${result.failure.reason}` : result.kind === "activation" ? `started 1 child: ${result.children[0]?.childId ?? "(none)"}` : `started ${result.children.length} children:`,
673
381
  ...result.children.map((child) => `- ${child.childId} (${child.label}) agent=${child.agent} role=${child.role} route=${child.route}${child.effort === void 0 ? "" : ` effort=${child.effort}`}${child.maxDepth === void 0 ? "" : ` maxDepth=${child.maxDepth}`}`),
674
- "Results arrive as completion notices; do not poll for them. Each child can change its own",
675
- "effort from its next step with `set_reasoning_effort`."
382
+ "Results from started children arrive as completion notices; do not poll for them."
676
383
  ];
677
- if (result.diagnostics.length > 0) lines.push("", "Diagnostics:", ...result.diagnostics.map((diagnostic) => `- ${diagnostic}`));
384
+ if (result.diagnostics.length > 0) lines.push("", "Diagnostics:", ...result.diagnostics.map((line) => `- ${line}`));
678
385
  return lines.join("\n");
679
386
  }
680
- /** Build the model-facing tool for one row. */
681
- function createPstackSubagentTool(runtime, config = DEFAULT_CONFIG) {
387
+ function recordFor(child, activation) {
682
388
  return {
683
- name: TOOL_NAME,
684
- description: TOOL_DESCRIPTION,
685
- parameters: buildParameters(),
686
- output: {
687
- schema: OUTPUT_SCHEMA,
688
- render: (_args, value) => [{
689
- type: "text",
690
- text: renderDelegationResult(value)
691
- }]
692
- },
693
- isConcurrencySafe: () => true,
694
- async execute(rawArgs, exec) {
695
- const parent = exec.agent;
696
- if (parent === void 0) throw new DelegationError("pstack_subagent needs a calling Agent, and exec.agent was undefined.");
697
- return await delegate(parent, parseDelegationArgs(rawArgs), runtime, config, exec.signal);
698
- }
389
+ childId: activation.childId,
390
+ label: child.label,
391
+ agent: child.agent,
392
+ role: child.role,
393
+ route: child.routeLabel,
394
+ ...child.agentOptions?.reasoningEffort === void 0 ? {} : { effort: child.agentOptions.reasoningEffort },
395
+ ...child.maxDepth === void 0 ? {} : { maxDepth: child.maxDepth }
699
396
  };
700
397
  }
701
- /** Build the runtime a real Host call reads. */
702
- function hostRuntime(ctx, getAgentRegistry = () => void 0) {
703
- return {
704
- subagents: ctx.subagents,
705
- llm: ctx.llm,
706
- workingDirectory: ctx.workingDirectory,
707
- get agents() {
708
- return getAgentRegistry();
709
- },
710
- dshHome: resolveDshHome()
711
- };
398
+ function agentOptionsFor(route, effort) {
399
+ return isRoute(route) ? {
400
+ provider: route.provider,
401
+ model: route.model,
402
+ ...effort === void 0 ? {} : { reasoningEffort: effort }
403
+ } : effort === void 0 ? {} : { reasoningEffort: effort };
712
404
  }
713
- /** Register `pstack_subagent` for this row. */
714
- function apply(ctx, config) {
715
- const resolved = normalizeConfig(config);
716
- const runtime = hostRuntime(ctx, () => ctx.get?.("agents"));
717
- ctx.tools.register(createPstackSubagentTool(runtime, resolved));
405
+ function formatRoute(route, override) {
406
+ const effort = override ?? (isRoute(route) ? route.effort : void 0);
407
+ const base = isRoute(route) ? `${route.provider}/${route.model}` : "inherit-parent";
408
+ return effort === void 0 ? base : `${base} [${effort}]`;
718
409
  }
719
- function describeError(error) {
720
- if (error instanceof Error) {
721
- const code = error.code;
722
- const suffix = typeof code === "string" ? ` (${code})` : "";
723
- return `${error.message}${suffix}`;
410
+ function resolveChildDepth(requested, config, hostLimit) {
411
+ const depth = requested ?? hostLimit;
412
+ if (depth === void 0) return void 0;
413
+ if (!Number.isSafeInteger(depth) || depth < 1) throw new Error("maxDepth must be a positive safe integer or null");
414
+ if (config.maxDepth !== void 0 && depth > config.maxDepth) throw new Error(`maxDepth ${depth} exceeds this row's configured cap of ${config.maxDepth}`);
415
+ if (hostLimit !== void 0 && depth > hostLimit) throw new Error(`maxDepth ${depth} exceeds the Host delegation limit of ${hostLimit}`);
416
+ return depth;
417
+ }
418
+ function assertCapabilities(capabilities, plan) {
419
+ const needsAgentOptions = plan.children.some((child) => child.agentOptions !== void 0);
420
+ const needsPreset = plan.children.some((child) => child.agentPreset !== void 0);
421
+ const needsDepth = plan.children.some((child) => child.maxDepth !== void 0);
422
+ const missing = [
423
+ ...needsAgentOptions && !capabilities.agentOptions ? ["agentOptions"] : [],
424
+ ...needsPreset && !capabilities.agentPreset ? ["agentPreset"] : [],
425
+ ...needsDepth && !capabilities.depthLimit ? ["maxDepth"] : []
426
+ ];
427
+ if (missing.length > 0) throw new Error(`subagent provider does not support ${missing.join(", ")}`);
428
+ }
429
+ async function preflightRoutes(llm, parent, children, signal) {
430
+ for (const child of children) {
431
+ const options = child.agentOptions;
432
+ if (options === void 0) continue;
433
+ const provider = options.provider ?? parent.options.provider;
434
+ const model = options.model ?? parent.options.model;
435
+ if (provider === void 0 || model === void 0) throw new Error(`cannot resolve role "${child.role}" because the child has no provider/model and the parent has not made a request yet`);
436
+ try {
437
+ await llm.resolveCallConfig({
438
+ provider,
439
+ model,
440
+ ...options.reasoningEffort === void 0 ? {} : { reasoningEffort: options.reasoningEffort }
441
+ }, signal);
442
+ } catch (error) {
443
+ throw new Error(`role "${child.role}" resolves to ${child.routeLabel}, which failed route preflight: ${describeError(error)}`);
444
+ }
445
+ }
446
+ }
447
+ function resolveChildCwd(requested, sessionRoot) {
448
+ const target = isAbsolute(requested) ? resolve(requested) : resolve(sessionRoot, requested);
449
+ let directory = false;
450
+ try {
451
+ directory = statSync(target).isDirectory();
452
+ } catch {
453
+ directory = false;
724
454
  }
725
- return String(error);
455
+ if (!directory) throw new Error(`cwd ${target} does not exist or is not a directory`);
456
+ if (isWithin(sessionRoot, target) || existsSync(join(target, ".git"))) return target;
457
+ throw new Error(`cwd ${target} is outside the session directory (${sessionRoot}) and is not a Git worktree`);
458
+ }
459
+ function isWithin(root, target) {
460
+ const rel = relative(root, target);
461
+ return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
462
+ }
463
+ function injectPotetoModePath(task, path) {
464
+ return [
465
+ "Absolute path injected by `pstack_subagent`:",
466
+ `- \`poteto-mode\` SKILL.md: \`${path}\``,
467
+ "",
468
+ "Read it directly before doing any work. Your skill catalog hides this skill, so a missing catalog entry does not mean pstack is absent.",
469
+ "",
470
+ "Task:",
471
+ "",
472
+ task
473
+ ].join("\n");
474
+ }
475
+ function isNonNegativeInteger(value) {
476
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
477
+ }
478
+ function isDepth(value) {
479
+ return isNonNegativeInteger(value) && value >= 1;
480
+ }
481
+ function describeError(error) {
482
+ return error instanceof Error ? error.message : String(error);
726
483
  }
727
- export { AGENT_KINDS, AGENT_PRESETS, DEFAULT_CHILD_MAX_DEPTH, DEFAULT_SUBAGENT_PROVIDER, DELEGATION_ARGUMENT_KEYS, DelegationError, PartialDelegationError, REQUIRED_DELEGATION_ARGUMENT_KEYS, TOOL_NAME, agentPresetFor, apply, assertProviderCapabilities, composeChildPrompt, createPstackSubagentTool, delegate, hostRuntime, inject, name, normalizeConfig, parseDelegationArgs, planDelegation, renderDelegationResult, requestedChildDepth, resolveChildCwd, resolveDelegationDepth, routeLabel, startPlannedChildren };
484
+ export { AGENT_KINDS, DEFAULT_PROVIDER, TOOL_NAME, apply, createPstackSubagentTool, delegate, inject, name, normalizeConfig, parseDelegationArgs, planDelegation, startPlannedChildren };