humanish 0.108.0 → 0.109.0
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/ARCHITECTURE.md +58 -59
- package/CHANGELOG.md +13 -0
- package/CONTEXT.md +44 -44
- package/README.md +3 -3
- package/TELEMETRY.md +2 -2
- package/dist/actors/codex/app-server-trace.js +2 -1
- package/dist/actors/codex/restricted-participant.js +12 -12
- package/dist/actors/codex/restricted-session.d.ts +2 -2
- package/dist/actors/computer-use/actor.d.ts +6 -6
- package/dist/actors/computer-use/actor.js +2 -2
- package/dist/actors/computer-use/admission-limit.d.ts +2 -2
- package/dist/actors/computer-use/admission-limit.js +3 -3
- package/dist/actors/computer-use/executor-error.d.ts +2 -2
- package/dist/actors/computer-use/executor-error.js +3 -3
- package/dist/actors/computer-use/loop/actions.js +5 -5
- package/dist/actors/computer-use/loop/debrief.js +2 -2
- package/dist/actors/computer-use/loop/ending.d.ts +1 -1
- package/dist/actors/computer-use/loop/ending.js +12 -11
- package/dist/actors/computer-use/loop/observation.js +6 -5
- package/dist/actors/computer-use/loop/provider-call.js +11 -11
- package/dist/actors/computer-use/loop/session.d.ts +4 -4
- package/dist/actors/computer-use/loop/session.js +2 -2
- package/dist/actors/computer-use/loop/trace.js +3 -2
- package/dist/actors/computer-use/loop/types.d.ts +24 -24
- package/dist/actors/computer-use/loop/usage.d.ts +2 -2
- package/dist/actors/computer-use/loop.d.ts +6 -1
- package/dist/actors/computer-use/loop.js +26 -4
- package/dist/actors/computer-use/openai-provider.d.ts +2 -2
- package/dist/actors/computer-use/openai-provider.js +8 -8
- package/dist/actors/computer-use/provider-error.d.ts +4 -4
- package/dist/actors/computer-use/provider-error.js +6 -6
- package/dist/actors/contract.d.ts +4 -4
- package/dist/actors/contract.js +1 -1
- package/dist/actors/local-agent/claude-session.js +3 -3
- package/dist/actors/local-agent/cli.d.ts +1 -1
- package/dist/actors/local-agent/cli.js +1 -1
- package/dist/actors/reasoning-effort.js +3 -3
- package/dist/actors/registry.d.ts +2 -2
- package/dist/actors/registry.js +3 -3
- package/dist/actors/scripted-browser/actor.d.ts +2 -2
- package/dist/actors/scripted-browser/actor.js +1 -1
- package/dist/analysis/automatic-completion.d.ts +7 -7
- package/dist/analysis/automatic-completion.js +1 -1
- package/dist/analysis/automatic-config.d.ts +6 -6
- package/dist/analysis/automatic-config.js +1 -1
- package/dist/analysis/execute.d.ts +1 -1
- package/dist/analysis/execute.js +1 -1
- package/dist/analysis/types.d.ts +6 -0
- package/dist/browser-control/client.js +16 -16
- package/dist/browser-control/dispatcher.js +4 -4
- package/dist/browser-control/protocol.js +14 -14
- package/dist/browser-control/recording-transfer.js +4 -4
- package/dist/browser-control/transport.js +7 -7
- package/dist/cli/commands/analysis-signals.d.ts +2 -2
- package/dist/cli/commands/comms.js +14 -22
- package/dist/cli/commands/observe.d.ts +0 -1
- package/dist/cli/commands/observe.js +0 -15
- package/dist/cli/commands/run-command.d.ts +2 -2
- package/dist/cli/commands/run-command.js +3 -3
- package/dist/cli/commands/runs.js +3 -5
- package/dist/cli/commands/setup.js +5 -7
- package/dist/cli/commands/study-format.d.ts +9 -0
- package/dist/cli/commands/{lab-format.js → study-format.js} +5 -5
- package/dist/cli/commands/{lab-route-computer-use.d.ts → study-route-computer-use.d.ts} +6 -6
- package/dist/cli/commands/{lab-route-computer-use.js → study-route-computer-use.js} +12 -12
- package/dist/cli/commands/{lab-route-open.d.ts → study-route-open.d.ts} +4 -4
- package/dist/cli/commands/{lab-route-open.js → study-route-open.js} +2 -2
- package/dist/cli/commands/{lab-route-preview.d.ts → study-route-preview.d.ts} +7 -7
- package/dist/cli/commands/{lab-route-preview.js → study-route-preview.js} +3 -3
- package/dist/cli/commands/study-route-run.d.ts +19 -0
- package/dist/cli/commands/{lab-route-run.js → study-route-run.js} +6 -6
- package/dist/cli/commands/study-route-scripted.d.ts +17 -0
- package/dist/cli/commands/{lab-route-scripted.js → study-route-scripted.js} +4 -4
- package/dist/cli/commands/{lab-route-shared-world.d.ts → study-route-shared-world.d.ts} +5 -5
- package/dist/cli/commands/{lab-route-shared-world.js → study-route-shared-world.js} +7 -7
- package/dist/cli/commands/study-route-terminal.d.ts +17 -0
- package/dist/cli/commands/{lab-route-terminal.js → study-route-terminal.js} +4 -4
- package/dist/cli/commands/study-run.d.ts +9 -0
- package/dist/cli/commands/{lab-run.js → study-run.js} +34 -34
- package/dist/cli/commands/{lab-scorer.d.ts → study-scorer.d.ts} +5 -5
- package/dist/cli/commands/{lab-scorer.js → study-scorer.js} +1 -1
- package/dist/cli/commands/study.js +13 -49
- package/dist/cli/commands/tui.js +12 -12
- package/dist/cli/commands/watch.js +30 -65
- package/dist/cli/deprecations.d.ts +1 -13
- package/dist/cli/deprecations.js +0 -30
- package/dist/cli/doctor.d.ts +3 -3
- package/dist/cli/doctor.js +16 -16
- package/dist/cli/first-run-path.d.ts +4 -4
- package/dist/cli/first-run-path.js +7 -7
- package/dist/cli/io.d.ts +3 -3
- package/dist/cli/io.js +2 -2
- package/dist/cli/observer-follow.d.ts +2 -2
- package/dist/cli/observer-follow.js +2 -2
- package/dist/cli/orientation.d.ts +4 -4
- package/dist/cli/orientation.js +58 -20
- package/dist/cli/program.js +3 -4
- package/dist/cli/telemetry.d.ts +1 -1
- package/dist/cli/telemetry.js +14 -20
- package/dist/comms/catch-host.d.ts +1 -1
- package/dist/comms/catch-host.js +3 -3
- package/dist/comms/connections.d.ts +1 -1
- package/dist/comms/connections.js +2 -2
- package/dist/comms/external-evidence.d.ts +5 -5
- package/dist/comms/external-evidence.js +4 -3
- package/dist/comms/fake-inbox.d.ts +2 -2
- package/dist/comms/fake-inbox.js +2 -2
- package/dist/comms/receiving-runtime.d.ts +4 -4
- package/dist/comms/sandbox-catch.d.ts +2 -2
- package/dist/comms/sandbox-catch.js +2 -2
- package/dist/comms/setup.d.ts +2 -2
- package/dist/comms/setup.js +29 -32
- package/dist/feedback/draft.js +2 -2
- package/dist/feedback/export.js +3 -2
- package/dist/feedback/proof.d.ts +1 -1
- package/dist/feedback/proof.js +2 -2
- package/dist/guest/bootstrap.js +6 -6
- package/dist/guest/browser-tools.js +8 -8
- package/dist/guest/chromium-text.js +17 -17
- package/dist/guest/desktop-executor.d.ts +2 -2
- package/dist/guest/desktop-executor.js +20 -20
- package/dist/guest/desktop-keys.js +4 -4
- package/dist/guest/desktop-media.d.ts +2 -2
- package/dist/guest/desktop-media.js +16 -16
- package/dist/guest/desktop-native.js +10 -10
- package/dist/guest/runtime-desktop.js +2 -2
- package/dist/guest/runtime-processes.d.ts +2 -2
- package/dist/guest/runtime-processes.js +2 -2
- package/dist/guest/runtime.js +5 -5
- package/dist/index.d.ts +13 -15
- package/dist/index.js +6 -8
- package/dist/observer/artifact.d.ts +1 -1
- package/dist/observer/artifact.js +1 -1
- package/dist/observer/data.d.ts +1 -1
- package/dist/observer/library.d.ts +2 -0
- package/dist/observer/library.js +4 -1
- package/dist/observer/render.js +7 -1
- package/dist/observer/run-routes.d.ts +1 -0
- package/dist/observer/run-routes.js +37 -12
- package/dist/observer/serve.d.ts +1 -1
- package/dist/observer-app.html +1 -1
- package/dist/routes/computer-use/bundle-parts.js +3 -2
- package/dist/routes/computer-use/bundle.d.ts +2 -2
- package/dist/routes/computer-use/bundle.js +7 -6
- package/dist/routes/computer-use/e2b-desktop/comms.d.ts +5 -5
- package/dist/routes/computer-use/e2b-desktop/comms.js +5 -4
- package/dist/routes/computer-use/e2b-desktop/fidelity.d.ts +1 -1
- package/dist/routes/computer-use/e2b-desktop/prepare.d.ts +1 -1
- package/dist/routes/computer-use/e2b-desktop/prepare.js +3 -3
- package/dist/routes/computer-use/e2b-desktop/start.js +3 -4
- package/dist/routes/computer-use/e2b-desktop/state.d.ts +2 -2
- package/dist/routes/computer-use/e2b-desktop/teardown.js +2 -3
- package/dist/routes/computer-use/external-comms.d.ts +3 -3
- package/dist/routes/computer-use/fanout-bundle.js +11 -10
- package/dist/routes/computer-use/fanout-records.js +2 -2
- package/dist/routes/computer-use/live-flush.d.ts +3 -3
- package/dist/routes/computer-use/live-phase.d.ts +2 -3
- package/dist/routes/computer-use/live-phase.js +3 -3
- package/dist/routes/computer-use/local-tree-pack.d.ts +5 -5
- package/dist/routes/computer-use/local-tree-pack.js +1 -1
- package/dist/routes/computer-use/local-vm.d.ts +8 -8
- package/dist/routes/computer-use/local-vm.js +2 -2
- package/dist/routes/computer-use/participant-desktop.d.ts +3 -3
- package/dist/routes/computer-use/participant-desktop.js +1 -1
- package/dist/routes/computer-use/participant-execution.js +1 -1
- package/dist/routes/computer-use/participant-model.js +3 -3
- package/dist/routes/computer-use/participant-prompt.d.ts +5 -5
- package/dist/routes/computer-use/participant-prompt.js +3 -3
- package/dist/routes/computer-use/participant-runs.d.ts +10 -10
- package/dist/routes/computer-use/participant-runs.js +14 -13
- package/dist/routes/computer-use/plan.d.ts +12 -12
- package/dist/routes/computer-use/plan.js +24 -24
- package/dist/routes/computer-use/preflight.d.ts +5 -5
- package/dist/routes/computer-use/preflight.js +5 -5
- package/dist/routes/computer-use/rerun-selection.d.ts +1 -1
- package/dist/routes/computer-use/rerun-selection.js +3 -2
- package/dist/routes/computer-use/result.d.ts +4 -4
- package/dist/routes/computer-use/result.js +13 -12
- package/dist/routes/computer-use/route.d.ts +12 -12
- package/dist/routes/computer-use/route.js +19 -19
- package/dist/routes/computer-use/self-report.js +1 -1
- package/dist/routes/computer-use/setup.d.ts +22 -22
- package/dist/routes/computer-use/setup.js +15 -15
- package/dist/routes/computer-use/single-bundle.d.ts +4 -4
- package/dist/routes/computer-use/single-bundle.js +14 -13
- package/dist/routes/computer-use/subject-projection.d.ts +3 -3
- package/dist/routes/computer-use/types.d.ts +34 -34
- package/dist/routes/computer-use/types.js +3 -3
- package/dist/routes/preview.d.ts +6 -6
- package/dist/routes/preview.js +5 -5
- package/dist/routes/scripted/bundle.d.ts +6 -6
- package/dist/routes/scripted/bundle.js +10 -9
- package/dist/routes/scripted/plan.d.ts +7 -7
- package/dist/routes/scripted/plan.js +6 -6
- package/dist/routes/scripted/result.d.ts +3 -3
- package/dist/routes/scripted/result.js +9 -9
- package/dist/routes/scripted/route.d.ts +9 -9
- package/dist/routes/scripted/route.js +11 -11
- package/dist/routes/scripted/scenario.d.ts +1 -1
- package/dist/routes/scripted/scenario.js +3 -3
- package/dist/routes/scripted/setup.d.ts +6 -6
- package/dist/routes/scripted/setup.js +4 -4
- package/dist/routes/scripted/subject.d.ts +5 -5
- package/dist/routes/scripted/subject.js +3 -3
- package/dist/routes/scripted/surface-records.d.ts +1 -1
- package/dist/routes/scripted/surface-records.js +2 -2
- package/dist/routes/scripted/surface-sessions.d.ts +3 -3
- package/dist/routes/scripted/types.d.ts +17 -17
- package/dist/routes/scripted/types.js +1 -1
- package/dist/routes/shared-world/bundle-records.js +3 -3
- package/dist/routes/shared-world/bundle.js +15 -14
- package/dist/routes/shared-world/checkpoints.d.ts +3 -3
- package/dist/routes/shared-world/checkpoints.js +1 -1
- package/dist/routes/shared-world/comms.d.ts +9 -9
- package/dist/routes/shared-world/comms.js +6 -5
- package/dist/routes/shared-world/participant-specs.d.ts +3 -3
- package/dist/routes/shared-world/participant-specs.js +7 -7
- package/dist/routes/shared-world/plan.d.ts +9 -9
- package/dist/routes/shared-world/plan.js +9 -9
- package/dist/routes/shared-world/provisioned.d.ts +8 -8
- package/dist/routes/shared-world/provisioned.js +4 -4
- package/dist/routes/shared-world/result.d.ts +6 -6
- package/dist/routes/shared-world/result.js +11 -10
- package/dist/routes/shared-world/route.d.ts +11 -11
- package/dist/routes/shared-world/route.js +19 -19
- package/dist/routes/shared-world/setup.d.ts +13 -13
- package/dist/routes/shared-world/setup.js +19 -19
- package/dist/routes/shared-world/types.d.ts +27 -27
- package/dist/routes/terminal/adapter.d.ts +2 -2
- package/dist/routes/terminal/adapter.js +4 -4
- package/dist/routes/terminal/bundle.d.ts +11 -11
- package/dist/routes/terminal/bundle.js +12 -12
- package/dist/routes/terminal/credentials.d.ts +4 -4
- package/dist/routes/terminal/credentials.js +5 -5
- package/dist/routes/terminal/dry-run.d.ts +4 -4
- package/dist/routes/terminal/dry-run.js +9 -9
- package/dist/routes/terminal/ledger.d.ts +2 -2
- package/dist/routes/terminal/lifetime.d.ts +1 -1
- package/dist/routes/terminal/lifetime.js +1 -1
- package/dist/routes/terminal/live-finish.d.ts +2 -2
- package/dist/routes/terminal/live-finish.js +7 -7
- package/dist/routes/terminal/live-sandbox.d.ts +2 -2
- package/dist/routes/terminal/live-sandbox.js +3 -2
- package/dist/routes/terminal/participant-text.js +2 -1
- package/dist/routes/terminal/persona.d.ts +2 -2
- package/dist/routes/terminal/persona.js +2 -2
- package/dist/routes/terminal/plan.d.ts +7 -7
- package/dist/routes/terminal/plan.js +5 -5
- package/dist/routes/terminal/result.d.ts +5 -5
- package/dist/routes/terminal/result.js +7 -7
- package/dist/routes/terminal/route.d.ts +9 -9
- package/dist/routes/terminal/route.js +14 -14
- package/dist/routes/terminal/session.d.ts +5 -5
- package/dist/routes/terminal/session.js +7 -7
- package/dist/routes/terminal/trace.d.ts +2 -2
- package/dist/routes/terminal/types.d.ts +24 -24
- package/dist/routes/terminal/types.js +2 -2
- package/dist/run/bundle.d.ts +7 -7
- package/dist/run/bundle.js +2 -2
- package/dist/run/costs.d.ts +23 -0
- package/dist/run/costs.js +72 -43
- package/dist/run/dry-run-inputs.d.ts +1 -1
- package/dist/run/dry-run-inputs.js +1 -1
- package/dist/run/dry-run.js +2 -2
- package/dist/run/outcomes.d.ts +1 -1
- package/dist/run/participant.d.ts +1 -1
- package/dist/run/preflight-receipts.js +1 -1
- package/dist/run/pricing.js +2 -2
- package/dist/run/projection.d.ts +32 -32
- package/dist/run/projection.js +44 -44
- package/dist/run/reclaim.d.ts +1 -1
- package/dist/run/reclaim.js +1 -1
- package/dist/run/results.d.ts +2 -2
- package/dist/run/run-cost.d.ts +53 -0
- package/dist/run/run-cost.js +105 -0
- package/dist/run/run-index-analysis.d.ts +15 -0
- package/dist/run/run-index-analysis.js +77 -0
- package/dist/run/run-index.d.ts +11 -1
- package/dist/run/run-index.js +63 -49
- package/dist/run/run.d.ts +3 -3
- package/dist/run/run.js +2 -2
- package/dist/run/shared-world-evidence.d.ts +1 -1
- package/dist/run/shared-world-shape.js +1 -1
- package/dist/run/stats.d.ts +3 -3
- package/dist/run/stats.js +14 -14
- package/dist/run/status.d.ts +10 -2
- package/dist/run/status.js +6 -3
- package/dist/run/streams.d.ts +2 -2
- package/dist/run/study-provenance.d.ts +4 -2
- package/dist/run/study-provenance.js +7 -4
- package/dist/run/study-result.d.ts +0 -5
- package/dist/run/study-result.js +1 -1
- package/dist/run-study.d.ts +112 -0
- package/dist/{run-lab.js → run-study.js} +52 -45
- package/dist/{lab → study}/adapter-extension.d.ts +8 -20
- package/dist/{lab → study}/adapter-extension.js +2 -14
- package/dist/{lab → study}/adapter-scorer-loader.d.ts +10 -10
- package/dist/{lab → study}/adapter-scorer-loader.js +3 -3
- package/dist/study/composition-rules.d.ts +7 -0
- package/dist/{lab → study}/composition-rules.js +12 -12
- package/dist/study/config.d.ts +15 -0
- package/dist/{lab → study}/config.js +37 -20
- package/dist/study/convert.d.ts +1 -1
- package/dist/study/convert.js +15 -15
- package/dist/{lab → study}/device-presets.d.ts +2 -2
- package/dist/{lab → study}/discover.d.ts +29 -23
- package/dist/{lab → study}/discover.js +97 -118
- package/dist/{lab → study}/doctor.d.ts +11 -11
- package/dist/{lab → study}/doctor.js +18 -18
- package/dist/study/files.d.ts +2 -2
- package/dist/study/files.js +6 -5
- package/dist/{lab → study}/init-templates.d.ts +2 -2
- package/dist/{lab → study}/init-templates.js +16 -11
- package/dist/{lab → study}/init.d.ts +1 -1
- package/dist/{lab → study}/init.js +7 -4
- package/dist/{lab → study}/keys.d.ts +2 -2
- package/dist/{lab → study}/keys.js +10 -10
- package/dist/study/migrate.d.ts +1 -1
- package/dist/{lab → study}/parse/actors.d.ts +5 -5
- package/dist/{lab → study}/parse/actors.js +5 -5
- package/dist/study/parse/comms.d.ts +12 -0
- package/dist/study/parse/execution.d.ts +19 -0
- package/dist/{lab → study}/parse/study-v3.d.ts +3 -5
- package/dist/{lab → study}/parse/study-v3.js +3 -3
- package/dist/{lab → study}/parse/subject-state.d.ts +8 -8
- package/dist/{lab → study}/parse/subject-state.js +4 -4
- package/dist/{lab → study}/parse/subject.d.ts +3 -3
- package/dist/{lab → study}/parse/subject.js +8 -8
- package/dist/{lab → study}/parse/values.d.ts +2 -2
- package/dist/{lab → study}/persona-resolve.d.ts +4 -4
- package/dist/{lab → study}/persona-resolve.js +2 -2
- package/dist/{lab → study}/plan-base.d.ts +7 -7
- package/dist/{lab → study}/plan-base.js +1 -1
- package/dist/{lab → study}/plan-participants.d.ts +10 -10
- package/dist/{lab → study}/plan-participants.js +4 -4
- package/dist/{lab → study}/plan-types.d.ts +28 -28
- package/dist/{lab → study}/plan-types.js +2 -2
- package/dist/study/plan.d.ts +13 -0
- package/dist/{lab → study}/plan.js +20 -20
- package/dist/study/preflight-probes.d.ts +3 -0
- package/dist/{lab → study}/preflight-probes.js +9 -8
- package/dist/study/preflight-result.d.ts +8 -0
- package/dist/{lab → study}/preflight-result.js +3 -3
- package/dist/{lab → study}/preflight.d.ts +31 -31
- package/dist/{lab → study}/preflight.js +8 -8
- package/dist/{lab → study}/requirements.d.ts +3 -3
- package/dist/{lab → study}/requirements.js +1 -1
- package/dist/study/route-inputs.d.ts +28 -0
- package/dist/{lab → study}/route-inputs.js +1 -1
- package/dist/{lab → study}/routing.d.ts +12 -12
- package/dist/{lab/run-lab-events.d.ts → study/run-study-events.d.ts} +10 -10
- package/dist/{lab/run-lab-events.js → study/run-study-events.js} +3 -3
- package/dist/{lab/run-lab-homes.d.ts → study/run-study-homes.d.ts} +8 -17
- package/dist/study/run-study-homes.js +3 -0
- package/dist/study/run-study-options.d.ts +28 -0
- package/dist/{lab/run-lab-options.js → study/run-study-options.js} +13 -12
- package/dist/{lab/lab-deps.d.ts → study/study-deps.d.ts} +2 -2
- package/dist/{lab/lab-deps.js → study/study-deps.js} +2 -2
- package/dist/{lab → study}/summary.d.ts +10 -10
- package/dist/{lab → study}/summary.js +15 -15
- package/dist/{lab → study}/tasks.d.ts +3 -3
- package/dist/{lab → study}/tasks.js +1 -1
- package/dist/{lab → study}/types.d.ts +104 -104
- package/dist/{lab → study}/types.js +1 -1
- package/dist/{lab → study}/validation.d.ts +19 -19
- package/dist/{lab → study}/validation.js +13 -13
- package/dist/{lab → study}/warnings.d.ts +4 -4
- package/dist/{lab → study}/warnings.js +1 -1
- package/dist/subject/clone.d.ts +6 -6
- package/dist/subject/clone.js +2 -2
- package/dist/subject/local-tree-archive.d.ts +2 -2
- package/dist/subject/local-tree-archive.js +3 -3
- package/dist/subject/local-tree.d.ts +3 -3
- package/dist/subject/runtime.js +2 -2
- package/dist/subject/serve.d.ts +4 -4
- package/dist/subject/state.d.ts +3 -3
- package/dist/subject/state.js +1 -1
- package/dist/subject/steps.d.ts +1 -1
- package/dist/subject/steps.js +1 -1
- package/dist/substrates/desktop-session.js +2 -2
- package/dist/substrates/detached.d.ts +1 -1
- package/dist/substrates/e2b/desktop-browser.d.ts +4 -4
- package/dist/substrates/e2b/desktop-browser.js +1 -1
- package/dist/substrates/e2b/desktop-cdp.d.ts +1 -1
- package/dist/substrates/e2b/desktop-cdp.js +1 -1
- package/dist/substrates/e2b/desktop-executor.d.ts +1 -1
- package/dist/substrates/e2b/desktop-executor.js +12 -12
- package/dist/substrates/e2b/desktop-geometry.d.ts +1 -1
- package/dist/substrates/e2b/desktop-geometry.js +1 -1
- package/dist/substrates/e2b/desktop-media.d.ts +3 -3
- package/dist/substrates/e2b/lifetime.js +1 -1
- package/dist/substrates/e2b/sandbox.d.ts +3 -3
- package/dist/substrates/e2b/sandbox.js +1 -1
- package/dist/substrates/e2b/sdk.d.ts +1 -1
- package/dist/substrates/e2b/sdk.js +1 -1
- package/dist/substrates/local/runtime-config.d.ts +4 -4
- package/dist/substrates/local/runtime-config.js +4 -4
- package/dist/tui/contract.d.ts +8 -8
- package/dist/tui/contract.js +2 -2
- package/dist/tui/launch.d.ts +3 -3
- package/dist/tui/launch.js +22 -16
- package/dist/tui-app.js +139 -139
- package/dist/verify/subject.d.ts +1 -1
- package/dist/verify/subject.js +1 -1
- package/dist/verify/verify.js +2 -1
- package/docs/architecture/actor-contract.md +5 -5
- package/docs/architecture/browser-control.md +1 -1
- package/docs/architecture/external-public-shared-world.md +8 -7
- package/docs/architecture/github-feedback-loop.md +1 -1
- package/docs/architecture/task-protocol-support.md +1 -1
- package/docs/architecture/terminal-product-route.md +18 -18
- package/docs/contracts/adapter-fixtures.md +2 -2
- package/docs/contracts/errors.md +8 -8
- package/docs/contracts/run-bundle.md +1 -4
- package/docs/contracts/schemas.md +61 -42
- package/docs/contracts/study-analysis.md +4 -1
- package/docs/contracts/study-costs.md +17 -2
- package/examples/README.md +1 -1
- package/examples/scorer/scorer.mjs +3 -3
- package/package.json +1 -1
- package/skills/humanish/SKILL.md +8 -6
- package/skills/humanish/agents/openai.yaml +1 -1
- package/dist/cli/commands/lab-format.d.ts +0 -9
- package/dist/cli/commands/lab-route-run.d.ts +0 -19
- package/dist/cli/commands/lab-route-scripted.d.ts +0 -17
- package/dist/cli/commands/lab-route-terminal.d.ts +0 -17
- package/dist/cli/commands/lab-run.d.ts +0 -9
- package/dist/lab/composition-rules.d.ts +0 -7
- package/dist/lab/config.d.ts +0 -7
- package/dist/lab/deprecated-fields.d.ts +0 -10
- package/dist/lab/deprecated-fields.js +0 -24
- package/dist/lab/parse/comms.d.ts +0 -12
- package/dist/lab/parse/execution.d.ts +0 -19
- package/dist/lab/plan.d.ts +0 -13
- package/dist/lab/preflight-probes.d.ts +0 -3
- package/dist/lab/preflight-result.d.ts +0 -8
- package/dist/lab/route-inputs.d.ts +0 -28
- package/dist/lab/run-lab-homes.js +0 -7
- package/dist/lab/run-lab-options.d.ts +0 -28
- package/dist/library-aliases.d.ts +0 -56
- package/dist/library-aliases.js +0 -22
- package/dist/run-lab.d.ts +0 -112
- /package/dist/{lab → study}/device-presets.js +0 -0
- /package/dist/{lab → study}/init-paths.d.ts +0 -0
- /package/dist/{lab → study}/init-paths.js +0 -0
- /package/dist/{lab → study}/init-plan.d.ts +0 -0
- /package/dist/{lab → study}/init-plan.js +0 -0
- /package/dist/{lab → study}/parse/comms.js +0 -0
- /package/dist/{lab → study}/parse/execution.js +0 -0
- /package/dist/{lab → study}/parse/values.js +0 -0
- /package/dist/{lab → study}/participant-assignment.d.ts +0 -0
- /package/dist/{lab → study}/participant-assignment.js +0 -0
- /package/dist/{lab → study}/persona.d.ts +0 -0
- /package/dist/{lab → study}/persona.js +0 -0
- /package/dist/{lab → study}/routing.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {} from "../contract.js";
|
|
2
2
|
import { defaultCodexCliVersion, untestedOperatorReleaseWarning } from "./codex-admission.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ComputerUseProviderError, isComputerUseProviderError, } from "../computer-use/provider-error.js";
|
|
4
4
|
import { validateBrowserControlPng, validateHeardSpeech } from "../../browser-control/protocol.js";
|
|
5
5
|
import { createRestrictedCodexSession, } from "./restricted-session.js";
|
|
6
6
|
import { PARTICIPANT_PROFILE, PARTICIPANT_LIMITS as L, PARTICIPANT_FINAL_SCHEMA, participantToolSchema, parseParticipantTool, parseParticipantFinal, } from "./restricted-participant-policy.js";
|
|
@@ -150,15 +150,15 @@ const runReceipt = (result) => ({
|
|
|
150
150
|
*/
|
|
151
151
|
function finalTurn(result, receipt, usage, stopped) {
|
|
152
152
|
if (stopped.stopped)
|
|
153
|
-
throw new
|
|
153
|
+
throw new ComputerUseProviderError(stopped.failedCleanup ? "cleanup_unconfirmed" : "cancelled", receipt, usage, result.failurePhase);
|
|
154
154
|
if (result.status !== "completed" || result.errorCode !== null)
|
|
155
|
-
throw new
|
|
155
|
+
throw new ComputerUseProviderError(codeOf(result.errorCode), receipt, usage, result.failurePhase);
|
|
156
156
|
let turn;
|
|
157
157
|
try {
|
|
158
158
|
turn = parseParticipantFinal(result.output);
|
|
159
159
|
}
|
|
160
160
|
catch {
|
|
161
|
-
throw new
|
|
161
|
+
throw new ComputerUseProviderError("invalid_response", receipt, usage, "response");
|
|
162
162
|
}
|
|
163
163
|
return {
|
|
164
164
|
...turn,
|
|
@@ -340,9 +340,9 @@ function launchNativeRun(settings, state, req, imageUrl) {
|
|
|
340
340
|
catch (error) {
|
|
341
341
|
revokeParticipant(state);
|
|
342
342
|
state.events.emit({
|
|
343
|
-
error:
|
|
343
|
+
error: isComputerUseProviderError(error)
|
|
344
344
|
? error
|
|
345
|
-
: new
|
|
345
|
+
: new ComputerUseProviderError("process_failed", { dispatched: "unknown", usageComplete: false, cleanup: "unconfirmed" }, usage),
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
348
|
finally {
|
|
@@ -356,7 +356,7 @@ async function runParticipantTurn(settings, state, req, signal, debrief) {
|
|
|
356
356
|
return state.events.next();
|
|
357
357
|
if (signal.aborted) {
|
|
358
358
|
revokeParticipant(state);
|
|
359
|
-
throw new
|
|
359
|
+
throw new ComputerUseProviderError("cancelled", noDispatch());
|
|
360
360
|
}
|
|
361
361
|
const conversation = {
|
|
362
362
|
instructions: state.instructions,
|
|
@@ -365,7 +365,7 @@ async function runParticipantTurn(settings, state, req, signal, debrief) {
|
|
|
365
365
|
lastActionCount: state.lastActionCount,
|
|
366
366
|
};
|
|
367
367
|
if (rejectsParticipantRequest(req, conversation))
|
|
368
|
-
throw new
|
|
368
|
+
throw new ComputerUseProviderError("request_rejected", noDispatch());
|
|
369
369
|
const onAbort = () => {
|
|
370
370
|
revokeParticipant(state);
|
|
371
371
|
};
|
|
@@ -382,7 +382,7 @@ async function runParticipantTurn(settings, state, req, signal, debrief) {
|
|
|
382
382
|
else if (!state.active)
|
|
383
383
|
launchNativeRun(settings, state, req, imageUrl);
|
|
384
384
|
else
|
|
385
|
-
throw new
|
|
385
|
+
throw new ComputerUseProviderError("busy", noDispatch());
|
|
386
386
|
return await state.events.next();
|
|
387
387
|
}
|
|
388
388
|
finally {
|
|
@@ -426,7 +426,7 @@ function participantProvider(settings, state, start) {
|
|
|
426
426
|
export function createRestrictedCodexParticipant(options = {}) {
|
|
427
427
|
const timeoutMs = options.requestTimeoutMs ?? L.requestMs;
|
|
428
428
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > L.requestMs)
|
|
429
|
-
throw new
|
|
429
|
+
throw new ComputerUseProviderError("request_rejected", noDispatch());
|
|
430
430
|
const operator = options.authMode === "operator";
|
|
431
431
|
const speechEnabled = options.speechEnabled === true;
|
|
432
432
|
const settings = {
|
|
@@ -458,9 +458,9 @@ export function createRestrictedCodexParticipant(options = {}) {
|
|
|
458
458
|
let pending, closing;
|
|
459
459
|
const start = (req, signal, debrief) => {
|
|
460
460
|
if (state.closed && !state.events.waiting)
|
|
461
|
-
return Promise.reject(new
|
|
461
|
+
return Promise.reject(new ComputerUseProviderError("request_rejected", noDispatch()));
|
|
462
462
|
if (pending)
|
|
463
|
-
return Promise.reject(new
|
|
463
|
+
return Promise.reject(new ComputerUseProviderError("busy", noDispatch()));
|
|
464
464
|
const task = runParticipantTurn(settings, state, req, signal, debrief);
|
|
465
465
|
pending = task;
|
|
466
466
|
void task
|
|
@@ -13,8 +13,8 @@ export interface RestrictedCodexSessionOptions {
|
|
|
13
13
|
cliVersion?: string;
|
|
14
14
|
/**
|
|
15
15
|
* Bypasses launch admission: admits exactly this list. It exists only so
|
|
16
|
-
* scripts/codex-qualify.mjs can launch a candidate admission would refuse. No library export,
|
|
17
|
-
* manifest, CLI flag,
|
|
16
|
+
* scripts/codex-qualify.mjs can launch a candidate admission would refuse. No library export, study
|
|
17
|
+
* manifest, CLI flag, RunStudyOptions field or StudyDeps seam reaches it
|
|
18
18
|
* (tests/actors/codex/cli-versions-seam.test.ts).
|
|
19
19
|
*/
|
|
20
20
|
cliVersions?: readonly string[];
|
|
@@ -4,7 +4,7 @@ import { type E2BDesktopExecutorOptions, type E2BDesktopLike } from "../../subst
|
|
|
4
4
|
import { type OpenAiResponsesProviderOptions } from "./openai-provider.js";
|
|
5
5
|
import { type RedactionHooks } from "../../evidence/redaction.js";
|
|
6
6
|
import type { DwellWindow, StopWhen } from "../stop-conditions.js";
|
|
7
|
-
import type {
|
|
7
|
+
import type { StudyTask } from "../../study/tasks.js";
|
|
8
8
|
export interface CuaActorSessionOptions {
|
|
9
9
|
/** The composed mission (persona + scenario/participant instruction) handed to the model. */
|
|
10
10
|
instructions: string;
|
|
@@ -51,10 +51,10 @@ export interface CuaActorSessionOptions {
|
|
|
51
51
|
stopWhen?: StopWhen;
|
|
52
52
|
/** A declared observation window, forwarded to the loop. */
|
|
53
53
|
dwell?: DwellWindow;
|
|
54
|
-
/** The
|
|
54
|
+
/** The study's declared protocol; the loop records a corroborated task funnel on the trace.
|
|
55
55
|
* Only the `success` criteria are read here; the participant-facing goals are already composed
|
|
56
56
|
* into `instructions` upstream, and the criteria never reach the prompt. */
|
|
57
|
-
tasks?: readonly
|
|
57
|
+
tasks?: readonly StudyTask[];
|
|
58
58
|
/** Fail-closed spend cap (USD) threaded to the loop; absent = uncapped. See CuaLoopOptions.maxUsd. */
|
|
59
59
|
maxUsd?: number;
|
|
60
60
|
/** Injected pure per-turn cost estimator paired with `maxUsd`. See CuaLoopOptions.estimateTurnCostUsd. */
|
|
@@ -64,12 +64,12 @@ export interface CuaActorSessionOptions {
|
|
|
64
64
|
/** Stricter unknown-usage policy for capped sessions (see CuaLoopOptions); it also makes the
|
|
65
65
|
* OpenAI provider send one HTTP dispatch per turn. Library-only. */
|
|
66
66
|
requireReportedUsageForSpendCap?: boolean;
|
|
67
|
-
/** Runtime-only observed-URL callback threaded to the loop; see
|
|
67
|
+
/** Runtime-only observed-URL callback threaded to the loop; see LoopTaps.onObservedUrl. Used by
|
|
68
68
|
* the concurrent shared-world handoff barrier to latch a host's live /lobby/CODE URL. */
|
|
69
69
|
onObservedUrl?: (url: string | undefined) => void;
|
|
70
|
-
/** Runtime-only per-turn narration callback threaded to the loop; see
|
|
70
|
+
/** Runtime-only per-turn narration callback threaded to the loop; see LoopTaps.onMessage. */
|
|
71
71
|
onMessage?: (text: string) => void;
|
|
72
|
-
/** Runtime-only per-turn raw-frame callback threaded to the loop; see
|
|
72
|
+
/** Runtime-only per-turn raw-frame callback threaded to the loop; see LoopTaps.onScreenshot. */
|
|
73
73
|
onScreenshot?: (frame: Buffer) => void;
|
|
74
74
|
/** Per-turn trace snapshot callback threaded to the loop; see CuaLoopOptions.onTrace. */
|
|
75
75
|
onTrace?: (items: readonly ActorTraceItem[], usage: ActorTokenUsage, metadata?: CuaLiveMetadata) => void;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
//
|
|
8
8
|
// The loop already returns a fully-formed ActorTrace at result.trace, so there is no separate
|
|
9
9
|
// toActorTrace mapper: runCuaActorSession returns the CuaLoopResult unchanged.
|
|
10
|
-
import {
|
|
10
|
+
import { runComputerUseLoopWithTaps, } from "./loop.js";
|
|
11
11
|
import { createE2BDesktopExecutor, } from "../../substrates/e2b/desktop-executor.js";
|
|
12
12
|
import { createOpenAiResponsesProvider, } from "./openai-provider.js";
|
|
13
13
|
import { defaultRedactionHooks } from "../../evidence/redaction.js";
|
|
@@ -55,7 +55,7 @@ export async function runCuaActorSession(options) {
|
|
|
55
55
|
...(options.onScreenshot === undefined ? {} : { onScreenshot: options.onScreenshot }),
|
|
56
56
|
...(options.onTrace === undefined ? {} : { onTrace: options.onTrace }),
|
|
57
57
|
};
|
|
58
|
-
const result = await
|
|
58
|
+
const result = await runComputerUseLoopWithTaps(loopOptions);
|
|
59
59
|
if (result.trace.executionProfile?.billing === "account-unknown") {
|
|
60
60
|
result.trace.estimatedCost = estimateActorCostForExecution(result.trace.tokenUsage, result.trace.ids.model, result.trace.executionProfile);
|
|
61
61
|
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* outcome or usage is unknown. Import this class from the same humanish installation as the
|
|
6
6
|
* loop/provider; names, message text and lookalike objects are not the contract.
|
|
7
7
|
*/
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class ComputerUseAdmissionLimitError extends Error {
|
|
9
9
|
constructor();
|
|
10
10
|
}
|
|
11
11
|
/** Internal nominal check: neither a matching payload nor a forged prototype is a declaration. */
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function isComputerUseAdmissionLimitError(error: unknown): error is ComputerUseAdmissionLimitError;
|
|
@@ -6,14 +6,14 @@ const admissionLimits = new WeakSet();
|
|
|
6
6
|
* outcome or usage is unknown. Import this class from the same humanish installation as the
|
|
7
7
|
* loop/provider; names, message text and lookalike objects are not the contract.
|
|
8
8
|
*/
|
|
9
|
-
export class
|
|
9
|
+
export class ComputerUseAdmissionLimitError extends Error {
|
|
10
10
|
constructor() {
|
|
11
11
|
super("The adapter refused the request before provider dispatch because a local admission limit was reached.");
|
|
12
|
-
this.name = "
|
|
12
|
+
this.name = "ComputerUseAdmissionLimitError";
|
|
13
13
|
admissionLimits.add(this);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
/** Internal nominal check: neither a matching payload nor a forged prototype is a declaration. */
|
|
17
|
-
export function
|
|
17
|
+
export function isComputerUseAdmissionLimitError(error) {
|
|
18
18
|
return typeof error === "object" && error !== null && admissionLimits.has(error);
|
|
19
19
|
}
|
|
@@ -21,11 +21,11 @@ export declare function isCuaExecutorErrorCode(value: unknown): value is CuaExec
|
|
|
21
21
|
* began; a lost acknowledgement or partial action is `outcome_uncertain`, never a retry.
|
|
22
22
|
* Import from the same installation as the loop: names and lookalike objects do not qualify.
|
|
23
23
|
*/
|
|
24
|
-
export declare class
|
|
24
|
+
export declare class ComputerUseExecutorError extends Error {
|
|
25
25
|
readonly code: CuaExecutorErrorCode;
|
|
26
26
|
readonly disposition: CuaExecutorDisposition;
|
|
27
27
|
constructor(code: CuaExecutorErrorCode, disposition: CuaExecutorDisposition);
|
|
28
28
|
}
|
|
29
29
|
/** A forged prototype is not an executor declaration. */
|
|
30
|
-
export declare function
|
|
30
|
+
export declare function isComputerUseExecutorError(error: unknown): error is ComputerUseExecutorError;
|
|
31
31
|
export {};
|
|
@@ -22,7 +22,7 @@ const executorErrors = new WeakSet();
|
|
|
22
22
|
* began; a lost acknowledgement or partial action is `outcome_uncertain`, never a retry.
|
|
23
23
|
* Import from the same installation as the loop: names and lookalike objects do not qualify.
|
|
24
24
|
*/
|
|
25
|
-
export class
|
|
25
|
+
export class ComputerUseExecutorError extends Error {
|
|
26
26
|
code;
|
|
27
27
|
disposition;
|
|
28
28
|
constructor(code, disposition) {
|
|
@@ -31,7 +31,7 @@ export class CuaExecutorError extends Error {
|
|
|
31
31
|
throw new TypeError("Invalid desktop executor error declaration.");
|
|
32
32
|
}
|
|
33
33
|
super(messages[code]);
|
|
34
|
-
this.name = "
|
|
34
|
+
this.name = "ComputerUseExecutorError";
|
|
35
35
|
this.code = code;
|
|
36
36
|
this.disposition = disposition;
|
|
37
37
|
// Keep the values used in durable diagnostics finite even for JavaScript callers.
|
|
@@ -43,6 +43,6 @@ export class CuaExecutorError extends Error {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
/** A forged prototype is not an executor declaration. */
|
|
46
|
-
export function
|
|
46
|
+
export function isComputerUseExecutorError(error) {
|
|
47
47
|
return typeof error === "object" && error !== null && executorErrors.has(error);
|
|
48
48
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { classifyCuaAction } from "../../affordance.js";
|
|
2
2
|
import { commandFailureInfo, isCommandExitError } from "../../../substrates/command-failure.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ComputerUseExecutorError, isComputerUseExecutorError } from "../executor-error.js";
|
|
4
4
|
import { CuaAbortError, CuaDeadlineError, CuaStallError, raceCallBound, raceSessionDeadline, requestScope, } from "./race.js";
|
|
5
5
|
import { notice } from "./trace.js";
|
|
6
6
|
// The participant's actions: their public labels, what counts as a material action, and how one
|
|
@@ -131,7 +131,7 @@ export async function runActionBatch(session, actions) {
|
|
|
131
131
|
status = await dispatchAction(session, action, title);
|
|
132
132
|
}
|
|
133
133
|
catch (error) {
|
|
134
|
-
const declared =
|
|
134
|
+
const declared = isComputerUseExecutorError(error)
|
|
135
135
|
? error.disposition
|
|
136
136
|
: isCommandExitError(error)
|
|
137
137
|
? "skipped"
|
|
@@ -139,7 +139,7 @@ export async function runActionBatch(session, actions) {
|
|
|
139
139
|
if (declared !== undefined)
|
|
140
140
|
execution.actions.push({ index, status: declared });
|
|
141
141
|
countAttempt(session, action, title, declared);
|
|
142
|
-
if (
|
|
142
|
+
if (isComputerUseExecutorError(error) &&
|
|
143
143
|
error.code === "action_rejected" &&
|
|
144
144
|
error.disposition === "not_dispatched") {
|
|
145
145
|
// Later actions may depend on this one (type, then submit). Return
|
|
@@ -150,7 +150,7 @@ export async function runActionBatch(session, actions) {
|
|
|
150
150
|
trace.record("notice", () => notice("warn", "action rejected before dispatch", session.redactNarration(`action: ${title}; code: action_rejected; disposition: not_dispatched; remaining batch actions not dispatched: ${actions.length - index - 1}`)));
|
|
151
151
|
return { execution, hint: rejectedActionHint(title) };
|
|
152
152
|
}
|
|
153
|
-
if (
|
|
153
|
+
if (isComputerUseExecutorError(error) || !isCommandExitError(error))
|
|
154
154
|
throw error;
|
|
155
155
|
// A skipped action changes nothing on screen, so a persistently-failing run makes no
|
|
156
156
|
// progress and still terminates via the idle/no-progress backstop (gave_up),
|
|
@@ -213,7 +213,7 @@ async function executeAction(session, action, title, boundMs) {
|
|
|
213
213
|
}
|
|
214
214
|
catch (error) {
|
|
215
215
|
if (error instanceof CuaStallError && session.executor.stallRecovery === "fail_closed") {
|
|
216
|
-
throw new
|
|
216
|
+
throw new ComputerUseExecutorError("deadline_exceeded", "outcome_uncertain");
|
|
217
217
|
}
|
|
218
218
|
if (error instanceof CuaDeadlineError || error instanceof CuaAbortError) {
|
|
219
219
|
// The loop's deadline/abort may win before the executor can report whether its
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isComputerUseAdmissionLimitError } from "../admission-limit.js";
|
|
2
2
|
import { singleDispatch } from "./provider-call.js";
|
|
3
3
|
import { CuaDeadlineError, raceSessionDeadline, requestScope } from "./race.js";
|
|
4
4
|
import { notice } from "./trace.js";
|
|
@@ -110,7 +110,7 @@ async function debriefExchange(session, provider, context, trigger, boundMs, rec
|
|
|
110
110
|
}
|
|
111
111
|
catch (error) {
|
|
112
112
|
// A failed optional report cannot rewrite the already observed structured completion.
|
|
113
|
-
if (
|
|
113
|
+
if (isComputerUseAdmissionLimitError(error)) {
|
|
114
114
|
return record("skipped", "the adapter reported a local admission limit before provider dispatch; no closing request was sent");
|
|
115
115
|
}
|
|
116
116
|
const detail = signal?.aborted
|
|
@@ -69,7 +69,7 @@ export declare function providerInterrupted(interruption: NonNullable<CuaTurn["i
|
|
|
69
69
|
* Safety-check categories are provider-defined enums (e.g. "malicious_instructions"), not free
|
|
70
70
|
* text; the evidence records them (redacted for defense-in-depth) so it shows why the run paused.
|
|
71
71
|
*/
|
|
72
|
-
export declare function blockedOnSafetyChecks(checks: string): Stop;
|
|
72
|
+
export declare function blockedOnSafetyChecks(checks: string, count: number): Stop;
|
|
73
73
|
/**
|
|
74
74
|
* A vision provider against a screenshot-less observation is a fail-closed harness error, not a
|
|
75
75
|
* silent crash. The provider sets requiresFrame; a state-reasoning provider omits it.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isComputerUseExecutorError } from "../executor-error.js";
|
|
2
|
+
import { isComputerUsePromptRefusedError, isComputerUseProviderError } from "../provider-error.js";
|
|
3
3
|
import { CuaAbortError, CuaDeadlineError } from "./race.js";
|
|
4
4
|
import { notice } from "./trace.js";
|
|
5
|
+
import { plural } from "../../../run/text.js";
|
|
5
6
|
/**
|
|
6
7
|
* Read the fixed closing line the prompt asks for: the first non-empty line of the
|
|
7
8
|
* participant's last message, exactly one of three phrases, punctuation and case forgiven. Anything
|
|
@@ -67,8 +68,8 @@ export function timeLimit(session) {
|
|
|
67
68
|
return {
|
|
68
69
|
completionReason: "budget_reached",
|
|
69
70
|
reason: session.actionHistory.interruptedActionOutcome
|
|
70
|
-
? `reached the ${timeoutMs}ms time budget with ${materialActions
|
|
71
|
-
: `reached the ${timeoutMs}ms time budget after productive activity (${materialActions
|
|
71
|
+
? `reached the ${timeoutMs}ms time budget with ${plural(materialActions, "material action attempt")}, ${plural(turns, "turn")}; the latest action outcome is uncertain`
|
|
72
|
+
: `reached the ${timeoutMs}ms time budget after productive activity (${plural(materialActions, "material action")}, ${plural(turns, "turn")})`,
|
|
72
73
|
stopCause: "time_limit",
|
|
73
74
|
};
|
|
74
75
|
}
|
|
@@ -82,11 +83,11 @@ export function spendLimit(session, estimate, maxUsd) {
|
|
|
82
83
|
const booked = session.usage.reservedRequests;
|
|
83
84
|
const spend = booked === 0
|
|
84
85
|
? `estimated spend $${estimate}`
|
|
85
|
-
: `estimated spend $${estimate}, including the worst case of ${booked
|
|
86
|
+
: `estimated spend $${estimate}, including the worst case of ${plural(booked, "lost request")},`;
|
|
86
87
|
return {
|
|
87
88
|
completionReason: "budget_reached",
|
|
88
89
|
reason: materialActions > 0
|
|
89
|
-
? `Stopped before the next model turn: ${spend} passed execution.caps.maxUsd=$${maxUsd} after productive activity (${materialActions
|
|
90
|
+
? `Stopped before the next model turn: ${spend} passed execution.caps.maxUsd=$${maxUsd} after productive activity (${plural(materialActions, "material action")}, ${plural(turns, "turn")})`
|
|
90
91
|
: `Stopped before the next model turn: ${spend} passed execution.caps.maxUsd=$${maxUsd} with no material progress`,
|
|
91
92
|
stopCause: "spend_limit",
|
|
92
93
|
};
|
|
@@ -180,10 +181,10 @@ export function providerInterrupted(interruption) {
|
|
|
180
181
|
* Safety-check categories are provider-defined enums (e.g. "malicious_instructions"), not free
|
|
181
182
|
* text; the evidence records them (redacted for defense-in-depth) so it shows why the run paused.
|
|
182
183
|
*/
|
|
183
|
-
export function blockedOnSafetyChecks(checks) {
|
|
184
|
+
export function blockedOnSafetyChecks(checks, count) {
|
|
184
185
|
return {
|
|
185
186
|
completionReason: "blocked_approval",
|
|
186
|
-
reason: `paused on model safety check
|
|
187
|
+
reason: `paused on ${count === 1 ? "a model safety check" : `${count} model safety checks`}: ${checks}; not acknowledged`,
|
|
187
188
|
evidence: {
|
|
188
189
|
kind: "approval",
|
|
189
190
|
body: () => ({ lifecycle: "completed", status: "blocked", title: `safety check: ${checks}` }),
|
|
@@ -258,7 +259,7 @@ export function stopForError(session, error) {
|
|
|
258
259
|
const { lastActionTitle } = session.actionHistory;
|
|
259
260
|
const lastAction = () => lastActionTitle === undefined ? undefined : `last action: ${redact(lastActionTitle)}`;
|
|
260
261
|
const screenshot = session.lastScreenshotRef === undefined ? {} : { screenshotRef: session.lastScreenshotRef };
|
|
261
|
-
if (
|
|
262
|
+
if (isComputerUsePromptRefusedError(error)) {
|
|
262
263
|
// The provider's policy decision about the prompt, not a harness fault; never resent.
|
|
263
264
|
const reason = `${error.message}; the prompt was not sent again`;
|
|
264
265
|
return {
|
|
@@ -268,7 +269,7 @@ export function stopForError(session, error) {
|
|
|
268
269
|
evidence: noticeEvidence("error", "provider refused the prompt", `phase: ${redact(session.phase)}; ${reason}`),
|
|
269
270
|
};
|
|
270
271
|
}
|
|
271
|
-
if (
|
|
272
|
+
if (isComputerUseProviderError(error)) {
|
|
272
273
|
const reason = `participant provider error: ${error.code}${error.failurePhase ? ` during ${error.failurePhase}` : ""}; cleanup: ${error.receipt.cleanup}`;
|
|
273
274
|
return {
|
|
274
275
|
completionReason: "harness_error",
|
|
@@ -276,7 +277,7 @@ export function stopForError(session, error) {
|
|
|
276
277
|
evidence: noticeEvidence("error", "participant provider error", reason),
|
|
277
278
|
};
|
|
278
279
|
}
|
|
279
|
-
if (
|
|
280
|
+
if (isComputerUseExecutorError(error)) {
|
|
280
281
|
const detail = () => [
|
|
281
282
|
`phase: ${redact(session.phase)}`,
|
|
282
283
|
`code: ${error.code}`,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { evaluateStopWhen } from "../../stop-conditions.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ComputerUseExecutorError, isComputerUseExecutorError } from "../executor-error.js";
|
|
3
3
|
import { CUA_SPEECH_LIMITS } from "../speech.js";
|
|
4
4
|
import { dwellCompleted, missingFrame, stopWhenMatched } from "./ending.js";
|
|
5
5
|
import { CuaAbortError, CuaStallError, raceCallBound } from "./race.js";
|
|
6
6
|
import { notice } from "./trace.js";
|
|
7
|
+
import { plural } from "../../../run/text.js";
|
|
7
8
|
// One projection feeds both the stop guard and the task tracker, so a criterion that would stop
|
|
8
9
|
// the run and a criterion that completes a task can never see different evidence for one turn.
|
|
9
10
|
function stopObservationOf(observation) {
|
|
@@ -114,7 +115,7 @@ export class DesktopObserver {
|
|
|
114
115
|
this.observeTasks(final, turnNumber);
|
|
115
116
|
}
|
|
116
117
|
catch (error) {
|
|
117
|
-
if (
|
|
118
|
+
if (isComputerUseExecutorError(error))
|
|
118
119
|
throw error;
|
|
119
120
|
}
|
|
120
121
|
}
|
|
@@ -133,7 +134,7 @@ export class DesktopObserver {
|
|
|
133
134
|
if (executor.stallRecovery === "fail_closed") {
|
|
134
135
|
// The outer bound says nothing about whether the still-pending request completed.
|
|
135
136
|
// The owning session will close it; this loop must not send a replacement request.
|
|
136
|
-
throw new
|
|
137
|
+
throw new ComputerUseExecutorError("deadline_exceeded", "outcome_uncertain");
|
|
137
138
|
}
|
|
138
139
|
session.trace.record("notice", () => notice("warn", "observation stalled; retrying once", `${error.what} produced nothing within ${error.afterMs}ms; asking the desktop again`));
|
|
139
140
|
return await raceCallBound(`observe (${label}, retry)`, executor.observe(), session.remaining(), session.observationTimeoutMs, session.signal);
|
|
@@ -153,7 +154,7 @@ export class DesktopObserver {
|
|
|
153
154
|
this.session.trace.record("notice", () => notice("ok", "speech heard", this.session.redactNarration(utterance.text)));
|
|
154
155
|
}
|
|
155
156
|
if (this.pendingHeardSpeech.length > CUA_SPEECH_LIMITS.utterances) {
|
|
156
|
-
throw new
|
|
157
|
+
throw new ComputerUseExecutorError("invalid_response", "outcome_uncertain");
|
|
157
158
|
}
|
|
158
159
|
return this.pendingHeardSpeech.length === 0
|
|
159
160
|
? observation
|
|
@@ -240,7 +241,7 @@ export class DesktopObserver {
|
|
|
240
241
|
session.trace.record("notice", () => notice(
|
|
241
242
|
// A window that ends the session is structured, harness-owned completion evidence, the
|
|
242
243
|
// same class as a matched stopWhen, and the verdict resolver reads it that way.
|
|
243
|
-
dwell.then === "stop" ? "matched" : "ok", "dwell window complete", `${frames
|
|
244
|
+
dwell.then === "stop" ? "matched" : "ok", "dwell window complete", `${plural(frames, "frame")} over ${heldMs}ms; no model turn was requested during the window`));
|
|
244
245
|
return { next: dwell.then, heldMs };
|
|
245
246
|
}
|
|
246
247
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isComputerUseAdmissionLimitError } from "../admission-limit.js";
|
|
2
|
+
import { ComputerUseProviderError, isComputerUseProviderError } from "../provider-error.js";
|
|
3
3
|
import { adapterLimit, providerStalledTwice, usageUnreported } from "./ending.js";
|
|
4
4
|
import { CuaAbortError, CuaDeadlineError, CuaStallError, raceCallBound, requestScope, } from "./race.js";
|
|
5
5
|
import { bookLostRequest, LostRequestRefused, spendGate } from "./spend.js";
|
|
@@ -32,7 +32,7 @@ export async function requestTurn(session, request, turnNumber) {
|
|
|
32
32
|
catch (error) {
|
|
33
33
|
// Stops are concluded here, before `finally` ends the request scope, so their notices are
|
|
34
34
|
// recorded before any abort listener runs.
|
|
35
|
-
if (
|
|
35
|
+
if (isComputerUseAdmissionLimitError(error))
|
|
36
36
|
return { stop: session.conclude(adapterLimit) };
|
|
37
37
|
if (error instanceof LostRequestRefused)
|
|
38
38
|
return { stop: session.conclude(error.stop) };
|
|
@@ -73,7 +73,7 @@ async function retryStalledTurn(session, request, turnNumber, stall, stalled) {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
catch (retryError) {
|
|
76
|
-
if (
|
|
76
|
+
if (isComputerUseAdmissionLimitError(retryError))
|
|
77
77
|
return { stop: session.conclude(adapterLimit) };
|
|
78
78
|
if (retryError instanceof LostRequestRefused)
|
|
79
79
|
return { stop: session.conclude(retryError.stop) };
|
|
@@ -101,7 +101,7 @@ export async function singleDispatch(session, kind, dispatch, boundMs) {
|
|
|
101
101
|
const pending = Promise.resolve()
|
|
102
102
|
.then(() => {
|
|
103
103
|
if (scope.signal.aborted)
|
|
104
|
-
throw new
|
|
104
|
+
throw new ComputerUseProviderError("cancelled", {
|
|
105
105
|
dispatched: false,
|
|
106
106
|
usageComplete: false,
|
|
107
107
|
cleanup: "confirmed",
|
|
@@ -135,11 +135,11 @@ export async function singleDispatch(session, kind, dispatch, boundMs) {
|
|
|
135
135
|
}
|
|
136
136
|
const failure = "error" in outcome ? outcome.error : undefined;
|
|
137
137
|
const requestSettlement = settlementRef.current;
|
|
138
|
-
const providerError =
|
|
138
|
+
const providerError = isComputerUseProviderError(failure)
|
|
139
139
|
? failure
|
|
140
140
|
: requestSettlement &&
|
|
141
141
|
"error" in requestSettlement &&
|
|
142
|
-
|
|
142
|
+
isComputerUseProviderError(requestSettlement.error)
|
|
143
143
|
? requestSettlement.error
|
|
144
144
|
: undefined;
|
|
145
145
|
const turn = requestSettlement && "turn" in requestSettlement ? requestSettlement.turn : undefined;
|
|
@@ -157,8 +157,8 @@ export async function singleDispatch(session, kind, dispatch, boundMs) {
|
|
|
157
157
|
if (failure instanceof CuaAbortError || failure instanceof CuaDeadlineError)
|
|
158
158
|
throw failure;
|
|
159
159
|
if (failure instanceof CuaStallError)
|
|
160
|
-
throw new
|
|
161
|
-
throw providerError ?? new
|
|
160
|
+
throw new ComputerUseProviderError("timeout", receipt, usage, providerError?.failurePhase);
|
|
161
|
+
throw providerError ?? new ComputerUseProviderError("process_failed", receipt, usage);
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* Whether a single-dispatch turn is a valid turn from a continuing request (see
|
|
@@ -175,7 +175,7 @@ function isContinuingTurn(kind, turn) {
|
|
|
175
175
|
turn.usage !== undefined ||
|
|
176
176
|
turn.interruption !== undefined ||
|
|
177
177
|
turn.closingReport !== undefined) {
|
|
178
|
-
throw new
|
|
178
|
+
throw new ComputerUseProviderError("invalid_response", {
|
|
179
179
|
dispatched: "unknown",
|
|
180
180
|
usageComplete: false,
|
|
181
181
|
cleanup: "unconfirmed",
|
|
@@ -188,7 +188,7 @@ function isContinuingTurn(kind, turn) {
|
|
|
188
188
|
r.dispatched !== true ||
|
|
189
189
|
typeof r.usageComplete !== "boolean" ||
|
|
190
190
|
r.cleanup !== "confirmed") {
|
|
191
|
-
throw new
|
|
191
|
+
throw new ComputerUseProviderError("invalid_response", { dispatched: "unknown", usageComplete: false, cleanup: "unconfirmed" }, turn.usage);
|
|
192
192
|
}
|
|
193
193
|
return false;
|
|
194
194
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ActorTraceItem, ParticipantDeclaredOutcome } from "../../contract.js";
|
|
2
2
|
import type { AffordanceObservation } from "../../affordance.js";
|
|
3
|
-
import { TaskTracker } from "../../../
|
|
3
|
+
import { TaskTracker } from "../../../study/tasks.js";
|
|
4
4
|
import type { DebriefTrigger, Stop } from "./ending.js";
|
|
5
5
|
import { TraceRecorder } from "./trace.js";
|
|
6
|
-
import type { CuaExecutor,
|
|
6
|
+
import type { CuaExecutor, CuaProvider, CuaSafetyCheck, LoopRunOptions } from "./types.js";
|
|
7
7
|
import { UsageLedger } from "./usage.js";
|
|
8
8
|
export type ScreenshotRef = NonNullable<ActorTraceItem["screenshotRef"]>;
|
|
9
9
|
/**
|
|
@@ -11,7 +11,7 @@ export type ScreenshotRef = NonNullable<ActorTraceItem["screenshotRef"]>;
|
|
|
11
11
|
* wrapped callbacks are fields on LoopSession instead. Callers destructure hooks to call them.
|
|
12
12
|
*/
|
|
13
13
|
export type LoopSettings = {
|
|
14
|
-
readonly [K in "instructions" | "persona" | "redaction" | "stopWhen" | "dwell" | "tasks" | "maxUsd" | "overRunBudget" | "estimateTurnCostUsd" | "onObservedUrl" | "onMessage" | "onScreenshot" | "onTrace"]:
|
|
14
|
+
readonly [K in "instructions" | "persona" | "redaction" | "stopWhen" | "dwell" | "tasks" | "maxUsd" | "overRunBudget" | "estimateTurnCostUsd" | "onObservedUrl" | "onMessage" | "onScreenshot" | "onTrace"]: LoopRunOptions[K];
|
|
15
15
|
};
|
|
16
16
|
/** The participant's dispatched actions, as the backstop and failure notices describe them. */
|
|
17
17
|
export interface ActionHistory {
|
|
@@ -63,7 +63,7 @@ export declare class LoopSession {
|
|
|
63
63
|
debriefTrigger: DebriefTrigger | undefined;
|
|
64
64
|
private stopCause;
|
|
65
65
|
private readonly scrubText;
|
|
66
|
-
constructor(options:
|
|
66
|
+
constructor(options: LoopRunOptions);
|
|
67
67
|
remaining(): number;
|
|
68
68
|
redactNarration(text: string): string;
|
|
69
69
|
/** Hand a watcher the trace so far with the running usage, without waiting on it. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TaskTracker } from "../../../
|
|
1
|
+
import { TaskTracker } from "../../../study/tasks.js";
|
|
2
2
|
import { TraceRecorder } from "./trace.js";
|
|
3
3
|
import { UsageLedger } from "./usage.js";
|
|
4
4
|
// The state one loop session shares across its phases: the options as read at entry, the session
|
|
@@ -107,7 +107,7 @@ export class LoopSession {
|
|
|
107
107
|
}
|
|
108
108
|
// Model-authored narration: literal-scrub known provisioned values, then pattern-redact.
|
|
109
109
|
// A value the model transcribes (a DB password it read on screen) has no shape, so redactText
|
|
110
|
-
// alone cannot catch it; the
|
|
110
|
+
// alone cannot catch it; the run's scrubKnownValues, injected as scrubText, closes that.
|
|
111
111
|
redactNarration(text) {
|
|
112
112
|
return this.settings.redaction.redactText(this.scrubText(text));
|
|
113
113
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { summarizeAffordanceUse } from "../../affordance.js";
|
|
2
2
|
import { ACTOR_TRACE_SCHEMA, } from "../../contract.js";
|
|
3
|
+
import { plural } from "../../../run/text.js";
|
|
3
4
|
export function notice(status, title, text) {
|
|
4
5
|
return { lifecycle: "completed", status, title, text };
|
|
5
6
|
}
|
|
@@ -76,8 +77,8 @@ export function loopResult(session, stop, debrief) {
|
|
|
76
77
|
const screenshotNote = !(counts.screenshots > 0)
|
|
77
78
|
? "no screenshots captured"
|
|
78
79
|
: session.redactScreenshots
|
|
79
|
-
? `${counts.screenshots
|
|
80
|
-
: `${counts.screenshots
|
|
80
|
+
? `${plural(counts.screenshots, "screenshot")} redacted to blurred thumbnails via RedactionHooks`
|
|
81
|
+
: `${plural(counts.screenshots, "unblurred screenshot")} kept for local use and not redacted for publishing; set redactScreenshots to blur screenshots in a bundle you plan to share`;
|
|
81
82
|
// Self-describing artifact: when any observation carried structured app state,
|
|
82
83
|
// the trace says how the loop handled it: it fed progress and task checks and was not written to
|
|
83
84
|
// the trace. The appState itself never appears in this bundle.
|