pi-agent-browser-native 0.9.5 → 0.9.6
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 +19 -0
- package/README.md +3 -0
- package/dist/extensions/agent-browser/index.js +1214 -583
- package/dist/packaged/lib/browser-session-conversion.js +2810 -0
- package/dist/packaged/lib/config-policy.js +599 -0
- package/dist/packaged/lib/parsing.js +34 -0
- package/dist/packaged/lib/playbook.js +694 -0
- package/dist/packaged/lib/results/snapshot.js +2671 -0
- package/dist/packaged/lib/runtime.js +3027 -0
- package/docs/ARCHITECTURE.md +11 -1
- package/docs/CODE_QUALITY.md +11 -0
- package/docs/COMMAND_REFERENCE.md +2 -2
- package/docs/PERFORMANCE.md +243 -0
- package/docs/REFERENCE.md +3 -3
- package/docs/SESSION_STORAGE.md +11 -3
- package/docs/SUPPORT_MATRIX.md +8 -4
- package/docs/TOOL_CONTRACT.md +4 -4
- package/docs/performance/2026-10-12.json +7257 -0
- package/package.json +13 -2
- package/scripts/build.mjs +16 -5
- package/scripts/config.mjs +1 -1
- package/scripts/convert-browser-session.mjs +1 -1
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +0 -123
- package/dist/extensions/agent-browser/lib/argv-grammar.js +0 -320
- package/dist/extensions/agent-browser/lib/bash-guard.js +0 -193
- package/dist/extensions/agent-browser/lib/batch-lifecycle.js +0 -131
- package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +0 -61
- package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +0 -232
- package/dist/extensions/agent-browser/lib/browser-execution-claims.js +0 -202
- package/dist/extensions/agent-browser/lib/browser-execution-identity.js +0 -77
- package/dist/extensions/agent-browser/lib/browser-journal-branch.js +0 -98
- package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/browser-journal-projection.js +0 -221
- package/dist/extensions/agent-browser/lib/browser-journal-reader.js +0 -89
- package/dist/extensions/agent-browser/lib/browser-journal-replay.js +0 -246
- package/dist/extensions/agent-browser/lib/browser-journal.js +0 -148
- package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +0 -220
- package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +0 -282
- package/dist/extensions/agent-browser/lib/browser-legacy-types.js +0 -1
- package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +0 -217
- package/dist/extensions/agent-browser/lib/browser-session-conversion.js +0 -126
- package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +0 -35
- package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +0 -166
- package/dist/extensions/agent-browser/lib/browser-transcript.js +0 -189
- package/dist/extensions/agent-browser/lib/browser-value-parsing.js +0 -15
- package/dist/extensions/agent-browser/lib/command-capabilities.js +0 -340
- package/dist/extensions/agent-browser/lib/command-policy.js +0 -155
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +0 -105
- package/dist/extensions/agent-browser/lib/config-policy.js +0 -450
- package/dist/extensions/agent-browser/lib/config-providers.js +0 -71
- package/dist/extensions/agent-browser/lib/config-validation.js +0 -231
- package/dist/extensions/agent-browser/lib/config.js +0 -69
- package/dist/extensions/agent-browser/lib/electron/cdp.js +0 -62
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +0 -274
- package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +0 -109
- package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +0 -136
- package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +0 -90
- package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +0 -93
- package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +0 -162
- package/dist/extensions/agent-browser/lib/electron/discovery-types.js +0 -2
- package/dist/extensions/agent-browser/lib/electron/discovery.js +0 -217
- package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +0 -102
- package/dist/extensions/agent-browser/lib/electron/launch-process.js +0 -209
- package/dist/extensions/agent-browser/lib/electron/launch-types.js +0 -2
- package/dist/extensions/agent-browser/lib/electron/launch.js +0 -340
- package/dist/extensions/agent-browser/lib/executable-path.js +0 -29
- package/dist/extensions/agent-browser/lib/execution-cwd.js +0 -67
- package/dist/extensions/agent-browser/lib/fs-utils.js +0 -10
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +0 -201
- package/dist/extensions/agent-browser/lib/input-modes/job.js +0 -198
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +0 -116
- package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +0 -132
- package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +0 -57
- package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +0 -151
- package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +0 -142
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +0 -84
- package/dist/extensions/agent-browser/lib/input-modes/params.js +0 -195
- package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +0 -268
- package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +0 -117
- package/dist/extensions/agent-browser/lib/input-modes/script-child.js +0 -396
- package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +0 -86
- package/dist/extensions/agent-browser/lib/input-modes/script-types.js +0 -1
- package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +0 -60
- package/dist/extensions/agent-browser/lib/input-modes/script.js +0 -108
- package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +0 -243
- package/dist/extensions/agent-browser/lib/input-modes/shared.js +0 -48
- package/dist/extensions/agent-browser/lib/input-modes/types.js +0 -65
- package/dist/extensions/agent-browser/lib/json-schema.js +0 -65
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +0 -212
- package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +0 -165
- package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +0 -58
- package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +0 -244
- package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +0 -84
- package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +0 -119
- package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +0 -83
- package/dist/extensions/agent-browser/lib/managed-session-restore.js +0 -212
- package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +0 -277
- package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +0 -181
- package/dist/extensions/agent-browser/lib/managed-session-storage.js +0 -126
- package/dist/extensions/agent-browser/lib/native-confirmation.js +0 -140
- package/dist/extensions/agent-browser/lib/native-output.js +0 -81
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +0 -30
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +0 -188
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +0 -82
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +0 -406
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +0 -31
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +0 -240
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +0 -203
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +0 -109
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +0 -119
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +0 -147
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +0 -144
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +0 -123
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +0 -156
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +0 -187
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +0 -39
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +0 -89
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +0 -97
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +0 -106
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +0 -110
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +0 -53
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +0 -224
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +0 -290
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +0 -167
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +0 -108
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +0 -174
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +0 -65
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +0 -120
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +0 -192
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +0 -225
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +0 -150
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +0 -174
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +0 -147
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +0 -145
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +0 -159
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +0 -131
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +0 -93
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +0 -42
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +0 -242
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +0 -75
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +0 -92
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +0 -254
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +0 -121
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +0 -130
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +0 -114
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +0 -121
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +0 -222
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +0 -68
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +0 -202
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +0 -191
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +0 -152
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +0 -150
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +0 -115
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +0 -256
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +0 -256
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +0 -93
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +0 -113
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +0 -316
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +0 -28
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +0 -142
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +0 -333
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +0 -71
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +0 -201
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +0 -183
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +0 -200
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +0 -142
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +0 -25
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +0 -50
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +0 -198
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +0 -154
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +0 -80
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +0 -14
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +0 -206
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +0 -130
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +0 -212
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +0 -61
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +0 -187
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +0 -169
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +0 -228
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +0 -117
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +0 -256
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +0 -108
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/types.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +0 -39
- package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +0 -119
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +0 -93
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +0 -58
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +0 -78
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +0 -106
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +0 -60
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +0 -86
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +0 -68
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +0 -169
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +0 -161
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +0 -167
- package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +0 -98
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +0 -211
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +0 -23
- package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +0 -99
- package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +0 -275
- package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +0 -280
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +0 -303
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +0 -36
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +0 -335
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +0 -227
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +0 -204
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +0 -139
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +0 -24
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +0 -98
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +0 -295
- package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +0 -41
- package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +0 -7
- package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +0 -102
- package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +0 -133
- package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +0 -120
- package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +0 -180
- package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +0 -290
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +0 -269
- package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +0 -113
- package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +0 -146
- package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +0 -58
- package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +0 -62
- package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +0 -54
- package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +0 -313
- package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +0 -62
- package/dist/extensions/agent-browser/lib/orchestration/native-config.js +0 -144
- package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +0 -77
- package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +0 -231
- package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +0 -142
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +0 -276
- package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +0 -220
- package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +0 -55
- package/dist/extensions/agent-browser/lib/page-target-batch.js +0 -118
- package/dist/extensions/agent-browser/lib/page-target-guards.js +0 -50
- package/dist/extensions/agent-browser/lib/page-target-navigation.js +0 -104
- package/dist/extensions/agent-browser/lib/page-target-validation.js +0 -90
- package/dist/extensions/agent-browser/lib/parsing.js +0 -30
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +0 -343
- package/dist/extensions/agent-browser/lib/playbook.js +0 -146
- package/dist/extensions/agent-browser/lib/process-child.js +0 -284
- package/dist/extensions/agent-browser/lib/process-environment.js +0 -48
- package/dist/extensions/agent-browser/lib/process-errors.js +0 -23
- package/dist/extensions/agent-browser/lib/process-identity.js +0 -127
- package/dist/extensions/agent-browser/lib/process-socket-storage.js +0 -256
- package/dist/extensions/agent-browser/lib/process-stdout.js +0 -74
- package/dist/extensions/agent-browser/lib/process.js +0 -216
- package/dist/extensions/agent-browser/lib/prompt-artifacts.js +0 -287
- package/dist/extensions/agent-browser/lib/prompt-policy.js +0 -54
- package/dist/extensions/agent-browser/lib/read-command.js +0 -41
- package/dist/extensions/agent-browser/lib/read-confirmation.js +0 -162
- package/dist/extensions/agent-browser/lib/recording-reservations.js +0 -208
- package/dist/extensions/agent-browser/lib/redaction-fields.js +0 -75
- package/dist/extensions/agent-browser/lib/redaction-json.js +0 -149
- package/dist/extensions/agent-browser/lib/redaction-url.js +0 -88
- package/dist/extensions/agent-browser/lib/results/action-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/action-recommendations.js +0 -38
- package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +0 -133
- package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +0 -173
- package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +0 -73
- package/dist/extensions/agent-browser/lib/results/categories.js +0 -152
- package/dist/extensions/agent-browser/lib/results/confirmation.js +0 -75
- package/dist/extensions/agent-browser/lib/results/contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +0 -99
- package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +0 -83
- package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +0 -48
- package/dist/extensions/agent-browser/lib/results/envelope.js +0 -198
- package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +0 -180
- package/dist/extensions/agent-browser/lib/results/network-routes.js +0 -133
- package/dist/extensions/agent-browser/lib/results/network.js +0 -89
- package/dist/extensions/agent-browser/lib/results/next-actions.js +0 -111
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +0 -320
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +0 -138
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +0 -113
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +0 -145
- package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +0 -165
- package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +0 -118
- package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +0 -68
- package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +0 -135
- package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +0 -227
- package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +0 -91
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +0 -123
- package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +0 -54
- package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +0 -216
- package/dist/extensions/agent-browser/lib/results/presentation/common.js +0 -81
- package/dist/extensions/agent-browser/lib/results/presentation/content.js +0 -119
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +0 -67
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +0 -79
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +0 -199
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +0 -75
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +0 -216
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +0 -124
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +0 -64
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +0 -209
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +0 -69
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +0 -222
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +0 -124
- package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +0 -70
- package/dist/extensions/agent-browser/lib/results/presentation/errors.js +0 -285
- package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +0 -117
- package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +0 -231
- package/dist/extensions/agent-browser/lib/results/presentation/notices.js +0 -75
- package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +0 -127
- package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +0 -120
- package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +0 -77
- package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +0 -51
- package/dist/extensions/agent-browser/lib/results/presentation/registry.js +0 -145
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +0 -104
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +0 -183
- package/dist/extensions/agent-browser/lib/results/presentation/source.js +0 -109
- package/dist/extensions/agent-browser/lib/results/presentation.js +0 -19
- package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/recording.js +0 -88
- package/dist/extensions/agent-browser/lib/results/recovery-actions.js +0 -118
- package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +0 -60
- package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +0 -83
- package/dist/extensions/agent-browser/lib/results/selector-recovery.js +0 -261
- package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +0 -266
- package/dist/extensions/agent-browser/lib/results/snapshot-content.js +0 -32
- package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +0 -240
- package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +0 -103
- package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +0 -383
- package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +0 -53
- package/dist/extensions/agent-browser/lib/results/snapshot.js +0 -44
- package/dist/extensions/agent-browser/lib/results/text.js +0 -44
- package/dist/extensions/agent-browser/lib/runtime-args-validation.js +0 -133
- package/dist/extensions/agent-browser/lib/runtime-compatibility.js +0 -81
- package/dist/extensions/agent-browser/lib/runtime-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/runtime-redaction.js +0 -118
- package/dist/extensions/agent-browser/lib/runtime-replay-events.js +0 -144
- package/dist/extensions/agent-browser/lib/runtime-session-identity.js +0 -76
- package/dist/extensions/agent-browser/lib/runtime-session-plan.js +0 -114
- package/dist/extensions/agent-browser/lib/runtime-session-replay.js +0 -123
- package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +0 -65
- package/dist/extensions/agent-browser/lib/runtime-timeouts.js +0 -28
- package/dist/extensions/agent-browser/lib/runtime.js +0 -163
- package/dist/extensions/agent-browser/lib/session-identity.js +0 -51
- package/dist/extensions/agent-browser/lib/session-page-observation.js +0 -357
- package/dist/extensions/agent-browser/lib/session-page-state.js +0 -353
- package/dist/extensions/agent-browser/lib/session-page-types.js +0 -1
- package/dist/extensions/agent-browser/lib/string-enum-schema.js +0 -8
- package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +0 -81
- package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +0 -7
- package/dist/extensions/agent-browser/lib/temp-root-ownership.js +0 -234
- package/dist/extensions/agent-browser/lib/temp-root.js +0 -211
- package/dist/extensions/agent-browser/lib/temp.js +0 -91
- package/dist/extensions/agent-browser/lib/tool-surface.js +0 -239
- package/dist/extensions/agent-browser/lib/upstream-version.js +0 -15
- package/dist/extensions/agent-browser/lib/web-search-providers.js +0 -193
- package/dist/extensions/agent-browser/lib/web-search-request.js +0 -102
- package/dist/extensions/agent-browser/lib/web-search-results.js +0 -281
- package/dist/extensions/agent-browser/lib/web-search-schema.js +0 -82
- package/dist/extensions/agent-browser/lib/web-search.js +0 -167
- package/dist/extensions/agent-browser/lib/webmcp-observation.js +0 -35
- package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +0 -96
- package/dist/scripts/agent-browser-target.mjs +0 -23
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../parsing.js";
|
|
2
|
-
import { isStringArray } from "./shared.js";
|
|
3
|
-
import { AGENT_BROWSER_QA_LOAD_STATES, } from "./types.js";
|
|
4
|
-
export { analyzeQaPresetResults, analyzeQaPresetTimeout } from "./qa-analysis.js";
|
|
5
|
-
export { extractQaPageContext, buildQaCompactPassText, buildQaCompactFailureText, } from "./qa-presentation.js";
|
|
6
|
-
const QA_VISIBLE_TEXT_TIMEOUT_MS = 5_000;
|
|
7
|
-
function buildQaVisibleTextPredicate(text) {
|
|
8
|
-
return `(() => {
|
|
9
|
-
const expected = ${JSON.stringify(text)}.replace(/\\s+/g, " ").trim();
|
|
10
|
-
if (!expected) return false;
|
|
11
|
-
const root = document.body || document.documentElement;
|
|
12
|
-
if (!root) return false;
|
|
13
|
-
const skipTags = new Set(["SCRIPT", "STYLE", "NOSCRIPT", "SVG"]);
|
|
14
|
-
const normalize = (value) => String(value ?? "").replace(/\\s+/g, " ").trim();
|
|
15
|
-
const isVisibleElement = (element) => {
|
|
16
|
-
if (!(element instanceof HTMLElement)) return false;
|
|
17
|
-
if (skipTags.has(element.tagName)) return false;
|
|
18
|
-
const style = window.getComputedStyle(element);
|
|
19
|
-
if (style.display === "none" || style.visibility === "hidden" || Number(style.opacity) === 0) return false;
|
|
20
|
-
return element.getClientRects().length > 0;
|
|
21
|
-
};
|
|
22
|
-
const ancestorsAllowVisibility = (node) => {
|
|
23
|
-
for (let element = node.parentElement; element; element = element.parentElement) {
|
|
24
|
-
const style = window.getComputedStyle(element);
|
|
25
|
-
if (style.display === "none" || Number(style.opacity) === 0) return false;
|
|
26
|
-
if (element === root) break;
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
};
|
|
30
|
-
const textWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
|
31
|
-
let visitedText = 0;
|
|
32
|
-
for (let node = textWalker.nextNode(); node && visitedText < 6000; node = textWalker.nextNode(), visitedText += 1) {
|
|
33
|
-
const parent = node.parentElement;
|
|
34
|
-
if (!(parent instanceof HTMLElement) || skipTags.has(parent.tagName)) continue;
|
|
35
|
-
if (window.getComputedStyle(parent).visibility === "hidden" || !ancestorsAllowVisibility(node)) continue;
|
|
36
|
-
if (normalize(node.nodeValue).includes(expected)) return true;
|
|
37
|
-
}
|
|
38
|
-
const elementWalker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
|
|
39
|
-
let visitedElements = 0;
|
|
40
|
-
for (let node = elementWalker.nextNode(); node && visitedElements < 3000; node = elementWalker.nextNode(), visitedElements += 1) {
|
|
41
|
-
const element = node;
|
|
42
|
-
if (!isVisibleElement(element) || !ancestorsAllowVisibility(element) || !("value" in element)) continue;
|
|
43
|
-
if (normalize(element.value).includes(expected)) return true;
|
|
44
|
-
}
|
|
45
|
-
return false;
|
|
46
|
-
})()`;
|
|
47
|
-
}
|
|
48
|
-
function validateQaIdentity(input) {
|
|
49
|
-
if (input.attached !== undefined && typeof input.attached !== "boolean") {
|
|
50
|
-
return "qa.attached must be a boolean when provided.";
|
|
51
|
-
}
|
|
52
|
-
if (input.attached === true) {
|
|
53
|
-
return input.url === undefined ? undefined : "qa.url must be omitted when qa.attached is true.";
|
|
54
|
-
}
|
|
55
|
-
return typeof input.url !== "string" || input.url.trim().length === 0
|
|
56
|
-
? "qa.url must be a non-empty string."
|
|
57
|
-
: undefined;
|
|
58
|
-
}
|
|
59
|
-
function validateQaOptions(input) {
|
|
60
|
-
for (const field of ["expectedSelector", "screenshotPath"]) {
|
|
61
|
-
const value = input[field];
|
|
62
|
-
if (value !== undefined && (typeof value !== "string" || value.trim().length === 0)) {
|
|
63
|
-
return `qa.${field} must be a non-empty string when provided.`;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
for (const field of ["checkConsole", "checkErrors", "checkNetwork"]) {
|
|
67
|
-
const value = input[field];
|
|
68
|
-
if (value !== undefined && typeof value !== "boolean") {
|
|
69
|
-
return `qa.${field} must be a boolean when provided.`;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
function normalizeExpectedText(value) {
|
|
75
|
-
if (value === undefined) {
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
return typeof value === "string" ? [value] : value;
|
|
79
|
-
}
|
|
80
|
-
function validateQa(input) {
|
|
81
|
-
if (!isRecord(input)) {
|
|
82
|
-
return { error: "qa must be an object." };
|
|
83
|
-
}
|
|
84
|
-
const identityError = validateQaIdentity(input);
|
|
85
|
-
if (identityError !== undefined) {
|
|
86
|
-
return { error: identityError };
|
|
87
|
-
}
|
|
88
|
-
const expectedText = normalizeExpectedText(input.expectedText);
|
|
89
|
-
if (!isStringArray(expectedText) || expectedText.some((text) => text.trim().length === 0)) {
|
|
90
|
-
return {
|
|
91
|
-
error: "qa.expectedText must be a non-empty string or array of non-empty strings when provided.",
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
const optionsError = validateQaOptions(input);
|
|
95
|
-
if (optionsError !== undefined) {
|
|
96
|
-
return { error: optionsError };
|
|
97
|
-
}
|
|
98
|
-
const loadState = AGENT_BROWSER_QA_LOAD_STATES.find((value) => value === input.loadState);
|
|
99
|
-
if (input.loadState !== undefined && loadState === undefined) {
|
|
100
|
-
return { error: `qa.loadState must be one of: ${AGENT_BROWSER_QA_LOAD_STATES.join(", ")}.` };
|
|
101
|
-
}
|
|
102
|
-
return { checks: qaChecks(input, expectedText, loadState ?? "domcontentloaded") };
|
|
103
|
-
}
|
|
104
|
-
function qaChecks(input, expectedText, loadState) {
|
|
105
|
-
const attached = input.attached === true;
|
|
106
|
-
return {
|
|
107
|
-
attached,
|
|
108
|
-
checkConsole: typeof input.checkConsole === "boolean" ? input.checkConsole : !attached,
|
|
109
|
-
checkErrors: typeof input.checkErrors === "boolean" ? input.checkErrors : !attached,
|
|
110
|
-
checkNetwork: typeof input.checkNetwork === "boolean" ? input.checkNetwork : !attached,
|
|
111
|
-
diagnosticsResetAtStart: !attached,
|
|
112
|
-
expectedSelector: typeof input.expectedSelector === "string" ? input.expectedSelector : undefined,
|
|
113
|
-
expectedText,
|
|
114
|
-
loadState,
|
|
115
|
-
screenshotPath: typeof input.screenshotPath === "string" ? input.screenshotPath : undefined,
|
|
116
|
-
url: typeof input.url === "string" ? input.url.trim() : undefined,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
function diagnosticResetSteps(checks) {
|
|
120
|
-
const steps = [];
|
|
121
|
-
if (!checks.diagnosticsResetAtStart) {
|
|
122
|
-
return steps;
|
|
123
|
-
}
|
|
124
|
-
if (checks.checkNetwork) {
|
|
125
|
-
steps.push({ action: "wait", args: ["network", "requests", "--clear"] });
|
|
126
|
-
}
|
|
127
|
-
if (checks.checkConsole) {
|
|
128
|
-
steps.push({ action: "wait", args: ["console", "--clear"] });
|
|
129
|
-
}
|
|
130
|
-
if (checks.checkErrors) {
|
|
131
|
-
steps.push({ action: "wait", args: ["errors", "--clear"] });
|
|
132
|
-
steps.push({ action: "wait", args: ["errors"], generatedFrom: "qa.errorBaselineAfterClear" });
|
|
133
|
-
}
|
|
134
|
-
return steps;
|
|
135
|
-
}
|
|
136
|
-
function readinessSteps(checks) {
|
|
137
|
-
const steps = [];
|
|
138
|
-
if (!checks.attached && checks.url !== undefined && checks.url.length > 0) {
|
|
139
|
-
steps.push({ action: "open", args: ["open", checks.url] });
|
|
140
|
-
}
|
|
141
|
-
steps.push({ action: "wait", args: ["wait", "--load", checks.loadState] });
|
|
142
|
-
if (checks.checkConsole || checks.checkErrors) {
|
|
143
|
-
steps.push({ action: "wait", args: ["wait", "150"], generatedFrom: "qa.diagnosticSettle" });
|
|
144
|
-
}
|
|
145
|
-
for (const text of checks.expectedText) {
|
|
146
|
-
steps.push({
|
|
147
|
-
action: "assertText",
|
|
148
|
-
args: [
|
|
149
|
-
"wait",
|
|
150
|
-
"--fn",
|
|
151
|
-
buildQaVisibleTextPredicate(text),
|
|
152
|
-
"--timeout",
|
|
153
|
-
String(QA_VISIBLE_TEXT_TIMEOUT_MS),
|
|
154
|
-
],
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
if (checks.expectedSelector !== undefined) {
|
|
158
|
-
steps.push({ action: "wait", args: ["wait", checks.expectedSelector] });
|
|
159
|
-
}
|
|
160
|
-
return steps;
|
|
161
|
-
}
|
|
162
|
-
function diagnosticReadSteps(checks) {
|
|
163
|
-
const steps = [];
|
|
164
|
-
if (checks.checkNetwork) {
|
|
165
|
-
steps.push({ action: "wait", args: ["network", "requests"] });
|
|
166
|
-
}
|
|
167
|
-
if (checks.checkConsole) {
|
|
168
|
-
steps.push({ action: "wait", args: ["console"] });
|
|
169
|
-
}
|
|
170
|
-
if (checks.checkErrors) {
|
|
171
|
-
steps.push({ action: "wait", args: ["errors"] });
|
|
172
|
-
}
|
|
173
|
-
if (checks.screenshotPath !== undefined) {
|
|
174
|
-
steps.push({ action: "screenshot", args: ["screenshot", checks.screenshotPath] });
|
|
175
|
-
}
|
|
176
|
-
return steps;
|
|
177
|
-
}
|
|
178
|
-
export function compileAgentBrowserQaPreset(input) {
|
|
179
|
-
const validation = validateQa(input);
|
|
180
|
-
if (validation.error !== undefined) {
|
|
181
|
-
return { error: validation.error };
|
|
182
|
-
}
|
|
183
|
-
const checks = validation.checks;
|
|
184
|
-
const steps = [
|
|
185
|
-
...diagnosticResetSteps(checks),
|
|
186
|
-
...readinessSteps(checks),
|
|
187
|
-
...diagnosticReadSteps(checks),
|
|
188
|
-
];
|
|
189
|
-
return {
|
|
190
|
-
compiled: {
|
|
191
|
-
args: ["batch", "--bail"],
|
|
192
|
-
checks,
|
|
193
|
-
failFast: true,
|
|
194
|
-
stdin: JSON.stringify(steps.map((step) => step.args)),
|
|
195
|
-
steps,
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../parsing.js";
|
|
2
|
-
import { getLookupResultPayload, sourceCandidatesFromValue } from "./lookup-source-evidence.js";
|
|
3
|
-
import { getBatchResultItems } from "./shared.js";
|
|
4
|
-
function networkRequestMatchesQuery(url, queryText) {
|
|
5
|
-
return (queryText === undefined ||
|
|
6
|
-
url === undefined ||
|
|
7
|
-
url.includes(queryText) ||
|
|
8
|
-
queryText.includes(url));
|
|
9
|
-
}
|
|
10
|
-
function isFailedNetworkRecord(request) {
|
|
11
|
-
const status = typeof request.status === "number" ? request.status : undefined;
|
|
12
|
-
const error = typeof request.error === "string" ? request.error : undefined;
|
|
13
|
-
return request.failed === true || error !== undefined || (status !== undefined && status >= 400);
|
|
14
|
-
}
|
|
15
|
-
function requestId(request) {
|
|
16
|
-
if (typeof request.id === "string") {
|
|
17
|
-
return request.id;
|
|
18
|
-
}
|
|
19
|
-
return typeof request.requestId === "string" ? request.requestId : undefined;
|
|
20
|
-
}
|
|
21
|
-
function failedRequestValues(payload) {
|
|
22
|
-
if (isRecord(payload) && Array.isArray(payload.requests)) {
|
|
23
|
-
return payload.requests;
|
|
24
|
-
}
|
|
25
|
-
if (Array.isArray(payload)) {
|
|
26
|
-
return payload;
|
|
27
|
-
}
|
|
28
|
-
return isRecord(payload) ? [payload] : [];
|
|
29
|
-
}
|
|
30
|
-
export function getFailedNetworkRequests(data, queryText) {
|
|
31
|
-
const failed = [];
|
|
32
|
-
for (const item of getBatchResultItems(data)) {
|
|
33
|
-
for (const request of failedRequestValues(getLookupResultPayload(item))) {
|
|
34
|
-
if (!isRecord(request)) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
const url = typeof request.url === "string" ? request.url : undefined;
|
|
38
|
-
if (!networkRequestMatchesQuery(url, queryText) || !isFailedNetworkRecord(request)) {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
failed.push({
|
|
42
|
-
error: typeof request.error === "string" ? request.error : undefined,
|
|
43
|
-
method: typeof request.method === "string" ? request.method : undefined,
|
|
44
|
-
requestId: requestId(request),
|
|
45
|
-
status: typeof request.status === "number" ? request.status : undefined,
|
|
46
|
-
url,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const seenRequestIds = new Set();
|
|
51
|
-
return failed.filter(({ requestId: id }) => {
|
|
52
|
-
if (id === undefined) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
if (seenRequestIds.has(id)) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
seenRequestIds.add(id);
|
|
59
|
-
return true;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
export function distinctNetworkCandidates(candidates) {
|
|
63
|
-
const keys = new Set();
|
|
64
|
-
return candidates.filter((candidate) => {
|
|
65
|
-
const key = [
|
|
66
|
-
candidate.source,
|
|
67
|
-
candidate.file ?? "",
|
|
68
|
-
candidate.line ?? "",
|
|
69
|
-
candidate.requestUrl ?? "",
|
|
70
|
-
].join(":");
|
|
71
|
-
if (keys.has(key)) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
keys.add(key);
|
|
75
|
-
return true;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
function initiatorCandidates(request) {
|
|
79
|
-
const requestUrl = typeof request.url === "string" ? request.url : undefined;
|
|
80
|
-
return [request.initiator, request.stack, request.source, request.trace].flatMap((field) => sourceCandidatesFromValue(field, {
|
|
81
|
-
source: "dom-attribute",
|
|
82
|
-
evidence: ["failed network request included source-like initiator metadata"],
|
|
83
|
-
}).map((candidate) => ({
|
|
84
|
-
confidence: "medium",
|
|
85
|
-
evidence: candidate.evidence,
|
|
86
|
-
file: candidate.file,
|
|
87
|
-
line: candidate.line,
|
|
88
|
-
requestUrl,
|
|
89
|
-
source: "initiator",
|
|
90
|
-
})));
|
|
91
|
-
}
|
|
92
|
-
function correlatesWithFailure(value, failedIds, failedUrls) {
|
|
93
|
-
const id = requestId(value);
|
|
94
|
-
const url = typeof value.url === "string" ? value.url : undefined;
|
|
95
|
-
return (id !== undefined && failedIds.has(id)) || (url !== undefined && failedUrls.has(url));
|
|
96
|
-
}
|
|
97
|
-
export function observeInitiatorCandidates(data, failedRequests, queryText) {
|
|
98
|
-
const failedIds = new Set(failedRequests.map((request) => request.requestId).filter((value) => value !== undefined));
|
|
99
|
-
const failedUrls = new Set(failedRequests.map((request) => request.url).filter((value) => value !== undefined));
|
|
100
|
-
const candidates = [];
|
|
101
|
-
for (const item of getBatchResultItems(data)) {
|
|
102
|
-
const payload = getLookupResultPayload(item);
|
|
103
|
-
const values = isRecord(payload) && Array.isArray(payload.requests) ? payload.requests : [payload];
|
|
104
|
-
for (const value of values) {
|
|
105
|
-
if (!isRecord(value)) {
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
const url = typeof value.url === "string" ? value.url : undefined;
|
|
109
|
-
if (networkRequestMatchesQuery(url, queryText) &&
|
|
110
|
-
(correlatesWithFailure(value, failedIds, failedUrls) || isFailedNetworkRecord(value))) {
|
|
111
|
-
candidates.push(...initiatorCandidates(value));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return distinctNetworkCandidates(candidates);
|
|
116
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../parsing.js";
|
|
2
|
-
import { validateLookupMaxWorkspaceFiles } from "./shared.js";
|
|
3
|
-
function optionalString(value) {
|
|
4
|
-
return typeof value === "string" ? value : undefined;
|
|
5
|
-
}
|
|
6
|
-
function validateString(value, field, allowEmpty = false) {
|
|
7
|
-
if (value === undefined) {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
if (typeof value === "string" && (value.trim().length > 0 || (allowEmpty && value === ""))) {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
if (allowEmpty) {
|
|
14
|
-
return `${field} must be a non-empty string or the empty default namespace when provided.`;
|
|
15
|
-
}
|
|
16
|
-
return `${field} must be a non-empty string when provided.`;
|
|
17
|
-
}
|
|
18
|
-
function validateSourceQuery(input) {
|
|
19
|
-
for (const field of ["selector", "reactFiberId", "componentName"]) {
|
|
20
|
-
const error = validateString(input[field], `sourceLookup.${field}`);
|
|
21
|
-
if (error !== undefined) {
|
|
22
|
-
return error;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (input.selector === undefined &&
|
|
26
|
-
input.reactFiberId === undefined &&
|
|
27
|
-
input.componentName === undefined) {
|
|
28
|
-
return "sourceLookup requires selector, reactFiberId, or componentName.";
|
|
29
|
-
}
|
|
30
|
-
if (input.includeDomHints !== undefined && typeof input.includeDomHints !== "boolean") {
|
|
31
|
-
return "sourceLookup.includeDomHints must be a boolean when provided.";
|
|
32
|
-
}
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
function planSourceSteps(query) {
|
|
36
|
-
const steps = [];
|
|
37
|
-
if (query.selector !== undefined) {
|
|
38
|
-
steps.push({ action: "dom", args: ["is", "visible", query.selector] });
|
|
39
|
-
if (query.includeDomHints) {
|
|
40
|
-
steps.push({ action: "dom", args: ["get", "html", query.selector] });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (query.reactFiberId !== undefined) {
|
|
44
|
-
steps.push({ action: "react", args: ["react", "inspect", query.reactFiberId] });
|
|
45
|
-
}
|
|
46
|
-
if (query.componentName !== undefined) {
|
|
47
|
-
steps.push({ action: "react", args: ["react", "tree"] });
|
|
48
|
-
}
|
|
49
|
-
return steps;
|
|
50
|
-
}
|
|
51
|
-
export function compileAgentBrowserSourceLookup(input) {
|
|
52
|
-
if (!isRecord(input)) {
|
|
53
|
-
return { error: "sourceLookup must be an object." };
|
|
54
|
-
}
|
|
55
|
-
const error = validateSourceQuery(input);
|
|
56
|
-
if (error !== undefined) {
|
|
57
|
-
return { error };
|
|
58
|
-
}
|
|
59
|
-
const maxFiles = validateLookupMaxWorkspaceFiles(input.maxWorkspaceFiles, "sourceLookup.maxWorkspaceFiles");
|
|
60
|
-
if (maxFiles.error !== undefined) {
|
|
61
|
-
return { error: maxFiles.error };
|
|
62
|
-
}
|
|
63
|
-
const query = {
|
|
64
|
-
componentName: optionalString(input.componentName),
|
|
65
|
-
includeDomHints: input.includeDomHints !== false,
|
|
66
|
-
maxWorkspaceFiles: maxFiles.value,
|
|
67
|
-
reactFiberId: optionalString(input.reactFiberId),
|
|
68
|
-
selector: optionalString(input.selector),
|
|
69
|
-
};
|
|
70
|
-
const steps = planSourceSteps(query);
|
|
71
|
-
return {
|
|
72
|
-
compiled: {
|
|
73
|
-
args: ["batch"],
|
|
74
|
-
query,
|
|
75
|
-
stdin: JSON.stringify(steps.map((step) => step.args)),
|
|
76
|
-
steps,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function validateNetworkQuery(input) {
|
|
81
|
-
for (const field of ["filter", "requestId", "namespace", "session", "url"]) {
|
|
82
|
-
const error = validateString(input[field], `networkSourceLookup.${field}`, field === "namespace");
|
|
83
|
-
if (error !== undefined) {
|
|
84
|
-
return error;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (input.filter === undefined && input.requestId === undefined && input.url === undefined) {
|
|
88
|
-
return "networkSourceLookup requires requestId, filter, or url.";
|
|
89
|
-
}
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
function planNetworkSteps(query) {
|
|
93
|
-
const steps = [];
|
|
94
|
-
if (query.requestId !== undefined) {
|
|
95
|
-
steps.push({ action: "network", args: ["network", "request", query.requestId] });
|
|
96
|
-
}
|
|
97
|
-
const effectiveFilter = query.filter ?? query.url;
|
|
98
|
-
if (effectiveFilter !== undefined && effectiveFilter.length > 0) {
|
|
99
|
-
steps.push({ action: "network", args: ["network", "requests", "--filter", effectiveFilter] });
|
|
100
|
-
}
|
|
101
|
-
return steps;
|
|
102
|
-
}
|
|
103
|
-
export function compileAgentBrowserNetworkSourceLookup(input) {
|
|
104
|
-
if (!isRecord(input)) {
|
|
105
|
-
return { error: "networkSourceLookup must be an object." };
|
|
106
|
-
}
|
|
107
|
-
const error = validateNetworkQuery(input);
|
|
108
|
-
if (error !== undefined) {
|
|
109
|
-
return { error };
|
|
110
|
-
}
|
|
111
|
-
const maxFiles = validateLookupMaxWorkspaceFiles(input.maxWorkspaceFiles, "networkSourceLookup.maxWorkspaceFiles");
|
|
112
|
-
if (maxFiles.error !== undefined) {
|
|
113
|
-
return { error: maxFiles.error };
|
|
114
|
-
}
|
|
115
|
-
const query = {
|
|
116
|
-
filter: optionalString(input.filter),
|
|
117
|
-
maxWorkspaceFiles: maxFiles.value,
|
|
118
|
-
namespace: optionalString(input.namespace),
|
|
119
|
-
requestId: optionalString(input.requestId),
|
|
120
|
-
session: optionalString(input.session),
|
|
121
|
-
url: optionalString(input.url),
|
|
122
|
-
};
|
|
123
|
-
const steps = planNetworkSteps(query);
|
|
124
|
-
const args = [
|
|
125
|
-
...(query.namespace !== undefined ? ["--namespace", query.namespace] : []),
|
|
126
|
-
...(query.session !== undefined ? ["--session", query.session] : []),
|
|
127
|
-
"batch",
|
|
128
|
-
];
|
|
129
|
-
return {
|
|
130
|
-
compiled: { args, query, stdin: JSON.stringify(steps.map((step) => step.args)), steps },
|
|
131
|
-
};
|
|
132
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../parsing.js";
|
|
2
|
-
import { redactInvocationArgs, redactSensitiveText } from "../runtime-redaction.js";
|
|
3
|
-
export function redactNetworkSourceLookupUrl(value) {
|
|
4
|
-
if (value === undefined || value.length === 0) {
|
|
5
|
-
return value;
|
|
6
|
-
}
|
|
7
|
-
try {
|
|
8
|
-
const isRelative = value.startsWith("/");
|
|
9
|
-
const url = new URL(value, isRelative ? "https://redacted.invalid" : undefined);
|
|
10
|
-
url.username = url.username.length > 0 ? "[REDACTED]" : "";
|
|
11
|
-
url.password = url.password.length > 0 ? "[REDACTED]" : "";
|
|
12
|
-
// Snapshot keys before set() collapses duplicates and changes iterator positions.
|
|
13
|
-
for (const key of Array.from(url.searchParams.keys())) {
|
|
14
|
-
url.searchParams.set(key, "[REDACTED]");
|
|
15
|
-
}
|
|
16
|
-
if (/(?:token|secret|password|passwd|pwd|key|auth|session|jwt|credential)/i.test(url.hash)) {
|
|
17
|
-
url.hash = "#[REDACTED]";
|
|
18
|
-
}
|
|
19
|
-
return isRelative ? `${url.pathname}${url.search}${url.hash}` : url.toString();
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return redactSensitiveText(value
|
|
23
|
-
.replace(/([a-z][a-z0-9+.-]*:\/\/)\S+:\S+@/gi, "$1[REDACTED]@")
|
|
24
|
-
.replace(/([?&][^=]+)=([^&#\s"'\]]+)/g, "$1=[REDACTED]"));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export function redactNetworkSourceLookupArgs(args) {
|
|
28
|
-
return redactInvocationArgs(args).map((arg) => redactNetworkSourceLookupUrl(arg) ?? arg);
|
|
29
|
-
}
|
|
30
|
-
export function redactNetworkSourceLookupSurface(value) {
|
|
31
|
-
if (typeof value === "string") {
|
|
32
|
-
return redactNetworkSourceLookupUrl(value) ?? value;
|
|
33
|
-
}
|
|
34
|
-
if (Array.isArray(value)) {
|
|
35
|
-
return value.map((item) => redactNetworkSourceLookupSurface(item));
|
|
36
|
-
}
|
|
37
|
-
if (!isRecord(value)) {
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, redactNetworkSourceLookupSurface(item)]));
|
|
41
|
-
}
|
|
42
|
-
export function redactNetworkSourceLookupAnalysis(analysis) {
|
|
43
|
-
return {
|
|
44
|
-
...analysis,
|
|
45
|
-
candidates: analysis.candidates.map((candidate) => ({
|
|
46
|
-
...candidate,
|
|
47
|
-
evidence: candidate.evidence.map((item) => redactNetworkSourceLookupUrl(item) ?? redactSensitiveText(item)),
|
|
48
|
-
file: redactNetworkSourceLookupUrl(candidate.file),
|
|
49
|
-
requestUrl: redactNetworkSourceLookupUrl(candidate.requestUrl),
|
|
50
|
-
})),
|
|
51
|
-
failedRequests: analysis.failedRequests.map((request) => ({
|
|
52
|
-
...request,
|
|
53
|
-
error: redactNetworkSourceLookupUrl(request.error),
|
|
54
|
-
url: redactNetworkSourceLookupUrl(request.url),
|
|
55
|
-
})),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../parsing.js";
|
|
2
|
-
import { getBatchResultItems } from "./shared.js";
|
|
3
|
-
function extractStringField(value, names) {
|
|
4
|
-
for (const name of names) {
|
|
5
|
-
const field = value[name];
|
|
6
|
-
if (typeof field === "string" && field.trim().length > 0) {
|
|
7
|
-
return field;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
|
-
function extractNumberField(value, names) {
|
|
13
|
-
for (const name of names) {
|
|
14
|
-
const field = value[name];
|
|
15
|
-
if (typeof field === "number" && Number.isFinite(field)) {
|
|
16
|
-
return field;
|
|
17
|
-
}
|
|
18
|
-
if (typeof field === "string" && /^\d+$/.test(field)) {
|
|
19
|
-
return Number(field);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
function candidateKey(candidate) {
|
|
25
|
-
return [
|
|
26
|
-
candidate.source,
|
|
27
|
-
candidate.file ?? "",
|
|
28
|
-
candidate.line ?? "",
|
|
29
|
-
candidate.column ?? "",
|
|
30
|
-
candidate.componentName ?? "",
|
|
31
|
-
].join(":");
|
|
32
|
-
}
|
|
33
|
-
export function distinctSourceCandidates(candidates) {
|
|
34
|
-
const keys = new Set();
|
|
35
|
-
return candidates.filter((candidate) => {
|
|
36
|
-
const key = candidateKey(candidate);
|
|
37
|
-
if (keys.has(key)) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
keys.add(key);
|
|
41
|
-
return true;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function sourceTextCandidates(value, hint) {
|
|
45
|
-
const pattern = /([A-Za-z0-9_./@-]+\.(?:tsx|jsx|ts|js))(?:[:#](\d+))?(?:[:#](\d+))?/g;
|
|
46
|
-
return [...value.matchAll(pattern)].map((match) => ({
|
|
47
|
-
column: match.at(3) !== undefined ? Number(match[3]) : undefined,
|
|
48
|
-
confidence: hint.source === "react-inspect" ? "high" : "medium",
|
|
49
|
-
evidence: hint.evidence,
|
|
50
|
-
file: match[1],
|
|
51
|
-
line: match.at(2) !== undefined ? Number(match[2]) : undefined,
|
|
52
|
-
source: hint.source,
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
function sourceRecordCandidate(value, hint) {
|
|
56
|
-
const file = extractStringField(value, [
|
|
57
|
-
"file",
|
|
58
|
-
"fileName",
|
|
59
|
-
"filename",
|
|
60
|
-
"filePath",
|
|
61
|
-
"path",
|
|
62
|
-
"source",
|
|
63
|
-
"url",
|
|
64
|
-
]);
|
|
65
|
-
if (file === undefined || !/\.(?:tsx|jsx|ts|js)(?:$|[:?#])/.test(file)) {
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
return [
|
|
69
|
-
{
|
|
70
|
-
column: extractNumberField(value, ["column", "columnNumber", "col"]),
|
|
71
|
-
confidence: hint.source === "react-inspect" ? "high" : "medium",
|
|
72
|
-
evidence: hint.evidence,
|
|
73
|
-
file,
|
|
74
|
-
line: extractNumberField(value, ["line", "lineNumber"]),
|
|
75
|
-
source: hint.source,
|
|
76
|
-
},
|
|
77
|
-
];
|
|
78
|
-
}
|
|
79
|
-
export function sourceCandidatesFromValue(value, hint, depth = 0) {
|
|
80
|
-
if (depth > 6 || value === undefined || value === null) {
|
|
81
|
-
return [];
|
|
82
|
-
}
|
|
83
|
-
if (typeof value === "string") {
|
|
84
|
-
return sourceTextCandidates(value, hint);
|
|
85
|
-
}
|
|
86
|
-
if (Array.isArray(value)) {
|
|
87
|
-
return value.flatMap((item) => sourceCandidatesFromValue(item, hint, depth + 1));
|
|
88
|
-
}
|
|
89
|
-
if (!isRecord(value)) {
|
|
90
|
-
return [];
|
|
91
|
-
}
|
|
92
|
-
return [
|
|
93
|
-
...sourceRecordCandidate(value, hint),
|
|
94
|
-
...Object.values(value).flatMap((nested) => sourceCandidatesFromValue(nested, hint, depth + 1)),
|
|
95
|
-
];
|
|
96
|
-
}
|
|
97
|
-
function getHtmlAttributeValue(html, name) {
|
|
98
|
-
return new RegExp(`${name}=["']([^"']+)["']`, "i").exec(html)?.[1];
|
|
99
|
-
}
|
|
100
|
-
function htmlAttributeNumber(html, name) {
|
|
101
|
-
const value = getHtmlAttributeValue(html, name);
|
|
102
|
-
return value !== undefined && /^\d+$/.test(value) ? Number(value) : undefined;
|
|
103
|
-
}
|
|
104
|
-
function domSourceCandidates(html) {
|
|
105
|
-
if (typeof html !== "string") {
|
|
106
|
-
return [];
|
|
107
|
-
}
|
|
108
|
-
const file = getHtmlAttributeValue(html, "(?:data-source-file|data-file|data-component-file|data-source)");
|
|
109
|
-
const attributes = [];
|
|
110
|
-
if (file !== undefined && /\.(?:tsx|jsx|ts|js)$/.test(file)) {
|
|
111
|
-
attributes.push({
|
|
112
|
-
column: htmlAttributeNumber(html, "(?:data-source-column|data-column)"),
|
|
113
|
-
confidence: "medium",
|
|
114
|
-
evidence: ["selector HTML contained source-like data attributes"],
|
|
115
|
-
file,
|
|
116
|
-
line: htmlAttributeNumber(html, "(?:data-source-line|data-line)"),
|
|
117
|
-
source: "dom-attribute",
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
return [
|
|
121
|
-
...attributes,
|
|
122
|
-
...sourceCandidatesFromValue(html, {
|
|
123
|
-
source: "dom-attribute",
|
|
124
|
-
evidence: ["selector HTML contained source-like text"],
|
|
125
|
-
}),
|
|
126
|
-
];
|
|
127
|
-
}
|
|
128
|
-
export function getLookupResultPayload(item) {
|
|
129
|
-
return isRecord(item.result) && "data" in item.result ? item.result.data : item.result;
|
|
130
|
-
}
|
|
131
|
-
export function observeSourceCandidates(data) {
|
|
132
|
-
const candidates = [];
|
|
133
|
-
let unsupported = false;
|
|
134
|
-
for (const item of getBatchResultItems(data)) {
|
|
135
|
-
const command = Array.isArray(item.command) ? item.command : [];
|
|
136
|
-
const result = getLookupResultPayload(item);
|
|
137
|
-
if (item.success === false && command[0] === "react") {
|
|
138
|
-
unsupported = true;
|
|
139
|
-
}
|
|
140
|
-
if (command[0] === "react" && command[1] === "inspect") {
|
|
141
|
-
candidates.push(...sourceCandidatesFromValue(result, {
|
|
142
|
-
source: "react-inspect",
|
|
143
|
-
evidence: ["react inspect returned source-like metadata"],
|
|
144
|
-
}));
|
|
145
|
-
}
|
|
146
|
-
if (command[0] === "get" && command[1] === "html") {
|
|
147
|
-
candidates.push(...domSourceCandidates(result));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return { candidates: distinctSourceCandidates(candidates), unsupported };
|
|
151
|
-
}
|