@a5c-ai/genty-platform 5.1.1-staging.0007199a1cb2

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 (749) hide show
  1. package/README.md +48 -0
  2. package/dist/anycli/cache.d.ts +45 -0
  3. package/dist/anycli/cache.d.ts.map +1 -0
  4. package/dist/anycli/cache.js +118 -0
  5. package/dist/anycli/index.d.ts +10 -0
  6. package/dist/anycli/index.d.ts.map +1 -0
  7. package/dist/anycli/index.js +25 -0
  8. package/dist/anycli/types.d.ts +32 -0
  9. package/dist/anycli/types.d.ts.map +1 -0
  10. package/dist/anycli/types.js +9 -0
  11. package/dist/api/breakpoints.d.ts +93 -0
  12. package/dist/api/breakpoints.d.ts.map +1 -0
  13. package/dist/api/breakpoints.js +334 -0
  14. package/dist/api/effects.d.ts +14 -0
  15. package/dist/api/effects.d.ts.map +1 -0
  16. package/dist/api/effects.js +301 -0
  17. package/dist/api/effectsTypes.d.ts +79 -0
  18. package/dist/api/effectsTypes.d.ts.map +1 -0
  19. package/dist/api/effectsTypes.js +6 -0
  20. package/dist/api/eventStream.d.ts +34 -0
  21. package/dist/api/eventStream.d.ts.map +1 -0
  22. package/dist/api/eventStream.js +127 -0
  23. package/dist/api/index.d.ts +10 -0
  24. package/dist/api/index.d.ts.map +1 -0
  25. package/dist/api/index.js +27 -0
  26. package/dist/api/runs.d.ts +85 -0
  27. package/dist/api/runs.d.ts.map +1 -0
  28. package/dist/api/runs.js +279 -0
  29. package/dist/api/sessions.d.ts +17 -0
  30. package/dist/api/sessions.d.ts.map +1 -0
  31. package/dist/api/sessions.js +58 -0
  32. package/dist/api/utils.d.ts +28 -0
  33. package/dist/api/utils.d.ts.map +1 -0
  34. package/dist/api/utils.js +74 -0
  35. package/dist/breakpoints/analytics.d.ts +46 -0
  36. package/dist/breakpoints/analytics.d.ts.map +1 -0
  37. package/dist/breakpoints/analytics.js +64 -0
  38. package/dist/breakpoints/approvalChains.d.ts +68 -0
  39. package/dist/breakpoints/approvalChains.d.ts.map +1 -0
  40. package/dist/breakpoints/approvalChains.js +111 -0
  41. package/dist/breakpoints/delegation.d.ts +42 -0
  42. package/dist/breakpoints/delegation.d.ts.map +1 -0
  43. package/dist/breakpoints/delegation.js +199 -0
  44. package/dist/breakpoints/delegationTypes.d.ts +46 -0
  45. package/dist/breakpoints/delegationTypes.d.ts.map +1 -0
  46. package/dist/breakpoints/delegationTypes.js +10 -0
  47. package/dist/breakpoints/postures.d.ts +28 -0
  48. package/dist/breakpoints/postures.d.ts.map +1 -0
  49. package/dist/breakpoints/postures.js +100 -0
  50. package/dist/compression/compaction.d.ts +82 -0
  51. package/dist/compression/compaction.d.ts.map +1 -0
  52. package/dist/compression/compaction.js +310 -0
  53. package/dist/compression/compactionStrategy.d.ts +37 -0
  54. package/dist/compression/compactionStrategy.d.ts.map +1 -0
  55. package/dist/compression/compactionStrategy.js +52 -0
  56. package/dist/compression/compressionFamilies.d.ts +39 -0
  57. package/dist/compression/compressionFamilies.d.ts.map +1 -0
  58. package/dist/compression/compressionFamilies.js +123 -0
  59. package/dist/context/dynamic.d.ts +16 -0
  60. package/dist/context/dynamic.d.ts.map +1 -0
  61. package/dist/context/dynamic.js +55 -0
  62. package/dist/context/instructions.d.ts +15 -0
  63. package/dist/context/instructions.d.ts.map +1 -0
  64. package/dist/context/instructions.js +97 -0
  65. package/dist/cost/claudeCodeParser.d.ts +81 -0
  66. package/dist/cost/claudeCodeParser.d.ts.map +1 -0
  67. package/dist/cost/claudeCodeParser.js +232 -0
  68. package/dist/cost/collector.d.ts +42 -0
  69. package/dist/cost/collector.d.ts.map +1 -0
  70. package/dist/cost/collector.js +105 -0
  71. package/dist/cost/effectCost.d.ts +23 -0
  72. package/dist/cost/effectCost.d.ts.map +1 -0
  73. package/dist/cost/effectCost.js +26 -0
  74. package/dist/cost/index.d.ts +7 -0
  75. package/dist/cost/index.d.ts.map +1 -0
  76. package/dist/cost/index.js +28 -0
  77. package/dist/cost/journal.d.ts +40 -0
  78. package/dist/cost/journal.d.ts.map +1 -0
  79. package/dist/cost/journal.js +163 -0
  80. package/dist/cost/types.d.ts +172 -0
  81. package/dist/cost/types.d.ts.map +1 -0
  82. package/dist/cost/types.js +229 -0
  83. package/dist/daemon/automationExecutor.d.ts +16 -0
  84. package/dist/daemon/automationExecutor.d.ts.map +1 -0
  85. package/dist/daemon/automationExecutor.js +222 -0
  86. package/dist/daemon/config.d.ts +8 -0
  87. package/dist/daemon/config.d.ts.map +1 -0
  88. package/dist/daemon/config.js +245 -0
  89. package/dist/daemon/daemonLog.d.ts +13 -0
  90. package/dist/daemon/daemonLog.d.ts.map +1 -0
  91. package/dist/daemon/daemonLog.js +64 -0
  92. package/dist/daemon/durableQueue.d.ts +41 -0
  93. package/dist/daemon/durableQueue.d.ts.map +1 -0
  94. package/dist/daemon/durableQueue.js +183 -0
  95. package/dist/daemon/fileWatcher.d.ts +9 -0
  96. package/dist/daemon/fileWatcher.d.ts.map +1 -0
  97. package/dist/daemon/fileWatcher.js +144 -0
  98. package/dist/daemon/index.d.ts +9 -0
  99. package/dist/daemon/index.d.ts.map +1 -0
  100. package/dist/daemon/index.js +26 -0
  101. package/dist/daemon/lifecycle.d.ts +12 -0
  102. package/dist/daemon/lifecycle.d.ts.map +1 -0
  103. package/dist/daemon/lifecycle.js +257 -0
  104. package/dist/daemon/loop.d.ts +27 -0
  105. package/dist/daemon/loop.d.ts.map +1 -0
  106. package/dist/daemon/loop.js +387 -0
  107. package/dist/daemon/timerScheduler.d.ts +13 -0
  108. package/dist/daemon/timerScheduler.d.ts.map +1 -0
  109. package/dist/daemon/timerScheduler.js +212 -0
  110. package/dist/daemon/types.d.ts +122 -0
  111. package/dist/daemon/types.d.ts.map +1 -0
  112. package/dist/daemon/types.js +25 -0
  113. package/dist/daemon/webhookListener.d.ts +6 -0
  114. package/dist/daemon/webhookListener.d.ts.map +1 -0
  115. package/dist/daemon/webhookListener.js +132 -0
  116. package/dist/extensions/discovery.d.ts +15 -0
  117. package/dist/extensions/discovery.d.ts.map +1 -0
  118. package/dist/extensions/discovery.js +119 -0
  119. package/dist/extensions/installer.d.ts +14 -0
  120. package/dist/extensions/installer.d.ts.map +1 -0
  121. package/dist/extensions/installer.js +100 -0
  122. package/dist/governance/authority.d.ts +68 -0
  123. package/dist/governance/authority.d.ts.map +1 -0
  124. package/dist/governance/authority.js +136 -0
  125. package/dist/governance/bridge.d.ts +17 -0
  126. package/dist/governance/bridge.d.ts.map +1 -0
  127. package/dist/governance/bridge.js +46 -0
  128. package/dist/governance/builtins.d.ts +25 -0
  129. package/dist/governance/builtins.d.ts.map +1 -0
  130. package/dist/governance/builtins.js +67 -0
  131. package/dist/governance/categories.d.ts +58 -0
  132. package/dist/governance/categories.d.ts.map +1 -0
  133. package/dist/governance/categories.js +120 -0
  134. package/dist/governance/decisionTrail.d.ts +60 -0
  135. package/dist/governance/decisionTrail.d.ts.map +1 -0
  136. package/dist/governance/decisionTrail.js +68 -0
  137. package/dist/governance/engine.d.ts +20 -0
  138. package/dist/governance/engine.d.ts.map +1 -0
  139. package/dist/governance/engine.js +124 -0
  140. package/dist/governance/index.d.ts +20 -0
  141. package/dist/governance/index.d.ts.map +1 -0
  142. package/dist/governance/index.js +75 -0
  143. package/dist/governance/logging.d.ts +18 -0
  144. package/dist/governance/logging.d.ts.map +1 -0
  145. package/dist/governance/logging.js +83 -0
  146. package/dist/governance/mandate.d.ts +83 -0
  147. package/dist/governance/mandate.d.ts.map +1 -0
  148. package/dist/governance/mandate.js +180 -0
  149. package/dist/governance/permissionEvents.d.ts +51 -0
  150. package/dist/governance/permissionEvents.d.ts.map +1 -0
  151. package/dist/governance/permissionEvents.js +52 -0
  152. package/dist/governance/permissionPropagation.d.ts +18 -0
  153. package/dist/governance/permissionPropagation.d.ts.map +1 -0
  154. package/dist/governance/permissionPropagation.js +58 -0
  155. package/dist/governance/postureBridge.d.ts +17 -0
  156. package/dist/governance/postureBridge.d.ts.map +1 -0
  157. package/dist/governance/postureBridge.js +117 -0
  158. package/dist/governance/privacySettings.d.ts +31 -0
  159. package/dist/governance/privacySettings.d.ts.map +1 -0
  160. package/dist/governance/privacySettings.js +104 -0
  161. package/dist/governance/sandboxBridge.d.ts +49 -0
  162. package/dist/governance/sandboxBridge.d.ts.map +1 -0
  163. package/dist/governance/sandboxBridge.js +77 -0
  164. package/dist/governance/sandboxPolicy.d.ts +51 -0
  165. package/dist/governance/sandboxPolicy.d.ts.map +1 -0
  166. package/dist/governance/sandboxPolicy.js +177 -0
  167. package/dist/governance/types.d.ts +7 -0
  168. package/dist/governance/types.d.ts.map +1 -0
  169. package/dist/governance/types.js +10 -0
  170. package/dist/harness/adapters/adapterBridge.d.ts +71 -0
  171. package/dist/harness/adapters/adapterBridge.d.ts.map +1 -0
  172. package/dist/harness/adapters/adapterBridge.js +117 -0
  173. package/dist/harness/adapters/adapterClientFactory.d.ts +29 -0
  174. package/dist/harness/adapters/adapterClientFactory.d.ts.map +1 -0
  175. package/dist/harness/adapters/adapterClientFactory.js +90 -0
  176. package/dist/harness/adapters/adapterEventEmitter.d.ts +51 -0
  177. package/dist/harness/adapters/adapterEventEmitter.d.ts.map +1 -0
  178. package/dist/harness/adapters/adapterEventEmitter.js +143 -0
  179. package/dist/harness/adapters/adapterEventMapper.d.ts +63 -0
  180. package/dist/harness/adapters/adapterEventMapper.d.ts.map +1 -0
  181. package/dist/harness/adapters/adapterEventMapper.js +100 -0
  182. package/dist/harness/adapters/adapterHarnessMap.d.ts +25 -0
  183. package/dist/harness/adapters/adapterHarnessMap.d.ts.map +1 -0
  184. package/dist/harness/adapters/adapterHarnessMap.js +55 -0
  185. package/dist/harness/adapters/adapterStdinReader.d.ts +45 -0
  186. package/dist/harness/adapters/adapterStdinReader.d.ts.map +1 -0
  187. package/dist/harness/adapters/adapterStdinReader.js +106 -0
  188. package/dist/harness/adapters/adapterTypes.d.ts +122 -0
  189. package/dist/harness/adapters/adapterTypes.d.ts.map +1 -0
  190. package/dist/harness/adapters/adapterTypes.js +11 -0
  191. package/dist/harness/adapters/index.d.ts +17 -0
  192. package/dist/harness/adapters/index.d.ts.map +1 -0
  193. package/dist/harness/adapters/index.js +34 -0
  194. package/dist/harness/backgroundTracker.d.ts +64 -0
  195. package/dist/harness/backgroundTracker.d.ts.map +1 -0
  196. package/dist/harness/backgroundTracker.js +107 -0
  197. package/dist/harness/budgetDowngrade.d.ts +12 -0
  198. package/dist/harness/budgetDowngrade.d.ts.map +1 -0
  199. package/dist/harness/budgetDowngrade.js +71 -0
  200. package/dist/harness/builtInHarness.d.ts +3 -0
  201. package/dist/harness/builtInHarness.d.ts.map +1 -0
  202. package/dist/harness/builtInHarness.js +18 -0
  203. package/dist/harness/capabilityRouter.d.ts +76 -0
  204. package/dist/harness/capabilityRouter.d.ts.map +1 -0
  205. package/dist/harness/capabilityRouter.js +177 -0
  206. package/dist/harness/circuitBreaker.d.ts +51 -0
  207. package/dist/harness/circuitBreaker.d.ts.map +1 -0
  208. package/dist/harness/circuitBreaker.js +110 -0
  209. package/dist/harness/concurrentEffects.d.ts +39 -0
  210. package/dist/harness/concurrentEffects.d.ts.map +1 -0
  211. package/dist/harness/concurrentEffects.js +90 -0
  212. package/dist/harness/effectRouting.d.ts +57 -0
  213. package/dist/harness/effectRouting.d.ts.map +1 -0
  214. package/dist/harness/effectRouting.js +130 -0
  215. package/dist/harness/extensionToolBridge.d.ts +11 -0
  216. package/dist/harness/extensionToolBridge.d.ts.map +1 -0
  217. package/dist/harness/extensionToolBridge.js +48 -0
  218. package/dist/harness/fallbackChains.d.ts +42 -0
  219. package/dist/harness/fallbackChains.d.ts.map +1 -0
  220. package/dist/harness/fallbackChains.js +69 -0
  221. package/dist/harness/gentySessionContext.d.ts +31 -0
  222. package/dist/harness/gentySessionContext.d.ts.map +1 -0
  223. package/dist/harness/gentySessionContext.js +49 -0
  224. package/dist/harness/gentySessionIntegration.d.ts +16 -0
  225. package/dist/harness/gentySessionIntegration.d.ts.map +1 -0
  226. package/dist/harness/gentySessionIntegration.js +66 -0
  227. package/dist/harness/hostContract.d.ts +69 -0
  228. package/dist/harness/hostContract.d.ts.map +1 -0
  229. package/dist/harness/hostContract.js +169 -0
  230. package/dist/harness/index.d.ts +25 -0
  231. package/dist/harness/index.d.ts.map +1 -0
  232. package/dist/harness/index.js +124 -0
  233. package/dist/harness/internal/createRun/agent-core-loop.d.ts +44 -0
  234. package/dist/harness/internal/createRun/agent-core-loop.d.ts.map +1 -0
  235. package/dist/harness/internal/createRun/agent-core-loop.js +247 -0
  236. package/dist/harness/internal/createRun/askUserQuestion.d.ts +11 -0
  237. package/dist/harness/internal/createRun/askUserQuestion.d.ts.map +1 -0
  238. package/dist/harness/internal/createRun/askUserQuestion.js +162 -0
  239. package/dist/harness/internal/createRun/index.d.ts +25 -0
  240. package/dist/harness/internal/createRun/index.d.ts.map +1 -0
  241. package/dist/harness/internal/createRun/index.js +196 -0
  242. package/dist/harness/internal/createRun/orchestration/constants.d.ts +8 -0
  243. package/dist/harness/internal/createRun/orchestration/constants.d.ts.map +1 -0
  244. package/dist/harness/internal/createRun/orchestration/constants.js +22 -0
  245. package/dist/harness/internal/createRun/orchestration/dispatch.d.ts +23 -0
  246. package/dist/harness/internal/createRun/orchestration/dispatch.d.ts.map +1 -0
  247. package/dist/harness/internal/createRun/orchestration/dispatch.js +142 -0
  248. package/dist/harness/internal/createRun/orchestration/effects.d.ts +135 -0
  249. package/dist/harness/internal/createRun/orchestration/effects.d.ts.map +1 -0
  250. package/dist/harness/internal/createRun/orchestration/effects.js +948 -0
  251. package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts +21 -0
  252. package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts.map +1 -0
  253. package/dist/harness/internal/createRun/orchestration/effectsHelpers.js +80 -0
  254. package/dist/harness/internal/createRun/orchestration/externalPhase.d.ts +3 -0
  255. package/dist/harness/internal/createRun/orchestration/externalPhase.d.ts.map +1 -0
  256. package/dist/harness/internal/createRun/orchestration/externalPhase.js +404 -0
  257. package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.d.ts +16 -0
  258. package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.d.ts.map +1 -0
  259. package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.js +107 -0
  260. package/dist/harness/internal/createRun/orchestration/hookDecisionEffects.d.ts +32 -0
  261. package/dist/harness/internal/createRun/orchestration/hookDecisionEffects.d.ts.map +1 -0
  262. package/dist/harness/internal/createRun/orchestration/hookDecisionEffects.js +76 -0
  263. package/dist/harness/internal/createRun/orchestration/index.d.ts +49 -0
  264. package/dist/harness/internal/createRun/orchestration/index.d.ts.map +1 -0
  265. package/dist/harness/internal/createRun/orchestration/index.js +505 -0
  266. package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts +22 -0
  267. package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts.map +1 -0
  268. package/dist/harness/internal/createRun/orchestration/internalPhase.js +787 -0
  269. package/dist/harness/internal/createRun/orchestration/internalTools.d.ts +28 -0
  270. package/dist/harness/internal/createRun/orchestration/internalTools.d.ts.map +1 -0
  271. package/dist/harness/internal/createRun/orchestration/internalTools.js +265 -0
  272. package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.d.ts +17 -0
  273. package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.d.ts.map +1 -0
  274. package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.js +23 -0
  275. package/dist/harness/internal/createRun/orchestration/taskResult.d.ts +10 -0
  276. package/dist/harness/internal/createRun/orchestration/taskResult.d.ts.map +1 -0
  277. package/dist/harness/internal/createRun/orchestration/taskResult.js +67 -0
  278. package/dist/harness/internal/createRun/orchestration/types.d.ts +48 -0
  279. package/dist/harness/internal/createRun/orchestration/types.d.ts.map +1 -0
  280. package/dist/harness/internal/createRun/orchestration/types.js +2 -0
  281. package/dist/harness/internal/createRun/orchestration/verbose.d.ts +7 -0
  282. package/dist/harness/internal/createRun/orchestration/verbose.d.ts.map +1 -0
  283. package/dist/harness/internal/createRun/orchestration/verbose.js +240 -0
  284. package/dist/harness/internal/createRun/orchestration/workerSessionEnhancer.d.ts +4 -0
  285. package/dist/harness/internal/createRun/orchestration/workerSessionEnhancer.d.ts.map +1 -0
  286. package/dist/harness/internal/createRun/orchestration/workerSessionEnhancer.js +36 -0
  287. package/dist/harness/internal/createRun/output.d.ts +40 -0
  288. package/dist/harness/internal/createRun/output.d.ts.map +1 -0
  289. package/dist/harness/internal/createRun/output.js +469 -0
  290. package/dist/harness/internal/createRun/pi.d.ts +10 -0
  291. package/dist/harness/internal/createRun/pi.d.ts.map +1 -0
  292. package/dist/harness/internal/createRun/pi.js +35 -0
  293. package/dist/harness/internal/createRun/planProcess/agentOutput.d.ts +5 -0
  294. package/dist/harness/internal/createRun/planProcess/agentOutput.d.ts.map +1 -0
  295. package/dist/harness/internal/createRun/planProcess/agentOutput.js +161 -0
  296. package/dist/harness/internal/createRun/planProcess/delegation.d.ts +33 -0
  297. package/dist/harness/internal/createRun/planProcess/delegation.d.ts.map +1 -0
  298. package/dist/harness/internal/createRun/planProcess/delegation.js +202 -0
  299. package/dist/harness/internal/createRun/planProcess/external.d.ts +14 -0
  300. package/dist/harness/internal/createRun/planProcess/external.d.ts.map +1 -0
  301. package/dist/harness/internal/createRun/planProcess/external.js +140 -0
  302. package/dist/harness/internal/createRun/planProcess/index.d.ts +12 -0
  303. package/dist/harness/internal/createRun/planProcess/index.d.ts.map +1 -0
  304. package/dist/harness/internal/createRun/planProcess/index.js +24 -0
  305. package/dist/harness/internal/createRun/planProcess/paths.d.ts +7 -0
  306. package/dist/harness/internal/createRun/planProcess/paths.d.ts.map +1 -0
  307. package/dist/harness/internal/createRun/planProcess/paths.js +98 -0
  308. package/dist/harness/internal/createRun/planProcess/phase.d.ts +6 -0
  309. package/dist/harness/internal/createRun/planProcess/phase.d.ts.map +1 -0
  310. package/dist/harness/internal/createRun/planProcess/phase.js +396 -0
  311. package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts +44 -0
  312. package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts.map +1 -0
  313. package/dist/harness/internal/createRun/planProcess/phaseHelpers.js +161 -0
  314. package/dist/harness/internal/createRun/planProcess/phaseTypes.d.ts +25 -0
  315. package/dist/harness/internal/createRun/planProcess/phaseTypes.d.ts.map +1 -0
  316. package/dist/harness/internal/createRun/planProcess/phaseTypes.js +6 -0
  317. package/dist/harness/internal/createRun/planProcess/prompts.d.ts +22 -0
  318. package/dist/harness/internal/createRun/planProcess/prompts.d.ts.map +1 -0
  319. package/dist/harness/internal/createRun/planProcess/prompts.js +241 -0
  320. package/dist/harness/internal/createRun/planProcess/recovery.d.ts +18 -0
  321. package/dist/harness/internal/createRun/planProcess/recovery.d.ts.map +1 -0
  322. package/dist/harness/internal/createRun/planProcess/recovery.js +205 -0
  323. package/dist/harness/internal/createRun/planProcess/runState.d.ts +40 -0
  324. package/dist/harness/internal/createRun/planProcess/runState.d.ts.map +1 -0
  325. package/dist/harness/internal/createRun/planProcess/runState.js +179 -0
  326. package/dist/harness/internal/createRun/planProcess/understandIntent.d.ts +22 -0
  327. package/dist/harness/internal/createRun/planProcess/understandIntent.d.ts.map +1 -0
  328. package/dist/harness/internal/createRun/planProcess/understandIntent.js +65 -0
  329. package/dist/harness/internal/createRun/planProcess/validation.d.ts +10 -0
  330. package/dist/harness/internal/createRun/planProcess/validation.d.ts.map +1 -0
  331. package/dist/harness/internal/createRun/planProcess/validation.js +289 -0
  332. package/dist/harness/internal/createRun/planProcess/validationSource.d.ts +13 -0
  333. package/dist/harness/internal/createRun/planProcess/validationSource.d.ts.map +1 -0
  334. package/dist/harness/internal/createRun/planProcess/validationSource.js +345 -0
  335. package/dist/harness/internal/createRun/planProcess/validationText.d.ts +3 -0
  336. package/dist/harness/internal/createRun/planProcess/validationText.d.ts.map +1 -0
  337. package/dist/harness/internal/createRun/planProcess/validationText.js +145 -0
  338. package/dist/harness/internal/createRun/prompts.d.ts +76 -0
  339. package/dist/harness/internal/createRun/prompts.d.ts.map +1 -0
  340. package/dist/harness/internal/createRun/prompts.js +466 -0
  341. package/dist/harness/internal/createRun/resumeState.d.ts +28 -0
  342. package/dist/harness/internal/createRun/resumeState.d.ts.map +1 -0
  343. package/dist/harness/internal/createRun/resumeState.js +134 -0
  344. package/dist/harness/internal/createRun/utils.d.ts +195 -0
  345. package/dist/harness/internal/createRun/utils.d.ts.map +1 -0
  346. package/dist/harness/internal/createRun/utils.js +237 -0
  347. package/dist/harness/internal.d.ts +13 -0
  348. package/dist/harness/internal.d.ts.map +1 -0
  349. package/dist/harness/internal.js +151 -0
  350. package/dist/harness/invoker/launch.d.ts +20 -0
  351. package/dist/harness/invoker/launch.d.ts.map +1 -0
  352. package/dist/harness/invoker/launch.js +23 -0
  353. package/dist/harness/invoker/processControl.d.ts +11 -0
  354. package/dist/harness/invoker/processControl.d.ts.map +1 -0
  355. package/dist/harness/invoker/processControl.js +50 -0
  356. package/dist/harness/invoker.d.ts +44 -0
  357. package/dist/harness/invoker.d.ts.map +1 -0
  358. package/dist/harness/invoker.js +343 -0
  359. package/dist/harness/lspIntegration.d.ts +48 -0
  360. package/dist/harness/lspIntegration.d.ts.map +1 -0
  361. package/dist/harness/lspIntegration.js +45 -0
  362. package/dist/harness/modeSelector.d.ts +50 -0
  363. package/dist/harness/modeSelector.d.ts.map +1 -0
  364. package/dist/harness/modeSelector.js +124 -0
  365. package/dist/harness/modelSelection.d.ts +37 -0
  366. package/dist/harness/modelSelection.d.ts.map +1 -0
  367. package/dist/harness/modelSelection.js +81 -0
  368. package/dist/harness/multiHarnessDispatch.d.ts +49 -0
  369. package/dist/harness/multiHarnessDispatch.d.ts.map +1 -0
  370. package/dist/harness/multiHarnessDispatch.js +73 -0
  371. package/dist/harness/oauthIntegration.d.ts +55 -0
  372. package/dist/harness/oauthIntegration.d.ts.map +1 -0
  373. package/dist/harness/oauthIntegration.js +84 -0
  374. package/dist/harness/operatorCommands.d.ts +38 -0
  375. package/dist/harness/operatorCommands.d.ts.map +1 -0
  376. package/dist/harness/operatorCommands.js +118 -0
  377. package/dist/harness/parallelFileOps.d.ts +56 -0
  378. package/dist/harness/parallelFileOps.d.ts.map +1 -0
  379. package/dist/harness/parallelFileOps.js +166 -0
  380. package/dist/harness/planMode.d.ts +68 -0
  381. package/dist/harness/planMode.d.ts.map +1 -0
  382. package/dist/harness/planMode.js +145 -0
  383. package/dist/harness/profileOrchestration.d.ts +55 -0
  384. package/dist/harness/profileOrchestration.d.ts.map +1 -0
  385. package/dist/harness/profileOrchestration.js +61 -0
  386. package/dist/harness/selectionPolicies.d.ts +29 -0
  387. package/dist/harness/selectionPolicies.d.ts.map +1 -0
  388. package/dist/harness/selectionPolicies.js +165 -0
  389. package/dist/harness/streamingParallelism.d.ts +43 -0
  390. package/dist/harness/streamingParallelism.d.ts.map +1 -0
  391. package/dist/harness/streamingParallelism.js +113 -0
  392. package/dist/harness/streamingRenderer.d.ts +64 -0
  393. package/dist/harness/streamingRenderer.d.ts.map +1 -0
  394. package/dist/harness/streamingRenderer.js +85 -0
  395. package/dist/harness/types.d.ts +289 -0
  396. package/dist/harness/types.d.ts.map +1 -0
  397. package/dist/harness/types.js +34 -0
  398. package/dist/harness/websocketSession.d.ts +63 -0
  399. package/dist/harness/websocketSession.d.ts.map +1 -0
  400. package/dist/harness/websocketSession.js +113 -0
  401. package/dist/harness/worktreeIsolation.d.ts +39 -0
  402. package/dist/harness/worktreeIsolation.d.ts.map +1 -0
  403. package/dist/harness/worktreeIsolation.js +85 -0
  404. package/dist/index.d.ts +16 -0
  405. package/dist/index.d.ts.map +1 -0
  406. package/dist/index.js +54 -0
  407. package/dist/interaction/askUserQuestion/core.d.ts +8 -0
  408. package/dist/interaction/askUserQuestion/core.d.ts.map +1 -0
  409. package/dist/interaction/askUserQuestion/core.js +112 -0
  410. package/dist/interaction/askUserQuestion/terminal.d.ts +15 -0
  411. package/dist/interaction/askUserQuestion/terminal.d.ts.map +1 -0
  412. package/dist/interaction/askUserQuestion/terminal.js +128 -0
  413. package/dist/interaction/askUserQuestion.d.ts +10 -0
  414. package/dist/interaction/askUserQuestion.d.ts.map +1 -0
  415. package/dist/interaction/askUserQuestion.js +295 -0
  416. package/dist/interaction/askUserQuestionTypes.d.ts +31 -0
  417. package/dist/interaction/askUserQuestionTypes.d.ts.map +1 -0
  418. package/dist/interaction/askUserQuestionTypes.js +6 -0
  419. package/dist/interaction/commandDiscovery.d.ts +38 -0
  420. package/dist/interaction/commandDiscovery.d.ts.map +1 -0
  421. package/dist/interaction/commandDiscovery.js +106 -0
  422. package/dist/interaction/index.d.ts +11 -0
  423. package/dist/interaction/index.d.ts.map +1 -0
  424. package/dist/interaction/index.js +42 -0
  425. package/dist/interaction/interactionRouter.d.ts +25 -0
  426. package/dist/interaction/interactionRouter.d.ts.map +1 -0
  427. package/dist/interaction/interactionRouter.js +55 -0
  428. package/dist/interaction/model-switch.d.ts +16 -0
  429. package/dist/interaction/model-switch.d.ts.map +1 -0
  430. package/dist/interaction/model-switch.js +41 -0
  431. package/dist/interaction/permissionApprovalUi.d.ts +32 -0
  432. package/dist/interaction/permissionApprovalUi.d.ts.map +1 -0
  433. package/dist/interaction/permissionApprovalUi.js +96 -0
  434. package/dist/interaction/steering.d.ts +17 -0
  435. package/dist/interaction/steering.d.ts.map +1 -0
  436. package/dist/interaction/steering.js +41 -0
  437. package/dist/interaction/typedEffectPatterns.d.ts +55 -0
  438. package/dist/interaction/typedEffectPatterns.d.ts.map +1 -0
  439. package/dist/interaction/typedEffectPatterns.js +190 -0
  440. package/dist/mcp/channels/allowlist.d.ts +19 -0
  441. package/dist/mcp/channels/allowlist.d.ts.map +1 -0
  442. package/dist/mcp/channels/allowlist.js +140 -0
  443. package/dist/mcp/channels/channelManager.d.ts +64 -0
  444. package/dist/mcp/channels/channelManager.d.ts.map +1 -0
  445. package/dist/mcp/channels/channelManager.js +137 -0
  446. package/dist/mcp/channels/inboundQueue.d.ts +47 -0
  447. package/dist/mcp/channels/inboundQueue.d.ts.map +1 -0
  448. package/dist/mcp/channels/inboundQueue.js +96 -0
  449. package/dist/mcp/channels/index.d.ts +16 -0
  450. package/dist/mcp/channels/index.d.ts.map +1 -0
  451. package/dist/mcp/channels/index.js +38 -0
  452. package/dist/mcp/channels/outbound.d.ts +33 -0
  453. package/dist/mcp/channels/outbound.d.ts.map +1 -0
  454. package/dist/mcp/channels/outbound.js +94 -0
  455. package/dist/mcp/channels/permissionRelay.d.ts +62 -0
  456. package/dist/mcp/channels/permissionRelay.d.ts.map +1 -0
  457. package/dist/mcp/channels/permissionRelay.js +159 -0
  458. package/dist/mcp/channels/types.d.ts +135 -0
  459. package/dist/mcp/channels/types.d.ts.map +1 -0
  460. package/dist/mcp/channels/types.js +16 -0
  461. package/dist/mcp/client/auth.d.ts +57 -0
  462. package/dist/mcp/client/auth.d.ts.map +1 -0
  463. package/dist/mcp/client/auth.js +99 -0
  464. package/dist/mcp/client/config.d.ts +28 -0
  465. package/dist/mcp/client/config.d.ts.map +1 -0
  466. package/dist/mcp/client/config.js +144 -0
  467. package/dist/mcp/client/executor.d.ts +30 -0
  468. package/dist/mcp/client/executor.d.ts.map +1 -0
  469. package/dist/mcp/client/executor.js +61 -0
  470. package/dist/mcp/client/index.d.ts +13 -0
  471. package/dist/mcp/client/index.d.ts.map +1 -0
  472. package/dist/mcp/client/index.js +30 -0
  473. package/dist/mcp/client/manager.d.ts +74 -0
  474. package/dist/mcp/client/manager.d.ts.map +1 -0
  475. package/dist/mcp/client/manager.js +215 -0
  476. package/dist/mcp/client/resourceBrowser.d.ts +52 -0
  477. package/dist/mcp/client/resourceBrowser.d.ts.map +1 -0
  478. package/dist/mcp/client/resourceBrowser.js +80 -0
  479. package/dist/mcp/client/toolRegistry.d.ts +113 -0
  480. package/dist/mcp/client/toolRegistry.d.ts.map +1 -0
  481. package/dist/mcp/client/toolRegistry.js +190 -0
  482. package/dist/mcp/client/types.d.ts +96 -0
  483. package/dist/mcp/client/types.d.ts.map +1 -0
  484. package/dist/mcp/client/types.js +15 -0
  485. package/dist/mcp/transport/index.d.ts +9 -0
  486. package/dist/mcp/transport/index.d.ts.map +1 -0
  487. package/dist/mcp/transport/index.js +13 -0
  488. package/dist/mcp/transport/session.d.ts +18 -0
  489. package/dist/mcp/transport/session.d.ts.map +1 -0
  490. package/dist/mcp/transport/session.js +78 -0
  491. package/dist/mcp/transport/types.d.ts +19 -0
  492. package/dist/mcp/transport/types.d.ts.map +1 -0
  493. package/dist/mcp/transport/types.js +7 -0
  494. package/dist/mcp/transport/websocket.d.ts +41 -0
  495. package/dist/mcp/transport/websocket.d.ts.map +1 -0
  496. package/dist/mcp/transport/websocket.js +271 -0
  497. package/dist/microagents/discovery.d.ts +34 -0
  498. package/dist/microagents/discovery.d.ts.map +1 -0
  499. package/dist/microagents/discovery.js +72 -0
  500. package/dist/microagents/dispatch.d.ts +36 -0
  501. package/dist/microagents/dispatch.d.ts.map +1 -0
  502. package/dist/microagents/dispatch.js +59 -0
  503. package/dist/microagents/index.d.ts +35 -0
  504. package/dist/microagents/index.d.ts.map +1 -0
  505. package/dist/microagents/index.js +44 -0
  506. package/dist/microagents/subprocess.d.ts +41 -0
  507. package/dist/microagents/subprocess.d.ts.map +1 -0
  508. package/dist/microagents/subprocess.js +75 -0
  509. package/dist/observability/alertWebhooks.d.ts +35 -0
  510. package/dist/observability/alertWebhooks.d.ts.map +1 -0
  511. package/dist/observability/alertWebhooks.js +68 -0
  512. package/dist/observability/analytics.d.ts +66 -0
  513. package/dist/observability/analytics.d.ts.map +1 -0
  514. package/dist/observability/analytics.js +104 -0
  515. package/dist/observability/auditExport.d.ts +25 -0
  516. package/dist/observability/auditExport.d.ts.map +1 -0
  517. package/dist/observability/auditExport.js +108 -0
  518. package/dist/observability/contextIntrospection.d.ts +40 -0
  519. package/dist/observability/contextIntrospection.d.ts.map +1 -0
  520. package/dist/observability/contextIntrospection.js +93 -0
  521. package/dist/observability/failureTriage.d.ts +28 -0
  522. package/dist/observability/failureTriage.d.ts.map +1 -0
  523. package/dist/observability/failureTriage.js +168 -0
  524. package/dist/observability/health.d.ts +19 -0
  525. package/dist/observability/health.d.ts.map +1 -0
  526. package/dist/observability/health.js +129 -0
  527. package/dist/observability/index.d.ts +14 -0
  528. package/dist/observability/index.d.ts.map +1 -0
  529. package/dist/observability/index.js +53 -0
  530. package/dist/observability/progressSummarizer.d.ts +27 -0
  531. package/dist/observability/progressSummarizer.d.ts.map +1 -0
  532. package/dist/observability/progressSummarizer.js +143 -0
  533. package/dist/observability/promptPlan.d.ts +52 -0
  534. package/dist/observability/promptPlan.d.ts.map +1 -0
  535. package/dist/observability/promptPlan.js +101 -0
  536. package/dist/observability/resumeDashboard.d.ts +32 -0
  537. package/dist/observability/resumeDashboard.d.ts.map +1 -0
  538. package/dist/observability/resumeDashboard.js +204 -0
  539. package/dist/observability/runStatus.d.ts +44 -0
  540. package/dist/observability/runStatus.d.ts.map +1 -0
  541. package/dist/observability/runStatus.js +170 -0
  542. package/dist/observability/subagentHealth.d.ts +66 -0
  543. package/dist/observability/subagentHealth.d.ts.map +1 -0
  544. package/dist/observability/subagentHealth.js +107 -0
  545. package/dist/observability/subagentProgress.d.ts +64 -0
  546. package/dist/observability/subagentProgress.d.ts.map +1 -0
  547. package/dist/observability/subagentProgress.js +91 -0
  548. package/dist/observability/timeline.d.ts +11 -0
  549. package/dist/observability/timeline.d.ts.map +1 -0
  550. package/dist/observability/timeline.js +176 -0
  551. package/dist/observability/types.d.ts +62 -0
  552. package/dist/observability/types.d.ts.map +1 -0
  553. package/dist/observability/types.js +8 -0
  554. package/dist/observability/webhooks.d.ts +68 -0
  555. package/dist/observability/webhooks.d.ts.map +1 -0
  556. package/dist/observability/webhooks.js +132 -0
  557. package/dist/orchestration/defaultOrchestrationProvider.d.ts +30 -0
  558. package/dist/orchestration/defaultOrchestrationProvider.d.ts.map +1 -0
  559. package/dist/orchestration/defaultOrchestrationProvider.js +304 -0
  560. package/dist/orchestration/global.d.ts +27 -0
  561. package/dist/orchestration/global.d.ts.map +1 -0
  562. package/dist/orchestration/global.js +51 -0
  563. package/dist/orchestration/index.d.ts +12 -0
  564. package/dist/orchestration/index.d.ts.map +1 -0
  565. package/dist/orchestration/index.js +17 -0
  566. package/dist/orchestration/interfaces.d.ts +136 -0
  567. package/dist/orchestration/interfaces.d.ts.map +1 -0
  568. package/dist/orchestration/interfaces.js +11 -0
  569. package/dist/orchestration/registry.d.ts +30 -0
  570. package/dist/orchestration/registry.d.ts.map +1 -0
  571. package/dist/orchestration/registry.js +148 -0
  572. package/dist/plugins/ccCompatibility.d.ts +79 -0
  573. package/dist/plugins/ccCompatibility.d.ts.map +1 -0
  574. package/dist/plugins/ccCompatibility.js +139 -0
  575. package/dist/plugins/index.d.ts +16 -0
  576. package/dist/plugins/index.d.ts.map +1 -0
  577. package/dist/plugins/index.js +38 -0
  578. package/dist/plugins/loader.d.ts +37 -0
  579. package/dist/plugins/loader.d.ts.map +1 -0
  580. package/dist/plugins/loader.js +112 -0
  581. package/dist/plugins/management.d.ts +33 -0
  582. package/dist/plugins/management.d.ts.map +1 -0
  583. package/dist/plugins/management.js +99 -0
  584. package/dist/plugins/marketplace.d.ts +64 -0
  585. package/dist/plugins/marketplace.d.ts.map +1 -0
  586. package/dist/plugins/marketplace.js +101 -0
  587. package/dist/plugins/sandbox.d.ts +38 -0
  588. package/dist/plugins/sandbox.d.ts.map +1 -0
  589. package/dist/plugins/sandbox.js +109 -0
  590. package/dist/plugins/trust.d.ts +31 -0
  591. package/dist/plugins/trust.d.ts.map +1 -0
  592. package/dist/plugins/trust.js +66 -0
  593. package/dist/plugins/types.d.ts +27 -0
  594. package/dist/plugins/types.d.ts.map +1 -0
  595. package/dist/plugins/types.js +7 -0
  596. package/dist/plugins/validation.d.ts +32 -0
  597. package/dist/plugins/validation.d.ts.map +1 -0
  598. package/dist/plugins/validation.js +117 -0
  599. package/dist/plugins/version-check.d.ts +23 -0
  600. package/dist/plugins/version-check.d.ts.map +1 -0
  601. package/dist/plugins/version-check.js +70 -0
  602. package/dist/plugins/versioning.d.ts +40 -0
  603. package/dist/plugins/versioning.d.ts.map +1 -0
  604. package/dist/plugins/versioning.js +101 -0
  605. package/dist/processes/index.d.ts +12 -0
  606. package/dist/processes/index.d.ts.map +1 -0
  607. package/dist/processes/index.js +15 -0
  608. package/dist/processes/recommender.d.ts +36 -0
  609. package/dist/processes/recommender.d.ts.map +1 -0
  610. package/dist/processes/recommender.js +73 -0
  611. package/dist/processes/scorer.d.ts +26 -0
  612. package/dist/processes/scorer.d.ts.map +1 -0
  613. package/dist/processes/scorer.js +104 -0
  614. package/dist/processes/types.d.ts +48 -0
  615. package/dist/processes/types.d.ts.map +1 -0
  616. package/dist/processes/types.js +9 -0
  617. package/dist/runtime/index.d.ts +9 -0
  618. package/dist/runtime/index.d.ts.map +1 -0
  619. package/dist/runtime/index.js +9 -0
  620. package/dist/seams/contract.d.ts +63 -0
  621. package/dist/seams/contract.d.ts.map +1 -0
  622. package/dist/seams/contract.js +146 -0
  623. package/dist/seams/index.d.ts +3 -0
  624. package/dist/seams/index.d.ts.map +1 -0
  625. package/dist/seams/index.js +8 -0
  626. package/dist/session/context.d.ts +22 -0
  627. package/dist/session/context.d.ts.map +1 -0
  628. package/dist/session/context.js +113 -0
  629. package/dist/session/continuityState.d.ts +39 -0
  630. package/dist/session/continuityState.d.ts.map +1 -0
  631. package/dist/session/continuityState.js +164 -0
  632. package/dist/session/cost.d.ts +72 -0
  633. package/dist/session/cost.d.ts.map +1 -0
  634. package/dist/session/cost.js +221 -0
  635. package/dist/session/crossRunComm.d.ts +40 -0
  636. package/dist/session/crossRunComm.d.ts.map +1 -0
  637. package/dist/session/crossRunComm.js +86 -0
  638. package/dist/session/crossRunState.d.ts +8 -0
  639. package/dist/session/crossRunState.d.ts.map +1 -0
  640. package/dist/session/crossRunState.js +45 -0
  641. package/dist/session/discovery.d.ts +22 -0
  642. package/dist/session/discovery.d.ts.map +1 -0
  643. package/dist/session/discovery.js +51 -0
  644. package/dist/session/history.d.ts +30 -0
  645. package/dist/session/history.d.ts.map +1 -0
  646. package/dist/session/history.js +144 -0
  647. package/dist/session/index.d.ts +8 -0
  648. package/dist/session/index.d.ts.map +1 -0
  649. package/dist/session/index.js +73 -0
  650. package/dist/session/memoryConsolidation.d.ts +31 -0
  651. package/dist/session/memoryConsolidation.d.ts.map +1 -0
  652. package/dist/session/memoryConsolidation.js +135 -0
  653. package/dist/session/memoryExtraction.d.ts +65 -0
  654. package/dist/session/memoryExtraction.d.ts.map +1 -0
  655. package/dist/session/memoryExtraction.js +201 -0
  656. package/dist/session/parse.d.ts +45 -0
  657. package/dist/session/parse.d.ts.map +1 -0
  658. package/dist/session/parse.js +170 -0
  659. package/dist/session/persistence.d.ts +46 -0
  660. package/dist/session/persistence.d.ts.map +1 -0
  661. package/dist/session/persistence.js +180 -0
  662. package/dist/session/sessionSharing.d.ts +55 -0
  663. package/dist/session/sessionSharing.d.ts.map +1 -0
  664. package/dist/session/sessionSharing.js +113 -0
  665. package/dist/session/sessionTemplates.d.ts +57 -0
  666. package/dist/session/sessionTemplates.d.ts.map +1 -0
  667. package/dist/session/sessionTemplates.js +93 -0
  668. package/dist/session/types.d.ts +267 -0
  669. package/dist/session/types.d.ts.map +1 -0
  670. package/dist/session/types.js +45 -0
  671. package/dist/session/write.d.ts +61 -0
  672. package/dist/session/write.d.ts.map +1 -0
  673. package/dist/session/write.js +213 -0
  674. package/dist/skills/chain.d.ts +31 -0
  675. package/dist/skills/chain.d.ts.map +1 -0
  676. package/dist/skills/chain.js +113 -0
  677. package/dist/skills/discovery.d.ts +34 -0
  678. package/dist/skills/discovery.d.ts.map +1 -0
  679. package/dist/skills/discovery.js +185 -0
  680. package/dist/skills/index.d.ts +12 -0
  681. package/dist/skills/index.d.ts.map +1 -0
  682. package/dist/skills/index.js +18 -0
  683. package/dist/skills/router.d.ts +35 -0
  684. package/dist/skills/router.d.ts.map +1 -0
  685. package/dist/skills/router.js +143 -0
  686. package/dist/skills/types.d.ts +33 -0
  687. package/dist/skills/types.d.ts.map +1 -0
  688. package/dist/skills/types.js +5 -0
  689. package/dist/storage/atomic.d.ts +2 -0
  690. package/dist/storage/atomic.d.ts.map +1 -0
  691. package/dist/storage/atomic.js +54 -0
  692. package/dist/storage/clock.d.ts +2 -0
  693. package/dist/storage/clock.d.ts.map +1 -0
  694. package/dist/storage/clock.js +6 -0
  695. package/dist/storage/index.d.ts +9 -0
  696. package/dist/storage/index.d.ts.map +1 -0
  697. package/dist/storage/index.js +11 -0
  698. package/dist/storage/journalWatcher.d.ts +24 -0
  699. package/dist/storage/journalWatcher.d.ts.map +1 -0
  700. package/dist/storage/journalWatcher.js +173 -0
  701. package/dist/storage/paths.d.ts +5 -0
  702. package/dist/storage/paths.d.ts.map +1 -0
  703. package/dist/storage/paths.js +26 -0
  704. package/dist/storage/runFiles.d.ts +29 -0
  705. package/dist/storage/runFiles.d.ts.map +1 -0
  706. package/dist/storage/runFiles.js +85 -0
  707. package/dist/storage/snapshotState.d.ts +10 -0
  708. package/dist/storage/snapshotState.d.ts.map +1 -0
  709. package/dist/storage/snapshotState.js +15 -0
  710. package/dist/storage/storeTaskArtifacts.d.ts +6 -0
  711. package/dist/storage/storeTaskArtifacts.d.ts.map +1 -0
  712. package/dist/storage/storeTaskArtifacts.js +55 -0
  713. package/dist/storage/types.d.ts +21 -0
  714. package/dist/storage/types.d.ts.map +1 -0
  715. package/dist/storage/types.js +2 -0
  716. package/dist/tasks/crud.d.ts +33 -0
  717. package/dist/tasks/crud.d.ts.map +1 -0
  718. package/dist/tasks/crud.js +150 -0
  719. package/dist/tasks/index.d.ts +2 -0
  720. package/dist/tasks/index.d.ts.map +1 -0
  721. package/dist/tasks/index.js +9 -0
  722. package/dist/trust/harness-signing.d.ts +15 -0
  723. package/dist/trust/harness-signing.d.ts.map +1 -0
  724. package/dist/trust/harness-signing.js +46 -0
  725. package/dist/trust/key-store.d.ts +15 -0
  726. package/dist/trust/key-store.d.ts.map +1 -0
  727. package/dist/trust/key-store.js +66 -0
  728. package/dist/types.d.ts +81 -0
  729. package/dist/types.d.ts.map +1 -0
  730. package/dist/types.js +21 -0
  731. package/dist/utils/atomic.d.ts +16 -0
  732. package/dist/utils/atomic.d.ts.map +1 -0
  733. package/dist/utils/atomic.js +75 -0
  734. package/dist/utils/concurrency.d.ts +27 -0
  735. package/dist/utils/concurrency.d.ts.map +1 -0
  736. package/dist/utils/concurrency.js +42 -0
  737. package/dist/utils/defaults.d.ts +11 -0
  738. package/dist/utils/defaults.d.ts.map +1 -0
  739. package/dist/utils/defaults.js +13 -0
  740. package/dist/utils/errors.d.ts +50 -0
  741. package/dist/utils/errors.d.ts.map +1 -0
  742. package/dist/utils/errors.js +76 -0
  743. package/dist/utils/index.d.ts +7 -0
  744. package/dist/utils/index.d.ts.map +1 -0
  745. package/dist/utils/index.js +18 -0
  746. package/dist/utils/patterns.d.ts +35 -0
  747. package/dist/utils/patterns.d.ts.map +1 -0
  748. package/dist/utils/patterns.js +84 -0
  749. package/package.json +170 -0
@@ -0,0 +1,787 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.runInternalOrchestrationPhase = runInternalOrchestrationPhase;
37
+ exports.resolveWorkspaceRunsDir = resolveWorkspaceRunsDir;
38
+ const node_fs_1 = require("node:fs");
39
+ const path = __importStar(require("node:path"));
40
+ const node_crypto_1 = require("node:crypto");
41
+ const utils_1 = require("../utils");
42
+ const prompts_1 = require("../prompts");
43
+ const constants_1 = require("./constants");
44
+ const effects_1 = require("./effects");
45
+ const internalTools_1 = require("./internalTools");
46
+ const runState_1 = require("../planProcess/runState");
47
+ const planProcess_1 = require("../planProcess");
48
+ const resumeState_1 = require("../resumeState");
49
+ const verbose_1 = require("./verbose");
50
+ const tasks_1 = require("../../../../tasks");
51
+ const history_1 = require("../../../../session/history");
52
+ const gentySessionContext_1 = require("../../../gentySessionContext");
53
+ const gentySessionIntegration_1 = require("../../../gentySessionIntegration");
54
+ const extensionToolBridge_1 = require("../../../extensionToolBridge");
55
+ async function runInternalOrchestrationPhase(args) {
56
+ const state = {
57
+ runId: args.existingRunId,
58
+ runDir: args.existingRunDir,
59
+ sessionBound: args.existingSessionBound,
60
+ iteration: 0,
61
+ pendingActions: new Map(),
62
+ pendingEffectResults: new Map(),
63
+ };
64
+ let orchestrationSession = null;
65
+ // Bug #936: genty's internal (in-process) execution must establish the run
66
+ // lifecycle in the WORKSPACE .a5c/runs, not the global ~/.a5c/runs. When the
67
+ // caller did not pass an explicit runsDir and no BABYSITTER_RUNS_DIR override
68
+ // is set, resolveRunsDir() defaults to the global home dir (scope=global),
69
+ // so the workspace .a5c/runs/ is never created and downstream verification
70
+ // (and run resumption) can't find the run. Force the workspace repo runs dir
71
+ // in that case so the internal path matches the external path's lifecycle.
72
+ // An explicit args.runsDir or BABYSITTER_RUNS_DIR override still wins.
73
+ const resolvedRunsDir = resolveWorkspaceRunsDir(args.runsDir, args.workspace);
74
+ if (resolvedRunsDir && resolvedRunsDir !== args.runsDir) {
75
+ args.runsDir = resolvedRunsDir;
76
+ }
77
+ // Initialize genty session context — wires trust, extensions, instructions, steering, model switch
78
+ let gentyCtx = null;
79
+ try {
80
+ gentyCtx = await (0, gentySessionContext_1.createGentySessionContext)({
81
+ workspace: args.workspace ?? process.cwd(),
82
+ sessionId: (0, node_crypto_1.randomUUID)(),
83
+ model: args.model,
84
+ agentId: `genty-orchestrator-${Date.now()}`,
85
+ });
86
+ }
87
+ catch {
88
+ // Genty context is optional; orchestration works without it
89
+ }
90
+ if (gentyCtx) {
91
+ args.gentyContext = gentyCtx;
92
+ }
93
+ const activePiSessions = new Set();
94
+ const writeVerbose = (message) => {
95
+ (0, utils_1.writeVerboseLine)(args.verbose, args.json, message, args.outputMode);
96
+ };
97
+ const writeVerboseData = (label, value, maxChars) => {
98
+ (0, utils_1.writeVerboseBlock)(args.verbose, args.json, label, value, maxChars, args.outputMode);
99
+ };
100
+ const registerPiSession = (session) => {
101
+ activePiSessions.add(session);
102
+ return session;
103
+ };
104
+ const shutdownPiSession = async (session) => {
105
+ if (!session) {
106
+ return;
107
+ }
108
+ activePiSessions.delete(session);
109
+ const maybeAbort = session;
110
+ if (typeof maybeAbort.abort === "function") {
111
+ await maybeAbort.abort().catch(() => undefined);
112
+ }
113
+ session.dispose();
114
+ };
115
+ const describePendingActions = () => Array.from(state.pendingActions.values()).map((action) => ({
116
+ effectId: action.effectId,
117
+ kind: action.kind,
118
+ title: action.taskDef?.title,
119
+ harness: (0, utils_1.resolveTaskHarness)(action, args.selectedHarnessName, args.discovered),
120
+ }));
121
+ const ensureTerminalResult = () => {
122
+ if (state.lastIterationResult?.status === "completed")
123
+ return 0;
124
+ if (state.lastIterationResult?.status === "failed")
125
+ return 1;
126
+ return null;
127
+ };
128
+ const captureProgressSnapshot = () => ({
129
+ runId: state.runId,
130
+ runDir: state.runDir,
131
+ sessionBound: Boolean(state.sessionBound),
132
+ iteration: state.iteration,
133
+ pendingActionIds: Array.from(state.pendingActions.keys()).sort().join(","),
134
+ pendingResultIds: Array.from(state.pendingEffectResults.keys()).sort().join(","),
135
+ lastStatus: state.lastIterationResult?.status,
136
+ hasAskUserQuestionResponse: Boolean(state.lastAskUserQuestionResponse),
137
+ finished: Boolean(state.finished),
138
+ processFileFingerprint: (0, effects_1.readProcessFileFingerprint)(args.processPath),
139
+ });
140
+ const orchestrationStateAdvanced = (before) => {
141
+ const after = captureProgressSnapshot();
142
+ return Object.keys(after).some((key) => after[key]
143
+ !== before[key]);
144
+ };
145
+ const protectedRunEntries = new Set();
146
+ let runSummaryRecorded = false;
147
+ const recordRunSummary = async (status, outcome) => {
148
+ const stateFile = state.sessionBound?.stateFile;
149
+ const sessionId = state.sessionBound?.sessionId;
150
+ if (runSummaryRecorded || !stateFile || !sessionId || !state.runId) {
151
+ return;
152
+ }
153
+ const recordedAt = new Date().toISOString();
154
+ await (0, history_1.addRunSummary)(path.dirname(stateFile), sessionId, {
155
+ runId: state.runId,
156
+ processId: path.basename(args.processPath, path.extname(args.processPath)),
157
+ status,
158
+ startedAt: recordedAt,
159
+ completedAt: recordedAt,
160
+ outcome,
161
+ });
162
+ runSummaryRecorded = true;
163
+ };
164
+ const snapshotProtectedRunEntries = async () => {
165
+ if (!args.runsDir) {
166
+ return;
167
+ }
168
+ let entries = [];
169
+ try {
170
+ entries = await node_fs_1.promises.readdir(args.runsDir);
171
+ }
172
+ catch {
173
+ return;
174
+ }
175
+ for (const entry of entries) {
176
+ protectedRunEntries.add(entry);
177
+ }
178
+ };
179
+ const cleanupUnexpectedRunSiblings = async () => {
180
+ if (!args.runsDir || !state.runId) {
181
+ return;
182
+ }
183
+ let entries = [];
184
+ try {
185
+ entries = await node_fs_1.promises.readdir(args.runsDir);
186
+ }
187
+ catch {
188
+ return;
189
+ }
190
+ const removed = [];
191
+ for (const entry of entries) {
192
+ if (entry === state.runId || protectedRunEntries.has(entry)) {
193
+ continue;
194
+ }
195
+ try {
196
+ const target = path.join(args.runsDir, entry);
197
+ const stat = await node_fs_1.promises.stat(target);
198
+ if (!stat.isDirectory()) {
199
+ continue;
200
+ }
201
+ await node_fs_1.promises.rm(target, { recursive: true, force: true });
202
+ removed.push(entry);
203
+ }
204
+ catch {
205
+ // Best-effort cleanup only; don't derail the orchestration loop.
206
+ }
207
+ }
208
+ if (removed.length > 0) {
209
+ writeVerboseData("phaseOrchestration host cleaned stray run dirs", {
210
+ runId: state.runId,
211
+ removed,
212
+ });
213
+ }
214
+ };
215
+ const syncStateFromRunArtifacts = async () => {
216
+ if (!state.runDir) {
217
+ return { runStatus: null, synchronized: false };
218
+ }
219
+ const before = captureProgressSnapshot();
220
+ const assessed = await (0, resumeState_1.assessRun)(state.runDir).catch(() => null);
221
+ if (!assessed) {
222
+ return { runStatus: null, synchronized: false };
223
+ }
224
+ const pendingTasks = await (0, tasks_1.listTasks)(state.runDir, { status: "requested" }).catch(() => []);
225
+ state.runId = assessed.run.runId;
226
+ state.pendingActions.clear();
227
+ for (const task of pendingTasks) {
228
+ const detail = await (0, tasks_1.readTask)(state.runDir, task.effectId).catch(() => null);
229
+ if (!detail) {
230
+ continue;
231
+ }
232
+ const definition = detail.definition;
233
+ const io = typeof definition.io === "object" && definition.io !== null
234
+ ? definition.io
235
+ : undefined;
236
+ const action = {
237
+ effectId: task.effectId,
238
+ invocationKey: String(definition.invocationKey ?? task.effectId),
239
+ kind: task.kind,
240
+ label: task.title,
241
+ labels: task.labels,
242
+ taskDef: detail.definition,
243
+ taskId: task.taskId,
244
+ stepId: typeof definition.stepId === "string" ? definition.stepId : undefined,
245
+ taskDefRef: `tasks/${task.effectId}/task.json`,
246
+ inputsRef: typeof io?.inputJsonPath === "string" ? String(io.inputJsonPath) : undefined,
247
+ requestedAt: task.requestedAt,
248
+ };
249
+ state.pendingActions.set(task.effectId, action);
250
+ }
251
+ if (assessed.run.status === "completed") {
252
+ state.lastIterationResult = { status: "completed", output: undefined };
253
+ }
254
+ else if (assessed.run.status === "failed") {
255
+ state.lastIterationResult = {
256
+ status: "failed",
257
+ error: { message: "Run failed" },
258
+ };
259
+ }
260
+ else if (state.pendingActions.size > 0) {
261
+ state.lastIterationResult = {
262
+ status: "waiting",
263
+ nextActions: Array.from(state.pendingActions.values()),
264
+ };
265
+ }
266
+ const synchronized = orchestrationStateAdvanced(before);
267
+ if (synchronized) {
268
+ writeVerboseData("phaseOrchestration synced run state", {
269
+ runStatus: assessed.run.status,
270
+ pendingEffects: Array.from(state.pendingActions.keys()),
271
+ journalLength: assessed.journalLength,
272
+ lastEvent: assessed.lastEvent,
273
+ });
274
+ }
275
+ return { runStatus: assessed.run.status, synchronized };
276
+ };
277
+ const { mergedTools, iterateTool, taskPostTool, finishTool, invokeTool } = (0, internalTools_1.createOrchestrationTools)({
278
+ phaseArgs: args,
279
+ state,
280
+ describePendingActions,
281
+ writeVerbose,
282
+ writeVerboseData,
283
+ });
284
+ const ensureBoundRunContext = async () => {
285
+ const runState = await (0, runState_1.ensureRunAndMaybeBindFromProcessDefinition)({
286
+ processPath: args.processPath,
287
+ prompt: args.prompt ?? "",
288
+ workspace: args.workspace,
289
+ runsDir: args.runsDir,
290
+ selectedHarnessName: args.selectedHarnessName,
291
+ maxIterations: args.maxIterations,
292
+ interactive: args.interactive,
293
+ verbose: args.verbose,
294
+ json: args.json,
295
+ phaseSession: orchestrationSession,
296
+ state,
297
+ });
298
+ if (runState.createdRun) {
299
+ (0, utils_1.emitProgress)({ phase: "2", status: "run-created", runId: runState.runId, runDir: runState.runDir }, args.json, args.verbose, args.outputMode);
300
+ writeVerboseData("phaseOrchestration host run state", runState);
301
+ }
302
+ if (runState.boundSession && runState.sessionBound) {
303
+ (0, utils_1.emitProgress)({
304
+ phase: "2",
305
+ status: "bound",
306
+ runId: runState.runId,
307
+ runDir: runState.runDir,
308
+ harness: runState.sessionBound.harness,
309
+ sessionId: runState.sessionBound.sessionId,
310
+ error: runState.sessionBound.error,
311
+ }, args.json, args.verbose, args.outputMode);
312
+ }
313
+ };
314
+ const promptOrchestrationAgent = async (message, label = "phaseOrchestration") => {
315
+ if (!orchestrationSession) {
316
+ throw new utils_1.BabysitterRuntimeError("OrchestrationSessionMissing", "The orchestration PI session has not been created.", { category: utils_1.ErrorCategory.Runtime });
317
+ }
318
+ if (!args.json && args.verbose && args.outputMode !== "tui") {
319
+ process.stderr.write(`\n${utils_1.DIM}[${label}] agent turn\n`);
320
+ }
321
+ writeVerboseData(`${label} prompt`, message);
322
+ const progressSnapshot = captureProgressSnapshot();
323
+ let result;
324
+ try {
325
+ result = await (0, utils_1.promptPiWithRetry)({
326
+ session: orchestrationSession,
327
+ message: (0, utils_1.compressInternalHarnessPrompt)(message, args.compressionConfig, "agent"),
328
+ timeout: utils_1.PARENT_PROMPT_TIMEOUT_MS,
329
+ label,
330
+ writeVerbose,
331
+ writeVerboseData,
332
+ });
333
+ }
334
+ catch (err) {
335
+ const isTimeout = err instanceof utils_1.BabysitterRuntimeError
336
+ && (err.name === "PiTimeoutError" || err.message.includes("timed out"));
337
+ if (!isTimeout) {
338
+ throw err;
339
+ }
340
+ result = {
341
+ success: false,
342
+ output: `Pi prompt timed out: ${err instanceof Error ? err.message : String(err)}`,
343
+ };
344
+ }
345
+ if (!result.success) {
346
+ writeVerboseData(`${label} agent failure output`, result.output);
347
+ if (!orchestrationStateAdvanced(progressSnapshot)) {
348
+ throw new utils_1.BabysitterRuntimeError("OrchestrationAgentFailed", result.output, {
349
+ category: utils_1.ErrorCategory.External,
350
+ });
351
+ }
352
+ if (state.lastIterationResult?.status !== "process-error" &&
353
+ !(0, utils_1.isIgnorablePiPromptFailure)(result.output)) {
354
+ throw new utils_1.BabysitterRuntimeError("OrchestrationAgentFailed", result.output, {
355
+ category: utils_1.ErrorCategory.External,
356
+ });
357
+ }
358
+ return;
359
+ }
360
+ writeVerbose(`[phaseOrchestration agent] ${summarizeAgentText(result.output)}`);
361
+ };
362
+ // Build orchestration system prompt, then layer in genty context (instructions, extensions)
363
+ const orchestrationSystemPrompt = (0, prompts_1.buildOrchestrationSystemPrompt)(args.selectedHarnessName, args.promptContext, args.interactive, (0, prompts_1.prefersAgentOnlyTasks)(args.invocationCommand));
364
+ const appendSystemPrompt = [orchestrationSystemPrompt];
365
+ let sessionCustomTools = mergedTools;
366
+ if (gentyCtx) {
367
+ // Apply AGENTS.md / SYSTEM.md instructions
368
+ if (gentyCtx.instructions.agentInstructions.length > 0) {
369
+ appendSystemPrompt.push(...gentyCtx.instructions.agentInstructions);
370
+ }
371
+ if (gentyCtx.instructions.systemPromptMode === 'append' && gentyCtx.instructions.systemPrompt) {
372
+ appendSystemPrompt.push(gentyCtx.instructions.systemPrompt);
373
+ }
374
+ // Bridge extension tools into the custom tools array
375
+ const extensionTools = (0, extensionToolBridge_1.bridgeExtensionTools)(gentyCtx.extensionRegistry);
376
+ if (extensionTools.length > 0) {
377
+ sessionCustomTools = [...mergedTools, ...extensionTools];
378
+ }
379
+ }
380
+ orchestrationSession = registerPiSession((0, utils_1.createAgentCoreSession)({
381
+ workspace: args.workspace,
382
+ model: gentyCtx?.modelSwitch.currentModel ?? args.model,
383
+ backend: (0, utils_1.resolveAgentCoreBackendForHarness)(args.selectedHarnessName),
384
+ toolsMode: "coding",
385
+ customTools: sessionCustomTools,
386
+ uiContext: args.interactive && args.rl
387
+ ? (0, utils_1.createReadlineAskUserQuestionUiContext)(args.rl)
388
+ : undefined,
389
+ appendSystemPrompt,
390
+ ephemeral: true,
391
+ ...(gentyCtx?.instructions.systemPromptMode === 'replace' && gentyCtx.instructions.systemPrompt
392
+ ? { systemPrompt: gentyCtx.instructions.systemPrompt }
393
+ : {}),
394
+ }));
395
+ (0, utils_1.emitProgress)({ phase: "2", status: "started", harness: args.selectedHarnessName }, args.json, args.verbose, args.outputMode);
396
+ let unsubscribe = null;
397
+ try {
398
+ await orchestrationSession.initialize();
399
+ if (gentyCtx) {
400
+ await gentyCtx.extensionRegistry.emit({
401
+ type: 'sessionStart',
402
+ timestamp: new Date().toISOString(),
403
+ data: { model: gentyCtx.modelSwitch.currentModel, extensions: gentyCtx.extensionLoadResult },
404
+ });
405
+ }
406
+ if (!args.json && args.verbose && args.outputMode !== "tui") {
407
+ unsubscribe = (0, verbose_1.subscribeVerbosePiEvents)(orchestrationSession, "orchestrator", args);
408
+ }
409
+ await ensureBoundRunContext();
410
+ if (!state.runId || !state.runDir) {
411
+ throw new utils_1.BabysitterRuntimeError("RunNotCreated", "The orchestration session could not establish a run before iteration.", { category: utils_1.ErrorCategory.Runtime });
412
+ }
413
+ await snapshotProtectedRunEntries();
414
+ let consecutiveTimeouts = 0;
415
+ let consecutiveStalls = 0;
416
+ let consecutiveProcessErrorStalls = 0;
417
+ // #936: a process-error whose journal "advances" each turn (e.g. an agent
418
+ // task that declares outputSchema but whose worker returns markdown, so the
419
+ // SDK rejects every result with the same coercion error) keeps re-arming the
420
+ // auto-advance branch and resets the stall counters — spinning forever on
421
+ // the same iteration. Track the verbatim error signature independently of
422
+ // journal advancement and abort fast once it recurs past the threshold.
423
+ let lastProcessErrorSignature;
424
+ let repeatedProcessErrorCount = 0;
425
+ const observeProcessErrorConvergence = () => {
426
+ if (state.lastIterationResult?.status !== "process-error") {
427
+ lastProcessErrorSignature = undefined;
428
+ repeatedProcessErrorCount = 0;
429
+ return;
430
+ }
431
+ const signature = extractIterationError(state.lastIterationResult.error);
432
+ if (signature === lastProcessErrorSignature) {
433
+ repeatedProcessErrorCount += 1;
434
+ }
435
+ else {
436
+ lastProcessErrorSignature = signature;
437
+ repeatedProcessErrorCount = 1;
438
+ }
439
+ if (repeatedProcessErrorCount >= constants_1.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS) {
440
+ throw new utils_1.BabysitterRuntimeError("OrchestrationProcessErrorLoop", `The run produced the same process-error ${repeatedProcessErrorCount} times without progress; aborting instead of spinning. `
441
+ + `Underlying error: ${signature}`, { category: utils_1.ErrorCategory.Runtime });
442
+ }
443
+ };
444
+ // #936: bound repeated delegated-effect failures. A delegated agent/skill/
445
+ // shell effect that keeps failing (e.g. the worker session can't reach a
446
+ // model, so runDelegatedHarnessTask returns success:false every time) must
447
+ // fail the run fast — it must be impossible to re-post the same failing
448
+ // effect thousands of times and spin to the orchestration timeout.
449
+ const delegatedFailureCounts = new Map();
450
+ const recordDelegatedEffectFailure = (effectId, message) => {
451
+ const next = (delegatedFailureCounts.get(effectId) ?? 0) + 1;
452
+ delegatedFailureCounts.set(effectId, next);
453
+ writeVerbose(`[phaseOrchestration host] delegated effect ${effectId} failure ${next}/${constants_1.MAX_DELEGATED_EFFECT_FAILURES}: ${message.slice(0, 200)}`);
454
+ if (next >= constants_1.MAX_DELEGATED_EFFECT_FAILURES) {
455
+ throw new utils_1.BabysitterRuntimeError("DelegatedEffectFailed", `Delegated effect ${effectId} failed ${next} times and is not making progress; aborting the run. Underlying failure: ${message}`, { category: utils_1.ErrorCategory.External });
456
+ }
457
+ };
458
+ while (state.iteration < args.maxIterations) {
459
+ const observed = await syncStateFromRunArtifacts();
460
+ const terminal = ensureTerminalResult();
461
+ if (terminal !== null) {
462
+ break;
463
+ }
464
+ if ((state.lastIterationResult?.status === "waiting"
465
+ && state.pendingActions.size === 0)
466
+ || observed.runStatus === "created"
467
+ || observed.runStatus === "in-progress") {
468
+ writeVerbose(observed.runStatus === "created"
469
+ ? "[phaseOrchestration host] bootstrapping the freshly created run"
470
+ : "[phaseOrchestration host] all pending effects were posted; auto-advancing the run");
471
+ await invokeTool(iterateTool, "babysitter_run_iterate");
472
+ if (ensureTerminalResult() !== null) {
473
+ break;
474
+ }
475
+ // Abort if the auto-advanced iterate keeps yielding the identical
476
+ // process-error (otherwise this branch re-arms every turn and spins).
477
+ observeProcessErrorConvergence();
478
+ consecutiveTimeouts = 0;
479
+ consecutiveStalls = 0;
480
+ consecutiveProcessErrorStalls = 0;
481
+ continue;
482
+ }
483
+ // Auto-execute effects in the host — models struggle with the babysitter tool protocol.
484
+ // Handle shell effects via child_process, all other non-breakpoint effects via delegation.
485
+ if (state.pendingActions.size > 0) {
486
+ let effectsResolved = 0;
487
+ for (const [effectId, action] of state.pendingActions) {
488
+ if (action.kind === 'breakpoint')
489
+ continue;
490
+ if (action.kind === 'shell') {
491
+ const shell = action.shell ?? action.taskDef?.shell;
492
+ if (!shell?.command)
493
+ continue;
494
+ writeVerbose(`[phaseOrchestration host] auto-executing shell effect ${effectId}: ${shell.command} ${(shell.args || []).slice(0, 2).join(' ')}`);
495
+ try {
496
+ const { execFileSync } = await Promise.resolve().then(() => __importStar(require('node:child_process')));
497
+ const stdout = execFileSync(shell.command, shell.args || [], {
498
+ cwd: args.workspace,
499
+ timeout: shell.timeout || 30_000,
500
+ encoding: 'utf8',
501
+ stdio: ['pipe', 'pipe', 'pipe'],
502
+ });
503
+ await invokeTool(taskPostTool, 'babysitter_task_post_result', {
504
+ effectId,
505
+ status: 'ok',
506
+ valueText: stdout,
507
+ });
508
+ effectsResolved++;
509
+ }
510
+ catch (err) {
511
+ const msg = err instanceof Error ? err.message : String(err);
512
+ writeVerbose(`[phaseOrchestration host] shell effect ${effectId} failed: ${msg}`);
513
+ await invokeTool(taskPostTool, 'babysitter_task_post_result', {
514
+ effectId,
515
+ status: 'error',
516
+ error: msg,
517
+ });
518
+ effectsResolved++;
519
+ recordDelegatedEffectFailure(effectId, msg);
520
+ }
521
+ }
522
+ else {
523
+ // Build the agent prompt exactly as the SDK effect resolver does so
524
+ // structured-output (outputSchema) instructions are included. Using
525
+ // the raw taskDef means object-shaped prompts ({role,task,...}) and
526
+ // declared output schemas are honored — not blindly JSON.stringified.
527
+ const taskDef = action.taskDef;
528
+ const prompt = taskDef
529
+ ? (0, planProcess_1.buildAgentPrompt)(taskDef)
530
+ : String(action.title ?? action.label ?? 'Execute this task');
531
+ writeVerbose(`[phaseOrchestration host] auto-delegating ${action.kind} effect ${effectId}: ${(action.title ?? action.label ?? '').slice(0, 80)}`);
532
+ try {
533
+ const delegated = await (0, planProcess_1.runDelegatedHarnessTask)({
534
+ task: prompt,
535
+ workspace: args.workspace,
536
+ model: args.model,
537
+ timeout: 180_000,
538
+ });
539
+ if (!delegated.success) {
540
+ writeVerbose(`[phaseOrchestration host] ${action.kind} effect ${effectId} returned failure`);
541
+ await invokeTool(taskPostTool, 'babysitter_task_post_result', {
542
+ effectId,
543
+ status: 'error',
544
+ error: delegated.output,
545
+ });
546
+ effectsResolved++;
547
+ recordDelegatedEffectFailure(effectId, delegated.output);
548
+ continue;
549
+ }
550
+ // Bug #936: propagate the AGENT'S RESULT (delegated.output), not the
551
+ // {success,output,harness} wrapper. Coerce against the task's declared
552
+ // outputSchema (mirrors resolveEffect's agent branch) so ctx.task()
553
+ // receives the real value the process expects (e.g. {markdown}).
554
+ const coerced = taskDef
555
+ ? (0, planProcess_1.coerceAgentResultValue)(taskDef, delegated.output)
556
+ : delegated.output;
557
+ await invokeTool(taskPostTool, 'babysitter_task_post_result', {
558
+ effectId,
559
+ status: 'ok',
560
+ valueJson: JSON.stringify(coerced),
561
+ });
562
+ effectsResolved++;
563
+ }
564
+ catch (err) {
565
+ const msg = err instanceof Error ? err.message : String(err);
566
+ writeVerbose(`[phaseOrchestration host] ${action.kind} effect ${effectId} failed: ${msg}`);
567
+ await invokeTool(taskPostTool, 'babysitter_task_post_result', {
568
+ effectId,
569
+ status: 'error',
570
+ error: msg,
571
+ });
572
+ effectsResolved++;
573
+ recordDelegatedEffectFailure(effectId, msg);
574
+ }
575
+ }
576
+ }
577
+ if (effectsResolved > 0) {
578
+ const totalPending = state.pendingActions.size;
579
+ writeVerbose(`[phaseOrchestration host] auto-resolved ${effectsResolved} effects (${totalPending} still pending)`);
580
+ consecutiveStalls = 0;
581
+ // If all effects resolved, auto-advance the run without prompting the model.
582
+ if (totalPending === 0) {
583
+ writeVerbose('[phaseOrchestration host] all effects auto-resolved — auto-advancing run');
584
+ await invokeTool(iterateTool, "babysitter_run_iterate");
585
+ if (ensureTerminalResult() !== null)
586
+ break;
587
+ consecutiveTimeouts = 0;
588
+ consecutiveProcessErrorStalls = 0;
589
+ }
590
+ continue;
591
+ }
592
+ }
593
+ const progressBeforeTurn = captureProgressSnapshot();
594
+ // Drain any mid-execution steering messages and prepend to prompt
595
+ const steeringContent = gentyCtx ? (0, gentySessionIntegration_1.drainSteeringMessages)(gentyCtx) : undefined;
596
+ // Emit extension turnStart event
597
+ if (gentyCtx) {
598
+ await gentyCtx.extensionRegistry.emit({
599
+ type: 'turnStart',
600
+ timestamp: new Date().toISOString(),
601
+ data: { iteration: state.iteration, runId: state.runId },
602
+ });
603
+ }
604
+ try {
605
+ let turnPrompt = (0, prompts_1.buildOrchestrationTurnPrompt)({
606
+ processPath: path.resolve(args.processPath),
607
+ userPrompt: args.prompt,
608
+ planningConversationSummary: args.planningConversationSummary,
609
+ maxIterations: args.maxIterations,
610
+ currentIteration: state.iteration,
611
+ runId: state.runId,
612
+ runDir: state.runDir,
613
+ lastStatus: state.lastIterationResult?.status,
614
+ lastError: state.lastIterationResult?.status === "process-error"
615
+ ? extractIterationError(state.lastIterationResult.error)
616
+ : undefined,
617
+ pendingEffects: describePendingActions(),
618
+ });
619
+ if (steeringContent) {
620
+ turnPrompt = `[Steering messages from user]\n${steeringContent}\n\n${turnPrompt}`;
621
+ }
622
+ await promptOrchestrationAgent(turnPrompt, `phaseOrchestration iteration ${state.iteration + 1}`);
623
+ }
624
+ catch (err) {
625
+ const isTimeoutFailure = err instanceof utils_1.BabysitterRuntimeError
626
+ && err.name === "OrchestrationAgentFailed"
627
+ && (err.message.includes("timed out") || err.message.includes("PiTimeoutError"));
628
+ if (!isTimeoutFailure) {
629
+ throw err;
630
+ }
631
+ consecutiveTimeouts += 1;
632
+ if (consecutiveTimeouts >= constants_1.MAX_CONSECUTIVE_TIMEOUTS) {
633
+ throw new utils_1.BabysitterRuntimeError("OrchestrationAgentTimedOut", `Pi prompt timed out ${consecutiveTimeouts} consecutive times — aborting orchestration.`, { category: utils_1.ErrorCategory.External });
634
+ }
635
+ continue;
636
+ }
637
+ // Emit extension turnEnd event
638
+ if (gentyCtx) {
639
+ await gentyCtx.extensionRegistry.emit({
640
+ type: 'turnEnd',
641
+ timestamp: new Date().toISOString(),
642
+ data: { iteration: state.iteration, runId: state.runId },
643
+ });
644
+ }
645
+ await cleanupUnexpectedRunSiblings();
646
+ if (ensureTerminalResult() !== null) {
647
+ break;
648
+ }
649
+ if (!orchestrationStateAdvanced(progressBeforeTurn)) {
650
+ await syncStateFromRunArtifacts();
651
+ }
652
+ if (orchestrationStateAdvanced(progressBeforeTurn)) {
653
+ consecutiveTimeouts = 0;
654
+ consecutiveStalls = 0;
655
+ consecutiveProcessErrorStalls = 0;
656
+ continue;
657
+ }
658
+ if (state.lastIterationResult?.status === "process-error") {
659
+ consecutiveProcessErrorStalls += 1;
660
+ if (consecutiveProcessErrorStalls >= constants_1.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS) {
661
+ throw new utils_1.BabysitterRuntimeError("OrchestrationAgentStalled", `The orchestration agent did not retry the run or repair the process after ${consecutiveProcessErrorStalls} consecutive recovery prompts.`, { category: utils_1.ErrorCategory.Runtime });
662
+ }
663
+ continue;
664
+ }
665
+ consecutiveStalls += 1;
666
+ if (consecutiveStalls >= constants_1.MAX_CONSECUTIVE_STALLS) {
667
+ throw new utils_1.BabysitterRuntimeError("OrchestrationAgentStalled", `The orchestration agent did not advance the run or resolve pending effects for ${consecutiveStalls} consecutive turns.`, { category: utils_1.ErrorCategory.Runtime });
668
+ }
669
+ }
670
+ if (state.lastIterationResult?.status === "completed" || state.lastIterationResult?.status === "failed") {
671
+ await recordRunSummary(state.lastIterationResult.status, state.lastIterationResult.status === "completed"
672
+ ? `Run ${state.runId} completed after ${state.iteration} iterations.`
673
+ : `Run ${state.runId} failed after ${state.iteration} iterations.`);
674
+ if (!state.finished) {
675
+ await invokeTool(finishTool, "babysitter_finish_orchestration", {
676
+ summary: state.lastIterationResult.status === "completed"
677
+ ? `Run ${state.runId} completed after ${state.iteration} iterations.`
678
+ : `Run ${state.runId} failed after ${state.iteration} iterations.`,
679
+ });
680
+ }
681
+ }
682
+ const terminalResult = ensureTerminalResult();
683
+ if (terminalResult !== null) {
684
+ return terminalResult;
685
+ }
686
+ await recordRunSummary("failed", `Max iterations (${args.maxIterations}) reached without completion.`);
687
+ return 1;
688
+ }
689
+ catch (error) {
690
+ await recordRunSummary("failed", error instanceof Error ? error.message : String(error));
691
+ writeVerboseData("phaseOrchestration error", error instanceof Error
692
+ ? {
693
+ name: error.name,
694
+ message: error.message,
695
+ stack: error.stack,
696
+ runId: state.runId,
697
+ runDir: state.runDir,
698
+ iteration: state.iteration,
699
+ pendingEffects: describePendingActions(),
700
+ lastIterationResult: state.lastIterationResult,
701
+ }
702
+ : error);
703
+ (0, utils_1.emitProgress)({
704
+ phase: "2",
705
+ status: "failed",
706
+ runId: state.runId,
707
+ runDir: state.runDir,
708
+ iteration: state.iteration,
709
+ error: error instanceof Error ? error.message : String(error),
710
+ }, args.json, args.verbose, args.outputMode);
711
+ return 1;
712
+ }
713
+ finally {
714
+ unsubscribe?.();
715
+ await Promise.allSettled(Array.from(activePiSessions).map((session) => shutdownPiSession(session)));
716
+ if (gentyCtx) {
717
+ await gentyCtx.extensionRegistry.emit({
718
+ type: 'sessionEnd',
719
+ timestamp: new Date().toISOString(),
720
+ data: { runId: state.runId },
721
+ });
722
+ await (0, gentySessionContext_1.destroyGentySessionContext)(gentyCtx).catch(() => { });
723
+ }
724
+ }
725
+ }
726
+ /**
727
+ * Resolve the runs directory for genty's internal (in-process) execution.
728
+ *
729
+ * Precedence (highest first):
730
+ * 1. An explicit runsDir passed by the caller (CLI --runs-dir).
731
+ * 2. The BABYSITTER_RUNS_DIR / BABYSITTER_RUNS_SCOPE env overrides, honored
732
+ * via the SDK's resolveRunsDir({ cwd }).
733
+ * 3. The WORKSPACE repo runs dir (<repoRoot>/.a5c/runs) — NOT the global
734
+ * ~/.a5c/runs. The SDK defaults to global scope when nothing is set, which
735
+ * means a plain `genty call` never materializes the workspace .a5c/runs/.
736
+ * Forcing the workspace dir here makes the internal path establish the run
737
+ * lifecycle where downstream tooling (and the live-stack verification)
738
+ * expects it. See #936 bug 2.
739
+ *
740
+ * The SDK is loaded lazily (sync require, only when this is actually called) to
741
+ * avoid eagerly pulling the heavy SDK + atlas index into the module graph, per
742
+ * the #936 default-provider lazy-load decision.
743
+ */
744
+ function resolveWorkspaceRunsDir(explicitRunsDir, workspace) {
745
+ if (explicitRunsDir) {
746
+ return explicitRunsDir;
747
+ }
748
+ const cwd = workspace ?? process.cwd();
749
+ // An explicit BABYSITTER_RUNS_DIR override is a deterministic, caller-intended
750
+ // location — honor it verbatim (this is how the live-stack BP path and users
751
+ // pin the runs dir). Do NOT defer to getRunsScope()==="repo": sdk.resolveRunsDir
752
+ // walks UP to the nearest repo root and falls back to the GLOBAL ~/.a5c/runs when
753
+ // `cwd` is not itself a repo root (e.g. genty invoked with an explicit --workspace
754
+ // that is a tmp/live-stack dir, or any non-repo-root workspace). That escaped the
755
+ // run — and its completion proof — out of <workspace>/.a5c/runs where the
756
+ // live-stack validator (and users) look, which was the residual #936 failure.
757
+ if (process.env.BABYSITTER_RUNS_DIR?.trim()) {
758
+ try {
759
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
760
+ const sdk = require("@a5c-ai/babysitter-sdk");
761
+ return sdk.resolveRunsDir({ cwd });
762
+ }
763
+ catch {
764
+ // SDK unavailable: fall through to the deterministic workspace anchor below.
765
+ }
766
+ }
767
+ // Default genty's internal execution to the runs dir directly under the
768
+ // workspace the CLI was invoked in — <workspace>/.a5c/runs — NOT the global
769
+ // ~/.a5c/runs. Deliberately do NOT use getRepoRunsDir here: it walks UP to the
770
+ // nearest .git/.a5c ancestor, which for a non-git-repo workspace nested under
771
+ // $HOME (e.g. a tmp live-stack workspace) would wrongly anchor on the global
772
+ // ~/.a5c. Anchoring on the workspace directly guarantees the nested run + its
773
+ // completion proof land where the validator (and users) look. See #936 bug 2.
774
+ return path.join(cwd, ".a5c", "runs");
775
+ }
776
+ function summarizeAgentText(text) {
777
+ const normalized = text.replace(/\s+/g, " ").trim();
778
+ if (!normalized) {
779
+ return "(no summary emitted)";
780
+ }
781
+ return normalized.length > 240 ? `${normalized.slice(0, 237)}...` : normalized;
782
+ }
783
+ function extractIterationError(error) {
784
+ return typeof error === "object" && error !== null && "message" in error
785
+ ? String(error.message)
786
+ : String(error);
787
+ }