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
|
@@ -1,67 +1,30 @@
|
|
|
1
1
|
import { getAgentBrowserSessionIdentityKey } from "../argv-grammar.js";
|
|
2
|
-
|
|
2
|
+
export { isSessionArtifactManifest } from "./artifact-manifest-validation.js";
|
|
3
3
|
export function isPendingRecordingCommand(command, subcommand, kind) {
|
|
4
|
-
return command === "record" && (subcommand === "start" || subcommand === "restart") && kind === "video";
|
|
4
|
+
return (command === "record" && (subcommand === "start" || subcommand === "restart") && kind === "video");
|
|
5
5
|
}
|
|
6
6
|
export function isPendingRecordingArtifact(artifact) {
|
|
7
|
-
return artifact.recordingState === "openRecording" ||
|
|
8
|
-
|
|
7
|
+
return (artifact.recordingState === "openRecording" ||
|
|
8
|
+
artifact.status === "pending" ||
|
|
9
|
+
(artifact.status === undefined &&
|
|
10
|
+
isPendingRecordingCommand(artifact.command, artifact.subcommand, artifact.kind)));
|
|
9
11
|
}
|
|
10
12
|
const SESSION_ARTIFACT_MANIFEST_VERSION = 1;
|
|
11
13
|
const SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES_ENV = "PI_AGENT_BROWSER_SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES";
|
|
12
14
|
export const DEFAULT_SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES = 100;
|
|
13
15
|
function parsePositiveSafeInteger(value) {
|
|
14
|
-
if (value === undefined)
|
|
16
|
+
if (value === undefined) {
|
|
15
17
|
return undefined;
|
|
18
|
+
}
|
|
16
19
|
const parsed = Number(value);
|
|
17
|
-
if (!Number.isSafeInteger(parsed) || parsed <= 0)
|
|
20
|
+
if (!Number.isSafeInteger(parsed) || parsed <= 0) {
|
|
18
21
|
return undefined;
|
|
22
|
+
}
|
|
19
23
|
return parsed;
|
|
20
24
|
}
|
|
21
25
|
export function getSessionArtifactManifestMaxEntries(env = process.env) {
|
|
22
|
-
return parsePositiveSafeInteger(env[SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES_ENV]) ??
|
|
23
|
-
|
|
24
|
-
function isManifestEntry(value) {
|
|
25
|
-
if (!isRecord(value))
|
|
26
|
-
return false;
|
|
27
|
-
if (typeof value.path !== "string" || value.path.trim().length === 0)
|
|
28
|
-
return false;
|
|
29
|
-
if (typeof value.createdAtMs !== "number" || !Number.isFinite(value.createdAtMs))
|
|
30
|
-
return false;
|
|
31
|
-
if (!["evicted", "ephemeral", "live", "missing"].includes(String(value.retentionState)))
|
|
32
|
-
return false;
|
|
33
|
-
if (!["explicit-path", "persistent-session", "process-temp"].includes(String(value.storageScope)))
|
|
34
|
-
return false;
|
|
35
|
-
if (typeof value.kind !== "string" || value.kind.trim().length === 0)
|
|
36
|
-
return false;
|
|
37
|
-
for (const key of ["absolutePath", "command", "cwd", "extension", "mediaType", "namespace", "requestedPath", "session", "subcommand"]) {
|
|
38
|
-
if (value[key] !== undefined && typeof value[key] !== "string")
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
if (value.evictedAtMs !== undefined && (typeof value.evictedAtMs !== "number" || !Number.isFinite(value.evictedAtMs)))
|
|
42
|
-
return false;
|
|
43
|
-
if (value.exists !== undefined && typeof value.exists !== "boolean")
|
|
44
|
-
return false;
|
|
45
|
-
if (value.sizeBytes !== undefined && (typeof value.sizeBytes !== "number" || !Number.isFinite(value.sizeBytes) || value.sizeBytes < 0))
|
|
46
|
-
return false;
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
export function isSessionArtifactManifest(value) {
|
|
50
|
-
if (!isRecord(value))
|
|
51
|
-
return false;
|
|
52
|
-
if (value.version !== SESSION_ARTIFACT_MANIFEST_VERSION)
|
|
53
|
-
return false;
|
|
54
|
-
if (!Array.isArray(value.entries) || !value.entries.every(isManifestEntry))
|
|
55
|
-
return false;
|
|
56
|
-
if (typeof value.updatedAtMs !== "number" || !Number.isFinite(value.updatedAtMs))
|
|
57
|
-
return false;
|
|
58
|
-
if (typeof value.maxEntries !== "number" || !Number.isSafeInteger(value.maxEntries) || value.maxEntries <= 0)
|
|
59
|
-
return false;
|
|
60
|
-
if (typeof value.liveCount !== "number" || !Number.isSafeInteger(value.liveCount) || value.liveCount < 0)
|
|
61
|
-
return false;
|
|
62
|
-
if (typeof value.evictedCount !== "number" || !Number.isSafeInteger(value.evictedCount) || value.evictedCount < 0)
|
|
63
|
-
return false;
|
|
64
|
-
return true;
|
|
26
|
+
return (parsePositiveSafeInteger(env[SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES_ENV]) ??
|
|
27
|
+
DEFAULT_SESSION_ARTIFACT_MANIFEST_MAX_ENTRIES);
|
|
65
28
|
}
|
|
66
29
|
export function buildEvictedSessionArtifactEntries(evictedArtifacts, nowMs) {
|
|
67
30
|
return evictedArtifacts.map((artifact) => ({
|
|
@@ -78,34 +41,54 @@ export function formatSessionArtifactRetentionSummary(manifest) {
|
|
|
78
41
|
const ephemeralCount = manifest.entries.filter((entry) => entry.retentionState === "ephemeral").length;
|
|
79
42
|
const missingCount = manifest.entries.filter((entry) => entry.retentionState === "missing").length;
|
|
80
43
|
const parts = [`${manifest.liveCount} live`, `${manifest.evictedCount} evicted`];
|
|
81
|
-
if (ephemeralCount > 0)
|
|
44
|
+
if (ephemeralCount > 0) {
|
|
82
45
|
parts.push(`${ephemeralCount} ephemeral`);
|
|
83
|
-
|
|
46
|
+
}
|
|
47
|
+
if (missingCount > 0) {
|
|
84
48
|
parts.push(`${missingCount} missing`);
|
|
49
|
+
}
|
|
85
50
|
return `Session artifacts: ${parts.join(", ")} (${manifest.entries.length}/${manifest.maxEntries} recent).`;
|
|
86
51
|
}
|
|
87
52
|
export function getSessionArtifactManifestEntryKey(entry) {
|
|
88
|
-
const pathKey = entry.storageScope === "explicit-path" &&
|
|
89
|
-
|
|
53
|
+
const pathKey = entry.storageScope === "explicit-path" &&
|
|
54
|
+
entry.absolutePath !== undefined &&
|
|
55
|
+
entry.absolutePath.length > 0
|
|
56
|
+
? `${entry.storageScope}:${entry.absolutePath}`
|
|
57
|
+
: `${entry.storageScope}:${entry.path}`;
|
|
58
|
+
const recordingSessionKey = entry.command === "record" &&
|
|
59
|
+
entry.kind === "video" &&
|
|
60
|
+
entry.session !== undefined &&
|
|
61
|
+
entry.session.length > 0
|
|
90
62
|
? getAgentBrowserSessionIdentityKey(entry.session, entry.namespace)
|
|
91
63
|
: undefined;
|
|
92
|
-
return recordingSessionKey
|
|
64
|
+
return recordingSessionKey !== undefined && recordingSessionKey.length > 0
|
|
65
|
+
? `${pathKey}\0${recordingSessionKey}`
|
|
66
|
+
: pathKey;
|
|
93
67
|
}
|
|
94
68
|
export function retirePendingRecordingManifestEntries(manifest, sessionName, namespace, nowMs = Date.now()) {
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
const sessionKey = sessionName !== undefined && sessionName.length > 0
|
|
70
|
+
? getAgentBrowserSessionIdentityKey(sessionName, namespace)
|
|
71
|
+
: undefined;
|
|
97
72
|
const entries = manifest.entries.map((entry) => {
|
|
98
|
-
if (
|
|
99
|
-
||
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
73
|
+
if (sessionKey === undefined ||
|
|
74
|
+
sessionKey.length === 0 ||
|
|
75
|
+
entry.session === undefined ||
|
|
76
|
+
entry.session.length === 0 ||
|
|
77
|
+
getAgentBrowserSessionIdentityKey(entry.session, entry.namespace) !== sessionKey ||
|
|
78
|
+
entry.kind !== "video" ||
|
|
79
|
+
!isPendingRecordingArtifact(entry)) {
|
|
103
80
|
return entry;
|
|
104
|
-
|
|
105
|
-
return {
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
...entry,
|
|
84
|
+
recordingState: undefined,
|
|
85
|
+
status: "unverified",
|
|
86
|
+
subcommand: "close-abandoned",
|
|
87
|
+
};
|
|
106
88
|
});
|
|
107
|
-
if (
|
|
89
|
+
if (entries.every((entry, index) => entry === manifest.entries[index])) {
|
|
108
90
|
return manifest;
|
|
91
|
+
}
|
|
109
92
|
return {
|
|
110
93
|
...manifest,
|
|
111
94
|
entries,
|
|
@@ -114,6 +97,45 @@ export function retirePendingRecordingManifestEntries(manifest, sessionName, nam
|
|
|
114
97
|
updatedAtMs: nowMs,
|
|
115
98
|
};
|
|
116
99
|
}
|
|
100
|
+
function getSupersededRecordingKeys(candidates, entry, key) {
|
|
101
|
+
if (entry.command !== "record" || entry.kind !== "video") {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const entrySessionKey = entry.session !== undefined && entry.session.length > 0
|
|
105
|
+
? getAgentBrowserSessionIdentityKey(entry.session, entry.namespace)
|
|
106
|
+
: undefined;
|
|
107
|
+
return candidates
|
|
108
|
+
.filter(([candidateKey, candidate]) => {
|
|
109
|
+
const sameRecordingSession = entrySessionKey === undefined
|
|
110
|
+
? candidate.session === undefined
|
|
111
|
+
: candidate.session !== undefined &&
|
|
112
|
+
getAgentBrowserSessionIdentityKey(candidate.session, candidate.namespace) ===
|
|
113
|
+
entrySessionKey;
|
|
114
|
+
return (candidateKey !== key &&
|
|
115
|
+
sameRecordingSession &&
|
|
116
|
+
candidate.kind === "video" &&
|
|
117
|
+
isPendingRecordingArtifact(candidate));
|
|
118
|
+
})
|
|
119
|
+
.map(([candidateKey]) => candidateKey);
|
|
120
|
+
}
|
|
121
|
+
function mergeManifestEntry(existing, entry, nowMs) {
|
|
122
|
+
return {
|
|
123
|
+
...existing,
|
|
124
|
+
...entry,
|
|
125
|
+
createdAtMs: entry.command === "record" && entry.kind === "video"
|
|
126
|
+
? entry.createdAtMs
|
|
127
|
+
: (existing?.createdAtMs ?? entry.createdAtMs),
|
|
128
|
+
evictedAtMs: entry.retentionState === "evicted" ? (entry.evictedAtMs ?? nowMs) : entry.evictedAtMs,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function compareManifestEntries(left, right) {
|
|
132
|
+
const difference = (right.evictedAtMs ?? right.createdAtMs) - (left.evictedAtMs ?? left.createdAtMs);
|
|
133
|
+
if (difference !== 0 && !Number.isNaN(difference)) {
|
|
134
|
+
return difference;
|
|
135
|
+
}
|
|
136
|
+
const pendingDifference = Number(isPendingRecordingArtifact(right)) - Number(isPendingRecordingArtifact(left));
|
|
137
|
+
return pendingDifference !== 0 ? pendingDifference : left.path.localeCompare(right.path);
|
|
138
|
+
}
|
|
117
139
|
export function mergeSessionArtifactManifest(options) {
|
|
118
140
|
const nowMs = options.nowMs ?? Date.now();
|
|
119
141
|
const maxEntries = getSessionArtifactManifestMaxEntries();
|
|
@@ -123,43 +145,23 @@ export function mergeSessionArtifactManifest(options) {
|
|
|
123
145
|
}
|
|
124
146
|
const orderedEntries = (options.entries ?? [])
|
|
125
147
|
.map((entry, index) => ({ entry, index }))
|
|
126
|
-
.sort((left, right) =>
|
|
148
|
+
.sort((left, right) => {
|
|
149
|
+
const difference = left.entry.createdAtMs - right.entry.createdAtMs;
|
|
150
|
+
return difference !== 0 && !Number.isNaN(difference) ? difference : left.index - right.index;
|
|
151
|
+
})
|
|
127
152
|
.map(({ entry }) => entry);
|
|
128
153
|
for (const entry of orderedEntries) {
|
|
129
154
|
const key = getSessionArtifactManifestEntryKey(entry);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
for (const [candidateKey, candidate] of byPath) {
|
|
133
|
-
const sameRecordingSession = entrySessionKey === undefined
|
|
134
|
-
? candidate.session === undefined
|
|
135
|
-
: candidate.session !== undefined && getAgentBrowserSessionIdentityKey(candidate.session, candidate.namespace) === entrySessionKey;
|
|
136
|
-
if (candidateKey !== key
|
|
137
|
-
&& sameRecordingSession
|
|
138
|
-
&& candidate.kind === "video"
|
|
139
|
-
&& isPendingRecordingArtifact(candidate)) {
|
|
140
|
-
byPath.delete(candidateKey);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
155
|
+
for (const candidateKey of getSupersededRecordingKeys([...byPath], entry, key)) {
|
|
156
|
+
byPath.delete(candidateKey);
|
|
143
157
|
}
|
|
144
158
|
const existing = byPath.get(key);
|
|
145
|
-
byPath.set(key,
|
|
146
|
-
...existing,
|
|
147
|
-
...entry,
|
|
148
|
-
createdAtMs: entry.command === "record" && entry.kind === "video" ? entry.createdAtMs : existing?.createdAtMs ?? entry.createdAtMs,
|
|
149
|
-
evictedAtMs: entry.retentionState === "evicted" ? (entry.evictedAtMs ?? nowMs) : entry.evictedAtMs,
|
|
150
|
-
});
|
|
159
|
+
byPath.set(key, mergeManifestEntry(existing, entry, nowMs));
|
|
151
160
|
}
|
|
152
|
-
if (byPath.size === 0)
|
|
161
|
+
if (byPath.size === 0) {
|
|
153
162
|
return undefined;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const leftTime = left.evictedAtMs ?? left.createdAtMs;
|
|
157
|
-
const rightTime = right.evictedAtMs ?? right.createdAtMs;
|
|
158
|
-
return rightTime - leftTime
|
|
159
|
-
|| Number(isPendingRecordingArtifact(right)) - Number(isPendingRecordingArtifact(left))
|
|
160
|
-
|| left.path.localeCompare(right.path);
|
|
161
|
-
})
|
|
162
|
-
.slice(0, maxEntries);
|
|
163
|
+
}
|
|
164
|
+
const entries = [...byPath.values()].sort(compareManifestEntries).slice(0, maxEntries);
|
|
163
165
|
return {
|
|
164
166
|
entries,
|
|
165
167
|
evictedCount: entries.filter((entry) => entry.retentionState === "evicted").length,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { isPendingRecordingArtifact } from "./artifact-manifest.js";
|
|
2
|
+
import { buildNextToolAction } from "./next-actions.js";
|
|
3
|
+
function buildArtifactAction(path) {
|
|
4
|
+
return {
|
|
5
|
+
artifactPath: path,
|
|
6
|
+
id: "use-saved-artifact",
|
|
7
|
+
reason: "Use the saved artifact path from the structured result instead of scraping it from text.",
|
|
8
|
+
safety: "Verify artifact metadata such as exists/status before treating the file as durable.",
|
|
9
|
+
tool: "agent_browser",
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function buildArtifactVerificationAction(artifact) {
|
|
13
|
+
return {
|
|
14
|
+
artifactPath: artifact.path,
|
|
15
|
+
id: "verify-artifact-path",
|
|
16
|
+
reason: "The wrapper has artifact metadata but did not verify this file as present on disk.",
|
|
17
|
+
safety: "Check details.artifactVerification and the filesystem before treating the artifact as durable.",
|
|
18
|
+
tool: "agent_browser",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function buildMissingArtifactAction(artifact, afterFailure) {
|
|
22
|
+
if (artifact.kind !== "download") {
|
|
23
|
+
return buildArtifactVerificationAction(artifact);
|
|
24
|
+
}
|
|
25
|
+
return buildNextToolAction({
|
|
26
|
+
args: ["wait", "--download", artifact.path],
|
|
27
|
+
id: "wait-for-download",
|
|
28
|
+
reason: afterFailure
|
|
29
|
+
? "The requested download artifact was not found on disk after upstream reported completion."
|
|
30
|
+
: "Upstream reported a download path, but the wrapper did not verify the file on disk.",
|
|
31
|
+
safety: "Use an explicit wait timeout; if you set top-level timeoutMs, keep it above the wait duration plus a small grace window.",
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function buildSavedArtifactNextActions(options) {
|
|
35
|
+
const artifacts = options.artifacts ?? [];
|
|
36
|
+
const savedFilePath = options.savedFilePath;
|
|
37
|
+
const actions = [];
|
|
38
|
+
if (savedFilePath !== undefined &&
|
|
39
|
+
savedFilePath.length > 0 &&
|
|
40
|
+
artifacts.find((artifact) => artifact.path === savedFilePath)?.exists !== false) {
|
|
41
|
+
actions.push(buildArtifactAction(savedFilePath));
|
|
42
|
+
}
|
|
43
|
+
for (const artifact of artifacts) {
|
|
44
|
+
if (isPendingRecordingArtifact(artifact)) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (artifact.exists === false) {
|
|
48
|
+
actions.push(buildMissingArtifactAction(artifact, false));
|
|
49
|
+
}
|
|
50
|
+
else if (artifact.path !== savedFilePath) {
|
|
51
|
+
actions.push(buildArtifactAction(artifact.path));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return actions;
|
|
55
|
+
}
|
|
56
|
+
export function buildMissingArtifactNextActions(artifacts) {
|
|
57
|
+
return (artifacts ?? [])
|
|
58
|
+
.filter((artifact) => !isPendingRecordingArtifact(artifact) &&
|
|
59
|
+
(artifact.exists === false || artifact.status === "stale"))
|
|
60
|
+
.map((artifact) => buildMissingArtifactAction(artifact, true));
|
|
61
|
+
}
|
|
62
|
+
export function buildPendingRecordingNextActions(artifacts) {
|
|
63
|
+
return (artifacts ?? []).some(isPendingRecordingArtifact)
|
|
64
|
+
? [
|
|
65
|
+
buildNextToolAction({
|
|
66
|
+
args: ["record", "stop"],
|
|
67
|
+
id: "stop-pending-recording",
|
|
68
|
+
reason: "Stop the active recording so the requested video can be finalized and verified on disk.",
|
|
69
|
+
safety: "The file remains pending until record stop succeeds; verify details.artifactVerification afterward.",
|
|
70
|
+
}),
|
|
71
|
+
]
|
|
72
|
+
: [];
|
|
73
|
+
}
|
|
@@ -1,85 +1,142 @@
|
|
|
1
1
|
import { isPendingRecordingArtifact } from "./artifact-manifest.js";
|
|
2
2
|
function hasUnverifiedFileArtifact(artifacts) {
|
|
3
|
-
return (artifacts ?? []).some((artifact) => !isPendingRecordingArtifact(artifact) &&
|
|
3
|
+
return (artifacts ?? []).some((artifact) => !isPendingRecordingArtifact(artifact) &&
|
|
4
|
+
(artifact.exists !== true ||
|
|
5
|
+
["failed", "stale", "unverified"].includes(artifact.status ?? "")));
|
|
4
6
|
}
|
|
5
7
|
export function classifyAgentBrowserSuccessCategory(options) {
|
|
6
|
-
if (options.inspection)
|
|
8
|
+
if (options.inspection === true) {
|
|
7
9
|
return "inspection";
|
|
8
|
-
|
|
10
|
+
}
|
|
11
|
+
if (hasUnverifiedFileArtifact(options.artifacts)) {
|
|
9
12
|
return "artifact-unverified";
|
|
10
|
-
|
|
13
|
+
}
|
|
14
|
+
if ((options.artifacts ?? []).some(isPendingRecordingArtifact)) {
|
|
11
15
|
return "artifact-pending";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return "completed";
|
|
16
|
+
}
|
|
17
|
+
return (options.artifacts ?? []).length > 0 || options.savedFile !== undefined
|
|
18
|
+
? "artifact-saved"
|
|
19
|
+
: "completed";
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (options.confirmationRequired)
|
|
25
|
-
return "confirmation-required";
|
|
26
|
-
// Canonical upstream prefix first: lastUrl can contain aborted / policy-blocked / about:blank.
|
|
27
|
-
if (/\btab_gone:/i.test(text))
|
|
28
|
-
return "tab-gone";
|
|
29
|
-
// Upstream 0.32.4+ locator misses keep detail and may echo getByRole/getByText or Names seen lists.
|
|
30
|
-
// Evaluate before text-derived timeout/confirmation so accessible-name substrings cannot suppress recovery.
|
|
31
|
-
const isUpstreamLocatorMiss = /\bNo element found:\s*(?:getBy[A-Za-z]+|role=|text=|label=|placeholder=|alt=|title=|testid=)/i.test(text) ||
|
|
32
|
-
// No trailing \b after ":" — colon is non-word, so "Element not found: text=…" would not match.
|
|
21
|
+
function hasScopedNamesSeen(text, command) {
|
|
22
|
+
return (/\bNames seen:/i.test(text) &&
|
|
23
|
+
(command === "find" || /\belement has role\b|\bnone match name\b|\bgetByRole\b/i.test(text)));
|
|
24
|
+
}
|
|
25
|
+
function isUpstreamLocatorMiss(text, command) {
|
|
26
|
+
return (/\bNo element found:\s*(?:getBy[A-Za-z]+|role=|text=|label=|placeholder=|alt=|title=|testid=)/i.test(text) ||
|
|
33
27
|
(/\bElement not found:/i.test(text) && /\bVerify the selector, role, or name\b/i.test(text)) ||
|
|
34
28
|
/\bnone match name\b/i.test(text) ||
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
hasScopedNamesSeen(text, command) ||
|
|
30
|
+
/\belement has role\b[\s\S]*\bnone match\b/i.test(text));
|
|
31
|
+
}
|
|
32
|
+
function classifyNativeFailure(context) {
|
|
33
|
+
const { options, text, command } = context;
|
|
34
|
+
// Explicit native flags and prefixes win over accessible-name text and lastUrl substrings.
|
|
35
|
+
if (options.confirmationRequired === true) {
|
|
36
|
+
return "confirmation-required";
|
|
37
|
+
}
|
|
38
|
+
if (/\btab_gone:/i.test(text)) {
|
|
39
|
+
return "tab-gone";
|
|
40
|
+
}
|
|
41
|
+
if (isUpstreamLocatorMiss(text, command)) {
|
|
39
42
|
return "selector-not-found";
|
|
40
|
-
|
|
43
|
+
}
|
|
44
|
+
if (/confirmation required|pending confirmation|requires confirmation/i.test(text)) {
|
|
41
45
|
return "confirmation-required";
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
function classifyProcessFailure(context) {
|
|
50
|
+
const { options, text } = context;
|
|
51
|
+
// Bare "timeout" may be an accessible name; require actual timeout phrasing.
|
|
52
|
+
if (options.timedOut === true ||
|
|
45
53
|
/\b(?:timed\s+out|timeout exceeded|watchdog|IPC read timeout)\b|must stay under its 30s IPC read timeout|Operation timed out/i.test(text)) {
|
|
46
54
|
return "timeout";
|
|
47
55
|
}
|
|
48
|
-
if (/ENOENT|not found on PATH|could not find.*agent-browser|agent-browser is required but was not found/i.test(text))
|
|
56
|
+
if (/ENOENT|not found on PATH|could not find.*agent-browser|agent-browser is required but was not found/i.test(text)) {
|
|
49
57
|
return "missing-binary";
|
|
50
|
-
|
|
58
|
+
}
|
|
59
|
+
if ((options.parseError ?? "") !== "" ||
|
|
60
|
+
/invalid JSON|missing boolean success|success field must be boolean|returned no JSON output/i.test(text)) {
|
|
51
61
|
return "parse-failure";
|
|
52
|
-
|
|
62
|
+
}
|
|
63
|
+
if (/aborted/i.test(text)) {
|
|
53
64
|
return "aborted";
|
|
54
|
-
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
function classifyLifecycleFailure(context) {
|
|
69
|
+
const { options, text } = context;
|
|
70
|
+
if (/policy[- ]blocked|blocked by caller policy|caller deny policy|caller allow policy/i.test(text)) {
|
|
55
71
|
return "policy-blocked";
|
|
56
|
-
|
|
72
|
+
}
|
|
73
|
+
if (/cleanup failed|cleanup.*partial|partial cleanup|remaining resources/i.test(text)) {
|
|
57
74
|
return "cleanup-failed";
|
|
58
|
-
|
|
75
|
+
}
|
|
76
|
+
if ((options.validationError ?? "") !== "" ||
|
|
77
|
+
/Agent-browser Unix socket path would be|Agent-browser socket storage .* is unusable/i.test(text)) {
|
|
59
78
|
return "validation-error";
|
|
60
|
-
|
|
79
|
+
}
|
|
80
|
+
if (options.tabDrift === true ||
|
|
81
|
+
/could not re-select the intended tab|about:blank|selected tab looks wrong|tab drift|tab.*wrong/i.test(text)) {
|
|
61
82
|
return "tab-drift";
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
function reportsSelectorMatchFailure(text) {
|
|
87
|
+
return (/\b(?:no elements? found|failed to find|could not find|unable to find)\b.*\b(?:selector|locator)\b/i.test(text) ||
|
|
88
|
+
/\b(?:selector|locator)\b.*\b(?:no elements? found|not found|missing|failed to find|could not find|unable to find)\b/i.test(text));
|
|
89
|
+
}
|
|
90
|
+
function reportsUnsupportedSelector(text) {
|
|
91
|
+
return (/\b(?:unsupported|unknown|invalid)\s+(?:selector|locator)\b/i.test(text) ||
|
|
70
92
|
/\bfailed to parse selector\b/i.test(text) ||
|
|
71
93
|
/\bselector\b.*\b(?:parse|syntax|unsupported|invalid)\b/i.test(text) ||
|
|
72
|
-
(
|
|
94
|
+
(/(?:\btext=|:has-text\(|\bgetByRole\b|\bgetByText\b)/i.test(text) &&
|
|
95
|
+
reportsSelectorMatchFailure(text)));
|
|
96
|
+
}
|
|
97
|
+
function classifySelectorFailure(context) {
|
|
98
|
+
const { options, text, command } = context;
|
|
99
|
+
if (/\bUnknown ref\b|\bstale ref\b|@ref may be stale|\bref\b.*\b(?:not found|missing|expired)\b/i.test(text)) {
|
|
100
|
+
return "stale-ref";
|
|
101
|
+
}
|
|
102
|
+
const usedRef = options.args?.some((arg) => /^@e\d+\b/.test(arg)) ?? false;
|
|
103
|
+
if (usedRef && /could not locate element|element not found|no element/i.test(text)) {
|
|
104
|
+
return "stale-ref";
|
|
105
|
+
}
|
|
106
|
+
if (reportsUnsupportedSelector(text)) {
|
|
73
107
|
return "selector-unsupported";
|
|
74
108
|
}
|
|
75
|
-
if (command === "find" &&
|
|
109
|
+
if (command === "find" &&
|
|
110
|
+
/could not locate element|element not found|no elements? found|unable to find/i.test(text)) {
|
|
76
111
|
return "selector-not-found";
|
|
77
|
-
if (reportsSelectorMatchFailure)
|
|
78
|
-
return "selector-not-found";
|
|
79
|
-
if ((command === "download" || text.includes("wait --download") || /\bdownload\b/i.test(text)) && /missing|not verified|not found|failed|timeout|timed out/i.test(text)) {
|
|
80
|
-
return "download-not-verified";
|
|
81
112
|
}
|
|
82
|
-
return "
|
|
113
|
+
return reportsSelectorMatchFailure(text) ? "selector-not-found" : undefined;
|
|
114
|
+
}
|
|
115
|
+
function classifyDownloadFailure(context) {
|
|
116
|
+
const { text, command } = context;
|
|
117
|
+
return (command === "download" ||
|
|
118
|
+
text.includes("wait --download") ||
|
|
119
|
+
/\bdownload\b/i.test(text)) &&
|
|
120
|
+
/missing|not verified|not found|failed|timeout|timed out/i.test(text)
|
|
121
|
+
? "download-not-verified"
|
|
122
|
+
: "upstream-error";
|
|
123
|
+
}
|
|
124
|
+
export function classifyAgentBrowserFailureCategory(options) {
|
|
125
|
+
const text = [
|
|
126
|
+
options.errorText,
|
|
127
|
+
options.validationError,
|
|
128
|
+
options.parseError,
|
|
129
|
+
options.spawnError,
|
|
130
|
+
options.stderr,
|
|
131
|
+
]
|
|
132
|
+
.filter(Boolean)
|
|
133
|
+
.join("\n");
|
|
134
|
+
const context = { options, text, command: options.command ?? "" };
|
|
135
|
+
return (classifyNativeFailure(context) ??
|
|
136
|
+
classifyProcessFailure(context) ??
|
|
137
|
+
classifyLifecycleFailure(context) ??
|
|
138
|
+
classifySelectorFailure(context) ??
|
|
139
|
+
classifyDownloadFailure(context));
|
|
83
140
|
}
|
|
84
141
|
export function buildAgentBrowserResultCategoryDetails(options) {
|
|
85
142
|
if (options.succeeded) {
|
|
@@ -5,9 +5,18 @@ const CONFIRMATION_REQUIRED_FIELD_NAMES = [
|
|
|
5
5
|
"requires_confirmation",
|
|
6
6
|
"requiresConfirmation",
|
|
7
7
|
];
|
|
8
|
-
const CONFIRMATION_REQUIRED_RECORD_FIELD_NAMES = [
|
|
8
|
+
const CONFIRMATION_REQUIRED_RECORD_FIELD_NAMES = [
|
|
9
|
+
"confirmation",
|
|
10
|
+
"pendingConfirmation",
|
|
11
|
+
"pending_confirmation",
|
|
12
|
+
];
|
|
9
13
|
const CONFIRMATION_ID_FIELD_NAMES = ["confirmation_id", "confirmationId", "id"];
|
|
10
|
-
const CONFIRMATION_ACTION_TEXT_FIELD_NAMES = [
|
|
14
|
+
const CONFIRMATION_ACTION_TEXT_FIELD_NAMES = [
|
|
15
|
+
"action",
|
|
16
|
+
"description",
|
|
17
|
+
"message",
|
|
18
|
+
"summary",
|
|
19
|
+
];
|
|
11
20
|
const CONFIRMATION_REQUIRED_MARKER = "confirmation_required";
|
|
12
21
|
function getTrimmedStringField(data, fieldNames) {
|
|
13
22
|
for (const fieldName of fieldNames) {
|
|
@@ -19,10 +28,10 @@ function getTrimmedStringField(data, fieldNames) {
|
|
|
19
28
|
return undefined;
|
|
20
29
|
}
|
|
21
30
|
function hasConfirmationRequiredMarker(data) {
|
|
22
|
-
return CONFIRMATION_REQUIRED_FIELD_NAMES.some((fieldName) => data[fieldName] === true)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
return (CONFIRMATION_REQUIRED_FIELD_NAMES.some((fieldName) => data[fieldName] === true) ||
|
|
32
|
+
data.type === CONFIRMATION_REQUIRED_MARKER ||
|
|
33
|
+
data.status === CONFIRMATION_REQUIRED_MARKER ||
|
|
34
|
+
data.kind === CONFIRMATION_REQUIRED_MARKER);
|
|
26
35
|
}
|
|
27
36
|
function getNestedConfirmationRecord(data) {
|
|
28
37
|
for (const fieldName of CONFIRMATION_REQUIRED_RECORD_FIELD_NAMES) {
|
|
@@ -33,18 +42,28 @@ function getNestedConfirmationRecord(data) {
|
|
|
33
42
|
}
|
|
34
43
|
return undefined;
|
|
35
44
|
}
|
|
45
|
+
function getConfirmationPayload(data) {
|
|
46
|
+
// Native confirm can acknowledge one action while its original compound command remains pending.
|
|
47
|
+
return isRecord(data) &&
|
|
48
|
+
data.confirmed === true &&
|
|
49
|
+
isRecord(data.result) &&
|
|
50
|
+
data.result.success === true
|
|
51
|
+
? data.result.data
|
|
52
|
+
: data;
|
|
53
|
+
}
|
|
36
54
|
export function detectConfirmationRequired(data) {
|
|
37
|
-
|
|
55
|
+
const payload = getConfirmationPayload(data);
|
|
56
|
+
if (!isRecord(payload)) {
|
|
38
57
|
return undefined;
|
|
39
58
|
}
|
|
40
|
-
const nestedRecord = getNestedConfirmationRecord(
|
|
41
|
-
const candidateRecords = nestedRecord ? [
|
|
59
|
+
const nestedRecord = getNestedConfirmationRecord(payload);
|
|
60
|
+
const candidateRecords = nestedRecord ? [payload, nestedRecord] : [payload];
|
|
42
61
|
if (!candidateRecords.some(hasConfirmationRequiredMarker)) {
|
|
43
62
|
return undefined;
|
|
44
63
|
}
|
|
45
64
|
for (const record of candidateRecords) {
|
|
46
65
|
const id = getTrimmedStringField(record, CONFIRMATION_ID_FIELD_NAMES);
|
|
47
|
-
if (
|
|
66
|
+
if (id === undefined || id.length === 0) {
|
|
48
67
|
continue;
|
|
49
68
|
}
|
|
50
69
|
return {
|