@openclaw/lobster 2026.7.1-beta.2 → 2026.7.1-beta.4

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 (418) hide show
  1. package/dist/index.js +18 -23
  2. package/node_modules/@clawdbot/lobster/README.md +10 -0
  3. package/node_modules/@clawdbot/lobster/dist/src/cli.js +23 -7
  4. package/node_modules/@clawdbot/lobster/dist/src/cli.js.map +1 -1
  5. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/ask.js +28 -5
  6. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/ask.js.map +1 -1
  7. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/llm_invoke.js +20 -5
  8. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/llm_invoke.js.map +1 -1
  9. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/state.js +3 -3
  10. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/state.js.map +1 -1
  11. package/node_modules/@clawdbot/lobster/dist/src/core/cost_tracker.js +52 -6
  12. package/node_modules/@clawdbot/lobster/dist/src/core/cost_tracker.js.map +1 -1
  13. package/node_modules/@clawdbot/lobster/dist/src/core/retry.js +7 -3
  14. package/node_modules/@clawdbot/lobster/dist/src/core/retry.js.map +1 -1
  15. package/node_modules/@clawdbot/lobster/dist/src/core/tool_runtime.js +17 -8
  16. package/node_modules/@clawdbot/lobster/dist/src/core/tool_runtime.js.map +1 -1
  17. package/node_modules/@clawdbot/lobster/dist/src/input_request.js +430 -0
  18. package/node_modules/@clawdbot/lobster/dist/src/input_request.js.map +1 -0
  19. package/node_modules/@clawdbot/lobster/dist/src/pipeline_resume_state.js +50 -4
  20. package/node_modules/@clawdbot/lobster/dist/src/pipeline_resume_state.js.map +1 -1
  21. package/node_modules/@clawdbot/lobster/dist/src/runtime.js +160 -10
  22. package/node_modules/@clawdbot/lobster/dist/src/runtime.js.map +1 -1
  23. package/node_modules/@clawdbot/lobster/dist/src/sdk/Lobster.js +105 -12
  24. package/node_modules/@clawdbot/lobster/dist/src/sdk/Lobster.js.map +1 -1
  25. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/diff.js +7 -6
  26. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/diff.js.map +1 -1
  27. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/state.js +43 -2
  28. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/state.js.map +1 -1
  29. package/node_modules/@clawdbot/lobster/dist/src/sdk/runtime.js +82 -90
  30. package/node_modules/@clawdbot/lobster/dist/src/sdk/runtime.js.map +1 -1
  31. package/node_modules/@clawdbot/lobster/dist/src/state/store.js +166 -8
  32. package/node_modules/@clawdbot/lobster/dist/src/state/store.js.map +1 -1
  33. package/node_modules/@clawdbot/lobster/dist/src/workflows/file.js +216 -28
  34. package/node_modules/@clawdbot/lobster/dist/src/workflows/file.js.map +1 -1
  35. package/node_modules/@clawdbot/lobster/dist/test/approval_id.test.js +13 -0
  36. package/node_modules/@clawdbot/lobster/dist/test/approval_id.test.js.map +1 -1
  37. package/node_modules/@clawdbot/lobster/dist/test/cost_tracker.test.js +108 -3
  38. package/node_modules/@clawdbot/lobster/dist/test/cost_tracker.test.js.map +1 -1
  39. package/node_modules/@clawdbot/lobster/dist/test/for_each.test.js +17 -0
  40. package/node_modules/@clawdbot/lobster/dist/test/for_each.test.js.map +1 -1
  41. package/node_modules/@clawdbot/lobster/dist/test/llm_task_invoke.test.js +70 -1
  42. package/node_modules/@clawdbot/lobster/dist/test/llm_task_invoke.test.js.map +1 -1
  43. package/node_modules/@clawdbot/lobster/dist/test/parallel.test.js +13 -0
  44. package/node_modules/@clawdbot/lobster/dist/test/parallel.test.js.map +1 -1
  45. package/node_modules/@clawdbot/lobster/dist/test/request_input.test.js +946 -0
  46. package/node_modules/@clawdbot/lobster/dist/test/request_input.test.js.map +1 -0
  47. package/node_modules/@clawdbot/lobster/dist/test/sdk_lobster.test.js +118 -0
  48. package/node_modules/@clawdbot/lobster/dist/test/sdk_lobster.test.js.map +1 -1
  49. package/node_modules/@clawdbot/lobster/dist/test/state.test.js +268 -1
  50. package/node_modules/@clawdbot/lobster/dist/test/state.test.js.map +1 -1
  51. package/node_modules/@clawdbot/lobster/dist/test/step_retry.test.js +46 -2
  52. package/node_modules/@clawdbot/lobster/dist/test/step_retry.test.js.map +1 -1
  53. package/node_modules/@clawdbot/lobster/dist/test/workflow_file.test.js +503 -0
  54. package/node_modules/@clawdbot/lobster/dist/test/workflow_file.test.js.map +1 -1
  55. package/node_modules/@clawdbot/lobster/package.json +15 -9
  56. package/node_modules/typebox/build/compile/validator.d.mts +2 -7
  57. package/node_modules/typebox/build/compile/validator.mjs +6 -36
  58. package/node_modules/typebox/build/error/errors.d.mts +1 -7
  59. package/node_modules/typebox/build/format/_idna.mjs +36 -6
  60. package/node_modules/typebox/build/format/_puny.mjs +4 -1
  61. package/node_modules/typebox/build/format/uuid.d.mts +2 -2
  62. package/node_modules/typebox/build/format/uuid.mjs +3 -3
  63. package/node_modules/typebox/build/guard/emit.d.mts +0 -4
  64. package/node_modules/typebox/build/guard/emit.mjs +0 -8
  65. package/node_modules/typebox/build/guard/guard.d.mts +4 -8
  66. package/node_modules/typebox/build/guard/guard.mjs +5 -13
  67. package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  68. package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  69. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  70. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  71. package/node_modules/typebox/build/schema/engine/schema.mjs +5 -10
  72. package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  73. package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  74. package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  75. package/node_modules/typebox/build/schema/types/index.mjs +0 -1
  76. package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  77. package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  78. package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  79. package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  80. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  81. package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  82. package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  83. package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  84. package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  85. package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  86. package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  87. package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  88. package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  89. package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  90. package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  91. package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  92. package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  93. package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  94. package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  95. package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  96. package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  97. package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  98. package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  99. package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  100. package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  101. package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  102. package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  103. package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  104. package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  105. package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  106. package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  107. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  108. package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  109. package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  110. package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  111. package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  112. package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  113. package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  114. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  115. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  116. package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  117. package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  118. package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  119. package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  120. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  121. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  122. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  123. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  124. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  125. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  126. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  127. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  128. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  129. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  130. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  131. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  132. package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  133. package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  134. package/node_modules/typebox/build/type/action/index.d.mts +7 -4
  135. package/node_modules/typebox/build/type/action/index.mjs +7 -4
  136. package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  137. package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  138. package/node_modules/typebox/build/type/action/module.d.mts +8 -7
  139. package/node_modules/typebox/build/type/action/module.mjs +7 -6
  140. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  141. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
  142. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  143. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  144. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  145. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  146. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  147. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  148. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  149. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  150. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  151. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  152. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  153. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  154. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  155. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  156. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  157. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  158. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  159. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  160. package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  161. package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  162. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  163. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  164. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  165. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  166. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  167. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  168. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  169. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  170. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  171. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  172. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  173. package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  174. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  175. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  176. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  177. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  178. package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  179. package/node_modules/typebox/build/type/engine/index.mjs +2 -2
  180. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  181. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  182. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  183. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  184. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  185. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  186. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  187. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  188. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  189. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  190. package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  191. package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  192. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  193. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  194. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  195. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  196. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  197. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  198. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  199. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  200. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  201. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  202. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  203. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  204. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  205. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  206. package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  207. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  208. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  209. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  210. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  211. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  212. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  213. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  214. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  215. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  216. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  217. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  218. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  219. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  220. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  221. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  222. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  223. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  224. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  225. package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  226. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  227. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  228. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  229. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  230. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  231. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  232. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  233. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  234. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  235. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  236. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  237. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  238. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  239. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  240. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  241. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  242. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  243. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  244. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  245. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  246. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  247. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  248. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  249. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  250. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  251. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  252. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  253. package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  254. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  255. package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  256. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  257. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  258. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  259. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  260. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  261. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  262. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  263. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  264. package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
  265. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  266. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  267. package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  268. package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  269. package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  270. package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  271. package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  272. package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  273. package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  274. package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  275. package/node_modules/typebox/build/type/extends/object.mjs +25 -3
  276. package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  277. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  278. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  279. package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  280. package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  281. package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  282. package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  283. package/node_modules/typebox/build/type/extends/union.mjs +2 -2
  284. package/node_modules/typebox/build/type/script/mapping.d.mts +84 -99
  285. package/node_modules/typebox/build/type/script/mapping.mjs +81 -85
  286. package/node_modules/typebox/build/type/script/parser.d.mts +40 -40
  287. package/node_modules/typebox/build/type/script/parser.mjs +22 -22
  288. package/node_modules/typebox/build/type/script/script.d.mts +3 -4
  289. package/node_modules/typebox/build/type/script/script.mjs +3 -2
  290. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  291. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  292. package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  293. package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  294. package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  295. package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  296. package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  297. package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  298. package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  299. package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  300. package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  301. package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  302. package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  303. package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  304. package/node_modules/typebox/build/type/types/call.d.mts +3 -3
  305. package/node_modules/typebox/build/type/types/call.mjs +3 -2
  306. package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  307. package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  308. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  309. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  310. package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  311. package/node_modules/typebox/build/type/types/enum.mjs +5 -0
  312. package/node_modules/typebox/build/type/types/index.d.mts +1 -4
  313. package/node_modules/typebox/build/type/types/index.mjs +1 -4
  314. package/node_modules/typebox/build/type/types/number.d.mts +1 -1
  315. package/node_modules/typebox/build/type/types/number.mjs +1 -1
  316. package/node_modules/typebox/build/type/types/record.d.mts +13 -7
  317. package/node_modules/typebox/build/type/types/record.mjs +15 -9
  318. package/node_modules/typebox/build/type/types/static.d.mts +2 -5
  319. package/node_modules/typebox/build/typebox.d.mts +4 -8
  320. package/node_modules/typebox/build/typebox.mjs +4 -8
  321. package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  322. package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  323. package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  324. package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  325. package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  326. package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  327. package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  328. package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  329. package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  330. package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  331. package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  332. package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  333. package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  334. package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  335. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  336. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  337. package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  338. package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  339. package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  340. package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  341. package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  342. package/node_modules/typebox/build/value/index.d.mts +0 -1
  343. package/node_modules/typebox/build/value/index.mjs +0 -1
  344. package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  345. package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  346. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  347. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  348. package/node_modules/typebox/build/value/value.d.mts +0 -1
  349. package/node_modules/typebox/build/value/value.mjs +0 -1
  350. package/node_modules/typebox/package.json +25 -25
  351. package/node_modules/typebox/readme.md +97 -80
  352. package/npm-shrinkwrap.json +12 -12
  353. package/package.json +6 -6
  354. package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  355. package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  356. package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  357. package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  358. package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  359. package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  360. package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  361. package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  362. package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  363. package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  364. package/node_modules/typebox/build/type/action/options.d.mts +0 -11
  365. package/node_modules/typebox/build/type/action/options.mjs +0 -11
  366. package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  367. package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  368. package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  369. package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  370. package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  371. package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  372. package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  373. package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  374. package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  375. package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  376. package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  377. package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  378. package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  379. package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  380. package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  381. package/node_modules/typebox/build/type/types/base.d.mts +0 -50
  382. package/node_modules/typebox/build/type/types/base.mjs +0 -84
  383. package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  384. package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  385. package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  386. package/node_modules/typebox/build/type/types/promise.mjs +0 -29
  387. package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  388. package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  389. package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  390. package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  391. package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  392. package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  393. package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  394. package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  395. package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  396. package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  397. package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  398. package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  399. package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  400. package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  401. package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  402. package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  403. package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  404. package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  405. package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  406. package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  407. package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  408. package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  409. package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  410. package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  411. package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  412. package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  413. package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  414. package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  415. package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  416. package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  417. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  418. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
@@ -13,12 +13,25 @@ import { resolveInlineShellCommand } from "../shell.js";
13
13
  import { compileCached } from "../validation.js";
14
14
  import { CostTracker } from "../core/cost_tracker.js";
15
15
  import { withRetry, resolveRetryConfig } from "../core/retry.js";
16
+ import { RequestInputResumeError, validateCommandInputState, } from "../input_request.js";
16
17
  export class WorkflowResumeArgumentError extends Error {
17
18
  constructor(message) {
18
19
  super(message);
19
20
  this.name = "WorkflowResumeArgumentError";
20
21
  }
21
22
  }
23
+ class WorkflowPipelineInputSuspension extends Error {
24
+ stepId;
25
+ request;
26
+ pipelineInput;
27
+ constructor({ stepId, request, pipelineInput, }) {
28
+ super(`Workflow step ${stepId} pipeline requested input`);
29
+ this.name = "WorkflowPipelineInputSuspension";
30
+ this.stepId = stepId;
31
+ this.request = request;
32
+ this.pipelineInput = pipelineInput;
33
+ }
34
+ }
22
35
  export async function loadWorkflowFile(filePath) {
23
36
  const text = await fsp.readFile(filePath, "utf8");
24
37
  const ext = path.extname(filePath).toLowerCase();
@@ -412,6 +425,7 @@ export async function runWorkflowFile({ filePath, args, ctx, resume, approved, r
412
425
  previous.approvedBy = approvedBy;
413
426
  results[resumeState.approvalStepId] = previous;
414
427
  }
428
+ let resumedPipelineInput = null;
415
429
  if (resumeState?.inputStepId) {
416
430
  if (approved !== undefined) {
417
431
  throw new WorkflowResumeArgumentError("Workflow resume requires --response-json for input requests");
@@ -419,30 +433,65 @@ export async function runWorkflowFile({ filePath, args, ctx, resume, approved, r
419
433
  if (response === undefined) {
420
434
  throw new WorkflowResumeArgumentError("Workflow resume requires --response-json for input requests");
421
435
  }
422
- const inputStep = steps[stepIndexById.get(resumeState.inputStepId) ?? -1];
423
- if (!inputStep || !isInputStep(inputStep.input)) {
424
- throw new Error(`Invalid input step in resume state: ${resumeState.inputStepId}`);
425
- }
426
- try {
427
- validateInputResponse({
428
- schema: resumeState.inputSchema ?? inputStep.input.responseSchema,
436
+ if (resumeState.inputKind === "pipeline_command") {
437
+ const resumedStepIndex = stepIndexById.get(resumeState.inputStepId);
438
+ if (resumedStepIndex !== startIndex) {
439
+ throw new RequestInputResumeError("workflow input step changed since input request");
440
+ }
441
+ const pipelineStep = steps[resumedStepIndex];
442
+ if (!pipelineStep || typeof pipelineStep.pipeline !== "string") {
443
+ throw new Error(`Invalid pipeline input step in resume state: ${resumeState.inputStepId}`);
444
+ }
445
+ if (!evaluateCondition(pipelineStep.when ?? pipelineStep.condition, results)) {
446
+ throw new RequestInputResumeError("workflow input step condition changed since input request");
447
+ }
448
+ try {
449
+ validateInputResponse({
450
+ schema: resumeState.inputSchema,
451
+ response,
452
+ stepId: pipelineStep.id,
453
+ });
454
+ }
455
+ catch (err) {
456
+ throw new WorkflowResumeArgumentError(err?.message ?? String(err));
457
+ }
458
+ resumedPipelineInput = {
459
+ stepId: resumeState.inputStepId,
429
460
  response,
430
- stepId: inputStep.id,
431
- });
461
+ pipelineInput: resumeState.pipelineInput,
462
+ onConsumed: consumedResumeStateKey
463
+ ? async () => {
464
+ await deleteStateJson({ env: ctx.env, key: consumedResumeStateKey });
465
+ }
466
+ : undefined,
467
+ };
432
468
  }
433
- catch (err) {
434
- throw new WorkflowResumeArgumentError(err?.message ?? String(err));
469
+ else {
470
+ const inputStep = steps[stepIndexById.get(resumeState.inputStepId) ?? -1];
471
+ if (!inputStep || !isInputStep(inputStep.input)) {
472
+ throw new Error(`Invalid input step in resume state: ${resumeState.inputStepId}`);
473
+ }
474
+ try {
475
+ validateInputResponse({
476
+ schema: resumeState.inputSchema ?? inputStep.input.responseSchema,
477
+ response,
478
+ stepId: inputStep.id,
479
+ });
480
+ }
481
+ catch (err) {
482
+ throw new WorkflowResumeArgumentError(err?.message ?? String(err));
483
+ }
484
+ const previous = results[resumeState.inputStepId] ?? { id: resumeState.inputStepId };
485
+ previous.subject = resumeState.inputSubject ?? null;
486
+ previous.response = response;
487
+ delete previous.skipped;
488
+ results[resumeState.inputStepId] = previous;
435
489
  }
436
- const previous = results[resumeState.inputStepId] ?? { id: resumeState.inputStepId };
437
- previous.subject = resumeState.inputSubject ?? null;
438
- previous.response = response;
439
- delete previous.skipped;
440
- results[resumeState.inputStepId] = previous;
441
490
  }
442
491
  if (ctx.dryRun) {
443
492
  return dryRunWorkflow({ steps, resolvedArgs, results, startIndex, ctx });
444
493
  }
445
- const costTracker = new CostTracker(CostTracker.parsePricingFromEnv(ctx.env));
494
+ const costTracker = new CostTracker(CostTracker.parsePricingFromEnv(ctx.env, ctx.stderr), ctx.stderr);
446
495
  let lastStepId = resumeState?.inputStepId ?? findLastCompletedStepId(steps, results);
447
496
  for (let idx = startIndex; idx < steps.length; idx++) {
448
497
  const step = steps[idx];
@@ -577,6 +626,7 @@ export async function runWorkflowFile({ filePath, args, ctx, resume, approved, r
577
626
  ctx,
578
627
  env: subEnv,
579
628
  cwd: subCwd,
629
+ requestInputEnabled: false,
580
630
  });
581
631
  }
582
632
  else {
@@ -677,6 +727,7 @@ export async function runWorkflowFile({ filePath, args, ctx, resume, approved, r
677
727
  ctx: { ...ctx, signal: branchSignal },
678
728
  env: branchEnv,
679
729
  cwd: branchCwd,
730
+ requestInputEnabled: false,
680
731
  });
681
732
  return { branchId: branch.id, result: branchResult };
682
733
  }
@@ -799,6 +850,13 @@ export async function runWorkflowFile({ filePath, args, ctx, resume, approved, r
799
850
  ctx: { ...ctx, signal: stepSignal },
800
851
  env,
801
852
  cwd,
853
+ resume: resumedPipelineInput?.stepId === step.id
854
+ ? {
855
+ pipelineInput: resumedPipelineInput.pipelineInput,
856
+ response: resumedPipelineInput.response,
857
+ onConsumed: resumedPipelineInput.onConsumed,
858
+ }
859
+ : undefined,
802
860
  });
803
861
  }
804
862
  else {
@@ -819,6 +877,10 @@ export async function runWorkflowFile({ filePath, args, ctx, resume, approved, r
819
877
  ? await withRetry(executeStepAttempt, retryConfig, {
820
878
  signal: ctx.signal,
821
879
  shouldRetry: (error) => {
880
+ if (error instanceof WorkflowPipelineInputSuspension ||
881
+ error instanceof RequestInputResumeError) {
882
+ return false;
883
+ }
822
884
  const message = error?.message ?? String(error);
823
885
  return !/halted (for approval inside|before completion at) pipeline/.test(message);
824
886
  },
@@ -831,6 +893,48 @@ export async function runWorkflowFile({ filePath, args, ctx, resume, approved, r
831
893
  parallelBranchResults = attemptResult.parallelBranchResults;
832
894
  }
833
895
  catch (err) {
896
+ if (err instanceof WorkflowPipelineInputSuspension) {
897
+ const inputRequest = buildNeedsInputRequest({
898
+ stepId: err.stepId,
899
+ prompt: err.request.prompt,
900
+ responseSchema: err.request.responseSchema,
901
+ defaults: err.request.defaults,
902
+ subject: err.request.subject,
903
+ maxEnvelopeBytes: resolveToolEnvelopeMaxBytes(ctx.env),
904
+ });
905
+ const stateKey = await saveWorkflowResumeState(ctx.env, {
906
+ filePath: resolvedFilePath,
907
+ resumeAtIndex: idx,
908
+ steps: results,
909
+ args: resolvedArgs,
910
+ inputStepId: err.stepId,
911
+ inputKind: "pipeline_command",
912
+ inputSchema: err.request.responseSchema,
913
+ inputSubject: err.request.subject,
914
+ pipelineInput: err.pipelineInput,
915
+ createdAt: new Date().toISOString(),
916
+ });
917
+ if (consumedResumeStateKey && consumedResumeStateKey !== stateKey) {
918
+ await deleteStateJson({ env: ctx.env, key: consumedResumeStateKey });
919
+ }
920
+ const resumeToken = encodeToken({
921
+ protocolVersion: 1,
922
+ v: 1,
923
+ kind: "workflow-file",
924
+ stateKey,
925
+ });
926
+ return {
927
+ status: "needs_input",
928
+ output: [],
929
+ requiresInput: {
930
+ ...inputRequest,
931
+ resumeToken,
932
+ },
933
+ };
934
+ }
935
+ if (err instanceof RequestInputResumeError) {
936
+ throw err;
937
+ }
834
938
  if (ctx.signal?.aborted && (err?.name === "AbortError" || err?.code === "ABORT_ERR")) {
835
939
  throw err;
836
940
  }
@@ -908,7 +1012,7 @@ export async function runWorkflowFile({ filePath, args, ctx, resume, approved, r
908
1012
  requiresApproval: {
909
1013
  ...approval,
910
1014
  resumeToken,
911
- approvalId,
1015
+ ...(approvalId ? { approvalId } : null),
912
1016
  },
913
1017
  };
914
1018
  }
@@ -1264,8 +1368,55 @@ async function loadWorkflowResumeState(env, stateKey) {
1264
1368
  throw new Error("Invalid workflow resume state");
1265
1369
  if (!data.args || typeof data.args !== "object")
1266
1370
  throw new Error("Invalid workflow resume state");
1371
+ if (data.inputKind !== undefined &&
1372
+ !["workflow_step", "pipeline_command"].includes(data.inputKind)) {
1373
+ throw new Error("Invalid workflow resume state");
1374
+ }
1375
+ if (data.inputKind === "pipeline_command") {
1376
+ if (typeof data.inputStepId !== "string")
1377
+ throw new Error("Invalid workflow resume state");
1378
+ if (data.inputSchema === undefined)
1379
+ throw new Error("Invalid workflow resume state");
1380
+ data.pipelineInput = validateWorkflowPipelineInputResumeState(data.pipelineInput);
1381
+ }
1382
+ else if (data.pipelineInput !== undefined) {
1383
+ throw new Error("Invalid workflow resume state");
1384
+ }
1267
1385
  return data;
1268
1386
  }
1387
+ function validateWorkflowPipelineInputResumeState(value) {
1388
+ if (!value || typeof value !== "object")
1389
+ throw new Error("Invalid workflow resume state");
1390
+ const data = value;
1391
+ if (!Array.isArray(data.pipeline))
1392
+ throw new Error("Invalid workflow resume state");
1393
+ validateWorkflowPipelineShape(data.pipeline);
1394
+ if (typeof data.resumeAtIndex !== "number" ||
1395
+ !Number.isInteger(data.resumeAtIndex) ||
1396
+ data.resumeAtIndex < 0 ||
1397
+ data.resumeAtIndex >= data.pipeline.length) {
1398
+ throw new Error("Invalid workflow resume state");
1399
+ }
1400
+ if (!Array.isArray(data.items))
1401
+ throw new Error("Invalid workflow resume state");
1402
+ data.commandInput = validateCommandInputState(data.commandInput);
1403
+ return data;
1404
+ }
1405
+ function validateWorkflowPipelineShape(pipeline) {
1406
+ for (const stage of pipeline) {
1407
+ if (!stage || typeof stage !== "object")
1408
+ throw new Error("Invalid workflow resume state");
1409
+ const data = stage;
1410
+ if (typeof data.name !== "string" || data.name.length === 0) {
1411
+ throw new Error("Invalid workflow resume state");
1412
+ }
1413
+ if (!data.args || typeof data.args !== "object" || Array.isArray(data.args)) {
1414
+ throw new Error("Invalid workflow resume state");
1415
+ }
1416
+ if (typeof data.raw !== "string")
1417
+ throw new Error("Invalid workflow resume state");
1418
+ }
1419
+ }
1269
1420
  function mergeEnv(base, workflowEnv, stepEnv, args, results) {
1270
1421
  const env = { ...base };
1271
1422
  // Expose resolved args as env vars so shell commands can safely reference them
@@ -2040,12 +2191,23 @@ function getStepExecution(step) {
2040
2191
  }
2041
2192
  return { kind: "none" };
2042
2193
  }
2043
- async function runPipelineStep({ stepId, pipelineText, inputValue, ctx, env, cwd, }) {
2194
+ async function runPipelineStep({ stepId, pipelineText, inputValue, ctx, env, cwd, resume, requestInputEnabled = true, }) {
2044
2195
  let pipeline;
2045
2196
  try {
2046
- pipeline = parsePipeline(pipelineText);
2197
+ const currentPipeline = parsePipeline(pipelineText);
2198
+ if (resume) {
2199
+ if (!isDeepStrictEqual(currentPipeline, resume.pipelineInput.pipeline)) {
2200
+ throw new RequestInputResumeError("workflow pipeline changed since input request");
2201
+ }
2202
+ pipeline = resume.pipelineInput.pipeline;
2203
+ }
2204
+ else {
2205
+ pipeline = currentPipeline;
2206
+ }
2047
2207
  }
2048
2208
  catch (err) {
2209
+ if (err instanceof RequestInputResumeError)
2210
+ throw err;
2049
2211
  throw new Error(`Workflow step ${stepId} pipeline parse failed: ${err?.message ?? String(err)}`);
2050
2212
  }
2051
2213
  const stdout = new PassThrough();
@@ -2054,8 +2216,10 @@ async function runPipelineStep({ stepId, pipelineText, inputValue, ctx, env, cwd
2054
2216
  stdout.on("data", (chunk) => {
2055
2217
  renderedStdout += String(chunk);
2056
2218
  });
2219
+ const pipelineStartIndex = resume ? resume.pipelineInput.resumeAtIndex : 0;
2220
+ const remainingPipeline = pipeline.slice(pipelineStartIndex);
2057
2221
  const result = await runPipeline({
2058
- pipeline,
2222
+ pipeline: remainingPipeline,
2059
2223
  registry: ctx.registry,
2060
2224
  stdin: ctx.stdin,
2061
2225
  stdout,
@@ -2065,7 +2229,15 @@ async function runPipelineStep({ stepId, pipelineText, inputValue, ctx, env, cwd
2065
2229
  cwd,
2066
2230
  signal: ctx.signal,
2067
2231
  llmAdapters: ctx.llmAdapters,
2068
- input: inputValueToStream(inputValue),
2232
+ input: resume ? resume.pipelineInput.items : inputValueToPipelineItems(inputValue),
2233
+ requestInputEnabled,
2234
+ requestInputResume: resume
2235
+ ? {
2236
+ state: resume.pipelineInput.commandInput,
2237
+ response: resume.response,
2238
+ onConsumed: resume.onConsumed,
2239
+ }
2240
+ : undefined,
2069
2241
  });
2070
2242
  stdout.end();
2071
2243
  if (result.halted) {
@@ -2073,6 +2245,26 @@ async function runPipelineStep({ stepId, pipelineText, inputValue, ctx, env, cwd
2073
2245
  if (result.items.length === 1 && result.items[0]?.type === "approval_request") {
2074
2246
  throw new Error(`Workflow step ${stepId} halted for approval inside pipeline stage ${haltedName}. Use a separate approval step in the workflow file.`);
2075
2247
  }
2248
+ const request = result.items.length === 1 && result.items[0]?.type === "input_request"
2249
+ ? result.items[0]
2250
+ : null;
2251
+ if (request?.commandInput) {
2252
+ throw new WorkflowPipelineInputSuspension({
2253
+ stepId,
2254
+ request: {
2255
+ prompt: String(request.prompt),
2256
+ responseSchema: request.responseSchema,
2257
+ ...(request.defaults !== undefined ? { defaults: request.defaults } : null),
2258
+ ...(request.subject !== undefined ? { subject: request.subject } : null),
2259
+ },
2260
+ pipelineInput: {
2261
+ pipeline,
2262
+ resumeAtIndex: pipelineStartIndex + (result.haltedAt?.index ?? 0),
2263
+ items: Array.isArray(request.items) ? request.items : [],
2264
+ commandInput: request.commandInput,
2265
+ },
2266
+ });
2267
+ }
2076
2268
  throw new Error(`Workflow step ${stepId} halted before completion at pipeline stage ${haltedName}`);
2077
2269
  }
2078
2270
  const normalizedStdout = renderedStdout || serializePipelineItemsToStdout(result.items);
@@ -2142,12 +2334,8 @@ function* inputValueToItems(value) {
2142
2334
  }
2143
2335
  yield value;
2144
2336
  }
2145
- function inputValueToStream(value) {
2146
- return (async function* () {
2147
- for (const item of inputValueToItems(value)) {
2148
- yield item;
2149
- }
2150
- })();
2337
+ function inputValueToPipelineItems(value) {
2338
+ return [...inputValueToItems(value)];
2151
2339
  }
2152
2340
  function serializePipelineItemsToStdout(items) {
2153
2341
  if (!items.length)