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,5 +1,22 @@
|
|
|
1
1
|
import { isRecord } from "../parsing.js";
|
|
2
2
|
const RECORDING_QUALITY_WARNING = "Capture quality warning: repaint-driven capture, held/repeated or static frames, and late/final-state-only frames cannot establish UI smoothness. Output FPS is not captured-frame rate; inspect the recording and capture window before judging motion.";
|
|
3
|
+
function getRecordingOutcome(value, outcome) {
|
|
4
|
+
if (typeof value === "boolean" || value === null) {
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
return outcome ?? null;
|
|
8
|
+
}
|
|
9
|
+
function formatRecordingOutcome(receipt) {
|
|
10
|
+
let outcome = "pending/unknown";
|
|
11
|
+
if (receipt.success !== null) {
|
|
12
|
+
outcome = receipt.success ? "succeeded" : "failed";
|
|
13
|
+
}
|
|
14
|
+
const error = receipt.error !== null && receipt.error.length > 0 ? ` — ${receipt.error}` : "";
|
|
15
|
+
return `Native recording outcome: ${outcome}${error}`;
|
|
16
|
+
}
|
|
17
|
+
function recordOrEmpty(value) {
|
|
18
|
+
return isRecord(value) ? value : {};
|
|
19
|
+
}
|
|
3
20
|
function number(value) {
|
|
4
21
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
|
|
5
22
|
}
|
|
@@ -7,34 +24,55 @@ function text(value) {
|
|
|
7
24
|
return typeof value === "string" && value.length > 0 ? value : null;
|
|
8
25
|
}
|
|
9
26
|
export function getRecordingReceipt(value, outcome) {
|
|
10
|
-
if (!isRecord(value) || typeof value.path !== "string" ||
|
|
27
|
+
if (!isRecord(value) || typeof value.path !== "string" || value.path.length === 0) {
|
|
11
28
|
return undefined;
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
29
|
+
}
|
|
30
|
+
const capture = recordOrEmpty(value.capture);
|
|
31
|
+
const output = recordOrEmpty(value.output);
|
|
32
|
+
const file = recordOrEmpty(value.file);
|
|
15
33
|
return {
|
|
16
34
|
warning: RECORDING_QUALITY_WARNING,
|
|
17
|
-
recordingId: text(value.recordingId),
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
recordingId: text(value.recordingId),
|
|
36
|
+
path: value.path,
|
|
37
|
+
success: getRecordingOutcome(value.success, outcome),
|
|
38
|
+
error: text(value.error),
|
|
39
|
+
frames: number(value.frames),
|
|
40
|
+
capturedFrames: number(value.capturedFrames),
|
|
41
|
+
fps: number(value.fps),
|
|
20
42
|
capture: {
|
|
21
|
-
startedAt: text(capture.startedAt),
|
|
22
|
-
|
|
23
|
-
|
|
43
|
+
startedAt: text(capture.startedAt),
|
|
44
|
+
endedAt: text(capture.endedAt),
|
|
45
|
+
durationMs: number(capture.durationMs),
|
|
46
|
+
firstFrameAt: text(capture.firstFrameAt),
|
|
47
|
+
lastFrameAt: text(capture.lastFrameAt),
|
|
48
|
+
firstFrameAfterMs: number(capture.firstFrameAfterMs),
|
|
49
|
+
lastFrameAfterMs: number(capture.lastFrameAfterMs),
|
|
50
|
+
averageFps: number(capture.averageFps),
|
|
51
|
+
maxFrameGapMs: number(capture.maxFrameGapMs),
|
|
52
|
+
timestampSource: text(capture.timestampSource),
|
|
24
53
|
},
|
|
25
54
|
output: {
|
|
26
|
-
frames: number(output.frames ?? value.frames),
|
|
27
|
-
|
|
55
|
+
frames: number(output.frames ?? value.frames),
|
|
56
|
+
fps: number(output.fps ?? value.fps),
|
|
57
|
+
encodedFrames: number(output.encodedFrames),
|
|
58
|
+
durationMs: number(output.durationMs),
|
|
59
|
+
durationSource: text(output.durationSource),
|
|
60
|
+
heldFrames: number(output.heldFrames),
|
|
61
|
+
droppedFrames: number(output.droppedFrames),
|
|
62
|
+
skippedFrames: number(output.skippedFrames),
|
|
28
63
|
encoderSucceeded: typeof output.encoderSucceeded === "boolean" ? output.encoderSucceeded : null,
|
|
29
64
|
},
|
|
30
|
-
file: {
|
|
65
|
+
file: {
|
|
66
|
+
exists: typeof file.exists === "boolean" ? file.exists : null,
|
|
67
|
+
sizeBytes: number(file.sizeBytes),
|
|
68
|
+
},
|
|
31
69
|
};
|
|
32
70
|
}
|
|
33
71
|
export function formatRecordingReceipt(receipt) {
|
|
34
72
|
const metric = (value, unit = "") => value === null ? "unknown" : `${value}${unit}`;
|
|
35
73
|
return [
|
|
36
74
|
`Recording ID: ${metric(receipt.recordingId)}`,
|
|
37
|
-
|
|
75
|
+
formatRecordingOutcome(receipt),
|
|
38
76
|
`Capture started: ${metric(receipt.capture.startedAt)}; ended: ${metric(receipt.capture.endedAt)}`,
|
|
39
77
|
`Wall-clock capture duration: ${metric(receipt.capture.durationMs, " ms")}`,
|
|
40
78
|
`Captured frames (received, not pixel-unique): ${metric(receipt.capturedFrames)}`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildNextToolAction, withOptionalSessionArgs } from "./next-actions.js";
|
|
1
|
+
import { buildNextToolAction, withOptionalSessionArgs, } from "./next-actions.js";
|
|
2
2
|
export const AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS = {
|
|
3
3
|
aboutBlankListTabs: "list-tabs-for-about-blank-recovery",
|
|
4
4
|
connectedSessionGetUrl: "verify-connected-session-url",
|
|
@@ -29,7 +29,9 @@ export function getAgentBrowserRichInputRecoveryNextActionIds(candidateCount) {
|
|
|
29
29
|
return ids;
|
|
30
30
|
}
|
|
31
31
|
function getRecoveryTargetDescription(recovery) {
|
|
32
|
-
const target = [recovery.targetTitle, recovery.targetUrl]
|
|
32
|
+
const target = [recovery.targetTitle, recovery.targetUrl]
|
|
33
|
+
.filter((item) => item !== undefined && item.length > 0)
|
|
34
|
+
.join(" at ");
|
|
33
35
|
return target.length > 0 ? target : "the intended tab";
|
|
34
36
|
}
|
|
35
37
|
function isStableTabId(tab) {
|
|
@@ -49,7 +51,11 @@ function buildTabSnapshotRecoveryAction(options) {
|
|
|
49
51
|
id: options.id,
|
|
50
52
|
reason: `${options.reason} The batch selects and verifies the stable tab before snapshotting.`,
|
|
51
53
|
safety: `${options.safety} A failed tab selection or URL check stops before the snapshot.`,
|
|
52
|
-
stdin: JSON.stringify([
|
|
54
|
+
stdin: JSON.stringify([
|
|
55
|
+
["tab", options.tabId],
|
|
56
|
+
["get", "url"],
|
|
57
|
+
["snapshot", "-i"],
|
|
58
|
+
]),
|
|
53
59
|
});
|
|
54
60
|
}
|
|
55
61
|
export function buildRecoveryNextActions(recovery) {
|
|
@@ -83,12 +89,15 @@ export function buildRecoveryNextActions(recovery) {
|
|
|
83
89
|
const targetDescription = getRecoveryTargetDescription(recovery);
|
|
84
90
|
const listAction = buildNextToolAction({
|
|
85
91
|
args: sessionArgs(["tab", "list"]),
|
|
86
|
-
id: recovery.kind === "about-blank"
|
|
92
|
+
id: recovery.kind === "about-blank"
|
|
93
|
+
? AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.aboutBlankListTabs
|
|
94
|
+
: AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS.tabDriftListTabs,
|
|
87
95
|
reason: `Inspect tabs for ${targetDescription} before continuing after tab drift.`,
|
|
88
96
|
safety: "Read-only tab listing; prefer stable tN tab ids over positional tab guesses.",
|
|
89
97
|
});
|
|
90
|
-
if (!isStableTabId(recovery.selectedTab))
|
|
98
|
+
if (!isStableTabId(recovery.selectedTab)) {
|
|
91
99
|
return [listAction];
|
|
100
|
+
}
|
|
92
101
|
return [
|
|
93
102
|
listAction,
|
|
94
103
|
buildNextToolAction({
|
|
@@ -1,52 +1,60 @@
|
|
|
1
1
|
import { buildAgentBrowserNextActions } from "./action-recommendations.js";
|
|
2
2
|
import { withOptionalSessionArgs } from "./next-actions.js";
|
|
3
3
|
export function buildConnectedSessionNextActions(sessionName) {
|
|
4
|
-
if (
|
|
4
|
+
if ((sessionName ?? "") === "") {
|
|
5
5
|
return [];
|
|
6
|
-
|
|
6
|
+
}
|
|
7
|
+
return (buildAgentBrowserNextActions({
|
|
7
8
|
recovery: { kind: "connected-session", sessionName },
|
|
8
9
|
resultCategory: "success",
|
|
9
10
|
successCategory: "completed",
|
|
10
|
-
}) ?? [];
|
|
11
|
+
}) ?? []);
|
|
11
12
|
}
|
|
12
13
|
export function buildNoActivePageNextActions(sessionName) {
|
|
13
|
-
if (
|
|
14
|
+
if ((sessionName ?? "") === "") {
|
|
14
15
|
return [];
|
|
15
|
-
|
|
16
|
+
}
|
|
17
|
+
return (buildAgentBrowserNextActions({
|
|
16
18
|
recovery: { kind: "no-active-page", sessionName },
|
|
17
19
|
resultCategory: "failure",
|
|
18
|
-
}) ?? [];
|
|
20
|
+
}) ?? []);
|
|
19
21
|
}
|
|
20
22
|
export function buildPendingWebMcpNextActions(sessionName) {
|
|
21
|
-
return [
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
22
25
|
id: "verify-page-target-after-pending-webmcp",
|
|
23
26
|
params: { args: withOptionalSessionArgs(sessionName, ["get", "url"]) },
|
|
24
27
|
reason: "Verify the current page target before taking a fresh snapshot; use webmcp result or cancel to settle the detached invocation.",
|
|
25
28
|
safety: "Read-only URL inspection. It does not settle the pending page tool, which may still mutate or navigate later.",
|
|
26
29
|
tool: "agent_browser",
|
|
27
|
-
}
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
function getSessionTabRecoveryContext(options) {
|
|
34
|
+
return {
|
|
35
|
+
kind: options.kind,
|
|
36
|
+
recoveryApplied: options.recoveryApplied,
|
|
37
|
+
selectedTab: options.tabCorrection?.selectedTab,
|
|
38
|
+
sessionName: options.sessionName,
|
|
39
|
+
targetTitle: options.tabCorrection?.targetTitle ?? options.target?.title,
|
|
40
|
+
targetUrl: options.tabCorrection?.targetUrl ?? options.target?.url,
|
|
41
|
+
};
|
|
28
42
|
}
|
|
29
43
|
export function buildSessionTabRecoveryNextActions(options) {
|
|
30
44
|
const resultCategory = options.resultCategory ?? "success";
|
|
31
|
-
return buildAgentBrowserNextActions({
|
|
32
|
-
recovery:
|
|
33
|
-
kind: options.kind,
|
|
34
|
-
recoveryApplied: options.recoveryApplied,
|
|
35
|
-
selectedTab: options.tabCorrection?.selectedTab,
|
|
36
|
-
sessionName: options.sessionName,
|
|
37
|
-
targetTitle: options.tabCorrection?.targetTitle ?? options.target?.title,
|
|
38
|
-
targetUrl: options.tabCorrection?.targetUrl ?? options.target?.url,
|
|
39
|
-
},
|
|
45
|
+
return (buildAgentBrowserNextActions({
|
|
46
|
+
recovery: getSessionTabRecoveryContext(options),
|
|
40
47
|
resultCategory,
|
|
41
48
|
successCategory: resultCategory === "success" ? "completed" : undefined,
|
|
42
|
-
}) ?? [];
|
|
49
|
+
}) ?? []);
|
|
43
50
|
}
|
|
44
51
|
export function buildSessionAwareStaleRefNextActions(sessionName) {
|
|
45
52
|
return (buildAgentBrowserNextActions({ failureCategory: "stale-ref", resultCategory: "failure" }) ?? []).map((action) => {
|
|
46
53
|
const actionArgs = action.params?.args;
|
|
47
|
-
return {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
return Object.assign({}, action, {
|
|
55
|
+
params: action.params && actionArgs
|
|
56
|
+
? { ...action.params, args: withOptionalSessionArgs(sessionName, actionArgs) }
|
|
57
|
+
: action.params,
|
|
58
|
+
});
|
|
51
59
|
});
|
|
52
60
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const SELECTOR_RECOVERY_ACTION_NAMES = [
|
|
2
|
+
"check",
|
|
3
|
+
"click",
|
|
4
|
+
"fill",
|
|
5
|
+
"select",
|
|
6
|
+
"uncheck",
|
|
7
|
+
];
|
|
8
|
+
function isSelectorRecoveryActionName(action) {
|
|
9
|
+
return SELECTOR_RECOVERY_ACTION_NAMES.some((name) => name === action);
|
|
10
|
+
}
|
|
11
|
+
function getFindNameFlagValue(args, startIndex) {
|
|
12
|
+
const index = args.indexOf("--name", startIndex);
|
|
13
|
+
const name = index >= 0 ? args.at(index + 1) : undefined;
|
|
14
|
+
return name !== undefined && name.length > 0 ? name : undefined;
|
|
15
|
+
}
|
|
16
|
+
function collectFindTrailingValues(args, startIndex) {
|
|
17
|
+
const values = [];
|
|
18
|
+
for (const token of args.slice(startIndex)) {
|
|
19
|
+
if (token.length === 0 || token.startsWith("-")) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
values.push(token);
|
|
23
|
+
}
|
|
24
|
+
return values;
|
|
25
|
+
}
|
|
26
|
+
function getSelectTarget(args, index, locator, value) {
|
|
27
|
+
const optionValues = collectFindTrailingValues(args, index + 4);
|
|
28
|
+
if (locator === "role") {
|
|
29
|
+
if (!/^(?:combobox|listbox)$/i.test(value)) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const targetName = getFindNameFlagValue(args, index + 4);
|
|
33
|
+
return targetName !== undefined
|
|
34
|
+
? { action: "select", optionValues, roles: [value.toLowerCase()], targetName }
|
|
35
|
+
: undefined;
|
|
36
|
+
}
|
|
37
|
+
return locator === "label"
|
|
38
|
+
? { action: "select", optionValues, roles: ["combobox", "listbox"], targetName: value }
|
|
39
|
+
: undefined;
|
|
40
|
+
}
|
|
41
|
+
function getTextTarget(action, locator, targetName, text) {
|
|
42
|
+
if (locator === "text" && action === "click") {
|
|
43
|
+
return { action, roles: ["button", "link"], targetName };
|
|
44
|
+
}
|
|
45
|
+
if ((locator === "text" || locator === "placeholder") && action === "fill") {
|
|
46
|
+
return { action, roles: ["searchbox", "textbox"], targetName, text };
|
|
47
|
+
}
|
|
48
|
+
return locator === "label" && action === "fill"
|
|
49
|
+
? { action, roles: ["textbox"], targetName, text }
|
|
50
|
+
: undefined;
|
|
51
|
+
}
|
|
52
|
+
export function getFindVisibleRefFallbackTarget(args) {
|
|
53
|
+
const index = args[0] === "--session" ? 2 : 0;
|
|
54
|
+
if (args[index] !== "find") {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const locator = args.at(index + 1);
|
|
58
|
+
const value = args.at(index + 2);
|
|
59
|
+
const action = args.at(index + 3);
|
|
60
|
+
if (locator === undefined ||
|
|
61
|
+
locator.length === 0 ||
|
|
62
|
+
value === undefined ||
|
|
63
|
+
value.length === 0 ||
|
|
64
|
+
!isSelectorRecoveryActionName(action)) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return getFindActionTarget(args, { index, locator, value, action });
|
|
68
|
+
}
|
|
69
|
+
function getFindActionTarget(args, command) {
|
|
70
|
+
const { index, locator, value, action } = command;
|
|
71
|
+
if (action === "select") {
|
|
72
|
+
return getSelectTarget(args, index, locator, value);
|
|
73
|
+
}
|
|
74
|
+
const text = action === "fill" ? args.at(index + 4) : undefined;
|
|
75
|
+
if (action === "fill" && (text === undefined || text.length === 0)) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
if (locator === "role") {
|
|
79
|
+
const targetName = getFindNameFlagValue(args, index + 4);
|
|
80
|
+
return targetName !== undefined ? { action, roles: [value], targetName, text } : undefined;
|
|
81
|
+
}
|
|
82
|
+
return getTextTarget(action, locator, value, text);
|
|
83
|
+
}
|
|
@@ -1,105 +1,70 @@
|
|
|
1
1
|
import { isRecord } from "../parsing.js";
|
|
2
|
-
import { extractRefSnapshotFromData } from "../session-page-
|
|
2
|
+
import { extractRefSnapshotFromData } from "../session-page-observation.js";
|
|
3
3
|
import { getEditableRefEvidence } from "./editable-ref-evidence.js";
|
|
4
4
|
import { withOptionalSessionArgs } from "./next-actions.js";
|
|
5
5
|
import { getAgentBrowserRichInputRecoveryNextActionId, getAgentBrowserRichInputRecoveryNextActionIds, } from "./recovery-actions.js";
|
|
6
6
|
import { getSnapshotLineTextByRef, getSnapshotRefRecord, getSnapshotRefRole, } from "./snapshot-refs.js";
|
|
7
7
|
import { compareRefIds } from "./text.js";
|
|
8
|
-
|
|
8
|
+
import { getFindVisibleRefFallbackTarget, } from "./selector-recovery-target.js";
|
|
9
9
|
const VISIBLE_REF_FALLBACK_CANDIDATE_LIMIT = 3;
|
|
10
10
|
const EDITABLE_CONTROL_ROLES = new Set(["combobox", "searchbox", "textbox"]);
|
|
11
11
|
const RICH_INPUT_RECOVERY_EDITABLE_ROLES = new Set(["searchbox", "textbox"]);
|
|
12
12
|
const RICH_INPUT_RECOVERY_HINT = "After the editable ref is focused, use keyboard type when a framework-controlled editor requires real key events. keyboard inserttext is paste-like and needs separate application-state verification. Do not press Enter or otherwise submit unless the user flow explicitly calls for it.";
|
|
13
|
-
function
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const name = nameFlagIndex >= 0 ? args[nameFlagIndex + 1] : undefined;
|
|
19
|
-
return typeof name === "string" && name.length > 0 ? name : undefined;
|
|
20
|
-
}
|
|
21
|
-
function collectFindTrailingValues(args, startIndex) {
|
|
22
|
-
const values = [];
|
|
23
|
-
for (let index = startIndex; index < args.length; index += 1) {
|
|
24
|
-
const token = args[index];
|
|
25
|
-
if (!token || token.startsWith("-"))
|
|
26
|
-
break;
|
|
27
|
-
values.push(token);
|
|
28
|
-
}
|
|
29
|
-
return values;
|
|
13
|
+
export function getVisibleRefFallbackTarget(options) {
|
|
14
|
+
return (getFindVisibleRefFallbackTarget(options.commandTokens) ??
|
|
15
|
+
(options.compiledSemanticAction
|
|
16
|
+
? getFindVisibleRefFallbackTarget(options.compiledSemanticAction.args)
|
|
17
|
+
: undefined));
|
|
30
18
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
if (args[findIndex] !== "find")
|
|
19
|
+
function getDirectRefFallbackArgs(target, ref) {
|
|
20
|
+
if (target.action === "fill") {
|
|
34
21
|
return undefined;
|
|
35
|
-
const locator = args[findIndex + 1];
|
|
36
|
-
const value = args[findIndex + 2];
|
|
37
|
-
const action = args[findIndex + 3];
|
|
38
|
-
if (!locator || !value || !isSelectorRecoveryActionName(action))
|
|
39
|
-
return undefined;
|
|
40
|
-
if (action === "select") {
|
|
41
|
-
const optionValues = collectFindTrailingValues(args, findIndex + 4);
|
|
42
|
-
if (locator === "role") {
|
|
43
|
-
if (!/^(?:combobox|listbox)$/i.test(value))
|
|
44
|
-
return undefined;
|
|
45
|
-
const targetName = getFindNameFlagValue(args, findIndex + 4);
|
|
46
|
-
return targetName ? { action, optionValues, roles: [value.toLowerCase()], targetName } : undefined;
|
|
47
|
-
}
|
|
48
|
-
if (locator === "label") {
|
|
49
|
-
return { action, optionValues, roles: ["combobox", "listbox"], targetName: value };
|
|
50
|
-
}
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
const text = action === "fill" ? args[findIndex + 4] : undefined;
|
|
54
|
-
if (action === "fill" && (!text || (!options.allowLeadingDashFillText && text.startsWith("-"))))
|
|
55
|
-
return undefined;
|
|
56
|
-
if (locator === "role") {
|
|
57
|
-
const targetName = getFindNameFlagValue(args, findIndex + 4);
|
|
58
|
-
return targetName ? { action, roles: [value], targetName, text } : undefined;
|
|
59
|
-
}
|
|
60
|
-
if (locator === "text" && action === "click") {
|
|
61
|
-
return { action, roles: ["button", "link"], targetName: value };
|
|
62
|
-
}
|
|
63
|
-
if (locator === "text" && action === "fill") {
|
|
64
|
-
return { action, roles: ["searchbox", "textbox"], targetName: value, text };
|
|
65
|
-
}
|
|
66
|
-
if (locator === "label" && action === "fill") {
|
|
67
|
-
return { action, roles: ["textbox"], targetName: value, text };
|
|
68
22
|
}
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
23
|
+
if (target.action === "select") {
|
|
24
|
+
return target.optionValues && target.optionValues.length > 0
|
|
25
|
+
? ["select", `@${ref}`, ...target.optionValues]
|
|
26
|
+
: undefined;
|
|
71
27
|
}
|
|
72
|
-
return
|
|
28
|
+
return [target.action, `@${ref}`];
|
|
73
29
|
}
|
|
74
|
-
|
|
75
|
-
return
|
|
30
|
+
function getCandidateEditableEvidence(snapshot, ref, entry, line) {
|
|
31
|
+
return snapshot
|
|
32
|
+
? snapshot.refs?.[ref]?.isEditable
|
|
33
|
+
: getEditableRefEvidence({ ref: entry, text: line });
|
|
34
|
+
}
|
|
35
|
+
function matchesFallbackName(name, targetName) {
|
|
36
|
+
return (name !== undefined &&
|
|
37
|
+
name.length > 0 &&
|
|
38
|
+
normalizeSemanticActionAccessibleName(name) === targetName);
|
|
39
|
+
}
|
|
40
|
+
function isDisallowedEditableFill(action, evidence, role) {
|
|
41
|
+
return action === "fill" && evidence === false && EDITABLE_CONTROL_ROLES.has(role.toLowerCase());
|
|
76
42
|
}
|
|
77
43
|
function getVisibleRefFallbackCandidates(target, snapshotData, refSnapshot) {
|
|
78
44
|
const refs = refSnapshot?.refs ?? getSnapshotRefRecord(snapshotData);
|
|
79
|
-
if (!refs)
|
|
45
|
+
if (!refs) {
|
|
80
46
|
return [];
|
|
47
|
+
}
|
|
81
48
|
const snapshotLineByRef = getSnapshotLineTextByRef(snapshotData);
|
|
82
49
|
const roleOrder = target.roles.map((role) => role.toLowerCase());
|
|
83
50
|
const targetName = normalizeSemanticActionAccessibleName(target.targetName);
|
|
84
51
|
const candidates = Object.entries(refs).flatMap(([ref, entry]) => {
|
|
85
|
-
if (!/^e\d+$/.test(ref) || !isRecord(entry))
|
|
52
|
+
if (!/^e\d+$/.test(ref) || !isRecord(entry)) {
|
|
86
53
|
return [];
|
|
54
|
+
}
|
|
87
55
|
const snapshotLine = snapshotLineByRef.get(ref);
|
|
88
|
-
const editableEvidence = refSnapshot
|
|
56
|
+
const editableEvidence = getCandidateEditableEvidence(refSnapshot, ref, entry, snapshotLine);
|
|
89
57
|
const role = getSnapshotRefRole(entry, editableEvidence);
|
|
90
58
|
const name = typeof entry.name === "string" ? entry.name : undefined;
|
|
91
|
-
if (!
|
|
59
|
+
if (!matchesFallbackName(name, targetName) || !roleOrder.includes(role.toLowerCase())) {
|
|
92
60
|
return [];
|
|
93
|
-
|
|
61
|
+
}
|
|
62
|
+
if (isDisallowedEditableFill(target.action, editableEvidence, role)) {
|
|
94
63
|
return [];
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
: target.action === "select"
|
|
100
|
-
? undefined
|
|
101
|
-
: [target.action, `@${ref}`];
|
|
102
|
-
return [{
|
|
64
|
+
}
|
|
65
|
+
const directRefArgs = getDirectRefFallbackArgs(target, ref);
|
|
66
|
+
return [
|
|
67
|
+
{
|
|
103
68
|
action: target.action,
|
|
104
69
|
...(directRefArgs ? { args: directRefArgs } : {}),
|
|
105
70
|
name,
|
|
@@ -107,34 +72,74 @@ function getVisibleRefFallbackCandidates(target, snapshotData, refSnapshot) {
|
|
|
107
72
|
ref: `@${ref}`,
|
|
108
73
|
role,
|
|
109
74
|
...(editableEvidence !== undefined ? { editableEvidence } : {}),
|
|
110
|
-
}
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
});
|
|
78
|
+
candidates.sort((left, right) => {
|
|
79
|
+
const difference = roleOrder.indexOf(left.role.toLowerCase()) - roleOrder.indexOf(right.role.toLowerCase());
|
|
80
|
+
return difference !== 0 ? difference : compareRefIds(left.ref.slice(1), right.ref.slice(1));
|
|
111
81
|
});
|
|
112
|
-
candidates.sort((left, right) => roleOrder.indexOf(left.role.toLowerCase()) - roleOrder.indexOf(right.role.toLowerCase()) || compareRefIds(left.ref.slice(1), right.ref.slice(1)));
|
|
113
82
|
return candidates.slice(0, VISIBLE_REF_FALLBACK_CANDIDATE_LIMIT);
|
|
114
83
|
}
|
|
115
84
|
export function buildVisibleRefFallbackDiagnosticFromSnapshot(options) {
|
|
116
85
|
const snapshot = extractRefSnapshotFromData(options.snapshotData);
|
|
117
|
-
if (!snapshot)
|
|
86
|
+
if (!snapshot) {
|
|
118
87
|
return undefined;
|
|
88
|
+
}
|
|
119
89
|
const candidates = getVisibleRefFallbackCandidates(options.target, options.snapshotData);
|
|
120
|
-
if (candidates.length === 0)
|
|
90
|
+
if (candidates.length === 0) {
|
|
121
91
|
return undefined;
|
|
92
|
+
}
|
|
122
93
|
return {
|
|
123
94
|
candidates,
|
|
124
95
|
snapshot,
|
|
125
96
|
summary: candidates.length === 1
|
|
126
97
|
? `Current snapshot has one exact visible ref match for ${options.target.action} ${JSON.stringify(options.target.targetName)}.`
|
|
127
98
|
: `Current snapshot has ${candidates.length} exact visible ref matches for ${options.target.action} ${JSON.stringify(options.target.targetName)}; choose only if the intended control is unambiguous.`,
|
|
128
|
-
target: {
|
|
99
|
+
target: {
|
|
100
|
+
action: options.target.action,
|
|
101
|
+
roles: options.target.roles,
|
|
102
|
+
targetName: options.target.targetName,
|
|
103
|
+
},
|
|
129
104
|
};
|
|
130
105
|
}
|
|
106
|
+
function resolveFillCandidateArgs(candidates, text, allowFill) {
|
|
107
|
+
if (allowFill !== true || candidates.length !== 1 || text === undefined) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const candidate = candidates.at(0);
|
|
111
|
+
if (!candidate ||
|
|
112
|
+
candidate.editableEvidence === false ||
|
|
113
|
+
!EDITABLE_CONTROL_ROLES.has(candidate.role.toLowerCase())) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
return ["fill", candidate.ref, text];
|
|
117
|
+
}
|
|
118
|
+
function resolveSelectCandidateArgs(candidates, values) {
|
|
119
|
+
if (candidates.length !== 1 || !values || values.length === 0) {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
const candidate = candidates.at(0);
|
|
123
|
+
return candidate ? ["select", candidate.ref, ...values] : undefined;
|
|
124
|
+
}
|
|
125
|
+
function resolveCandidateArgs(target, candidates, allowFill, selectValues) {
|
|
126
|
+
if (target.action === "fill") {
|
|
127
|
+
return resolveFillCandidateArgs(candidates, target.text, allowFill);
|
|
128
|
+
}
|
|
129
|
+
if (target.action === "select") {
|
|
130
|
+
return resolveSelectCandidateArgs(candidates, selectValues);
|
|
131
|
+
}
|
|
132
|
+
return candidates.find((candidate) => candidate.args !== undefined)?.args;
|
|
133
|
+
}
|
|
131
134
|
export function resolveVisibleRefActionFromSnapshot(options) {
|
|
132
|
-
const target = getFindVisibleRefFallbackTarget(options.compiledAction.args
|
|
133
|
-
if (!target)
|
|
135
|
+
const target = getFindVisibleRefFallbackTarget(options.compiledAction.args);
|
|
136
|
+
if (!target) {
|
|
134
137
|
return undefined;
|
|
138
|
+
}
|
|
135
139
|
const snapshot = options.refSnapshot ?? extractRefSnapshotFromData(options.snapshotData);
|
|
136
|
-
if (!snapshot)
|
|
140
|
+
if (!snapshot) {
|
|
137
141
|
return undefined;
|
|
142
|
+
}
|
|
138
143
|
const selectOptionValues = options.compiledAction.values && options.compiledAction.values.length > 0
|
|
139
144
|
? options.compiledAction.values
|
|
140
145
|
: target.optionValues;
|
|
@@ -142,45 +147,32 @@ export function resolveVisibleRefActionFromSnapshot(options) {
|
|
|
142
147
|
? { ...target, optionValues: selectOptionValues }
|
|
143
148
|
: target;
|
|
144
149
|
const candidates = getVisibleRefFallbackCandidates(effectiveTarget, options.snapshotData, options.refSnapshot);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return undefined;
|
|
148
|
-
const [candidate] = candidates;
|
|
149
|
-
if (!candidate || candidate.editableEvidence === false || !EDITABLE_CONTROL_ROLES.has(candidate.role.toLowerCase()))
|
|
150
|
-
return undefined;
|
|
151
|
-
return { args: ["fill", candidate.ref, effectiveTarget.text], snapshot };
|
|
152
|
-
}
|
|
153
|
-
if (effectiveTarget.action === "select") {
|
|
154
|
-
if (candidates.length !== 1 || !selectOptionValues || selectOptionValues.length === 0)
|
|
155
|
-
return undefined;
|
|
156
|
-
const [candidate] = candidates;
|
|
157
|
-
if (!candidate)
|
|
158
|
-
return undefined;
|
|
159
|
-
return { args: ["select", candidate.ref, ...selectOptionValues], snapshot };
|
|
160
|
-
}
|
|
161
|
-
const candidate = candidates.find((item) => item.args !== undefined);
|
|
162
|
-
if (!candidate?.args)
|
|
163
|
-
return undefined;
|
|
164
|
-
return { args: candidate.args, snapshot };
|
|
150
|
+
const args = resolveCandidateArgs(effectiveTarget, candidates, options.allowFill, selectOptionValues);
|
|
151
|
+
return args ? { args, snapshot } : undefined;
|
|
165
152
|
}
|
|
166
153
|
export function buildVisibleRefFallbackNextActions(options) {
|
|
167
154
|
const ambiguous = options.diagnostic.candidates.length > 1;
|
|
168
|
-
return options.diagnostic.candidates.flatMap((candidate, index) => candidate.args
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
:
|
|
175
|
-
|
|
176
|
-
|
|
155
|
+
return options.diagnostic.candidates.flatMap((candidate, index) => candidate.args
|
|
156
|
+
? [
|
|
157
|
+
{
|
|
158
|
+
id: ambiguous ? `try-current-visible-ref-${index + 1}` : "try-current-visible-ref",
|
|
159
|
+
params: { args: withOptionalSessionArgs(options.sessionName, candidate.args) },
|
|
160
|
+
reason: candidate.reason,
|
|
161
|
+
safety: ambiguous
|
|
162
|
+
? "Several current refs share the same exact role/name. Inspect the snapshot and use only the ref that clearly matches the intended target."
|
|
163
|
+
: "Use only while this current snapshot still represents the page; refresh refs first if the page changed.",
|
|
164
|
+
tool: "agent_browser",
|
|
165
|
+
},
|
|
166
|
+
]
|
|
167
|
+
: []);
|
|
177
168
|
}
|
|
178
169
|
export function formatVisibleRefFallbackText(diagnostic) {
|
|
179
|
-
if (!diagnostic)
|
|
170
|
+
if (!diagnostic) {
|
|
180
171
|
return undefined;
|
|
172
|
+
}
|
|
181
173
|
return [
|
|
182
174
|
"Current snapshot ref fallback:",
|
|
183
|
-
...diagnostic.candidates.map((candidate) => `- ${candidate.ref}${candidate.role ? ` ${candidate.role}` : ""} ${JSON.stringify(candidate.name)}: ${candidate.reason}`),
|
|
175
|
+
...diagnostic.candidates.map((candidate) => `- ${candidate.ref}${candidate.role.length > 0 ? ` ${candidate.role}` : ""} ${JSON.stringify(candidate.name)}: ${candidate.reason}`),
|
|
184
176
|
].join("\n");
|
|
185
177
|
}
|
|
186
178
|
export function sanitizeVisibleRefFallbackDiagnostic(diagnostic) {
|
|
@@ -192,12 +184,17 @@ export function sanitizeVisibleRefFallbackDiagnostic(diagnostic) {
|
|
|
192
184
|
};
|
|
193
185
|
}
|
|
194
186
|
function isRichInputRecoveryCandidate(candidate) {
|
|
195
|
-
return candidate.action === "fill" &&
|
|
187
|
+
return (candidate.action === "fill" &&
|
|
188
|
+
candidate.editableEvidence !== false &&
|
|
189
|
+
RICH_INPUT_RECOVERY_EDITABLE_ROLES.has(candidate.role.toLowerCase()));
|
|
196
190
|
}
|
|
197
191
|
export function buildRichInputRecoveryDiagnostic(diagnostic) {
|
|
198
|
-
if (!diagnostic || diagnostic.target.action !== "fill")
|
|
192
|
+
if (!diagnostic || diagnostic.target.action !== "fill") {
|
|
199
193
|
return undefined;
|
|
200
|
-
|
|
194
|
+
}
|
|
195
|
+
const candidates = diagnostic.candidates
|
|
196
|
+
.filter(isRichInputRecoveryCandidate)
|
|
197
|
+
.map((candidate) => ({
|
|
201
198
|
clickArgs: ["click", candidate.ref],
|
|
202
199
|
focusArgs: ["focus", candidate.ref],
|
|
203
200
|
name: candidate.name,
|
|
@@ -205,8 +202,9 @@ export function buildRichInputRecoveryDiagnostic(diagnostic) {
|
|
|
205
202
|
ref: candidate.ref,
|
|
206
203
|
role: candidate.role,
|
|
207
204
|
}));
|
|
208
|
-
if (candidates.length === 0)
|
|
205
|
+
if (candidates.length === 0) {
|
|
209
206
|
return undefined;
|
|
207
|
+
}
|
|
210
208
|
return {
|
|
211
209
|
candidates,
|
|
212
210
|
inputMethodHint: RICH_INPUT_RECOVERY_HINT,
|
|
@@ -245,13 +243,15 @@ export function buildRichInputRecoveryNextActions(options) {
|
|
|
245
243
|
});
|
|
246
244
|
}
|
|
247
245
|
export function formatRichInputRecoveryText(diagnostic) {
|
|
248
|
-
if (!diagnostic)
|
|
246
|
+
if (!diagnostic) {
|
|
249
247
|
return undefined;
|
|
248
|
+
}
|
|
250
249
|
return [
|
|
251
250
|
"Rich input recovery:",
|
|
252
251
|
...diagnostic.candidates.map((candidate, index) => {
|
|
253
|
-
const
|
|
254
|
-
|
|
252
|
+
const focusId = diagnostic.nextActionIds.at(index * 2);
|
|
253
|
+
const clickId = diagnostic.nextActionIds.at(index * 2 + 1);
|
|
254
|
+
return `- ${candidate.ref} ${candidate.role} ${JSON.stringify(candidate.name)}: use ${focusId ?? "undefined"} or ${clickId ?? "undefined"}; then use keyboard type for framework-controlled editors, or paste-like keyboard inserttext only with separate application-state verification.`;
|
|
255
255
|
}),
|
|
256
256
|
`- ${diagnostic.inputMethodHint}`,
|
|
257
257
|
].join("\n");
|