pi-agent-browser-native 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -5
- package/README.md +120 -86
- package/dist/extensions/agent-browser/index.js +43065 -2016
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +49 -26
- package/dist/extensions/agent-browser/lib/argv-grammar.js +82 -93
- package/dist/extensions/agent-browser/lib/bash-guard.js +129 -126
- package/dist/extensions/agent-browser/lib/batch-lifecycle.js +113 -49
- package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +61 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +232 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claims.js +202 -0
- package/dist/extensions/agent-browser/lib/browser-execution-identity.js +77 -0
- package/dist/extensions/agent-browser/lib/browser-journal-branch.js +98 -0
- package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-journal-projection.js +221 -0
- package/dist/extensions/agent-browser/lib/browser-journal-reader.js +89 -0
- package/dist/extensions/agent-browser/lib/browser-journal-replay.js +246 -0
- package/dist/extensions/agent-browser/lib/browser-journal.js +103 -394
- package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +220 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +282 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-types.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +217 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion.js +80 -335
- package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +35 -0
- package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +166 -0
- package/dist/extensions/agent-browser/lib/browser-transcript.js +137 -81
- package/dist/extensions/agent-browser/lib/browser-value-parsing.js +15 -0
- package/dist/extensions/agent-browser/lib/command-capabilities.js +340 -0
- package/dist/extensions/agent-browser/lib/command-policy.js +107 -88
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +49 -322
- package/dist/extensions/agent-browser/lib/config-policy.js +138 -343
- package/dist/extensions/agent-browser/lib/config-providers.js +71 -0
- package/dist/extensions/agent-browser/lib/config-validation.js +218 -0
- package/dist/extensions/agent-browser/lib/config.js +19 -7
- package/dist/extensions/agent-browser/lib/electron/cdp.js +15 -7
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +134 -55
- package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +109 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +136 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +89 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +93 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +162 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/discovery.js +140 -549
- package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +102 -0
- package/dist/extensions/agent-browser/lib/electron/launch-process.js +209 -0
- package/dist/extensions/agent-browser/lib/electron/launch-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/launch.js +249 -354
- package/dist/extensions/agent-browser/lib/executable-path.js +21 -12
- package/dist/extensions/agent-browser/lib/execution-cwd.js +35 -18
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +162 -121
- package/dist/extensions/agent-browser/lib/input-modes/job.js +116 -313
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +104 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +132 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +57 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +151 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +142 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +57 -412
- package/dist/extensions/agent-browser/lib/input-modes/params.js +63 -17
- package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +268 -0
- package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +117 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-child.js +396 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +86 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-types.js +1 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +60 -0
- package/dist/extensions/agent-browser/lib/input-modes/script.js +60 -409
- package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +218 -128
- package/dist/extensions/agent-browser/lib/input-modes/shared.js +15 -4
- package/dist/extensions/agent-browser/lib/input-modes/types.js +56 -7
- package/dist/extensions/agent-browser/lib/json-schema.js +22 -10
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +17 -5
- package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +92 -425
- package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +58 -0
- package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +244 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +84 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +119 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +83 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore.js +168 -300
- package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +277 -0
- package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +128 -305
- package/dist/extensions/agent-browser/lib/managed-session-storage.js +56 -253
- package/dist/extensions/agent-browser/lib/native-confirmation.js +140 -0
- package/dist/extensions/agent-browser/lib/native-output.js +44 -9
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +107 -66
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +14 -6
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +109 -57
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +82 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +171 -57
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +31 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +152 -781
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +202 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +109 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +123 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +156 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +179 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +89 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +97 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +110 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +41 -538
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +204 -108
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +127 -199
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +65 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +113 -30
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +109 -28
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +138 -253
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +59 -24
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +159 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +131 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +42 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +242 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +75 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +92 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +254 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +114 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +222 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +68 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +176 -1114
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +191 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +152 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +115 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +316 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +28 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +333 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +71 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +201 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +183 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +200 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +18 -910
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +23 -13
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +198 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +154 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +68 -151
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +14 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +169 -46
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +210 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +61 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +187 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +171 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +228 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +77 -753
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +92 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +78 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +48 -816
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +86 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +69 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +164 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +161 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +165 -0
- package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +21 -9
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +211 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +23 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +99 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +275 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +280 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +303 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +36 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +335 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +227 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +204 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +139 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +24 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +98 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +295 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +41 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +7 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +102 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +133 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +180 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +269 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +146 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +54 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +261 -185
- package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-config.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +77 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +210 -139
- package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +124 -58
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +198 -98
- package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +199 -96
- package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +55 -0
- package/dist/extensions/agent-browser/lib/page-target-batch.js +118 -0
- package/dist/extensions/agent-browser/lib/page-target-guards.js +50 -0
- package/dist/extensions/agent-browser/lib/page-target-navigation.js +104 -0
- package/dist/extensions/agent-browser/lib/page-target-validation.js +59 -243
- package/dist/extensions/agent-browser/lib/parsing.js +13 -4
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +134 -68
- package/dist/extensions/agent-browser/lib/playbook.js +18 -14
- package/dist/extensions/agent-browser/lib/process-child.js +284 -0
- package/dist/extensions/agent-browser/lib/process-environment.js +22 -6
- package/dist/extensions/agent-browser/lib/process-errors.js +23 -0
- package/dist/extensions/agent-browser/lib/process-identity.js +47 -15
- package/dist/extensions/agent-browser/lib/process-socket-storage.js +256 -0
- package/dist/extensions/agent-browser/lib/process-stdout.js +74 -0
- package/dist/extensions/agent-browser/lib/process.js +146 -537
- package/dist/extensions/agent-browser/lib/prompt-artifacts.js +287 -0
- package/dist/extensions/agent-browser/lib/prompt-policy.js +15 -194
- package/dist/extensions/agent-browser/lib/read-command.js +41 -0
- package/dist/extensions/agent-browser/lib/read-confirmation.js +138 -35
- package/dist/extensions/agent-browser/lib/recording-reservations.js +118 -45
- package/dist/extensions/agent-browser/lib/redaction-fields.js +75 -0
- package/dist/extensions/agent-browser/lib/redaction-json.js +149 -0
- package/dist/extensions/agent-browser/lib/redaction-url.js +88 -0
- package/dist/extensions/agent-browser/lib/results/action-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/action-recommendations.js +28 -271
- package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +96 -94
- package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +73 -0
- package/dist/extensions/agent-browser/lib/results/categories.js +111 -54
- package/dist/extensions/agent-browser/lib/results/confirmation.js +29 -10
- package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +62 -27
- package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +83 -0
- package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +48 -0
- package/dist/extensions/agent-browser/lib/results/envelope.js +93 -66
- package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +180 -0
- package/dist/extensions/agent-browser/lib/results/network-routes.js +86 -45
- package/dist/extensions/agent-browser/lib/results/network.js +35 -12
- package/dist/extensions/agent-browser/lib/results/next-actions.js +49 -19
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +320 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +138 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +113 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +145 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +99 -552
- package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +118 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +68 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +135 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +227 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +91 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +91 -460
- package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +9 -5
- package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/common.js +26 -9
- package/dist/extensions/agent-browser/lib/results/presentation/content.js +86 -29
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +67 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +79 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +199 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +124 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +64 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +209 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +69 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +222 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +103 -1019
- package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +70 -0
- package/dist/extensions/agent-browser/lib/results/presentation/errors.js +130 -60
- package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +60 -145
- package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +147 -88
- package/dist/extensions/agent-browser/lib/results/presentation/notices.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +127 -0
- package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +120 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +77 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +51 -0
- package/dist/extensions/agent-browser/lib/results/presentation/registry.js +117 -237
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +35 -21
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +104 -73
- package/dist/extensions/agent-browser/lib/results/presentation/source.js +109 -0
- package/dist/extensions/agent-browser/lib/results/presentation.js +17 -248
- package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/recording.js +52 -14
- package/dist/extensions/agent-browser/lib/results/recovery-actions.js +14 -5
- package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +30 -22
- package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +83 -0
- package/dist/extensions/agent-browser/lib/results/selector-recovery.js +123 -123
- package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +266 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-content.js +32 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +104 -71
- package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +31 -11
- package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +125 -66
- package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +26 -7
- package/dist/extensions/agent-browser/lib/results/snapshot.js +28 -248
- package/dist/extensions/agent-browser/lib/results/text.js +16 -5
- package/dist/extensions/agent-browser/lib/runtime-args-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/runtime-compatibility.js +81 -0
- package/dist/extensions/agent-browser/lib/runtime-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/runtime-redaction.js +118 -0
- package/dist/extensions/agent-browser/lib/runtime-replay-events.js +144 -0
- package/dist/extensions/agent-browser/lib/runtime-session-identity.js +76 -0
- package/dist/extensions/agent-browser/lib/runtime-session-plan.js +114 -0
- package/dist/extensions/agent-browser/lib/runtime-session-replay.js +123 -0
- package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +65 -0
- package/dist/extensions/agent-browser/lib/runtime-timeouts.js +28 -0
- package/dist/extensions/agent-browser/lib/runtime.js +137 -1037
- package/dist/extensions/agent-browser/lib/session-identity.js +51 -0
- package/dist/extensions/agent-browser/lib/session-page-observation.js +357 -0
- package/dist/extensions/agent-browser/lib/session-page-state.js +188 -324
- package/dist/extensions/agent-browser/lib/session-page-types.js +1 -0
- package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +78 -0
- package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +7 -0
- package/dist/extensions/agent-browser/lib/temp-root-ownership.js +234 -0
- package/dist/extensions/agent-browser/lib/temp-root.js +207 -0
- package/dist/extensions/agent-browser/lib/temp.js +33 -446
- package/dist/extensions/agent-browser/lib/tool-surface.js +94 -24
- package/dist/extensions/agent-browser/lib/upstream-version.js +3 -2
- package/dist/extensions/agent-browser/lib/web-search-providers.js +229 -0
- package/dist/extensions/agent-browser/lib/web-search-request.js +108 -0
- package/dist/extensions/agent-browser/lib/web-search-results.js +281 -0
- package/dist/extensions/agent-browser/lib/web-search-schema.js +82 -0
- package/dist/extensions/agent-browser/lib/web-search.js +109 -617
- package/dist/extensions/agent-browser/lib/webmcp-observation.js +13 -6
- package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +63 -37
- package/dist/extensions/agent-browser/script-worker.js +80 -43
- package/dist/scripts/agent-browser-target.mjs +4 -2
- package/docs/ARCHITECTURE.md +22 -10
- package/docs/CODE_QUALITY.md +242 -0
- package/docs/COMMAND_REFERENCE.md +264 -229
- package/docs/ELECTRON.md +53 -44
- package/docs/RELEASE.md +21 -17
- package/docs/REQUIREMENTS.md +2 -0
- package/docs/SESSION_STORAGE.md +1 -1
- package/docs/SUPPORT_MATRIX.md +84 -77
- package/docs/TOOL_CONTRACT.md +165 -130
- package/docs/platform-smoke.md +5 -5
- package/package.json +143 -120
- package/scripts/agent-browser-capability-baseline.mjs +361 -957
- package/scripts/agent-browser-target.mjs +6 -2
- package/scripts/build.mjs +37 -8
- package/scripts/capability-core-commands.mjs +193 -0
- package/scripts/capability-options.mjs +283 -0
- package/scripts/capability-samples.mjs +133 -0
- package/scripts/capability-section.mjs +11 -0
- package/scripts/config.mjs +213 -114
- package/scripts/convert-browser-session.mjs +30 -9
- package/scripts/doctor-sources.mjs +195 -0
- package/scripts/doctor.mjs +92 -247
- package/scripts/platform-smoke/artifacts.mjs +38 -11
- package/scripts/platform-smoke/commands.mjs +104 -0
- package/scripts/platform-smoke/crabbox-runner.mjs +167 -80
- package/scripts/platform-smoke/doctor-support.mjs +157 -0
- package/scripts/platform-smoke/doctor-windows.mjs +230 -0
- package/scripts/platform-smoke/doctor.mjs +212 -320
- package/scripts/platform-smoke/lease-evidence.mjs +134 -0
- package/scripts/platform-smoke/suite-checks.mjs +98 -0
- package/scripts/platform-smoke/suite-evidence.mjs +281 -0
- package/scripts/platform-smoke/targets.mjs +158 -472
- package/scripts/platform-smoke.mjs +55 -40
- package/scripts/prepare.mjs +16 -7
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { buildAgentBrowserNextActions } from "../../results/action-recommendations.js";
|
|
2
|
+
import { appendUniqueAgentBrowserNextActions, isStandaloneSnapshotNextAction, withOptionalSessionArgs, } from "../../results/next-actions.js";
|
|
3
|
+
import { buildElectronLifecycleNextActions, buildElectronMismatchNextActions, buildElectronRefFreshnessNextActions, buildManagedSessionFreshFailureNextActions, } from "./session-state.js";
|
|
4
|
+
import { buildOverlayBlockerNextActions } from "./overlay-diagnostics.js";
|
|
5
|
+
import { buildFillVerificationNextActions } from "./fill-diagnostics.js";
|
|
6
|
+
import { buildSelectorTextVisibilityNextActions } from "./text-visibility-diagnostics.js";
|
|
7
|
+
import { buildElectronBroadGetTextScopeNextActions, buildSourceLookupElectronNextActions, } from "./electron-text-diagnostics.js";
|
|
8
|
+
import { buildClickDispatchNextActions } from "./click-dispatch.js";
|
|
9
|
+
import { buildComboboxFocusNextActions, buildScrollNoopNextActions, } from "./interaction-diagnostics.js";
|
|
10
|
+
import { buildPageRecoveryActions, buildSelectorRecoveryActions, buildSemanticActionCandidateActions, buildStaleSemanticRetry, } from "./final-result-action-recovery.js";
|
|
11
|
+
import { buildDialogTimeoutNextActions, buildTimeoutPartialProgressNextActions, } from "./final-result-timeout.js";
|
|
12
|
+
function addElectronRecovery(prior, options) {
|
|
13
|
+
const actions = [...prior];
|
|
14
|
+
const healthRecord = options.electronPostCommandHealth
|
|
15
|
+
? options.electronLaunchRecords.get(options.electronPostCommandHealth.launchId)
|
|
16
|
+
: undefined;
|
|
17
|
+
if (healthRecord) {
|
|
18
|
+
appendUniqueAgentBrowserNextActions(actions, buildElectronLifecycleNextActions(healthRecord));
|
|
19
|
+
}
|
|
20
|
+
const mismatchRecord = options.electronSessionMismatch
|
|
21
|
+
? options.electronLaunchRecords.get(options.electronSessionMismatch.launchId)
|
|
22
|
+
: undefined;
|
|
23
|
+
if (mismatchRecord) {
|
|
24
|
+
appendUniqueAgentBrowserNextActions(actions, buildElectronMismatchNextActions(mismatchRecord, options.electronSessionMismatch?.liveTarget));
|
|
25
|
+
}
|
|
26
|
+
return actions;
|
|
27
|
+
}
|
|
28
|
+
function addObservationRecovery(prior, options) {
|
|
29
|
+
const actions = [...prior];
|
|
30
|
+
const sessionName = options.executionPlan.sessionName;
|
|
31
|
+
if (options.overlayBlockerDiagnostic) {
|
|
32
|
+
actions.push(...buildOverlayBlockerNextActions({
|
|
33
|
+
diagnostic: options.overlayBlockerDiagnostic,
|
|
34
|
+
sessionName,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
if (options.fillVerificationDiagnostic) {
|
|
38
|
+
appendUniqueAgentBrowserNextActions(actions, buildFillVerificationNextActions(options.fillVerificationDiagnostic, sessionName));
|
|
39
|
+
}
|
|
40
|
+
if (options.electronRefFreshnessDiagnostic) {
|
|
41
|
+
appendUniqueAgentBrowserNextActions(actions, buildElectronRefFreshnessNextActions(sessionName));
|
|
42
|
+
}
|
|
43
|
+
if (options.selectorTextVisibilityDiagnostics.length > 0) {
|
|
44
|
+
actions.push(...buildSelectorTextVisibilityNextActions({
|
|
45
|
+
diagnostics: options.selectorTextVisibilityDiagnostics,
|
|
46
|
+
sessionName,
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
if (options.electronBroadGetTextScopeDiagnostics.length > 0) {
|
|
50
|
+
actions.push(...buildElectronBroadGetTextScopeNextActions({
|
|
51
|
+
diagnostics: options.electronBroadGetTextScopeDiagnostics,
|
|
52
|
+
sessionName,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
if (options.sourceLookup?.electronContext) {
|
|
56
|
+
appendUniqueAgentBrowserNextActions(actions, buildSourceLookupElectronNextActions(options.sourceLookup));
|
|
57
|
+
}
|
|
58
|
+
return actions;
|
|
59
|
+
}
|
|
60
|
+
function addInteractionRecovery(prior, options) {
|
|
61
|
+
const actions = [...prior];
|
|
62
|
+
const sessionName = options.executionPlan.sessionName;
|
|
63
|
+
if (options.clickDispatchDiagnostic) {
|
|
64
|
+
actions.push(...buildClickDispatchNextActions({
|
|
65
|
+
commandTokens: options.commandTokens,
|
|
66
|
+
diagnostic: options.clickDispatchDiagnostic,
|
|
67
|
+
sessionName,
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
if (options.scrollNoopDiagnostic) {
|
|
71
|
+
actions.push(...buildScrollNoopNextActions(sessionName));
|
|
72
|
+
}
|
|
73
|
+
if (options.comboboxFocusDiagnostic) {
|
|
74
|
+
actions.push(...buildComboboxFocusNextActions(sessionName));
|
|
75
|
+
}
|
|
76
|
+
if (options.managedSessionOutcome) {
|
|
77
|
+
appendUniqueAgentBrowserNextActions(actions, buildManagedSessionFreshFailureNextActions(options.managedSessionOutcome));
|
|
78
|
+
}
|
|
79
|
+
return actions;
|
|
80
|
+
}
|
|
81
|
+
function addInterruptionRecovery(prior, options) {
|
|
82
|
+
let actions = [...prior];
|
|
83
|
+
if (options.currentSessionTabTargetUnknown === true &&
|
|
84
|
+
["aborted", "parse-failure"].includes(options.categoryDetails.failureCategory ?? "")) {
|
|
85
|
+
actions = actions.filter((action) => !isStandaloneSnapshotNextAction(action));
|
|
86
|
+
appendUniqueAgentBrowserNextActions(actions, [
|
|
87
|
+
{
|
|
88
|
+
id: "verify-page-target-after-interruption",
|
|
89
|
+
tool: "agent_browser",
|
|
90
|
+
params: {
|
|
91
|
+
args: withOptionalSessionArgs(options.executionPlan.sessionName, ["batch", "--bail"]),
|
|
92
|
+
stdin: JSON.stringify([
|
|
93
|
+
["get", "url"],
|
|
94
|
+
["snapshot", "-i"],
|
|
95
|
+
]),
|
|
96
|
+
},
|
|
97
|
+
reason: "Verify the current URL and inspect the page after an interrupted operation.",
|
|
98
|
+
safety: "Read-only recovery. The mutation may already have happened; inspect before deciding whether to retry.",
|
|
99
|
+
},
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
if (options.categoryDetails.failureCategory === "timeout" && options.processResult.timedOut) {
|
|
103
|
+
if (options.currentSessionTabTargetUnknown === true) {
|
|
104
|
+
actions = actions.filter((action) => !isStandaloneSnapshotNextAction(action));
|
|
105
|
+
}
|
|
106
|
+
appendUniqueAgentBrowserNextActions(actions, buildTimeoutPartialProgressNextActions(options));
|
|
107
|
+
appendUniqueAgentBrowserNextActions(actions, buildDialogTimeoutNextActions({
|
|
108
|
+
command: options.executionPlan.commandInfo.command,
|
|
109
|
+
sessionName: options.executionPlan.sessionName,
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
return actions;
|
|
113
|
+
}
|
|
114
|
+
export function buildResultNextActions(options) {
|
|
115
|
+
if (options.presentation.recordingRecovery || options.presentation.readConfirmation) {
|
|
116
|
+
return options.presentation.nextActions === undefined
|
|
117
|
+
? undefined
|
|
118
|
+
: [...options.presentation.nextActions];
|
|
119
|
+
}
|
|
120
|
+
let actions = buildPageRecoveryActions(options);
|
|
121
|
+
actions.push(...buildSelectorRecoveryActions(options));
|
|
122
|
+
actions = addElectronRecovery(actions, options);
|
|
123
|
+
if (options.categoryDetails.failureCategory === "selector-not-found" &&
|
|
124
|
+
options.redactedCompiledSemanticAction) {
|
|
125
|
+
actions.push(...buildSemanticActionCandidateActions(options.redactedCompiledSemanticAction));
|
|
126
|
+
}
|
|
127
|
+
actions = addObservationRecovery(actions, options);
|
|
128
|
+
actions = addInteractionRecovery(actions, options);
|
|
129
|
+
actions = addInterruptionRecovery(actions, options);
|
|
130
|
+
actions.push(...buildStaleSemanticRetry(options));
|
|
131
|
+
if (options.electronLaunchRecord) {
|
|
132
|
+
actions.push(...(buildAgentBrowserNextActions({
|
|
133
|
+
electron: {
|
|
134
|
+
launchId: options.electronLaunchRecord.launchId,
|
|
135
|
+
sessionName: options.electronLaunchRecord.sessionName,
|
|
136
|
+
status: options.electronLaunchRecord.cleanupState,
|
|
137
|
+
},
|
|
138
|
+
failureCategory: options.categoryDetails.failureCategory,
|
|
139
|
+
resultCategory: options.categoryDetails.resultCategory,
|
|
140
|
+
successCategory: options.categoryDetails.successCategory,
|
|
141
|
+
}) ?? []));
|
|
142
|
+
}
|
|
143
|
+
return actions.length > 0 ? actions : undefined;
|
|
144
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { formatVisibleRefFallbackText, formatRichInputRecoveryText, } from "../../results/selector-recovery.js";
|
|
2
|
+
import { redactSensitiveText } from "../../runtime-redaction.js";
|
|
3
|
+
import { formatClickDispatchDiagnosticText } from "./click-dispatch.js";
|
|
4
|
+
import { formatOverlayBlockerText } from "./overlay-diagnostics.js";
|
|
5
|
+
import { formatFillVerificationText } from "./fill-diagnostics.js";
|
|
6
|
+
import { formatSelectorTextVisibilityText } from "./text-visibility-diagnostics.js";
|
|
7
|
+
import { formatElectronBroadGetTextScopeText } from "./electron-text-diagnostics.js";
|
|
8
|
+
import { formatTimeoutPartialProgressText } from "./timeout-diagnostics.js";
|
|
9
|
+
import { formatArtifactCleanupGuidanceText, formatComboboxFocusDiagnosticText, formatEvalResultWarningText, formatEvalStdinHintText, formatRecordingDependencyWarningText, formatScrollNoopDiagnosticText, } from "./diagnostics.js";
|
|
10
|
+
import { formatElectronRefFreshnessText, formatManagedSessionOutcomeText, } from "./session-state.js";
|
|
11
|
+
import { formatBrowserWindowText, formatReadExecutionText } from "./final-result-evidence.js";
|
|
12
|
+
import { formatElectronLaunchText } from "./final-result-electron.js";
|
|
13
|
+
import { buildJsonVisibleContent, readJsonWarnings, redactExactSensitiveText, } from "./final-result-redaction.js";
|
|
14
|
+
const SEMANTIC_ACTION_CANDIDATE_ACTION_IDS = new Set([
|
|
15
|
+
"try-button-name-candidate",
|
|
16
|
+
"try-link-name-candidate",
|
|
17
|
+
]);
|
|
18
|
+
function formatSemanticActionCandidateText(actions) {
|
|
19
|
+
const candidates = actions?.filter((action) => SEMANTIC_ACTION_CANDIDATE_ACTION_IDS.has(action.id) && action.params?.args !== undefined) ?? [];
|
|
20
|
+
if (candidates.length === 0) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return [
|
|
24
|
+
"Agent-browser candidate fallbacks:",
|
|
25
|
+
...candidates.map((action) => `- ${action.id}: agent_browser ${JSON.stringify({ args: action.params?.args })} — ${action.reason}`),
|
|
26
|
+
].join("\n");
|
|
27
|
+
}
|
|
28
|
+
export function formatAgentBrowserNextActionsText(nextActions) {
|
|
29
|
+
if (!nextActions || nextActions.length === 0) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const lines = nextActions.map((action) => {
|
|
33
|
+
const payload = action.artifactPath !== undefined && action.artifactPath.length > 0
|
|
34
|
+
? { artifactPath: action.artifactPath }
|
|
35
|
+
: action.params;
|
|
36
|
+
return `- ${action.id}${payload ? ` ${redactSensitiveText(JSON.stringify(payload))}` : ""}: ${redactSensitiveText(action.reason)}`;
|
|
37
|
+
});
|
|
38
|
+
return ["Next actions:", ...lines].join("\n");
|
|
39
|
+
}
|
|
40
|
+
function interactionDiagnosticText(options, nextActions) {
|
|
41
|
+
return [
|
|
42
|
+
formatVisibleRefFallbackText(options.visibleRefFallbackDiagnostic),
|
|
43
|
+
formatRichInputRecoveryText(options.richInputRecoveryDiagnostic),
|
|
44
|
+
formatSemanticActionCandidateText(nextActions),
|
|
45
|
+
options.clickDispatchDiagnostic
|
|
46
|
+
? formatClickDispatchDiagnosticText(options.clickDispatchDiagnostic)
|
|
47
|
+
: undefined,
|
|
48
|
+
options.overlayBlockerDiagnostic
|
|
49
|
+
? formatOverlayBlockerText(options.overlayBlockerDiagnostic)
|
|
50
|
+
: undefined,
|
|
51
|
+
formatFillVerificationText(options.fillVerificationDiagnostic),
|
|
52
|
+
formatElectronRefFreshnessText(options.electronRefFreshnessDiagnostic),
|
|
53
|
+
formatSelectorTextVisibilityText(options.selectorTextVisibilityDiagnostics),
|
|
54
|
+
formatElectronBroadGetTextScopeText(options.electronBroadGetTextScopeDiagnostics),
|
|
55
|
+
formatScrollNoopDiagnosticText(options.scrollNoopDiagnostic),
|
|
56
|
+
formatComboboxFocusDiagnosticText(options.comboboxFocusDiagnostic),
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
function timeoutText(options) {
|
|
60
|
+
return options.timeoutPartialProgress
|
|
61
|
+
? formatTimeoutPartialProgressText(options.timeoutPartialProgress, options.currentSessionTabTargetUnknown === true &&
|
|
62
|
+
!(options.sessionMode === "fresh" &&
|
|
63
|
+
options.timeoutPartialProgress.liveUrlRecovered !== true))
|
|
64
|
+
: undefined;
|
|
65
|
+
}
|
|
66
|
+
function appendedDiagnosticText(options, nextActions, lifecycle, browserWindow) {
|
|
67
|
+
const text = [
|
|
68
|
+
...interactionDiagnosticText(options, nextActions),
|
|
69
|
+
formatRecordingDependencyWarningText(options.recordingDependencyWarning),
|
|
70
|
+
formatEvalStdinHintText(options.evalStdinHint),
|
|
71
|
+
formatEvalResultWarningText(options.evalResultWarning),
|
|
72
|
+
formatArtifactCleanupGuidanceText(options.artifactCleanup),
|
|
73
|
+
timeoutText(options),
|
|
74
|
+
formatManagedSessionOutcomeText(options.managedSessionOutcome),
|
|
75
|
+
formatReadExecutionText(options, lifecycle),
|
|
76
|
+
formatBrowserWindowText(browserWindow),
|
|
77
|
+
options.categoryDetails.resultCategory === "failure"
|
|
78
|
+
? formatAgentBrowserNextActionsText(nextActions)
|
|
79
|
+
: undefined,
|
|
80
|
+
]
|
|
81
|
+
.filter((item) => item !== undefined)
|
|
82
|
+
.join("\n\n");
|
|
83
|
+
return redactSensitiveText(redactExactSensitiveText(text, options.exactSensitiveValues));
|
|
84
|
+
}
|
|
85
|
+
function withAppendedText(content, text) {
|
|
86
|
+
if (text.length === 0 || content[0]?.type !== "text") {
|
|
87
|
+
return [...content];
|
|
88
|
+
}
|
|
89
|
+
return [{ ...content[0], text: `${content[0].text}\n\n${text}` }, ...content.slice(1)];
|
|
90
|
+
}
|
|
91
|
+
function withElectronHandoff(content, options) {
|
|
92
|
+
if (!options.electronLaunchRecord ||
|
|
93
|
+
!options.succeeded ||
|
|
94
|
+
options.userRequestedJson ||
|
|
95
|
+
content[0]?.type !== "text") {
|
|
96
|
+
return [...content];
|
|
97
|
+
}
|
|
98
|
+
const text = redactSensitiveText(formatElectronLaunchText({
|
|
99
|
+
handoff: options.electronHandoff,
|
|
100
|
+
record: options.electronLaunchRecord,
|
|
101
|
+
targets: options.electronLaunch?.targets ?? [],
|
|
102
|
+
upstreamText: content[0].text,
|
|
103
|
+
}));
|
|
104
|
+
return [{ ...content[0], text }, ...content.slice(1)];
|
|
105
|
+
}
|
|
106
|
+
export function buildFinalResultContent(options, details, nextActions, evidence) {
|
|
107
|
+
if (options.userRequestedJson && !options.plainTextInspection) {
|
|
108
|
+
const warnings = readJsonWarnings(options.redactedContent);
|
|
109
|
+
return {
|
|
110
|
+
content: buildJsonVisibleContent({
|
|
111
|
+
error: details.error,
|
|
112
|
+
details: { ...details, ...(warnings === undefined ? {} : { warnings }) },
|
|
113
|
+
presentation: options.presentation,
|
|
114
|
+
succeeded: options.succeeded,
|
|
115
|
+
warnings,
|
|
116
|
+
}),
|
|
117
|
+
warnings,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const diagnosticText = appendedDiagnosticText(options, nextActions, evidence.lifecycle, evidence.browserWindow);
|
|
121
|
+
const content = withAppendedText(options.redactedContent, diagnosticText);
|
|
122
|
+
return { content: withElectronHandoff(content, options) };
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { formatSessionArtifactRetentionSummary } from "../../results/artifact-manifest.js";
|
|
2
|
+
import { alignPageChangeSummaryNextActionIds } from "../../results/next-actions.js";
|
|
3
|
+
import { sanitizeVisibleRefFallbackDiagnostic } from "../../results/selector-recovery.js";
|
|
4
|
+
import { buildElectronIdentifiers, buildSessionDetailFields } from "./session-state.js";
|
|
5
|
+
import { getReadSource } from "./final-result-evidence.js";
|
|
6
|
+
function compiledRequestDetails(options) {
|
|
7
|
+
return {
|
|
8
|
+
args: options.redactedArgs,
|
|
9
|
+
compiledElectron: options.redactedCompiledElectron,
|
|
10
|
+
compiledJob: options.redactedCompiledJob,
|
|
11
|
+
compiledQaPreset: options.redactedCompiledQaPreset,
|
|
12
|
+
compiledSourceLookup: options.redactedCompiledSourceLookup,
|
|
13
|
+
compiledNetworkSourceLookup: options.redactedCompiledNetworkSourceLookup,
|
|
14
|
+
compiledSemanticAction: options.redactedCompiledSemanticAction,
|
|
15
|
+
compatibilityWorkaround: options.compatibilityWorkaround,
|
|
16
|
+
effectiveArgs: options.redactedProcessArgs,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function artifactDetails(options) {
|
|
20
|
+
const presentation = options.presentation;
|
|
21
|
+
return {
|
|
22
|
+
artifactManifest: options.resultArtifactManifest,
|
|
23
|
+
artifactRetentionSummary: presentation.artifactRetentionSummary ??
|
|
24
|
+
(options.resultArtifactManifest
|
|
25
|
+
? formatSessionArtifactRetentionSummary(options.resultArtifactManifest)
|
|
26
|
+
: undefined),
|
|
27
|
+
artifactCleanup: options.artifactCleanup,
|
|
28
|
+
artifactVerification: presentation.artifactVerification,
|
|
29
|
+
artifacts: presentation.artifacts,
|
|
30
|
+
fullOutputPath: options.parseFailureOutput.fullOutputPath ?? presentation.fullOutputPath,
|
|
31
|
+
fullOutputPaths: presentation.fullOutputPaths,
|
|
32
|
+
fullOutputUnavailable: options.parseFailureOutput.fullOutputUnavailable,
|
|
33
|
+
imagePath: presentation.imagePath,
|
|
34
|
+
imagePaths: presentation.imagePaths,
|
|
35
|
+
imageObservations: presentation.imageObservations,
|
|
36
|
+
savedFile: presentation.savedFile,
|
|
37
|
+
savedFilePath: presentation.savedFilePath,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function nativeObservationDetails(options, lifecycle, browserWindow) {
|
|
41
|
+
return {
|
|
42
|
+
batchFailure: options.presentation.batchFailure,
|
|
43
|
+
batchSteps: options.presentation.batchSteps,
|
|
44
|
+
command: options.executionPlan.commandInfo.command,
|
|
45
|
+
subcommand: options.executionPlan.commandInfo.subcommand,
|
|
46
|
+
data: options.presentation.data,
|
|
47
|
+
error: options.plainTextInspection ? undefined : options.presentationEnvelope?.error,
|
|
48
|
+
inspection: options.plainTextInspection || undefined,
|
|
49
|
+
agentBrowserStarted: options.processResult.agentBrowserStarted,
|
|
50
|
+
browserWindow,
|
|
51
|
+
lifecycle,
|
|
52
|
+
readSource: getReadSource(options),
|
|
53
|
+
recordingRecovery: options.presentation.recordingRecovery,
|
|
54
|
+
readConfirmation: options.presentation.readConfirmation,
|
|
55
|
+
exitCode: options.processResult.exitCode,
|
|
56
|
+
parseError: options.plainTextInspection ? undefined : options.parseError,
|
|
57
|
+
stderr: options.processResult.stderr,
|
|
58
|
+
stdout: options.plainTextInspection ? (options.inspectionText ?? "") : undefined,
|
|
59
|
+
summary: options.presentation.summary,
|
|
60
|
+
timedOut: options.processResult.timedOut || undefined,
|
|
61
|
+
timeoutMs: options.processResult.timeoutMs,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function sessionEvidenceDetails(options) {
|
|
65
|
+
return {
|
|
66
|
+
managedSessionHeadedAutosaveDisabled: options.managedSessionHeadedAutosaveDisabled,
|
|
67
|
+
managedSessionHeadedAutosaveInterval: options.managedSessionHeadedAutosaveInterval,
|
|
68
|
+
managedSessionOutcome: options.managedSessionOutcome,
|
|
69
|
+
sessionMode: options.sessionMode,
|
|
70
|
+
sessionTabCorrection: options.sessionTabCorrection,
|
|
71
|
+
sessionTabTarget: options.currentSessionTabTarget,
|
|
72
|
+
sessionTabTargetUnknown: options.currentSessionTabTargetUnknown,
|
|
73
|
+
refSnapshot: options.currentRefSnapshot,
|
|
74
|
+
refSnapshotInvalidation: options.currentRefSnapshotInvalidation,
|
|
75
|
+
namespace: options.executionPlan.namespace,
|
|
76
|
+
...buildSessionDetailFields(options.executionPlan.sessionName, options.executionPlan.usedImplicitSession, options.executionPlan.namespace, options.managedSessionRestoreDisabled),
|
|
77
|
+
sessionRecoveryHint: options.redactedRecoveryHint,
|
|
78
|
+
startupScopedFlags: options.executionPlan.startupScopedFlags,
|
|
79
|
+
aboutBlankSessionMismatch: options.aboutBlankSessionMismatch,
|
|
80
|
+
openResultTabCorrection: options.openResultTabCorrection,
|
|
81
|
+
navigationSummary: options.navigationSummary,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function electronEvidenceDetails(options) {
|
|
85
|
+
return {
|
|
86
|
+
electron: options.electronLaunchRecord
|
|
87
|
+
? {
|
|
88
|
+
action: "launch",
|
|
89
|
+
cleanup: options.electronFailedConnectCleanup,
|
|
90
|
+
handoff: options.electronHandoff,
|
|
91
|
+
identifiers: buildElectronIdentifiers(options.electronLaunchRecord),
|
|
92
|
+
launch: options.electronLaunchRecord,
|
|
93
|
+
profileIsolation: options.electronProfileIsolationDetails,
|
|
94
|
+
status: options.succeeded ? "succeeded" : "failed",
|
|
95
|
+
targets: options.electronLaunch?.targets,
|
|
96
|
+
version: options.electronLaunch?.version,
|
|
97
|
+
}
|
|
98
|
+
: undefined,
|
|
99
|
+
electronPostCommandHealth: options.electronPostCommandHealth,
|
|
100
|
+
electronRefFreshness: options.electronRefFreshnessDiagnostic,
|
|
101
|
+
electronSessionMismatch: options.electronSessionMismatch,
|
|
102
|
+
electronGetTextScopeWarning: options.electronBroadGetTextScopeDiagnostics[0],
|
|
103
|
+
electronGetTextScopeWarnings: options.electronBroadGetTextScopeDiagnostics.length > 1
|
|
104
|
+
? options.electronBroadGetTextScopeDiagnostics
|
|
105
|
+
: undefined,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function interactionEvidenceDetails(options) {
|
|
109
|
+
return {
|
|
110
|
+
clickDispatch: options.clickDispatchDiagnostic,
|
|
111
|
+
overlayBlockers: options.overlayBlockerDiagnostic,
|
|
112
|
+
fillVerification: options.fillVerificationDiagnostic,
|
|
113
|
+
visibleRefFallback: options.visibleRefFallbackDiagnostic
|
|
114
|
+
? sanitizeVisibleRefFallbackDiagnostic(options.visibleRefFallbackDiagnostic)
|
|
115
|
+
: undefined,
|
|
116
|
+
richInputRecovery: options.richInputRecoveryDiagnostic,
|
|
117
|
+
comboboxFocus: options.comboboxFocusDiagnostic,
|
|
118
|
+
recordingDependencyWarning: options.recordingDependencyWarning,
|
|
119
|
+
scrollNoop: options.scrollNoopDiagnostic,
|
|
120
|
+
selectorTextVisibility: options.selectorTextVisibilityDiagnostics[0],
|
|
121
|
+
selectorTextVisibilityAll: options.selectorTextVisibilityDiagnostics.length > 1
|
|
122
|
+
? options.selectorTextVisibilityDiagnostics
|
|
123
|
+
: undefined,
|
|
124
|
+
evalStdinHint: options.evalStdinHint,
|
|
125
|
+
evalResultWarning: options.evalResultWarning,
|
|
126
|
+
timeoutPartialProgress: options.timeoutPartialProgress,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function pageChangeSummary(options, nextActions) {
|
|
130
|
+
const rawSummary = (options.scrollNoopDiagnostic || options.comboboxFocusDiagnostic) &&
|
|
131
|
+
options.presentation.pageChangeSummary
|
|
132
|
+
? {
|
|
133
|
+
...options.presentation.pageChangeSummary,
|
|
134
|
+
nextActionIds: nextActions?.map((action) => action.id),
|
|
135
|
+
}
|
|
136
|
+
: options.presentation.pageChangeSummary;
|
|
137
|
+
return alignPageChangeSummaryNextActionIds(rawSummary, nextActions);
|
|
138
|
+
}
|
|
139
|
+
export function buildAgentBrowserResultDetails(options, nextActions, lifecycle, browserWindow) {
|
|
140
|
+
return {
|
|
141
|
+
...compiledRequestDetails(options),
|
|
142
|
+
...artifactDetails(options),
|
|
143
|
+
...nativeObservationDetails(options, lifecycle, browserWindow),
|
|
144
|
+
...options.categoryDetails,
|
|
145
|
+
...sessionEvidenceDetails(options),
|
|
146
|
+
...electronEvidenceDetails(options),
|
|
147
|
+
...interactionEvidenceDetails(options),
|
|
148
|
+
nextActions,
|
|
149
|
+
pageChangeSummary: pageChangeSummary(options, nextActions),
|
|
150
|
+
qaPreset: options.qaPreset,
|
|
151
|
+
qaAttachedTarget: options.qaAttachedTarget,
|
|
152
|
+
sourceLookup: options.sourceLookup,
|
|
153
|
+
networkSourceLookup: options.networkSourceLookup,
|
|
154
|
+
networkRouteDiagnostics: options.presentation.networkRouteDiagnostics,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { buildAgentBrowserResultCategoryDetails } from "../../results/categories.js";
|
|
2
|
+
import { redactSensitiveText } from "../../runtime-redaction.js";
|
|
3
|
+
import { redactToolDetails } from "./final-result-redaction.js";
|
|
4
|
+
export function getElectronLaunchFailureCategory(failure) {
|
|
5
|
+
switch (failure.reason) {
|
|
6
|
+
case "aborted":
|
|
7
|
+
return "aborted";
|
|
8
|
+
case "policy-blocked":
|
|
9
|
+
return "policy-blocked";
|
|
10
|
+
case "timeout":
|
|
11
|
+
return "timeout";
|
|
12
|
+
case "non-electron-target":
|
|
13
|
+
return "validation-error";
|
|
14
|
+
case "port-not-found":
|
|
15
|
+
case "single-instance-conflict":
|
|
16
|
+
case "spawn-error":
|
|
17
|
+
return "upstream-error";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function pidState(pidAlive) {
|
|
21
|
+
if (pidAlive === undefined) {
|
|
22
|
+
return "state unknown";
|
|
23
|
+
}
|
|
24
|
+
return pidAlive ? "alive before cleanup" : "not alive before cleanup";
|
|
25
|
+
}
|
|
26
|
+
function formatProcessDiagnostics(diagnostics) {
|
|
27
|
+
const lines = [];
|
|
28
|
+
if (diagnostics.pid !== undefined) {
|
|
29
|
+
lines.push(`- PID: ${diagnostics.pid} (${pidState(diagnostics.pidAlive)}).`);
|
|
30
|
+
}
|
|
31
|
+
if (diagnostics.exitCode !== undefined || diagnostics.exitSignal !== undefined) {
|
|
32
|
+
const exitParts = [
|
|
33
|
+
diagnostics.exitCode !== undefined ? `code ${String(diagnostics.exitCode)}` : undefined,
|
|
34
|
+
diagnostics.exitSignal !== undefined &&
|
|
35
|
+
diagnostics.exitSignal !== null &&
|
|
36
|
+
diagnostics.exitSignal.length > 0
|
|
37
|
+
? `signal ${diagnostics.exitSignal}`
|
|
38
|
+
: undefined,
|
|
39
|
+
]
|
|
40
|
+
.filter(Boolean)
|
|
41
|
+
.join(", ");
|
|
42
|
+
lines.push(`- Process exit: ${exitParts.length > 0 ? exitParts : "not observed before cleanup"}.`);
|
|
43
|
+
}
|
|
44
|
+
return lines;
|
|
45
|
+
}
|
|
46
|
+
function formatActivePort(activePort) {
|
|
47
|
+
const error = activePort.error !== undefined && activePort.error.length > 0 ? ` (${activePort.error})` : "";
|
|
48
|
+
let state;
|
|
49
|
+
if (activePort.port !== undefined && activePort.port !== 0) {
|
|
50
|
+
state = `found port ${activePort.port}`;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
state = activePort.found ? `found but invalid${error}` : `missing${error}`;
|
|
54
|
+
}
|
|
55
|
+
return `- DevToolsActivePort: ${state} at ${activePort.path}.`;
|
|
56
|
+
}
|
|
57
|
+
function formatConnectionDiagnostics(diagnostics) {
|
|
58
|
+
const lines = [];
|
|
59
|
+
if (diagnostics.userDataDir !== undefined && diagnostics.userDataDir.length > 0) {
|
|
60
|
+
lines.push(`- Wrapper profile: ${diagnostics.userDataDir}`);
|
|
61
|
+
}
|
|
62
|
+
if (diagnostics.devToolsActivePort) {
|
|
63
|
+
lines.push(formatActivePort(diagnostics.devToolsActivePort));
|
|
64
|
+
}
|
|
65
|
+
if (diagnostics.cdpVersionReached === false) {
|
|
66
|
+
lines.push("- CDP /json/version: did not return a valid payload before timeout.");
|
|
67
|
+
}
|
|
68
|
+
if (diagnostics.timeoutMs !== undefined || diagnostics.elapsedMs !== undefined) {
|
|
69
|
+
lines.push(`- Timing: ${diagnostics.elapsedMs ?? "unknown"}ms elapsed${diagnostics.timeoutMs !== undefined ? ` of ${diagnostics.timeoutMs}ms timeout` : ""}.`);
|
|
70
|
+
}
|
|
71
|
+
if (!diagnostics.outputCaptured) {
|
|
72
|
+
lines.push("- App stdout/stderr: not captured by this wrapper launch path.");
|
|
73
|
+
}
|
|
74
|
+
return lines;
|
|
75
|
+
}
|
|
76
|
+
function formatElectronLaunchFailureDiagnostics(failure) {
|
|
77
|
+
const diagnostics = failure?.diagnostics;
|
|
78
|
+
if (!diagnostics) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
const lines = [
|
|
82
|
+
"Electron launch diagnostics:",
|
|
83
|
+
...formatProcessDiagnostics(diagnostics),
|
|
84
|
+
...formatConnectionDiagnostics(diagnostics),
|
|
85
|
+
];
|
|
86
|
+
if (failure.reason !== "aborted") {
|
|
87
|
+
lines.push("Retry guidance: increase electron.timeoutMs, try targetType:'any', pass an explicit appPath/executablePath, quit any already-running singleton instance, then retry launch.");
|
|
88
|
+
}
|
|
89
|
+
return lines.join("\n");
|
|
90
|
+
}
|
|
91
|
+
export function buildElectronHostFailureResult(options) {
|
|
92
|
+
const text = [
|
|
93
|
+
options.errorText,
|
|
94
|
+
formatElectronLaunchFailureDiagnostics(options.launchFailure),
|
|
95
|
+
options.launchFailure?.cleanupError !== undefined &&
|
|
96
|
+
options.launchFailure.cleanupError.length > 0
|
|
97
|
+
? `Electron launch cleanup warning: ${options.launchFailure.cleanupError}`
|
|
98
|
+
: undefined,
|
|
99
|
+
]
|
|
100
|
+
.filter((item) => item !== undefined && item.length > 0)
|
|
101
|
+
.join("\n");
|
|
102
|
+
const details = {
|
|
103
|
+
args: [],
|
|
104
|
+
compiledElectron: options.compiledElectron,
|
|
105
|
+
electron: {
|
|
106
|
+
action: options.compiledElectron.action,
|
|
107
|
+
error: options.errorText,
|
|
108
|
+
failure: options.launchFailure,
|
|
109
|
+
status: options.status ?? "failed",
|
|
110
|
+
},
|
|
111
|
+
managedSessionOutcome: options.managedSessionOutcome,
|
|
112
|
+
...buildAgentBrowserResultCategoryDetails({
|
|
113
|
+
args: [],
|
|
114
|
+
errorText: options.errorText,
|
|
115
|
+
failureCategory: options.failureCategory,
|
|
116
|
+
succeeded: false,
|
|
117
|
+
timedOut: options.failureCategory === "timeout",
|
|
118
|
+
}),
|
|
119
|
+
summary: options.errorText,
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
content: [{ type: "text", text: redactSensitiveText(text) }],
|
|
123
|
+
details: redactToolDetails(details, []),
|
|
124
|
+
isError: true,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export function formatElectronTargetLines(targets, limit = 8) {
|
|
128
|
+
const shownTargets = targets.slice(0, limit);
|
|
129
|
+
const lines = shownTargets.map((target) => {
|
|
130
|
+
const typeTitle = [target.type, target.title].filter(Boolean).join(" ");
|
|
131
|
+
const fallback = target.id === undefined || target.id.length === 0 ? "target" : target.id;
|
|
132
|
+
const label = typeTitle.length > 0 ? typeTitle : fallback;
|
|
133
|
+
return `- ${label}${target.url !== undefined && target.url.length > 0 ? ` — ${target.url}` : ""}`;
|
|
134
|
+
});
|
|
135
|
+
if (targets.length > shownTargets.length) {
|
|
136
|
+
lines.push(`- ... ${targets.length - shownTargets.length} more target(s) omitted`);
|
|
137
|
+
}
|
|
138
|
+
return lines;
|
|
139
|
+
}
|
|
140
|
+
function formatSnapshotHandoff(handoff) {
|
|
141
|
+
if (handoff.refSnapshot && handoff.refSnapshot.refIds.length > 0) {
|
|
142
|
+
const retries = handoff.snapshotRetryCount;
|
|
143
|
+
return `Snapshot handoff: ${handoff.refSnapshot.refIds.length} interactive ref(s)${retries !== undefined && retries !== 0 ? ` after ${retries} retry attempt(s)` : ""}.`;
|
|
144
|
+
}
|
|
145
|
+
return "Snapshot handoff: no interactive refs returned after a short readiness retry; run snapshot -i once more before assuming the Electron UI is unusable.";
|
|
146
|
+
}
|
|
147
|
+
function formatHandoffText(handoff) {
|
|
148
|
+
switch (handoff?.handoff) {
|
|
149
|
+
case "snapshot":
|
|
150
|
+
return formatSnapshotHandoff(handoff);
|
|
151
|
+
case "tabs":
|
|
152
|
+
return "Tabs handoff completed: safer diagnostic starting point; no interactive refs were captured.";
|
|
153
|
+
case "connect":
|
|
154
|
+
return "Connect handoff completed: run snapshot -i before using interactive refs.";
|
|
155
|
+
case undefined:
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
export function formatElectronLaunchText(options) {
|
|
160
|
+
const lines = [
|
|
161
|
+
`Electron launch: ${options.record.appName} attached as ${options.record.sessionName ?? "managed session"} (launchId ${options.record.launchId}, port ${options.record.port}).`,
|
|
162
|
+
`Identifiers: launchId ${options.record.launchId} for electron.status/electron.cleanup/electron.probe; sessionName ${options.record.sessionName ?? "not attached"} for browser snapshot/tab commands.`,
|
|
163
|
+
"Profile note: electron.launch starts an isolated temporary profile; it does not reuse the app's normal signed-in profile or attach to an already-running authenticated app.",
|
|
164
|
+
"For already-authenticated desktop app content, do not stop here: if host tools are allowed and the app is not running, launch the normal app with --remote-debugging-port=<port>, verify the port, then run agent_browser connect <port>; if it is already running without a debug port, ask before relaunching it.",
|
|
165
|
+
...formatElectronTargetLines(options.targets),
|
|
166
|
+
];
|
|
167
|
+
const handoffText = formatHandoffText(options.handoff);
|
|
168
|
+
if (handoffText !== undefined) {
|
|
169
|
+
lines.push(handoffText);
|
|
170
|
+
}
|
|
171
|
+
lines.push(`Cleanup: use details.nextActions cleanup-electron-launch or call electron.cleanup with launchId ${options.record.launchId} when finished.`);
|
|
172
|
+
if (options.handoff?.error !== undefined && options.handoff.error.length > 0) {
|
|
173
|
+
lines.push(`Handoff warning: ${options.handoff.error}`);
|
|
174
|
+
}
|
|
175
|
+
if (options.upstreamText.trim().length > 0) {
|
|
176
|
+
lines.push("", options.upstreamText.trim());
|
|
177
|
+
}
|
|
178
|
+
return lines.join("\n");
|
|
179
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isRecord } from "../../parsing.js";
|
|
2
|
+
export function getReadSource(options) {
|
|
3
|
+
return options.executionPlan.commandInfo.command === "read" &&
|
|
4
|
+
isRecord(options.presentationEnvelope?.data) &&
|
|
5
|
+
typeof options.presentationEnvelope.data.source === "string"
|
|
6
|
+
? options.presentationEnvelope.data.source
|
|
7
|
+
: undefined;
|
|
8
|
+
}
|
|
9
|
+
export function formatReadExecutionText(options, lifecycle) {
|
|
10
|
+
const source = getReadSource(options);
|
|
11
|
+
if (source === undefined || source.length === 0) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return `Read execution: source ${source}; CLI started: ${options.processResult.agentBrowserStarted ? "yes" : "no"}; reported browserLaunched: ${lifecycle ? String(lifecycle.effectiveLaunch.browserLaunched) : "unknown"}; managed session outcome: ${options.managedSessionOutcome?.status ?? "not managed"}. An HTTP read does not establish shared-browser liveness; use session info for that.`;
|
|
15
|
+
}
|
|
16
|
+
function requestedOwnedHeadedWindow(options) {
|
|
17
|
+
return (options.headedLaunch &&
|
|
18
|
+
!options.preserveAttachedBrowserSession &&
|
|
19
|
+
!options.providerLaunch &&
|
|
20
|
+
options.succeeded);
|
|
21
|
+
}
|
|
22
|
+
export function buildBrowserWindowStatus(options, lifecycle) {
|
|
23
|
+
if (!requestedOwnedHeadedWindow(options) || lifecycle?.effectiveLaunch.browserLaunched !== true) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const sessionName = options.executionPlan.managedSessionName;
|
|
27
|
+
if (sessionName === undefined ||
|
|
28
|
+
sessionName.length === 0 ||
|
|
29
|
+
!options.managedSessionOutcome ||
|
|
30
|
+
!["created", "replaced"].includes(options.managedSessionOutcome.status)) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return { mode: "headed", ownership: "wrapper-managed", sessionName, visibility: "unverified" };
|
|
34
|
+
}
|
|
35
|
+
export function formatBrowserWindowText(browserWindow) {
|
|
36
|
+
return browserWindow
|
|
37
|
+
? "Headed browser handoff: wrapper-managed headed window requested; desktop visibility unverified. If login is needed, ask the user to confirm they can see the window and finish signing in there, then continue with sessionMode auto."
|
|
38
|
+
: undefined;
|
|
39
|
+
}
|