pi-agent-browser-native 0.9.5 → 0.9.7
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 +114 -1
- package/README.md +17 -6
- package/dist/extensions/agent-browser/index.js +2482 -925
- package/dist/packaged/lib/browser-session-conversion.js +2946 -0
- package/dist/packaged/lib/config-policy.js +599 -0
- package/dist/packaged/lib/parsing.js +34 -0
- package/dist/packaged/lib/playbook.js +728 -0
- package/dist/packaged/lib/results/snapshot.js +2800 -0
- package/dist/packaged/lib/runtime.js +3075 -0
- package/docs/ARCHITECTURE.md +29 -10
- package/docs/CODE_QUALITY.md +32 -5
- package/docs/COMMAND_REFERENCE.md +156 -40
- package/docs/ELECTRON.md +1 -1
- package/docs/PERFORMANCE.md +252 -0
- package/docs/REFERENCE.md +15 -15
- package/docs/RELEASE.md +41 -18
- package/docs/REQUIREMENTS.md +6 -0
- package/docs/SESSION_STORAGE.md +13 -5
- package/docs/SUPPORT_MATRIX.md +31 -25
- package/docs/TOOL_CONTRACT.md +41 -18
- package/docs/performance/2026-10-12.json +7257 -0
- package/docs/platform-smoke.md +18 -14
- package/package.json +18 -4
- package/platform-smoke.config.mjs +3 -2
- package/scripts/agent-browser-capability-baseline.mjs +16 -2
- package/scripts/agent-browser-target.mjs +1 -1
- package/scripts/build.mjs +16 -5
- package/scripts/capability-options.mjs +20 -0
- package/scripts/capability-samples.mjs +23 -10
- package/scripts/config.mjs +1 -1
- package/scripts/convert-browser-session.mjs +1 -1
- package/scripts/platform-smoke/commands.mjs +30 -4
- package/scripts/platform-smoke/doctor-support.mjs +11 -2
- package/scripts/platform-smoke/doctor-windows.mjs +1 -1
- package/scripts/platform-smoke/doctor.mjs +26 -11
- package/scripts/platform-smoke/linux-image/Dockerfile +6 -3
- package/scripts/platform-smoke/platform-build-windows.ps1 +23 -3
- package/scripts/platform-smoke/suite-checks.mjs +11 -1
- package/scripts/platform-smoke/targets.mjs +4 -3
- package/scripts/platform-smoke.mjs +68 -25
- 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 -231
- package/dist/extensions/agent-browser/lib/config.js +0 -69
- package/dist/extensions/agent-browser/lib/electron/cdp.js +0 -62
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +0 -274
- 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 -90
- 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 -340
- 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 -10
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +0 -201
- package/dist/extensions/agent-browser/lib/input-modes/job.js +0 -198
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +0 -116
- 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 -84
- 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 -203
- 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 -187
- 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 -174
- 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 -212
- 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 -169
- 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 -93
- 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 -68
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +0 -169
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +0 -182
- 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 -167
- 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 -183
- 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 -81
- 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 -211
- 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 -193
- package/dist/extensions/agent-browser/lib/web-search-request.js +0 -102
- 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 -167
- 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,88 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../parsing.js";
|
|
2
|
-
const RECORDING_QUALITY_WARNING = "Capture quality warning: repaint-driven capture, held/repeated or static frames, and late/final-state-only frames cannot establish UI smoothness. Output FPS is not captured-frame rate; inspect the recording and capture window before judging motion.";
|
|
3
|
-
function getRecordingOutcome(value, outcome) {
|
|
4
|
-
if (typeof value === "boolean" || value === null) {
|
|
5
|
-
return value;
|
|
6
|
-
}
|
|
7
|
-
return outcome ?? null;
|
|
8
|
-
}
|
|
9
|
-
function formatRecordingOutcome(receipt) {
|
|
10
|
-
let outcome = "pending/unknown";
|
|
11
|
-
if (receipt.success !== null) {
|
|
12
|
-
outcome = receipt.success ? "succeeded" : "failed";
|
|
13
|
-
}
|
|
14
|
-
const error = receipt.error !== null && receipt.error.length > 0 ? ` — ${receipt.error}` : "";
|
|
15
|
-
return `Native recording outcome: ${outcome}${error}`;
|
|
16
|
-
}
|
|
17
|
-
function recordOrEmpty(value) {
|
|
18
|
-
return isRecord(value) ? value : {};
|
|
19
|
-
}
|
|
20
|
-
function number(value) {
|
|
21
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
|
|
22
|
-
}
|
|
23
|
-
function text(value) {
|
|
24
|
-
return typeof value === "string" && value.length > 0 ? value : null;
|
|
25
|
-
}
|
|
26
|
-
export function getRecordingReceipt(value, outcome) {
|
|
27
|
-
if (!isRecord(value) || typeof value.path !== "string" || value.path.length === 0) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
const capture = recordOrEmpty(value.capture);
|
|
31
|
-
const output = recordOrEmpty(value.output);
|
|
32
|
-
const file = recordOrEmpty(value.file);
|
|
33
|
-
return {
|
|
34
|
-
warning: RECORDING_QUALITY_WARNING,
|
|
35
|
-
recordingId: text(value.recordingId),
|
|
36
|
-
path: value.path,
|
|
37
|
-
success: getRecordingOutcome(value.success, outcome),
|
|
38
|
-
error: text(value.error),
|
|
39
|
-
frames: number(value.frames),
|
|
40
|
-
capturedFrames: number(value.capturedFrames),
|
|
41
|
-
fps: number(value.fps),
|
|
42
|
-
capture: {
|
|
43
|
-
startedAt: text(capture.startedAt),
|
|
44
|
-
endedAt: text(capture.endedAt),
|
|
45
|
-
durationMs: number(capture.durationMs),
|
|
46
|
-
firstFrameAt: text(capture.firstFrameAt),
|
|
47
|
-
lastFrameAt: text(capture.lastFrameAt),
|
|
48
|
-
firstFrameAfterMs: number(capture.firstFrameAfterMs),
|
|
49
|
-
lastFrameAfterMs: number(capture.lastFrameAfterMs),
|
|
50
|
-
averageFps: number(capture.averageFps),
|
|
51
|
-
maxFrameGapMs: number(capture.maxFrameGapMs),
|
|
52
|
-
timestampSource: text(capture.timestampSource),
|
|
53
|
-
},
|
|
54
|
-
output: {
|
|
55
|
-
frames: number(output.frames ?? value.frames),
|
|
56
|
-
fps: number(output.fps ?? value.fps),
|
|
57
|
-
encodedFrames: number(output.encodedFrames),
|
|
58
|
-
durationMs: number(output.durationMs),
|
|
59
|
-
durationSource: text(output.durationSource),
|
|
60
|
-
heldFrames: number(output.heldFrames),
|
|
61
|
-
droppedFrames: number(output.droppedFrames),
|
|
62
|
-
skippedFrames: number(output.skippedFrames),
|
|
63
|
-
encoderSucceeded: typeof output.encoderSucceeded === "boolean" ? output.encoderSucceeded : null,
|
|
64
|
-
},
|
|
65
|
-
file: {
|
|
66
|
-
exists: typeof file.exists === "boolean" ? file.exists : null,
|
|
67
|
-
sizeBytes: number(file.sizeBytes),
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export function formatRecordingReceipt(receipt) {
|
|
72
|
-
const metric = (value, unit = "") => value === null ? "unknown" : `${value}${unit}`;
|
|
73
|
-
return [
|
|
74
|
-
`Recording ID: ${metric(receipt.recordingId)}`,
|
|
75
|
-
formatRecordingOutcome(receipt),
|
|
76
|
-
`Capture started: ${metric(receipt.capture.startedAt)}; ended: ${metric(receipt.capture.endedAt)}`,
|
|
77
|
-
`Wall-clock capture duration: ${metric(receipt.capture.durationMs, " ms")}`,
|
|
78
|
-
`Captured frames (received, not pixel-unique): ${metric(receipt.capturedFrames)}`,
|
|
79
|
-
`Captured-frame rate: ${metric(receipt.capture.averageFps, " fps")}`,
|
|
80
|
-
`First frame: ${metric(receipt.capture.firstFrameAt)}; after start: ${metric(receipt.capture.firstFrameAfterMs, " ms")}`,
|
|
81
|
-
`Last frame: ${metric(receipt.capture.lastFrameAt)}; after start: ${metric(receipt.capture.lastFrameAfterMs, " ms")}`,
|
|
82
|
-
`Maximum frame gap: ${metric(receipt.capture.maxFrameGapMs, " ms")}; timestamp source: ${metric(receipt.capture.timestampSource)}`,
|
|
83
|
-
`Written frames: ${metric(receipt.output.frames)}; Encoded frames: ${metric(receipt.output.encodedFrames)}`,
|
|
84
|
-
`Held frames: ${metric(receipt.output.heldFrames)}; dropped frames: ${metric(receipt.output.droppedFrames)}; skipped frames: ${metric(receipt.output.skippedFrames)}`,
|
|
85
|
-
`Nominal/output FPS: ${metric(receipt.output.fps)}; output duration (encoded frames/fps): ${metric(receipt.output.durationMs, " ms")}`,
|
|
86
|
-
receipt.warning,
|
|
87
|
-
].join("\n");
|
|
88
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { buildNextToolAction, withOptionalSessionArgs, } from "./next-actions.js";
|
|
2
|
-
export const AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS = {
|
|
3
|
-
aboutBlankListTabs: "list-tabs-for-about-blank-recovery",
|
|
4
|
-
connectedSessionGetUrl: "verify-connected-session-url",
|
|
5
|
-
connectedSessionListTabs: "list-connected-session-tabs",
|
|
6
|
-
genericTabDriftListTabs: "list-tabs-for-recovery",
|
|
7
|
-
noActivePageListTabs: "list-tabs-after-no-active-page",
|
|
8
|
-
selectIntendedTabAfterDrift: "select-intended-tab-after-drift",
|
|
9
|
-
snapshotAfterTabRecovery: "snapshot-after-tab-recovery",
|
|
10
|
-
tabDriftListTabs: "list-tabs-for-tab-drift-recovery",
|
|
11
|
-
tabGoneListTabs: "list-tabs-after-tab-gone",
|
|
12
|
-
tabGoneNewTab: "open-tab-after-tab-gone",
|
|
13
|
-
};
|
|
14
|
-
export const AGENT_BROWSER_RICH_INPUT_RECOVERY_NEXT_ACTION_IDS = {
|
|
15
|
-
click: "click-current-editable-ref",
|
|
16
|
-
focus: "focus-current-editable-ref",
|
|
17
|
-
};
|
|
18
|
-
function getNumberedAgentBrowserNextActionId(baseId, index, total) {
|
|
19
|
-
return total > 1 ? `${baseId}-${index + 1}` : baseId;
|
|
20
|
-
}
|
|
21
|
-
export function getAgentBrowserRichInputRecoveryNextActionId(kind, index, candidateCount) {
|
|
22
|
-
return getNumberedAgentBrowserNextActionId(AGENT_BROWSER_RICH_INPUT_RECOVERY_NEXT_ACTION_IDS[kind], index, candidateCount);
|
|
23
|
-
}
|
|
24
|
-
export function getAgentBrowserRichInputRecoveryNextActionIds(candidateCount) {
|
|
25
|
-
const ids = [];
|
|
26
|
-
for (let index = 0; index < candidateCount; index += 1) {
|
|
27
|
-
ids.push(getAgentBrowserRichInputRecoveryNextActionId("focus", index, candidateCount), getAgentBrowserRichInputRecoveryNextActionId("click", index, candidateCount));
|
|
28
|
-
}
|
|
29
|
-
return ids;
|
|
30
|
-
}
|
|
31
|
-
function getRecoveryTargetDescription(recovery) {
|
|
32
|
-
const target = [recovery.targetTitle, recovery.targetUrl]
|
|
33
|
-
.filter((item) => item !== undefined && item.length > 0)
|
|
34
|
-
.join(" at ");
|
|
35
|
-
return target.length > 0 ? target : "the intended tab";
|
|
36
|
-
}
|
|
37
|
-
function isStableTabId(tab) {
|
|
38
|
-
return /^t\d+$/.test(tab ?? "");
|
|
39
|
-
}
|
|
40
|
-
function buildTabSnapshotRecoveryAction(options) {
|
|
41
|
-
if (options.recovery.recoveryApplied === true) {
|
|
42
|
-
return buildNextToolAction({
|
|
43
|
-
args: options.sessionArgs(["snapshot", "-i"]),
|
|
44
|
-
id: options.id,
|
|
45
|
-
reason: options.reason,
|
|
46
|
-
safety: options.safety,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return buildNextToolAction({
|
|
50
|
-
args: options.sessionArgs(["batch", "--bail"]),
|
|
51
|
-
id: options.id,
|
|
52
|
-
reason: `${options.reason} The batch selects and verifies the stable tab before snapshotting.`,
|
|
53
|
-
safety: `${options.safety} A failed tab selection or URL check stops before the snapshot.`,
|
|
54
|
-
stdin: JSON.stringify([
|
|
55
|
-
["tab", options.tabId],
|
|
56
|
-
["get", "url"],
|
|
57
|
-
["snapshot", "-i"],
|
|
58
|
-
]),
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
export function buildRecoveryNextActions(recovery) {
|
|
62
|
-
const sessionArgs = (args) => withOptionalSessionArgs(recovery.sessionName, args);
|
|
63
|
-
if (recovery.kind === "connected-session") {
|
|
64
|
-
return [
|
|
65
|
-
buildNextToolAction({
|
|
66
|
-
args: sessionArgs(["get", "url"]),
|
|
67
|
-
id: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.connectedSessionGetUrl,
|
|
68
|
-
reason: "Verify the attached page URL before any page-content inspection.",
|
|
69
|
-
safety: "Read-only URL lookup. The wrapper keeps page inspection blocked if the active target URL cannot be verified.",
|
|
70
|
-
}),
|
|
71
|
-
buildNextToolAction({
|
|
72
|
-
args: sessionArgs(["tab", "list"]),
|
|
73
|
-
id: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.connectedSessionListTabs,
|
|
74
|
-
reason: "Inspect tabs exposed by the connected CDP endpoint before assuming the app surface is active.",
|
|
75
|
-
safety: "Read-only. Raw connect can succeed before the desktop app has an active rendered page.",
|
|
76
|
-
}),
|
|
77
|
-
];
|
|
78
|
-
}
|
|
79
|
-
if (recovery.kind === "no-active-page") {
|
|
80
|
-
return [
|
|
81
|
-
buildNextToolAction({
|
|
82
|
-
args: sessionArgs(["tab", "list"]),
|
|
83
|
-
id: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.noActivePageListTabs,
|
|
84
|
-
reason: "The snapshot found no active page; inspect the session tabs before retrying refs.",
|
|
85
|
-
safety: "Read-only tab listing for the same connected session.",
|
|
86
|
-
}),
|
|
87
|
-
];
|
|
88
|
-
}
|
|
89
|
-
const targetDescription = getRecoveryTargetDescription(recovery);
|
|
90
|
-
const listAction = buildNextToolAction({
|
|
91
|
-
args: sessionArgs(["tab", "list"]),
|
|
92
|
-
id: recovery.kind === "about-blank"
|
|
93
|
-
? AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.aboutBlankListTabs
|
|
94
|
-
: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.tabDriftListTabs,
|
|
95
|
-
reason: `Inspect tabs for ${targetDescription} before continuing after tab drift.`,
|
|
96
|
-
safety: "Read-only tab listing; prefer stable tN tab ids over positional tab guesses.",
|
|
97
|
-
});
|
|
98
|
-
if (!isStableTabId(recovery.selectedTab)) {
|
|
99
|
-
return [listAction];
|
|
100
|
-
}
|
|
101
|
-
return [
|
|
102
|
-
listAction,
|
|
103
|
-
buildNextToolAction({
|
|
104
|
-
args: sessionArgs(["tab", recovery.selectedTab]),
|
|
105
|
-
id: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.selectIntendedTabAfterDrift,
|
|
106
|
-
reason: `Re-select ${targetDescription} with the stable tab id already observed by the wrapper.`,
|
|
107
|
-
safety: "Switches only the active tab in this browser session; it does not mutate page content.",
|
|
108
|
-
}),
|
|
109
|
-
buildTabSnapshotRecoveryAction({
|
|
110
|
-
id: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.snapshotAfterTabRecovery,
|
|
111
|
-
reason: "Refresh interactive refs on the recovered tab before using @e refs again.",
|
|
112
|
-
recovery,
|
|
113
|
-
safety: "Read-only snapshot. Treat previous refs as stale until this succeeds.",
|
|
114
|
-
sessionArgs,
|
|
115
|
-
tabId: recovery.selectedTab,
|
|
116
|
-
}),
|
|
117
|
-
];
|
|
118
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { buildAgentBrowserNextActions } from "./action-recommendations.js";
|
|
2
|
-
import { withOptionalSessionArgs } from "./next-actions.js";
|
|
3
|
-
export function buildConnectedSessionNextActions(sessionName) {
|
|
4
|
-
if ((sessionName ?? "") === "") {
|
|
5
|
-
return [];
|
|
6
|
-
}
|
|
7
|
-
return (buildAgentBrowserNextActions({
|
|
8
|
-
recovery: { kind: "connected-session", sessionName },
|
|
9
|
-
resultCategory: "success",
|
|
10
|
-
successCategory: "completed",
|
|
11
|
-
}) ?? []);
|
|
12
|
-
}
|
|
13
|
-
export function buildNoActivePageNextActions(sessionName) {
|
|
14
|
-
if ((sessionName ?? "") === "") {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
return (buildAgentBrowserNextActions({
|
|
18
|
-
recovery: { kind: "no-active-page", sessionName },
|
|
19
|
-
resultCategory: "failure",
|
|
20
|
-
}) ?? []);
|
|
21
|
-
}
|
|
22
|
-
export function buildPendingWebMcpNextActions(sessionName) {
|
|
23
|
-
return [
|
|
24
|
-
{
|
|
25
|
-
id: "verify-page-target-after-pending-webmcp",
|
|
26
|
-
params: { args: withOptionalSessionArgs(sessionName, ["get", "url"]) },
|
|
27
|
-
reason: "Verify the current page target before taking a fresh snapshot; use webmcp result or cancel to settle the detached invocation.",
|
|
28
|
-
safety: "Read-only URL inspection. It does not settle the pending page tool, which may still mutate or navigate later.",
|
|
29
|
-
tool: "agent_browser",
|
|
30
|
-
},
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
function getSessionTabRecoveryContext(options) {
|
|
34
|
-
return {
|
|
35
|
-
kind: options.kind,
|
|
36
|
-
recoveryApplied: options.recoveryApplied,
|
|
37
|
-
selectedTab: options.tabCorrection?.selectedTab,
|
|
38
|
-
sessionName: options.sessionName,
|
|
39
|
-
targetTitle: options.tabCorrection?.targetTitle ?? options.target?.title,
|
|
40
|
-
targetUrl: options.tabCorrection?.targetUrl ?? options.target?.url,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export function buildSessionTabRecoveryNextActions(options) {
|
|
44
|
-
const resultCategory = options.resultCategory ?? "success";
|
|
45
|
-
return (buildAgentBrowserNextActions({
|
|
46
|
-
recovery: getSessionTabRecoveryContext(options),
|
|
47
|
-
resultCategory,
|
|
48
|
-
successCategory: resultCategory === "success" ? "completed" : undefined,
|
|
49
|
-
}) ?? []);
|
|
50
|
-
}
|
|
51
|
-
export function buildSessionAwareStaleRefNextActions(sessionName) {
|
|
52
|
-
return (buildAgentBrowserNextActions({ failureCategory: "stale-ref", resultCategory: "failure" }) ?? []).map((action) => {
|
|
53
|
-
const actionArgs = action.params?.args;
|
|
54
|
-
return Object.assign({}, action, {
|
|
55
|
-
params: action.params && actionArgs
|
|
56
|
-
? { ...action.params, args: withOptionalSessionArgs(sessionName, actionArgs) }
|
|
57
|
-
: action.params,
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
const SELECTOR_RECOVERY_ACTION_NAMES = [
|
|
2
|
-
"check",
|
|
3
|
-
"click",
|
|
4
|
-
"fill",
|
|
5
|
-
"select",
|
|
6
|
-
"uncheck",
|
|
7
|
-
];
|
|
8
|
-
function isSelectorRecoveryActionName(action) {
|
|
9
|
-
return SELECTOR_RECOVERY_ACTION_NAMES.some((name) => name === action);
|
|
10
|
-
}
|
|
11
|
-
function getFindNameFlagValue(args, startIndex) {
|
|
12
|
-
const index = args.indexOf("--name", startIndex);
|
|
13
|
-
const name = index >= 0 ? args.at(index + 1) : undefined;
|
|
14
|
-
return name !== undefined && name.length > 0 ? name : undefined;
|
|
15
|
-
}
|
|
16
|
-
function collectFindTrailingValues(args, startIndex) {
|
|
17
|
-
const values = [];
|
|
18
|
-
for (const token of args.slice(startIndex)) {
|
|
19
|
-
if (token.length === 0 || token.startsWith("-")) {
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
values.push(token);
|
|
23
|
-
}
|
|
24
|
-
return values;
|
|
25
|
-
}
|
|
26
|
-
function getSelectTarget(args, index, locator, value) {
|
|
27
|
-
const optionValues = collectFindTrailingValues(args, index + 4);
|
|
28
|
-
if (locator === "role") {
|
|
29
|
-
if (!/^(?:combobox|listbox)$/i.test(value)) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
const targetName = getFindNameFlagValue(args, index + 4);
|
|
33
|
-
return targetName !== undefined
|
|
34
|
-
? { action: "select", optionValues, roles: [value.toLowerCase()], targetName }
|
|
35
|
-
: undefined;
|
|
36
|
-
}
|
|
37
|
-
return locator === "label"
|
|
38
|
-
? { action: "select", optionValues, roles: ["combobox", "listbox"], targetName: value }
|
|
39
|
-
: undefined;
|
|
40
|
-
}
|
|
41
|
-
function getTextTarget(action, locator, targetName, text) {
|
|
42
|
-
if (locator === "text" && action === "click") {
|
|
43
|
-
return { action, roles: ["button", "link"], targetName };
|
|
44
|
-
}
|
|
45
|
-
if ((locator === "text" || locator === "placeholder") && action === "fill") {
|
|
46
|
-
return { action, roles: ["searchbox", "textbox"], targetName, text };
|
|
47
|
-
}
|
|
48
|
-
return locator === "label" && action === "fill"
|
|
49
|
-
? { action, roles: ["textbox"], targetName, text }
|
|
50
|
-
: undefined;
|
|
51
|
-
}
|
|
52
|
-
export function getFindVisibleRefFallbackTarget(args) {
|
|
53
|
-
const index = args[0] === "--session" ? 2 : 0;
|
|
54
|
-
if (args[index] !== "find") {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
const locator = args.at(index + 1);
|
|
58
|
-
const value = args.at(index + 2);
|
|
59
|
-
const action = args.at(index + 3);
|
|
60
|
-
if (locator === undefined ||
|
|
61
|
-
locator.length === 0 ||
|
|
62
|
-
value === undefined ||
|
|
63
|
-
value.length === 0 ||
|
|
64
|
-
!isSelectorRecoveryActionName(action)) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
return getFindActionTarget(args, { index, locator, value, action });
|
|
68
|
-
}
|
|
69
|
-
function getFindActionTarget(args, command) {
|
|
70
|
-
const { index, locator, value, action } = command;
|
|
71
|
-
if (action === "select") {
|
|
72
|
-
return getSelectTarget(args, index, locator, value);
|
|
73
|
-
}
|
|
74
|
-
const text = action === "fill" ? args.at(index + 4) : undefined;
|
|
75
|
-
if (action === "fill" && (text === undefined || text.length === 0)) {
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
if (locator === "role") {
|
|
79
|
-
const targetName = getFindNameFlagValue(args, index + 4);
|
|
80
|
-
return targetName !== undefined ? { action, roles: [value], targetName, text } : undefined;
|
|
81
|
-
}
|
|
82
|
-
return getTextTarget(action, locator, value, text);
|
|
83
|
-
}
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../parsing.js";
|
|
2
|
-
import { extractRefSnapshotFromData } from "../session-page-observation.js";
|
|
3
|
-
import { getEditableRefEvidence } from "./editable-ref-evidence.js";
|
|
4
|
-
import { withOptionalSessionArgs } from "./next-actions.js";
|
|
5
|
-
import { getAgentBrowserRichInputRecoveryNextActionId, getAgentBrowserRichInputRecoveryNextActionIds, } from "./recovery-actions.js";
|
|
6
|
-
import { getSnapshotLineTextByRef, getSnapshotRefRecord, getSnapshotRefRole, } from "./snapshot-refs.js";
|
|
7
|
-
import { compareRefIds } from "./text.js";
|
|
8
|
-
import { getFindVisibleRefFallbackTarget, } from "./selector-recovery-target.js";
|
|
9
|
-
const VISIBLE_REF_FALLBACK_CANDIDATE_LIMIT = 3;
|
|
10
|
-
const EDITABLE_CONTROL_ROLES = new Set(["combobox", "searchbox", "textbox"]);
|
|
11
|
-
const RICH_INPUT_RECOVERY_EDITABLE_ROLES = new Set(["searchbox", "textbox"]);
|
|
12
|
-
const RICH_INPUT_RECOVERY_HINT = "After the editable ref is focused, use keyboard type when a framework-controlled editor requires real key events. keyboard inserttext is paste-like and needs separate application-state verification. Do not press Enter or otherwise submit unless the user flow explicitly calls for it.";
|
|
13
|
-
export function getVisibleRefFallbackTarget(options) {
|
|
14
|
-
return (getFindVisibleRefFallbackTarget(options.commandTokens) ??
|
|
15
|
-
(options.compiledSemanticAction
|
|
16
|
-
? getFindVisibleRefFallbackTarget(options.compiledSemanticAction.args)
|
|
17
|
-
: undefined));
|
|
18
|
-
}
|
|
19
|
-
function getDirectRefFallbackArgs(target, ref) {
|
|
20
|
-
if (target.action === "fill") {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
if (target.action === "select") {
|
|
24
|
-
return target.optionValues && target.optionValues.length > 0
|
|
25
|
-
? ["select", `@${ref}`, ...target.optionValues]
|
|
26
|
-
: undefined;
|
|
27
|
-
}
|
|
28
|
-
return [target.action, `@${ref}`];
|
|
29
|
-
}
|
|
30
|
-
function getCandidateEditableEvidence(snapshot, ref, entry, line) {
|
|
31
|
-
return snapshot
|
|
32
|
-
? snapshot.refs?.[ref]?.isEditable
|
|
33
|
-
: getEditableRefEvidence({ ref: entry, text: line });
|
|
34
|
-
}
|
|
35
|
-
function matchesFallbackName(name, targetName) {
|
|
36
|
-
return (name !== undefined &&
|
|
37
|
-
name.length > 0 &&
|
|
38
|
-
normalizeSemanticActionAccessibleName(name) === targetName);
|
|
39
|
-
}
|
|
40
|
-
function isDisallowedEditableFill(action, evidence, role) {
|
|
41
|
-
return action === "fill" && evidence === false && EDITABLE_CONTROL_ROLES.has(role.toLowerCase());
|
|
42
|
-
}
|
|
43
|
-
function getVisibleRefFallbackCandidates(target, snapshotData, refSnapshot) {
|
|
44
|
-
const refs = refSnapshot?.refs ?? getSnapshotRefRecord(snapshotData);
|
|
45
|
-
if (!refs) {
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
const snapshotLineByRef = getSnapshotLineTextByRef(snapshotData);
|
|
49
|
-
const roleOrder = target.roles.map((role) => role.toLowerCase());
|
|
50
|
-
const targetName = normalizeSemanticActionAccessibleName(target.targetName);
|
|
51
|
-
const candidates = Object.entries(refs).flatMap(([ref, entry]) => {
|
|
52
|
-
if (!/^e\d+$/.test(ref) || !isRecord(entry)) {
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
const snapshotLine = snapshotLineByRef.get(ref);
|
|
56
|
-
const editableEvidence = getCandidateEditableEvidence(refSnapshot, ref, entry, snapshotLine);
|
|
57
|
-
const role = getSnapshotRefRole(entry, editableEvidence);
|
|
58
|
-
const name = typeof entry.name === "string" ? entry.name : undefined;
|
|
59
|
-
if (!matchesFallbackName(name, targetName) || !roleOrder.includes(role.toLowerCase())) {
|
|
60
|
-
return [];
|
|
61
|
-
}
|
|
62
|
-
if (isDisallowedEditableFill(target.action, editableEvidence, role)) {
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
const directRefArgs = getDirectRefFallbackArgs(target, ref);
|
|
66
|
-
return [
|
|
67
|
-
{
|
|
68
|
-
action: target.action,
|
|
69
|
-
...(directRefArgs ? { args: directRefArgs } : {}),
|
|
70
|
-
name,
|
|
71
|
-
reason: `Current snapshot shows ${role} ${JSON.stringify(name)} at @${ref}, matching the failed ${target.action} locator exactly.`,
|
|
72
|
-
ref: `@${ref}`,
|
|
73
|
-
role,
|
|
74
|
-
...(editableEvidence !== undefined ? { editableEvidence } : {}),
|
|
75
|
-
},
|
|
76
|
-
];
|
|
77
|
-
});
|
|
78
|
-
candidates.sort((left, right) => {
|
|
79
|
-
const difference = roleOrder.indexOf(left.role.toLowerCase()) - roleOrder.indexOf(right.role.toLowerCase());
|
|
80
|
-
return difference !== 0 ? difference : compareRefIds(left.ref.slice(1), right.ref.slice(1));
|
|
81
|
-
});
|
|
82
|
-
return candidates.slice(0, VISIBLE_REF_FALLBACK_CANDIDATE_LIMIT);
|
|
83
|
-
}
|
|
84
|
-
export function buildVisibleRefFallbackDiagnosticFromSnapshot(options) {
|
|
85
|
-
const snapshot = extractRefSnapshotFromData(options.snapshotData);
|
|
86
|
-
if (!snapshot) {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
const candidates = getVisibleRefFallbackCandidates(options.target, options.snapshotData);
|
|
90
|
-
if (candidates.length === 0) {
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
candidates,
|
|
95
|
-
snapshot,
|
|
96
|
-
summary: candidates.length === 1
|
|
97
|
-
? `Current snapshot has one exact visible ref match for ${options.target.action} ${JSON.stringify(options.target.targetName)}.`
|
|
98
|
-
: `Current snapshot has ${candidates.length} exact visible ref matches for ${options.target.action} ${JSON.stringify(options.target.targetName)}; choose only if the intended control is unambiguous.`,
|
|
99
|
-
target: {
|
|
100
|
-
action: options.target.action,
|
|
101
|
-
roles: options.target.roles,
|
|
102
|
-
targetName: options.target.targetName,
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function resolveFillCandidateArgs(candidates, text, allowFill) {
|
|
107
|
-
if (allowFill !== true || candidates.length !== 1 || text === undefined) {
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
const candidate = candidates.at(0);
|
|
111
|
-
if (!candidate ||
|
|
112
|
-
candidate.editableEvidence === false ||
|
|
113
|
-
!EDITABLE_CONTROL_ROLES.has(candidate.role.toLowerCase())) {
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
return ["fill", candidate.ref, text];
|
|
117
|
-
}
|
|
118
|
-
function resolveSelectCandidateArgs(candidates, values) {
|
|
119
|
-
if (candidates.length !== 1 || !values || values.length === 0) {
|
|
120
|
-
return undefined;
|
|
121
|
-
}
|
|
122
|
-
const candidate = candidates.at(0);
|
|
123
|
-
return candidate ? ["select", candidate.ref, ...values] : undefined;
|
|
124
|
-
}
|
|
125
|
-
function resolveCandidateArgs(target, candidates, allowFill, selectValues) {
|
|
126
|
-
if (target.action === "fill") {
|
|
127
|
-
return resolveFillCandidateArgs(candidates, target.text, allowFill);
|
|
128
|
-
}
|
|
129
|
-
if (target.action === "select") {
|
|
130
|
-
return resolveSelectCandidateArgs(candidates, selectValues);
|
|
131
|
-
}
|
|
132
|
-
return candidates.find((candidate) => candidate.args !== undefined)?.args;
|
|
133
|
-
}
|
|
134
|
-
export function resolveVisibleRefActionFromSnapshot(options) {
|
|
135
|
-
const target = getFindVisibleRefFallbackTarget(options.compiledAction.args);
|
|
136
|
-
if (!target) {
|
|
137
|
-
return undefined;
|
|
138
|
-
}
|
|
139
|
-
const snapshot = options.refSnapshot ?? extractRefSnapshotFromData(options.snapshotData);
|
|
140
|
-
if (!snapshot) {
|
|
141
|
-
return undefined;
|
|
142
|
-
}
|
|
143
|
-
const selectOptionValues = options.compiledAction.values && options.compiledAction.values.length > 0
|
|
144
|
-
? options.compiledAction.values
|
|
145
|
-
: target.optionValues;
|
|
146
|
-
const effectiveTarget = target.action === "select" && selectOptionValues
|
|
147
|
-
? { ...target, optionValues: selectOptionValues }
|
|
148
|
-
: target;
|
|
149
|
-
const candidates = getVisibleRefFallbackCandidates(effectiveTarget, options.snapshotData, options.refSnapshot);
|
|
150
|
-
const args = resolveCandidateArgs(effectiveTarget, candidates, options.allowFill, selectOptionValues);
|
|
151
|
-
return args ? { args, snapshot } : undefined;
|
|
152
|
-
}
|
|
153
|
-
export function buildVisibleRefFallbackNextActions(options) {
|
|
154
|
-
const ambiguous = options.diagnostic.candidates.length > 1;
|
|
155
|
-
return options.diagnostic.candidates.flatMap((candidate, index) => candidate.args
|
|
156
|
-
? [
|
|
157
|
-
{
|
|
158
|
-
id: ambiguous ? `try-current-visible-ref-${index + 1}` : "try-current-visible-ref",
|
|
159
|
-
params: { args: withOptionalSessionArgs(options.sessionName, candidate.args) },
|
|
160
|
-
reason: candidate.reason,
|
|
161
|
-
safety: ambiguous
|
|
162
|
-
? "Several current refs share the same exact role/name. Inspect the snapshot and use only the ref that clearly matches the intended target."
|
|
163
|
-
: "Use only while this current snapshot still represents the page; refresh refs first if the page changed.",
|
|
164
|
-
tool: "agent_browser",
|
|
165
|
-
},
|
|
166
|
-
]
|
|
167
|
-
: []);
|
|
168
|
-
}
|
|
169
|
-
export function formatVisibleRefFallbackText(diagnostic) {
|
|
170
|
-
if (!diagnostic) {
|
|
171
|
-
return undefined;
|
|
172
|
-
}
|
|
173
|
-
return [
|
|
174
|
-
"Current snapshot ref fallback:",
|
|
175
|
-
...diagnostic.candidates.map((candidate) => `- ${candidate.ref}${candidate.role.length > 0 ? ` ${candidate.role}` : ""} ${JSON.stringify(candidate.name)}: ${candidate.reason}`),
|
|
176
|
-
].join("\n");
|
|
177
|
-
}
|
|
178
|
-
export function sanitizeVisibleRefFallbackDiagnostic(diagnostic) {
|
|
179
|
-
return {
|
|
180
|
-
candidates: diagnostic.candidates.map(({ editableEvidence: _editableEvidence, ...candidate }) => candidate),
|
|
181
|
-
snapshot: diagnostic.snapshot,
|
|
182
|
-
summary: diagnostic.summary,
|
|
183
|
-
target: diagnostic.target,
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function isRichInputRecoveryCandidate(candidate) {
|
|
187
|
-
return (candidate.action === "fill" &&
|
|
188
|
-
candidate.editableEvidence !== false &&
|
|
189
|
-
RICH_INPUT_RECOVERY_EDITABLE_ROLES.has(candidate.role.toLowerCase()));
|
|
190
|
-
}
|
|
191
|
-
export function buildRichInputRecoveryDiagnostic(diagnostic) {
|
|
192
|
-
if (!diagnostic || diagnostic.target.action !== "fill") {
|
|
193
|
-
return undefined;
|
|
194
|
-
}
|
|
195
|
-
const candidates = diagnostic.candidates
|
|
196
|
-
.filter(isRichInputRecoveryCandidate)
|
|
197
|
-
.map((candidate) => ({
|
|
198
|
-
clickArgs: ["click", candidate.ref],
|
|
199
|
-
focusArgs: ["focus", candidate.ref],
|
|
200
|
-
name: candidate.name,
|
|
201
|
-
reason: `Current snapshot shows editable ${candidate.role} ${JSON.stringify(candidate.name)} at ${candidate.ref}; focus or click it before keyboard insertion instead of retrying fill with copied text.`,
|
|
202
|
-
ref: candidate.ref,
|
|
203
|
-
role: candidate.role,
|
|
204
|
-
}));
|
|
205
|
-
if (candidates.length === 0) {
|
|
206
|
-
return undefined;
|
|
207
|
-
}
|
|
208
|
-
return {
|
|
209
|
-
candidates,
|
|
210
|
-
inputMethodHint: RICH_INPUT_RECOVERY_HINT,
|
|
211
|
-
nextActionIds: getAgentBrowserRichInputRecoveryNextActionIds(candidates.length),
|
|
212
|
-
summary: candidates.length === 1
|
|
213
|
-
? "Fill locator missed, but the current snapshot has one exact editable ref candidate for safe keyboard-based recovery."
|
|
214
|
-
: `Fill locator missed, but the current snapshot has ${candidates.length} exact editable ref candidates; choose only if the intended input is unambiguous.`,
|
|
215
|
-
target: { roles: diagnostic.target.roles, targetName: diagnostic.target.targetName },
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
export function buildRichInputRecoveryNextActions(options) {
|
|
219
|
-
const candidateCount = options.diagnostic.candidates.length;
|
|
220
|
-
const ambiguous = candidateCount > 1;
|
|
221
|
-
return options.diagnostic.candidates.flatMap((candidate, index) => {
|
|
222
|
-
const focusId = getAgentBrowserRichInputRecoveryNextActionId("focus", index, candidateCount);
|
|
223
|
-
const clickId = getAgentBrowserRichInputRecoveryNextActionId("click", index, candidateCount);
|
|
224
|
-
const safety = ambiguous
|
|
225
|
-
? `Several editable refs share the same exact name. Inspect the current snapshot and use only the ${candidate.ref} ${candidate.role} if it is clearly the intended input. No fill text or submit key is included.`
|
|
226
|
-
: "Does not include fill text or submit the form. After focus/click succeeds, use keyboard type for framework-controlled editors; use keyboard inserttext only with separate application-state verification.";
|
|
227
|
-
return [
|
|
228
|
-
{
|
|
229
|
-
id: focusId,
|
|
230
|
-
params: { args: withOptionalSessionArgs(options.sessionName, candidate.focusArgs) },
|
|
231
|
-
reason: candidate.reason,
|
|
232
|
-
safety,
|
|
233
|
-
tool: "agent_browser",
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
id: clickId,
|
|
237
|
-
params: { args: withOptionalSessionArgs(options.sessionName, candidate.clickArgs) },
|
|
238
|
-
reason: `Click ${candidate.ref} to focus the editable ${candidate.role} before keyboard insertion when focus alone is insufficient.`,
|
|
239
|
-
safety: `${safety} A click may run normal focus/click handlers, but this action does not press Enter or auto-submit.`,
|
|
240
|
-
tool: "agent_browser",
|
|
241
|
-
},
|
|
242
|
-
];
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
export function formatRichInputRecoveryText(diagnostic) {
|
|
246
|
-
if (!diagnostic) {
|
|
247
|
-
return undefined;
|
|
248
|
-
}
|
|
249
|
-
return [
|
|
250
|
-
"Rich input recovery:",
|
|
251
|
-
...diagnostic.candidates.map((candidate, index) => {
|
|
252
|
-
const focusId = diagnostic.nextActionIds.at(index * 2);
|
|
253
|
-
const clickId = diagnostic.nextActionIds.at(index * 2 + 1);
|
|
254
|
-
return `- ${candidate.ref} ${candidate.role} ${JSON.stringify(candidate.name)}: use ${focusId ?? "undefined"} or ${clickId ?? "undefined"}; then use keyboard type for framework-controlled editors, or paste-like keyboard inserttext only with separate application-state verification.`;
|
|
255
|
-
}),
|
|
256
|
-
`- ${diagnostic.inputMethodHint}`,
|
|
257
|
-
].join("\n");
|
|
258
|
-
}
|
|
259
|
-
function normalizeSemanticActionAccessibleName(name) {
|
|
260
|
-
return name.replace(/\s+/g, " ").trim().toLowerCase();
|
|
261
|
-
}
|