@openclaw/lobster 2026.9.4 → 2026.9.5
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/assets/activity.svg +4 -0
- package/assets/icon.png +0 -0
- package/dist/index.js +39 -10
- package/node_modules/@clawdbot/lobster/README.md +112 -1
- package/node_modules/@clawdbot/lobster/bin/clawd.invoke.js +13 -7
- package/node_modules/@clawdbot/lobster/bin/lobster.js +7 -7
- package/node_modules/@clawdbot/lobster/bin/openclaw.invoke.js +16 -10
- package/node_modules/@clawdbot/lobster/dist/src/abortable_process.js +297 -0
- package/node_modules/@clawdbot/lobster/dist/src/abortable_process.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/src/cli.js +96 -248
- package/node_modules/@clawdbot/lobster/dist/src/cli.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/commands_list.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/registry.js +2 -0
- package/node_modules/@clawdbot/lobster/dist/src/commands/registry.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/approve.js +2 -0
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/approve.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/ask.js +3 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/ask.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/dedupe.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/diff_last.js +6 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/diff_last.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/email_triage.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/exec.js +30 -34
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/exec.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/gog_gmail_search.js +12 -25
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/gog_gmail_search.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/gog_gmail_send.js +19 -25
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/gog_gmail_send.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/group_by.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/head.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/json.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/llm_invoke.js +596 -42
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/llm_invoke.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/map.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/openclaw_agent.js +139 -0
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/openclaw_agent.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/openclaw_invoke.js +20 -2
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/openclaw_invoke.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/pick.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/sort.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/state.js +48 -20
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/state.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/table.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/template.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/where.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/workflows/workflows_list.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/commands/workflows/workflows_run.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/core/cost_tracker.js +45 -3
- package/node_modules/@clawdbot/lobster/dist/src/core/cost_tracker.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/core/filters.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/core/retry.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/core/tool_runtime.js +147 -21
- package/node_modules/@clawdbot/lobster/dist/src/core/tool_runtime.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/input_request.js +4 -2
- package/node_modules/@clawdbot/lobster/dist/src/input_request.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/parser.js +4 -3
- package/node_modules/@clawdbot/lobster/dist/src/parser.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/pipeline_resume_state.js +241 -74
- package/node_modules/@clawdbot/lobster/dist/src/pipeline_resume_state.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/read_line.js +52 -7
- package/node_modules/@clawdbot/lobster/dist/src/read_line.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/read_response_text.js +86 -0
- package/node_modules/@clawdbot/lobster/dist/src/read_response_text.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/src/recipes/github/pr-monitor.js +4 -2
- package/node_modules/@clawdbot/lobster/dist/src/recipes/github/pr-monitor.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/recipes/github/stages/pr-view.js +20 -34
- package/node_modules/@clawdbot/lobster/dist/src/recipes/github/stages/pr-view.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/recipes/registry.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/renderers/json.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/resume.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/runtime.js +187 -17
- package/node_modules/@clawdbot/lobster/dist/src/runtime.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/Lobster.js +10 -2
- package/node_modules/@clawdbot/lobster/dist/src/sdk/Lobster.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/approve.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/diff.js +13 -82
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/diff.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/exec.js +22 -32
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/exec.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/state.js +9 -101
- package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/state.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/runtime.js +2 -1
- package/node_modules/@clawdbot/lobster/dist/src/sdk/runtime.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/shell.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/state/store.js +619 -19
- package/node_modules/@clawdbot/lobster/dist/src/state/store.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/token.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/validation.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/workflows/file.js +963 -283
- package/node_modules/@clawdbot/lobster/dist/src/workflows/file.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/workflows/github_pr_monitor.js +27 -28
- package/node_modules/@clawdbot/lobster/dist/src/workflows/github_pr_monitor.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/workflows/graph.js +9 -2
- package/node_modules/@clawdbot/lobster/dist/src/workflows/graph.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/src/workflows/registry.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/approval_id.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/approve_preview.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/bin_smoke.test.js +25 -0
- package/node_modules/@clawdbot/lobster/dist/test/bin_smoke.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/cancellation.test.js +5170 -0
- package/node_modules/@clawdbot/lobster/dist/test/cancellation.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/clawd_invoke.test.js +22 -0
- package/node_modules/@clawdbot/lobster/dist/test/clawd_invoke.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/clawd_invoke_legacy.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/cli_run_file_args_json.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/commands_list.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/condition_comparison.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/core_tool_runtime.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/cost_tracker.test.js +1733 -1
- package/node_modules/@clawdbot/lobster/dist/test/cost_tracker.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/dedupe.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/diff_last.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/doctor.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/dry_run.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/email_triage.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/exec_stdin.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/for_each.test.js +254 -0
- package/node_modules/@clawdbot/lobster/dist/test/for_each.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/github_pr_notify_format.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/github_pr_summary.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/github_pr_view.test.js +176 -0
- package/node_modules/@clawdbot/lobster/dist/test/github_pr_view.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/gog_gmail_send.test.js +100 -0
- package/node_modules/@clawdbot/lobster/dist/test/gog_gmail_send.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/group_by.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/helpers/wait_for_pid.js +19 -0
- package/node_modules/@clawdbot/lobster/dist/test/helpers/wait_for_pid.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/http_response_body_cap.test.js +318 -0
- package/node_modules/@clawdbot/lobster/dist/test/http_response_body_cap.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/llm_invoke.test.js +946 -1
- package/node_modules/@clawdbot/lobster/dist/test/llm_invoke.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/llm_task_invoke.test.js +103 -0
- package/node_modules/@clawdbot/lobster/dist/test/llm_task_invoke.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/map.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/multi_approval_resume.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/on_error.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/openclaw_agent.test.js +169 -0
- package/node_modules/@clawdbot/lobster/dist/test/openclaw_agent.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/openclaw_dispatch_retry.test.js +96 -0
- package/node_modules/@clawdbot/lobster/dist/test/openclaw_dispatch_retry.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/openclaw_invoke_alias.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/parallel.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/parser.test.js +57 -0
- package/node_modules/@clawdbot/lobster/dist/test/parser.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/process_output_limit.test.js +173 -0
- package/node_modules/@clawdbot/lobster/dist/test/process_output_limit.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/read_line.test.js +54 -0
- package/node_modules/@clawdbot/lobster/dist/test/read_line.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/release_changelog.test.js +39 -0
- package/node_modules/@clawdbot/lobster/dist/test/release_changelog.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/request_input.test.js +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/request_input.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/resume.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/sdk_exec.test.js +201 -0
- package/node_modules/@clawdbot/lobster/dist/test/sdk_exec.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/sdk_lobster.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/shell.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/sort.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/state.test.js +584 -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.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/step_stdin_epipe.test.js +44 -0
- package/node_modules/@clawdbot/lobster/dist/test/step_stdin_epipe.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/step_timeout.test.js +67 -1
- package/node_modules/@clawdbot/lobster/dist/test/step_timeout.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/template.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/template_filters.test.js +37 -0
- package/node_modules/@clawdbot/lobster/dist/test/template_filters.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/tool_envelope_version.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/tool_mode.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/validation.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/where.test.js +94 -0
- package/node_modules/@clawdbot/lobster/dist/test/where.test.js.map +1 -0
- package/node_modules/@clawdbot/lobster/dist/test/workflow_args_env.test.js +5 -3
- package/node_modules/@clawdbot/lobster/dist/test/workflow_args_env.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/workflow_composition.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/workflow_file.test.js +647 -1
- package/node_modules/@clawdbot/lobster/dist/test/workflow_file.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/workflow_graph.test.js +12 -2
- package/node_modules/@clawdbot/lobster/dist/test/workflow_graph.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/dist/test/workflows.test.js.map +1 -1
- package/node_modules/@clawdbot/lobster/package.json +74 -73
- package/node_modules/typebox/build/compile/validator.d.mts +1 -1
- package/node_modules/typebox/build/compile/validator.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
- package/node_modules/typebox/build/format/iri.mjs +5 -1
- package/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/node_modules/typebox/build/guard/string.mjs +16 -24
- package/node_modules/typebox/build/schema/build.mjs +2 -2
- package/node_modules/typebox/build/schema/check.mjs +1 -1
- package/node_modules/typebox/build/schema/compile.d.mts +3 -2
- package/node_modules/typebox/build/schema/compile.mjs +8 -8
- package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
- package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
- package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
- package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
- package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
- package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
- package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
- package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
- package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
- package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
- package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
- package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
- package/node_modules/typebox/build/schema/errors.d.mts +2 -2
- package/node_modules/typebox/build/schema/errors.mjs +8 -14
- package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
- package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
- package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
- package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
- package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
- package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
- package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
- package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
- package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
- package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
- package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
- package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
- package/node_modules/typebox/build/schema/parse.d.mts +1 -0
- package/node_modules/typebox/build/schema/parse.mjs +10 -5
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
- package/node_modules/typebox/build/schema/schema.d.mts +2 -0
- package/node_modules/typebox/build/schema/schema.mjs +2 -0
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
- package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +59 -89
- package/openclaw.plugin.json +1 -1
- package/package.json +10 -7
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export function httpResponseLimitFromEnv(env) {
|
|
2
|
+
const raw = env.LOBSTER_MAX_HTTP_RESPONSE_BYTES?.trim();
|
|
3
|
+
if (!raw)
|
|
4
|
+
return undefined;
|
|
5
|
+
const value = Number(raw);
|
|
6
|
+
if (!/^\d+$/.test(raw) || !Number.isSafeInteger(value) || value <= 0) {
|
|
7
|
+
throw new Error("LOBSTER_MAX_HTTP_RESPONSE_BYTES must be a positive safe integer (bytes)");
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
export async function readResponseTextCapped(res, maxBytes) {
|
|
12
|
+
if (maxBytes === undefined)
|
|
13
|
+
return res.text();
|
|
14
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) {
|
|
15
|
+
throw new Error("maxBytes must be a non-negative safe integer");
|
|
16
|
+
}
|
|
17
|
+
const declared = parseContentLength(res.headers.get("content-length"));
|
|
18
|
+
if (declared !== null && declared > maxBytes) {
|
|
19
|
+
if (res.body) {
|
|
20
|
+
try {
|
|
21
|
+
await res.body.cancel();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
// The socket may already be closed; still refuse the oversized body.
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
throw new Error(`HTTP response body exceeded ${maxBytes} bytes`);
|
|
28
|
+
}
|
|
29
|
+
if (!res.body) {
|
|
30
|
+
return "";
|
|
31
|
+
}
|
|
32
|
+
const reader = res.body.getReader();
|
|
33
|
+
const chunks = [];
|
|
34
|
+
let total = 0;
|
|
35
|
+
try {
|
|
36
|
+
while (true) {
|
|
37
|
+
const { done, value } = await reader.read();
|
|
38
|
+
if (done) {
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
if (!value || value.byteLength === 0) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
total += value.byteLength;
|
|
45
|
+
if (total > maxBytes) {
|
|
46
|
+
try {
|
|
47
|
+
await reader.cancel();
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Reader is already closed after cancel.
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`HTTP response body exceeded ${maxBytes} bytes`);
|
|
53
|
+
}
|
|
54
|
+
chunks.push(value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
reader.releaseLock();
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Already released by cancel().
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (total === 0) {
|
|
66
|
+
return "";
|
|
67
|
+
}
|
|
68
|
+
const bytes = new Uint8Array(total);
|
|
69
|
+
let offset = 0;
|
|
70
|
+
for (const chunk of chunks) {
|
|
71
|
+
bytes.set(chunk, offset);
|
|
72
|
+
offset += chunk.byteLength;
|
|
73
|
+
}
|
|
74
|
+
return new TextDecoder().decode(bytes);
|
|
75
|
+
}
|
|
76
|
+
function parseContentLength(raw) {
|
|
77
|
+
if (raw === null || raw.trim() === "") {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const n = Number(raw);
|
|
81
|
+
if (!Number.isFinite(n) || n < 0) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return n;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=read_response_text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_response_text.js","sourceRoot":"","sources":["../../src/read_response_text.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,wBAAwB,CAAC,GAAsB;IAC9D,MAAM,GAAG,GAAG,GAAG,CAAC,+BAA+B,EAAE,IAAI,EAAE,CAAC;IACxD,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU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
@@ -82,6 +82,7 @@ function formatChangeMessage({ repo, pr, changedFields, prInfo }) {
|
|
|
82
82
|
* @param {string} [options.key] - State key override
|
|
83
83
|
* @param {boolean} [options.changesOnly=false] - Only output when changed
|
|
84
84
|
* @param {boolean} [options.summaryOnly=false] - Return compact summary
|
|
85
|
+
* @param {AbortSignal} [options.signal] - Cancel the running GitHub command
|
|
85
86
|
* @returns {Lobster}
|
|
86
87
|
*/
|
|
87
88
|
export function prMonitor(options) {
|
|
@@ -91,7 +92,7 @@ export function prMonitor(options) {
|
|
|
91
92
|
throw new Error("prMonitor requires repo");
|
|
92
93
|
if (!pr)
|
|
93
94
|
throw new Error("prMonitor requires pr");
|
|
94
|
-
const workflow = new Lobster()
|
|
95
|
+
const workflow = new Lobster({ signal: options.signal })
|
|
95
96
|
.pipe(ghPrView({ repo, pr }))
|
|
96
97
|
.pipe(diffLast(key))
|
|
97
98
|
.pipe((results) => {
|
|
@@ -179,6 +180,7 @@ prMonitor.meta = {
|
|
|
179
180
|
* @param {string} options.repo - Repository in owner/repo format
|
|
180
181
|
* @param {number} options.pr - PR number
|
|
181
182
|
* @param {string} [options.key] - State key override
|
|
183
|
+
* @param {AbortSignal} [options.signal] - Cancel the running GitHub command
|
|
182
184
|
* @returns {Lobster}
|
|
183
185
|
*/
|
|
184
186
|
export function prMonitorNotify(options) {
|
|
@@ -188,7 +190,7 @@ export function prMonitorNotify(options) {
|
|
|
188
190
|
throw new Error("prMonitorNotify requires repo");
|
|
189
191
|
if (!pr)
|
|
190
192
|
throw new Error("prMonitorNotify requires pr");
|
|
191
|
-
const workflow = new Lobster()
|
|
193
|
+
const workflow = new Lobster({ signal: options.signal })
|
|
192
194
|
.pipe(ghPrView({ repo, pr }))
|
|
193
195
|
.pipe(diffLast(key, { changesOnly: true }))
|
|
194
196
|
.pipe((results) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-monitor.js","sourceRoot":"","sources":["../../../../src/recipes/github/pr-monitor.ts"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AI,CAAC;QAChB,IAAI,EAAE;YACL,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YACxC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YACtC,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACvB;KACD,CAAC,CAAC;IAEJ,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,kBAAkB;AAClB,eAAe,CAAC,IAAI,GAAG;IACtB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,CAAC,IAAI,CAAC;IAChB,IAAI,EAAE;QACL,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QACxC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QACtC,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACvB;CACD,CAAC"}
|
|
@@ -9,46 +9,27 @@
|
|
|
9
9
|
* .pipe(ghPrView({ repo: 'owner/repo', pr: 123 }))
|
|
10
10
|
* .pipe(pr => console.log(pr.state));
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
12
|
+
import { runAbortableProcess } from "../../../abortable_process.js";
|
|
13
13
|
/**
|
|
14
14
|
* Run gh command
|
|
15
15
|
* @param {string[]} argv
|
|
16
16
|
* @param {Object} options
|
|
17
17
|
* @returns {Promise<{stdout: string, stderr: string}>}
|
|
18
18
|
*/
|
|
19
|
-
function runGh(argv, { env, cwd }) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
child.stdout.setEncoding("utf8");
|
|
29
|
-
child.stderr.setEncoding("utf8");
|
|
30
|
-
child.stdout.on("data", (d) => {
|
|
31
|
-
stdout += d;
|
|
32
|
-
});
|
|
33
|
-
child.stderr.on("data", (d) => {
|
|
34
|
-
stderr += d;
|
|
35
|
-
});
|
|
36
|
-
child.on("error", (err) => {
|
|
37
|
-
if (err?.code === "ENOENT") {
|
|
38
|
-
reject(new Error("gh not found on PATH (install GitHub CLI)"));
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
reject(err);
|
|
42
|
-
});
|
|
43
|
-
child.on("close", (code) => {
|
|
44
|
-
if (code === 0) {
|
|
45
|
-
resolve({ stdout, stderr });
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
reject(new Error(`gh failed (${code}): ${stderr.trim() || stdout.trim()}`));
|
|
49
|
-
}
|
|
50
|
-
});
|
|
19
|
+
async function runGh(argv, { env, cwd, signal, forceTerminationSignal }) {
|
|
20
|
+
const { stdout, stderr, code } = await runAbortableProcess({
|
|
21
|
+
command: "gh",
|
|
22
|
+
argv,
|
|
23
|
+
env,
|
|
24
|
+
cwd,
|
|
25
|
+
signal,
|
|
26
|
+
forceTerminationSignal,
|
|
27
|
+
notFoundMessage: "gh not found on PATH (install GitHub CLI)",
|
|
51
28
|
});
|
|
29
|
+
if (code === 0) {
|
|
30
|
+
return { stdout, stderr };
|
|
31
|
+
}
|
|
32
|
+
throw new Error(`gh failed (${code}): ${stderr.trim() || stdout.trim()}`);
|
|
52
33
|
}
|
|
53
34
|
/**
|
|
54
35
|
* Create a GitHub PR view stage
|
|
@@ -88,7 +69,12 @@ export function ghPrView(options) {
|
|
|
88
69
|
// no-op
|
|
89
70
|
}
|
|
90
71
|
const argv = ["pr", "view", String(pr), "--repo", String(repo), "--json", fields.join(",")];
|
|
91
|
-
const { stdout } = (await runGh(argv, {
|
|
72
|
+
const { stdout } = (await runGh(argv, {
|
|
73
|
+
env: ctx.env,
|
|
74
|
+
cwd: process.cwd(),
|
|
75
|
+
signal: ctx.signal,
|
|
76
|
+
forceTerminationSignal: ctx.forceTerminationSignal,
|
|
77
|
+
}));
|
|
92
78
|
let parsed;
|
|
93
79
|
try {
|
|
94
80
|
parsed = JSON.parse(stdout.trim());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-view.js","sourceRoot":"","sources":["../../../../../src/recipes/github/stages/pr-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pr-view.js","sourceRoot":"","sources":["../../../../../src/recipes/github/stages/pr-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE;;;;;GAKG;AACH,KAAK,UAAU,KAAK,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,sBAAsB,EAAE;IACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,mBAAmB,CAAC;QAC1D,OAAO,EAAE,IAAI;QACb,IAAI;QACJ,GAAG;QACH,GAAG;QACH,MAAM;QACN,sBAAsB;QACtB,eAAe,EAAE,2CAA2C;KAC5D,CAAC,CAAC;IACH,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QAChB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC3B,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAO;IAC/B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC;IAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI;QAChC,QAAQ;QACR,OAAO;QACP,KAAK;QACL,OAAO;QACP,SAAS;QACT,WAAW;QACX,gBAAgB;QAChB,QAAQ;QACR,aAAa;QACb,aAAa;QACb,WAAW;K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registry.js","sourceRoot":"","sources":["../../../src/recipes/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEpE,MAAM,OAAO,GAAwB;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/recipes/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEpE,MAAM,OAAO,GAAwB;IACpC,mBAAmB,EAAE,SAAS;IAC9B,0BAA0B,EAAE,eAAe;CAC3C,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,EAAE;IAChC,MAAM,IAAI,GAAG,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACvB,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC1D,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,WAAW;IAC1B,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;QACjD,MAAM,IAAI,GAAS,EAAU,CAAC,IAAI,IAAI,EAAE,CAAC;QACzC,OAAO;YACN,IAAI;YACJ,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;YACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;SACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAI;IAC7B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/renderers/json.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/renderers/json.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,MAAM;IACxC,OAAO;QACN,IAAI,CAAC,KAAK;YACT,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QACD,KAAK,CAAC,KAAK;YACV,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAC7D,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../src/resume.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;
|
|
1
|
+
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../src/resume.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAChD,IAAI,QAAQ,CAAC,UAAU,CAAC,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,eAAe,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAC;IAC7D,IAAI,eAAe;QAAE,OAAO,eAAe,CAAC;IAC5C,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,2BAA2B,CAAC,OAAgB;IACpD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzD,MAAM,IAAI,GAAG,OAAyC,CAAC;IACvD,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IACjD,IAAI,IAAI,CAAC,eAAe,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC7F,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IAC1F,OAAO;QACN,eAAe,EAAE,CAAC;QAClB,CAAC,EAAE,CAAC;QACJ,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACvB,CAAC;AACH,CAAC"}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { createJsonRenderer } from "./renderers/json.js";
|
|
2
2
|
import { InputRequestSuspension, RequestInputResumeError, assertRequestInputResumeConsumed, createInputTracker, createStageRequestInput, } from "./input_request.js";
|
|
3
|
-
export async function runPipeline({ pipeline, registry, stdin, stdout, stderr, env, mode = "human", input, cwd = undefined, llmAdapters = undefined, signal = undefined, dryRun = false, requestInputResume = undefined, requestInputEnabled = true, }) {
|
|
3
|
+
export async function runPipeline({ pipeline, registry, stdin, stdout, stderr, env, mode = "human", input, cwd = undefined, llmAdapters = undefined, llmSpendLedger = undefined, signal = undefined, forceTerminationSignal = undefined, haltAfterStageOnAbort = false, dryRun = false, requestInputResume = undefined, requestInputEnabled = true, onExecutionStart = undefined, onNonRetryableSideEffect = undefined, }) {
|
|
4
4
|
if (dryRun) {
|
|
5
5
|
return dryRunPipeline({ pipeline, registry, stderr });
|
|
6
6
|
}
|
|
7
7
|
let stream = input ?? [];
|
|
8
8
|
let rendered = false;
|
|
9
|
+
const renderedItems = [];
|
|
9
10
|
let halted = false;
|
|
10
11
|
let haltedAt = null;
|
|
11
12
|
let pipelineOutputStarted = false;
|
|
13
|
+
let executionStarted = false;
|
|
14
|
+
let executionStart;
|
|
15
|
+
const markExecutionStarted = async () => {
|
|
16
|
+
if (executionStart)
|
|
17
|
+
return executionStart;
|
|
18
|
+
executionStart = (async () => {
|
|
19
|
+
await onExecutionStart?.();
|
|
20
|
+
executionStarted = true;
|
|
21
|
+
})();
|
|
22
|
+
return executionStart;
|
|
23
|
+
};
|
|
12
24
|
const baseCtx = {
|
|
13
25
|
stdin,
|
|
14
26
|
stdout,
|
|
@@ -18,14 +30,24 @@ export async function runPipeline({ pipeline, registry, stdin, stdout, stderr, e
|
|
|
18
30
|
mode,
|
|
19
31
|
cwd,
|
|
20
32
|
llmAdapters,
|
|
33
|
+
// The ledger of live LLM calls this run has not billed yet, so a replay of one of them
|
|
34
|
+
// can still be charged to the run that made it. Absent outside a cost-tracked run.
|
|
35
|
+
llmSpendLedger,
|
|
21
36
|
signal,
|
|
37
|
+
forceTerminationSignal,
|
|
38
|
+
onNonRetryableSideEffect,
|
|
22
39
|
};
|
|
23
40
|
for (let idx = 0; idx < pipeline.length; idx++) {
|
|
41
|
+
if (haltAfterStageOnAbort)
|
|
42
|
+
signal?.throwIfAborted();
|
|
24
43
|
const stage = pipeline[idx];
|
|
25
44
|
const command = registry.get(stage.name);
|
|
26
45
|
if (!command) {
|
|
27
46
|
throw new Error(`Unknown command: ${stage.name}`);
|
|
28
47
|
}
|
|
48
|
+
if (command.meta?.resumeSafeBeforeInput !== true) {
|
|
49
|
+
await markExecutionStarted();
|
|
50
|
+
}
|
|
29
51
|
const inputTracker = createInputTracker(stream);
|
|
30
52
|
const stageResume = idx === 0 ? requestInputResume : undefined;
|
|
31
53
|
let commandActive = true;
|
|
@@ -48,7 +70,7 @@ export async function runPipeline({ pipeline, registry, stdin, stdout, stderr, e
|
|
|
48
70
|
const ctx = {
|
|
49
71
|
...baseCtx,
|
|
50
72
|
stdout: stageStdout,
|
|
51
|
-
render:
|
|
73
|
+
render: createRecordingJsonRenderer(stageStdout, renderedItems),
|
|
52
74
|
};
|
|
53
75
|
const stageCtx = {
|
|
54
76
|
...ctx,
|
|
@@ -62,6 +84,7 @@ export async function runPipeline({ pipeline, registry, stdin, stdout, stderr, e
|
|
|
62
84
|
getInactiveReason: () => inactiveReason,
|
|
63
85
|
isOutputStarted: () => pipelineOutputStarted || commandOutputStarted,
|
|
64
86
|
resume: stageResume,
|
|
87
|
+
onResumedInput: command.meta?.resumeSafeAfterInput === true ? undefined : markExecutionStarted,
|
|
65
88
|
})
|
|
66
89
|
: createUnsupportedRequestInput(),
|
|
67
90
|
};
|
|
@@ -79,29 +102,43 @@ export async function runPipeline({ pipeline, registry, stdin, stdout, stderr, e
|
|
|
79
102
|
if (result?.rendered) {
|
|
80
103
|
rendered = true;
|
|
81
104
|
}
|
|
105
|
+
const terminalOutput = Boolean(result?.halt);
|
|
106
|
+
let stageHalted = Boolean(terminalOutput || (haltAfterStageOnAbort && signal?.aborted));
|
|
82
107
|
const output = result?.output;
|
|
83
108
|
if (Array.isArray(output)) {
|
|
84
109
|
stream = output;
|
|
85
110
|
await finishStage();
|
|
86
111
|
}
|
|
87
|
-
else if (output &&
|
|
112
|
+
else if (output && idx < pipeline.length - 1 && !terminalOutput) {
|
|
88
113
|
commandActive = false;
|
|
89
114
|
inactiveReason = "requestInput cannot suspend from lazy output before downstream stages";
|
|
90
115
|
assertRequestInputResumeConsumed(stageResume);
|
|
91
|
-
|
|
116
|
+
const trackedOutput = trackCommandOutput(output, () => {
|
|
92
117
|
commandOutputStarted = true;
|
|
93
118
|
}, () => assertRequestInputResumeConsumed(stageResume), (err) => assertNoUnconsumedResumeAfterError(stageResume, err), finishStage);
|
|
119
|
+
stream = haltAfterStageOnAbort
|
|
120
|
+
? throwIfAbortedAfterDrain(trackedOutput, signal)
|
|
121
|
+
: trackedOutput;
|
|
94
122
|
}
|
|
95
123
|
else {
|
|
96
|
-
|
|
97
|
-
|
|
124
|
+
if (output) {
|
|
125
|
+
const trackedOutput = trackCommandOutput(output, () => {
|
|
98
126
|
commandOutputStarted = true;
|
|
99
|
-
}, () => assertRequestInputResumeConsumed(stageResume), (err) => assertNoUnconsumedResumeAfterError(stageResume, err), finishStage)
|
|
100
|
-
|
|
101
|
-
|
|
127
|
+
}, () => assertRequestInputResumeConsumed(stageResume), (err) => assertNoUnconsumedResumeAfterError(stageResume, err), finishStage);
|
|
128
|
+
// Terminal output is drained after the stage loop as well. It needs the
|
|
129
|
+
// same abort-aware read as a handoff, otherwise a stalled final iterator
|
|
130
|
+
// can prevent the tool cancellation from settling forever.
|
|
131
|
+
stream = haltAfterStageOnAbort
|
|
132
|
+
? throwIfAbortedAfterDrain(trackedOutput, signal)
|
|
133
|
+
: trackedOutput;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
stream = [];
|
|
102
137
|
await finishStage();
|
|
138
|
+
}
|
|
103
139
|
}
|
|
104
|
-
|
|
140
|
+
stageHalted ||= Boolean(haltAfterStageOnAbort && signal?.aborted);
|
|
141
|
+
if (stageHalted) {
|
|
105
142
|
halted = true;
|
|
106
143
|
haltedAt = { index: idx, stage };
|
|
107
144
|
break;
|
|
@@ -122,8 +159,10 @@ export async function runPipeline({ pipeline, registry, stdin, stdout, stderr, e
|
|
|
122
159
|
throw err;
|
|
123
160
|
}
|
|
124
161
|
}
|
|
162
|
+
if (haltAfterStageOnAbort)
|
|
163
|
+
signal?.throwIfAborted();
|
|
125
164
|
assertRequestInputResumeConsumed(requestInputResume);
|
|
126
|
-
return { items, rendered, halted, haltedAt };
|
|
165
|
+
return { items, rendered, renderedItems, halted, haltedAt, executionStarted };
|
|
127
166
|
function haltForInputRequest(err) {
|
|
128
167
|
if (!(err instanceof InputRequestSuspension))
|
|
129
168
|
return false;
|
|
@@ -154,7 +193,14 @@ function dryRunPipeline({ pipeline, registry, stderr, }) {
|
|
|
154
193
|
lines.push("");
|
|
155
194
|
stderr.write(lines.join("\n"));
|
|
156
195
|
// Return rendered:true so the CLI does not print an empty JSON array to stdout.
|
|
157
|
-
return {
|
|
196
|
+
return {
|
|
197
|
+
items: [],
|
|
198
|
+
rendered: true,
|
|
199
|
+
renderedItems: [],
|
|
200
|
+
halted: false,
|
|
201
|
+
haltedAt: null,
|
|
202
|
+
executionStarted: false,
|
|
203
|
+
};
|
|
158
204
|
}
|
|
159
205
|
function formatStageArgs(args) {
|
|
160
206
|
const parts = [];
|
|
@@ -172,20 +218,128 @@ function formatStageArgs(args) {
|
|
|
172
218
|
}
|
|
173
219
|
return parts.join(", ");
|
|
174
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Wraps the stage renderer so the pipeline keeps the objects a renderer was handed. A renderer
|
|
223
|
+
* writes them to stdout and returns no items, so a caller that reads the pipeline back from that
|
|
224
|
+
* text only ever sees what JSON can express. Provenance a consumer must not take from the text
|
|
225
|
+
* itself — whether an LLM result was replayed rather than paid for — lives on these originals.
|
|
226
|
+
* They stay in this process and are never written or serialized.
|
|
227
|
+
*/
|
|
228
|
+
function createRecordingJsonRenderer(stdout, collected) {
|
|
229
|
+
const renderer = createJsonRenderer(stdout);
|
|
230
|
+
return {
|
|
231
|
+
...renderer,
|
|
232
|
+
json(items) {
|
|
233
|
+
if (Array.isArray(items))
|
|
234
|
+
collected.push(...items);
|
|
235
|
+
else
|
|
236
|
+
collected.push(items);
|
|
237
|
+
return renderer.json(items);
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
175
241
|
function streamFromItems(items) {
|
|
176
242
|
return (async function* () {
|
|
177
243
|
for (const item of items)
|
|
178
244
|
yield item;
|
|
179
245
|
})();
|
|
180
246
|
}
|
|
181
|
-
function
|
|
247
|
+
function throwIfAbortedAfterDrain(input, signal) {
|
|
182
248
|
return (async function* () {
|
|
249
|
+
const iterator = input[Symbol.asyncIterator]();
|
|
183
250
|
let completed = false;
|
|
184
251
|
try {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
252
|
+
while (true) {
|
|
253
|
+
const next = await nextWithAbort(iterator, signal);
|
|
254
|
+
if (next.done) {
|
|
255
|
+
completed = true;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
signal?.throwIfAborted();
|
|
259
|
+
yield next.value;
|
|
260
|
+
}
|
|
261
|
+
signal?.throwIfAborted();
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
if (!completed)
|
|
265
|
+
await closeAfterAbortedRead(input, iterator, signal);
|
|
266
|
+
}
|
|
267
|
+
})();
|
|
268
|
+
}
|
|
269
|
+
async function closeAfterAbortedRead(input, iterator, signal) {
|
|
270
|
+
const cancellable = iterator;
|
|
271
|
+
const inputCancellable = input;
|
|
272
|
+
const abort = cancellable.abort ?? inputCancellable.abort;
|
|
273
|
+
try {
|
|
274
|
+
// A source that owns a pending timer, socket, or process can expose this
|
|
275
|
+
// small cancellation hook. It must release the pending next() operation.
|
|
276
|
+
if (signal?.aborted && abort)
|
|
277
|
+
await abort(signal.reason);
|
|
278
|
+
if (typeof iterator.return !== "function")
|
|
279
|
+
return;
|
|
280
|
+
const close = iterator.return();
|
|
281
|
+
if (signal?.aborted && !abort) {
|
|
282
|
+
// Legacy iterators cannot interrupt an in-flight next(). Keep the
|
|
283
|
+
// existing prompt cancellation behavior, while resource-owning sources
|
|
284
|
+
// opt into the abort hook above so their cleanup is awaited.
|
|
285
|
+
void Promise.resolve(close).catch(() => { });
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
await close;
|
|
289
|
+
}
|
|
290
|
+
catch (err) {
|
|
291
|
+
if (!signal?.aborted)
|
|
292
|
+
throw err;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
async function nextWithAbort(iterator, signal) {
|
|
296
|
+
if (!signal)
|
|
297
|
+
return iterator.next();
|
|
298
|
+
signal.throwIfAborted();
|
|
299
|
+
let onAbort;
|
|
300
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
301
|
+
onAbort = () => {
|
|
302
|
+
try {
|
|
303
|
+
signal.throwIfAborted();
|
|
304
|
+
}
|
|
305
|
+
catch (err) {
|
|
306
|
+
reject(err);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
310
|
+
});
|
|
311
|
+
if (signal.aborted)
|
|
312
|
+
onAbort();
|
|
313
|
+
try {
|
|
314
|
+
return await Promise.race([iterator.next(), aborted]);
|
|
315
|
+
}
|
|
316
|
+
finally {
|
|
317
|
+
signal.removeEventListener("abort", onAbort);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function trackCommandOutput(output, markOutput, assertResumeConsumed, assertNoUnconsumedResumeAfterError, finishStage) {
|
|
321
|
+
const source = output;
|
|
322
|
+
let sourceIterator;
|
|
323
|
+
const tracked = (async function* () {
|
|
324
|
+
let completed = false;
|
|
325
|
+
try {
|
|
326
|
+
if (typeof source[Symbol.asyncIterator] === "function") {
|
|
327
|
+
sourceIterator = source[Symbol.asyncIterator]();
|
|
328
|
+
const iteratorInput = {
|
|
329
|
+
[Symbol.asyncIterator]: () => sourceIterator,
|
|
330
|
+
};
|
|
331
|
+
for await (const item of iteratorInput) {
|
|
332
|
+
assertResumeConsumed();
|
|
333
|
+
markOutput();
|
|
334
|
+
yield item;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
for (const item of output) {
|
|
339
|
+
assertResumeConsumed();
|
|
340
|
+
markOutput();
|
|
341
|
+
yield item;
|
|
342
|
+
}
|
|
189
343
|
}
|
|
190
344
|
completed = true;
|
|
191
345
|
}
|
|
@@ -198,6 +352,22 @@ function trackCommandOutput(output, markOutput, assertResumeConsumed, assertNoUn
|
|
|
198
352
|
await finishStage({ assertResume: completed });
|
|
199
353
|
}
|
|
200
354
|
})();
|
|
355
|
+
// Iterator-owned abort hooks are only discoverable after iterator acquisition.
|
|
356
|
+
// A getter lets the abort-aware wrapper find that hook once a read is pending,
|
|
357
|
+
// without performing acquisition outside the generator's guarded cleanup path.
|
|
358
|
+
Object.defineProperty(tracked, "abort", {
|
|
359
|
+
configurable: true,
|
|
360
|
+
get() {
|
|
361
|
+
const cancellationOwner = sourceIterator && typeof sourceIterator.abort === "function"
|
|
362
|
+
? sourceIterator
|
|
363
|
+
: source;
|
|
364
|
+
const abort = cancellationOwner.abort;
|
|
365
|
+
return typeof abort === "function"
|
|
366
|
+
? (reason) => abort.call(cancellationOwner, reason)
|
|
367
|
+
: undefined;
|
|
368
|
+
},
|
|
369
|
+
});
|
|
370
|
+
return tracked;
|
|
201
371
|
}
|
|
202
372
|
function assertNoUnconsumedResumeAfterError(resume, err) {
|
|
203
373
|
if (err instanceof RequestInputResumeError)
|