pi-agent-browser-native 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -5
- package/README.md +120 -86
- package/dist/extensions/agent-browser/index.js +43065 -2016
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +49 -26
- package/dist/extensions/agent-browser/lib/argv-grammar.js +82 -93
- package/dist/extensions/agent-browser/lib/bash-guard.js +129 -126
- package/dist/extensions/agent-browser/lib/batch-lifecycle.js +113 -49
- package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +61 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +232 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claims.js +202 -0
- package/dist/extensions/agent-browser/lib/browser-execution-identity.js +77 -0
- package/dist/extensions/agent-browser/lib/browser-journal-branch.js +98 -0
- package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-journal-projection.js +221 -0
- package/dist/extensions/agent-browser/lib/browser-journal-reader.js +89 -0
- package/dist/extensions/agent-browser/lib/browser-journal-replay.js +246 -0
- package/dist/extensions/agent-browser/lib/browser-journal.js +103 -394
- package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +220 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +282 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-types.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +217 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion.js +80 -335
- package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +35 -0
- package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +166 -0
- package/dist/extensions/agent-browser/lib/browser-transcript.js +137 -81
- package/dist/extensions/agent-browser/lib/browser-value-parsing.js +15 -0
- package/dist/extensions/agent-browser/lib/command-capabilities.js +340 -0
- package/dist/extensions/agent-browser/lib/command-policy.js +107 -88
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +49 -322
- package/dist/extensions/agent-browser/lib/config-policy.js +138 -343
- package/dist/extensions/agent-browser/lib/config-providers.js +71 -0
- package/dist/extensions/agent-browser/lib/config-validation.js +218 -0
- package/dist/extensions/agent-browser/lib/config.js +19 -7
- package/dist/extensions/agent-browser/lib/electron/cdp.js +15 -7
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +134 -55
- package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +109 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +136 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +89 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +93 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +162 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/discovery.js +140 -549
- package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +102 -0
- package/dist/extensions/agent-browser/lib/electron/launch-process.js +209 -0
- package/dist/extensions/agent-browser/lib/electron/launch-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/launch.js +249 -354
- package/dist/extensions/agent-browser/lib/executable-path.js +21 -12
- package/dist/extensions/agent-browser/lib/execution-cwd.js +35 -18
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +162 -121
- package/dist/extensions/agent-browser/lib/input-modes/job.js +116 -313
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +104 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +132 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +57 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +151 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +142 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +57 -412
- package/dist/extensions/agent-browser/lib/input-modes/params.js +63 -17
- package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +268 -0
- package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +117 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-child.js +396 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +86 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-types.js +1 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +60 -0
- package/dist/extensions/agent-browser/lib/input-modes/script.js +60 -409
- package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +218 -128
- package/dist/extensions/agent-browser/lib/input-modes/shared.js +15 -4
- package/dist/extensions/agent-browser/lib/input-modes/types.js +56 -7
- package/dist/extensions/agent-browser/lib/json-schema.js +22 -10
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +17 -5
- package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +92 -425
- package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +58 -0
- package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +244 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +84 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +119 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +83 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore.js +168 -300
- package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +277 -0
- package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +128 -305
- package/dist/extensions/agent-browser/lib/managed-session-storage.js +56 -253
- package/dist/extensions/agent-browser/lib/native-confirmation.js +140 -0
- package/dist/extensions/agent-browser/lib/native-output.js +44 -9
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +107 -66
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +14 -6
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +109 -57
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +82 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +171 -57
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +31 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +152 -781
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +202 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +109 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +123 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +156 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +179 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +89 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +97 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +110 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +41 -538
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +204 -108
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +127 -199
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +65 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +113 -30
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +109 -28
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +138 -253
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +59 -24
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +159 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +131 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +42 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +242 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +75 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +92 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +254 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +114 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +222 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +68 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +176 -1114
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +191 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +152 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +115 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +316 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +28 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +333 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +71 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +201 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +183 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +200 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +18 -910
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +23 -13
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +198 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +154 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +68 -151
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +14 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +169 -46
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +210 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +61 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +187 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +171 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +228 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +77 -753
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +92 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +78 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +48 -816
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +86 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +69 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +164 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +161 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +165 -0
- package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +21 -9
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +211 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +23 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +99 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +275 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +280 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +303 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +36 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +335 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +227 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +204 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +139 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +24 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +98 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +295 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +41 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +7 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +102 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +133 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +180 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +269 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +146 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +54 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +261 -185
- package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-config.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +77 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +210 -139
- package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +124 -58
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +198 -98
- package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +199 -96
- package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +55 -0
- package/dist/extensions/agent-browser/lib/page-target-batch.js +118 -0
- package/dist/extensions/agent-browser/lib/page-target-guards.js +50 -0
- package/dist/extensions/agent-browser/lib/page-target-navigation.js +104 -0
- package/dist/extensions/agent-browser/lib/page-target-validation.js +59 -243
- package/dist/extensions/agent-browser/lib/parsing.js +13 -4
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +134 -68
- package/dist/extensions/agent-browser/lib/playbook.js +18 -14
- package/dist/extensions/agent-browser/lib/process-child.js +284 -0
- package/dist/extensions/agent-browser/lib/process-environment.js +22 -6
- package/dist/extensions/agent-browser/lib/process-errors.js +23 -0
- package/dist/extensions/agent-browser/lib/process-identity.js +47 -15
- package/dist/extensions/agent-browser/lib/process-socket-storage.js +256 -0
- package/dist/extensions/agent-browser/lib/process-stdout.js +74 -0
- package/dist/extensions/agent-browser/lib/process.js +146 -537
- package/dist/extensions/agent-browser/lib/prompt-artifacts.js +287 -0
- package/dist/extensions/agent-browser/lib/prompt-policy.js +15 -194
- package/dist/extensions/agent-browser/lib/read-command.js +41 -0
- package/dist/extensions/agent-browser/lib/read-confirmation.js +138 -35
- package/dist/extensions/agent-browser/lib/recording-reservations.js +118 -45
- package/dist/extensions/agent-browser/lib/redaction-fields.js +75 -0
- package/dist/extensions/agent-browser/lib/redaction-json.js +149 -0
- package/dist/extensions/agent-browser/lib/redaction-url.js +88 -0
- package/dist/extensions/agent-browser/lib/results/action-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/action-recommendations.js +28 -271
- package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +96 -94
- package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +73 -0
- package/dist/extensions/agent-browser/lib/results/categories.js +111 -54
- package/dist/extensions/agent-browser/lib/results/confirmation.js +29 -10
- package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +62 -27
- package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +83 -0
- package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +48 -0
- package/dist/extensions/agent-browser/lib/results/envelope.js +93 -66
- package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +180 -0
- package/dist/extensions/agent-browser/lib/results/network-routes.js +86 -45
- package/dist/extensions/agent-browser/lib/results/network.js +35 -12
- package/dist/extensions/agent-browser/lib/results/next-actions.js +49 -19
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +320 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +138 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +113 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +145 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +99 -552
- package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +118 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +68 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +135 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +227 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +91 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +91 -460
- package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +9 -5
- package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/common.js +26 -9
- package/dist/extensions/agent-browser/lib/results/presentation/content.js +86 -29
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +67 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +79 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +199 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +124 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +64 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +209 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +69 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +222 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +103 -1019
- package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +70 -0
- package/dist/extensions/agent-browser/lib/results/presentation/errors.js +130 -60
- package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +60 -145
- package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +147 -88
- package/dist/extensions/agent-browser/lib/results/presentation/notices.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +127 -0
- package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +120 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +77 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +51 -0
- package/dist/extensions/agent-browser/lib/results/presentation/registry.js +117 -237
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +35 -21
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +104 -73
- package/dist/extensions/agent-browser/lib/results/presentation/source.js +109 -0
- package/dist/extensions/agent-browser/lib/results/presentation.js +17 -248
- package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/recording.js +52 -14
- package/dist/extensions/agent-browser/lib/results/recovery-actions.js +14 -5
- package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +30 -22
- package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +83 -0
- package/dist/extensions/agent-browser/lib/results/selector-recovery.js +123 -123
- package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +266 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-content.js +32 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +104 -71
- package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +31 -11
- package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +125 -66
- package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +26 -7
- package/dist/extensions/agent-browser/lib/results/snapshot.js +28 -248
- package/dist/extensions/agent-browser/lib/results/text.js +16 -5
- package/dist/extensions/agent-browser/lib/runtime-args-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/runtime-compatibility.js +81 -0
- package/dist/extensions/agent-browser/lib/runtime-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/runtime-redaction.js +118 -0
- package/dist/extensions/agent-browser/lib/runtime-replay-events.js +144 -0
- package/dist/extensions/agent-browser/lib/runtime-session-identity.js +76 -0
- package/dist/extensions/agent-browser/lib/runtime-session-plan.js +114 -0
- package/dist/extensions/agent-browser/lib/runtime-session-replay.js +123 -0
- package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +65 -0
- package/dist/extensions/agent-browser/lib/runtime-timeouts.js +28 -0
- package/dist/extensions/agent-browser/lib/runtime.js +137 -1037
- package/dist/extensions/agent-browser/lib/session-identity.js +51 -0
- package/dist/extensions/agent-browser/lib/session-page-observation.js +357 -0
- package/dist/extensions/agent-browser/lib/session-page-state.js +188 -324
- package/dist/extensions/agent-browser/lib/session-page-types.js +1 -0
- package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +78 -0
- package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +7 -0
- package/dist/extensions/agent-browser/lib/temp-root-ownership.js +234 -0
- package/dist/extensions/agent-browser/lib/temp-root.js +207 -0
- package/dist/extensions/agent-browser/lib/temp.js +33 -446
- package/dist/extensions/agent-browser/lib/tool-surface.js +94 -24
- package/dist/extensions/agent-browser/lib/upstream-version.js +3 -2
- package/dist/extensions/agent-browser/lib/web-search-providers.js +229 -0
- package/dist/extensions/agent-browser/lib/web-search-request.js +108 -0
- package/dist/extensions/agent-browser/lib/web-search-results.js +281 -0
- package/dist/extensions/agent-browser/lib/web-search-schema.js +82 -0
- package/dist/extensions/agent-browser/lib/web-search.js +109 -617
- package/dist/extensions/agent-browser/lib/webmcp-observation.js +13 -6
- package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +63 -37
- package/dist/extensions/agent-browser/script-worker.js +80 -43
- package/dist/scripts/agent-browser-target.mjs +4 -2
- package/docs/ARCHITECTURE.md +22 -10
- package/docs/CODE_QUALITY.md +242 -0
- package/docs/COMMAND_REFERENCE.md +264 -229
- package/docs/ELECTRON.md +53 -44
- package/docs/RELEASE.md +21 -17
- package/docs/REQUIREMENTS.md +2 -0
- package/docs/SESSION_STORAGE.md +1 -1
- package/docs/SUPPORT_MATRIX.md +84 -77
- package/docs/TOOL_CONTRACT.md +165 -130
- package/docs/platform-smoke.md +5 -5
- package/package.json +143 -120
- package/scripts/agent-browser-capability-baseline.mjs +361 -957
- package/scripts/agent-browser-target.mjs +6 -2
- package/scripts/build.mjs +37 -8
- package/scripts/capability-core-commands.mjs +193 -0
- package/scripts/capability-options.mjs +283 -0
- package/scripts/capability-samples.mjs +133 -0
- package/scripts/capability-section.mjs +11 -0
- package/scripts/config.mjs +213 -114
- package/scripts/convert-browser-session.mjs +30 -9
- package/scripts/doctor-sources.mjs +195 -0
- package/scripts/doctor.mjs +92 -247
- package/scripts/platform-smoke/artifacts.mjs +38 -11
- package/scripts/platform-smoke/commands.mjs +104 -0
- package/scripts/platform-smoke/crabbox-runner.mjs +167 -80
- package/scripts/platform-smoke/doctor-support.mjs +157 -0
- package/scripts/platform-smoke/doctor-windows.mjs +230 -0
- package/scripts/platform-smoke/doctor.mjs +212 -320
- package/scripts/platform-smoke/lease-evidence.mjs +134 -0
- package/scripts/platform-smoke/suite-checks.mjs +98 -0
- package/scripts/platform-smoke/suite-evidence.mjs +281 -0
- package/scripts/platform-smoke/targets.mjs +158 -472
- package/scripts/platform-smoke.mjs +55 -40
- package/scripts/prepare.mjs +16 -7
|
@@ -1,236 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return { error: "sourceLookup.reactFiberId must be a non-empty string when provided." };
|
|
19
|
-
}
|
|
20
|
-
if (componentName !== undefined && (typeof componentName !== "string" || componentName.trim().length === 0)) {
|
|
21
|
-
return { error: "sourceLookup.componentName must be a non-empty string when provided." };
|
|
22
|
-
}
|
|
23
|
-
if (selector === undefined && reactFiberId === undefined && componentName === undefined) {
|
|
24
|
-
return { error: "sourceLookup requires selector, reactFiberId, or componentName." };
|
|
25
|
-
}
|
|
26
|
-
if (input.includeDomHints !== undefined && typeof input.includeDomHints !== "boolean") {
|
|
27
|
-
return { error: "sourceLookup.includeDomHints must be a boolean when provided." };
|
|
28
|
-
}
|
|
29
|
-
const rawMaxWorkspaceFiles = input.maxWorkspaceFiles;
|
|
30
|
-
if (rawMaxWorkspaceFiles !== undefined && (typeof rawMaxWorkspaceFiles !== "number" || !Number.isInteger(rawMaxWorkspaceFiles) || rawMaxWorkspaceFiles <= 0)) {
|
|
31
|
-
return { error: "sourceLookup.maxWorkspaceFiles must be a positive integer when provided." };
|
|
32
|
-
}
|
|
33
|
-
if (typeof rawMaxWorkspaceFiles === "number" && rawMaxWorkspaceFiles > SOURCE_LOOKUP_MAX_WORKSPACE_FILES) {
|
|
34
|
-
return { error: `sourceLookup.maxWorkspaceFiles must be ${SOURCE_LOOKUP_MAX_WORKSPACE_FILES} or less.` };
|
|
35
|
-
}
|
|
36
|
-
const includeDomHints = input.includeDomHints !== false;
|
|
37
|
-
const maxWorkspaceFiles = rawMaxWorkspaceFiles ?? SOURCE_LOOKUP_DEFAULT_MAX_WORKSPACE_FILES;
|
|
38
|
-
const steps = [];
|
|
39
|
-
if (typeof selector === "string") {
|
|
40
|
-
steps.push({ action: "dom", args: ["is", "visible", selector] });
|
|
41
|
-
if (includeDomHints) {
|
|
42
|
-
steps.push({ action: "dom", args: ["get", "html", selector] });
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (typeof reactFiberId === "string") {
|
|
46
|
-
steps.push({ action: "react", args: ["react", "inspect", reactFiberId] });
|
|
47
|
-
}
|
|
48
|
-
if (typeof componentName === "string") {
|
|
49
|
-
steps.push({ action: "react", args: ["react", "tree"] });
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
compiled: {
|
|
53
|
-
args: ["batch"],
|
|
54
|
-
query: { componentName, includeDomHints, maxWorkspaceFiles, reactFiberId, selector },
|
|
55
|
-
stdin: JSON.stringify(steps.map((step) => step.args)),
|
|
56
|
-
steps,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function extractStringField(value, names) {
|
|
61
|
-
for (const name of names) {
|
|
62
|
-
const field = value[name];
|
|
63
|
-
if (typeof field === "string" && field.trim().length > 0)
|
|
64
|
-
return field;
|
|
65
|
-
}
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
function extractNumberField(value, names) {
|
|
69
|
-
for (const name of names) {
|
|
70
|
-
const field = value[name];
|
|
71
|
-
if (typeof field === "number" && Number.isFinite(field))
|
|
72
|
-
return field;
|
|
73
|
-
if (typeof field === "string" && /^\d+$/.test(field))
|
|
74
|
-
return Number(field);
|
|
75
|
-
}
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
function candidateKey(candidate) {
|
|
79
|
-
return [candidate.source, candidate.file ?? "", candidate.line ?? "", candidate.column ?? "", candidate.componentName ?? ""].join(":");
|
|
80
|
-
}
|
|
81
|
-
function addSourceLookupCandidate(candidates, candidate) {
|
|
82
|
-
if (!candidates.some((existing) => candidateKey(existing) === candidateKey(candidate))) {
|
|
83
|
-
candidates.push(candidate);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function collectSourceCandidatesFromValue(value, source, candidates, evidence, depth = 0) {
|
|
87
|
-
if (depth > 6 || value === undefined || value === null)
|
|
88
|
-
return;
|
|
89
|
-
if (typeof value === "string") {
|
|
90
|
-
const sourcePattern = /([A-Za-z0-9_./@-]+\.(?:tsx|jsx|ts|js))(?:[:#](\d+))?(?:[:#](\d+))?/g;
|
|
91
|
-
for (const match of value.matchAll(sourcePattern)) {
|
|
92
|
-
addSourceLookupCandidate(candidates, {
|
|
93
|
-
column: match[3] ? Number(match[3]) : undefined,
|
|
94
|
-
confidence: source === "react-inspect" ? "high" : "medium",
|
|
95
|
-
evidence,
|
|
96
|
-
file: match[1],
|
|
97
|
-
line: match[2] ? Number(match[2]) : undefined,
|
|
98
|
-
source,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (Array.isArray(value)) {
|
|
104
|
-
for (const item of value)
|
|
105
|
-
collectSourceCandidatesFromValue(item, source, candidates, evidence, depth + 1);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (!isRecord(value))
|
|
109
|
-
return;
|
|
110
|
-
const file = extractStringField(value, ["file", "fileName", "filename", "filePath", "path", "source", "url"]);
|
|
111
|
-
if (file && /\.(?:tsx|jsx|ts|js)(?:$|[:?#])/.test(file)) {
|
|
112
|
-
addSourceLookupCandidate(candidates, {
|
|
113
|
-
column: extractNumberField(value, ["column", "columnNumber", "col"]),
|
|
114
|
-
confidence: source === "react-inspect" ? "high" : "medium",
|
|
115
|
-
evidence,
|
|
116
|
-
file,
|
|
117
|
-
line: extractNumberField(value, ["line", "lineNumber"]),
|
|
118
|
-
source,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
for (const nested of Object.values(value)) {
|
|
122
|
-
collectSourceCandidatesFromValue(nested, source, candidates, evidence, depth + 1);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function getHtmlAttributeValue(html, name) {
|
|
126
|
-
const pattern = new RegExp(`${name}=["']([^"']+)["']`, "i");
|
|
127
|
-
return pattern.exec(html)?.[1];
|
|
128
|
-
}
|
|
129
|
-
function collectDomSourceCandidates(html, candidates) {
|
|
130
|
-
if (typeof html !== "string")
|
|
131
|
-
return;
|
|
132
|
-
const file = getHtmlAttributeValue(html, "(?:data-source-file|data-file|data-component-file|data-source)");
|
|
133
|
-
if (file && /\.(?:tsx|jsx|ts|js)$/.test(file)) {
|
|
134
|
-
const line = getHtmlAttributeValue(html, "(?:data-source-line|data-line)");
|
|
135
|
-
const column = getHtmlAttributeValue(html, "(?:data-source-column|data-column)");
|
|
136
|
-
addSourceLookupCandidate(candidates, {
|
|
137
|
-
column: column && /^\d+$/.test(column) ? Number(column) : undefined,
|
|
138
|
-
confidence: "medium",
|
|
139
|
-
evidence: ["selector HTML contained source-like data attributes"],
|
|
140
|
-
file,
|
|
141
|
-
line: line && /^\d+$/.test(line) ? Number(line) : undefined,
|
|
142
|
-
source: "dom-attribute",
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
collectSourceCandidatesFromValue(html, "dom-attribute", candidates, ["selector HTML contained source-like text"]);
|
|
146
|
-
}
|
|
147
|
-
async function walkWorkspaceSourceFiles(root, maxFiles) {
|
|
148
|
-
const files = [];
|
|
149
|
-
async function visit(directory) {
|
|
150
|
-
if (files.length >= maxFiles)
|
|
151
|
-
return;
|
|
152
|
-
let entries;
|
|
153
|
-
try {
|
|
154
|
-
entries = await readdir(directory, { withFileTypes: true });
|
|
155
|
-
}
|
|
156
|
-
catch {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
for (const entry of entries) {
|
|
160
|
-
if (files.length >= maxFiles)
|
|
161
|
-
return;
|
|
162
|
-
const path = join(directory, entry.name);
|
|
163
|
-
if (entry.isDirectory()) {
|
|
164
|
-
if (!SOURCE_LOOKUP_IGNORED_DIRECTORIES.has(entry.name))
|
|
165
|
-
await visit(path);
|
|
1
|
+
export { compileAgentBrowserNetworkSourceLookup, compileAgentBrowserSourceLookup, } from "./lookup-plan.js";
|
|
2
|
+
export { redactNetworkSourceLookupAnalysis, redactNetworkSourceLookupArgs, redactNetworkSourceLookupSurface, redactNetworkSourceLookupUrl, } from "./lookup-redaction.js";
|
|
3
|
+
function sourceStatus(candidateCount, unsupported) {
|
|
4
|
+
if (candidateCount > 0) {
|
|
5
|
+
return "candidates-found";
|
|
6
|
+
}
|
|
7
|
+
return unsupported ? "unsupported" : "no-candidates";
|
|
8
|
+
}
|
|
9
|
+
function sourceSummary(status, candidateCount, electronWorkspace) {
|
|
10
|
+
switch (status) {
|
|
11
|
+
case "candidates-found":
|
|
12
|
+
return `Source lookup found ${candidateCount} candidate location(s).`;
|
|
13
|
+
case "unsupported":
|
|
14
|
+
return "Source lookup could not inspect React metadata in this session.";
|
|
15
|
+
case "no-candidates":
|
|
16
|
+
if (electronWorkspace !== undefined) {
|
|
17
|
+
return `Source lookup found no candidate locations. The workspace scan was limited to ${electronWorkspace}; packaged Electron app code may live outside that cwd in app resources or app.asar.`;
|
|
166
18
|
}
|
|
167
|
-
|
|
168
|
-
files.push(path);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
await visit(root);
|
|
173
|
-
return files;
|
|
174
|
-
}
|
|
175
|
-
function escapeRegExp(value) {
|
|
176
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
177
|
-
}
|
|
178
|
-
async function collectWorkspaceComponentCandidates(query, cwd, candidates, limitations) {
|
|
179
|
-
if (!query.componentName)
|
|
180
|
-
return;
|
|
181
|
-
const files = await walkWorkspaceSourceFiles(cwd, query.maxWorkspaceFiles);
|
|
182
|
-
if (files.length >= query.maxWorkspaceFiles) {
|
|
183
|
-
limitations.push(`Workspace source scan stopped at ${query.maxWorkspaceFiles} files.`);
|
|
184
|
-
}
|
|
185
|
-
const componentPattern = new RegExp(`(?:function|class)\\s+${escapeRegExp(query.componentName)}\\b|(?:const|let|var)\\s+${escapeRegExp(query.componentName)}\\s*=|export\\s+default\\s+function\\s+${escapeRegExp(query.componentName)}\\b`);
|
|
186
|
-
for (const file of files) {
|
|
187
|
-
let text;
|
|
188
|
-
try {
|
|
189
|
-
text = await readFile(file, "utf8");
|
|
190
|
-
}
|
|
191
|
-
catch {
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
const match = componentPattern.exec(text);
|
|
195
|
-
if (!match)
|
|
196
|
-
continue;
|
|
197
|
-
const line = text.slice(0, match.index).split("\n").length;
|
|
198
|
-
addSourceLookupCandidate(candidates, {
|
|
199
|
-
componentName: query.componentName,
|
|
200
|
-
confidence: "low",
|
|
201
|
-
evidence: [`local workspace contains a matching ${query.componentName} declaration`],
|
|
202
|
-
file,
|
|
203
|
-
line,
|
|
204
|
-
source: "workspace-search",
|
|
205
|
-
});
|
|
206
|
-
if (candidates.filter((candidate) => candidate.source === "workspace-search").length >= 10)
|
|
207
|
-
break;
|
|
19
|
+
return "Source lookup found no candidate locations.";
|
|
208
20
|
}
|
|
209
21
|
}
|
|
210
22
|
export async function analyzeSourceLookupResults(data, compiled, cwd, context) {
|
|
211
|
-
const
|
|
212
|
-
const
|
|
23
|
+
const { distinctSourceCandidates, observeSourceCandidates } = await import("./lookup-source-evidence.js");
|
|
24
|
+
const { scanWorkspaceComponent } = await import("./lookup-workspace.js");
|
|
25
|
+
const observed = observeSourceCandidates(data);
|
|
26
|
+
const workspace = await scanWorkspaceComponent(compiled.query, cwd);
|
|
27
|
+
const candidates = distinctSourceCandidates([...observed.candidates, ...workspace.candidates]);
|
|
28
|
+
const status = sourceStatus(candidates.length, observed.unsupported);
|
|
29
|
+
const electronContext = status === "no-candidates" ? context?.electronContext : undefined;
|
|
30
|
+
const workspaceRoot = context?.workspaceRoot ?? cwd;
|
|
213
31
|
const limitations = [
|
|
214
32
|
"Experimental lookup only reports candidates with evidence; it cannot guarantee a DOM node maps to one source file.",
|
|
215
33
|
"React source hints require the page to be opened with --enable react-devtools and source information from the app build.",
|
|
34
|
+
...workspace.limitations,
|
|
216
35
|
];
|
|
217
|
-
let unsupported = false;
|
|
218
|
-
for (const item of items) {
|
|
219
|
-
const command = Array.isArray(item.command) ? item.command : [];
|
|
220
|
-
const result = isRecord(item.result) && "data" in item.result ? item.result.data : item.result;
|
|
221
|
-
if (item.success === false && command[0] === "react")
|
|
222
|
-
unsupported = true;
|
|
223
|
-
if (command[0] === "react" && command[1] === "inspect") {
|
|
224
|
-
collectSourceCandidatesFromValue(result, "react-inspect", candidates, ["react inspect returned source-like metadata"]);
|
|
225
|
-
}
|
|
226
|
-
if (command[0] === "get" && command[1] === "html") {
|
|
227
|
-
collectDomSourceCandidates(result, candidates);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
await collectWorkspaceComponentCandidates(compiled.query, cwd, candidates, limitations);
|
|
231
|
-
const status = candidates.length > 0 ? "candidates-found" : unsupported ? "unsupported" : "no-candidates";
|
|
232
|
-
const electronContext = status === "no-candidates" ? context?.electronContext : undefined;
|
|
233
|
-
const workspaceRoot = context?.workspaceRoot ?? cwd;
|
|
234
36
|
if (electronContext) {
|
|
235
37
|
limitations.push(`Workspace source scan is limited to the captured execution directory: ${workspaceRoot}.`, "Packaged Electron app code may live inside installed app resources or app.asar outside the workspace; the wrapper does not unpack asar files or scan app bundle resources.");
|
|
236
38
|
}
|
|
@@ -239,200 +41,43 @@ export async function analyzeSourceLookupResults(data, compiled, cwd, context) {
|
|
|
239
41
|
electronContext,
|
|
240
42
|
limitations,
|
|
241
43
|
status,
|
|
242
|
-
summary: candidates.length
|
|
243
|
-
? `Source lookup found ${candidates.length} candidate location(s).`
|
|
244
|
-
: unsupported
|
|
245
|
-
? "Source lookup could not inspect React metadata in this session."
|
|
246
|
-
: electronContext
|
|
247
|
-
? `Source lookup found no candidate locations. The workspace scan was limited to ${workspaceRoot}; packaged Electron app code may live outside that cwd in app resources or app.asar.`
|
|
248
|
-
: "Source lookup found no candidate locations.",
|
|
44
|
+
summary: sourceSummary(status, candidates.length, electronContext ? workspaceRoot : undefined),
|
|
249
45
|
workspaceRoot: electronContext ? workspaceRoot : undefined,
|
|
250
46
|
};
|
|
251
47
|
}
|
|
252
|
-
|
|
253
|
-
if (
|
|
254
|
-
return
|
|
255
|
-
const filter = input.filter;
|
|
256
|
-
const requestId = input.requestId;
|
|
257
|
-
const namespace = input.namespace;
|
|
258
|
-
const session = input.session;
|
|
259
|
-
const url = input.url;
|
|
260
|
-
if (filter !== undefined && (typeof filter !== "string" || filter.trim().length === 0))
|
|
261
|
-
return { error: "networkSourceLookup.filter must be a non-empty string when provided." };
|
|
262
|
-
if (requestId !== undefined && (typeof requestId !== "string" || requestId.trim().length === 0))
|
|
263
|
-
return { error: "networkSourceLookup.requestId must be a non-empty string when provided." };
|
|
264
|
-
if (namespace !== undefined && (typeof namespace !== "string" || (namespace !== "" && namespace.trim().length === 0)))
|
|
265
|
-
return { error: "networkSourceLookup.namespace must be a non-empty string or the empty default namespace when provided." };
|
|
266
|
-
if (session !== undefined && (typeof session !== "string" || session.trim().length === 0))
|
|
267
|
-
return { error: "networkSourceLookup.session must be a non-empty string when provided." };
|
|
268
|
-
if (url !== undefined && (typeof url !== "string" || url.trim().length === 0))
|
|
269
|
-
return { error: "networkSourceLookup.url must be a non-empty string when provided." };
|
|
270
|
-
if (filter === undefined && requestId === undefined && url === undefined)
|
|
271
|
-
return { error: "networkSourceLookup requires requestId, filter, or url." };
|
|
272
|
-
const maxWorkspaceFiles = validateLookupMaxWorkspaceFiles(input.maxWorkspaceFiles, "networkSourceLookup.maxWorkspaceFiles");
|
|
273
|
-
if (maxWorkspaceFiles.error)
|
|
274
|
-
return { error: maxWorkspaceFiles.error };
|
|
275
|
-
const steps = [];
|
|
276
|
-
if (typeof requestId === "string") {
|
|
277
|
-
steps.push({ action: "network", args: ["network", "request", requestId] });
|
|
278
|
-
}
|
|
279
|
-
const effectiveFilter = typeof filter === "string" ? filter : typeof url === "string" ? url : undefined;
|
|
280
|
-
if (effectiveFilter) {
|
|
281
|
-
steps.push({ action: "network", args: ["network", "requests", "--filter", effectiveFilter] });
|
|
282
|
-
}
|
|
283
|
-
const args = [...(typeof namespace === "string" ? ["--namespace", namespace] : []), ...(typeof session === "string" ? ["--session", session] : []), "batch"];
|
|
284
|
-
return { compiled: { args, query: { filter, maxWorkspaceFiles: maxWorkspaceFiles.value, namespace, requestId, session, url }, stdin: JSON.stringify(steps.map((step) => step.args)), steps } };
|
|
285
|
-
}
|
|
286
|
-
function getResultPayload(item) {
|
|
287
|
-
return isRecord(item.result) && "data" in item.result ? item.result.data : item.result;
|
|
288
|
-
}
|
|
289
|
-
function networkRequestMatchesQuery(url, queryText) {
|
|
290
|
-
return queryText === undefined || url === undefined || url.includes(queryText) || queryText.includes(url);
|
|
291
|
-
}
|
|
292
|
-
function isFailedNetworkRecord(request) {
|
|
293
|
-
const status = typeof request.status === "number" ? request.status : undefined;
|
|
294
|
-
const error = typeof request.error === "string" ? request.error : undefined;
|
|
295
|
-
return request.failed === true || error !== undefined || (status !== undefined && status >= 400);
|
|
296
|
-
}
|
|
297
|
-
function getFailedNetworkRequests(data, queryText) {
|
|
298
|
-
const failed = [];
|
|
299
|
-
for (const item of getBatchResultItems(data)) {
|
|
300
|
-
const payload = getResultPayload(item);
|
|
301
|
-
const requests = isRecord(payload) && Array.isArray(payload.requests) ? payload.requests : Array.isArray(payload) ? payload : isRecord(payload) ? [payload] : [];
|
|
302
|
-
for (const request of requests) {
|
|
303
|
-
if (!isRecord(request))
|
|
304
|
-
continue;
|
|
305
|
-
const url = typeof request.url === "string" ? request.url : undefined;
|
|
306
|
-
if (!networkRequestMatchesQuery(url, queryText) || !isFailedNetworkRecord(request))
|
|
307
|
-
continue;
|
|
308
|
-
failed.push({
|
|
309
|
-
error: typeof request.error === "string" ? request.error : undefined,
|
|
310
|
-
method: typeof request.method === "string" ? request.method : undefined,
|
|
311
|
-
requestId: typeof request.id === "string" ? request.id : typeof request.requestId === "string" ? request.requestId : undefined,
|
|
312
|
-
status: typeof request.status === "number" ? request.status : undefined,
|
|
313
|
-
url,
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return failed;
|
|
318
|
-
}
|
|
319
|
-
function addNetworkCandidate(candidates, candidate) {
|
|
320
|
-
const key = [candidate.source, candidate.file ?? "", candidate.line ?? "", candidate.requestUrl ?? ""].join(":");
|
|
321
|
-
if (!candidates.some((existing) => [existing.source, existing.file ?? "", existing.line ?? "", existing.requestUrl ?? ""].join(":") === key))
|
|
322
|
-
candidates.push(candidate);
|
|
323
|
-
}
|
|
324
|
-
function collectInitiatorCandidates(data, failedRequests, candidates) {
|
|
325
|
-
const failedRequestIds = new Set(failedRequests.map((request) => request.requestId).filter((value) => value !== undefined));
|
|
326
|
-
const failedRequestUrls = new Set(failedRequests.map((request) => request.url).filter((value) => value !== undefined));
|
|
327
|
-
for (const item of getBatchResultItems(data)) {
|
|
328
|
-
const payload = getResultPayload(item);
|
|
329
|
-
const requestValues = isRecord(payload) && Array.isArray(payload.requests) ? payload.requests : [payload];
|
|
330
|
-
for (const value of requestValues) {
|
|
331
|
-
if (!isRecord(value))
|
|
332
|
-
continue;
|
|
333
|
-
const requestUrl = typeof value.url === "string" ? value.url : undefined;
|
|
334
|
-
const requestId = typeof value.id === "string" ? value.id : typeof value.requestId === "string" ? value.requestId : undefined;
|
|
335
|
-
const correlatesWithFailedRequest = (requestId !== undefined && failedRequestIds.has(requestId)) || (requestUrl !== undefined && failedRequestUrls.has(requestUrl));
|
|
336
|
-
if (!correlatesWithFailedRequest && !isFailedNetworkRecord(value))
|
|
337
|
-
continue;
|
|
338
|
-
for (const field of [value.initiator, value.stack, value.source, value.trace]) {
|
|
339
|
-
const localCandidates = [];
|
|
340
|
-
collectSourceCandidatesFromValue(field, "dom-attribute", localCandidates, ["failed network request included source-like initiator metadata"]);
|
|
341
|
-
for (const candidate of localCandidates) {
|
|
342
|
-
addNetworkCandidate(candidates, { confidence: "medium", evidence: candidate.evidence, file: candidate.file, line: candidate.line, requestUrl, source: "initiator" });
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
async function collectWorkspaceRequestCandidates(query, failedRequests, cwd, candidates, limitations) {
|
|
349
|
-
const needles = [...new Set([query.url, query.filter, ...failedRequests.map((request) => request.url)].filter((value) => typeof value === "string" && value.length > 0).flatMap((value) => {
|
|
350
|
-
try {
|
|
351
|
-
const parsed = new URL(value);
|
|
352
|
-
return [value, parsed.pathname].filter((item) => item && item !== "/");
|
|
353
|
-
}
|
|
354
|
-
catch {
|
|
355
|
-
return [value];
|
|
356
|
-
}
|
|
357
|
-
}))].slice(0, 8);
|
|
358
|
-
if (needles.length === 0)
|
|
359
|
-
return;
|
|
360
|
-
const files = await walkWorkspaceSourceFiles(cwd, query.maxWorkspaceFiles);
|
|
361
|
-
if (files.length >= query.maxWorkspaceFiles)
|
|
362
|
-
limitations.push(`Workspace source scan stopped at ${query.maxWorkspaceFiles} files.`);
|
|
363
|
-
for (const file of files) {
|
|
364
|
-
let text;
|
|
365
|
-
try {
|
|
366
|
-
text = await readFile(file, "utf8");
|
|
367
|
-
}
|
|
368
|
-
catch {
|
|
369
|
-
continue;
|
|
370
|
-
}
|
|
371
|
-
for (const needle of needles) {
|
|
372
|
-
const index = text.indexOf(needle);
|
|
373
|
-
if (index === -1)
|
|
374
|
-
continue;
|
|
375
|
-
addNetworkCandidate(candidates, { confidence: "low", evidence: [`local workspace contains request URL literal ${needle}`], file, line: text.slice(0, index).split("\n").length, requestUrl: needle, source: "workspace-search" });
|
|
376
|
-
if (candidates.filter((candidate) => candidate.source === "workspace-search").length >= 10)
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
48
|
+
function networkStatus(failedCount, candidateCount) {
|
|
49
|
+
if (failedCount === 0) {
|
|
50
|
+
return "no-failed-requests";
|
|
379
51
|
}
|
|
52
|
+
return candidateCount > 0 ? "failed-requests-found" : "no-candidates";
|
|
380
53
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
for (const key of [...url.searchParams.keys()]) {
|
|
390
|
-
url.searchParams.set(key, "[REDACTED]");
|
|
391
|
-
}
|
|
392
|
-
if (/(?:token|secret|password|passwd|pwd|key|auth|session|jwt|credential)/i.test(url.hash)) {
|
|
393
|
-
url.hash = "#[REDACTED]";
|
|
394
|
-
}
|
|
395
|
-
return isRelative ? `${url.pathname}${url.search}${url.hash}` : url.toString();
|
|
54
|
+
function networkSummary(status, failedCount, candidateCount) {
|
|
55
|
+
switch (status) {
|
|
56
|
+
case "no-failed-requests":
|
|
57
|
+
return "Network source lookup found no failed requests.";
|
|
58
|
+
case "failed-requests-found":
|
|
59
|
+
return `Network source lookup found ${failedCount} failed request(s) and ${candidateCount} candidate source hint(s).`;
|
|
60
|
+
case "no-candidates":
|
|
61
|
+
return `Network source lookup found ${failedCount} failed request(s) but no source candidates.`;
|
|
396
62
|
}
|
|
397
|
-
catch {
|
|
398
|
-
return redactSensitiveText(value
|
|
399
|
-
.replace(/([a-z][a-z0-9+.-]*:\/\/)\S+:\S+@/gi, "$1[REDACTED]@")
|
|
400
|
-
.replace(/([?&][^=]+)=([^&#\s"'\]]+)/g, "$1=[REDACTED]"));
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
export function redactNetworkSourceLookupArgs(args) {
|
|
404
|
-
return redactInvocationArgs(args).map((arg) => redactNetworkSourceLookupUrl(arg) ?? arg);
|
|
405
|
-
}
|
|
406
|
-
export function redactNetworkSourceLookupSurface(value) {
|
|
407
|
-
if (typeof value === "string")
|
|
408
|
-
return redactNetworkSourceLookupUrl(value) ?? value;
|
|
409
|
-
if (Array.isArray(value))
|
|
410
|
-
return value.map((item) => redactNetworkSourceLookupSurface(item));
|
|
411
|
-
if (!isRecord(value))
|
|
412
|
-
return value;
|
|
413
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, redactNetworkSourceLookupSurface(item)]));
|
|
414
|
-
}
|
|
415
|
-
export function redactNetworkSourceLookupAnalysis(analysis) {
|
|
416
|
-
return {
|
|
417
|
-
...analysis,
|
|
418
|
-
candidates: analysis.candidates.map((candidate) => ({
|
|
419
|
-
...candidate,
|
|
420
|
-
evidence: candidate.evidence.map((item) => redactNetworkSourceLookupUrl(item) ?? redactSensitiveText(item)),
|
|
421
|
-
file: redactNetworkSourceLookupUrl(candidate.file),
|
|
422
|
-
requestUrl: redactNetworkSourceLookupUrl(candidate.requestUrl),
|
|
423
|
-
})),
|
|
424
|
-
failedRequests: analysis.failedRequests.map((request) => ({ ...request, error: redactNetworkSourceLookupUrl(request.error), url: redactNetworkSourceLookupUrl(request.url) })),
|
|
425
|
-
};
|
|
426
63
|
}
|
|
427
64
|
export async function analyzeNetworkSourceLookupResults(data, compiled, cwd) {
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
"Initiator/source-map metadata is upstream/browser-build dependent and may be absent.",
|
|
431
|
-
];
|
|
65
|
+
const { distinctNetworkCandidates, getFailedNetworkRequests, observeInitiatorCandidates } = await import("./lookup-network-evidence.js");
|
|
66
|
+
const { scanWorkspaceRequests } = await import("./lookup-workspace.js");
|
|
432
67
|
const failedRequests = getFailedNetworkRequests(data, compiled.query.url ?? compiled.query.filter);
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
const status = failedRequests.length
|
|
437
|
-
return {
|
|
68
|
+
const observed = observeInitiatorCandidates(data, failedRequests);
|
|
69
|
+
const workspace = await scanWorkspaceRequests(compiled.query, failedRequests, cwd);
|
|
70
|
+
const candidates = distinctNetworkCandidates([...observed, ...workspace.candidates]);
|
|
71
|
+
const status = networkStatus(failedRequests.length, candidates.length);
|
|
72
|
+
return {
|
|
73
|
+
candidates,
|
|
74
|
+
failedRequests,
|
|
75
|
+
limitations: [
|
|
76
|
+
"Experimental network source hints report candidates only; failed requests can be triggered indirectly by frameworks, caches, service workers, or third-party scripts.",
|
|
77
|
+
"Initiator/source-map metadata is upstream/browser-build dependent and may be absent.",
|
|
78
|
+
...workspace.limitations,
|
|
79
|
+
],
|
|
80
|
+
status,
|
|
81
|
+
summary: networkSummary(status, failedRequests.length, candidates.length),
|
|
82
|
+
};
|
|
438
83
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { JsonSchema } from "../json-schema.js";
|
|
2
2
|
import { StringEnum as localStringEnum } from "../string-enum-schema.js";
|
|
3
|
-
import { ELECTRON_DISCOVERY_DEFAULT_MAX_RESULTS, ELECTRON_DISCOVERY_MAX_RESULTS } from "../electron/discovery.js";
|
|
3
|
+
import { ELECTRON_DISCOVERY_DEFAULT_MAX_RESULTS, ELECTRON_DISCOVERY_MAX_RESULTS, } from "../electron/discovery-types.js";
|
|
4
4
|
import { AGENT_BROWSER_CODE_MAX_TIMEOUT_MS, AGENT_BROWSER_ELECTRON_HANDOFFS, AGENT_BROWSER_ELECTRON_TARGET_TYPES, AGENT_BROWSER_QA_LOAD_STATES, AGENT_BROWSER_SEMANTIC_ACTIONS, AGENT_BROWSER_SEMANTIC_LOCATORS, DEFAULT_SESSION_MODE, SOURCE_LOOKUP_MAX_WORKSPACE_FILES, } from "./types.js";
|
|
5
5
|
const AGENT_BROWSER_ADVANCED_TOOLS = ["action", "qa", "electron", "source", "network"];
|
|
6
6
|
function outputProperties(Type) {
|
|
7
7
|
return {
|
|
8
|
-
outputPath: Type.Optional(Type.String({
|
|
8
|
+
outputPath: Type.Optional(Type.String({
|
|
9
|
+
description: "Result-data path, separate from browser artifact paths.",
|
|
10
|
+
minLength: 1,
|
|
11
|
+
})),
|
|
9
12
|
timeoutMs: Type.Optional(Type.Integer({ description: "Timeout in ms; exceed explicit waits.", minimum: 1 })),
|
|
10
13
|
};
|
|
11
14
|
}
|
|
@@ -18,17 +21,31 @@ function sessionModeProperty(Type, StringEnum) {
|
|
|
18
21
|
// Keep the always-on schemas small; specialized guidance belongs to each advanced tool.
|
|
19
22
|
export function createAgentBrowserParamsSchema(Type = JsonSchema, StringEnum = localStringEnum) {
|
|
20
23
|
return Type.Unsafe(Type.Object({
|
|
21
|
-
args: Type.Array(Type.String(), {
|
|
22
|
-
|
|
24
|
+
args: Type.Array(Type.String(), {
|
|
25
|
+
description: "Native agent-browser argv without the binary or shell syntax. Fixed sequences: batch --bail with JSON-array stdin.",
|
|
26
|
+
minItems: 1,
|
|
27
|
+
}),
|
|
28
|
+
stdin: Type.Optional(Type.String({
|
|
29
|
+
description: "Native batch JSON, eval --stdin source, or auth save --password-stdin text.",
|
|
30
|
+
})),
|
|
23
31
|
...outputProperties(Type),
|
|
24
32
|
sessionMode: sessionModeProperty(Type, StringEnum),
|
|
25
33
|
}, { additionalProperties: false }));
|
|
26
34
|
}
|
|
27
35
|
export function createAgentBrowserCodeParamsSchema(Type = JsonSchema) {
|
|
28
36
|
return Type.Unsafe(Type.Object({
|
|
29
|
-
code: Type.String({
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
code: Type.String({
|
|
38
|
+
description: "JavaScript with await browser({args, stdin?, timeoutMs?}), emit(JSON), and emitImage(image handle). Fresh JS context; persistent browser.",
|
|
39
|
+
minLength: 1,
|
|
40
|
+
maxLength: 65_536,
|
|
41
|
+
}),
|
|
42
|
+
session: Type.Optional(Type.String({
|
|
43
|
+
description: "Explicit native session; omitted uses the ordinary default browser.",
|
|
44
|
+
minLength: 1,
|
|
45
|
+
})),
|
|
46
|
+
namespace: Type.Optional(Type.String({
|
|
47
|
+
description: "Native namespace; empty string selects the default namespace.",
|
|
48
|
+
})),
|
|
32
49
|
...outputProperties(Type),
|
|
33
50
|
timeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: AGENT_BROWSER_CODE_MAX_TIMEOUT_MS })),
|
|
34
51
|
}, { additionalProperties: false }));
|
|
@@ -36,9 +53,16 @@ export function createAgentBrowserCodeParamsSchema(Type = JsonSchema) {
|
|
|
36
53
|
export function createAgentBrowserActionParamsSchema(Type = JsonSchema, StringEnum = localStringEnum) {
|
|
37
54
|
return Type.Unsafe(Type.Object({
|
|
38
55
|
action: StringEnum(AGENT_BROWSER_SEMANTIC_ACTIONS),
|
|
39
|
-
locator: Type.Optional(StringEnum(AGENT_BROWSER_SEMANTIC_LOCATORS, {
|
|
40
|
-
|
|
41
|
-
|
|
56
|
+
locator: Type.Optional(StringEnum(AGENT_BROWSER_SEMANTIC_LOCATORS, {
|
|
57
|
+
description: "Select supports role or label.",
|
|
58
|
+
})),
|
|
59
|
+
value: Type.Optional(Type.String({
|
|
60
|
+
description: "Locator value or select option; label text for select by label.",
|
|
61
|
+
})),
|
|
62
|
+
values: Type.Optional(Type.Array(Type.String(), {
|
|
63
|
+
description: "Select options; required for select by label.",
|
|
64
|
+
minItems: 1,
|
|
65
|
+
})),
|
|
42
66
|
selector: Type.Optional(Type.String({ description: "Direct selector or current @ref." })),
|
|
43
67
|
text: Type.Optional(Type.String({ description: "Fill text." })),
|
|
44
68
|
role: Type.Optional(Type.String({ description: "Role locator; select needs combobox or listbox." })),
|
|
@@ -49,7 +73,10 @@ export function createAgentBrowserActionParamsSchema(Type = JsonSchema, StringEn
|
|
|
49
73
|
additionalProperties: false,
|
|
50
74
|
// Top-level properties let Pi normalize optional nulls before validating branches.
|
|
51
75
|
anyOf: [
|
|
52
|
-
Type.Object({
|
|
76
|
+
Type.Object({
|
|
77
|
+
action: StringEnum(["select"]),
|
|
78
|
+
locator: Type.Optional(StringEnum(["role", "label"])),
|
|
79
|
+
}, { not: { required: ["text"] } }),
|
|
53
80
|
Type.Object({ action: StringEnum(["check", "click", "fill"]) }, { not: { required: ["values"] } }),
|
|
54
81
|
],
|
|
55
82
|
}));
|
|
@@ -70,7 +97,10 @@ export function createAgentBrowserQaParamsSchema(Type = JsonSchema, StringEnum =
|
|
|
70
97
|
}, {
|
|
71
98
|
additionalProperties: false,
|
|
72
99
|
anyOf: [
|
|
73
|
-
Type.Object({
|
|
100
|
+
Type.Object({
|
|
101
|
+
attached: Type.Literal(true),
|
|
102
|
+
sessionMode: Type.Optional(StringEnum(["auto"])),
|
|
103
|
+
}, { not: { required: ["url"] } }),
|
|
74
104
|
Type.Object({ url: Type.String(), attached: Type.Optional(Type.Literal(false)) }),
|
|
75
105
|
],
|
|
76
106
|
}));
|
|
@@ -80,7 +110,10 @@ export function createAgentBrowserElectronParamsSchema(Type = JsonSchema, String
|
|
|
80
110
|
const timeoutMs = Type.Optional(Type.Integer({ minimum: 1 }));
|
|
81
111
|
const list = {
|
|
82
112
|
query: Type.Optional(Type.String({ description: "Case-insensitive app filter.", minLength: 1 })),
|
|
83
|
-
maxResults: Type.Optional(Type.Integer({
|
|
113
|
+
maxResults: Type.Optional(Type.Integer({
|
|
114
|
+
description: `Result cap; default ${ELECTRON_DISCOVERY_DEFAULT_MAX_RESULTS}, clamped to ${ELECTRON_DISCOVERY_MAX_RESULTS}.`,
|
|
115
|
+
minimum: 1,
|
|
116
|
+
})),
|
|
84
117
|
};
|
|
85
118
|
const launch = {
|
|
86
119
|
appPath: Type.Optional(Type.String({ description: "macOS .app path.", minLength: 1 })),
|
|
@@ -100,7 +133,10 @@ export function createAgentBrowserElectronParamsSchema(Type = JsonSchema, String
|
|
|
100
133
|
// Each branch retains its original action-specific field boundary.
|
|
101
134
|
return Type.Unsafe(Type.Object({
|
|
102
135
|
action: StringEnum(["list", "launch", "status", "cleanup", "probe"]),
|
|
103
|
-
...list,
|
|
136
|
+
...list,
|
|
137
|
+
...launch,
|
|
138
|
+
...lifecycle,
|
|
139
|
+
...common,
|
|
104
140
|
}, {
|
|
105
141
|
additionalProperties: false,
|
|
106
142
|
anyOf: [
|
|
@@ -117,7 +153,11 @@ export function createAgentBrowserSourceParamsSchema(Type = JsonSchema, StringEn
|
|
|
117
153
|
reactFiberId: Type.Optional(Type.String({ description: "React fiber id; requires --enable react-devtools." })),
|
|
118
154
|
componentName: Type.Optional(Type.String({ description: "Component for local source search." })),
|
|
119
155
|
includeDomHints: Type.Optional(Type.Boolean({ description: "Inspect DOM hints; default true." })),
|
|
120
|
-
maxWorkspaceFiles: Type.Optional(Type.Integer({
|
|
156
|
+
maxWorkspaceFiles: Type.Optional(Type.Integer({
|
|
157
|
+
description: "Source scan cap; default 2000.",
|
|
158
|
+
minimum: 1,
|
|
159
|
+
maximum: SOURCE_LOOKUP_MAX_WORKSPACE_FILES,
|
|
160
|
+
})),
|
|
121
161
|
...outputProperties(Type),
|
|
122
162
|
sessionMode: sessionModeProperty(Type, StringEnum),
|
|
123
163
|
}, { additionalProperties: false }));
|
|
@@ -129,14 +169,20 @@ export function createAgentBrowserNetworkSourceParamsSchema(Type = JsonSchema, S
|
|
|
129
169
|
requestId: Type.Optional(Type.String({ description: "Request id to inspect." })),
|
|
130
170
|
session: Type.Optional(Type.String()),
|
|
131
171
|
url: Type.Optional(Type.String({ description: "Failed URL or fragment." })),
|
|
132
|
-
maxWorkspaceFiles: Type.Optional(Type.Integer({
|
|
172
|
+
maxWorkspaceFiles: Type.Optional(Type.Integer({
|
|
173
|
+
description: "Source scan cap; default 2000.",
|
|
174
|
+
minimum: 1,
|
|
175
|
+
maximum: SOURCE_LOOKUP_MAX_WORKSPACE_FILES,
|
|
176
|
+
})),
|
|
133
177
|
...outputProperties(Type),
|
|
134
178
|
sessionMode: sessionModeProperty(Type, StringEnum),
|
|
135
179
|
}, { additionalProperties: false }));
|
|
136
180
|
}
|
|
137
181
|
export function createAgentBrowserToolsParamsSchema(Type = JsonSchema, StringEnum = localStringEnum) {
|
|
138
182
|
return Type.Unsafe(Type.Object({
|
|
139
|
-
enable: Type.Optional(Type.Array(StringEnum(AGENT_BROWSER_ADVANCED_TOOLS), {
|
|
183
|
+
enable: Type.Optional(Type.Array(StringEnum(AGENT_BROWSER_ADVANCED_TOOLS), {
|
|
184
|
+
description: "Add capabilities to active tools; omit to list inventory.",
|
|
185
|
+
})),
|
|
140
186
|
}, { additionalProperties: false }));
|
|
141
187
|
}
|
|
142
188
|
export const AGENT_BROWSER_PARAMS = createAgentBrowserParamsSchema();
|