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,70 +0,0 @@
|
|
|
1
|
-
import { isAgentBrowserBatchResultArray } from "./batch.js";
|
|
2
|
-
import { redactModelFacingText } from "./common.js";
|
|
3
|
-
import { redactPresentationData } from "./diagnostics.js";
|
|
4
|
-
import { buildErrorPresentation } from "./errors.js";
|
|
5
|
-
import { compactLargePresentationOutput } from "./large-output.js";
|
|
6
|
-
import { stringifyUnknown } from "../text.js";
|
|
7
|
-
function getNativeTextSummary(text) {
|
|
8
|
-
const first = text.split("\n", 1).at(0);
|
|
9
|
-
return first !== undefined && first.length > 0 ? first : "Native text command completed.";
|
|
10
|
-
}
|
|
11
|
-
export function sanitizeModelFacingPresentation(presentation) {
|
|
12
|
-
return {
|
|
13
|
-
...presentation,
|
|
14
|
-
content: presentation.content.map((item) => item.type === "text" ? { ...item, text: redactModelFacingText(item.text) } : item),
|
|
15
|
-
summary: redactModelFacingText(presentation.summary),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
async function buildNativeTextPresentation(options, commandInfo) {
|
|
19
|
-
const value = redactPresentationData(commandInfo, typeof options.envelope?.data === "string" ? options.envelope.data : "", options.stdin);
|
|
20
|
-
const text = typeof value === "string" ? value : stringifyUnknown(value);
|
|
21
|
-
const failure = options.errorText !== undefined && options.errorText.length > 0
|
|
22
|
-
? buildErrorPresentation({
|
|
23
|
-
args: options.args,
|
|
24
|
-
commandInfo: options.commandInfo,
|
|
25
|
-
errorText: options.errorText,
|
|
26
|
-
sessionName: options.sessionName,
|
|
27
|
-
})
|
|
28
|
-
: undefined;
|
|
29
|
-
const presentation = {
|
|
30
|
-
...failure,
|
|
31
|
-
content: options.modelVisible === false
|
|
32
|
-
? []
|
|
33
|
-
: [{ type: "text", text: [options.errorText, text].filter(Boolean).join("\n\n") }],
|
|
34
|
-
data: text,
|
|
35
|
-
summary: failure?.summary ?? getNativeTextSummary(text),
|
|
36
|
-
};
|
|
37
|
-
return sanitizeModelFacingPresentation(options.modelVisible === false
|
|
38
|
-
? presentation
|
|
39
|
-
: await compactLargePresentationOutput({
|
|
40
|
-
artifactManifest: options.artifactManifest,
|
|
41
|
-
commandInfo: options.commandInfo,
|
|
42
|
-
data: presentation.data,
|
|
43
|
-
persistentArtifactStore: options.persistentArtifactStore,
|
|
44
|
-
presentation,
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
export async function buildEarlyPresentation(options, commands) {
|
|
48
|
-
if (options.textOutput === true) {
|
|
49
|
-
return buildNativeTextPresentation(options, commands.commandInfo);
|
|
50
|
-
}
|
|
51
|
-
const recordingBatch = options.commandInfo.command === "batch" &&
|
|
52
|
-
isAgentBrowserBatchResultArray(options.envelope?.data) &&
|
|
53
|
-
options.envelope.data.some((row) => row.command?.[0] === "record");
|
|
54
|
-
if (options.errorText !== undefined &&
|
|
55
|
-
options.errorText.length > 0 &&
|
|
56
|
-
options.commandInfo.command !== "record" &&
|
|
57
|
-
!recordingBatch) {
|
|
58
|
-
return {
|
|
59
|
-
...buildErrorPresentation({
|
|
60
|
-
args: options.args,
|
|
61
|
-
commandInfo: options.commandInfo,
|
|
62
|
-
errorText: options.errorText,
|
|
63
|
-
presentationCommand: commands.presentationCommandInfo.command,
|
|
64
|
-
sessionName: options.sessionName,
|
|
65
|
-
}),
|
|
66
|
-
data: redactPresentationData(commands.commandInfo, options.envelope?.data),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { isOpenNavigationCommand } from "../../command-taxonomy.js";
|
|
2
|
-
import { isRecord } from "../../parsing.js";
|
|
3
|
-
import { extractUpstreamCommandTokens } from "../../argv-descriptor.js";
|
|
4
|
-
import { redactSensitiveText } from "../../runtime-redaction.js";
|
|
5
|
-
import { buildBrowserProfileConfigRecovery } from "./browser-profile-recovery.js";
|
|
6
|
-
import { redactModelFacingText } from "./common.js";
|
|
7
|
-
import { buildAgentBrowserNextActions } from "../action-recommendations.js";
|
|
8
|
-
import { buildAgentBrowserResultCategoryDetails } from "../categories.js";
|
|
9
|
-
import { withOptionalSessionArgs } from "../next-actions.js";
|
|
10
|
-
const STALE_REF_ERROR_HINT = [
|
|
11
|
-
"Agent-browser hint: This ref may be stale after navigation, scrolling, or re-rendering.",
|
|
12
|
-
"Run `snapshot -i` again and retry with a current `@e…` ref; for less ref churn, use `find role|text|label|placeholder|alt|title|testid ...` or `scrollintoview` before interacting with off-screen elements.",
|
|
13
|
-
].join(" ");
|
|
14
|
-
const SELECTOR_DIALECT_ERROR_HINT = [
|
|
15
|
-
"Agent-browser hint: This selector may use an unsupported selector dialect.",
|
|
16
|
-
"Prefer refs from `snapshot -i`, or use supported `find role|text|label|placeholder|alt|title|testid ...` locators; use `scrollintoview` before interacting with off-screen elements.",
|
|
17
|
-
].join(" ");
|
|
18
|
-
const CLIPBOARD_PERMISSION_ERROR_HINT = [
|
|
19
|
-
"Agent-browser clipboard hint: Clipboard read/write access is environment-dependent and often fails in headless, managed, remote-profile, or file:// sessions.",
|
|
20
|
-
"If you see `NotAllowedError` or `permission denied`, treat it as a browser/OS permission limitation rather than proof that page state changed.",
|
|
21
|
-
"When possible, prefer page-native reads (`snapshot -i`, `get text`, `eval --stdin`) or direct input (`keyboard inserttext` / `keyboard type`) instead of relying on OS clipboard access.",
|
|
22
|
-
"If true clipboard access is required, retry in a browser/profile/session with explicit clipboard permission on a normal http(s) page.",
|
|
23
|
-
].join(" ");
|
|
24
|
-
const KEYBOARD_PRESS_ERROR_HINT = [
|
|
25
|
-
"Agent-browser keyboard hint: upstream keyboard commands are `keyboard type <text>` and `keyboard inserttext <text>`; `keyboard press` is not a supported subcommand in the targeted upstream version.",
|
|
26
|
-
'For Enter in text fields, use `keyboard type "\\n"` after focusing the intended control, then verify with a fresh snapshot, URL, or page-state check.',
|
|
27
|
-
].join(" ");
|
|
28
|
-
function getSelectorRecoveryHint(errorText) {
|
|
29
|
-
const normalized = errorText.trim();
|
|
30
|
-
if (normalized.length === 0) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
if (/\bUnknown ref\b|\bstale ref\b|\bref\b.*\b(?:not found|missing|expired)\b/i.test(normalized)) {
|
|
34
|
-
return STALE_REF_ERROR_HINT;
|
|
35
|
-
}
|
|
36
|
-
const mentionsPlaywrightSelectorDialect = /(?:\btext=|:has-text\(|\bgetByRole\b|\bgetByText\b)/i.test(normalized);
|
|
37
|
-
const reportsSelectorMatchFailure = /\b(?:no elements? found|failed to find|could not find|unable to find)\b.*\b(?:selector|locator)\b/i.test(normalized) ||
|
|
38
|
-
/\b(?:selector|locator)\b.*\b(?:no elements? found|not found|missing|failed to find|could not find|unable to find)\b/i.test(normalized);
|
|
39
|
-
if (/\b(?:unsupported|unknown|invalid)\s+(?:selector|locator)\b/i.test(normalized) ||
|
|
40
|
-
/\bfailed to parse selector\b/i.test(normalized) ||
|
|
41
|
-
/\bselector\b.*\b(?:parse|syntax|unsupported|invalid)\b/i.test(normalized) ||
|
|
42
|
-
(mentionsPlaywrightSelectorDialect && reportsSelectorMatchFailure)) {
|
|
43
|
-
return SELECTOR_DIALECT_ERROR_HINT;
|
|
44
|
-
}
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
function getClipboardPermissionHint(commandInfo, errorText) {
|
|
48
|
-
if (commandInfo.command !== "clipboard") {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
if (!/\bNotAllowedError\b|\bclipboard\b.*\bpermission denied\b|\bpermission denied\b.*\bclipboard\b/i.test(errorText)) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
return CLIPBOARD_PERMISSION_ERROR_HINT;
|
|
55
|
-
}
|
|
56
|
-
function getKeyboardPressHint(commandInfo, errorText) {
|
|
57
|
-
if (commandInfo.command !== "keyboard" || commandInfo.subcommand !== "press") {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
if (!/\bunknown\s+subcommand\b|\bvalid options?\b/i.test(errorText)) {
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
return KEYBOARD_PRESS_ERROR_HINT;
|
|
64
|
-
}
|
|
65
|
-
export function isOverlayBlockedClickError(command, errorText, args) {
|
|
66
|
-
const tokens = args ? extractUpstreamCommandTokens(args) : [];
|
|
67
|
-
const action = tokens[0] === "find"
|
|
68
|
-
? (tokens[tokens[1] === "nth" ? 4 : 3] ?? "click")
|
|
69
|
-
: (tokens[0] ?? command);
|
|
70
|
-
return (action === "click" &&
|
|
71
|
-
errorText !== undefined &&
|
|
72
|
-
/\bis covered by\b[\s\S]*\bat its click point\b/i.test(errorText));
|
|
73
|
-
}
|
|
74
|
-
export function redactClipboardPermissionEcho(commandInfo, errorText) {
|
|
75
|
-
if (commandInfo.command !== "clipboard") {
|
|
76
|
-
return errorText;
|
|
77
|
-
}
|
|
78
|
-
return errorText
|
|
79
|
-
.replace(/(\b(?:read|write)\s+permission denied\b(?:\s+for)?\s+)([\s\S]+)$/gi, "$1[REDACTED]")
|
|
80
|
-
.replace(/(\bFailed to execute '[^']+' on 'Clipboard':\s*)([\s\S]+)$/gi, (match, prefix, suffix) => {
|
|
81
|
-
if (!/\bpermission denied\b/i.test(suffix)) {
|
|
82
|
-
return match;
|
|
83
|
-
}
|
|
84
|
-
return `${prefix}${suffix.replace(/(\bpermission denied\b(?:\s+for)?\s+)([\s\S]+)$/i, "$1[REDACTED]")}`;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
export function getClipboardWritePayloadCandidates(commandTokens) {
|
|
88
|
-
if (commandTokens[0] !== "clipboard" || commandTokens[1] !== "write") {
|
|
89
|
-
return [];
|
|
90
|
-
}
|
|
91
|
-
const payloadTokens = commandTokens.slice(2).filter((value) => value.length > 0);
|
|
92
|
-
return [
|
|
93
|
-
...new Set([...payloadTokens, payloadTokens.join(" ")].filter((value) => value.length > 0)),
|
|
94
|
-
];
|
|
95
|
-
}
|
|
96
|
-
function shouldRedactClipboardPayloadField(key, value, payloadCandidates) {
|
|
97
|
-
return payloadCandidates.some((candidate) => {
|
|
98
|
-
if (value === candidate) {
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
if (candidate.length < 8 || !/payload|clipboard|argument/i.test(key)) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
return value.includes(candidate);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
export function redactClipboardPermissionErrorValue(commandInfo, value, payloadCandidates = []) {
|
|
108
|
-
if (commandInfo.command !== "clipboard") {
|
|
109
|
-
return value;
|
|
110
|
-
}
|
|
111
|
-
if (typeof value === "string") {
|
|
112
|
-
return payloadCandidates.includes(value)
|
|
113
|
-
? "[REDACTED]"
|
|
114
|
-
: redactClipboardPermissionEcho(commandInfo, value);
|
|
115
|
-
}
|
|
116
|
-
if (Array.isArray(value)) {
|
|
117
|
-
return value.map((item) => redactClipboardPermissionErrorValue(commandInfo, item, payloadCandidates));
|
|
118
|
-
}
|
|
119
|
-
if (!isRecord(value)) {
|
|
120
|
-
return value;
|
|
121
|
-
}
|
|
122
|
-
return Object.fromEntries(Object.entries(value).map(([key, entryValue]) => [
|
|
123
|
-
key,
|
|
124
|
-
typeof entryValue === "string" &&
|
|
125
|
-
shouldRedactClipboardPayloadField(key, entryValue, payloadCandidates)
|
|
126
|
-
? "[REDACTED]"
|
|
127
|
-
: redactClipboardPermissionErrorValue(commandInfo, entryValue, payloadCandidates),
|
|
128
|
-
]));
|
|
129
|
-
}
|
|
130
|
-
const UNKNOWN_COMMAND_SUGGESTIONS = {
|
|
131
|
-
attr: [
|
|
132
|
-
{
|
|
133
|
-
description: "Use `get attr <selector> <name>` to read an attribute from a selector or current `@ref`.",
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
count: [{ description: "Use `get count <selector>` to count matching elements." }],
|
|
137
|
-
html: [
|
|
138
|
-
{
|
|
139
|
-
description: "Use `get html <selector>` to read element HTML from a selector or current `@ref`; use `get html body` when you need whole-page body HTML.",
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
text: [
|
|
143
|
-
{
|
|
144
|
-
description: "Use `get text <selector>` to read text from a selector or current `@ref`; run `snapshot -i` first when you need a safe `@ref`.",
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
title: [
|
|
148
|
-
{
|
|
149
|
-
args: ["get", "title"],
|
|
150
|
-
description: "Use `get title` to read the current page title.",
|
|
151
|
-
id: "use-get-title",
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
url: [
|
|
155
|
-
{
|
|
156
|
-
args: ["get", "url"],
|
|
157
|
-
description: "Use `get url` to read the current page URL.",
|
|
158
|
-
id: "use-get-url",
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
value: [
|
|
162
|
-
{
|
|
163
|
-
description: "Use `get value <selector>` to read form control value from a selector or current `@ref`.",
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
};
|
|
167
|
-
function getUnknownCommandSuggestions(command, errorText) {
|
|
168
|
-
if (command === undefined || command.length === 0) {
|
|
169
|
-
return [];
|
|
170
|
-
}
|
|
171
|
-
const normalizedCommand = command.trim().toLowerCase();
|
|
172
|
-
if (!/\bunknown\s+command\b|\bunknown\s+subcommand\b|\bunrecognized\s+command\b/i.test(errorText)) {
|
|
173
|
-
return [];
|
|
174
|
-
}
|
|
175
|
-
return UNKNOWN_COMMAND_SUGGESTIONS[normalizedCommand] ?? [];
|
|
176
|
-
}
|
|
177
|
-
function formatUnknownCommandSuggestionText(suggestions) {
|
|
178
|
-
if (suggestions.length === 0) {
|
|
179
|
-
return undefined;
|
|
180
|
-
}
|
|
181
|
-
return [
|
|
182
|
-
"Agent-browser hint: This looks like a getter shortcut, but upstream getter commands are grouped under `get`.",
|
|
183
|
-
...suggestions.map((suggestion) => suggestion.description),
|
|
184
|
-
].join(" ");
|
|
185
|
-
}
|
|
186
|
-
function buildUnknownCommandSuggestionActions(suggestions, sessionName) {
|
|
187
|
-
const actions = suggestions
|
|
188
|
-
.filter((suggestion) => suggestion.args !== undefined && suggestion.id !== undefined)
|
|
189
|
-
.map((suggestion) => ({
|
|
190
|
-
id: suggestion.id,
|
|
191
|
-
params: { args: withOptionalSessionArgs(sessionName, suggestion.args) },
|
|
192
|
-
reason: suggestion.description,
|
|
193
|
-
safety: "Read-only getter command; safe to retry when you intended to inspect page state.",
|
|
194
|
-
tool: "agent_browser",
|
|
195
|
-
}));
|
|
196
|
-
return actions.length > 0 ? actions : undefined;
|
|
197
|
-
}
|
|
198
|
-
function getLocalhostNavigationHint(commandInfo, errorText) {
|
|
199
|
-
if (!isOpenNavigationCommand(commandInfo.command) ||
|
|
200
|
-
commandInfo.subcommand === undefined ||
|
|
201
|
-
commandInfo.subcommand.length === 0) {
|
|
202
|
-
return undefined;
|
|
203
|
-
}
|
|
204
|
-
if (!/\bnet::ERR_(?:EMPTY_RESPONSE|CONNECTION_REFUSED|ADDRESS_UNREACHABLE|TIMED_OUT|CONNECTION_RESET)\b/i.test(errorText)) {
|
|
205
|
-
return undefined;
|
|
206
|
-
}
|
|
207
|
-
let targetUrl;
|
|
208
|
-
try {
|
|
209
|
-
targetUrl = new URL(commandInfo.subcommand);
|
|
210
|
-
}
|
|
211
|
-
catch {
|
|
212
|
-
return undefined;
|
|
213
|
-
}
|
|
214
|
-
if (!["localhost", "127.0.0.1", "::1", "[::1]"].includes(targetUrl.hostname.toLowerCase())) {
|
|
215
|
-
return undefined;
|
|
216
|
-
}
|
|
217
|
-
return [
|
|
218
|
-
"Agent-browser local fixture hint: the browser process could not read a loopback URL from its own network namespace or browser host.",
|
|
219
|
-
"Verify the server is still running and bound to an address the browser host can reach; if curl works from the shell but browser navigation fails, try the other loopback alias, add a proxy bypass for localhost/127.0.0.1 if a proxy is configured, or use a browser-host-reachable URL.",
|
|
220
|
-
"Use file:// only for static fallback fixtures and clean up any temporary server process outside agent_browser when the check is done.",
|
|
221
|
-
].join(" ");
|
|
222
|
-
}
|
|
223
|
-
export function appendSelectorRecoveryHint(errorText) {
|
|
224
|
-
const hint = getSelectorRecoveryHint(errorText);
|
|
225
|
-
if (hint === undefined || hint.length === 0 || errorText.includes("Agent-browser hint:")) {
|
|
226
|
-
return errorText;
|
|
227
|
-
}
|
|
228
|
-
return `${errorText}\n\n${hint}`;
|
|
229
|
-
}
|
|
230
|
-
function buildHintedErrorText(commandInfo, errorText, unknownSuggestion, profileHint) {
|
|
231
|
-
const selectorHinted = appendSelectorRecoveryHint(errorText);
|
|
232
|
-
return [
|
|
233
|
-
selectorHinted,
|
|
234
|
-
unknownSuggestion !== undefined &&
|
|
235
|
-
unknownSuggestion.length > 0 &&
|
|
236
|
-
!selectorHinted.includes("Agent-browser hint:")
|
|
237
|
-
? unknownSuggestion
|
|
238
|
-
: undefined,
|
|
239
|
-
profileHint,
|
|
240
|
-
getLocalhostNavigationHint(commandInfo, errorText),
|
|
241
|
-
getClipboardPermissionHint(commandInfo, errorText),
|
|
242
|
-
getKeyboardPressHint(commandInfo, errorText),
|
|
243
|
-
]
|
|
244
|
-
.filter((part) => part !== undefined && part.length > 0)
|
|
245
|
-
.join("\n\n");
|
|
246
|
-
}
|
|
247
|
-
export function buildErrorPresentation(options) {
|
|
248
|
-
const { args, commandInfo, errorText, presentationCommand, sessionName } = options;
|
|
249
|
-
const safeErrorText = redactModelFacingText(redactSensitiveText(redactClipboardPermissionEcho(commandInfo, errorText)));
|
|
250
|
-
const unknownCommandSuggestions = getUnknownCommandSuggestions(commandInfo.command, safeErrorText);
|
|
251
|
-
const unknownCommandSuggestionText = formatUnknownCommandSuggestionText(unknownCommandSuggestions);
|
|
252
|
-
const browserProfileConfigRecovery = buildBrowserProfileConfigRecovery({
|
|
253
|
-
args,
|
|
254
|
-
commandInfo,
|
|
255
|
-
errorText: safeErrorText,
|
|
256
|
-
});
|
|
257
|
-
const hintedErrorText = buildHintedErrorText(commandInfo, safeErrorText, unknownCommandSuggestionText, browserProfileConfigRecovery?.hint);
|
|
258
|
-
const categoryDetails = buildAgentBrowserResultCategoryDetails({
|
|
259
|
-
args: [commandInfo.command, commandInfo.subcommand].filter((item) => item !== undefined),
|
|
260
|
-
command: commandInfo.command,
|
|
261
|
-
errorText: hintedErrorText,
|
|
262
|
-
succeeded: false,
|
|
263
|
-
});
|
|
264
|
-
const nextActions = [
|
|
265
|
-
...(buildUnknownCommandSuggestionActions(unknownCommandSuggestions, sessionName) ?? []),
|
|
266
|
-
...(browserProfileConfigRecovery?.actions ?? []),
|
|
267
|
-
...(browserProfileConfigRecovery
|
|
268
|
-
? []
|
|
269
|
-
: (buildAgentBrowserNextActions({
|
|
270
|
-
args,
|
|
271
|
-
command: commandInfo.command,
|
|
272
|
-
failureCategory: categoryDetails.failureCategory,
|
|
273
|
-
overlayBlockedClick: isOverlayBlockedClickError(presentationCommand ?? commandInfo.command, safeErrorText, args ?? commandInfo.commandTokens),
|
|
274
|
-
resultCategory: "failure",
|
|
275
|
-
sessionName,
|
|
276
|
-
subcommand: commandInfo.subcommand,
|
|
277
|
-
}) ?? [])),
|
|
278
|
-
];
|
|
279
|
-
return {
|
|
280
|
-
...categoryDetails,
|
|
281
|
-
content: [{ type: "text", text: hintedErrorText }],
|
|
282
|
-
nextActions: nextActions.length > 0 ? nextActions : undefined,
|
|
283
|
-
summary: hintedErrorText,
|
|
284
|
-
};
|
|
285
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { countLines, stringifyUnknown, truncateText } from "../text.js";
|
|
2
|
-
import { applyArtifactManifest } from "./artifacts.js";
|
|
3
|
-
import { getPresentationText } from "./content.js";
|
|
4
|
-
import { buildSpillArtifactEntries, writeLargeOutputSpillFile, } from "./output-spill.js";
|
|
5
|
-
export { OBSERVATION_INLINE_MAX_CHARS } from "./content.js";
|
|
6
|
-
export { renderAgentBrowserObservation } from "./observation-rendering.js";
|
|
7
|
-
function shouldCompactLargeOutput(text) {
|
|
8
|
-
return text.length > 8_000 || countLines(text) > 120;
|
|
9
|
-
}
|
|
10
|
-
function buildLargeOutputPreview(text) {
|
|
11
|
-
const lines = text.split("\n");
|
|
12
|
-
const previewLines = [];
|
|
13
|
-
let previewChars = 0;
|
|
14
|
-
for (const line of lines) {
|
|
15
|
-
if (previewLines.length >= 40 || previewChars >= 2_500) {
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
const remainingChars = 2_500 - previewChars;
|
|
19
|
-
const previewLine = truncateText(line, Math.min(Math.max(40, remainingChars), 240));
|
|
20
|
-
previewLines.push(previewLine);
|
|
21
|
-
previewChars += previewLine.length + 1;
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
omittedLineCount: Math.max(0, lines.length - previewLines.length),
|
|
25
|
-
previewText: previewLines.join("\n"),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function buildLargeOutputFailureContext(presentation) {
|
|
29
|
-
const failure = presentation.batchFailure;
|
|
30
|
-
if (!failure) {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
const failedStep = failure.failedStep;
|
|
34
|
-
const commandText = truncateText(failedStep.commandText, 240);
|
|
35
|
-
const lines = [
|
|
36
|
-
"Failure context:",
|
|
37
|
-
`- First failing step: ${failedStep.index + 1} — ${commandText}`,
|
|
38
|
-
`- Batch result: ${failure.successCount}/${failure.totalCount} succeeded${failure.failureCount > 1 ? `; ${failure.failureCount} failed` : ""}`,
|
|
39
|
-
];
|
|
40
|
-
if (failedStep.failureCategory !== undefined) {
|
|
41
|
-
lines.push(`- Failure category: ${failedStep.failureCategory}`);
|
|
42
|
-
}
|
|
43
|
-
const failureText = (failedStep.text.length > 0 ? failedStep.text : failedStep.summary)
|
|
44
|
-
.replace(/\s+/g, " ")
|
|
45
|
-
.trim();
|
|
46
|
-
if (failureText.length > 0) {
|
|
47
|
-
lines.push(`- Failure detail: ${truncateText(failureText, 700)}`);
|
|
48
|
-
}
|
|
49
|
-
const stepPaths = [failedStep.fullOutputPath, ...(failedStep.fullOutputPaths ?? [])].filter((path, index, paths) => typeof path === "string" && path.length > 0 && paths.indexOf(path) === index);
|
|
50
|
-
if (stepPaths.length > 0) {
|
|
51
|
-
lines.push(`- Failed-step spill path${stepPaths.length === 1 ? "" : "s"}: ${stepPaths.join(", ")}`);
|
|
52
|
-
}
|
|
53
|
-
return lines;
|
|
54
|
-
}
|
|
55
|
-
async function tryWritePresentationSpill(options) {
|
|
56
|
-
try {
|
|
57
|
-
return { spill: await writeLargeOutputSpillFile(options) };
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
return { error: error instanceof Error ? error.message : stringifyUnknown(error) };
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function buildCompactedText(command, text, presentation, persisted) {
|
|
64
|
-
const { omittedLineCount, previewText } = buildLargeOutputPreview(text);
|
|
65
|
-
const failureContext = buildLargeOutputFailureContext(presentation);
|
|
66
|
-
const lines = [
|
|
67
|
-
`Large ${command ?? "agent-browser"} output compacted.`,
|
|
68
|
-
...(failureContext.length > 0 ? ["", ...failureContext] : []),
|
|
69
|
-
"",
|
|
70
|
-
"Preview:",
|
|
71
|
-
previewText,
|
|
72
|
-
];
|
|
73
|
-
if (omittedLineCount > 0) {
|
|
74
|
-
lines.push(`- ... (${omittedLineCount} additional lines omitted)`);
|
|
75
|
-
}
|
|
76
|
-
lines.push("", persisted.spill
|
|
77
|
-
? `Full output path: ${persisted.spill.path}`
|
|
78
|
-
: `Full output unavailable: ${persisted.error ?? "spill file could not be created."}`);
|
|
79
|
-
return { compactedText: lines.join("\n"), previewText };
|
|
80
|
-
}
|
|
81
|
-
// The presentation owner supplies its mutable assembly draft; compaction preserves that identity.
|
|
82
|
-
function applyCompactedPresentation(draft, text, rendered, persisted) {
|
|
83
|
-
const firstTextIndex = draft.content.findIndex((part) => part.type === "text");
|
|
84
|
-
if (firstTextIndex >= 0) {
|
|
85
|
-
draft.content[firstTextIndex] = { type: "text", text: rendered.compactedText };
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
draft.content.unshift({ type: "text", text: rendered.compactedText });
|
|
89
|
-
}
|
|
90
|
-
draft.data = {
|
|
91
|
-
compacted: true,
|
|
92
|
-
fullOutputPath: persisted.spill?.path,
|
|
93
|
-
outputCharCount: text.length,
|
|
94
|
-
outputLineCount: countLines(text),
|
|
95
|
-
previewCharCount: rendered.previewText.length,
|
|
96
|
-
previewLineCount: countLines(rendered.previewText),
|
|
97
|
-
spillError: persisted.error,
|
|
98
|
-
};
|
|
99
|
-
draft.fullOutputPath = persisted.spill?.path;
|
|
100
|
-
draft.summary = `${draft.summary} (compact)`;
|
|
101
|
-
}
|
|
102
|
-
export async function compactLargePresentationOutput(options) {
|
|
103
|
-
const text = getPresentationText(options.presentation);
|
|
104
|
-
if (text.length === 0 || !shouldCompactLargeOutput(text)) {
|
|
105
|
-
return options.presentation;
|
|
106
|
-
}
|
|
107
|
-
const persisted = await tryWritePresentationSpill({
|
|
108
|
-
data: options.data,
|
|
109
|
-
persistentArtifactStore: options.persistentArtifactStore,
|
|
110
|
-
text,
|
|
111
|
-
});
|
|
112
|
-
const rendered = buildCompactedText(options.commandInfo.command, text, options.presentation, persisted);
|
|
113
|
-
applyCompactedPresentation(options.presentation, text, rendered, persisted);
|
|
114
|
-
return persisted.spill
|
|
115
|
-
? applyArtifactManifest(options.presentation, options.presentation.artifactManifest ?? options.artifactManifest, buildSpillArtifactEntries({ ...persisted.spill, commandInfo: options.commandInfo }))
|
|
116
|
-
: options.presentation;
|
|
117
|
-
}
|