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
package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { getAgentBrowserSessionIdentityKey, resolveAgentBrowserNamespace, } from "../../argv-grammar.js";
|
|
2
|
+
import { parseArgvDescriptor } from "../../argv-descriptor.js";
|
|
3
|
+
import { isBrowserIndependentRead, needsManagedSession } from "../../command-policy.js";
|
|
4
|
+
import { getAgentBrowserProcessEnvironment } from "../../process-environment.js";
|
|
5
|
+
import { nextReadConfirmation, parseReadConfirmation } from "../../read-confirmation.js";
|
|
6
|
+
import { nativePolicyDefinitelyUnestablished, } from "./session-state.js";
|
|
7
|
+
function helperNamespace(helper) {
|
|
8
|
+
return resolveAgentBrowserNamespace([], helper.namespace ?? getAgentBrowserProcessEnvironment().AGENT_BROWSER_NAMESPACE);
|
|
9
|
+
}
|
|
10
|
+
function helperMayRun(helper, effects) {
|
|
11
|
+
const pending = parseReadConfirmation(effects?.readConfirmation);
|
|
12
|
+
return ((!needsManagedSession(parseArgvDescriptor(helper.args), helper.stdin) &&
|
|
13
|
+
!isBrowserIndependentRead(helper.args, helper.stdin)) ||
|
|
14
|
+
pending?.state !== "pending" ||
|
|
15
|
+
getAgentBrowserSessionIdentityKey(helper.sessionName ?? "default", helperNamespace(helper)) !==
|
|
16
|
+
getAgentBrowserSessionIdentityKey(pending.sessionName, pending.namespace));
|
|
17
|
+
}
|
|
18
|
+
function helperSucceeded(observation) {
|
|
19
|
+
return (observation.envelope?.success === true &&
|
|
20
|
+
observation.processResult.exitCode === 0 &&
|
|
21
|
+
!observation.processResult.aborted &&
|
|
22
|
+
!observation.processResult.timedOut);
|
|
23
|
+
}
|
|
24
|
+
function markPendingOpenTargetUnknown(state, update, key) {
|
|
25
|
+
const invalidation = state.sessionPageState.get(key).refSnapshotInvalidation;
|
|
26
|
+
state.sessionPageState.markTabTargetUnknown({ sessionName: key, update });
|
|
27
|
+
if (invalidation) {
|
|
28
|
+
state.sessionPageState.applyRefSnapshotInvalidation({ sessionName: key, update, invalidation });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function applyHelperConfirmation(state, update, observation) {
|
|
32
|
+
const { helper, envelope, processResult } = observation;
|
|
33
|
+
const namespace = helperNamespace(helper);
|
|
34
|
+
const sessionName = helper.sessionName ?? "default";
|
|
35
|
+
const key = getAgentBrowserSessionIdentityKey(sessionName, namespace);
|
|
36
|
+
if (key === state.confirmationPolicyIdentity &&
|
|
37
|
+
!nativePolicyDefinitelyUnestablished(processResult, envelope, helper.args)) {
|
|
38
|
+
state.confirmationPolicyMayBeEstablished = true;
|
|
39
|
+
}
|
|
40
|
+
const confirmation = nextReadConfirmation({
|
|
41
|
+
commandTokens: helper.args,
|
|
42
|
+
current: state.sessionPageState.getReadConfirmation(key),
|
|
43
|
+
data: envelope?.data,
|
|
44
|
+
namespace,
|
|
45
|
+
sessionName,
|
|
46
|
+
succeeded: helperSucceeded(observation),
|
|
47
|
+
});
|
|
48
|
+
if (!confirmation) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
state.sessionPageState.applyReadConfirmation(confirmation, update);
|
|
52
|
+
if (helper.args[0] === "open" && confirmation.state === "pending") {
|
|
53
|
+
markPendingOpenTargetUnknown(state, update, key);
|
|
54
|
+
}
|
|
55
|
+
state.observedBrowserEffects = {
|
|
56
|
+
...state.observedBrowserEffects,
|
|
57
|
+
readConfirmation: confirmation,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function createNativeHelperObserver(state, update) {
|
|
61
|
+
return {
|
|
62
|
+
allow: (helper) => helperMayRun(helper, state.observedBrowserEffects),
|
|
63
|
+
observe: (helper, processResult, envelope) => applyHelperConfirmation(state, update, { helper, processResult, envelope }),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { isRecord } from "../../parsing.js";
|
|
2
|
+
import { buildInspectOverlayStateAction, withOptionalSessionArgs, } from "../../results/next-actions.js";
|
|
3
|
+
import { extractRefSnapshotFromData, normalizeComparableUrl, } from "../../session-page-state.js";
|
|
4
|
+
import { rawStringField } from "./diagnostic-values.js";
|
|
5
|
+
import { runSessionCommandData } from "./session-state.js";
|
|
6
|
+
const OVERLAY_CLOSE_NAME_PATTERN = /(?:\b(?:close|dismiss|no thanks|not now|maybe later|hide|skip|continue without|x)\b|^\s*×\s*$)/i;
|
|
7
|
+
const OVERLAY_CONTEXT_ROLES = new Set(["alertdialog", "dialog"]);
|
|
8
|
+
const OVERLAY_ACTION_ROLES = new Set(["button", "link", "menuitem"]);
|
|
9
|
+
const OVERLAY_BLOCKER_CANDIDATE_LIMIT = 3;
|
|
10
|
+
function overlayBlockerCandidate(ref, entry) {
|
|
11
|
+
if (!/^e\d+$/.test(ref) || !isRecord(entry)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const role = rawStringField(entry, "role");
|
|
15
|
+
const name = rawStringField(entry, "name");
|
|
16
|
+
if (role === undefined ||
|
|
17
|
+
role === "" ||
|
|
18
|
+
!OVERLAY_ACTION_ROLES.has(role.toLowerCase()) ||
|
|
19
|
+
name === undefined ||
|
|
20
|
+
name === "" ||
|
|
21
|
+
!OVERLAY_CLOSE_NAME_PATTERN.test(name)) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
args: ["click", `@${ref}`],
|
|
26
|
+
name,
|
|
27
|
+
reason: `Visible ${role} ${JSON.stringify(name)} appears in a snapshot that also contains overlay/banner/dialog context.`,
|
|
28
|
+
ref: `@${ref}`,
|
|
29
|
+
role,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function getOverlayBlockerCandidates(snapshotData) {
|
|
33
|
+
const refs = isRecord(snapshotData) && isRecord(snapshotData.refs) ? snapshotData.refs : undefined;
|
|
34
|
+
if (!refs ||
|
|
35
|
+
!Object.values(refs).some((entry) => isRecord(entry) &&
|
|
36
|
+
OVERLAY_CONTEXT_ROLES.has((rawStringField(entry, "role") ?? "").toLowerCase()))) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
const candidates = [];
|
|
40
|
+
for (const [ref, entry] of Object.entries(refs)) {
|
|
41
|
+
const candidate = overlayBlockerCandidate(ref, entry);
|
|
42
|
+
if (candidate) {
|
|
43
|
+
candidates.push(candidate);
|
|
44
|
+
}
|
|
45
|
+
if (candidates.length >= OVERLAY_BLOCKER_CANDIDATE_LIMIT) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return candidates;
|
|
50
|
+
}
|
|
51
|
+
export function formatOverlayBlockerText(diagnostic) {
|
|
52
|
+
return [
|
|
53
|
+
"Possible overlay blockers:",
|
|
54
|
+
...diagnostic.candidates.map((candidate) => {
|
|
55
|
+
const role = candidate.role !== undefined && candidate.role !== "" ? ` ${candidate.role}` : "";
|
|
56
|
+
const name = candidate.name !== undefined && candidate.name !== ""
|
|
57
|
+
? ` ${JSON.stringify(candidate.name)}`
|
|
58
|
+
: "";
|
|
59
|
+
return `- ${candidate.ref}${role}${name}: ${candidate.reason}`;
|
|
60
|
+
}),
|
|
61
|
+
].join("\n");
|
|
62
|
+
}
|
|
63
|
+
export function buildOverlayBlockerNextActions(options) {
|
|
64
|
+
return [
|
|
65
|
+
buildInspectOverlayStateAction(options.sessionName),
|
|
66
|
+
...options.diagnostic.candidates.map((candidate, index) => ({
|
|
67
|
+
id: `try-overlay-blocker-candidate-${index + 1}`,
|
|
68
|
+
params: { args: withOptionalSessionArgs(options.sessionName, candidate.args) },
|
|
69
|
+
reason: candidate.reason,
|
|
70
|
+
safety: "Only click this if the candidate is clearly a close/dismiss control for an overlay that blocks the intended workflow.",
|
|
71
|
+
tool: "agent_browser",
|
|
72
|
+
})),
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
export function collectSnapshotOverlayBlockerDiagnostic(data) {
|
|
76
|
+
const candidates = getOverlayBlockerCandidates(data);
|
|
77
|
+
const snapshot = extractRefSnapshotFromData(data);
|
|
78
|
+
return candidates.length === 0 || !snapshot
|
|
79
|
+
? undefined
|
|
80
|
+
: {
|
|
81
|
+
candidates,
|
|
82
|
+
snapshot,
|
|
83
|
+
summary: "Snapshot contains dialog/modal context plus likely close or dismiss controls; treat covered controls as potentially obstructed until the overlay state is resolved.",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function isSnapshotRefClick(data) {
|
|
87
|
+
return (isRecord(data) &&
|
|
88
|
+
typeof data.clicked === "string" &&
|
|
89
|
+
(data.clicked.startsWith("@") || data.clicked.startsWith("ref=")));
|
|
90
|
+
}
|
|
91
|
+
function stationaryRefClickUrl(options) {
|
|
92
|
+
if (options.command !== "click" || !isSnapshotRefClick(options.data)) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
const priorUrl = normalizeComparableUrl(options.priorTarget?.url);
|
|
96
|
+
const currentUrl = normalizeComparableUrl(options.navigationSummary?.url);
|
|
97
|
+
return currentUrl !== undefined && currentUrl !== "" && currentUrl === priorUrl
|
|
98
|
+
? currentUrl
|
|
99
|
+
: undefined;
|
|
100
|
+
}
|
|
101
|
+
export async function collectOverlayBlockerDiagnostic(options) {
|
|
102
|
+
const currentUrl = stationaryRefClickUrl(options);
|
|
103
|
+
if (currentUrl === undefined) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
const snapshotData = await runSessionCommandData({
|
|
107
|
+
args: ["snapshot", "-i"],
|
|
108
|
+
cwd: options.cwd,
|
|
109
|
+
namespace: options.namespace,
|
|
110
|
+
sessionName: options.sessionName,
|
|
111
|
+
signal: options.signal,
|
|
112
|
+
});
|
|
113
|
+
const diagnostic = collectSnapshotOverlayBlockerDiagnostic(snapshotData);
|
|
114
|
+
return diagnostic
|
|
115
|
+
? {
|
|
116
|
+
...diagnostic,
|
|
117
|
+
summary: `Click completed but the page stayed on ${currentUrl}; a fresh snapshot contains likely overlay close/dismiss controls.`,
|
|
118
|
+
}
|
|
119
|
+
: undefined;
|
|
120
|
+
}
|
package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { isRecord } from "../../../parsing.js";
|
|
2
2
|
import { buildAgentBrowserResultCategoryDetails } from "../../../results/categories.js";
|
|
3
3
|
import { redactPresentationData } from "../../../results/presentation/diagnostics.js";
|
|
4
|
-
import { redactInvocationArgs, redactSensitiveText } from "../../../runtime.js";
|
|
4
|
+
import { redactInvocationArgs, redactSensitiveText } from "../../../runtime-redaction.js";
|
|
5
5
|
import { buildSessionDetailFields, runSessionCommandData } from "../session-state.js";
|
|
6
6
|
function parseNetworkRequestsPageFilterRequest(commandTokens) {
|
|
7
|
-
if (commandTokens[0] !== "network" || commandTokens[1] !== "requests")
|
|
7
|
+
if (commandTokens[0] !== "network" || commandTokens[1] !== "requests") {
|
|
8
8
|
return undefined;
|
|
9
|
+
}
|
|
9
10
|
const cleanArgs = [];
|
|
10
11
|
let mode;
|
|
11
12
|
for (const token of commandTokens) {
|
|
@@ -19,36 +20,44 @@ function parseNetworkRequestsPageFilterRequest(commandTokens) {
|
|
|
19
20
|
}
|
|
20
21
|
cleanArgs.push(token);
|
|
21
22
|
}
|
|
22
|
-
if (
|
|
23
|
+
if (mode === undefined) {
|
|
23
24
|
return undefined;
|
|
25
|
+
}
|
|
24
26
|
return { cleanArgs, mode };
|
|
25
27
|
}
|
|
26
28
|
function extractCurrentUrl(data) {
|
|
27
|
-
if (typeof data === "string")
|
|
29
|
+
if (typeof data === "string") {
|
|
28
30
|
return data;
|
|
29
|
-
|
|
31
|
+
}
|
|
32
|
+
if (!isRecord(data)) {
|
|
30
33
|
return undefined;
|
|
34
|
+
}
|
|
31
35
|
const candidates = [data.url, data.currentUrl, data.href, data.result];
|
|
32
|
-
for (const candidate of candidates)
|
|
33
|
-
if (typeof candidate === "string" && candidate.length > 0)
|
|
36
|
+
for (const candidate of candidates) {
|
|
37
|
+
if (typeof candidate === "string" && candidate.length > 0) {
|
|
34
38
|
return candidate;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
35
41
|
return undefined;
|
|
36
42
|
}
|
|
37
43
|
function getRequestUrl(row) {
|
|
38
|
-
if (!isRecord(row))
|
|
44
|
+
if (!isRecord(row)) {
|
|
39
45
|
return undefined;
|
|
46
|
+
}
|
|
40
47
|
const candidate = row.url ?? row.requestUrl ?? row.href;
|
|
41
48
|
return typeof candidate === "string" ? candidate : undefined;
|
|
42
49
|
}
|
|
43
50
|
function requestMatchesCurrentPage(row, currentUrl, mode) {
|
|
44
51
|
const requestUrl = getRequestUrl(row);
|
|
45
|
-
if (
|
|
52
|
+
if (requestUrl === undefined || requestUrl === "") {
|
|
46
53
|
return false;
|
|
54
|
+
}
|
|
47
55
|
try {
|
|
48
56
|
const current = new URL(currentUrl);
|
|
49
57
|
const request = new URL(requestUrl, current);
|
|
50
|
-
if (mode === "origin")
|
|
58
|
+
if (mode === "origin") {
|
|
51
59
|
return current.origin === request.origin;
|
|
60
|
+
}
|
|
52
61
|
const currentComparable = `${current.origin}${current.pathname}`;
|
|
53
62
|
const requestComparable = `${request.origin}${request.pathname}`;
|
|
54
63
|
return requestComparable === currentComparable;
|
|
@@ -58,49 +67,123 @@ function requestMatchesCurrentPage(row, currentUrl, mode) {
|
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
function filterNetworkRequestsData(data, currentUrl, request) {
|
|
61
|
-
if (!isRecord(data))
|
|
70
|
+
if (!isRecord(data)) {
|
|
62
71
|
return undefined;
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
}
|
|
73
|
+
const key = ["requests", "items", "entries"].find((name) => Array.isArray(data[name]));
|
|
74
|
+
if (key === undefined) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const requestRows = data[key];
|
|
78
|
+
if (!Array.isArray(requestRows)) {
|
|
65
79
|
return undefined;
|
|
80
|
+
}
|
|
66
81
|
const rows = requestRows.filter((row) => requestMatchesCurrentPage(row, currentUrl, request.mode));
|
|
67
|
-
|
|
68
|
-
|
|
82
|
+
return {
|
|
83
|
+
data: { ...data, [key]: rows },
|
|
84
|
+
matchedRows: rows.length,
|
|
85
|
+
rows,
|
|
86
|
+
totalRows: requestRows.length,
|
|
87
|
+
};
|
|
69
88
|
}
|
|
70
89
|
function formatNetworkRequestRow(row) {
|
|
71
|
-
if (!isRecord(row))
|
|
72
|
-
return redactSensitiveText(
|
|
90
|
+
if (!isRecord(row)) {
|
|
91
|
+
return redactSensitiveText(formatNetworkValue(row));
|
|
92
|
+
}
|
|
73
93
|
const status = row.status ?? row.statusCode ?? row.responseStatus ?? "?";
|
|
74
|
-
const method =
|
|
75
|
-
const
|
|
94
|
+
const method = [row.method, row.requestMethod].find((value) => typeof value === "string") ?? "?";
|
|
95
|
+
const identifier = [row.id, row.requestId].find((value) => typeof value === "string");
|
|
96
|
+
const id = identifier === undefined ? "" : ` id=${identifier}`;
|
|
76
97
|
const url = getRequestUrl(row) ?? "(no url)";
|
|
77
|
-
return redactSensitiveText(`- ${status} ${method}${id} ${url}`);
|
|
98
|
+
return redactSensitiveText(`- ${formatNetworkValue(status)} ${method}${id} ${url}`);
|
|
99
|
+
}
|
|
100
|
+
function formatNetworkValue(value) {
|
|
101
|
+
switch (typeof value) {
|
|
102
|
+
case "string":
|
|
103
|
+
case "number":
|
|
104
|
+
case "bigint":
|
|
105
|
+
case "boolean":
|
|
106
|
+
case "undefined":
|
|
107
|
+
case "symbol":
|
|
108
|
+
case "function":
|
|
109
|
+
return String(value);
|
|
110
|
+
case "object":
|
|
111
|
+
if (value === null) {
|
|
112
|
+
return "null";
|
|
113
|
+
}
|
|
114
|
+
return Array.isArray(value)
|
|
115
|
+
? value.map(formatNetworkArrayElement).join(",")
|
|
116
|
+
: Object.prototype.toString.call(value);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function formatNetworkArrayElement(value) {
|
|
120
|
+
return value === null || value === undefined ? "" : formatNetworkValue(value);
|
|
121
|
+
}
|
|
122
|
+
function formatFilteredNetworkText(options) {
|
|
123
|
+
const preview = options.rows.slice(0, 12).map(formatNetworkRequestRow);
|
|
124
|
+
const omitted = options.rows.length > preview.length
|
|
125
|
+
? [`- …${options.rows.length - preview.length} more matching rows omitted`]
|
|
126
|
+
: [];
|
|
127
|
+
return [
|
|
128
|
+
redactSensitiveText(options.summary),
|
|
129
|
+
`Current page: ${redactSensitiveText(options.currentUrl)}`,
|
|
130
|
+
...preview,
|
|
131
|
+
...omitted,
|
|
132
|
+
].join("\n");
|
|
78
133
|
}
|
|
79
134
|
export async function tryNetworkRequestsPageFilter(options) {
|
|
80
135
|
const request = parseNetworkRequestsPageFilterRequest(options.commandTokens);
|
|
81
|
-
if (!request ||
|
|
136
|
+
if (!request || options.sessionName === undefined || options.sessionName === "") {
|
|
82
137
|
return undefined;
|
|
83
|
-
|
|
84
|
-
|
|
138
|
+
}
|
|
139
|
+
const currentUrl = extractCurrentUrl(await runSessionCommandData({
|
|
140
|
+
args: ["get", "url"],
|
|
141
|
+
cwd: options.cwd,
|
|
142
|
+
namespace: options.namespace,
|
|
143
|
+
sessionName: options.sessionName,
|
|
144
|
+
signal: options.signal,
|
|
145
|
+
}));
|
|
146
|
+
if (currentUrl === undefined || currentUrl === "") {
|
|
85
147
|
return undefined;
|
|
86
|
-
|
|
148
|
+
}
|
|
149
|
+
const networkData = await runSessionCommandData({
|
|
150
|
+
args: request.cleanArgs,
|
|
151
|
+
cwd: options.cwd,
|
|
152
|
+
namespace: options.namespace,
|
|
153
|
+
sessionName: options.sessionName,
|
|
154
|
+
signal: options.signal,
|
|
155
|
+
});
|
|
87
156
|
const filtered = filterNetworkRequestsData(networkData, currentUrl, request);
|
|
88
|
-
if (!filtered)
|
|
157
|
+
if (!filtered) {
|
|
89
158
|
return undefined;
|
|
159
|
+
}
|
|
90
160
|
const summary = `Network requests filtered to current ${request.mode === "origin" ? "origin" : "URL"}: ${filtered.matchedRows}/${filtered.totalRows} rows matched.`;
|
|
91
|
-
const preview = filtered.rows.slice(0, 12).map(formatNetworkRequestRow);
|
|
92
|
-
const omitted = filtered.rows.length > preview.length ? [`- …${filtered.rows.length - preview.length} more matching rows omitted`] : [];
|
|
93
161
|
return {
|
|
94
|
-
content: [
|
|
162
|
+
content: [
|
|
163
|
+
{
|
|
164
|
+
type: "text",
|
|
165
|
+
text: formatFilteredNetworkText({ summary, currentUrl, rows: filtered.rows }),
|
|
166
|
+
},
|
|
167
|
+
],
|
|
95
168
|
details: {
|
|
96
169
|
args: options.redactedArgs,
|
|
97
170
|
command: "network",
|
|
98
171
|
compatibilityWorkaround: options.compatibilityWorkaround,
|
|
99
172
|
data: redactPresentationData({ command: "network", subcommand: "requests" }, filtered.data),
|
|
100
173
|
effectiveArgs: options.effectiveArgs,
|
|
101
|
-
networkRequestsPageFilter: {
|
|
174
|
+
networkRequestsPageFilter: {
|
|
175
|
+
cleanArgs: redactInvocationArgs(request.cleanArgs),
|
|
176
|
+
currentUrl: redactSensitiveText(currentUrl),
|
|
177
|
+
matchedRows: filtered.matchedRows,
|
|
178
|
+
mode: request.mode,
|
|
179
|
+
totalRows: filtered.totalRows,
|
|
180
|
+
},
|
|
102
181
|
sessionMode: options.sessionMode,
|
|
103
|
-
...buildAgentBrowserResultCategoryDetails({
|
|
182
|
+
...buildAgentBrowserResultCategoryDetails({
|
|
183
|
+
args: options.effectiveArgs,
|
|
184
|
+
command: "network",
|
|
185
|
+
succeeded: true,
|
|
186
|
+
}),
|
|
104
187
|
...buildSessionDetailFields(options.sessionName, options.usedImplicitSession, options.namespace, options.managedSessionRestoreDisabled()),
|
|
105
188
|
summary,
|
|
106
189
|
},
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { isRecord } from "../../../parsing.js";
|
|
2
2
|
import { buildAgentBrowserResultCategoryDetails } from "../../../results/categories.js";
|
|
3
3
|
import { applyNamespaceToNextActions } from "../../../results/next-actions.js";
|
|
4
|
-
import { buildScrollNoopNextActions } from "../diagnostics.js";
|
|
4
|
+
import { buildScrollNoopNextActions } from "../interaction-diagnostics.js";
|
|
5
5
|
import { buildSessionDetailFields, runSessionCommandData } from "../session-state.js";
|
|
6
6
|
const SCROLL_CONTAINER_DIRECTIONS = new Set(["down", "left", "right", "up"]);
|
|
7
7
|
function getContainerScrollRequest(commandTokens) {
|
|
8
|
-
if (commandTokens[0] !== "scroll" || commandTokens.length < 3)
|
|
8
|
+
if (commandTokens[0] !== "scroll" || commandTokens.length < 3) {
|
|
9
9
|
return undefined;
|
|
10
|
+
}
|
|
10
11
|
const selector = commandTokens[1];
|
|
11
12
|
const direction = commandTokens[2]?.toLowerCase();
|
|
12
|
-
if (
|
|
13
|
+
if (selector === "" ||
|
|
14
|
+
selector.startsWith("-") ||
|
|
15
|
+
selector.startsWith("@") ||
|
|
16
|
+
SCROLL_CONTAINER_DIRECTIONS.has(selector.toLowerCase())) {
|
|
13
17
|
return undefined;
|
|
14
|
-
|
|
18
|
+
}
|
|
19
|
+
if (!SCROLL_CONTAINER_DIRECTIONS.has(direction)) {
|
|
15
20
|
return undefined;
|
|
21
|
+
}
|
|
16
22
|
return { amount: commandTokens[3], direction, selector };
|
|
17
23
|
}
|
|
18
24
|
function buildContainerScrollScript(request) {
|
|
@@ -53,10 +59,18 @@ function buildScrollResult(options) {
|
|
|
53
59
|
data: options.result,
|
|
54
60
|
effectiveArgs: options.effectiveArgs,
|
|
55
61
|
exitCode: options.succeeded ? 0 : 1,
|
|
56
|
-
nextActions: options.succeeded
|
|
62
|
+
nextActions: options.succeeded
|
|
63
|
+
? undefined
|
|
64
|
+
: applyNamespaceToNextActions(buildScrollNoopNextActions(options.sessionName), options.namespace),
|
|
57
65
|
[options.scrollField]: options.scrollValue,
|
|
58
66
|
sessionMode: options.sessionMode,
|
|
59
|
-
...buildAgentBrowserResultCategoryDetails({
|
|
67
|
+
...buildAgentBrowserResultCategoryDetails({
|
|
68
|
+
args: options.effectiveArgs,
|
|
69
|
+
command: options.command,
|
|
70
|
+
errorText: options.succeeded ? undefined : options.message,
|
|
71
|
+
succeeded: options.succeeded,
|
|
72
|
+
validationError: options.succeeded ? undefined : options.message,
|
|
73
|
+
}),
|
|
60
74
|
...buildSessionDetailFields(options.sessionName, options.usedImplicitSession, options.namespace, options.managedSessionRestoreDisabled()),
|
|
61
75
|
summary: options.message,
|
|
62
76
|
validationError: options.succeeded ? undefined : options.message,
|
|
@@ -64,40 +78,87 @@ function buildScrollResult(options) {
|
|
|
64
78
|
isError: !options.succeeded,
|
|
65
79
|
};
|
|
66
80
|
}
|
|
81
|
+
function getScrollResult(data) {
|
|
82
|
+
const result = isRecord(data) && isRecord(data.result) ? data.result : data;
|
|
83
|
+
return isRecord(result) && typeof result.status === "string"
|
|
84
|
+
? { ...result, status: result.status }
|
|
85
|
+
: undefined;
|
|
86
|
+
}
|
|
87
|
+
function describeScrollAmount(amount) {
|
|
88
|
+
return amount !== undefined && amount !== "" ? ` by ${amount}` : "";
|
|
89
|
+
}
|
|
67
90
|
export async function tryContainerScroll(options) {
|
|
68
91
|
const request = getContainerScrollRequest(options.commandTokens);
|
|
69
|
-
if (!request ||
|
|
92
|
+
if (!request || (options.sessionName ?? "") === "") {
|
|
70
93
|
return undefined;
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
94
|
+
}
|
|
95
|
+
const data = await runSessionCommandData({
|
|
96
|
+
args: ["eval", "--stdin"],
|
|
97
|
+
cwd: options.cwd,
|
|
98
|
+
namespace: options.namespace,
|
|
99
|
+
sessionName: options.sessionName,
|
|
100
|
+
signal: options.signal,
|
|
101
|
+
stdin: buildContainerScrollScript(request),
|
|
102
|
+
});
|
|
103
|
+
const result = getScrollResult(data);
|
|
104
|
+
if (!result) {
|
|
74
105
|
return undefined;
|
|
106
|
+
}
|
|
75
107
|
const succeeded = result.status === "scrolled";
|
|
76
108
|
const message = succeeded
|
|
77
|
-
? `Scrolled container ${request.selector} ${request.direction}${request.amount
|
|
109
|
+
? `Scrolled container ${request.selector} ${request.direction}${describeScrollAmount(request.amount)}.`
|
|
78
110
|
: `Scroll container ${request.selector} did not move (${result.status}).`;
|
|
79
|
-
return buildScrollResult({
|
|
111
|
+
return buildScrollResult({
|
|
112
|
+
...options,
|
|
113
|
+
command: "scroll",
|
|
114
|
+
message,
|
|
115
|
+
result,
|
|
116
|
+
scrollField: "scrollContainer",
|
|
117
|
+
scrollValue: { request, result },
|
|
118
|
+
succeeded,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function isPageScrollDirection(direction) {
|
|
122
|
+
return (direction === "down" || direction === "left" || direction === "right" || direction === "up");
|
|
123
|
+
}
|
|
124
|
+
function isValidScrollAmount(amount) {
|
|
125
|
+
if (amount === undefined || amount === "") {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
return /^\d+(?:\.\d+)?(?:px|%)?$/.test(amount) && Number(amount.replace(/(?:px|%)$/, "")) > 0;
|
|
129
|
+
}
|
|
130
|
+
function describePageScroll(request) {
|
|
131
|
+
if ("target" in request) {
|
|
132
|
+
return `to ${request.target}`;
|
|
133
|
+
}
|
|
134
|
+
return `${request.direction}${describeScrollAmount(request.amount)}`;
|
|
80
135
|
}
|
|
81
136
|
function getPageScrollToRequest(commandTokens) {
|
|
82
|
-
if (commandTokens[0] !== "scroll")
|
|
137
|
+
if (commandTokens[0] !== "scroll") {
|
|
83
138
|
return undefined;
|
|
139
|
+
}
|
|
84
140
|
if (commandTokens[1]?.toLowerCase() === "to") {
|
|
85
|
-
|
|
86
|
-
return target === "end" || target === "top" ? { target } : undefined;
|
|
141
|
+
return getPageScrollTarget(commandTokens.at(2));
|
|
87
142
|
}
|
|
88
143
|
const direction = commandTokens[1]?.toLowerCase();
|
|
89
|
-
if (!
|
|
144
|
+
if (!isPageScrollDirection(direction) || commandTokens.length > 3) {
|
|
90
145
|
return undefined;
|
|
91
|
-
|
|
92
|
-
|
|
146
|
+
}
|
|
147
|
+
const amount = commandTokens.at(2);
|
|
148
|
+
if (!isValidScrollAmount(amount)) {
|
|
93
149
|
return undefined;
|
|
94
|
-
|
|
150
|
+
}
|
|
151
|
+
return { amount, direction };
|
|
152
|
+
}
|
|
153
|
+
function getPageScrollTarget(token) {
|
|
154
|
+
const target = token?.toLowerCase();
|
|
155
|
+
return target === "end" || target === "top" ? { target } : undefined;
|
|
95
156
|
}
|
|
96
157
|
function buildPageScrollToScript(request) {
|
|
97
158
|
return `(() => {
|
|
98
159
|
const target = ${JSON.stringify("target" in request ? request.target : undefined)};
|
|
99
160
|
const direction = ${JSON.stringify("direction" in request ? request.direction : undefined)};
|
|
100
|
-
const amountToken = ${JSON.stringify("amount" in request ? request.amount ?? "" : "")};
|
|
161
|
+
const amountToken = ${JSON.stringify("amount" in request ? (request.amount ?? "") : "")};
|
|
101
162
|
const request = target ? { target } : { direction, amount: amountToken || undefined };
|
|
102
163
|
const scroller = document.scrollingElement || document.documentElement || document.body;
|
|
103
164
|
if (!scroller) return { status: "no-scroller", ...request };
|
|
@@ -129,16 +190,36 @@ function buildPageScrollToScript(request) {
|
|
|
129
190
|
}
|
|
130
191
|
export async function tryPageScrollTo(options) {
|
|
131
192
|
const request = getPageScrollToRequest(options.commandTokens);
|
|
132
|
-
if (!request ||
|
|
193
|
+
if (!request || (options.sessionName ?? "") === "") {
|
|
133
194
|
return undefined;
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
195
|
+
}
|
|
196
|
+
const data = await runSessionCommandData({
|
|
197
|
+
args: ["eval", "--stdin"],
|
|
198
|
+
cwd: options.cwd,
|
|
199
|
+
namespace: options.namespace,
|
|
200
|
+
sessionName: options.sessionName,
|
|
201
|
+
signal: options.signal,
|
|
202
|
+
stdin: buildPageScrollToScript(request),
|
|
203
|
+
});
|
|
204
|
+
const result = getScrollResult(data);
|
|
205
|
+
if (!result) {
|
|
137
206
|
return undefined;
|
|
207
|
+
}
|
|
138
208
|
const succeeded = result.status === "scrolled";
|
|
139
|
-
if (!succeeded && "direction" in request)
|
|
209
|
+
if (!succeeded && "direction" in request) {
|
|
140
210
|
return undefined;
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
211
|
+
}
|
|
212
|
+
const description = describePageScroll(request);
|
|
213
|
+
const message = succeeded
|
|
214
|
+
? `Scrolled page ${description}.`
|
|
215
|
+
: `Scroll ${description} completed with no observed movement (${result.status}).`;
|
|
216
|
+
return buildScrollResult({
|
|
217
|
+
...options,
|
|
218
|
+
command: "scroll",
|
|
219
|
+
message,
|
|
220
|
+
result,
|
|
221
|
+
scrollField: "scrollPage",
|
|
222
|
+
scrollValue: { request, result },
|
|
223
|
+
succeeded,
|
|
224
|
+
});
|
|
144
225
|
}
|