pi-agent-browser-native 0.9.4 → 0.9.6
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/CHANGELOG.md +48 -0
- package/README.md +60 -812
- package/dist/extensions/agent-browser/index.js +2381 -1706
- package/dist/packaged/lib/browser-session-conversion.js +2810 -0
- package/dist/packaged/lib/config-policy.js +599 -0
- package/dist/packaged/lib/parsing.js +34 -0
- package/dist/packaged/lib/playbook.js +694 -0
- package/dist/packaged/lib/results/snapshot.js +2671 -0
- package/dist/packaged/lib/runtime.js +3027 -0
- package/docs/ARCHITECTURE.md +14 -3
- package/docs/CODE_QUALITY.md +39 -3
- package/docs/COMMAND_REFERENCE.md +22 -22
- package/docs/ELECTRON.md +24 -2
- package/docs/PERFORMANCE.md +243 -0
- package/docs/REFERENCE.md +869 -0
- package/docs/RELEASE.md +9 -9
- package/docs/REQUIREMENTS.md +1 -1
- package/docs/SESSION_STORAGE.md +11 -3
- package/docs/SUPPORT_MATRIX.md +16 -11
- package/docs/TOOL_CONTRACT.md +17 -13
- package/docs/performance/2026-10-12.json +7257 -0
- package/docs/platform-smoke.md +3 -3
- package/package.json +15 -3
- package/scripts/build.mjs +16 -5
- package/scripts/config.mjs +24 -20
- package/scripts/convert-browser-session.mjs +1 -1
- package/scripts/doctor.mjs +2 -2
- package/scripts/platform-smoke/lease-evidence.mjs +2 -4
- package/scripts/platform-smoke/linux-image/Dockerfile +8 -2
- package/scripts/platform-smoke/targets.mjs +1 -5
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +0 -123
- package/dist/extensions/agent-browser/lib/argv-grammar.js +0 -320
- package/dist/extensions/agent-browser/lib/bash-guard.js +0 -193
- package/dist/extensions/agent-browser/lib/batch-lifecycle.js +0 -131
- package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +0 -61
- package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +0 -232
- package/dist/extensions/agent-browser/lib/browser-execution-claims.js +0 -202
- package/dist/extensions/agent-browser/lib/browser-execution-identity.js +0 -77
- package/dist/extensions/agent-browser/lib/browser-journal-branch.js +0 -98
- package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/browser-journal-projection.js +0 -221
- package/dist/extensions/agent-browser/lib/browser-journal-reader.js +0 -89
- package/dist/extensions/agent-browser/lib/browser-journal-replay.js +0 -246
- package/dist/extensions/agent-browser/lib/browser-journal.js +0 -148
- package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +0 -220
- package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +0 -282
- package/dist/extensions/agent-browser/lib/browser-legacy-types.js +0 -1
- package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +0 -217
- package/dist/extensions/agent-browser/lib/browser-session-conversion.js +0 -126
- package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +0 -35
- package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +0 -166
- package/dist/extensions/agent-browser/lib/browser-transcript.js +0 -189
- package/dist/extensions/agent-browser/lib/browser-value-parsing.js +0 -15
- package/dist/extensions/agent-browser/lib/command-capabilities.js +0 -340
- package/dist/extensions/agent-browser/lib/command-policy.js +0 -155
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +0 -105
- package/dist/extensions/agent-browser/lib/config-policy.js +0 -450
- package/dist/extensions/agent-browser/lib/config-providers.js +0 -71
- package/dist/extensions/agent-browser/lib/config-validation.js +0 -218
- package/dist/extensions/agent-browser/lib/config.js +0 -69
- package/dist/extensions/agent-browser/lib/electron/cdp.js +0 -58
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +0 -308
- package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +0 -109
- package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +0 -136
- package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +0 -89
- package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +0 -93
- package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +0 -162
- package/dist/extensions/agent-browser/lib/electron/discovery-types.js +0 -2
- package/dist/extensions/agent-browser/lib/electron/discovery.js +0 -217
- package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +0 -102
- package/dist/extensions/agent-browser/lib/electron/launch-process.js +0 -209
- package/dist/extensions/agent-browser/lib/electron/launch-types.js +0 -2
- package/dist/extensions/agent-browser/lib/electron/launch.js +0 -329
- package/dist/extensions/agent-browser/lib/executable-path.js +0 -29
- package/dist/extensions/agent-browser/lib/execution-cwd.js +0 -67
- package/dist/extensions/agent-browser/lib/fs-utils.js +0 -18
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +0 -201
- package/dist/extensions/agent-browser/lib/input-modes/job.js +0 -195
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +0 -104
- package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +0 -132
- package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +0 -57
- package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +0 -151
- package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +0 -142
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +0 -83
- package/dist/extensions/agent-browser/lib/input-modes/params.js +0 -195
- package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +0 -268
- package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +0 -117
- package/dist/extensions/agent-browser/lib/input-modes/script-child.js +0 -396
- package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +0 -86
- package/dist/extensions/agent-browser/lib/input-modes/script-types.js +0 -1
- package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +0 -60
- package/dist/extensions/agent-browser/lib/input-modes/script.js +0 -108
- package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +0 -243
- package/dist/extensions/agent-browser/lib/input-modes/shared.js +0 -48
- package/dist/extensions/agent-browser/lib/input-modes/types.js +0 -65
- package/dist/extensions/agent-browser/lib/json-schema.js +0 -65
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +0 -212
- package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +0 -165
- package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +0 -58
- package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +0 -244
- package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +0 -84
- package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +0 -119
- package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +0 -83
- package/dist/extensions/agent-browser/lib/managed-session-restore.js +0 -212
- package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +0 -277
- package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +0 -181
- package/dist/extensions/agent-browser/lib/managed-session-storage.js +0 -126
- package/dist/extensions/agent-browser/lib/native-confirmation.js +0 -140
- package/dist/extensions/agent-browser/lib/native-output.js +0 -81
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +0 -30
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +0 -188
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +0 -82
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +0 -406
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +0 -31
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +0 -240
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +0 -202
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +0 -109
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +0 -119
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +0 -147
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +0 -144
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +0 -123
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +0 -156
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +0 -179
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +0 -39
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +0 -89
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +0 -97
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +0 -106
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +0 -110
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +0 -53
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +0 -224
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +0 -290
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +0 -167
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +0 -108
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +0 -174
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +0 -65
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +0 -120
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +0 -192
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +0 -225
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +0 -150
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +0 -165
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +0 -147
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +0 -145
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +0 -159
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +0 -131
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +0 -93
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +0 -42
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +0 -242
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +0 -75
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +0 -92
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +0 -254
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +0 -121
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +0 -130
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +0 -114
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +0 -121
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +0 -222
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +0 -68
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +0 -202
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +0 -191
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +0 -152
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +0 -150
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +0 -115
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +0 -256
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +0 -256
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +0 -93
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +0 -113
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +0 -316
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +0 -28
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +0 -142
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +0 -333
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +0 -71
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +0 -201
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +0 -183
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +0 -200
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +0 -142
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +0 -25
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +0 -50
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +0 -198
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +0 -154
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +0 -80
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +0 -14
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +0 -206
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +0 -130
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +0 -210
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +0 -61
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +0 -187
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +0 -171
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +0 -228
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +0 -117
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +0 -256
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +0 -108
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/types.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +0 -39
- package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +0 -119
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +0 -92
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +0 -58
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +0 -78
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +0 -106
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +0 -60
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +0 -86
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +0 -69
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +0 -167
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +0 -164
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +0 -161
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +0 -165
- package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +0 -98
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +0 -211
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +0 -23
- package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +0 -99
- package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +0 -275
- package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +0 -280
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +0 -303
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +0 -36
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +0 -335
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +0 -227
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +0 -204
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +0 -139
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +0 -24
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +0 -98
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +0 -295
- package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +0 -41
- package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +0 -7
- package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +0 -102
- package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +0 -133
- package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +0 -120
- package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +0 -180
- package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +0 -290
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +0 -269
- package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +0 -113
- package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +0 -146
- package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +0 -58
- package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +0 -62
- package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +0 -54
- package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +0 -313
- package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +0 -62
- package/dist/extensions/agent-browser/lib/orchestration/native-config.js +0 -144
- package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +0 -77
- package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +0 -231
- package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +0 -142
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +0 -276
- package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +0 -220
- package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +0 -55
- package/dist/extensions/agent-browser/lib/page-target-batch.js +0 -118
- package/dist/extensions/agent-browser/lib/page-target-guards.js +0 -50
- package/dist/extensions/agent-browser/lib/page-target-navigation.js +0 -104
- package/dist/extensions/agent-browser/lib/page-target-validation.js +0 -90
- package/dist/extensions/agent-browser/lib/parsing.js +0 -30
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +0 -343
- package/dist/extensions/agent-browser/lib/playbook.js +0 -146
- package/dist/extensions/agent-browser/lib/process-child.js +0 -284
- package/dist/extensions/agent-browser/lib/process-environment.js +0 -48
- package/dist/extensions/agent-browser/lib/process-errors.js +0 -23
- package/dist/extensions/agent-browser/lib/process-identity.js +0 -127
- package/dist/extensions/agent-browser/lib/process-socket-storage.js +0 -256
- package/dist/extensions/agent-browser/lib/process-stdout.js +0 -74
- package/dist/extensions/agent-browser/lib/process.js +0 -216
- package/dist/extensions/agent-browser/lib/prompt-artifacts.js +0 -287
- package/dist/extensions/agent-browser/lib/prompt-policy.js +0 -54
- package/dist/extensions/agent-browser/lib/read-command.js +0 -41
- package/dist/extensions/agent-browser/lib/read-confirmation.js +0 -162
- package/dist/extensions/agent-browser/lib/recording-reservations.js +0 -208
- package/dist/extensions/agent-browser/lib/redaction-fields.js +0 -75
- package/dist/extensions/agent-browser/lib/redaction-json.js +0 -149
- package/dist/extensions/agent-browser/lib/redaction-url.js +0 -88
- package/dist/extensions/agent-browser/lib/results/action-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/action-recommendations.js +0 -38
- package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +0 -133
- package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +0 -173
- package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +0 -73
- package/dist/extensions/agent-browser/lib/results/categories.js +0 -152
- package/dist/extensions/agent-browser/lib/results/confirmation.js +0 -75
- package/dist/extensions/agent-browser/lib/results/contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +0 -99
- package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +0 -83
- package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +0 -48
- package/dist/extensions/agent-browser/lib/results/envelope.js +0 -198
- package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +0 -180
- package/dist/extensions/agent-browser/lib/results/network-routes.js +0 -133
- package/dist/extensions/agent-browser/lib/results/network.js +0 -89
- package/dist/extensions/agent-browser/lib/results/next-actions.js +0 -111
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +0 -320
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +0 -138
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +0 -113
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +0 -145
- package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +0 -165
- package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +0 -118
- package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +0 -68
- package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +0 -135
- package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +0 -227
- package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +0 -91
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +0 -123
- package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +0 -54
- package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +0 -216
- package/dist/extensions/agent-browser/lib/results/presentation/common.js +0 -81
- package/dist/extensions/agent-browser/lib/results/presentation/content.js +0 -119
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +0 -67
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +0 -79
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +0 -199
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +0 -75
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +0 -216
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +0 -124
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +0 -64
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +0 -209
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +0 -69
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +0 -222
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +0 -124
- package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +0 -70
- package/dist/extensions/agent-browser/lib/results/presentation/errors.js +0 -285
- package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +0 -117
- package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +0 -231
- package/dist/extensions/agent-browser/lib/results/presentation/notices.js +0 -75
- package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +0 -127
- package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +0 -120
- package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +0 -77
- package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +0 -51
- package/dist/extensions/agent-browser/lib/results/presentation/registry.js +0 -145
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +0 -104
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +0 -178
- package/dist/extensions/agent-browser/lib/results/presentation/source.js +0 -109
- package/dist/extensions/agent-browser/lib/results/presentation.js +0 -19
- package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/recording.js +0 -88
- package/dist/extensions/agent-browser/lib/results/recovery-actions.js +0 -118
- package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +0 -60
- package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +0 -83
- package/dist/extensions/agent-browser/lib/results/selector-recovery.js +0 -261
- package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +0 -266
- package/dist/extensions/agent-browser/lib/results/snapshot-content.js +0 -32
- package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +0 -240
- package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +0 -103
- package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +0 -383
- package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +0 -53
- package/dist/extensions/agent-browser/lib/results/snapshot.js +0 -44
- package/dist/extensions/agent-browser/lib/results/text.js +0 -44
- package/dist/extensions/agent-browser/lib/runtime-args-validation.js +0 -133
- package/dist/extensions/agent-browser/lib/runtime-compatibility.js +0 -81
- package/dist/extensions/agent-browser/lib/runtime-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/runtime-redaction.js +0 -118
- package/dist/extensions/agent-browser/lib/runtime-replay-events.js +0 -144
- package/dist/extensions/agent-browser/lib/runtime-session-identity.js +0 -76
- package/dist/extensions/agent-browser/lib/runtime-session-plan.js +0 -114
- package/dist/extensions/agent-browser/lib/runtime-session-replay.js +0 -123
- package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +0 -65
- package/dist/extensions/agent-browser/lib/runtime-timeouts.js +0 -28
- package/dist/extensions/agent-browser/lib/runtime.js +0 -163
- package/dist/extensions/agent-browser/lib/session-identity.js +0 -51
- package/dist/extensions/agent-browser/lib/session-page-observation.js +0 -357
- package/dist/extensions/agent-browser/lib/session-page-state.js +0 -353
- package/dist/extensions/agent-browser/lib/session-page-types.js +0 -1
- package/dist/extensions/agent-browser/lib/string-enum-schema.js +0 -8
- package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +0 -78
- package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +0 -7
- package/dist/extensions/agent-browser/lib/temp-root-ownership.js +0 -234
- package/dist/extensions/agent-browser/lib/temp-root.js +0 -207
- package/dist/extensions/agent-browser/lib/temp.js +0 -91
- package/dist/extensions/agent-browser/lib/tool-surface.js +0 -239
- package/dist/extensions/agent-browser/lib/upstream-version.js +0 -15
- package/dist/extensions/agent-browser/lib/web-search-providers.js +0 -229
- package/dist/extensions/agent-browser/lib/web-search-request.js +0 -108
- package/dist/extensions/agent-browser/lib/web-search-results.js +0 -281
- package/dist/extensions/agent-browser/lib/web-search-schema.js +0 -82
- package/dist/extensions/agent-browser/lib/web-search.js +0 -149
- package/dist/extensions/agent-browser/lib/webmcp-observation.js +0 -35
- package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +0 -96
- package/dist/scripts/agent-browser-target.mjs +0 -23
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { stat } from "node:fs/promises";
|
|
2
|
-
import { randomUUID } from "node:crypto";
|
|
3
|
-
import { AGENT_BROWSER_SCRIPT_FINAL_OUTPUT_MAX_BYTES, createAgentBrowserScriptCloseArgs, isAgentBrowserScriptSessionName, } from "../input-modes/script.js";
|
|
4
|
-
import { isRecord } from "../parsing.js";
|
|
5
|
-
import { appendBrowserTransition, getBrowserRecord } from "../browser-transcript.js";
|
|
6
|
-
import { redactSensitiveText } from "../runtime.js";
|
|
7
|
-
import { attachInlineImage } from "../results/presentation/artifacts.js";
|
|
8
|
-
import { projectAgentBrowserObservation } from "../results/presentation/content.js";
|
|
9
|
-
import { redactPresentationData } from "../results/presentation/diagnostic-redaction.js";
|
|
10
|
-
import { collectCodeArtifactReceipts, collectCodeFileArtifacts, } from "./code-artifact-observation.js";
|
|
11
|
-
import { parseCodeImageObservation } from "./code-image-observation.js";
|
|
12
|
-
// The offline converter retains outstanding isolated-session cleanup facts in canonical events.
|
|
13
|
-
export function getScriptSessionLeasesFromBranch(branch, ownerSessionId) {
|
|
14
|
-
const leases = new Map();
|
|
15
|
-
for (const entry of branch) {
|
|
16
|
-
const lease = parseScriptLease(getBrowserRecord(entry)?.event.state.scriptLease, ownerSessionId);
|
|
17
|
-
if (lease !== undefined) {
|
|
18
|
-
leases.set(lease.sessionName, lease);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return leases;
|
|
22
|
-
}
|
|
23
|
-
function parseScriptLease(value, ownerSessionId) {
|
|
24
|
-
if (!isRecord(value)) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
if (ownerSessionId !== undefined && value.ownerSessionId !== ownerSessionId) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
const { closeCommandArgs, launchAttempted, sessionName } = value;
|
|
31
|
-
const cleanup = ["active", "closed", "failed"].find((state) => state === value.cleanup);
|
|
32
|
-
if (!isAgentBrowserScriptSessionName(sessionName)) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
if (cleanup === undefined) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
const expected = createAgentBrowserScriptCloseArgs(sessionName);
|
|
39
|
-
if (launchAttempted !== true || !matchesCloseCommand(closeCommandArgs, expected)) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
cleanup,
|
|
44
|
-
closeCommandArgs: expected,
|
|
45
|
-
launchAttempted: true,
|
|
46
|
-
sessionName,
|
|
47
|
-
ownerSessionId: typeof value.ownerSessionId === "string" ? value.ownerSessionId : undefined,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function matchesCloseCommand(value, expected) {
|
|
51
|
-
return (Array.isArray(value) &&
|
|
52
|
-
value.length === expected.length &&
|
|
53
|
-
value.every((token, index) => token === expected[index]));
|
|
54
|
-
}
|
|
55
|
-
export function appendScriptSessionLease(pi, sessionName, cleanup, ownerSessionId) {
|
|
56
|
-
appendBrowserTransition(pi, {
|
|
57
|
-
event: {
|
|
58
|
-
version: 1,
|
|
59
|
-
phase: "state",
|
|
60
|
-
operationId: randomUUID(),
|
|
61
|
-
toolCallId: "cleanup",
|
|
62
|
-
commandIndex: 0,
|
|
63
|
-
isError: cleanup !== "closed",
|
|
64
|
-
state: {
|
|
65
|
-
scriptLease: {
|
|
66
|
-
cleanup,
|
|
67
|
-
closeCommandArgs: createAgentBrowserScriptCloseArgs(sessionName),
|
|
68
|
-
launchAttempted: true,
|
|
69
|
-
sessionName,
|
|
70
|
-
ownerSessionId,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
class BrowserCodeOutput {
|
|
77
|
-
images = new Map();
|
|
78
|
-
selected = new Map();
|
|
79
|
-
receipts = new Map();
|
|
80
|
-
fileArtifacts = new Map();
|
|
81
|
-
selectedBytes = 0;
|
|
82
|
-
observe = async (result) => {
|
|
83
|
-
const details = isRecord(result.details) ? result.details : {};
|
|
84
|
-
const observation = projectAgentBrowserObservation(details, result.isError !== true);
|
|
85
|
-
for (const entry of collectCodeArtifactReceipts(observation.artifactVerification)) {
|
|
86
|
-
this.receipts.set(entry.absolutePath ?? entry.path, entry);
|
|
87
|
-
}
|
|
88
|
-
for (const artifact of collectCodeFileArtifacts(observation.artifacts)) {
|
|
89
|
-
this.fileArtifacts.set(artifact.absolutePath, artifact);
|
|
90
|
-
}
|
|
91
|
-
if (observation.imageObservations === undefined) {
|
|
92
|
-
return { ...observation, imageObservations: undefined };
|
|
93
|
-
}
|
|
94
|
-
if (!Array.isArray(observation.imageObservations)) {
|
|
95
|
-
throw new Error("Browser capture returned invalid image observations.");
|
|
96
|
-
}
|
|
97
|
-
const images = await Promise.all(observation.imageObservations.map(async (value) => {
|
|
98
|
-
const image = parseCodeImageObservation(value);
|
|
99
|
-
if (image === undefined) {
|
|
100
|
-
throw new Error("Browser capture returned invalid image observation geometry.");
|
|
101
|
-
}
|
|
102
|
-
const file = await stat(image.path);
|
|
103
|
-
const id = `image-${this.images.size + 1}`;
|
|
104
|
-
this.images.set(id, { observation: image, size: file.size, mtime: file.mtimeMs });
|
|
105
|
-
return { ...image, id };
|
|
106
|
-
}));
|
|
107
|
-
return { ...observation, imageObservations: images };
|
|
108
|
-
};
|
|
109
|
-
resolveImage(value) {
|
|
110
|
-
const id = isRecord(value) && typeof value.id === "string" ? value.id : undefined;
|
|
111
|
-
const image = id !== undefined && id.length > 0 ? this.images.get(id) : undefined;
|
|
112
|
-
if (id === undefined || id.length === 0 || !image) {
|
|
113
|
-
throw new Error("emitImage expects an imageObservations handle returned by browser() in this code call.");
|
|
114
|
-
}
|
|
115
|
-
return { id, image };
|
|
116
|
-
}
|
|
117
|
-
emitImage = async (value) => {
|
|
118
|
-
const { id, image } = this.resolveImage(value);
|
|
119
|
-
if (this.selected.has(id)) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (this.selected.size >= 8 || this.selectedBytes + image.size > 20 * 1_024 * 1_024) {
|
|
123
|
-
throw new Error("Selected images exceed the code output limit (8 images / 20 MiB). Emit fewer images.");
|
|
124
|
-
}
|
|
125
|
-
const file = await stat(image.observation.path);
|
|
126
|
-
if (!file.isFile() || file.size !== image.size || file.mtimeMs !== image.mtime) {
|
|
127
|
-
throw new Error("The selected image changed since capture. Capture it again before emitting it.");
|
|
128
|
-
}
|
|
129
|
-
const presentation = await attachInlineImage({ content: [], summary: "Selected browser image" }, image.observation.path);
|
|
130
|
-
if (!presentation.content.some((item) => item.type === "image")) {
|
|
131
|
-
const reason = presentation.content
|
|
132
|
-
.filter((item) => item.type === "text")
|
|
133
|
-
.map((item) => item.text)
|
|
134
|
-
.join("\n");
|
|
135
|
-
throw new Error(reason.length > 0 ? reason : "The selected image could not be attached.");
|
|
136
|
-
}
|
|
137
|
-
this.selected.set(id, {
|
|
138
|
-
content: presentation.content.filter((item) => item.type === "image"),
|
|
139
|
-
observation: { ...image.observation, id },
|
|
140
|
-
});
|
|
141
|
-
this.selectedBytes += file.size;
|
|
142
|
-
};
|
|
143
|
-
artifactVerification() {
|
|
144
|
-
const artifacts = [...this.receipts.values()];
|
|
145
|
-
if (artifacts.length === 0) {
|
|
146
|
-
return undefined;
|
|
147
|
-
}
|
|
148
|
-
const count = (state) => artifacts.filter((entry) => entry.state === state).length;
|
|
149
|
-
return {
|
|
150
|
-
artifacts,
|
|
151
|
-
missingCount: count("missing"),
|
|
152
|
-
pendingCount: count("pending"),
|
|
153
|
-
unverifiedCount: count("unverified"),
|
|
154
|
-
verifiedCount: count("verified"),
|
|
155
|
-
verified: artifacts.every((entry) => entry.state === "verified"),
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
failureCategory(run, outputError) {
|
|
159
|
-
if (outputError !== undefined) {
|
|
160
|
-
return "validation-error";
|
|
161
|
-
}
|
|
162
|
-
return run.failureCategory ?? (run.rejectedCallCount > 0 ? "validation-error" : undefined);
|
|
163
|
-
}
|
|
164
|
-
observation(run, context, output) {
|
|
165
|
-
const failureCategory = this.failureCategory(run, output.error);
|
|
166
|
-
const success = run.ok && failureCategory === undefined;
|
|
167
|
-
return {
|
|
168
|
-
success,
|
|
169
|
-
resultCategory: success ? "success" : "failure",
|
|
170
|
-
failureCategory,
|
|
171
|
-
data: output.data,
|
|
172
|
-
error: output.error ??
|
|
173
|
-
(run.error !== undefined && run.error.length > 0
|
|
174
|
-
? redactSensitiveText(run.error)
|
|
175
|
-
: undefined),
|
|
176
|
-
...context,
|
|
177
|
-
codeRun: {
|
|
178
|
-
callCount: run.callCount,
|
|
179
|
-
emitCount: run.emitCount,
|
|
180
|
-
failedCallCount: run.steps.filter((step) => !step.ok).length,
|
|
181
|
-
rejectedCallCount: run.rejectedCallCount,
|
|
182
|
-
aborted: run.aborted,
|
|
183
|
-
timedOut: run.timedOut,
|
|
184
|
-
},
|
|
185
|
-
failures: run.failures !== undefined && run.failures.length > 0 ? run.failures : undefined,
|
|
186
|
-
artifactVerification: this.artifactVerification(),
|
|
187
|
-
artifacts: this.fileArtifacts.size > 0 ? [...this.fileArtifacts.values()] : undefined,
|
|
188
|
-
imageObservations: [...this.selected.values()].map((image) => image.observation),
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
finish = async (run, sessionName, namespace) => {
|
|
192
|
-
let data;
|
|
193
|
-
let error;
|
|
194
|
-
try {
|
|
195
|
-
data = redactPresentationData({ command: "code" }, run.data);
|
|
196
|
-
if (data !== undefined &&
|
|
197
|
-
Buffer.byteLength(JSON.stringify(data), "utf8") >
|
|
198
|
-
AGENT_BROWSER_SCRIPT_FINAL_OUTPUT_MAX_BYTES) {
|
|
199
|
-
throw new Error("oversized");
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
catch {
|
|
203
|
-
data = undefined;
|
|
204
|
-
error = "Code output could not be rendered as bounded JSON.";
|
|
205
|
-
}
|
|
206
|
-
const observation = this.observation(run, { sessionName, namespace }, { data, error });
|
|
207
|
-
const success = observation.success === true;
|
|
208
|
-
const summary = success
|
|
209
|
-
? `Browser code completed (${run.callCount} calls).`
|
|
210
|
-
: "Browser code failed.";
|
|
211
|
-
return {
|
|
212
|
-
content: [...this.selected.values()].flatMap((image) => image.content),
|
|
213
|
-
details: { ...observation, codeSteps: run.steps, summary },
|
|
214
|
-
isError: !success,
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
export function createBrowserCodeOutput() {
|
|
219
|
-
return new BrowserCodeOutput();
|
|
220
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import { canonicalizeAgentBrowserNamespace, extractExplicitSessionName, resolveAgentBrowserNamespace, } from "./argv-grammar.js";
|
|
3
|
-
const ownedManagedSessionStorage = new AsyncLocalStorage();
|
|
4
|
-
export async function withOwnedManagedSessionContext(context, run) {
|
|
5
|
-
return await ownedManagedSessionStorage.run(context, run);
|
|
6
|
-
}
|
|
7
|
-
export function resolveOwnedManagedSessionContext(options) {
|
|
8
|
-
const namespace = canonicalizeAgentBrowserNamespace(options.namespace);
|
|
9
|
-
const currentNamespace = canonicalizeAgentBrowserNamespace(options.currentManagedSessionNamespace);
|
|
10
|
-
const recordedNamespace = canonicalizeAgentBrowserNamespace(options.recordedOwnedSession?.namespace);
|
|
11
|
-
if (options.recordedOwnedSession &&
|
|
12
|
-
options.sessionName === options.recordedOwnedSession.sessionName &&
|
|
13
|
-
namespace === recordedNamespace) {
|
|
14
|
-
return {
|
|
15
|
-
cwd: options.recordedOwnedSession.cwd,
|
|
16
|
-
namespace,
|
|
17
|
-
restoreState: options.restoreState,
|
|
18
|
-
sessionName: options.sessionName,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
if (options.managedSessionName !== undefined && options.managedSessionName.length > 0) {
|
|
22
|
-
return {
|
|
23
|
-
cwd: options.cwd,
|
|
24
|
-
namespace,
|
|
25
|
-
restoreState: options.restoreState,
|
|
26
|
-
sessionName: options.managedSessionName,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
if (options.sessionName !== undefined &&
|
|
30
|
-
options.sessionName.length > 0 &&
|
|
31
|
-
matchesCurrentContext(options, namespace, currentNamespace)) {
|
|
32
|
-
return {
|
|
33
|
-
cwd: options.cwd,
|
|
34
|
-
namespace,
|
|
35
|
-
restoreState: options.restoreState,
|
|
36
|
-
sessionName: options.sessionName,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
function matchesCurrentContext(options, namespace, currentNamespace) {
|
|
42
|
-
return (options.sessionName === options.currentManagedSessionName && namespace === currentNamespace);
|
|
43
|
-
}
|
|
44
|
-
export function ownedContextMatches(sessionName, args) {
|
|
45
|
-
const owned = ownedManagedSessionStorage.getStore();
|
|
46
|
-
return owned &&
|
|
47
|
-
sessionName === owned.sessionName &&
|
|
48
|
-
canonicalizeAgentBrowserNamespace(resolveAgentBrowserNamespace(args, owned.namespace)) ===
|
|
49
|
-
owned.namespace
|
|
50
|
-
? owned
|
|
51
|
-
: undefined;
|
|
52
|
-
}
|
|
53
|
-
export function isOwnedManagedSessionTarget(args) {
|
|
54
|
-
return ownedContextMatches(extractExplicitSessionName(args), args) !== undefined;
|
|
55
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { parseArgvDescriptor } from "./argv-descriptor.js";
|
|
2
|
-
import { parseBatchCommandArgument, parseUserBatchStdin, } from "./orchestration/batch-stdin.js";
|
|
3
|
-
import { BATCH_UNVERIFIED_PAGE_MESSAGE, NON_BAIL_BATCH_NAVIGATION_MESSAGE, getUnverifiedPageError, } from "./page-target-guards.js";
|
|
4
|
-
import { commandMayChangePageTarget, commandVerifiesPageTarget, getResultingPageState, } from "./page-target-navigation.js";
|
|
5
|
-
export const UNSAFE_BATCH_ARGUMENT_MESSAGE = "Batch command arguments could not be inspected. Use batch stdin JSON command arrays instead.";
|
|
6
|
-
export const NESTED_BATCH_ARGUMENT_MESSAGE = "Nested batch commands are not supported. Flatten the batch steps instead.";
|
|
7
|
-
const MAX_NON_BAIL_BATCH_PAGE_STATES = 64;
|
|
8
|
-
function inspectBatchArguments(commands) {
|
|
9
|
-
const steps = [];
|
|
10
|
-
for (const command of commands) {
|
|
11
|
-
const parsed = parseBatchCommandArgument(command);
|
|
12
|
-
if ((parsed.error !== undefined && parsed.error.length > 0) || parsed.step === undefined) {
|
|
13
|
-
return { error: parsed.error ?? UNSAFE_BATCH_ARGUMENT_MESSAGE, steps: [] };
|
|
14
|
-
}
|
|
15
|
-
if (parseArgvDescriptor(parsed.step).commandInfo.command === "batch") {
|
|
16
|
-
return { error: NESTED_BATCH_ARGUMENT_MESSAGE, steps: [] };
|
|
17
|
-
}
|
|
18
|
-
steps.push(parsed.step);
|
|
19
|
-
}
|
|
20
|
-
return { steps };
|
|
21
|
-
}
|
|
22
|
-
export function getBatchCommandSteps(args, stdin) {
|
|
23
|
-
const descriptor = parseArgvDescriptor(args);
|
|
24
|
-
if (descriptor.commandInfo.command !== "batch") {
|
|
25
|
-
return { steps: [] };
|
|
26
|
-
}
|
|
27
|
-
const argumentsToParse = descriptor.upstreamCommandTokens
|
|
28
|
-
.slice(1)
|
|
29
|
-
.filter((command) => command !== "--bail");
|
|
30
|
-
if (argumentsToParse.length > 0) {
|
|
31
|
-
return inspectBatchArguments(argumentsToParse);
|
|
32
|
-
}
|
|
33
|
-
const parsed = parseUserBatchStdin(stdin);
|
|
34
|
-
if (parsed.error !== undefined && parsed.error.length > 0) {
|
|
35
|
-
return { error: parsed.error, steps: [] };
|
|
36
|
-
}
|
|
37
|
-
const steps = (parsed.steps ?? []).filter((step) => step.length > 0);
|
|
38
|
-
return steps.some((step) => parseArgvDescriptor(step).commandInfo.command === "batch")
|
|
39
|
-
? { error: NESTED_BATCH_ARGUMENT_MESSAGE, steps: [] }
|
|
40
|
-
: { steps };
|
|
41
|
-
}
|
|
42
|
-
function deduplicatePossibleBatchPageStates(states) {
|
|
43
|
-
const deduplicated = new Map();
|
|
44
|
-
for (const state of states) {
|
|
45
|
-
const key = `${state.pageUrlUnknown ? "unknown" : "known"}\0${state.currentPageUrl ?? ""}`;
|
|
46
|
-
const existing = deduplicated.get(key);
|
|
47
|
-
deduplicated.set(key, {
|
|
48
|
-
...(existing ?? state),
|
|
49
|
-
retainedAfterFailedNavigation: state.retainedAfterFailedNavigation || existing?.retainedAfterFailedNavigation === true,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return [...deduplicated.values()];
|
|
53
|
-
}
|
|
54
|
-
function possibleStateError(states, step, options) {
|
|
55
|
-
if (options.allowsConfirmation) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
let failedNavigationHazard = false;
|
|
59
|
-
for (const state of states) {
|
|
60
|
-
const error = getUnverifiedPageError({
|
|
61
|
-
...options,
|
|
62
|
-
args: step,
|
|
63
|
-
pageUrlUnknown: state.pageUrlUnknown,
|
|
64
|
-
});
|
|
65
|
-
if (error === undefined || error.length === 0) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
if (!state.retainedAfterFailedNavigation) {
|
|
69
|
-
return BATCH_UNVERIFIED_PAGE_MESSAGE;
|
|
70
|
-
}
|
|
71
|
-
failedNavigationHazard = true;
|
|
72
|
-
}
|
|
73
|
-
return failedNavigationHazard ? NON_BAIL_BATCH_NAVIGATION_MESSAGE : undefined;
|
|
74
|
-
}
|
|
75
|
-
function advancePossibleStates(states, step, trustedBatchTabSelection, bail) {
|
|
76
|
-
const mayChangePageTarget = commandMayChangePageTarget(step, trustedBatchTabSelection);
|
|
77
|
-
const verifiesPageTarget = commandVerifiesPageTarget(step);
|
|
78
|
-
const nextStates = [];
|
|
79
|
-
for (const state of states) {
|
|
80
|
-
if (nextStates.length >= MAX_NON_BAIL_BATCH_PAGE_STATES) {
|
|
81
|
-
return { states: [], error: NON_BAIL_BATCH_NAVIGATION_MESSAGE };
|
|
82
|
-
}
|
|
83
|
-
nextStates.push({
|
|
84
|
-
...getResultingPageState({ args: step, ...state, trustedBatchTabSelection }),
|
|
85
|
-
retainedAfterFailedNavigation: mayChangePageTarget || verifiesPageTarget ? false : state.retainedAfterFailedNavigation,
|
|
86
|
-
});
|
|
87
|
-
if (!bail && (mayChangePageTarget || (verifiesPageTarget && state.pageUrlUnknown))) {
|
|
88
|
-
nextStates.push({ ...state, retainedAfterFailedNavigation: true });
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return { states: deduplicatePossibleBatchPageStates(nextStates) };
|
|
92
|
-
}
|
|
93
|
-
export function validateBatchPageTargets(steps, bail, options) {
|
|
94
|
-
let states = [
|
|
95
|
-
{
|
|
96
|
-
currentPageUrl: options.currentPageUrl,
|
|
97
|
-
pageUrlUnknown: options.pageUrlUnknown ?? false,
|
|
98
|
-
retainedAfterFailedNavigation: false,
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
for (const [index, step] of steps.entries()) {
|
|
102
|
-
const trustedBatchTabSelection = options.trustedFirstBatchTabSelection === true && index === 0;
|
|
103
|
-
const error = possibleStateError(states, step, {
|
|
104
|
-
allowUnverifiedPageTransitions: options.allowUnverifiedPageTransitions,
|
|
105
|
-
trustedBatchTabSelection,
|
|
106
|
-
allowsConfirmation: options.allowFirstBatchConfirmation === true && index === 0,
|
|
107
|
-
});
|
|
108
|
-
if (error !== undefined) {
|
|
109
|
-
return error;
|
|
110
|
-
}
|
|
111
|
-
const next = advancePossibleStates(states, step, trustedBatchTabSelection, bail);
|
|
112
|
-
if (next.error !== undefined) {
|
|
113
|
-
return next.error;
|
|
114
|
-
}
|
|
115
|
-
states = next.states;
|
|
116
|
-
}
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { parseArgvDescriptor } from "./argv-descriptor.js";
|
|
2
|
-
import { needsManagedSession } from "./command-policy.js";
|
|
3
|
-
import { isUnverifiedPageTransitionCommand } from "./command-taxonomy.js";
|
|
4
|
-
import { getExplicitNavigationTarget } from "./page-target-navigation.js";
|
|
5
|
-
export const UNVERIFIED_PAGE_MESSAGE = "The active page became unverified after a tab, attachment, history, script, or state-load transition. Run get url or navigate explicitly before page-content inspection.";
|
|
6
|
-
export const BATCH_UNVERIFIED_PAGE_MESSAGE = `${UNVERIFIED_PAGE_MESSAGE} In a batch, put get url after the transition before later content steps, or split the batch at that boundary.`;
|
|
7
|
-
export const NON_BAIL_BATCH_NAVIGATION_MESSAGE = "Batches that change or re-verify the page target before page-content access must use exact batch --bail so a failed step cannot act on an unverified or prior page.";
|
|
8
|
-
export function isRecoveringPageTransitionCommand(command, subcommand) {
|
|
9
|
-
return (command !== "eval" &&
|
|
10
|
-
!(command === "webmcp" && subcommand === "invoke") &&
|
|
11
|
-
isUnverifiedPageTransitionCommand(command, subcommand));
|
|
12
|
-
}
|
|
13
|
-
function canOperateWithoutVerifiedPage(command, subcommand) {
|
|
14
|
-
switch (command) {
|
|
15
|
-
case undefined:
|
|
16
|
-
return false;
|
|
17
|
-
case "close":
|
|
18
|
-
case "exit":
|
|
19
|
-
case "quit":
|
|
20
|
-
return true;
|
|
21
|
-
case "tab":
|
|
22
|
-
return subcommand !== undefined && subcommand !== "new";
|
|
23
|
-
case "get":
|
|
24
|
-
return subcommand === "url";
|
|
25
|
-
case "webmcp":
|
|
26
|
-
return ["result", "cancel"].includes(subcommand ?? "");
|
|
27
|
-
case "record":
|
|
28
|
-
return subcommand === "stop";
|
|
29
|
-
case "dialog":
|
|
30
|
-
return ["status", "accept", "dismiss"].includes(subcommand ?? "");
|
|
31
|
-
default:
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export function getUnverifiedPageError(options) {
|
|
36
|
-
const descriptor = parseArgvDescriptor(options.args);
|
|
37
|
-
if (options.pageUrlUnknown !== true || !needsManagedSession(descriptor)) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
const { command, subcommand } = descriptor.commandInfo;
|
|
41
|
-
if (canOperateWithoutVerifiedPage(command, subcommand)) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
const transitionsPage = options.allowUnverifiedPageTransitions === true &&
|
|
45
|
-
isRecoveringPageTransitionCommand(command, subcommand);
|
|
46
|
-
const trustedTab = options.trustedBatchTabSelection === true && command === "tab";
|
|
47
|
-
return transitionsPage || trustedTab || getExplicitNavigationTarget(options.args) !== undefined
|
|
48
|
-
? undefined
|
|
49
|
-
: UNVERIFIED_PAGE_MESSAGE;
|
|
50
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { parseArgvDescriptor } from "./argv-descriptor.js";
|
|
2
|
-
import { GLOBAL_BOOLEAN_FLAGS_WITH_OPTIONAL_VALUES, VALUE_FLAGS } from "./argv-grammar.js";
|
|
3
|
-
import { isUnverifiedPageTransitionCommand } from "./command-taxonomy.js";
|
|
4
|
-
const EXPLICIT_NAVIGATION_COMMANDS = new Set([
|
|
5
|
-
"a11y",
|
|
6
|
-
"goto",
|
|
7
|
-
"navigate",
|
|
8
|
-
"open",
|
|
9
|
-
"pushstate",
|
|
10
|
-
"visit",
|
|
11
|
-
"vitals",
|
|
12
|
-
"web-vitals",
|
|
13
|
-
]);
|
|
14
|
-
const POSITIONAL_VALUE_FLAGS = new Set([...VALUE_FLAGS, "--llms"]);
|
|
15
|
-
function isPositionalOperand(token) {
|
|
16
|
-
return !token.startsWith("-") || token.includes("/") || token.includes("\\");
|
|
17
|
-
}
|
|
18
|
-
function getPositionalOperands(commandTokens) {
|
|
19
|
-
const values = [];
|
|
20
|
-
for (let index = 1; index < commandTokens.length; index += 1) {
|
|
21
|
-
const token = commandTokens[index];
|
|
22
|
-
if (token.length === 0 || (token.includes("=") && token.startsWith("-"))) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (POSITIONAL_VALUE_FLAGS.has(token)) {
|
|
26
|
-
index += 1;
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (GLOBAL_BOOLEAN_FLAGS_WITH_OPTIONAL_VALUES.has(token)) {
|
|
30
|
-
index += ["true", "false"].includes(commandTokens[index + 1] ?? "") ? 1 : 0;
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (isPositionalOperand(token)) {
|
|
34
|
-
values.push(token);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return values;
|
|
38
|
-
}
|
|
39
|
-
export function getExplicitNavigationTarget(args) {
|
|
40
|
-
const descriptor = parseArgvDescriptor(args);
|
|
41
|
-
const positionals = getPositionalOperands(descriptor.upstreamCommandTokens);
|
|
42
|
-
const { command, subcommand } = descriptor.commandInfo;
|
|
43
|
-
if (EXPLICIT_NAVIGATION_COMMANDS.has(command ?? "")) {
|
|
44
|
-
return positionals[0];
|
|
45
|
-
}
|
|
46
|
-
if (command === "tab" && subcommand === "new") {
|
|
47
|
-
return positionals[1];
|
|
48
|
-
}
|
|
49
|
-
if (command === "window" && subcommand === "new") {
|
|
50
|
-
return "about:blank";
|
|
51
|
-
}
|
|
52
|
-
return command === "diff" && subcommand === "url"
|
|
53
|
-
? descriptor.upstreamCommandTokens[3]
|
|
54
|
-
: undefined;
|
|
55
|
-
}
|
|
56
|
-
function getResultingExplicitNavigationTarget(args, currentPageUrl) {
|
|
57
|
-
const target = getExplicitNavigationTarget(args);
|
|
58
|
-
if (target === undefined || parseArgvDescriptor(args).commandInfo.command !== "pushstate") {
|
|
59
|
-
return target;
|
|
60
|
-
}
|
|
61
|
-
try {
|
|
62
|
-
return new URL(target).href;
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
if (currentPageUrl === undefined || currentPageUrl.length === 0) {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
return new URL(target, currentPageUrl).href;
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
export function commandMayChangePageTarget(args, trustedBatchTabSelection) {
|
|
77
|
-
const { command, subcommand } = parseArgvDescriptor(args).commandInfo;
|
|
78
|
-
return (getExplicitNavigationTarget(args) !== undefined ||
|
|
79
|
-
(isUnverifiedPageTransitionCommand(command, subcommand) &&
|
|
80
|
-
!(trustedBatchTabSelection && command === "tab")));
|
|
81
|
-
}
|
|
82
|
-
export function commandVerifiesPageTarget(args) {
|
|
83
|
-
const { command, subcommand } = parseArgvDescriptor(args).commandInfo;
|
|
84
|
-
return command === "get" && subcommand === "url";
|
|
85
|
-
}
|
|
86
|
-
export function getResultingPageState(options) {
|
|
87
|
-
const { command, subcommand } = parseArgvDescriptor(options.args).commandInfo;
|
|
88
|
-
if (command === "get" && subcommand === "url") {
|
|
89
|
-
return { currentPageUrl: options.currentPageUrl, pageUrlUnknown: false };
|
|
90
|
-
}
|
|
91
|
-
const rawExplicitTarget = getExplicitNavigationTarget(options.args);
|
|
92
|
-
const explicitTarget = getResultingExplicitNavigationTarget(options.args, options.currentPageUrl);
|
|
93
|
-
if (explicitTarget !== undefined) {
|
|
94
|
-
return { currentPageUrl: explicitTarget, pageUrlUnknown: false };
|
|
95
|
-
}
|
|
96
|
-
if (rawExplicitTarget !== undefined) {
|
|
97
|
-
return { pageUrlUnknown: true };
|
|
98
|
-
}
|
|
99
|
-
if (isUnverifiedPageTransitionCommand(command, subcommand) &&
|
|
100
|
-
!(options.trustedBatchTabSelection && command === "tab")) {
|
|
101
|
-
return { pageUrlUnknown: true };
|
|
102
|
-
}
|
|
103
|
-
return { currentPageUrl: options.currentPageUrl, pageUrlUnknown: options.pageUrlUnknown };
|
|
104
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { parseArgvDescriptor } from "./argv-descriptor.js";
|
|
2
|
-
import { isBrowserIndependentRead, needsManagedSession } from "./command-policy.js";
|
|
3
|
-
import { isRecord } from "./parsing.js";
|
|
4
|
-
import { detectConfirmationRequired } from "./results/confirmation.js";
|
|
5
|
-
import { getBatchCommandSteps, validateBatchPageTargets, UNSAFE_BATCH_ARGUMENT_MESSAGE, NESTED_BATCH_ARGUMENT_MESSAGE, } from "./page-target-batch.js";
|
|
6
|
-
import { UNVERIFIED_PAGE_MESSAGE, BATCH_UNVERIFIED_PAGE_MESSAGE, NON_BAIL_BATCH_NAVIGATION_MESSAGE, getUnverifiedPageError, isRecoveringPageTransitionCommand, } from "./page-target-guards.js";
|
|
7
|
-
import { commandMayChangePageTarget, getResultingPageState, } from "./page-target-navigation.js";
|
|
8
|
-
export { getExplicitNavigationTarget } from "./page-target-navigation.js";
|
|
9
|
-
export function commandRequiresLivePageVerification(args, stdin) {
|
|
10
|
-
const { command } = parseArgvDescriptor(args).commandInfo;
|
|
11
|
-
if (command === "eval") {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
if (command !== "batch") {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
const batch = getBatchCommandSteps(args, stdin);
|
|
18
|
-
return (batch.error === undefined &&
|
|
19
|
-
batch.steps.some((step) => commandRequiresLivePageVerification(step)));
|
|
20
|
-
}
|
|
21
|
-
export function getResultingPageTargetState(options) {
|
|
22
|
-
let state = {
|
|
23
|
-
currentPageUrl: options.currentPageUrl,
|
|
24
|
-
pageUrlUnknown: options.pageUrlUnknown ?? false,
|
|
25
|
-
};
|
|
26
|
-
if (parseArgvDescriptor(options.args).commandInfo.command !== "batch") {
|
|
27
|
-
return {
|
|
28
|
-
...getResultingPageState({ ...state, args: options.args, trustedBatchTabSelection: false }),
|
|
29
|
-
pageTargetMayHaveChanged: commandMayChangePageTarget(options.args, false),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
let pageTargetMayHaveChanged = false;
|
|
33
|
-
for (const [index, step] of options.executedBatchSteps.entries()) {
|
|
34
|
-
const row = Array.isArray(options.batchResults)
|
|
35
|
-
? options.batchResults[index]
|
|
36
|
-
: undefined;
|
|
37
|
-
if (isRecord(row) && detectConfirmationRequired(row.result)) {
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
pageTargetMayHaveChanged ||= commandMayChangePageTarget(step, false);
|
|
41
|
-
state = getResultingPageState({ ...state, args: step, trustedBatchTabSelection: false });
|
|
42
|
-
}
|
|
43
|
-
return { ...state, pageTargetMayHaveChanged };
|
|
44
|
-
}
|
|
45
|
-
export function getPageTargetValidationError(options) {
|
|
46
|
-
const descriptor = parseArgvDescriptor(options.args);
|
|
47
|
-
const command = descriptor.commandInfo.command;
|
|
48
|
-
if (isBrowserIndependentRead(descriptor.upstreamCommandTokens, options.stdin) ||
|
|
49
|
-
["close", "exit", "quit"].includes(command ?? "")) {
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
if (command !== "batch") {
|
|
53
|
-
return getUnverifiedPageError({
|
|
54
|
-
...options,
|
|
55
|
-
trustedBatchTabSelection: options.trustedFirstBatchTabSelection,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
const rawArguments = descriptor.upstreamCommandTokens.slice(1);
|
|
59
|
-
if (rawArguments.some((token) => token.startsWith("--bail="))) {
|
|
60
|
-
return "Use exact batch --bail for fail-fast, or omit it to continue after errors. --bail=<value> is a raw command upstream; stdin is ignored when raw batch arguments are present.";
|
|
61
|
-
}
|
|
62
|
-
const batch = getBatchCommandSteps(options.args, options.stdin);
|
|
63
|
-
if (batch.error !== undefined && batch.error.length > 0) {
|
|
64
|
-
return batch.error.startsWith("agent_browser batch stdin") ||
|
|
65
|
-
batch.error === NESTED_BATCH_ARGUMENT_MESSAGE
|
|
66
|
-
? batch.error
|
|
67
|
-
: UNSAFE_BATCH_ARGUMENT_MESSAGE;
|
|
68
|
-
}
|
|
69
|
-
return validateBatchPageTargets(batch.steps, rawArguments.includes("--bail"), options);
|
|
70
|
-
}
|
|
71
|
-
export function getExplicitSessionPageVerificationRequirement(options) {
|
|
72
|
-
const descriptor = parseArgvDescriptor(options.args);
|
|
73
|
-
if (!needsManagedSession(descriptor, options.stdin) ||
|
|
74
|
-
isRecoveringPageTransitionCommand(descriptor.commandInfo.command, descriptor.commandInfo.subcommand)) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
const validationError = getPageTargetValidationError({
|
|
78
|
-
args: options.args,
|
|
79
|
-
pageUrlUnknown: true,
|
|
80
|
-
stdin: options.stdin,
|
|
81
|
-
allowUnverifiedPageTransitions: true,
|
|
82
|
-
});
|
|
83
|
-
return [
|
|
84
|
-
UNVERIFIED_PAGE_MESSAGE,
|
|
85
|
-
BATCH_UNVERIFIED_PAGE_MESSAGE,
|
|
86
|
-
NON_BAIL_BATCH_NAVIGATION_MESSAGE,
|
|
87
|
-
].includes(validationError ?? "")
|
|
88
|
-
? UNVERIFIED_PAGE_MESSAGE
|
|
89
|
-
: undefined;
|
|
90
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export function isRecord(value) {
|
|
2
|
-
return typeof value === "object" && value !== null;
|
|
3
|
-
}
|
|
4
|
-
/** Upstream native element::parse_ref accepts @eN, ref=eN and bare eN. */
|
|
5
|
-
export function parseRefId(selector) {
|
|
6
|
-
const trimmed = selector.trim();
|
|
7
|
-
const prefixed = trimmed.startsWith("@") || trimmed.startsWith("ref=");
|
|
8
|
-
let candidate = trimmed;
|
|
9
|
-
if (trimmed.startsWith("@")) {
|
|
10
|
-
candidate = trimmed.slice(1);
|
|
11
|
-
}
|
|
12
|
-
else if (trimmed.startsWith("ref=")) {
|
|
13
|
-
candidate = trimmed.slice(4);
|
|
14
|
-
}
|
|
15
|
-
return (prefixed ? /^e\d*$/ : /^e\d+$/).test(candidate) ? candidate : undefined;
|
|
16
|
-
}
|
|
17
|
-
export function parsePositiveInteger(rawValue) {
|
|
18
|
-
if (typeof rawValue !== "string") {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
const normalizedValue = rawValue.trim();
|
|
22
|
-
if (!/^\d+$/.test(normalizedValue)) {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
const parsedValue = Number(normalizedValue);
|
|
26
|
-
if (!Number.isSafeInteger(parsedValue) || parsedValue <= 0) {
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
return parsedValue;
|
|
30
|
-
}
|