pi-agent-browser-native 0.9.3 → 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 +77 -5
- package/README.md +103 -81
- package/dist/extensions/agent-browser/index.js +43057 -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 +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 +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 +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 +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 +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 -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 +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 -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 +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 -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 +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 -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 +104 -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 +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 +17 -5
- package/docs/CODE_QUALITY.md +242 -0
- package/docs/COMMAND_REFERENCE.md +251 -220
- package/docs/ELECTRON.md +53 -44
- package/docs/RELEASE.md +18 -15
- package/docs/REQUIREMENTS.md +1 -0
- package/docs/SUPPORT_MATRIX.md +76 -75
- package/docs/TOOL_CONTRACT.md +145 -116
- 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
|
@@ -9,145 +9,235 @@ export function getCompiledSemanticActionSessionPrefix(compiled) {
|
|
|
9
9
|
return commandIndex > 0 ? compiled.args.slice(0, commandIndex) : [];
|
|
10
10
|
}
|
|
11
11
|
export function isCompiledSemanticActionFindCommand(compiled) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
return (compiled !== undefined &&
|
|
13
|
+
compiled.action !== "select" &&
|
|
14
|
+
compiled.args[getCompiledSemanticActionCommandIndex(compiled)] === "find");
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
function sessionArgs(session, args) {
|
|
17
|
+
return typeof session === "string" ? ["--session", session, ...args] : [...args];
|
|
18
|
+
}
|
|
19
|
+
function textError(action, text) {
|
|
20
|
+
if (text !== undefined && typeof text !== "string") {
|
|
21
|
+
return "semanticAction.text must be a string when provided.";
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const value = input.value;
|
|
23
|
-
const values = input.values;
|
|
24
|
-
const selector = input.selector;
|
|
25
|
-
const text = input.text;
|
|
26
|
-
const role = input.role;
|
|
27
|
-
const name = typeof input.name === "string" && input.name.trim().length === 0 ? undefined : input.name;
|
|
28
|
-
const session = input.session;
|
|
29
|
-
if (typeof action !== "string" || !AGENT_BROWSER_SEMANTIC_ACTIONS.includes(action)) {
|
|
30
|
-
return { error: `semanticAction.action must be one of: ${AGENT_BROWSER_SEMANTIC_ACTIONS.join(", ")}.` };
|
|
31
|
-
}
|
|
32
|
-
if (session !== undefined && (typeof session !== "string" || session.trim().length === 0)) {
|
|
33
|
-
return { error: "semanticAction.session must be a non-empty string when provided." };
|
|
23
|
+
if (action === "fill" && (typeof text !== "string" || text.length === 0)) {
|
|
24
|
+
return `semanticAction.text is required for ${action}.`;
|
|
34
25
|
}
|
|
35
|
-
if (action
|
|
36
|
-
|
|
37
|
-
return { error: "semanticAction.text is not supported for select; use value or values for option values." };
|
|
38
|
-
}
|
|
39
|
-
if (typeof selector === "string" && selector.trim().length > 0) {
|
|
40
|
-
if (locator !== undefined || role !== undefined || name !== undefined) {
|
|
41
|
-
return { error: "semanticAction.selector cannot be combined with locator, role, or name for select; use selector plus value/values, or locator fields plus values." };
|
|
42
|
-
}
|
|
43
|
-
const selectedValues = getSelectValues(input, "semanticAction");
|
|
44
|
-
if (selectedValues.error)
|
|
45
|
-
return { error: selectedValues.error };
|
|
46
|
-
const args = typeof session === "string" ? ["--session", session, "select", selector, ...selectedValues.values] : ["select", selector, ...selectedValues.values];
|
|
47
|
-
return { compiled: { action: "select", selector, values: selectedValues.values, args } };
|
|
48
|
-
}
|
|
49
|
-
if (selector !== undefined) {
|
|
50
|
-
return { error: "semanticAction.selector must be a non-empty string when provided." };
|
|
51
|
-
}
|
|
52
|
-
if (locator === undefined) {
|
|
53
|
-
return { error: "semanticAction.selector or semanticAction.locator is required for select." };
|
|
54
|
-
}
|
|
55
|
-
if (locator !== "role" && locator !== "label") {
|
|
56
|
-
return { error: "semanticAction select locator must be role or label; use selector plus value/values for other targets." };
|
|
57
|
-
}
|
|
58
|
-
if (locator === "role") {
|
|
59
|
-
if (typeof role !== "string" || !/^(?:combobox|listbox)$/i.test(role)) {
|
|
60
|
-
return { error: "semanticAction.role must be combobox or listbox for locator=role select." };
|
|
61
|
-
}
|
|
62
|
-
if (typeof name !== "string" || name.trim().length === 0) {
|
|
63
|
-
return { error: "semanticAction.name is required for locator=role select." };
|
|
64
|
-
}
|
|
65
|
-
const optionValues = getSelectValues({ value, values }, "semanticAction");
|
|
66
|
-
if (optionValues.error)
|
|
67
|
-
return { error: optionValues.error };
|
|
68
|
-
const args = typeof session === "string"
|
|
69
|
-
? ["--session", session, "find", "role", role, "select", ...optionValues.values, "--name", name]
|
|
70
|
-
: ["find", "role", role, "select", ...optionValues.values, "--name", name];
|
|
71
|
-
return { compiled: { action: "select", locator: "role", values: optionValues.values, args } };
|
|
72
|
-
}
|
|
73
|
-
if (typeof value !== "string" || value.trim().length === 0) {
|
|
74
|
-
return { error: "semanticAction.value must be the accessible label text for locator=label select." };
|
|
75
|
-
}
|
|
76
|
-
if (role !== undefined || name !== undefined) {
|
|
77
|
-
return { error: "semanticAction.role and name are only supported for locator=role select." };
|
|
78
|
-
}
|
|
79
|
-
const optionValues = getSelectValues({ values }, "semanticAction");
|
|
80
|
-
if (optionValues.error) {
|
|
81
|
-
return { error: optionValues.error.includes("required")
|
|
82
|
-
? "semanticAction.values is required for locator=label select (value is the label text)."
|
|
83
|
-
: optionValues.error };
|
|
84
|
-
}
|
|
85
|
-
const args = typeof session === "string"
|
|
86
|
-
? ["--session", session, "find", "label", value, "select", ...optionValues.values]
|
|
87
|
-
: ["find", "label", value, "select", ...optionValues.values];
|
|
88
|
-
return { compiled: { action: "select", locator: "label", values: optionValues.values, args } };
|
|
89
|
-
}
|
|
90
|
-
if (values !== undefined) {
|
|
91
|
-
return { error: "semanticAction.values is only supported for select actions." };
|
|
26
|
+
if (action !== "fill" && text !== undefined) {
|
|
27
|
+
return "semanticAction.text is only supported for fill actions.";
|
|
92
28
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
function directAction(input, action, selector) {
|
|
32
|
+
if (input.locator !== undefined ||
|
|
33
|
+
input.value !== undefined ||
|
|
34
|
+
input.role !== undefined ||
|
|
35
|
+
input.name !== undefined) {
|
|
36
|
+
return {
|
|
37
|
+
error: "semanticAction.selector cannot be combined with locator, value, role, or name; use selector for a direct click/check/fill target or locator fields for find-based actions.",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const error = textError(action, input.text);
|
|
41
|
+
if (error !== undefined) {
|
|
42
|
+
return { error };
|
|
43
|
+
}
|
|
44
|
+
const args = sessionArgs(input.session, [action, selector]);
|
|
45
|
+
if (action === "fill" && typeof input.text === "string") {
|
|
46
|
+
args.push(input.text);
|
|
47
|
+
}
|
|
48
|
+
return { compiled: { action, selector, args } };
|
|
49
|
+
}
|
|
50
|
+
function roleSelect(input) {
|
|
51
|
+
const { role, name } = input;
|
|
52
|
+
if (typeof role !== "string" || !/^(?:combobox|listbox)$/i.test(role)) {
|
|
53
|
+
return { error: "semanticAction.role must be combobox or listbox for locator=role select." };
|
|
54
|
+
}
|
|
55
|
+
if (typeof name !== "string" || name.trim().length === 0) {
|
|
56
|
+
return { error: "semanticAction.name is required for locator=role select." };
|
|
57
|
+
}
|
|
58
|
+
const options = getSelectValues({ value: input.value, values: input.values }, "semanticAction");
|
|
59
|
+
if (options.error !== undefined) {
|
|
60
|
+
return { error: options.error };
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
compiled: {
|
|
64
|
+
action: "select",
|
|
65
|
+
locator: "role",
|
|
66
|
+
values: options.values,
|
|
67
|
+
args: sessionArgs(input.session, [
|
|
68
|
+
"find",
|
|
69
|
+
"role",
|
|
70
|
+
role,
|
|
71
|
+
"select",
|
|
72
|
+
...options.values,
|
|
73
|
+
"--name",
|
|
74
|
+
name,
|
|
75
|
+
]),
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function labelSelect(input) {
|
|
80
|
+
if (typeof input.value !== "string" || input.value.trim().length === 0) {
|
|
81
|
+
return {
|
|
82
|
+
error: "semanticAction.value must be the accessible label text for locator=label select.",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (input.role !== undefined || input.name !== undefined) {
|
|
86
|
+
return { error: "semanticAction.role and name are only supported for locator=role select." };
|
|
87
|
+
}
|
|
88
|
+
const options = getSelectValues({ values: input.values }, "semanticAction");
|
|
89
|
+
if (options.error !== undefined) {
|
|
90
|
+
return {
|
|
91
|
+
error: options.error.includes("required")
|
|
92
|
+
? "semanticAction.values is required for locator=label select (value is the label text)."
|
|
93
|
+
: options.error,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
compiled: {
|
|
98
|
+
action: "select",
|
|
99
|
+
locator: "label",
|
|
100
|
+
values: options.values,
|
|
101
|
+
args: sessionArgs(input.session, ["find", "label", input.value, "select", ...options.values]),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function selectAction(input) {
|
|
106
|
+
if (input.text !== undefined) {
|
|
107
|
+
return {
|
|
108
|
+
error: "semanticAction.text is not supported for select; use value or values for option values.",
|
|
109
|
+
};
|
|
126
110
|
}
|
|
127
|
-
if (
|
|
128
|
-
return
|
|
111
|
+
if (typeof input.selector === "string" && input.selector.trim().length > 0) {
|
|
112
|
+
return directSelect(input, input.selector);
|
|
129
113
|
}
|
|
130
|
-
if (
|
|
131
|
-
return { error:
|
|
114
|
+
if (input.selector !== undefined) {
|
|
115
|
+
return { error: "semanticAction.selector must be a non-empty string when provided." };
|
|
132
116
|
}
|
|
133
|
-
if (
|
|
134
|
-
return { error: "semanticAction.
|
|
117
|
+
if (input.locator === undefined) {
|
|
118
|
+
return { error: "semanticAction.selector or semanticAction.locator is required for select." };
|
|
135
119
|
}
|
|
136
|
-
if (
|
|
137
|
-
return {
|
|
120
|
+
if (input.locator !== "role" && input.locator !== "label") {
|
|
121
|
+
return {
|
|
122
|
+
error: "semanticAction select locator must be role or label; use selector plus value/values for other targets.",
|
|
123
|
+
};
|
|
138
124
|
}
|
|
139
|
-
|
|
140
|
-
|
|
125
|
+
return input.locator === "role" ? roleSelect(input) : labelSelect(input);
|
|
126
|
+
}
|
|
127
|
+
function directSelect(input, selector) {
|
|
128
|
+
if (input.locator !== undefined || input.role !== undefined || input.name !== undefined) {
|
|
129
|
+
return {
|
|
130
|
+
error: "semanticAction.selector cannot be combined with locator, role, or name for select; use selector plus value/values, or locator fields plus values.",
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const options = getSelectValues(input, "semanticAction");
|
|
134
|
+
if (options.error !== undefined) {
|
|
135
|
+
return { error: options.error };
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
compiled: {
|
|
139
|
+
action: "select",
|
|
140
|
+
selector,
|
|
141
|
+
values: options.values,
|
|
142
|
+
args: sessionArgs(input.session, ["select", selector, ...options.values]),
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function locatorValueError(input) {
|
|
147
|
+
if (input.value !== undefined &&
|
|
148
|
+
(typeof input.value !== "string" || input.value.trim().length === 0)) {
|
|
149
|
+
return "semanticAction.value must be a non-empty string when provided.";
|
|
141
150
|
}
|
|
142
|
-
if (
|
|
143
|
-
|
|
151
|
+
if (input.role !== undefined &&
|
|
152
|
+
(typeof input.role !== "string" || input.role.trim().length === 0)) {
|
|
153
|
+
return "semanticAction.role must be a non-empty string when provided.";
|
|
144
154
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
function roleFieldsError(input, locator) {
|
|
158
|
+
if (input.role !== undefined && locator !== "role") {
|
|
159
|
+
return "semanticAction.role is only supported for locator=role.";
|
|
160
|
+
}
|
|
161
|
+
if (input.role !== undefined && input.value !== undefined && input.role !== input.value) {
|
|
162
|
+
return "semanticAction.role must match value when both are provided for locator=role.";
|
|
163
|
+
}
|
|
164
|
+
if (input.name !== undefined &&
|
|
165
|
+
(locator !== "role" || typeof input.name !== "string" || input.name.length === 0)) {
|
|
166
|
+
return "semanticAction.name is only supported as a non-empty string for locator=role.";
|
|
167
|
+
}
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
function findAction(input, action) {
|
|
171
|
+
const locator = AGENT_BROWSER_SEMANTIC_LOCATORS.find((value) => value === input.locator);
|
|
172
|
+
if (locator === undefined) {
|
|
173
|
+
return {
|
|
174
|
+
error: `semanticAction.locator must be one of: ${AGENT_BROWSER_SEMANTIC_LOCATORS.join(", ")}.`,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
const valueError = locatorValueError(input);
|
|
178
|
+
if (valueError !== undefined) {
|
|
179
|
+
return { error: valueError };
|
|
180
|
+
}
|
|
181
|
+
const locatorValue = locator === "role" && typeof input.role === "string" ? input.role : input.value;
|
|
182
|
+
if (typeof locatorValue !== "string" || locatorValue.trim().length === 0) {
|
|
183
|
+
return {
|
|
184
|
+
error: locator === "role"
|
|
185
|
+
? "semanticAction.value or semanticAction.role must be a non-empty string for locator=role."
|
|
186
|
+
: "semanticAction.value must be a non-empty string.",
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const error = textError(action, input.text) ?? roleFieldsError(input, locator);
|
|
190
|
+
if (error !== undefined) {
|
|
191
|
+
return { error };
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
compiled: { action, locator, args: findActionArgs(input, { action, locator, locatorValue }) },
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function findActionArgs(input, target) {
|
|
198
|
+
const args = sessionArgs(input.session, [
|
|
199
|
+
"find",
|
|
200
|
+
target.locator,
|
|
201
|
+
target.locatorValue,
|
|
202
|
+
target.action,
|
|
203
|
+
]);
|
|
204
|
+
if (target.action === "fill" && typeof input.text === "string") {
|
|
205
|
+
args.push(input.text);
|
|
206
|
+
}
|
|
207
|
+
if (target.locator === "role" && typeof input.name === "string") {
|
|
208
|
+
args.push("--name", input.name);
|
|
209
|
+
}
|
|
210
|
+
return args;
|
|
211
|
+
}
|
|
212
|
+
function nonSelectAction(input, action) {
|
|
213
|
+
if (input.values !== undefined) {
|
|
214
|
+
return { error: "semanticAction.values is only supported for select actions." };
|
|
148
215
|
}
|
|
149
|
-
if (
|
|
150
|
-
|
|
216
|
+
if (input.selector === undefined) {
|
|
217
|
+
return findAction(input, action);
|
|
218
|
+
}
|
|
219
|
+
if (typeof input.selector !== "string" || input.selector.trim().length === 0) {
|
|
220
|
+
return { error: "semanticAction.selector must be a non-empty string when provided." };
|
|
221
|
+
}
|
|
222
|
+
return directAction(input, action, input.selector);
|
|
223
|
+
}
|
|
224
|
+
export function compileAgentBrowserSemanticAction(input) {
|
|
225
|
+
if (!isRecord(input)) {
|
|
226
|
+
return { error: "semanticAction must be an object." };
|
|
227
|
+
}
|
|
228
|
+
const action = AGENT_BROWSER_SEMANTIC_ACTIONS.find((value) => value === input.action);
|
|
229
|
+
if (action === undefined) {
|
|
230
|
+
return {
|
|
231
|
+
error: `semanticAction.action must be one of: ${AGENT_BROWSER_SEMANTIC_ACTIONS.join(", ")}.`,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
if (input.session !== undefined &&
|
|
235
|
+
(typeof input.session !== "string" || input.session.trim().length === 0)) {
|
|
236
|
+
return { error: "semanticAction.session must be a non-empty string when provided." };
|
|
151
237
|
}
|
|
152
|
-
|
|
238
|
+
const normalized = {
|
|
239
|
+
...input,
|
|
240
|
+
name: typeof input.name === "string" && input.name.trim().length === 0 ? undefined : input.name,
|
|
241
|
+
};
|
|
242
|
+
return action === "select" ? selectAction(normalized) : nonSelectAction(normalized, action);
|
|
153
243
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { isRecord } from "../parsing.js";
|
|
2
|
-
import { SOURCE_LOOKUP_DEFAULT_MAX_WORKSPACE_FILES, SOURCE_LOOKUP_MAX_WORKSPACE_FILES } from "./types.js";
|
|
2
|
+
import { SOURCE_LOOKUP_DEFAULT_MAX_WORKSPACE_FILES, SOURCE_LOOKUP_MAX_WORKSPACE_FILES, } from "./types.js";
|
|
3
|
+
function isString(value) {
|
|
4
|
+
return typeof value === "string";
|
|
5
|
+
}
|
|
6
|
+
export function isStringArray(value) {
|
|
7
|
+
return Array.isArray(value) && value.every(isString);
|
|
8
|
+
}
|
|
3
9
|
export function getSelectValues(input, context) {
|
|
4
10
|
const rawValue = input.value;
|
|
5
11
|
const rawValues = input.values;
|
|
@@ -7,8 +13,12 @@ export function getSelectValues(input, context) {
|
|
|
7
13
|
return { error: `${context}.value and ${context}.values cannot both be provided for select.` };
|
|
8
14
|
}
|
|
9
15
|
if (rawValues !== undefined) {
|
|
10
|
-
if (!
|
|
11
|
-
|
|
16
|
+
if (!isStringArray(rawValues) ||
|
|
17
|
+
rawValues.length === 0 ||
|
|
18
|
+
rawValues.some((value) => value.trim().length === 0)) {
|
|
19
|
+
return {
|
|
20
|
+
error: `${context}.values must be a non-empty array of non-empty strings for select.`,
|
|
21
|
+
};
|
|
12
22
|
}
|
|
13
23
|
return { values: rawValues };
|
|
14
24
|
}
|
|
@@ -25,8 +35,9 @@ export function getCommandNameFromBatchItem(item) {
|
|
|
25
35
|
return Array.isArray(command) && typeof command[0] === "string" ? command[0] : undefined;
|
|
26
36
|
}
|
|
27
37
|
export function validateLookupMaxWorkspaceFiles(value, fieldName) {
|
|
28
|
-
if (value === undefined)
|
|
38
|
+
if (value === undefined) {
|
|
29
39
|
return { value: SOURCE_LOOKUP_DEFAULT_MAX_WORKSPACE_FILES };
|
|
40
|
+
}
|
|
30
41
|
if (typeof value !== "number" || !Number.isInteger(value) || value <= 0) {
|
|
31
42
|
return { error: `${fieldName} must be a positive integer when provided.` };
|
|
32
43
|
}
|
|
@@ -1,16 +1,65 @@
|
|
|
1
1
|
export const DEFAULT_SESSION_MODE = "auto";
|
|
2
2
|
export const AGENT_BROWSER_CODE_MAX_TIMEOUT_MS = 300_000;
|
|
3
3
|
export const AGENT_BROWSER_SEMANTIC_ACTIONS = ["check", "click", "fill", "select"];
|
|
4
|
-
export const AGENT_BROWSER_SEMANTIC_LOCATORS = [
|
|
5
|
-
|
|
4
|
+
export const AGENT_BROWSER_SEMANTIC_LOCATORS = [
|
|
5
|
+
"alt",
|
|
6
|
+
"label",
|
|
7
|
+
"placeholder",
|
|
8
|
+
"role",
|
|
9
|
+
"testid",
|
|
10
|
+
"text",
|
|
11
|
+
"title",
|
|
12
|
+
];
|
|
13
|
+
const AGENT_BROWSER_JOB_STEP_ACTIONS = [
|
|
14
|
+
"open",
|
|
15
|
+
"click",
|
|
16
|
+
"fill",
|
|
17
|
+
"type",
|
|
18
|
+
"select",
|
|
19
|
+
"wait",
|
|
20
|
+
"assertText",
|
|
21
|
+
"assertUrl",
|
|
22
|
+
"waitForDownload",
|
|
23
|
+
"screenshot",
|
|
24
|
+
"snapshot",
|
|
25
|
+
];
|
|
6
26
|
export const AGENT_BROWSER_QA_LOAD_STATES = ["domcontentloaded", "load", "networkidle"];
|
|
7
|
-
export const AGENT_BROWSER_ELECTRON_ACTIONS = [
|
|
27
|
+
export const AGENT_BROWSER_ELECTRON_ACTIONS = [
|
|
28
|
+
"list",
|
|
29
|
+
"launch",
|
|
30
|
+
"status",
|
|
31
|
+
"cleanup",
|
|
32
|
+
"probe",
|
|
33
|
+
];
|
|
8
34
|
export const AGENT_BROWSER_ELECTRON_HANDOFFS = ["connect", "tabs", "snapshot"];
|
|
9
35
|
export const AGENT_BROWSER_ELECTRON_TARGET_TYPES = ["page", "webview", "any"];
|
|
10
|
-
export const AGENT_BROWSER_ELECTRON_LIST_FIELDS =
|
|
11
|
-
|
|
12
|
-
|
|
36
|
+
export const AGENT_BROWSER_ELECTRON_LIST_FIELDS = [
|
|
37
|
+
"action",
|
|
38
|
+
"query",
|
|
39
|
+
"maxResults",
|
|
40
|
+
];
|
|
41
|
+
export const AGENT_BROWSER_ELECTRON_PROBE_FIELDS = [
|
|
42
|
+
"action",
|
|
43
|
+
"launchId",
|
|
44
|
+
"timeoutMs",
|
|
45
|
+
];
|
|
46
|
+
export const AGENT_BROWSER_ELECTRON_RESERVED_APP_ARGS = [
|
|
47
|
+
"--user-data-dir",
|
|
48
|
+
"--remote-debugging-port",
|
|
49
|
+
"--remote-debugging-address",
|
|
50
|
+
"--remote-debugging-pipe",
|
|
51
|
+
];
|
|
13
52
|
export const SOURCE_LOOKUP_WORKSPACE_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx"]);
|
|
14
|
-
export const SOURCE_LOOKUP_IGNORED_DIRECTORIES = new Set([
|
|
53
|
+
export const SOURCE_LOOKUP_IGNORED_DIRECTORIES = new Set([
|
|
54
|
+
".git",
|
|
55
|
+
"node_modules",
|
|
56
|
+
"dist",
|
|
57
|
+
"build",
|
|
58
|
+
"coverage",
|
|
59
|
+
".next",
|
|
60
|
+
"out",
|
|
61
|
+
"tmp",
|
|
62
|
+
"temp",
|
|
63
|
+
]);
|
|
15
64
|
export const SOURCE_LOOKUP_DEFAULT_MAX_WORKSPACE_FILES = 2_000;
|
|
16
65
|
export const SOURCE_LOOKUP_MAX_WORKSPACE_FILES = 5_000;
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
const OPTIONAL_SCHEMA = Symbol("pi-agent-browser-optional-schema");
|
|
2
2
|
function withOptions(schema, options) {
|
|
3
|
-
return { ...schema, ...
|
|
3
|
+
return { ...schema, ...options };
|
|
4
4
|
}
|
|
5
5
|
function literalType(value) {
|
|
6
6
|
const valueType = typeof value;
|
|
7
|
-
return valueType === "string" || valueType === "number" || valueType === "boolean"
|
|
7
|
+
return valueType === "string" || valueType === "number" || valueType === "boolean"
|
|
8
|
+
? valueType
|
|
9
|
+
: undefined;
|
|
8
10
|
}
|
|
9
11
|
function propertySchema(schema) {
|
|
10
12
|
const clone = { ...schema };
|
|
11
|
-
|
|
13
|
+
if (OPTIONAL_SCHEMA in clone) {
|
|
14
|
+
delete clone[OPTIONAL_SCHEMA];
|
|
15
|
+
}
|
|
12
16
|
return clone;
|
|
13
17
|
}
|
|
14
|
-
|
|
18
|
+
function isOptional(schema) {
|
|
19
|
+
return OPTIONAL_SCHEMA in schema && schema[OPTIONAL_SCHEMA] === true;
|
|
20
|
+
}
|
|
21
|
+
function unsafeSchema(schema) {
|
|
22
|
+
return schema;
|
|
23
|
+
}
|
|
24
|
+
const nativeJsonSchemaBuilder = {
|
|
15
25
|
Array(items, options) {
|
|
16
26
|
return withOptions({ type: "array", items }, options);
|
|
17
27
|
},
|
|
@@ -23,18 +33,21 @@ export const JsonSchema = {
|
|
|
23
33
|
},
|
|
24
34
|
Literal(value, options) {
|
|
25
35
|
const type = literalType(value);
|
|
26
|
-
return withOptions(type ? { type, const: value } : { const: value }, options);
|
|
36
|
+
return withOptions(type !== undefined ? { type, const: value } : { const: value }, options);
|
|
27
37
|
},
|
|
28
38
|
Number(options) {
|
|
29
39
|
return withOptions({ type: "number" }, options);
|
|
30
40
|
},
|
|
31
41
|
Object(properties, options) {
|
|
32
42
|
const required = globalThis.Object.entries(properties)
|
|
33
|
-
.filter(([, schema]) => schema
|
|
43
|
+
.filter(([, schema]) => !isOptional(schema))
|
|
34
44
|
.map(([key]) => key);
|
|
35
45
|
return withOptions({
|
|
36
46
|
type: "object",
|
|
37
|
-
properties: globalThis.Object.fromEntries(globalThis.Object.entries(properties).map(([key, schema]) => [
|
|
47
|
+
properties: globalThis.Object.fromEntries(globalThis.Object.entries(properties).map(([key, schema]) => [
|
|
48
|
+
key,
|
|
49
|
+
propertySchema(schema),
|
|
50
|
+
])),
|
|
38
51
|
...(required.length > 0 ? { required } : {}),
|
|
39
52
|
}, options);
|
|
40
53
|
},
|
|
@@ -47,7 +60,6 @@ export const JsonSchema = {
|
|
|
47
60
|
Union(types, options) {
|
|
48
61
|
return withOptions({ anyOf: types }, options);
|
|
49
62
|
},
|
|
50
|
-
Unsafe
|
|
51
|
-
return schema;
|
|
52
|
-
},
|
|
63
|
+
Unsafe: unsafeSchema,
|
|
53
64
|
};
|
|
65
|
+
export const JsonSchema = nativeJsonSchemaBuilder;
|
|
@@ -112,7 +112,12 @@ export const LAUNCH_SCOPED_FLAG_DEFINITIONS = [
|
|
|
112
112
|
];
|
|
113
113
|
export const LAUNCH_SCOPED_FLAGS = LAUNCH_SCOPED_FLAG_DEFINITIONS.map((definition) => definition.flag);
|
|
114
114
|
export const LAUNCH_SCOPED_FLAG_LABEL = LAUNCH_SCOPED_FLAGS.join(", ");
|
|
115
|
-
export const OPEN_RESULT_TAB_CORRECTION_FLAGS = new Set([
|
|
115
|
+
export const OPEN_RESULT_TAB_CORRECTION_FLAGS = new Set([
|
|
116
|
+
"--profile",
|
|
117
|
+
"--restore",
|
|
118
|
+
"--session-name",
|
|
119
|
+
"--state",
|
|
120
|
+
]);
|
|
116
121
|
/** Launch modes that must never be combined with wrapper-managed restore state. */
|
|
117
122
|
export const MANAGED_RESTORE_INCOMPATIBLE_FLAGS = [
|
|
118
123
|
"--restore",
|
|
@@ -187,14 +192,21 @@ export function hasLaunchScopedFlagToken(args, flag) {
|
|
|
187
192
|
const commandStartIndex = findCommandStartIndex(args);
|
|
188
193
|
const command = commandStartIndex === undefined ? undefined : args[commandStartIndex];
|
|
189
194
|
return args.some((token, index) => {
|
|
190
|
-
if (token.startsWith(`${flag}=`))
|
|
195
|
+
if (token.startsWith(`${flag}=`)) {
|
|
191
196
|
return flag === "--restore";
|
|
192
|
-
|
|
197
|
+
}
|
|
198
|
+
if (token !== flag) {
|
|
193
199
|
return false;
|
|
194
|
-
|
|
200
|
+
}
|
|
201
|
+
if (flag === "--auto-connect") {
|
|
195
202
|
return isBooleanFlagEnabled(args, flag);
|
|
196
|
-
|
|
203
|
+
}
|
|
204
|
+
if (flag === "--state" &&
|
|
205
|
+
command === "wait" &&
|
|
206
|
+
commandStartIndex !== undefined &&
|
|
207
|
+
index > commandStartIndex) {
|
|
197
208
|
return false;
|
|
209
|
+
}
|
|
198
210
|
return true;
|
|
199
211
|
});
|
|
200
212
|
}
|