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,7 +1,7 @@
|
|
|
1
|
-
import { isNavigationObservableCommandName, isOpenNavigationCommand, isPageChangeSummaryCommand } from "../../command-taxonomy.js";
|
|
1
|
+
import { isNavigationObservableCommandName, isOpenNavigationCommand, isPageChangeSummaryCommand, } from "../../command-taxonomy.js";
|
|
2
2
|
import { isRecord } from "../../parsing.js";
|
|
3
3
|
import { detectConfirmationRequired } from "../confirmation.js";
|
|
4
|
-
import { firstLine, omitUpstreamLifecycle, redactModelFacingText, stringifyModelFacing } from "./common.js";
|
|
4
|
+
import { firstLine, omitUpstreamLifecycle, redactModelFacingText, stringifyModelFacing, } from "./common.js";
|
|
5
5
|
const NAVIGATION_SUMMARY_FIELD = "navigationSummary";
|
|
6
6
|
const GET_RESULT_FIELDS = {
|
|
7
7
|
attr: "value",
|
|
@@ -12,77 +12,87 @@ const GET_RESULT_FIELDS = {
|
|
|
12
12
|
url: "url",
|
|
13
13
|
value: "value",
|
|
14
14
|
};
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
function getExtractionResultField(command, data) {
|
|
16
|
+
if (Object.hasOwn(data, "result")) {
|
|
17
|
+
return "result";
|
|
18
|
+
}
|
|
19
|
+
const field = command.command === "get" && command.subcommand !== undefined
|
|
20
|
+
? GET_RESULT_FIELDS[command.subcommand]
|
|
21
|
+
: undefined;
|
|
22
|
+
return field !== undefined && field.length > 0 && Object.hasOwn(data, field) ? field : undefined;
|
|
23
|
+
}
|
|
24
|
+
function getScalarExtractionResult(command, data) {
|
|
25
|
+
const field = getExtractionResultField(command, data);
|
|
26
|
+
if (field === undefined) {
|
|
19
27
|
return undefined;
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
}
|
|
29
|
+
const result = data[field];
|
|
30
|
+
if (typeof result === "string") {
|
|
22
31
|
return result.trim().length > 0 ? result : "(empty string)";
|
|
23
|
-
|
|
32
|
+
}
|
|
33
|
+
if (typeof result === "number" || typeof result === "boolean") {
|
|
24
34
|
return String(result);
|
|
25
|
-
|
|
35
|
+
}
|
|
36
|
+
if (result === null || result === undefined) {
|
|
26
37
|
return "null";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return typeof result === "object" ? JSON.stringify(result, null, 2) : undefined;
|
|
30
40
|
}
|
|
31
41
|
function getExtractionOrigin(data) {
|
|
32
42
|
if (typeof data.origin === "string" && data.origin.trim().length > 0) {
|
|
33
43
|
return data.origin.trim();
|
|
34
44
|
}
|
|
35
|
-
|
|
36
|
-
return data.url.trim();
|
|
37
|
-
}
|
|
38
|
-
return undefined;
|
|
45
|
+
return typeof data.url === "string" && data.url.trim().length > 0 ? data.url.trim() : undefined;
|
|
39
46
|
}
|
|
40
47
|
function formatGetSummaryLabel(subcommand) {
|
|
41
|
-
if (
|
|
48
|
+
if (subcommand === undefined || subcommand.length === 0) {
|
|
42
49
|
return "Get result";
|
|
43
50
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return `${subcommand.slice(0, 1).toUpperCase()}${subcommand.slice(1)}`;
|
|
51
|
+
return subcommand.toLowerCase() === "url"
|
|
52
|
+
? "URL"
|
|
53
|
+
: `${subcommand.slice(0, 1).toUpperCase()}${subcommand.slice(1)}`;
|
|
48
54
|
}
|
|
49
|
-
export function formatExtractionSummary(
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
55
|
+
export function formatExtractionSummary(command, data) {
|
|
56
|
+
const result = getScalarExtractionResult(command, data);
|
|
57
|
+
if (result === undefined || result.length === 0) {
|
|
52
58
|
return undefined;
|
|
53
59
|
}
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return `${formatGetSummaryLabel(commandInfo.subcommand)}: ${firstResultLine}`;
|
|
60
|
+
const line = firstLine(redactModelFacingText(result));
|
|
61
|
+
if (command.command === "get") {
|
|
62
|
+
return `${formatGetSummaryLabel(command.subcommand)}: ${line}`;
|
|
58
63
|
}
|
|
59
|
-
|
|
60
|
-
return `Eval result: ${firstResultLine}`;
|
|
61
|
-
}
|
|
62
|
-
return undefined;
|
|
64
|
+
return command.command === "eval" ? `Eval result: ${line}` : undefined;
|
|
63
65
|
}
|
|
64
|
-
export function formatExtractionText(
|
|
65
|
-
if (
|
|
66
|
+
export function formatExtractionText(command, data) {
|
|
67
|
+
if (command.command !== "get" && command.command !== "eval") {
|
|
66
68
|
return undefined;
|
|
67
69
|
}
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
+
const result = getScalarExtractionResult(command, data);
|
|
71
|
+
if (result === undefined || result.length === 0) {
|
|
70
72
|
return undefined;
|
|
71
73
|
}
|
|
72
74
|
const origin = getExtractionOrigin(data);
|
|
73
|
-
const
|
|
74
|
-
const safeOrigin = origin ? redactModelFacingText(origin) : undefined;
|
|
75
|
-
return safeOrigin && safeOrigin
|
|
75
|
+
const safeResult = redactModelFacingText(result);
|
|
76
|
+
const safeOrigin = origin !== undefined ? redactModelFacingText(origin) : undefined;
|
|
77
|
+
return safeOrigin !== undefined && safeOrigin.length > 0 && safeOrigin !== safeResult
|
|
78
|
+
? `${safeResult}\n\nOrigin: ${safeOrigin}`
|
|
79
|
+
: safeResult;
|
|
76
80
|
}
|
|
77
81
|
export function isNavigationObservableCommand(command, subcommand) {
|
|
78
82
|
return isNavigationObservableCommandName(command, subcommand);
|
|
79
83
|
}
|
|
80
84
|
function isNavigationSummary(value) {
|
|
81
|
-
|
|
85
|
+
if (!isRecord(value)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
return ((typeof value.title === "string" || typeof value.url === "string") &&
|
|
89
|
+
(value.title === undefined || typeof value.title === "string") &&
|
|
90
|
+
(value.url === undefined || typeof value.url === "string") &&
|
|
91
|
+
(value.urlChanged === undefined || typeof value.urlChanged === "boolean"));
|
|
82
92
|
}
|
|
83
93
|
export function getNavigationSummary(data) {
|
|
84
|
-
const
|
|
85
|
-
return isNavigationSummary(
|
|
94
|
+
const value = data[NAVIGATION_SUMMARY_FIELD];
|
|
95
|
+
return isNavigationSummary(value) ? value : undefined;
|
|
86
96
|
}
|
|
87
97
|
function getTopLevelNavigationSummary(data) {
|
|
88
98
|
return isNavigationSummary(data)
|
|
@@ -92,57 +102,109 @@ function getTopLevelNavigationSummary(data) {
|
|
|
92
102
|
}
|
|
93
103
|
: undefined;
|
|
94
104
|
}
|
|
105
|
+
function getNavigationText(value) {
|
|
106
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
|
107
|
+
}
|
|
95
108
|
function getNormalizedNavigationSummary(summary) {
|
|
96
|
-
const title =
|
|
97
|
-
const url =
|
|
98
|
-
return title
|
|
109
|
+
const title = getNavigationText(summary?.title);
|
|
110
|
+
const url = getNavigationText(summary?.url);
|
|
111
|
+
return title !== undefined || url !== undefined
|
|
112
|
+
? {
|
|
113
|
+
title,
|
|
114
|
+
url,
|
|
115
|
+
...(typeof summary?.urlChanged === "boolean" ? { urlChanged: summary.urlChanged } : {}),
|
|
116
|
+
}
|
|
117
|
+
: undefined;
|
|
99
118
|
}
|
|
100
119
|
export function formatNavigationSummary(summary) {
|
|
101
120
|
const normalized = getNormalizedNavigationSummary(summary);
|
|
102
|
-
if (!normalized)
|
|
121
|
+
if (!normalized) {
|
|
103
122
|
return undefined;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
123
|
+
}
|
|
124
|
+
return normalized.title !== undefined && normalized.url !== undefined
|
|
125
|
+
? `${normalized.title}\n${normalized.url}`
|
|
126
|
+
: (normalized.title ?? normalized.url);
|
|
107
127
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
128
|
+
function getPageNavigation(command, data) {
|
|
129
|
+
if (!isRecord(data)) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const summary = getNavigationSummary(data) ??
|
|
133
|
+
(isPageChangeSummaryCommand(command.command, command.subcommand)
|
|
134
|
+
? getTopLevelNavigationSummary(data)
|
|
135
|
+
: undefined);
|
|
136
|
+
return getNormalizedNavigationSummary(summary);
|
|
137
|
+
}
|
|
138
|
+
function isNavigationObserved(command, navigation) {
|
|
139
|
+
return (navigation !== undefined &&
|
|
140
|
+
(navigation.urlChanged === true ||
|
|
141
|
+
isOpenNavigationCommand(command.command) ||
|
|
142
|
+
["back", "forward", "pushstate", "reload"].includes(command.command ?? "")));
|
|
143
|
+
}
|
|
144
|
+
function getPageChangeKind(options, evidence) {
|
|
145
|
+
if (evidence.savedFilePath !== undefined || evidence.artifactCount > 0) {
|
|
146
|
+
return "artifact";
|
|
147
|
+
}
|
|
148
|
+
const navigation = evidence.navigation;
|
|
149
|
+
if (isNavigationObserved(options.commandInfo, navigation)) {
|
|
150
|
+
return "navigation";
|
|
151
|
+
}
|
|
152
|
+
if (detectConfirmationRequired(options.data) !== undefined) {
|
|
153
|
+
return "confirmation";
|
|
154
|
+
}
|
|
155
|
+
return navigation ||
|
|
156
|
+
isPageChangeSummaryCommand(options.commandInfo.command, options.commandInfo.subcommand)
|
|
157
|
+
? "mutation"
|
|
113
158
|
: undefined;
|
|
114
|
-
|
|
115
|
-
|
|
159
|
+
}
|
|
160
|
+
function getPageChangeTargetParts(evidence) {
|
|
161
|
+
const parts = [evidence.navigation?.title, evidence.navigation?.url].filter((value) => value !== undefined);
|
|
162
|
+
if (evidence.savedFilePath !== undefined) {
|
|
163
|
+
parts.push(evidence.savedFilePath);
|
|
164
|
+
}
|
|
165
|
+
else if (evidence.artifactCount > 0) {
|
|
166
|
+
parts.push(`${evidence.artifactCount} artifact${evidence.artifactCount === 1 ? "" : "s"}`);
|
|
167
|
+
}
|
|
168
|
+
return parts;
|
|
169
|
+
}
|
|
170
|
+
function formatPageChangeText(command, evidence, kind) {
|
|
171
|
+
const observed = kind !== "mutation";
|
|
172
|
+
const parts = [
|
|
173
|
+
command.command ?? "agent-browser",
|
|
174
|
+
observed ? kind : "action dispatched",
|
|
175
|
+
...getPageChangeTargetParts(evidence),
|
|
176
|
+
];
|
|
177
|
+
return `${parts.join(" → ")}${observed ? "" : " → application change unverified"}`;
|
|
178
|
+
}
|
|
179
|
+
function getPageChangeIdentityFields(options, evidence) {
|
|
180
|
+
return {
|
|
181
|
+
...(options.commandInfo.command !== undefined && options.commandInfo.command.length > 0
|
|
182
|
+
? { command: options.commandInfo.command }
|
|
183
|
+
: {}),
|
|
184
|
+
...(options.nextActions
|
|
185
|
+
? { nextActionIds: options.nextActions.map((action) => action.id) }
|
|
186
|
+
: {}),
|
|
187
|
+
...(evidence.savedFilePath !== undefined ? { savedFilePath: evidence.savedFilePath } : {}),
|
|
188
|
+
...(evidence.navigation?.title !== undefined ? { title: evidence.navigation.title } : {}),
|
|
189
|
+
...(evidence.navigation?.url !== undefined ? { url: evidence.navigation.url } : {}),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
export function buildPageChangeSummary(options) {
|
|
193
|
+
const evidence = {
|
|
194
|
+
artifactCount: options.artifacts?.length ?? 0,
|
|
195
|
+
navigation: getPageNavigation(options.commandInfo, options.data),
|
|
196
|
+
savedFilePath: options.savedFilePath === "" ? undefined : options.savedFilePath,
|
|
197
|
+
};
|
|
198
|
+
const changeType = getPageChangeKind(options, evidence);
|
|
199
|
+
if (changeType === undefined) {
|
|
116
200
|
return undefined;
|
|
117
201
|
}
|
|
118
|
-
const navigationObserved = navigation && (navigation.urlChanged === true || isOpenNavigationCommand(commandInfo.command) || ["back", "forward", "pushstate", "reload"].includes(commandInfo.command ?? ""));
|
|
119
|
-
const changeType = savedFilePath || artifactCount > 0
|
|
120
|
-
? "artifact"
|
|
121
|
-
: navigationObserved
|
|
122
|
-
? "navigation"
|
|
123
|
-
: confirmationRequired
|
|
124
|
-
? "confirmation"
|
|
125
|
-
: "mutation";
|
|
126
|
-
const observed = changeType !== "mutation";
|
|
127
|
-
const parts = [commandInfo.command ?? "agent-browser", observed ? changeType : "action dispatched"];
|
|
128
|
-
if (navigation?.title)
|
|
129
|
-
parts.push(navigation.title);
|
|
130
|
-
if (navigation?.url)
|
|
131
|
-
parts.push(navigation.url);
|
|
132
|
-
if (savedFilePath)
|
|
133
|
-
parts.push(savedFilePath);
|
|
134
|
-
else if (artifactCount > 0)
|
|
135
|
-
parts.push(`${artifactCount} artifact${artifactCount === 1 ? "" : "s"}`);
|
|
136
202
|
return {
|
|
137
|
-
...(
|
|
203
|
+
...getPageChangeIdentityFields(options, evidence),
|
|
204
|
+
...(evidence.artifactCount > 0 ? { artifactCount: evidence.artifactCount } : {}),
|
|
138
205
|
changeType,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
observed,
|
|
142
|
-
...(savedFilePath ? { savedFilePath } : {}),
|
|
143
|
-
summary: `${parts.join(" → ")}${observed ? "" : " → application change unverified"}`,
|
|
144
|
-
...(navigation?.title ? { title: navigation.title } : {}),
|
|
145
|
-
...(navigation?.url ? { url: navigation.url } : {}),
|
|
206
|
+
observed: changeType !== "mutation",
|
|
207
|
+
summary: formatPageChangeText(options.commandInfo, evidence, changeType),
|
|
146
208
|
};
|
|
147
209
|
}
|
|
148
210
|
function stripNavigationSummary(data) {
|
|
@@ -164,9 +226,6 @@ export function formatNavigationActionResult(data) {
|
|
|
164
226
|
if (lines.length > 0) {
|
|
165
227
|
return lines.join("\n");
|
|
166
228
|
}
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
return undefined;
|
|
170
|
-
}
|
|
171
|
-
return actionText;
|
|
229
|
+
const text = stringifyModelFacing(actionData).trim();
|
|
230
|
+
return text.length === 0 || text === "{}" ? undefined : text;
|
|
172
231
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { isRecord } from "../../parsing.js";
|
|
2
|
+
import { getSavedFileDetails } from "./artifacts.js";
|
|
3
|
+
import { formatWebMcpCatalogUpdate } from "./common.js";
|
|
4
|
+
import { formatNetworkRouteDiagnosticsText } from "./diagnostics.js";
|
|
5
|
+
import { buildErrorPresentation } from "./errors.js";
|
|
6
|
+
function appendNotice(draft, text) {
|
|
7
|
+
if (text !== undefined && text.length > 0 && draft.content[0]?.type === "text") {
|
|
8
|
+
draft.content[0] = { ...draft.content[0], text: `${draft.content[0].text}\n\n${text}` };
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function getKeyboardInsertTextWarning(commandInfo) {
|
|
12
|
+
if (commandInfo.command !== "keyboard" || commandInfo.subcommand !== "inserttext") {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return "Input dispatch warning: keyboard inserttext skips key events. A DOM value change does not prove a framework-controlled editor accepted it; verify application state before saving, or use keyboard type when real key events are required.";
|
|
16
|
+
}
|
|
17
|
+
function applyRecordingError(draft, options, source) {
|
|
18
|
+
if (options.errorText === undefined ||
|
|
19
|
+
options.errorText.length === 0 ||
|
|
20
|
+
(!source.recordingCommand && !source.recordingBatch)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const failure = buildErrorPresentation({
|
|
24
|
+
args: options.args,
|
|
25
|
+
commandInfo: options.commandInfo,
|
|
26
|
+
errorText: options.errorText,
|
|
27
|
+
presentationCommand: source.presentationCommandInfo.command,
|
|
28
|
+
sessionName: options.sessionName,
|
|
29
|
+
});
|
|
30
|
+
draft.resultCategory = "failure";
|
|
31
|
+
draft.failureCategory = failure.failureCategory;
|
|
32
|
+
draft.summary = failure.summary;
|
|
33
|
+
draft.content = [
|
|
34
|
+
{
|
|
35
|
+
type: "text",
|
|
36
|
+
text: `${failure.content[0]?.type === "text" ? failure.content[0].text : options.errorText}\n\n${draft.content[0]?.type === "text" ? draft.content[0].text : ""}`,
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
function applyNetworkNotices(draft, options) {
|
|
41
|
+
const diagnostics = options.networkRouteDiagnostics;
|
|
42
|
+
if (diagnostics && diagnostics.length > 0 && draft.content[0]?.type === "text") {
|
|
43
|
+
const text = formatNetworkRouteDiagnosticsText(diagnostics);
|
|
44
|
+
if (text !== undefined && text.length > 0) {
|
|
45
|
+
draft.content[0] = { ...draft.content[0], text: `${text}\n\n${draft.content[0].text}` };
|
|
46
|
+
}
|
|
47
|
+
draft.networkRouteDiagnostics = diagnostics;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function applySavedFile(draft, source, commandInfo) {
|
|
51
|
+
if (!isRecord(source.data)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const savedFile = getSavedFileDetails(commandInfo, source.data);
|
|
55
|
+
if (savedFile) {
|
|
56
|
+
draft.savedFile = savedFile;
|
|
57
|
+
draft.savedFilePath = savedFile.path;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export function applyPresentationNotices(draft, options, source) {
|
|
61
|
+
applyRecordingError(draft, options, source);
|
|
62
|
+
applyNetworkNotices(draft, options);
|
|
63
|
+
applySavedFile(draft, source, options.commandInfo);
|
|
64
|
+
const data = source.presentationData;
|
|
65
|
+
if (isRecord(data) &&
|
|
66
|
+
isRecord(data.webmcp) &&
|
|
67
|
+
(Array.isArray(data.webmcp.tools) || data.webmcp.status === "unavailable")) {
|
|
68
|
+
appendNotice(draft, formatWebMcpCatalogUpdate(data.webmcp));
|
|
69
|
+
}
|
|
70
|
+
if (options.commandInfo.command === "screenshot" &&
|
|
71
|
+
(options.args?.includes("--annotate") ?? false)) {
|
|
72
|
+
appendNotice(draft, "Annotated screenshot note: dense pages can produce overlapping labels. If the labels are noisy, capture a scoped element screenshot, take a non-annotated screenshot, or use snapshot -i high-value refs as the machine-readable map.");
|
|
73
|
+
}
|
|
74
|
+
appendNotice(draft, getKeyboardInsertTextWarning(source.commandInfo));
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { isRecord } from "../../parsing.js";
|
|
2
|
+
import { isSessionArtifactManifest } from "../artifact-manifest-validation.js";
|
|
3
|
+
import { stringifyUnknown, truncateText } from "../text.js";
|
|
4
|
+
import { applyArtifactManifest } from "./artifacts.js";
|
|
5
|
+
import { redactModelFacingText } from "./common.js";
|
|
6
|
+
import { OBSERVATION_INLINE_MAX_CHARS, projectAgentBrowserObservation } from "./content.js";
|
|
7
|
+
import { buildSpillArtifactEntries, writeLargeOutputSpillFile, } from "./output-spill.js";
|
|
8
|
+
function isJsonValue(value) {
|
|
9
|
+
if (value === null ||
|
|
10
|
+
typeof value === "string" ||
|
|
11
|
+
typeof value === "number" ||
|
|
12
|
+
typeof value === "boolean") {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
return value.every(isJsonValue);
|
|
17
|
+
}
|
|
18
|
+
return isRecord(value) && Object.values(value).every(isJsonValue);
|
|
19
|
+
}
|
|
20
|
+
function toJsonValue(value) {
|
|
21
|
+
const parsed = JSON.parse(JSON.stringify(value));
|
|
22
|
+
if (!isJsonValue(parsed)) {
|
|
23
|
+
throw new Error("Serialized browser observation must be JSON.");
|
|
24
|
+
}
|
|
25
|
+
return parsed;
|
|
26
|
+
}
|
|
27
|
+
function getCompactSummary(observation) {
|
|
28
|
+
if (typeof observation.summary === "string") {
|
|
29
|
+
return truncateText(observation.summary, 700);
|
|
30
|
+
}
|
|
31
|
+
return typeof observation.error === "string" ? truncateText(observation.error, 700) : undefined;
|
|
32
|
+
}
|
|
33
|
+
function buildCompactObservation(observation, persisted) {
|
|
34
|
+
const compact = {
|
|
35
|
+
success: observation.success,
|
|
36
|
+
resultCategory: observation.resultCategory,
|
|
37
|
+
failureCategory: observation.failureCategory,
|
|
38
|
+
successCategory: observation.successCategory,
|
|
39
|
+
summary: getCompactSummary(observation),
|
|
40
|
+
compacted: true,
|
|
41
|
+
...(persisted.spill
|
|
42
|
+
? {
|
|
43
|
+
observationPath: persisted.spill.path,
|
|
44
|
+
retrieve: "Read observationPath for the complete redacted observation, including exact recovery actions and requested data.",
|
|
45
|
+
}
|
|
46
|
+
: {
|
|
47
|
+
observationUnavailable: truncateText(redactModelFacingText(persisted.error ?? "Spill could not be written; request a smaller result."), 1_000),
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
for (const key of [
|
|
51
|
+
"sessionName",
|
|
52
|
+
"namespace",
|
|
53
|
+
"codeRun",
|
|
54
|
+
"error",
|
|
55
|
+
"failures",
|
|
56
|
+
"nextActions",
|
|
57
|
+
"artifactVerification",
|
|
58
|
+
"imageObservations",
|
|
59
|
+
"data",
|
|
60
|
+
"fullOutputPath",
|
|
61
|
+
"fullOutputPaths",
|
|
62
|
+
]) {
|
|
63
|
+
if (observation[key] !== undefined &&
|
|
64
|
+
JSON.stringify({ ...compact, [key]: observation[key] }, null, 2).length <=
|
|
65
|
+
OBSERVATION_INLINE_MAX_CHARS - 500) {
|
|
66
|
+
compact[key] = observation[key];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return compact;
|
|
70
|
+
}
|
|
71
|
+
async function persistObservation(options, observation, prose, text) {
|
|
72
|
+
const manifest = isSessionArtifactManifest(options.details.artifactManifest)
|
|
73
|
+
? options.details.artifactManifest
|
|
74
|
+
: undefined;
|
|
75
|
+
try {
|
|
76
|
+
const write = () => writeLargeOutputSpillFile({
|
|
77
|
+
data: { ...observation, ...(!options.json ? { text: prose } : {}) },
|
|
78
|
+
persistentArtifactStore: options.persistentArtifactStore,
|
|
79
|
+
text,
|
|
80
|
+
});
|
|
81
|
+
const spill = await (options.withArtifactWrite ? options.withArtifactWrite(write) : write());
|
|
82
|
+
return {
|
|
83
|
+
spill,
|
|
84
|
+
manifest: applyArtifactManifest({ content: [], summary: "" }, manifest, buildSpillArtifactEntries({
|
|
85
|
+
...spill,
|
|
86
|
+
commandInfo: {
|
|
87
|
+
command: typeof options.details.command === "string" ? options.details.command : undefined,
|
|
88
|
+
},
|
|
89
|
+
})).artifactManifest,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
return { manifest, error: error instanceof Error ? error.message : stringifyUnknown(error) };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** Bound final model-visible output after recovery assembly; never truncate executable actions. */
|
|
97
|
+
export async function renderAgentBrowserObservation(options) {
|
|
98
|
+
const observation = projectAgentBrowserObservation(options.details, options.succeeded);
|
|
99
|
+
let structuredContent = observation;
|
|
100
|
+
const images = options.content.filter((part) => part.type === "image");
|
|
101
|
+
const prose = options.content
|
|
102
|
+
.filter((part) => part.type === "text")
|
|
103
|
+
.map((part) => part.text)
|
|
104
|
+
.join("\n\n");
|
|
105
|
+
const { data: _data, error: _error, summary: _summary, ...metadata } = observation;
|
|
106
|
+
let text = options.json
|
|
107
|
+
? JSON.stringify(observation, null, 2)
|
|
108
|
+
: `${prose}\n\nObservation: ${JSON.stringify(metadata)}`;
|
|
109
|
+
let manifest = isSessionArtifactManifest(options.details.artifactManifest)
|
|
110
|
+
? options.details.artifactManifest
|
|
111
|
+
: undefined;
|
|
112
|
+
if (text.length > OBSERVATION_INLINE_MAX_CHARS ||
|
|
113
|
+
JSON.stringify(observation).length > OBSERVATION_INLINE_MAX_CHARS) {
|
|
114
|
+
const persisted = await persistObservation(options, observation, prose, text);
|
|
115
|
+
manifest = persisted.manifest;
|
|
116
|
+
structuredContent = buildCompactObservation(observation, persisted);
|
|
117
|
+
text = options.preserveContent === true ? prose : JSON.stringify(structuredContent, null, 2);
|
|
118
|
+
if (options.preserveContent !== true && !options.json) {
|
|
119
|
+
text = `Browser observation compacted.\n${text}`;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
content: [{ type: "text", text }, ...images],
|
|
124
|
+
artifactManifest: manifest,
|
|
125
|
+
structuredContent: toJsonValue(structuredContent),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { buildReadConfirmationNextActions } from "../../read-confirmation.js";
|
|
2
|
+
import { buildAgentBrowserNextActions } from "../action-recommendations.js";
|
|
3
|
+
import { buildAgentBrowserResultCategoryDetails } from "../categories.js";
|
|
4
|
+
import { classifyPresentationSuccessCategory, formatMissingArtifactFailureText, hasMissingFileArtifact, } from "./artifacts.js";
|
|
5
|
+
import { buildNetworkRequestsNextActions, buildStreamNextActions } from "./diagnostics.js";
|
|
6
|
+
import { isOverlayBlockedClickError } from "./errors.js";
|
|
7
|
+
import { buildPageChangeSummary } from "./navigation.js";
|
|
8
|
+
function markFailure(draft, category, text, prepend) {
|
|
9
|
+
draft.resultCategory = "failure";
|
|
10
|
+
draft.failureCategory = category;
|
|
11
|
+
draft.successCategory = undefined;
|
|
12
|
+
draft.summary = text;
|
|
13
|
+
if (!prepend && draft.content[0]?.type === "text") {
|
|
14
|
+
draft.content[0] = { ...draft.content[0], text: `${text}\n\n${draft.content[0].text}` };
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
draft.content.unshift({ type: "text", text });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function applyArtifactFailures(draft, options) {
|
|
21
|
+
const missing = formatMissingArtifactFailureText(draft.artifacts);
|
|
22
|
+
const hasError = options.errorText !== undefined && options.errorText.length > 0;
|
|
23
|
+
if (hasError) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (missing !== undefined && missing.length > 0 && hasMissingFileArtifact(draft.artifacts)) {
|
|
27
|
+
markFailure(draft, "artifact-missing", missing, false);
|
|
28
|
+
}
|
|
29
|
+
const recording = draft.artifacts?.find((artifact) => artifact.recording?.success === false ||
|
|
30
|
+
artifact.recording?.output.encoderSucceeded === false);
|
|
31
|
+
if (recording) {
|
|
32
|
+
markFailure(draft, "upstream-error", `Recording failed: ${recording.recording?.error ?? "native capture/encoder failure"}`, true);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function classifyOutcome(draft, options, source) {
|
|
36
|
+
if (source.readConfirmation?.state === "pending") {
|
|
37
|
+
draft.readConfirmation = source.readConfirmation;
|
|
38
|
+
draft.resultCategory = "failure";
|
|
39
|
+
draft.failureCategory = "confirmation-required";
|
|
40
|
+
draft.successCategory = undefined;
|
|
41
|
+
}
|
|
42
|
+
if (draft.resultCategory === undefined) {
|
|
43
|
+
const categories = buildAgentBrowserResultCategoryDetails({
|
|
44
|
+
artifacts: draft.artifacts,
|
|
45
|
+
command: source.presentationCommandInfo.command,
|
|
46
|
+
confirmationRequired: source.confirmationRequired !== undefined,
|
|
47
|
+
errorText: options.envelope?.success === false ? draft.summary : undefined,
|
|
48
|
+
savedFile: draft.savedFile,
|
|
49
|
+
succeeded: options.envelope?.success !== false && source.confirmationRequired === undefined,
|
|
50
|
+
});
|
|
51
|
+
draft.resultCategory = categories.resultCategory;
|
|
52
|
+
draft.successCategory = categories.successCategory;
|
|
53
|
+
draft.failureCategory = categories.failureCategory;
|
|
54
|
+
}
|
|
55
|
+
if (draft.resultCategory === "success") {
|
|
56
|
+
draft.successCategory = classifyPresentationSuccessCategory({
|
|
57
|
+
artifactVerification: draft.artifactVerification,
|
|
58
|
+
artifacts: draft.artifacts,
|
|
59
|
+
savedFile: draft.savedFile,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function getGenericNextActions(draft, options, source) {
|
|
64
|
+
if (draft.nextActions) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return buildAgentBrowserNextActions({
|
|
68
|
+
artifacts: draft.artifacts,
|
|
69
|
+
args: options.args,
|
|
70
|
+
command: source.presentationCommandInfo.command,
|
|
71
|
+
confirmationId: source.confirmationRequired?.id,
|
|
72
|
+
failureCategory: draft.failureCategory,
|
|
73
|
+
overlayBlockedClick: isOverlayBlockedClickError(source.presentationCommandInfo.command, options.envelope?.success === false ? draft.summary : undefined, options.args ?? source.presentationCommandInfo.commandTokens),
|
|
74
|
+
resultCategory: draft.resultCategory ?? "success",
|
|
75
|
+
savedFilePath: draft.savedFilePath,
|
|
76
|
+
sessionName: options.sessionName,
|
|
77
|
+
subcommand: source.presentationCommandInfo.subcommand,
|
|
78
|
+
successCategory: draft.successCategory,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function applyNextActions(draft, options, source) {
|
|
82
|
+
const generic = getGenericNextActions(draft, options, source);
|
|
83
|
+
const network = source.commandInfo.command === "network" &&
|
|
84
|
+
source.commandInfo.subcommand === "requests" &&
|
|
85
|
+
draft.resultCategory === "success"
|
|
86
|
+
? buildNetworkRequestsNextActions(source.data, options.sessionName, draft.networkRouteDiagnostics)
|
|
87
|
+
: undefined;
|
|
88
|
+
const stream = draft.resultCategory === "success"
|
|
89
|
+
? buildStreamNextActions(source.commandInfo, source.data, options.sessionName)
|
|
90
|
+
: undefined;
|
|
91
|
+
const merged = [draft.nextActions, generic, network, stream].flatMap((group) => group ?? []);
|
|
92
|
+
const fallback = merged.length > 0 ? merged : undefined;
|
|
93
|
+
draft.nextActions = source.readConfirmation
|
|
94
|
+
? buildReadConfirmationNextActions(source.readConfirmation, true)
|
|
95
|
+
: fallback;
|
|
96
|
+
}
|
|
97
|
+
export function applyPresentationOutcome(draft, options, source) {
|
|
98
|
+
applyArtifactFailures(draft, options);
|
|
99
|
+
classifyOutcome(draft, options, source);
|
|
100
|
+
applyNextActions(draft, options, source);
|
|
101
|
+
draft.pageChangeSummary ??= buildPageChangeSummary({
|
|
102
|
+
artifacts: draft.artifacts,
|
|
103
|
+
commandInfo: source.presentationCommandInfo,
|
|
104
|
+
data: source.data,
|
|
105
|
+
nextActions: draft.nextActions,
|
|
106
|
+
savedFilePath: draft.savedFilePath,
|
|
107
|
+
summary: draft.summary,
|
|
108
|
+
});
|
|
109
|
+
if (draft.pageChangeSummary?.observed === false &&
|
|
110
|
+
source.presentationCommandInfo.command !== "batch" &&
|
|
111
|
+
draft.content[0]?.type === "text") {
|
|
112
|
+
draft.content[0] = {
|
|
113
|
+
...draft.content[0],
|
|
114
|
+
text: `${draft.content[0].text}\n\nAction dispatched; application change unverified. Verify the expected URL, text, state, or external receipt before relying on it.`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (options.modelVisible === false) {
|
|
118
|
+
draft.content = [];
|
|
119
|
+
}
|
|
120
|
+
}
|