pi-agent-browser-native 0.9.3 → 0.9.5
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 +106 -5
- package/README.md +58 -791
- package/dist/extensions/agent-browser/index.js +43101 -2031
- 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 +112 -51
- 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 -82
- 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 +231 -0
- package/dist/extensions/agent-browser/lib/config.js +20 -8
- package/dist/extensions/agent-browser/lib/electron/cdp.js +20 -8
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +128 -83
- 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 +90 -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 +261 -355
- 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/fs-utils.js +1 -9
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +162 -121
- package/dist/extensions/agent-browser/lib/input-modes/job.js +123 -317
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +116 -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 +58 -412
- package/dist/extensions/agent-browser/lib/input-modes/params.js +86 -40
- 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 +43 -9
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +106 -59
- 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 +164 -60
- 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 +203 -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 +187 -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 +199 -154
- 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 -205
- 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 +147 -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 -1123
- 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 -968
- 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 +212 -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 +169 -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 -765
- 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 +93 -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 -821
- 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 +68 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +169 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +182 -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 +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +22 -10
- 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 -157
- package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +124 -58
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +197 -99
- 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 +55 -246
- package/dist/extensions/agent-browser/lib/parsing.js +13 -4
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +133 -68
- package/dist/extensions/agent-browser/lib/playbook.js +16 -12
- package/dist/extensions/agent-browser/lib/process-child.js +284 -0
- package/dist/extensions/agent-browser/lib/process-environment.js +13 -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 +145 -536
- 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 +131 -68
- 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 -13
- 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 +90 -67
- 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 -555
- 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 -1052
- 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 +116 -240
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +35 -21
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +109 -73
- package/dist/extensions/agent-browser/lib/results/presentation/source.js +109 -0
- package/dist/extensions/agent-browser/lib/results/presentation.js +17 -261
- 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 +119 -119
- 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 -1041
- 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 +178 -333
- package/dist/extensions/agent-browser/lib/session-page-types.js +1 -0
- package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +81 -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 +211 -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 +193 -0
- package/dist/extensions/agent-browser/lib/web-search-request.js +102 -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 +124 -614
- 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 +19 -6
- package/docs/CODE_QUALITY.md +267 -0
- package/docs/COMMAND_REFERENCE.md +272 -241
- package/docs/ELECTRON.md +77 -46
- package/docs/REFERENCE.md +869 -0
- package/docs/RELEASE.md +25 -22
- package/docs/REQUIREMENTS.md +2 -1
- package/docs/SUPPORT_MATRIX.md +81 -79
- package/docs/TOOL_CONTRACT.md +158 -125
- package/docs/platform-smoke.md +8 -8
- package/package.json +144 -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 +235 -132
- package/scripts/convert-browser-session.mjs +30 -9
- package/scripts/doctor-sources.mjs +195 -0
- package/scripts/doctor.mjs +94 -249
- 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 +132 -0
- package/scripts/platform-smoke/linux-image/Dockerfile +8 -2
- package/scripts/platform-smoke/suite-checks.mjs +98 -0
- package/scripts/platform-smoke/suite-evidence.mjs +281 -0
- package/scripts/platform-smoke/targets.mjs +154 -472
- package/scripts/platform-smoke.mjs +55 -40
- package/scripts/prepare.mjs +16 -7
|
@@ -1,60 +1,87 @@
|
|
|
1
|
-
import { JsonSchema } from "../json-schema.js";
|
|
2
|
-
import { StringEnum
|
|
3
|
-
import { ELECTRON_DISCOVERY_DEFAULT_MAX_RESULTS, ELECTRON_DISCOVERY_MAX_RESULTS } from "../electron/discovery.js";
|
|
1
|
+
import { JsonSchema as Type } from "../json-schema.js";
|
|
2
|
+
import { StringEnum } from "../string-enum-schema.js";
|
|
3
|
+
import { ELECTRON_DISCOVERY_DEFAULT_MAX_RESULTS, ELECTRON_DISCOVERY_MAX_RESULTS, } from "../electron/discovery-types.js";
|
|
4
4
|
import { AGENT_BROWSER_CODE_MAX_TIMEOUT_MS, AGENT_BROWSER_ELECTRON_HANDOFFS, AGENT_BROWSER_ELECTRON_TARGET_TYPES, AGENT_BROWSER_QA_LOAD_STATES, AGENT_BROWSER_SEMANTIC_ACTIONS, AGENT_BROWSER_SEMANTIC_LOCATORS, DEFAULT_SESSION_MODE, SOURCE_LOOKUP_MAX_WORKSPACE_FILES, } from "./types.js";
|
|
5
5
|
const AGENT_BROWSER_ADVANCED_TOOLS = ["action", "qa", "electron", "source", "network"];
|
|
6
|
-
function outputProperties(
|
|
6
|
+
function outputProperties() {
|
|
7
7
|
return {
|
|
8
|
-
outputPath: Type.Optional(Type.String({
|
|
8
|
+
outputPath: Type.Optional(Type.String({
|
|
9
|
+
description: "Result-data path, separate from browser artifact paths.",
|
|
10
|
+
minLength: 1,
|
|
11
|
+
})),
|
|
9
12
|
timeoutMs: Type.Optional(Type.Integer({ description: "Timeout in ms; exceed explicit waits.", minimum: 1 })),
|
|
10
13
|
};
|
|
11
14
|
}
|
|
12
|
-
function sessionModeProperty(
|
|
15
|
+
function sessionModeProperty() {
|
|
13
16
|
return Type.Optional(StringEnum(["auto", "fresh"], {
|
|
14
17
|
description: "Native configured sessions win; auto reuses the browser, fresh intentionally launches a separate managed browser.",
|
|
15
18
|
default: DEFAULT_SESSION_MODE,
|
|
16
19
|
}));
|
|
17
20
|
}
|
|
18
21
|
// Keep the always-on schemas small; specialized guidance belongs to each advanced tool.
|
|
19
|
-
export function createAgentBrowserParamsSchema(
|
|
22
|
+
export function createAgentBrowserParamsSchema() {
|
|
20
23
|
return Type.Unsafe(Type.Object({
|
|
21
|
-
args: Type.Array(Type.String(), {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
args: Type.Array(Type.String(), {
|
|
25
|
+
description: "Native agent-browser argv without the binary or shell syntax. Fixed sequences: batch --bail with JSON-array stdin.",
|
|
26
|
+
minItems: 1,
|
|
27
|
+
}),
|
|
28
|
+
stdin: Type.Optional(Type.String({
|
|
29
|
+
description: "Native batch JSON, eval --stdin source, or auth save --password-stdin text.",
|
|
30
|
+
})),
|
|
31
|
+
...outputProperties(),
|
|
32
|
+
sessionMode: sessionModeProperty(),
|
|
25
33
|
}, { additionalProperties: false }));
|
|
26
34
|
}
|
|
27
|
-
export function createAgentBrowserCodeParamsSchema(
|
|
35
|
+
export function createAgentBrowserCodeParamsSchema() {
|
|
28
36
|
return Type.Unsafe(Type.Object({
|
|
29
|
-
code: Type.String({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
code: Type.String({
|
|
38
|
+
description: "JavaScript with await browser({args, stdin?, timeoutMs?}), emit(JSON), and emitImage(image handle). Fresh JS context; persistent browser.",
|
|
39
|
+
minLength: 1,
|
|
40
|
+
maxLength: 65_536,
|
|
41
|
+
}),
|
|
42
|
+
session: Type.Optional(Type.String({
|
|
43
|
+
description: "Explicit native session; omitted uses the ordinary default browser.",
|
|
44
|
+
minLength: 1,
|
|
45
|
+
})),
|
|
46
|
+
namespace: Type.Optional(Type.String({
|
|
47
|
+
description: "Native namespace; empty string selects the default namespace.",
|
|
48
|
+
})),
|
|
49
|
+
...outputProperties(),
|
|
33
50
|
timeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: AGENT_BROWSER_CODE_MAX_TIMEOUT_MS })),
|
|
34
51
|
}, { additionalProperties: false }));
|
|
35
52
|
}
|
|
36
|
-
export function createAgentBrowserActionParamsSchema(
|
|
53
|
+
export function createAgentBrowserActionParamsSchema() {
|
|
37
54
|
return Type.Unsafe(Type.Object({
|
|
38
55
|
action: StringEnum(AGENT_BROWSER_SEMANTIC_ACTIONS),
|
|
39
|
-
locator: Type.Optional(StringEnum(AGENT_BROWSER_SEMANTIC_LOCATORS, {
|
|
40
|
-
|
|
41
|
-
|
|
56
|
+
locator: Type.Optional(StringEnum(AGENT_BROWSER_SEMANTIC_LOCATORS, {
|
|
57
|
+
description: "Select supports role or label.",
|
|
58
|
+
})),
|
|
59
|
+
value: Type.Optional(Type.String({
|
|
60
|
+
description: "Locator value or select option; label text for select by label.",
|
|
61
|
+
})),
|
|
62
|
+
values: Type.Optional(Type.Array(Type.String(), {
|
|
63
|
+
description: "Select options; required for select by label.",
|
|
64
|
+
minItems: 1,
|
|
65
|
+
})),
|
|
42
66
|
selector: Type.Optional(Type.String({ description: "Direct selector or current @ref." })),
|
|
43
67
|
text: Type.Optional(Type.String({ description: "Fill text." })),
|
|
44
68
|
role: Type.Optional(Type.String({ description: "Role locator; select needs combobox or listbox." })),
|
|
45
69
|
name: Type.Optional(Type.String({ description: "Accessible name." })),
|
|
46
70
|
session: Type.Optional(Type.String({ description: "Upstream session name." })),
|
|
47
|
-
...outputProperties(
|
|
71
|
+
...outputProperties(),
|
|
48
72
|
}, {
|
|
49
73
|
additionalProperties: false,
|
|
50
74
|
// Top-level properties let Pi normalize optional nulls before validating branches.
|
|
51
75
|
anyOf: [
|
|
52
|
-
Type.Object({
|
|
76
|
+
Type.Object({
|
|
77
|
+
action: StringEnum(["select"]),
|
|
78
|
+
locator: Type.Optional(StringEnum(["role", "label"])),
|
|
79
|
+
}, { not: { required: ["text"] } }),
|
|
53
80
|
Type.Object({ action: StringEnum(["check", "click", "fill"]) }, { not: { required: ["values"] } }),
|
|
54
81
|
],
|
|
55
82
|
}));
|
|
56
83
|
}
|
|
57
|
-
export function createAgentBrowserQaParamsSchema(
|
|
84
|
+
export function createAgentBrowserQaParamsSchema() {
|
|
58
85
|
return Type.Unsafe(Type.Object({
|
|
59
86
|
url: Type.Optional(Type.String()),
|
|
60
87
|
attached: Type.Optional(Type.Boolean()),
|
|
@@ -65,22 +92,28 @@ export function createAgentBrowserQaParamsSchema(Type = JsonSchema, StringEnum =
|
|
|
65
92
|
checkErrors: Type.Optional(Type.Boolean()),
|
|
66
93
|
checkNetwork: Type.Optional(Type.Boolean()),
|
|
67
94
|
loadState: Type.Optional(StringEnum(AGENT_BROWSER_QA_LOAD_STATES)),
|
|
68
|
-
...outputProperties(
|
|
69
|
-
sessionMode: sessionModeProperty(
|
|
95
|
+
...outputProperties(),
|
|
96
|
+
sessionMode: sessionModeProperty(),
|
|
70
97
|
}, {
|
|
71
98
|
additionalProperties: false,
|
|
72
99
|
anyOf: [
|
|
73
|
-
Type.Object({
|
|
100
|
+
Type.Object({
|
|
101
|
+
attached: Type.Literal(true),
|
|
102
|
+
sessionMode: Type.Optional(StringEnum(["auto"])),
|
|
103
|
+
}, { not: { required: ["url"] } }),
|
|
74
104
|
Type.Object({ url: Type.String(), attached: Type.Optional(Type.Literal(false)) }),
|
|
75
105
|
],
|
|
76
106
|
}));
|
|
77
107
|
}
|
|
78
|
-
export function createAgentBrowserElectronParamsSchema(
|
|
79
|
-
const common = { outputPath: outputProperties(
|
|
108
|
+
export function createAgentBrowserElectronParamsSchema() {
|
|
109
|
+
const common = { outputPath: outputProperties().outputPath };
|
|
80
110
|
const timeoutMs = Type.Optional(Type.Integer({ minimum: 1 }));
|
|
81
111
|
const list = {
|
|
82
112
|
query: Type.Optional(Type.String({ description: "Case-insensitive app filter.", minLength: 1 })),
|
|
83
|
-
maxResults: Type.Optional(Type.Integer({
|
|
113
|
+
maxResults: Type.Optional(Type.Integer({
|
|
114
|
+
description: `Result cap; default ${ELECTRON_DISCOVERY_DEFAULT_MAX_RESULTS}, clamped to ${ELECTRON_DISCOVERY_MAX_RESULTS}.`,
|
|
115
|
+
minimum: 1,
|
|
116
|
+
})),
|
|
84
117
|
};
|
|
85
118
|
const launch = {
|
|
86
119
|
appPath: Type.Optional(Type.String({ description: "macOS .app path.", minLength: 1 })),
|
|
@@ -100,7 +133,10 @@ export function createAgentBrowserElectronParamsSchema(Type = JsonSchema, String
|
|
|
100
133
|
// Each branch retains its original action-specific field boundary.
|
|
101
134
|
return Type.Unsafe(Type.Object({
|
|
102
135
|
action: StringEnum(["list", "launch", "status", "cleanup", "probe"]),
|
|
103
|
-
...list,
|
|
136
|
+
...list,
|
|
137
|
+
...launch,
|
|
138
|
+
...lifecycle,
|
|
139
|
+
...common,
|
|
104
140
|
}, {
|
|
105
141
|
additionalProperties: false,
|
|
106
142
|
anyOf: [
|
|
@@ -111,32 +147,42 @@ export function createAgentBrowserElectronParamsSchema(Type = JsonSchema, String
|
|
|
111
147
|
],
|
|
112
148
|
}));
|
|
113
149
|
}
|
|
114
|
-
export function createAgentBrowserSourceParamsSchema(
|
|
150
|
+
export function createAgentBrowserSourceParamsSchema() {
|
|
115
151
|
return Type.Unsafe(Type.Object({
|
|
116
152
|
selector: Type.Optional(Type.String({ description: "Visible selector or @ref." })),
|
|
117
153
|
reactFiberId: Type.Optional(Type.String({ description: "React fiber id; requires --enable react-devtools." })),
|
|
118
154
|
componentName: Type.Optional(Type.String({ description: "Component for local source search." })),
|
|
119
155
|
includeDomHints: Type.Optional(Type.Boolean({ description: "Inspect DOM hints; default true." })),
|
|
120
|
-
maxWorkspaceFiles: Type.Optional(Type.Integer({
|
|
121
|
-
|
|
122
|
-
|
|
156
|
+
maxWorkspaceFiles: Type.Optional(Type.Integer({
|
|
157
|
+
description: "Source scan cap; default 2000.",
|
|
158
|
+
minimum: 1,
|
|
159
|
+
maximum: SOURCE_LOOKUP_MAX_WORKSPACE_FILES,
|
|
160
|
+
})),
|
|
161
|
+
...outputProperties(),
|
|
162
|
+
sessionMode: sessionModeProperty(),
|
|
123
163
|
}, { additionalProperties: false }));
|
|
124
164
|
}
|
|
125
|
-
export function createAgentBrowserNetworkSourceParamsSchema(
|
|
165
|
+
export function createAgentBrowserNetworkSourceParamsSchema() {
|
|
126
166
|
return Type.Unsafe(Type.Object({
|
|
127
167
|
filter: Type.Optional(Type.String({ description: "Network request filter." })),
|
|
128
168
|
namespace: Type.Optional(Type.String()),
|
|
129
169
|
requestId: Type.Optional(Type.String({ description: "Request id to inspect." })),
|
|
130
170
|
session: Type.Optional(Type.String()),
|
|
131
171
|
url: Type.Optional(Type.String({ description: "Failed URL or fragment." })),
|
|
132
|
-
maxWorkspaceFiles: Type.Optional(Type.Integer({
|
|
133
|
-
|
|
134
|
-
|
|
172
|
+
maxWorkspaceFiles: Type.Optional(Type.Integer({
|
|
173
|
+
description: "Source scan cap; default 2000.",
|
|
174
|
+
minimum: 1,
|
|
175
|
+
maximum: SOURCE_LOOKUP_MAX_WORKSPACE_FILES,
|
|
176
|
+
})),
|
|
177
|
+
...outputProperties(),
|
|
178
|
+
sessionMode: sessionModeProperty(),
|
|
135
179
|
}, { additionalProperties: false }));
|
|
136
180
|
}
|
|
137
|
-
export function createAgentBrowserToolsParamsSchema(
|
|
181
|
+
export function createAgentBrowserToolsParamsSchema() {
|
|
138
182
|
return Type.Unsafe(Type.Object({
|
|
139
|
-
enable: Type.Optional(Type.Array(StringEnum(AGENT_BROWSER_ADVANCED_TOOLS), {
|
|
183
|
+
enable: Type.Optional(Type.Array(StringEnum(AGENT_BROWSER_ADVANCED_TOOLS), {
|
|
184
|
+
description: "Add capabilities to active tools; omit to list inventory.",
|
|
185
|
+
})),
|
|
140
186
|
}, { additionalProperties: false }));
|
|
141
187
|
}
|
|
142
188
|
export const AGENT_BROWSER_PARAMS = createAgentBrowserParamsSchema();
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { isRecord } from "../parsing.js";
|
|
2
|
+
import { summarizeNetworkFailures } from "../results/network.js";
|
|
3
|
+
import { stringifyUnknown } from "../results/text.js";
|
|
4
|
+
import { getBatchResultItems, getCommandNameFromBatchItem, isStringArray } from "./shared.js";
|
|
5
|
+
function expectedTextPreview(text) {
|
|
6
|
+
return JSON.stringify(text.length > 80 ? `${text.slice(0, 77)}...` : text);
|
|
7
|
+
}
|
|
8
|
+
function visibleTextWaitPassed(item, step) {
|
|
9
|
+
if (step.args[0] !== "wait" || step.args[1] !== "--fn") {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
if (item.success === false) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (typeof item.result === "boolean") {
|
|
16
|
+
return item.result;
|
|
17
|
+
}
|
|
18
|
+
if (isRecord(item.result) && typeof item.result.result === "boolean") {
|
|
19
|
+
return item.result.result;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
function textAssertionResult(item) {
|
|
24
|
+
if (item.success === false) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const result = item.result;
|
|
28
|
+
if (typeof result === "string") {
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
if (!isRecord(result)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
for (const key of ["result", "text", "value"]) {
|
|
35
|
+
if (typeof result[key] === "string") {
|
|
36
|
+
return result[key];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
function subtractBaselineErrors(errors, baseline) {
|
|
42
|
+
const counts = new Map();
|
|
43
|
+
for (const error of baseline) {
|
|
44
|
+
const signature = stringifyUnknown(error);
|
|
45
|
+
counts.set(signature, (counts.get(signature) ?? 0) + 1);
|
|
46
|
+
}
|
|
47
|
+
let matchedCount = 0;
|
|
48
|
+
const novelErrors = errors.filter((error) => {
|
|
49
|
+
const signature = stringifyUnknown(error);
|
|
50
|
+
const count = counts.get(signature) ?? 0;
|
|
51
|
+
if (count === 0) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
counts.set(signature, count - 1);
|
|
55
|
+
matchedCount++;
|
|
56
|
+
return false;
|
|
57
|
+
});
|
|
58
|
+
return { matchedCount, novelErrors };
|
|
59
|
+
}
|
|
60
|
+
function isResetCommand(item) {
|
|
61
|
+
const command = item.command;
|
|
62
|
+
if (!isStringArray(command)) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const [name, subcommand] = command;
|
|
66
|
+
return (command.includes("--clear") &&
|
|
67
|
+
(name === "console" || name === "errors" || (name === "network" && subcommand === "requests")));
|
|
68
|
+
}
|
|
69
|
+
function describeDiagnosticCheck(step) {
|
|
70
|
+
if (step.args.includes("--clear")) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
switch (step.args[0]) {
|
|
74
|
+
case "network":
|
|
75
|
+
return "network diagnostics";
|
|
76
|
+
case "console":
|
|
77
|
+
return "console diagnostics";
|
|
78
|
+
case "errors":
|
|
79
|
+
return step.generatedFrom === "qa.errorBaselineAfterClear"
|
|
80
|
+
? undefined
|
|
81
|
+
: "page error diagnostics";
|
|
82
|
+
default:
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function describePlannedCheck(step, checks) {
|
|
87
|
+
if (step.args[0] === "wait" && step.args[1] === "--load") {
|
|
88
|
+
return `load state: ${step.args[2]}`;
|
|
89
|
+
}
|
|
90
|
+
const selector = checks.expectedSelector;
|
|
91
|
+
if (selector !== undefined &&
|
|
92
|
+
selector.length > 0 &&
|
|
93
|
+
step.args[0] === "wait" &&
|
|
94
|
+
step.args[1] === selector) {
|
|
95
|
+
return `expected selector: ${expectedTextPreview(selector)}`;
|
|
96
|
+
}
|
|
97
|
+
if (step.action === "screenshot") {
|
|
98
|
+
return `screenshot: ${expectedTextPreview(step.args[1] ?? "")}`;
|
|
99
|
+
}
|
|
100
|
+
return describeDiagnosticCheck(step);
|
|
101
|
+
}
|
|
102
|
+
function describeNotRunChecks(compiled, count) {
|
|
103
|
+
let textIndex = 0;
|
|
104
|
+
const descriptions = compiled.steps.map((step) => {
|
|
105
|
+
if (step.action !== "assertText") {
|
|
106
|
+
return describePlannedCheck(step, compiled.checks);
|
|
107
|
+
}
|
|
108
|
+
const text = compiled.checks.expectedText.at(textIndex++);
|
|
109
|
+
return text === undefined || text.length === 0
|
|
110
|
+
? undefined
|
|
111
|
+
: `expected text: ${expectedTextPreview(text)}`;
|
|
112
|
+
});
|
|
113
|
+
return descriptions
|
|
114
|
+
.slice(count)
|
|
115
|
+
.filter((description) => description !== undefined && description.length > 0);
|
|
116
|
+
}
|
|
117
|
+
function baselineIndex(compiled) {
|
|
118
|
+
if (compiled?.checks.diagnosticsResetAtStart !== true || !compiled.checks.checkErrors) {
|
|
119
|
+
return -1;
|
|
120
|
+
}
|
|
121
|
+
return compiled.steps.findIndex((step) => step.generatedFrom === "qa.errorBaselineAfterClear");
|
|
122
|
+
}
|
|
123
|
+
/** Owns one QA verdict; native diagnostic rows remain observations, not mutable state. */
|
|
124
|
+
class QaVerdict {
|
|
125
|
+
failures = [];
|
|
126
|
+
warnings = [];
|
|
127
|
+
observeDiagnostic(item, baseline) {
|
|
128
|
+
const result = item.result;
|
|
129
|
+
if (!isRecord(result)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
switch (getCommandNameFromBatchItem(item)) {
|
|
133
|
+
case "errors":
|
|
134
|
+
this.observeErrors(result.errors, baseline);
|
|
135
|
+
break;
|
|
136
|
+
case "console":
|
|
137
|
+
this.observeConsole(result.messages);
|
|
138
|
+
break;
|
|
139
|
+
case "network":
|
|
140
|
+
this.observeNetwork(result.requests);
|
|
141
|
+
break;
|
|
142
|
+
case undefined:
|
|
143
|
+
break;
|
|
144
|
+
default:
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
observeErrors(value, baseline) {
|
|
149
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const { matchedCount, novelErrors } = subtractBaselineErrors(value, baseline);
|
|
153
|
+
if (novelErrors.length > 0) {
|
|
154
|
+
this.failures.push(`${novelErrors.length} page error(s)`);
|
|
155
|
+
}
|
|
156
|
+
if (matchedCount > 0) {
|
|
157
|
+
this.failures.push(`page-error check could not be verified (${matchedCount} row(s) matched the post-clear baseline; old residue and identical new errors are indistinguishable)`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
observeConsole(value) {
|
|
161
|
+
if (!Array.isArray(value)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const errors = value.filter((message) => isRecord(message) && /error/i.test(stringifyUnknown(message.type ?? message.level ?? ""))).length;
|
|
165
|
+
if (errors > 0) {
|
|
166
|
+
this.failures.push(`${errors} console error message(s)`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
observeNetwork(value) {
|
|
170
|
+
if (!Array.isArray(value)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const network = summarizeNetworkFailures(value);
|
|
174
|
+
if (network.actionableCount > 0) {
|
|
175
|
+
this.failures.push(`${network.actionableCount} actionable failed network request(s)`);
|
|
176
|
+
}
|
|
177
|
+
if (network.benignCount > 0) {
|
|
178
|
+
this.warnings.push(`${network.benignCount} benign network request failure(s) ignored`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
observeBatch(items, compiled) {
|
|
182
|
+
const baselineErrorIndex = baselineIndex(compiled);
|
|
183
|
+
const baselineResult = baselineErrorIndex >= 0 ? items.at(baselineErrorIndex)?.result : undefined;
|
|
184
|
+
const baseline = isRecord(baselineResult) && Array.isArray(baselineResult.errors) ? baselineResult.errors : [];
|
|
185
|
+
items.forEach((item, index) => {
|
|
186
|
+
if (item.success === false) {
|
|
187
|
+
this.failures.push(`${getCommandNameFromBatchItem(item) ?? "step"} failed`);
|
|
188
|
+
}
|
|
189
|
+
if (index === baselineErrorIndex ||
|
|
190
|
+
(compiled?.checks.diagnosticsResetAtStart === true && isResetCommand(item))) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this.observeDiagnostic(item, baseline);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
observeExpectedText(items, compiled) {
|
|
197
|
+
let textIndex = 0;
|
|
198
|
+
compiled.steps.forEach((step, index) => {
|
|
199
|
+
if (step.action !== "assertText") {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const expected = compiled.checks.expectedText.at(textIndex++);
|
|
203
|
+
const item = items.at(index);
|
|
204
|
+
if (expected === undefined || expected.length === 0 || item === undefined) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (visibleTextWaitPassed(item, step) === true) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const actual = textAssertionResult(item);
|
|
211
|
+
if (actual === undefined || !actual.includes(expected)) {
|
|
212
|
+
this.failures.push(`expected text not found: ${expectedTextPreview(expected)}`);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
finish(items, compiled) {
|
|
217
|
+
const stoppedEarly = compiled !== undefined && items.length < compiled.steps.length;
|
|
218
|
+
const failedFast = stoppedEarly && items.at(-1)?.success === false;
|
|
219
|
+
if (stoppedEarly && !failedFast) {
|
|
220
|
+
this.failures.push("QA execution could not be verified (incomplete batch results)");
|
|
221
|
+
}
|
|
222
|
+
const failedChecks = [...new Set(this.failures)];
|
|
223
|
+
const warnings = [...new Set(this.warnings)];
|
|
224
|
+
const notRunChecks = compiled !== undefined && failedFast ? describeNotRunChecks(compiled, items.length) : [];
|
|
225
|
+
return {
|
|
226
|
+
failedChecks,
|
|
227
|
+
warnings,
|
|
228
|
+
notRunChecks,
|
|
229
|
+
passed: failedChecks.length === 0,
|
|
230
|
+
summary: verdictSummary(failedChecks, warnings),
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function verdictSummary(failures, warnings) {
|
|
235
|
+
if (failures.length > 0) {
|
|
236
|
+
return `QA preset failed: ${failures.join("; ")}.`;
|
|
237
|
+
}
|
|
238
|
+
return warnings.length === 0
|
|
239
|
+
? "QA preset passed."
|
|
240
|
+
: `QA preset passed with warnings: ${warnings.join("; ")}.`;
|
|
241
|
+
}
|
|
242
|
+
export function analyzeQaPresetResults(data, compiled) {
|
|
243
|
+
const items = getBatchResultItems(data);
|
|
244
|
+
if (items.length === 0) {
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
const verdict = new QaVerdict();
|
|
248
|
+
verdict.observeBatch(items, compiled);
|
|
249
|
+
if (compiled !== undefined && compiled.checks.expectedText.length > 0) {
|
|
250
|
+
verdict.observeExpectedText(items, compiled);
|
|
251
|
+
}
|
|
252
|
+
return verdict.finish(items, compiled);
|
|
253
|
+
}
|
|
254
|
+
export function analyzeQaPresetTimeout(compiled) {
|
|
255
|
+
if (compiled.checks.expectedText.length === 0) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
const failedChecks = compiled.checks.expectedText.map((text) => `expected text was not verified before timeout: ${expectedTextPreview(text)}`);
|
|
259
|
+
return {
|
|
260
|
+
failedChecks,
|
|
261
|
+
notRunChecks: [],
|
|
262
|
+
passed: false,
|
|
263
|
+
summary: `QA preset failed: ${failedChecks.join("; ")}.`,
|
|
264
|
+
warnings: [
|
|
265
|
+
"The wrapper timed out before expected-text evidence could be verified; inspect timeoutPartialProgress and retry with a narrower readiness condition if the page was still loading.",
|
|
266
|
+
],
|
|
267
|
+
};
|
|
268
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { isRecord } from "../parsing.js";
|
|
2
|
+
import { truncateText } from "../results/text.js";
|
|
3
|
+
import { getBatchResultItems, getCommandNameFromBatchItem } from "./shared.js";
|
|
4
|
+
function hasPageContext(page) {
|
|
5
|
+
return (page?.title?.length ?? 0) > 0 || (page?.url?.length ?? 0) > 0;
|
|
6
|
+
}
|
|
7
|
+
function pageLine(page) {
|
|
8
|
+
const parts = [page?.title, page?.url].filter((part) => typeof part === "string" && part.length > 0);
|
|
9
|
+
return parts.length === 0 ? [] : [`Page: ${parts.join(" — ")}`];
|
|
10
|
+
}
|
|
11
|
+
function describeChecks(checks) {
|
|
12
|
+
const parts = [`load:${checks.loadState}`];
|
|
13
|
+
if (checks.expectedText.length > 0) {
|
|
14
|
+
parts.push(`text×${checks.expectedText.length}`);
|
|
15
|
+
}
|
|
16
|
+
const enabledChecks = [
|
|
17
|
+
["selector", (checks.expectedSelector ?? "").length > 0],
|
|
18
|
+
["network", checks.checkNetwork],
|
|
19
|
+
["console", checks.checkConsole],
|
|
20
|
+
["errors", checks.checkErrors],
|
|
21
|
+
];
|
|
22
|
+
for (const [name, enabled] of enabledChecks) {
|
|
23
|
+
if (enabled) {
|
|
24
|
+
parts.push(name);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (checks.diagnosticsResetAtStart) {
|
|
28
|
+
parts.push("diagnostics-reset");
|
|
29
|
+
}
|
|
30
|
+
else if (hasDiagnostics(checks)) {
|
|
31
|
+
parts.push("attached-diagnostics-preserved");
|
|
32
|
+
}
|
|
33
|
+
if ((checks.screenshotPath ?? "").length > 0) {
|
|
34
|
+
parts.push("screenshot");
|
|
35
|
+
}
|
|
36
|
+
return parts.join(", ");
|
|
37
|
+
}
|
|
38
|
+
function hasDiagnostics(checks) {
|
|
39
|
+
return checks.checkNetwork || checks.checkConsole || checks.checkErrors;
|
|
40
|
+
}
|
|
41
|
+
function isolationLines(checks) {
|
|
42
|
+
if (!hasDiagnostics(checks)) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
if (checks.diagnosticsResetAtStart) {
|
|
46
|
+
return [
|
|
47
|
+
"Diagnostic isolation: URL QA requests clears of enabled diagnostic buffers before opening the target.",
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
if (checks.attached) {
|
|
51
|
+
return [
|
|
52
|
+
"Attached diagnostics: existing upstream session console/network/error buffers were preserved; rows may include events from before qa.attached started.",
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
export function extractQaPageContext(options) {
|
|
58
|
+
if (hasPageContext(options.attachedTarget)) {
|
|
59
|
+
return { title: options.attachedTarget?.title, url: options.attachedTarget?.url };
|
|
60
|
+
}
|
|
61
|
+
const page = extractBatchPageContext(options.batchData);
|
|
62
|
+
if (page !== undefined) {
|
|
63
|
+
return page;
|
|
64
|
+
}
|
|
65
|
+
const url = options.compiled?.checks.url;
|
|
66
|
+
return url === undefined || url.length === 0 ? {} : { url };
|
|
67
|
+
}
|
|
68
|
+
function extractBatchPageContext(data) {
|
|
69
|
+
for (const item of getBatchResultItems(data)) {
|
|
70
|
+
if (getCommandNameFromBatchItem(item) !== "open" || !isRecord(item.result)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const page = {
|
|
74
|
+
url: typeof item.result.url === "string" ? item.result.url : undefined,
|
|
75
|
+
title: typeof item.result.title === "string" ? item.result.title : undefined,
|
|
76
|
+
};
|
|
77
|
+
if (hasPageContext(page)) {
|
|
78
|
+
return page;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
export function buildQaCompactPassText(options) {
|
|
84
|
+
const lines = [options.qaPreset.summary, ...pageLine(options.page)];
|
|
85
|
+
lines.push(`Checks run: ${describeChecks(options.checks)} (${options.batchStepCount} batch step${options.batchStepCount === 1 ? "" : "s"})`);
|
|
86
|
+
lines.push(...isolationLines(options.checks));
|
|
87
|
+
const path = options.checks.screenshotPath;
|
|
88
|
+
if (path !== undefined && path.length > 0) {
|
|
89
|
+
const verification = options.artifactVerification;
|
|
90
|
+
lines.push(verification
|
|
91
|
+
? `Screenshot: ${path} (${verification.verifiedCount}/${verification.artifacts.length} verified on disk)`
|
|
92
|
+
: `Screenshot: ${path}`);
|
|
93
|
+
}
|
|
94
|
+
lines.push("Full diagnostic matrix: see details.qaPreset and details.batchSteps.");
|
|
95
|
+
return lines.join("\n");
|
|
96
|
+
}
|
|
97
|
+
export function buildQaCompactFailureText(options) {
|
|
98
|
+
const error = options.causalError;
|
|
99
|
+
const lines = [
|
|
100
|
+
error !== undefined && error.length > 0
|
|
101
|
+
? truncateText(error.replace(/\s+/g, " ").trim(), 700)
|
|
102
|
+
: options.qaPreset.summary,
|
|
103
|
+
...pageLine(options.page),
|
|
104
|
+
];
|
|
105
|
+
for (const [label, entries] of [
|
|
106
|
+
["Failed checks:", options.qaPreset.failedChecks],
|
|
107
|
+
["Not run:", options.qaPreset.notRunChecks],
|
|
108
|
+
["Warnings:", options.qaPreset.warnings],
|
|
109
|
+
]) {
|
|
110
|
+
if (entries.length > 0) {
|
|
111
|
+
lines.push(label, ...entries.map((entry) => `- ${entry}`));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
lines.push(`Execution: ${options.executedStepCount ?? "unknown"}/${options.plannedStepCount} batch steps`);
|
|
115
|
+
lines.push("Full diagnostic matrix: see details.qaPreset and details.batchSteps.");
|
|
116
|
+
return lines.join("\n");
|
|
117
|
+
}
|