@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.
- package/dist/index.js +18 -23
- package/node_modules/@clawdbot/lobster/README.md +10 -0
- package/node_modules/@clawdbot/lobster/dist/src/cli.js +23 -7
- package/node_modules/@clawdbot/lobster/dist/src/cli.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/ask.js +28 -5
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/ask.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/llm_invoke.js +20 -5
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/llm_invoke.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/state.js +3 -3
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/state.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/core/cost_tracker.js +52 -6
- package/node_modules/@clawdbot/lobster/dist/src/core/cost_tracker.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/core/retry.js +7 -3
- package/node_modules/@clawdbot/lobster/dist/src/core/retry.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/core/tool_runtime.js +17 -8
- package/node_modules/@clawdbot/lobster/dist/src/core/tool_runtime.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/input_request.js +430 -0
- package/node_modules/@clawdbot/lobster/dist/src/input_request.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/src/pipeline_resume_state.js +50 -4
- package/node_modules/@clawdbot/lobster/dist/src/pipeline_resume_state.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/runtime.js +160 -10
- package/node_modules/@clawdbot/lobster/dist/src/runtime.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/Lobster.js +105 -12
- package/node_modules/@clawdbot/lobster/dist/src/sdk/Lobster.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/diff.js +7 -6
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/diff.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/state.js +43 -2
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/state.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/runtime.js +82 -90
- package/node_modules/@clawdbot/lobster/dist/src/sdk/runtime.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/state/store.js +166 -8
- package/node_modules/@clawdbot/lobster/dist/src/state/store.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/workflows/file.js +216 -28
- package/node_modules/@clawdbot/lobster/dist/src/workflows/file.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/approval_id.test.js +13 -0
- package/node_modules/@clawdbot/lobster/dist/test/approval_id.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/cost_tracker.test.js +108 -3
- package/node_modules/@clawdbot/lobster/dist/test/cost_tracker.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/for_each.test.js +17 -0
- package/node_modules/@clawdbot/lobster/dist/test/for_each.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/llm_task_invoke.test.js +70 -1
- package/node_modules/@clawdbot/lobster/dist/test/llm_task_invoke.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/parallel.test.js +13 -0
- package/node_modules/@clawdbot/lobster/dist/test/parallel.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/request_input.test.js +946 -0
- package/node_modules/@clawdbot/lobster/dist/test/request_input.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/sdk_lobster.test.js +118 -0
- package/node_modules/@clawdbot/lobster/dist/test/sdk_lobster.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/state.test.js +268 -1
- package/node_modules/@clawdbot/lobster/dist/test/state.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/step_retry.test.js +46 -2
- package/node_modules/@clawdbot/lobster/dist/test/step_retry.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/workflow_file.test.js +503 -0
- package/node_modules/@clawdbot/lobster/dist/test/workflow_file.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/package.json +15 -9
- package/node_modules/typebox/build/compile/validator.d.mts +2 -7
- package/node_modules/typebox/build/compile/validator.mjs +6 -36
- package/node_modules/typebox/build/error/errors.d.mts +1 -7
- package/node_modules/typebox/build/format/_idna.mjs +36 -6
- package/node_modules/typebox/build/format/_puny.mjs +4 -1
- package/node_modules/typebox/build/format/uuid.d.mts +2 -2
- package/node_modules/typebox/build/format/uuid.mjs +3 -3
- package/node_modules/typebox/build/guard/emit.d.mts +0 -4
- package/node_modules/typebox/build/guard/emit.mjs +0 -8
- package/node_modules/typebox/build/guard/guard.d.mts +4 -8
- package/node_modules/typebox/build/guard/guard.mjs +5 -13
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
- package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
- package/node_modules/typebox/build/schema/engine/schema.mjs +5 -10
- package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
- package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/types/index.mjs +0 -1
- package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
- package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
- package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
- package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
- package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
- package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
- package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
- package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
- package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
- package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
- package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
- package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
- package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
- package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
- package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
- package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
- package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
- package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
- package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
- package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
- package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
- package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
- package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
- package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
- package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
- package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
- package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
- package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
- package/node_modules/typebox/build/type/action/index.d.mts +7 -4
- package/node_modules/typebox/build/type/action/index.mjs +7 -4
- package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
- package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
- package/node_modules/typebox/build/type/action/module.d.mts +8 -7
- package/node_modules/typebox/build/type/action/module.mjs +7 -6
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
- package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
- package/node_modules/typebox/build/type/action/with.d.mts +11 -0
- package/node_modules/typebox/build/type/action/with.mjs +11 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
- package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
- package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
- package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
- package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
- package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
- package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
- package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
- package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
- package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/index.mjs +2 -2
- package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
- package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
- package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
- package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
- package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
- package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
- package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
- package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
- package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
- package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
- package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
- package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
- package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
- package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
- package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
- package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
- package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
- package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
- package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
- package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
- package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
- package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
- package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
- package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
- package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
- package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
- package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
- package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
- package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
- package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
- package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
- package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
- package/node_modules/typebox/build/type/extends/object.mjs +25 -3
- package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
- package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
- package/node_modules/typebox/build/type/extends/record.mjs +23 -0
- package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
- package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
- package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
- package/node_modules/typebox/build/type/extends/union.mjs +2 -2
- package/node_modules/typebox/build/type/script/mapping.d.mts +84 -99
- package/node_modules/typebox/build/type/script/mapping.mjs +81 -85
- package/node_modules/typebox/build/type/script/parser.d.mts +40 -40
- package/node_modules/typebox/build/type/script/parser.mjs +22 -22
- package/node_modules/typebox/build/type/script/script.d.mts +3 -4
- package/node_modules/typebox/build/type/script/script.mjs +3 -2
- package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
- package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
- package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
- package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
- package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
- package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
- package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
- package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
- package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
- package/node_modules/typebox/build/type/types/call.d.mts +3 -3
- package/node_modules/typebox/build/type/types/call.mjs +3 -2
- package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
- package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
- package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
- package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
- package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
- package/node_modules/typebox/build/type/types/enum.mjs +5 -0
- package/node_modules/typebox/build/type/types/index.d.mts +1 -4
- package/node_modules/typebox/build/type/types/index.mjs +1 -4
- package/node_modules/typebox/build/type/types/number.d.mts +1 -1
- package/node_modules/typebox/build/type/types/number.mjs +1 -1
- package/node_modules/typebox/build/type/types/record.d.mts +13 -7
- package/node_modules/typebox/build/type/types/record.mjs +15 -9
- package/node_modules/typebox/build/type/types/static.d.mts +2 -5
- package/node_modules/typebox/build/typebox.d.mts +4 -8
- package/node_modules/typebox/build/typebox.mjs +4 -8
- package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
- package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
- package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
- package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
- package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
- package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
- package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
- package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
- package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
- package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
- package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
- package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
- package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
- package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
- package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
- package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
- package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
- package/node_modules/typebox/build/value/index.d.mts +0 -1
- package/node_modules/typebox/build/value/index.mjs +0 -1
- package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
- package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
- package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
- package/node_modules/typebox/build/value/value.d.mts +0 -1
- package/node_modules/typebox/build/value/value.mjs +0 -1
- package/node_modules/typebox/package.json +25 -25
- package/node_modules/typebox/readme.md +97 -80
- package/npm-shrinkwrap.json +12 -12
- package/package.json +6 -6
- package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
- package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
- package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
- package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
- package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
- package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
- package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
- package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
- package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
- package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
- package/node_modules/typebox/build/type/action/options.d.mts +0 -11
- package/node_modules/typebox/build/type/action/options.mjs +0 -11
- package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
- package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
- package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
- package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
- package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
- package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
- package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
- package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
- package/node_modules/typebox/build/type/types/base.d.mts +0 -50
- package/node_modules/typebox/build/type/types/base.mjs +0 -84
- package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
- package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
- package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
- package/node_modules/typebox/build/type/types/promise.mjs +0 -29
- package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
- package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
- package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
- package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
- package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
- package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
- package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
- package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
- package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
- package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
- package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
- package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
- package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
- package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
- package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
- /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
- /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
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
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
|
-
|
|
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
|
-
|
|
434
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
|
2146
|
-
return (
|
|
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)
|