pi-agent-browser-native 0.9.2 → 0.9.4
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 +91 -5
- package/README.md +120 -86
- package/dist/extensions/agent-browser/index.js +43065 -2016
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +49 -26
- package/dist/extensions/agent-browser/lib/argv-grammar.js +82 -93
- package/dist/extensions/agent-browser/lib/bash-guard.js +129 -126
- package/dist/extensions/agent-browser/lib/batch-lifecycle.js +113 -49
- package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +61 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +232 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claims.js +202 -0
- package/dist/extensions/agent-browser/lib/browser-execution-identity.js +77 -0
- package/dist/extensions/agent-browser/lib/browser-journal-branch.js +98 -0
- package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-journal-projection.js +221 -0
- package/dist/extensions/agent-browser/lib/browser-journal-reader.js +89 -0
- package/dist/extensions/agent-browser/lib/browser-journal-replay.js +246 -0
- package/dist/extensions/agent-browser/lib/browser-journal.js +103 -394
- package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +220 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +282 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-types.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +217 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion.js +80 -335
- package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +35 -0
- package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +166 -0
- package/dist/extensions/agent-browser/lib/browser-transcript.js +137 -81
- package/dist/extensions/agent-browser/lib/browser-value-parsing.js +15 -0
- package/dist/extensions/agent-browser/lib/command-capabilities.js +340 -0
- package/dist/extensions/agent-browser/lib/command-policy.js +107 -88
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +49 -322
- package/dist/extensions/agent-browser/lib/config-policy.js +138 -343
- package/dist/extensions/agent-browser/lib/config-providers.js +71 -0
- package/dist/extensions/agent-browser/lib/config-validation.js +218 -0
- package/dist/extensions/agent-browser/lib/config.js +19 -7
- package/dist/extensions/agent-browser/lib/electron/cdp.js +15 -7
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +134 -55
- package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +109 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +136 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +89 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +93 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +162 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/discovery.js +140 -549
- package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +102 -0
- package/dist/extensions/agent-browser/lib/electron/launch-process.js +209 -0
- package/dist/extensions/agent-browser/lib/electron/launch-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/launch.js +249 -354
- package/dist/extensions/agent-browser/lib/executable-path.js +21 -12
- package/dist/extensions/agent-browser/lib/execution-cwd.js +35 -18
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +162 -121
- package/dist/extensions/agent-browser/lib/input-modes/job.js +116 -313
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +104 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +132 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +57 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +151 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +142 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +57 -412
- package/dist/extensions/agent-browser/lib/input-modes/params.js +63 -17
- package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +268 -0
- package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +117 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-child.js +396 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +86 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-types.js +1 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +60 -0
- package/dist/extensions/agent-browser/lib/input-modes/script.js +60 -409
- package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +218 -128
- package/dist/extensions/agent-browser/lib/input-modes/shared.js +15 -4
- package/dist/extensions/agent-browser/lib/input-modes/types.js +56 -7
- package/dist/extensions/agent-browser/lib/json-schema.js +22 -10
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +17 -5
- package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +92 -425
- package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +58 -0
- package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +244 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +84 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +119 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +83 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore.js +168 -300
- package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +277 -0
- package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +128 -305
- package/dist/extensions/agent-browser/lib/managed-session-storage.js +56 -253
- package/dist/extensions/agent-browser/lib/native-confirmation.js +140 -0
- package/dist/extensions/agent-browser/lib/native-output.js +44 -9
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +107 -66
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +14 -6
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +109 -57
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +82 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +171 -57
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +31 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +152 -781
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +202 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +109 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +123 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +156 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +179 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +89 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +97 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +110 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +41 -538
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +204 -108
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +127 -199
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +65 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +113 -30
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +109 -28
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +138 -253
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +59 -24
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +159 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +131 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +42 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +242 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +75 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +92 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +254 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +114 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +222 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +68 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +176 -1114
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +191 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +152 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +115 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +316 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +28 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +333 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +71 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +201 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +183 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +200 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +18 -910
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +23 -13
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +198 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +154 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +68 -151
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +14 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +169 -46
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +210 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +61 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +187 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +171 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +228 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +77 -753
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +92 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +78 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +48 -816
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +86 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +69 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +164 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +161 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +165 -0
- package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +21 -9
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +211 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +23 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +99 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +275 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +280 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +303 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +36 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +335 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +227 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +204 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +139 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +24 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +98 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +295 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +41 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +7 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +102 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +133 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +180 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +269 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +146 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +54 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +261 -185
- package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-config.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +77 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +210 -139
- package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +124 -58
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +198 -98
- package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +199 -96
- package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +55 -0
- package/dist/extensions/agent-browser/lib/page-target-batch.js +118 -0
- package/dist/extensions/agent-browser/lib/page-target-guards.js +50 -0
- package/dist/extensions/agent-browser/lib/page-target-navigation.js +104 -0
- package/dist/extensions/agent-browser/lib/page-target-validation.js +59 -243
- package/dist/extensions/agent-browser/lib/parsing.js +13 -4
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +134 -68
- package/dist/extensions/agent-browser/lib/playbook.js +18 -14
- package/dist/extensions/agent-browser/lib/process-child.js +284 -0
- package/dist/extensions/agent-browser/lib/process-environment.js +22 -6
- package/dist/extensions/agent-browser/lib/process-errors.js +23 -0
- package/dist/extensions/agent-browser/lib/process-identity.js +47 -15
- package/dist/extensions/agent-browser/lib/process-socket-storage.js +256 -0
- package/dist/extensions/agent-browser/lib/process-stdout.js +74 -0
- package/dist/extensions/agent-browser/lib/process.js +146 -537
- package/dist/extensions/agent-browser/lib/prompt-artifacts.js +287 -0
- package/dist/extensions/agent-browser/lib/prompt-policy.js +15 -194
- package/dist/extensions/agent-browser/lib/read-command.js +41 -0
- package/dist/extensions/agent-browser/lib/read-confirmation.js +138 -35
- package/dist/extensions/agent-browser/lib/recording-reservations.js +118 -45
- package/dist/extensions/agent-browser/lib/redaction-fields.js +75 -0
- package/dist/extensions/agent-browser/lib/redaction-json.js +149 -0
- package/dist/extensions/agent-browser/lib/redaction-url.js +88 -0
- package/dist/extensions/agent-browser/lib/results/action-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/action-recommendations.js +28 -271
- package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +96 -94
- package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +73 -0
- package/dist/extensions/agent-browser/lib/results/categories.js +111 -54
- package/dist/extensions/agent-browser/lib/results/confirmation.js +29 -10
- package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +62 -27
- package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +83 -0
- package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +48 -0
- package/dist/extensions/agent-browser/lib/results/envelope.js +93 -66
- package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +180 -0
- package/dist/extensions/agent-browser/lib/results/network-routes.js +86 -45
- package/dist/extensions/agent-browser/lib/results/network.js +35 -12
- package/dist/extensions/agent-browser/lib/results/next-actions.js +49 -19
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +320 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +138 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +113 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +145 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +99 -552
- package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +118 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +68 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +135 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +227 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +91 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +91 -460
- package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +9 -5
- package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/common.js +26 -9
- package/dist/extensions/agent-browser/lib/results/presentation/content.js +86 -29
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +67 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +79 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +199 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +124 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +64 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +209 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +69 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +222 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +103 -1019
- package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +70 -0
- package/dist/extensions/agent-browser/lib/results/presentation/errors.js +130 -60
- package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +60 -145
- package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +147 -88
- package/dist/extensions/agent-browser/lib/results/presentation/notices.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +127 -0
- package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +120 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +77 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +51 -0
- package/dist/extensions/agent-browser/lib/results/presentation/registry.js +117 -237
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +35 -21
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +104 -73
- package/dist/extensions/agent-browser/lib/results/presentation/source.js +109 -0
- package/dist/extensions/agent-browser/lib/results/presentation.js +17 -248
- package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/recording.js +52 -14
- package/dist/extensions/agent-browser/lib/results/recovery-actions.js +14 -5
- package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +30 -22
- package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +83 -0
- package/dist/extensions/agent-browser/lib/results/selector-recovery.js +123 -123
- package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +266 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-content.js +32 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +104 -71
- package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +31 -11
- package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +125 -66
- package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +26 -7
- package/dist/extensions/agent-browser/lib/results/snapshot.js +28 -248
- package/dist/extensions/agent-browser/lib/results/text.js +16 -5
- package/dist/extensions/agent-browser/lib/runtime-args-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/runtime-compatibility.js +81 -0
- package/dist/extensions/agent-browser/lib/runtime-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/runtime-redaction.js +118 -0
- package/dist/extensions/agent-browser/lib/runtime-replay-events.js +144 -0
- package/dist/extensions/agent-browser/lib/runtime-session-identity.js +76 -0
- package/dist/extensions/agent-browser/lib/runtime-session-plan.js +114 -0
- package/dist/extensions/agent-browser/lib/runtime-session-replay.js +123 -0
- package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +65 -0
- package/dist/extensions/agent-browser/lib/runtime-timeouts.js +28 -0
- package/dist/extensions/agent-browser/lib/runtime.js +137 -1037
- package/dist/extensions/agent-browser/lib/session-identity.js +51 -0
- package/dist/extensions/agent-browser/lib/session-page-observation.js +357 -0
- package/dist/extensions/agent-browser/lib/session-page-state.js +188 -324
- package/dist/extensions/agent-browser/lib/session-page-types.js +1 -0
- package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +78 -0
- package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +7 -0
- package/dist/extensions/agent-browser/lib/temp-root-ownership.js +234 -0
- package/dist/extensions/agent-browser/lib/temp-root.js +207 -0
- package/dist/extensions/agent-browser/lib/temp.js +33 -446
- package/dist/extensions/agent-browser/lib/tool-surface.js +94 -24
- package/dist/extensions/agent-browser/lib/upstream-version.js +3 -2
- package/dist/extensions/agent-browser/lib/web-search-providers.js +229 -0
- package/dist/extensions/agent-browser/lib/web-search-request.js +108 -0
- package/dist/extensions/agent-browser/lib/web-search-results.js +281 -0
- package/dist/extensions/agent-browser/lib/web-search-schema.js +82 -0
- package/dist/extensions/agent-browser/lib/web-search.js +109 -617
- package/dist/extensions/agent-browser/lib/webmcp-observation.js +13 -6
- package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +63 -37
- package/dist/extensions/agent-browser/script-worker.js +80 -43
- package/dist/scripts/agent-browser-target.mjs +4 -2
- package/docs/ARCHITECTURE.md +22 -10
- package/docs/CODE_QUALITY.md +242 -0
- package/docs/COMMAND_REFERENCE.md +264 -229
- package/docs/ELECTRON.md +53 -44
- package/docs/RELEASE.md +21 -17
- package/docs/REQUIREMENTS.md +2 -0
- package/docs/SESSION_STORAGE.md +1 -1
- package/docs/SUPPORT_MATRIX.md +84 -77
- package/docs/TOOL_CONTRACT.md +165 -130
- package/docs/platform-smoke.md +5 -5
- package/package.json +143 -120
- package/scripts/agent-browser-capability-baseline.mjs +361 -957
- package/scripts/agent-browser-target.mjs +6 -2
- package/scripts/build.mjs +37 -8
- package/scripts/capability-core-commands.mjs +193 -0
- package/scripts/capability-options.mjs +283 -0
- package/scripts/capability-samples.mjs +133 -0
- package/scripts/capability-section.mjs +11 -0
- package/scripts/config.mjs +213 -114
- package/scripts/convert-browser-session.mjs +30 -9
- package/scripts/doctor-sources.mjs +195 -0
- package/scripts/doctor.mjs +92 -247
- package/scripts/platform-smoke/artifacts.mjs +38 -11
- package/scripts/platform-smoke/commands.mjs +104 -0
- package/scripts/platform-smoke/crabbox-runner.mjs +167 -80
- package/scripts/platform-smoke/doctor-support.mjs +157 -0
- package/scripts/platform-smoke/doctor-windows.mjs +230 -0
- package/scripts/platform-smoke/doctor.mjs +212 -320
- package/scripts/platform-smoke/lease-evidence.mjs +134 -0
- package/scripts/platform-smoke/suite-checks.mjs +98 -0
- package/scripts/platform-smoke/suite-evidence.mjs +281 -0
- package/scripts/platform-smoke/targets.mjs +158 -472
- package/scripts/platform-smoke.mjs +55 -40
- package/scripts/prepare.mjs +16 -7
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { isSensitiveFieldName } from "./redaction-fields.js";
|
|
2
|
+
const SENSITIVE_QUERY_PARAM_PATTERN = /^(?:access(?:_|-)?token|api(?:_|-)?key|auth|authorization|authorization(?:_|-)?session(?:_|-)?id|bearer|client(?:_|-)?secret|code|cookie|id(?:_|-)?token|key|pass(?:word)?|refresh(?:_|-)?token|relay(?:_|-)?state|saml(?:_|-)?request|saml(?:_|-)?response|secret|sentry(?:_|-)?key|session(?:_|-)?id|sig(?:nature)?|token|write(?:_|-)?key)$/i;
|
|
3
|
+
const AUTH_STATE_QUERY_PARAM_PATTERN = /^(?:nonce|state)$/i;
|
|
4
|
+
const AUTH_URL_CONTEXT_PATTERN = /(?:^|[./_-])(?:auth|authorize|callback|login|oauth2?|oidc|saml|sso)(?:[./?#_-]|$)/i;
|
|
5
|
+
function shouldRedactQueryParam(name) {
|
|
6
|
+
return SENSITIVE_QUERY_PARAM_PATTERN.test(name) || isSensitiveFieldName(name);
|
|
7
|
+
}
|
|
8
|
+
function isSensitiveParameter(name, authContext) {
|
|
9
|
+
return shouldRedactQueryParam(name) || (authContext && AUTH_STATE_QUERY_PARAM_PATTERN.test(name));
|
|
10
|
+
}
|
|
11
|
+
function redactParameters(params, authContext) {
|
|
12
|
+
let mutated = false;
|
|
13
|
+
for (const [name] of params) {
|
|
14
|
+
if (isSensitiveParameter(name, authContext)) {
|
|
15
|
+
params.set(name, "[REDACTED]");
|
|
16
|
+
mutated = true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return mutated;
|
|
20
|
+
}
|
|
21
|
+
function getHashParameters(hash) {
|
|
22
|
+
const text = hash.startsWith("#") ? hash.slice(1) : hash;
|
|
23
|
+
return text.includes("=") ? new URLSearchParams(text) : undefined;
|
|
24
|
+
}
|
|
25
|
+
export function redactUrlToken(token) {
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = new URL(token);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return token;
|
|
32
|
+
}
|
|
33
|
+
const originalHref = parsed.href;
|
|
34
|
+
if (parsed.username.length > 0) {
|
|
35
|
+
parsed.username = "[REDACTED]";
|
|
36
|
+
}
|
|
37
|
+
if (parsed.password.length > 0) {
|
|
38
|
+
parsed.password = "[REDACTED]";
|
|
39
|
+
}
|
|
40
|
+
const hashParams = getHashParameters(parsed.hash);
|
|
41
|
+
const authContext = AUTH_URL_CONTEXT_PATTERN.test(`${parsed.hostname}${parsed.pathname}`) ||
|
|
42
|
+
[...parsed.searchParams.keys(), ...(hashParams?.keys() ?? [])].some(shouldRedactQueryParam);
|
|
43
|
+
redactParameters(parsed.searchParams, authContext);
|
|
44
|
+
if (hashParams && redactParameters(hashParams, authContext)) {
|
|
45
|
+
parsed.hash = `#${hashParams.toString()}`;
|
|
46
|
+
}
|
|
47
|
+
return parsed.href === originalHref ? token : parsed.href;
|
|
48
|
+
}
|
|
49
|
+
function decodeParameterName(raw) {
|
|
50
|
+
try {
|
|
51
|
+
return decodeURIComponent(raw.replace(/\+/g, " "));
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return raw;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function redactLooseUrlParameterText(text) {
|
|
58
|
+
return text.replace(/(?<![^\s"'`<>\])}])[^\s"'`<>\])}]*[?#&][^\s"'`<>\])}]*/g, (token) => {
|
|
59
|
+
const queryNames = [...token.matchAll(/[?#&]([^=&#\s"'`<>\])}]+)=/g)].map((match) => decodeParameterName(match[1]));
|
|
60
|
+
const authContext = AUTH_URL_CONTEXT_PATTERN.test(token) || queryNames.some(shouldRedactQueryParam);
|
|
61
|
+
return token.replace(/([?#&])([^=&#\s"'`<>\])}]+)=([^&#\s"'`<>\])}]*)/g, (match, separator, rawName, rawValue) => {
|
|
62
|
+
if (rawValue === "[REDACTED" ||
|
|
63
|
+
rawValue === "[REDACTED]" ||
|
|
64
|
+
/%5Bredacted%5D/i.test(rawValue)) {
|
|
65
|
+
return match;
|
|
66
|
+
}
|
|
67
|
+
if (!isSensitiveParameter(decodeParameterName(rawName), authContext)) {
|
|
68
|
+
return match;
|
|
69
|
+
}
|
|
70
|
+
return `${separator}${rawName}=[REDACTED]`;
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function redactLooseUrlUserinfo(text) {
|
|
75
|
+
return text.replace(/\b([A-Za-z][A-Za-z0-9+.-]*:\/\/)([^\s"'`/@]+)@([^\s"'`]+)/g, (match, prefix, userinfo, suffix) => {
|
|
76
|
+
if (/%5Bredacted%5D/i.test(userinfo)) {
|
|
77
|
+
return match;
|
|
78
|
+
}
|
|
79
|
+
if (userinfo.includes("[REDACTED]")) {
|
|
80
|
+
return redactLooseUrlParameterText(match);
|
|
81
|
+
}
|
|
82
|
+
return redactLooseUrlParameterText(`${prefix}${userinfo.includes(":") ? "[REDACTED]:[REDACTED]" : "[REDACTED]"}@${suffix}`);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export function redactLooseUrls(text) {
|
|
86
|
+
const urls = text.replace(/\b[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s"'`<>\])]+/g, (match) => redactUrlToken(match));
|
|
87
|
+
return redactLooseUrlParameterText(redactLooseUrlUserinfo(urls));
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,281 +1,38 @@
|
|
|
1
1
|
import { isOpenNavigationCommand, isPageMutationCommand } from "../command-taxonomy.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
tool: "agent_browser",
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function buildArtifactVerificationAction(artifact) {
|
|
15
|
-
return {
|
|
16
|
-
artifactPath: artifact.path,
|
|
17
|
-
id: "verify-artifact-path",
|
|
18
|
-
reason: "The wrapper has artifact metadata but did not verify this file as present on disk.",
|
|
19
|
-
safety: "Check details.artifactVerification and the filesystem before treating the artifact as durable.",
|
|
20
|
-
tool: "agent_browser",
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function buildElectronToolAction(options) {
|
|
24
|
-
return {
|
|
25
|
-
id: options.id,
|
|
26
|
-
params: { action: options.action, launchId: options.launchId },
|
|
27
|
-
reason: options.reason,
|
|
28
|
-
...(options.safety ? { safety: options.safety } : {}),
|
|
29
|
-
tool: "agent_browser_electron",
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function getDownloadRetryPath(args, fallback) {
|
|
33
|
-
if (fallback)
|
|
34
|
-
return fallback;
|
|
35
|
-
if (!args || args.length === 0)
|
|
36
|
-
return undefined;
|
|
37
|
-
const downloadFlagIndex = args.indexOf("--download");
|
|
38
|
-
if (downloadFlagIndex >= 0) {
|
|
39
|
-
const candidate = args[downloadFlagIndex + 1];
|
|
40
|
-
return candidate && !candidate.startsWith("-") ? candidate : undefined;
|
|
41
|
-
}
|
|
42
|
-
const downloadCommandIndex = args.indexOf("download");
|
|
43
|
-
if (downloadCommandIndex >= 0 && args.length > downloadCommandIndex + 2) {
|
|
44
|
-
return args[args.length - 1];
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
export function buildAgentBrowserNextActions(options) {
|
|
49
|
-
const actions = [];
|
|
50
|
-
if (options.recovery) {
|
|
51
|
-
actions.push(...buildRecoveryNextActions(options.recovery));
|
|
52
|
-
}
|
|
53
|
-
if (options.electron?.launchId) {
|
|
54
|
-
const { launchId, sessionName, status } = options.electron;
|
|
55
|
-
if (options.resultCategory === "success" && status !== "cleaned") {
|
|
56
|
-
actions.push(buildElectronToolAction({
|
|
57
|
-
action: "status",
|
|
58
|
-
id: "status-electron-launch",
|
|
59
|
-
launchId,
|
|
60
|
-
reason: "Check the wrapper-tracked Electron launch liveness and current CDP targets without mutating the app.",
|
|
61
|
-
}), buildElectronToolAction({
|
|
62
|
-
action: "probe",
|
|
63
|
-
id: "probe-electron-launch",
|
|
64
|
-
launchId,
|
|
65
|
-
reason: "Probe the attached Electron managed session and carry the wrapper launchId for follow-up diagnostics.",
|
|
66
|
-
}), buildElectronToolAction({
|
|
67
|
-
action: "cleanup",
|
|
68
|
-
id: "cleanup-electron-launch",
|
|
69
|
-
launchId,
|
|
70
|
-
reason: "Clean the wrapper-owned Electron process and isolated userDataDir when the run is complete.",
|
|
71
|
-
safety: "Only operates on the launchId created by electron.launch; explicit artifacts and manually launched apps remain host-owned.",
|
|
72
|
-
}));
|
|
73
|
-
if (sessionName) {
|
|
74
|
-
actions.push(buildNextToolAction({
|
|
75
|
-
args: ["--session", sessionName, "tab", "list"],
|
|
76
|
-
id: "list-electron-tabs",
|
|
77
|
-
reason: "Inspect attached Electron page/webview targets before choosing the active tab.",
|
|
78
|
-
}), buildNextToolAction({
|
|
79
|
-
args: ["--session", sessionName, "snapshot", "-i"],
|
|
80
|
-
id: "snapshot-electron-session",
|
|
81
|
-
reason: "Refresh interactive refs for the attached Electron session.",
|
|
82
|
-
safety: "Use current Electron refs only after a fresh snapshot for this session.",
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if (options.resultCategory === "failure" && options.failureCategory === "cleanup-failed") {
|
|
87
|
-
actions.push(buildElectronToolAction({
|
|
88
|
-
action: "status",
|
|
89
|
-
id: "status-electron-launch",
|
|
90
|
-
launchId,
|
|
91
|
-
reason: "Inspect which wrapper-tracked Electron resources remain after partial cleanup.",
|
|
92
|
-
}), buildElectronToolAction({
|
|
93
|
-
action: "cleanup",
|
|
94
|
-
id: "retry-electron-cleanup",
|
|
95
|
-
launchId,
|
|
96
|
-
reason: "Retry cleanup for the same wrapper-owned Electron launch after reviewing remaining resources.",
|
|
97
|
-
safety: "Only retry for the same launchId; do not use cleanup for manually launched Electron apps.",
|
|
98
|
-
}));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (options.resultCategory === "success") {
|
|
102
|
-
if (isOpenNavigationCommand(options.command)) {
|
|
103
|
-
actions.push(buildNextToolAction({
|
|
2
|
+
import { applySessionToNextActions, buildNextToolAction } from "./next-actions.js";
|
|
3
|
+
import { buildRecoveryNextActions } from "./recovery-actions.js";
|
|
4
|
+
import { buildElectronNextActions } from "./electron-recommendations.js";
|
|
5
|
+
import { buildPendingRecordingNextActions, buildSavedArtifactNextActions, } from "./artifact-recommendations.js";
|
|
6
|
+
import { buildFailureNextActions } from "./failure-recommendations.js";
|
|
7
|
+
function buildSuccessNavigationActions(options) {
|
|
8
|
+
if (isOpenNavigationCommand(options.command)) {
|
|
9
|
+
return [
|
|
10
|
+
buildNextToolAction({
|
|
104
11
|
args: ["snapshot", "-i"],
|
|
105
12
|
id: "inspect-opened-page",
|
|
106
13
|
reason: "Inspect the opened page before choosing interactive refs.",
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
14
|
+
}),
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
return isPageMutationCommand(options.command, options.subcommand)
|
|
18
|
+
? [
|
|
19
|
+
buildNextToolAction({
|
|
111
20
|
args: ["snapshot", "-i"],
|
|
112
21
|
id: "inspect-after-mutation",
|
|
113
22
|
reason: "Refresh interactive refs after a browser mutation, navigation, scroll, or rerender.",
|
|
114
23
|
safety: "Do not reuse prior @refs until a fresh snapshot confirms they still exist.",
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
args: ["wait", "--download", artifact.path],
|
|
129
|
-
id: "wait-for-download",
|
|
130
|
-
reason: "Upstream reported a download path, but the wrapper did not verify the file on disk.",
|
|
131
|
-
safety: "Use an explicit wait timeout; if you set top-level timeoutMs, keep it above the wait duration plus a small grace window.",
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
actions.push(buildArtifactVerificationAction(artifact));
|
|
136
|
-
}
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
if (artifact.path !== options.savedFilePath) {
|
|
140
|
-
actions.push(buildArtifactAction(artifact.path));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
switch (options.failureCategory) {
|
|
146
|
-
case "artifact-missing":
|
|
147
|
-
for (const artifact of options.artifacts ?? []) {
|
|
148
|
-
if (isPendingRecordingArtifact(artifact) || (artifact.exists !== false && artifact.status !== "stale"))
|
|
149
|
-
continue;
|
|
150
|
-
if (artifact.kind === "download") {
|
|
151
|
-
actions.push(buildNextToolAction({
|
|
152
|
-
args: ["wait", "--download", artifact.path],
|
|
153
|
-
id: "wait-for-download",
|
|
154
|
-
reason: "The requested download artifact was not found on disk after upstream reported completion.",
|
|
155
|
-
safety: "Use an explicit wait timeout; if you set top-level timeoutMs, keep it above the wait duration plus a small grace window.",
|
|
156
|
-
}));
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
actions.push(buildArtifactVerificationAction(artifact));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
break;
|
|
163
|
-
case "confirmation-required":
|
|
164
|
-
if (options.confirmationId) {
|
|
165
|
-
actions.push(buildNextToolAction({
|
|
166
|
-
args: ["confirm", options.confirmationId],
|
|
167
|
-
id: "approve-confirmation",
|
|
168
|
-
reason: "Approve the pending upstream confirmation when the requested action is safe.",
|
|
169
|
-
safety: "Only confirm after reviewing the guarded action shown in the result.",
|
|
170
|
-
}), buildNextToolAction({
|
|
171
|
-
args: ["deny", options.confirmationId],
|
|
172
|
-
id: "deny-confirmation",
|
|
173
|
-
reason: "Deny the pending upstream confirmation when the guarded action is unsafe or unintended.",
|
|
174
|
-
}));
|
|
175
|
-
}
|
|
176
|
-
break;
|
|
177
|
-
case "stale-ref":
|
|
178
|
-
case "selector-not-found":
|
|
179
|
-
case "selector-unsupported":
|
|
180
|
-
actions.push(buildNextToolAction({
|
|
181
|
-
args: ["snapshot", "-i"],
|
|
182
|
-
id: "refresh-interactive-refs",
|
|
183
|
-
reason: "Get current interactive refs before retrying the element action.",
|
|
184
|
-
safety: "Prefer a current @ref or a stable find locator; do not retry stale refs blindly.",
|
|
185
|
-
}));
|
|
186
|
-
break;
|
|
187
|
-
case "download-not-verified":
|
|
188
|
-
{
|
|
189
|
-
const retryPath = getDownloadRetryPath(options.args, options.savedFilePath);
|
|
190
|
-
actions.push(buildNextToolAction({
|
|
191
|
-
args: retryPath ? ["wait", "--download", retryPath] : ["wait", "--download"],
|
|
192
|
-
id: "wait-for-download",
|
|
193
|
-
reason: "Wait for the browser download and let the wrapper verify saved-file metadata.",
|
|
194
|
-
safety: "Use an explicit wait timeout; if you set top-level timeoutMs, keep it above the wait duration plus a small grace window.",
|
|
195
|
-
}));
|
|
196
|
-
}
|
|
197
|
-
break;
|
|
198
|
-
case "timeout":
|
|
199
|
-
{
|
|
200
|
-
if (options.command === "session" && options.subcommand === "info") {
|
|
201
|
-
actions.push(buildNextToolAction({
|
|
202
|
-
args: ["session", "info"],
|
|
203
|
-
id: "retry-session-info",
|
|
204
|
-
reason: "Retry the same session status check without opening a browser or inspecting its page.",
|
|
205
|
-
}));
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
const textAssertion = options.command === "wait" && options.args?.includes("--text") === true;
|
|
209
|
-
const urlAssertion = options.command === "wait" && options.args?.includes("--url") === true;
|
|
210
|
-
actions.push(buildNextToolAction({
|
|
211
|
-
args: ["snapshot", "-i"],
|
|
212
|
-
id: textAssertion ? "inspect-after-text-assertion-failure" : "inspect-after-timeout",
|
|
213
|
-
reason: textAssertion
|
|
214
|
-
? "Inspect the current page after the text assertion failed before concluding the expected text is absent."
|
|
215
|
-
: options.command === "wait"
|
|
216
|
-
? "Inspect the current page after the wait condition timed out before retrying with a different selector or timeout."
|
|
217
|
-
: "Inspect the current page after the timed-out browser operation.",
|
|
218
|
-
safety: textAssertion
|
|
219
|
-
? "Read-only snapshot; use current refs or visible text from this page before retrying the assertion."
|
|
220
|
-
: "Read-only snapshot; do not assume the timed-out interaction completed.",
|
|
221
|
-
}));
|
|
222
|
-
if (urlAssertion) {
|
|
223
|
-
actions.push(buildNextToolAction({
|
|
224
|
-
args: ["open", "about:blank"],
|
|
225
|
-
id: "fresh-session-after-url-wait-timeout",
|
|
226
|
-
reason: "If a preceding click or form submit reported success but the page never navigated, upstream click dispatch may have silently missed (observed with agent-browser 0.34 after many spaced commands); replace about:blank with the target URL and replay the flow as one batch in a fresh session instead of retrying the wait.",
|
|
227
|
-
safety: "Abandons the current browser session; capture page evidence with the inspect action first, and only abandon when the wait target is not simply wrong or slow.",
|
|
228
|
-
sessionMode: "fresh",
|
|
229
|
-
}));
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
break;
|
|
233
|
-
case "upstream-error":
|
|
234
|
-
if (options.overlayBlockedClick) {
|
|
235
|
-
actions.push(buildInspectOverlayStateAction(options.sessionName));
|
|
236
|
-
}
|
|
237
|
-
else if (isOpenNavigationCommand(options.command)) {
|
|
238
|
-
actions.push(buildNextToolAction({
|
|
239
|
-
args: ["get", "url"],
|
|
240
|
-
id: "inspect-page-after-navigation-error",
|
|
241
|
-
reason: "Check which page, if any, remains active after the navigation or network error.",
|
|
242
|
-
safety: "Read-only URL inspection; verify connectivity and the target URL before retrying navigation.",
|
|
243
|
-
}));
|
|
244
|
-
}
|
|
245
|
-
break;
|
|
246
|
-
case "tab-gone":
|
|
247
|
-
actions.push(buildNextToolAction({
|
|
248
|
-
args: ["tab", "list"],
|
|
249
|
-
id: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.tabGoneListTabs,
|
|
250
|
-
reason: "The pinned bound tab is gone; inspect remaining tabs before acting on a neighbor.",
|
|
251
|
-
safety: "Read-only. Prefer a listed tab id, label, or CDP targetId, or open a new tab to rebind.",
|
|
252
|
-
}), buildNextToolAction({
|
|
253
|
-
args: ["tab", "new"],
|
|
254
|
-
id: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.tabGoneNewTab,
|
|
255
|
-
reason: "Bind a fresh tab after tab_gone instead of continuing on another session's page.",
|
|
256
|
-
safety: "Opens a new tab in this session and rebinds the pin; pass a URL if you know the intended page.",
|
|
257
|
-
}));
|
|
258
|
-
break;
|
|
259
|
-
case "tab-drift":
|
|
260
|
-
if (options.recovery?.kind === "about-blank" || options.recovery?.kind === "tab-drift") {
|
|
261
|
-
break;
|
|
262
|
-
}
|
|
263
|
-
actions.push(buildNextToolAction({
|
|
264
|
-
args: ["tab", "list"],
|
|
265
|
-
id: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.genericTabDriftListTabs,
|
|
266
|
-
reason: "Inspect available tabs before selecting the intended target.",
|
|
267
|
-
safety: "Read-only. Retry snapshot only after selecting or confirming the intended stable tab.",
|
|
268
|
-
}));
|
|
269
|
-
break;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
if ((options.artifacts ?? []).some(isPendingRecordingArtifact)) {
|
|
273
|
-
actions.push(buildNextToolAction({
|
|
274
|
-
args: ["record", "stop"],
|
|
275
|
-
id: "stop-pending-recording",
|
|
276
|
-
reason: "Stop the active recording so the requested video can be finalized and verified on disk.",
|
|
277
|
-
safety: "The file remains pending until record stop succeeds; verify details.artifactVerification afterward.",
|
|
278
|
-
}));
|
|
279
|
-
}
|
|
24
|
+
}),
|
|
25
|
+
]
|
|
26
|
+
: [];
|
|
27
|
+
}
|
|
28
|
+
export function buildAgentBrowserNextActions(options) {
|
|
29
|
+
const actions = [
|
|
30
|
+
...(options.recovery ? buildRecoveryNextActions(options.recovery) : []),
|
|
31
|
+
...buildElectronNextActions(options),
|
|
32
|
+
...(options.resultCategory === "success"
|
|
33
|
+
? [...buildSuccessNavigationActions(options), ...buildSavedArtifactNextActions(options)]
|
|
34
|
+
: buildFailureNextActions(options)),
|
|
35
|
+
...buildPendingRecordingNextActions(options.artifacts),
|
|
36
|
+
];
|
|
280
37
|
return applySessionToNextActions(actions.length > 0 ? actions : undefined, options.sessionName);
|
|
281
38
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { isRecord } from "../parsing.js";
|
|
2
|
+
function finiteNonnegative(value) {
|
|
3
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
4
|
+
}
|
|
5
|
+
function safeCount(value) {
|
|
6
|
+
return finiteNonnegative(value) && Number.isSafeInteger(value);
|
|
7
|
+
}
|
|
8
|
+
function optionalStrings(value, keys) {
|
|
9
|
+
return keys.every((key) => value[key] === undefined || typeof value[key] === "string");
|
|
10
|
+
}
|
|
11
|
+
function nullableStrings(value, keys) {
|
|
12
|
+
return keys.every((key) => value[key] === null || typeof value[key] === "string");
|
|
13
|
+
}
|
|
14
|
+
function nullableNumbers(value, keys) {
|
|
15
|
+
return keys.every((key) => value[key] === null || finiteNonnegative(value[key]));
|
|
16
|
+
}
|
|
17
|
+
function nullableBoolean(value) {
|
|
18
|
+
return value === null || typeof value === "boolean";
|
|
19
|
+
}
|
|
20
|
+
function captureIsValid(value) {
|
|
21
|
+
return (nullableStrings(value, [
|
|
22
|
+
"startedAt",
|
|
23
|
+
"endedAt",
|
|
24
|
+
"firstFrameAt",
|
|
25
|
+
"lastFrameAt",
|
|
26
|
+
"timestampSource",
|
|
27
|
+
]) &&
|
|
28
|
+
nullableNumbers(value, [
|
|
29
|
+
"durationMs",
|
|
30
|
+
"firstFrameAfterMs",
|
|
31
|
+
"lastFrameAfterMs",
|
|
32
|
+
"averageFps",
|
|
33
|
+
"maxFrameGapMs",
|
|
34
|
+
]));
|
|
35
|
+
}
|
|
36
|
+
function outputIsValid(value) {
|
|
37
|
+
return (nullableStrings(value, ["durationSource"]) &&
|
|
38
|
+
nullableNumbers(value, [
|
|
39
|
+
"frames",
|
|
40
|
+
"fps",
|
|
41
|
+
"encodedFrames",
|
|
42
|
+
"durationMs",
|
|
43
|
+
"heldFrames",
|
|
44
|
+
"droppedFrames",
|
|
45
|
+
"skippedFrames",
|
|
46
|
+
]) &&
|
|
47
|
+
nullableBoolean(value.encoderSucceeded));
|
|
48
|
+
}
|
|
49
|
+
function recordingIsValid(value) {
|
|
50
|
+
if (!isRecord(value) ||
|
|
51
|
+
!isRecord(value.capture) ||
|
|
52
|
+
!isRecord(value.output) ||
|
|
53
|
+
!isRecord(value.file)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return (recordingScalarsAreValid(value) &&
|
|
57
|
+
captureIsValid(value.capture) &&
|
|
58
|
+
outputIsValid(value.output) &&
|
|
59
|
+
nullableBoolean(value.file.exists) &&
|
|
60
|
+
nullableNumbers(value.file, ["sizeBytes"]));
|
|
61
|
+
}
|
|
62
|
+
function recordingScalarsAreValid(value) {
|
|
63
|
+
return (typeof value.warning === "string" &&
|
|
64
|
+
typeof value.path === "string" &&
|
|
65
|
+
nullableStrings(value, ["recordingId", "error"]) &&
|
|
66
|
+
nullableBoolean(value.success) &&
|
|
67
|
+
nullableNumbers(value, ["frames", "capturedFrames", "fps"]));
|
|
68
|
+
}
|
|
69
|
+
function optionalNumbersAreValid(value) {
|
|
70
|
+
return (["evictedAtMs", "recordingStartedAtMs"].every((key) => value[key] === undefined || (typeof value[key] === "number" && Number.isFinite(value[key]))) &&
|
|
71
|
+
(value.sizeBytes === undefined || finiteNonnegative(value.sizeBytes)));
|
|
72
|
+
}
|
|
73
|
+
function optionalRecordingIsValid(value) {
|
|
74
|
+
return ((value.recordingState === undefined || value.recordingState === "openRecording") &&
|
|
75
|
+
(value.recording === undefined || recordingIsValid(value.recording)) &&
|
|
76
|
+
(value.status === undefined ||
|
|
77
|
+
[
|
|
78
|
+
"failed",
|
|
79
|
+
"missing",
|
|
80
|
+
"pending",
|
|
81
|
+
"repaired-from-temp",
|
|
82
|
+
"saved",
|
|
83
|
+
"stale",
|
|
84
|
+
"unverified",
|
|
85
|
+
"upstream-temp-only",
|
|
86
|
+
].some((status) => status === value.status)));
|
|
87
|
+
}
|
|
88
|
+
function optionalEvidenceIsValid(value) {
|
|
89
|
+
return (optionalStrings(value, [
|
|
90
|
+
"absolutePath",
|
|
91
|
+
"command",
|
|
92
|
+
"cwd",
|
|
93
|
+
"extension",
|
|
94
|
+
"mediaType",
|
|
95
|
+
"namespace",
|
|
96
|
+
"requestedPath",
|
|
97
|
+
"session",
|
|
98
|
+
"subcommand",
|
|
99
|
+
]) &&
|
|
100
|
+
(value.exists === undefined || typeof value.exists === "boolean") &&
|
|
101
|
+
optionalNumbersAreValid(value) &&
|
|
102
|
+
optionalRecordingIsValid(value));
|
|
103
|
+
}
|
|
104
|
+
function isManifestEntry(value) {
|
|
105
|
+
if (!isRecord(value)) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return (typeof value.path === "string" &&
|
|
109
|
+
value.path.trim().length > 0 &&
|
|
110
|
+
typeof value.createdAtMs === "number" &&
|
|
111
|
+
Number.isFinite(value.createdAtMs) &&
|
|
112
|
+
["evicted", "ephemeral", "live", "missing"].some((state) => state === value.retentionState) &&
|
|
113
|
+
["explicit-path", "persistent-session", "process-temp"].some((scope) => scope === value.storageScope) &&
|
|
114
|
+
["download", "file", "har", "image", "pdf", "profile", "trace", "video", "spill"].some((kind) => kind === value.kind) &&
|
|
115
|
+
optionalEvidenceIsValid(value));
|
|
116
|
+
}
|
|
117
|
+
function manifestCountsAreValid(value) {
|
|
118
|
+
return (safeCount(value.maxEntries) &&
|
|
119
|
+
value.maxEntries !== 0 &&
|
|
120
|
+
safeCount(value.liveCount) &&
|
|
121
|
+
safeCount(value.evictedCount));
|
|
122
|
+
}
|
|
123
|
+
export function isSessionArtifactManifest(value) {
|
|
124
|
+
if (!isRecord(value)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
return (value.version === 1 &&
|
|
128
|
+
Array.isArray(value.entries) &&
|
|
129
|
+
value.entries.every(isManifestEntry) &&
|
|
130
|
+
typeof value.updatedAtMs === "number" &&
|
|
131
|
+
Number.isFinite(value.updatedAtMs) &&
|
|
132
|
+
manifestCountsAreValid(value));
|
|
133
|
+
}
|