pi-agent-browser-native 0.9.4 → 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 +48 -0
- package/README.md +60 -812
- package/dist/extensions/agent-browser/index.js +2381 -1706
- 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 +14 -3
- package/docs/CODE_QUALITY.md +39 -3
- package/docs/COMMAND_REFERENCE.md +22 -22
- package/docs/ELECTRON.md +24 -2
- package/docs/PERFORMANCE.md +243 -0
- package/docs/REFERENCE.md +869 -0
- package/docs/RELEASE.md +9 -9
- package/docs/REQUIREMENTS.md +1 -1
- package/docs/SESSION_STORAGE.md +11 -3
- package/docs/SUPPORT_MATRIX.md +16 -11
- package/docs/TOOL_CONTRACT.md +17 -13
- package/docs/performance/2026-10-12.json +7257 -0
- package/docs/platform-smoke.md +3 -3
- package/package.json +15 -3
- package/scripts/build.mjs +16 -5
- package/scripts/config.mjs +24 -20
- package/scripts/convert-browser-session.mjs +1 -1
- package/scripts/doctor.mjs +2 -2
- package/scripts/platform-smoke/lease-evidence.mjs +2 -4
- package/scripts/platform-smoke/linux-image/Dockerfile +8 -2
- package/scripts/platform-smoke/targets.mjs +1 -5
- 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 -218
- package/dist/extensions/agent-browser/lib/config.js +0 -69
- package/dist/extensions/agent-browser/lib/electron/cdp.js +0 -58
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +0 -308
- 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 -89
- 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 -329
- 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 -18
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +0 -201
- package/dist/extensions/agent-browser/lib/input-modes/job.js +0 -195
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +0 -104
- 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 -83
- 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 -202
- 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 -179
- 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 -165
- 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 -210
- 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 -171
- 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 -92
- 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 -69
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +0 -167
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +0 -164
- 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 -165
- 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 -178
- 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 -78
- 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 -207
- 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 -229
- package/dist/extensions/agent-browser/lib/web-search-request.js +0 -108
- 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 -149
- 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,117 +0,0 @@
|
|
|
1
|
-
import { isCloseCommand } from "../../command-taxonomy.js";
|
|
2
|
-
import { getSessionPageStateKey } from "../../session-page-state.js";
|
|
3
|
-
export { buildManagedSessionOutcome, formatManagedSessionOutcomeText, buildManagedSessionFreshFailureNextActions, } from "./session-state-outcomes.js";
|
|
4
|
-
export { extractStringResultField, extractNavigationSummaryFromData, shouldCaptureNavigationSummary, mergeNavigationSummaryIntoData, buildAboutBlankRecoveryHint, buildAboutBlankWarning, extractBatchResultCommand, } from "./session-state-observations.js";
|
|
5
|
-
export { getStaleRefArgs, getGuardedRefUsage, buildStaleRefPreflight, } from "./session-state-refs.js";
|
|
6
|
-
export { withSessionCommandObservation, nativePolicyDefinitelyUnestablished, runSessionCommandData, } from "./session-state-commands.js";
|
|
7
|
-
export { commandChoosesSessionTabTarget, shouldPinSessionTabForCommand, shouldCorrectSessionTabAfterCommand, collectOpenResultTabCorrection, collectSessionTabTarget, collectSessionTabSelection, ensureSessionTabTarget, applyOpenResultTabCorrection, } from "./session-state-tabs.js";
|
|
8
|
-
export { isLiveElectronRendererTarget, getLiveElectronRendererTargets, electronTargetLabel, getActiveElectronRecords, findElectronLaunchRecordForSession, buildElectronMismatchNextActions, buildElectronSessionMismatch, formatElectronSessionMismatchText, shouldInspectElectronPostCommandHealth, buildElectronLifecycleNextActions, buildElectronPostCommandHealthDiagnostic, formatElectronPostCommandHealthText, buildElectronIdentifiers, buildElectronRefFreshnessNextActions, buildElectronRefFreshnessDiagnostic, formatElectronRefFreshnessText, } from "./session-state-electron.js";
|
|
9
|
-
function managedLaunchUpdate(patch) {
|
|
10
|
-
return {
|
|
11
|
-
...("managedSessionCompatibilityWorkaround" in patch
|
|
12
|
-
? { managedSessionCompatibilityWorkaround: patch.managedSessionCompatibilityWorkaround }
|
|
13
|
-
: {}),
|
|
14
|
-
...(patch.managedSessionHeadedAutosaveDisabled !== undefined
|
|
15
|
-
? { managedSessionHeadedAutosaveDisabled: patch.managedSessionHeadedAutosaveDisabled }
|
|
16
|
-
: {}),
|
|
17
|
-
...("managedSessionHeadedAutosaveInterval" in patch
|
|
18
|
-
? { managedSessionHeadedAutosaveInterval: patch.managedSessionHeadedAutosaveInterval }
|
|
19
|
-
: {}),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function managedIdentityUpdate(patch) {
|
|
23
|
-
return {
|
|
24
|
-
...(patch.managedSessionCwd !== undefined
|
|
25
|
-
? { managedSessionCwd: patch.managedSessionCwd }
|
|
26
|
-
: {}),
|
|
27
|
-
...(patch.managedSessionName !== undefined
|
|
28
|
-
? { managedSessionName: patch.managedSessionName }
|
|
29
|
-
: {}),
|
|
30
|
-
...("managedSessionNamespace" in patch
|
|
31
|
-
? { managedSessionNamespace: patch.managedSessionNamespace }
|
|
32
|
-
: {}),
|
|
33
|
-
...(patch.managedSessionActive !== undefined
|
|
34
|
-
? { managedSessionActive: patch.managedSessionActive }
|
|
35
|
-
: {}),
|
|
36
|
-
...(patch.freshSessionOrdinal !== undefined
|
|
37
|
-
? { freshSessionOrdinal: patch.freshSessionOrdinal }
|
|
38
|
-
: {}),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export function applyBrowserRunStatePatch(state, patch) {
|
|
42
|
-
if (!patch) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if ("artifactManifest" in patch) {
|
|
46
|
-
state.artifactManifest = patch.artifactManifest;
|
|
47
|
-
}
|
|
48
|
-
if (patch.networkRoutesBySession) {
|
|
49
|
-
state.networkRoutesBySession = patch.networkRoutesBySession;
|
|
50
|
-
}
|
|
51
|
-
Object.assign(state, managedLaunchUpdate(patch), managedIdentityUpdate(patch));
|
|
52
|
-
}
|
|
53
|
-
export const getSessionContextKey = getSessionPageStateKey;
|
|
54
|
-
export function buildSessionDetailFields(sessionName, usedImplicitSession, namespace, managedSessionRestoreDisabled = false) {
|
|
55
|
-
return {
|
|
56
|
-
...(namespace !== undefined ? { namespace } : {}),
|
|
57
|
-
...((sessionName?.length ?? 0) > 0
|
|
58
|
-
? {
|
|
59
|
-
sessionName,
|
|
60
|
-
usedImplicitSession,
|
|
61
|
-
...(managedSessionRestoreDisabled ? { managedSessionRestoreDisabled: true } : {}),
|
|
62
|
-
}
|
|
63
|
-
: {}),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function getTraceOwner(command) {
|
|
67
|
-
return command === "trace" || command === "profiler" ? command : undefined;
|
|
68
|
-
}
|
|
69
|
-
export function getTraceOwnerGuardMessage(options) {
|
|
70
|
-
const owner = getTraceOwner(options.command);
|
|
71
|
-
const sessionName = options.sessionName;
|
|
72
|
-
if (owner === undefined ||
|
|
73
|
-
sessionName === undefined ||
|
|
74
|
-
sessionName.length === 0 ||
|
|
75
|
-
(options.subcommand !== "start" && options.subcommand !== "stop")) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const activeOwner = options.traceOwners.get(sessionName);
|
|
79
|
-
if (activeOwner === undefined || activeOwner === owner) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
return options.subcommand === "start"
|
|
83
|
-
? `Wrapper believes ${activeOwner} tracing is active for session ${sessionName}; stop ${activeOwner} before starting ${owner}.`
|
|
84
|
-
: `Wrapper believes tracing for session ${sessionName} is owned by ${activeOwner}; run ${activeOwner} stop instead of ${owner} stop.`;
|
|
85
|
-
}
|
|
86
|
-
export function updateTraceOwnerState(options) {
|
|
87
|
-
const sessionName = options.sessionName;
|
|
88
|
-
if (sessionName === undefined || sessionName.length === 0 || !options.succeeded) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (isCloseCommand(options.command)) {
|
|
92
|
-
options.traceOwners.delete(sessionName);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const owner = getTraceOwner(options.command);
|
|
96
|
-
if (owner === undefined) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (options.subcommand === "start") {
|
|
100
|
-
options.traceOwners.set(sessionName, owner);
|
|
101
|
-
}
|
|
102
|
-
if (options.subcommand === "stop" && options.traceOwners.get(sessionName) === owner) {
|
|
103
|
-
options.traceOwners.delete(sessionName);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
export function getPersistentSessionArtifactStore(ctx) {
|
|
107
|
-
const sessionDir = typeof ctx.sessionManager.getSessionDir === "function"
|
|
108
|
-
? ctx.sessionManager.getSessionDir()
|
|
109
|
-
: undefined;
|
|
110
|
-
const sessionId = ctx.sessionManager.getSessionId();
|
|
111
|
-
return sessionDir !== undefined &&
|
|
112
|
-
sessionDir.length > 0 &&
|
|
113
|
-
sessionId !== undefined &&
|
|
114
|
-
sessionId.length > 0
|
|
115
|
-
? { sessionDir, sessionId }
|
|
116
|
-
: undefined;
|
|
117
|
-
}
|
package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../../parsing.js";
|
|
2
|
-
import { withOptionalSessionArgs } from "../../results/next-actions.js";
|
|
3
|
-
import { redactSensitiveText } from "../../runtime-redaction.js";
|
|
4
|
-
import { extractBatchResultCommand, extractStringResultField, runSessionCommandData, } from "./session-state.js";
|
|
5
|
-
import { rawNumberField, rawStringField } from "./diagnostic-values.js";
|
|
6
|
-
const SELECTOR_TEXT_VISIBILITY_CANDIDATE_LIMIT = 8;
|
|
7
|
-
function buildVisibleTextProbeScript(selector) {
|
|
8
|
-
return `(() => {\n const selector = ${JSON.stringify(selector)};\n const isVisible = (element) => {\n const style = window.getComputedStyle(element);\n if (!style || style.display === 'none' || style.visibility === 'hidden' || style.visibility === 'collapse' || Number(style.opacity) === 0) return false;\n return Array.from(element.getClientRects()).some((rect) => rect.width > 0 && rect.height > 0);\n };\n let matches = [];\n try {\n matches = Array.from(document.querySelectorAll(selector));\n } catch (error) {\n return JSON.stringify({ selector, error: error instanceof Error ? error.message : String(error) });\n }\n const visible = matches.filter(isVisible);\n const trim = (value) => typeof value === 'string' ? value.trim().replace(/\\s+/g, ' ').slice(0, 200) : undefined;\n const describeCandidate = (element) => {\n const index = matches.indexOf(element);\n const role = element.getAttribute('role');\n const candidate = { index, tagName: element.tagName.toLowerCase(), textPreview: trim(element.textContent) };\n if (role) candidate.role = role;\n return candidate;\n };\n const visibleCandidates = visible.slice(0, ${SELECTOR_TEXT_VISIBILITY_CANDIDATE_LIMIT}).map(describeCandidate);\n return JSON.stringify({ selector, matchCount: matches.length, visibleCount: visible.length, firstMatchVisible: matches[0] ? isVisible(matches[0]) : undefined, firstTextPreview: trim(matches[0]?.textContent), firstVisibleTextPreview: trim(visible[0]?.textContent), visibleCandidates });\n})()`;
|
|
9
|
-
}
|
|
10
|
-
function parseVisibleTextCandidate(entry) {
|
|
11
|
-
if (!isRecord(entry) || typeof entry.index !== "number" || typeof entry.tagName !== "string") {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
const role = rawStringField(entry, "role");
|
|
15
|
-
const text = rawStringField(entry, "textPreview");
|
|
16
|
-
const textPreview = text !== undefined && text !== "" ? redactSensitiveText(text) : undefined;
|
|
17
|
-
return [
|
|
18
|
-
{
|
|
19
|
-
index: entry.index,
|
|
20
|
-
tagName: entry.tagName,
|
|
21
|
-
...(role !== undefined && role !== "" ? { role } : {}),
|
|
22
|
-
...(textPreview !== undefined && textPreview !== "" ? { textPreview } : {}),
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
}
|
|
26
|
-
function parseSelectorTextVisibilityCandidates(value) {
|
|
27
|
-
if (!Array.isArray(value)) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
const candidates = value.flatMap(parseVisibleTextCandidate);
|
|
31
|
-
return candidates.length > 0 ? candidates : undefined;
|
|
32
|
-
}
|
|
33
|
-
function parseSelectorTextVisibilityProbe(data, selector) {
|
|
34
|
-
const result = extractStringResultField(data, "result");
|
|
35
|
-
if (result === undefined) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
let parsed;
|
|
39
|
-
try {
|
|
40
|
-
parsed = JSON.parse(result);
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
if (!isRecord(parsed) || typeof parsed.error === "string") {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
const matchCount = rawNumberField(parsed, "matchCount");
|
|
49
|
-
const visibleCount = rawNumberField(parsed, "visibleCount");
|
|
50
|
-
if (matchCount === undefined || visibleCount === undefined) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
const preview = rawStringField(parsed, "firstVisibleTextPreview");
|
|
54
|
-
return {
|
|
55
|
-
firstMatchVisible: typeof parsed.firstMatchVisible === "boolean" ? parsed.firstMatchVisible : undefined,
|
|
56
|
-
firstVisibleTextPreview: preview !== undefined && preview !== "" ? redactSensitiveText(preview) : undefined,
|
|
57
|
-
matchCount,
|
|
58
|
-
selector,
|
|
59
|
-
visibleCandidates: parseSelectorTextVisibilityCandidates(parsed.visibleCandidates),
|
|
60
|
-
visibleCount,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export function selectorMayExposeSensitiveLiteral(selector) {
|
|
64
|
-
return (redactSensitiveText(selector) !== selector ||
|
|
65
|
-
/\[[^\]]*[~|^$*]?=\s*(?:"[^"]*"|'[^']*'|[^\]\s]+)\s*(?:[is]\s*)?\]/.test(selector));
|
|
66
|
-
}
|
|
67
|
-
function canProbeVisibleText(selector) {
|
|
68
|
-
return (selector !== undefined &&
|
|
69
|
-
selector !== "" &&
|
|
70
|
-
!/^@e\d+$/.test(selector) &&
|
|
71
|
-
!/^#[A-Za-z_][\w-]*$/.test(selector) &&
|
|
72
|
-
!selectorMayExposeSensitiveLiteral(selector));
|
|
73
|
-
}
|
|
74
|
-
function selectorVisibilitySummary(parsed) {
|
|
75
|
-
const visibleMatchNoun = `visible match${parsed.visibleCount === 1 ? "" : "es"}`;
|
|
76
|
-
const visibleMatchVerb = parsed.visibleCount === 1 ? "exists" : "exist";
|
|
77
|
-
return parsed.firstMatchVisible === false
|
|
78
|
-
? `Selector ${JSON.stringify(parsed.selector)} matched ${parsed.matchCount} elements; the first match is hidden while ${parsed.visibleCount} ${visibleMatchNoun} ${visibleMatchVerb}.`
|
|
79
|
-
: `Selector ${JSON.stringify(parsed.selector)} matched ${parsed.matchCount} elements; get text reads the first upstream match, which may not be the intended visible tab/panel.`;
|
|
80
|
-
}
|
|
81
|
-
async function collectSelectorTextVisibilityDiagnosticForSelector(options) {
|
|
82
|
-
const { selector } = options;
|
|
83
|
-
if (!canProbeVisibleText(selector)) {
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
const probe = await runSessionCommandData({
|
|
87
|
-
args: ["eval", "--stdin"],
|
|
88
|
-
cwd: options.cwd,
|
|
89
|
-
namespace: options.namespace,
|
|
90
|
-
sessionName: options.sessionName,
|
|
91
|
-
signal: options.signal,
|
|
92
|
-
stdin: buildVisibleTextProbeScript(selector),
|
|
93
|
-
});
|
|
94
|
-
const parsed = parseSelectorTextVisibilityProbe(probe, selector);
|
|
95
|
-
if (!parsed ||
|
|
96
|
-
(parsed.matchCount <= 1 && parsed.firstMatchVisible !== false) ||
|
|
97
|
-
parsed.visibleCount === 0) {
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
return { ...parsed, summary: selectorVisibilitySummary(parsed) };
|
|
101
|
-
}
|
|
102
|
-
function getBatchGetTextSelectors(data) {
|
|
103
|
-
if (!Array.isArray(data)) {
|
|
104
|
-
return [];
|
|
105
|
-
}
|
|
106
|
-
return data.flatMap((item) => {
|
|
107
|
-
if (!isRecord(item) || item.success === false) {
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
|
-
const tokens = extractBatchResultCommand(item);
|
|
111
|
-
const selector = tokens.at(2);
|
|
112
|
-
return tokens[0] === "get" && tokens[1] === "text" && selector !== undefined && selector !== ""
|
|
113
|
-
? [selector]
|
|
114
|
-
: [];
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
export function getSuccessfulGetTextSelectors(options) {
|
|
118
|
-
if (options.commandInfo.command === "get" && options.commandInfo.subcommand === "text") {
|
|
119
|
-
return [options.commandTokens.at(2)].filter((selector) => typeof selector === "string" && selector.length > 0);
|
|
120
|
-
}
|
|
121
|
-
return options.commandInfo.command === "batch" ? getBatchGetTextSelectors(options.data) : [];
|
|
122
|
-
}
|
|
123
|
-
export async function collectSelectorTextVisibilityDiagnostics(options) {
|
|
124
|
-
const selectors = getSuccessfulGetTextSelectors(options);
|
|
125
|
-
const diagnostics = [];
|
|
126
|
-
for (const selector of selectors) {
|
|
127
|
-
// Native helper decisions and selector observations must remain in session order.
|
|
128
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
129
|
-
const diagnostic = await collectSelectorTextVisibilityDiagnosticForSelector({
|
|
130
|
-
cwd: options.cwd,
|
|
131
|
-
namespace: options.namespace,
|
|
132
|
-
selector,
|
|
133
|
-
sessionName: options.sessionName,
|
|
134
|
-
signal: options.signal,
|
|
135
|
-
});
|
|
136
|
-
if (diagnostic) {
|
|
137
|
-
diagnostics.push(diagnostic);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return diagnostics.sort((left, right) => Number(right.firstMatchVisible === false) - Number(left.firstMatchVisible === false));
|
|
141
|
-
}
|
|
142
|
-
function formatVisibleCandidate(candidate) {
|
|
143
|
-
const role = candidate.role !== undefined && candidate.role !== "" ? ` role=${candidate.role}` : "";
|
|
144
|
-
const preview = candidate.textPreview !== undefined && candidate.textPreview !== ""
|
|
145
|
-
? `: ${JSON.stringify(candidate.textPreview)}`
|
|
146
|
-
: "";
|
|
147
|
-
return `- [${candidate.index}] ${candidate.tagName}${role}${preview}`;
|
|
148
|
-
}
|
|
149
|
-
function formatSelectorVisibilityDiagnostic(diagnostic, index) {
|
|
150
|
-
const actionId = index === 0
|
|
151
|
-
? "inspect-visible-text-candidates"
|
|
152
|
-
: `inspect-visible-text-candidates-${index + 1}`;
|
|
153
|
-
const lines = [`Selector text visibility warning: ${diagnostic.summary}`];
|
|
154
|
-
if (diagnostic.firstVisibleTextPreview !== undefined &&
|
|
155
|
-
diagnostic.firstVisibleTextPreview !== "") {
|
|
156
|
-
lines.push(`First visible text preview: ${JSON.stringify(diagnostic.firstVisibleTextPreview)}`);
|
|
157
|
-
}
|
|
158
|
-
if (diagnostic.visibleCandidates && diagnostic.visibleCandidates.length > 0) {
|
|
159
|
-
lines.push(`Visible candidates (${diagnostic.visibleCandidates.length} shown, querySelectorAll index):`, ...diagnostic.visibleCandidates.map(formatVisibleCandidate));
|
|
160
|
-
}
|
|
161
|
-
lines.push(`Next action: use details.nextActions ${actionId} before trusting this selector text.`);
|
|
162
|
-
return lines;
|
|
163
|
-
}
|
|
164
|
-
export function formatSelectorTextVisibilityText(diagnostics) {
|
|
165
|
-
return diagnostics.length === 0
|
|
166
|
-
? undefined
|
|
167
|
-
: diagnostics.flatMap(formatSelectorVisibilityDiagnostic).join("\n");
|
|
168
|
-
}
|
|
169
|
-
export function buildSelectorTextVisibilityNextActions(options) {
|
|
170
|
-
return options.diagnostics.map((diagnostic, index) => ({
|
|
171
|
-
id: index === 0
|
|
172
|
-
? "inspect-visible-text-candidates"
|
|
173
|
-
: `inspect-visible-text-candidates-${index + 1}`,
|
|
174
|
-
params: {
|
|
175
|
-
args: withOptionalSessionArgs(options.sessionName, ["eval", "--stdin"]),
|
|
176
|
-
stdin: buildVisibleTextProbeScript(diagnostic.selector),
|
|
177
|
-
},
|
|
178
|
-
reason: "Inspect selector match count and visible text before trusting get text on tabbed or hidden DOM content.",
|
|
179
|
-
safety: "Read-only DOM inspection; use a more specific visible selector or current @ref before acting on hidden-tab text.",
|
|
180
|
-
tool: "agent_browser",
|
|
181
|
-
}));
|
|
182
|
-
}
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { stat } from "node:fs/promises";
|
|
2
|
-
import { isAbsolute, resolve } from "node:path";
|
|
3
|
-
import { setTimeout as sleepMs } from "node:timers/promises";
|
|
4
|
-
import { isOpenNavigationCommand } from "../../command-taxonomy.js";
|
|
5
|
-
import { isBrowserIndependentRead } from "../../command-policy.js";
|
|
6
|
-
import { redactInvocationArgs, redactSensitiveText } from "../../runtime-redaction.js";
|
|
7
|
-
import { getUpstreamEffectiveBatchSteps } from "../batch-stdin.js";
|
|
8
|
-
import { getExplicitArtifactDestination } from "./artifact-paths.js";
|
|
9
|
-
import { extractStringResultField, runSessionCommandData } from "./session-state.js";
|
|
10
|
-
import { redactSensitivePathSegmentsForDiagnostic, sanitizeCurrentPageUrlForTimeoutDiagnostic, } from "./timeout-progress.js";
|
|
11
|
-
function getTimeoutProgressSteps(options) {
|
|
12
|
-
if (options.compiledJob) {
|
|
13
|
-
return options.compiledJob.steps.map((step, index) => ({
|
|
14
|
-
args: step.args,
|
|
15
|
-
generatedFrom: step.generatedFrom,
|
|
16
|
-
index: index + 1,
|
|
17
|
-
status: "unknown",
|
|
18
|
-
reason: "Upstream did not report this step's outcome before timeout.",
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
return getUpstreamEffectiveBatchSteps(options.commandTokens, options.stdin).map((args, index) => ({
|
|
22
|
-
args,
|
|
23
|
-
index: index + 1,
|
|
24
|
-
status: "unknown",
|
|
25
|
-
reason: "Upstream did not report this step's outcome before timeout.",
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
function getLastPositionalToken(args, startIndex = 1) {
|
|
29
|
-
for (let index = args.length - 1; index >= startIndex; index -= 1) {
|
|
30
|
-
const token = args[index];
|
|
31
|
-
if (token !== "" && !token.startsWith("-")) {
|
|
32
|
-
return token;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
function getTimeoutStepArtifactPath(commandTokens) {
|
|
38
|
-
return ["screenshot", "pdf", "download", "wait"].includes(commandTokens[0])
|
|
39
|
-
? getExplicitArtifactDestination(commandTokens)
|
|
40
|
-
: undefined;
|
|
41
|
-
}
|
|
42
|
-
async function statTimeoutArtifactPath(absolutePath) {
|
|
43
|
-
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
44
|
-
try {
|
|
45
|
-
// Retries observe a still-finishing native writer only after the prior stat settles.
|
|
46
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
47
|
-
const stats = await stat(absolutePath);
|
|
48
|
-
return { exists: true, sizeBytes: stats.size };
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
if (attempt < 2) {
|
|
52
|
-
// Backoff must complete before the next artifact observation.
|
|
53
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
54
|
-
await sleepMs(25);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return { exists: false };
|
|
59
|
-
}
|
|
60
|
-
async function collectTimeoutArtifactEvidence(cwd, steps) {
|
|
61
|
-
const evidence = [];
|
|
62
|
-
for (const step of steps) {
|
|
63
|
-
const path = getTimeoutStepArtifactPath(step.args);
|
|
64
|
-
if (path === undefined || path === "") {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
const absolutePath = isAbsolute(path) ? path : resolve(cwd, path);
|
|
68
|
-
// Preserve each declared path's retry window before observing the next native step's output.
|
|
69
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
70
|
-
const artifact = await statTimeoutArtifactPath(absolutePath);
|
|
71
|
-
evidence.push({
|
|
72
|
-
absolutePath,
|
|
73
|
-
exists: artifact.exists,
|
|
74
|
-
path,
|
|
75
|
-
...(artifact.exists ? { sizeBytes: artifact.sizeBytes } : {}),
|
|
76
|
-
state: artifact.exists ? "verified" : "missing",
|
|
77
|
-
stepIndex: step.index,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return evidence;
|
|
81
|
-
}
|
|
82
|
-
function getPlannedCurrentPageUrl(steps) {
|
|
83
|
-
for (let index = steps.length - 1; index >= 0; index -= 1) {
|
|
84
|
-
const args = steps.at(index)?.args ?? [];
|
|
85
|
-
if (isOpenNavigationCommand(args[0]) || args[0] === "pushstate") {
|
|
86
|
-
return getLastPositionalToken(args);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
const TIMEOUT_RETRYABLE_COMMANDS = new Set([
|
|
92
|
-
"console",
|
|
93
|
-
"diff",
|
|
94
|
-
"errors",
|
|
95
|
-
"get",
|
|
96
|
-
"goto",
|
|
97
|
-
"navigate",
|
|
98
|
-
"network",
|
|
99
|
-
"open",
|
|
100
|
-
"pdf",
|
|
101
|
-
"pushstate",
|
|
102
|
-
"screenshot",
|
|
103
|
-
"snapshot",
|
|
104
|
-
"tab",
|
|
105
|
-
"vitals",
|
|
106
|
-
"wait",
|
|
107
|
-
]);
|
|
108
|
-
function getTimeoutStepRetry(step) {
|
|
109
|
-
const command = step.args.at(0);
|
|
110
|
-
return command !== undefined && command !== "" && TIMEOUT_RETRYABLE_COMMANDS.has(command)
|
|
111
|
-
? { args: ["batch"], stdin: JSON.stringify([step.args]) }
|
|
112
|
-
: undefined;
|
|
113
|
-
}
|
|
114
|
-
function timeoutRetryStep(steps) {
|
|
115
|
-
const singleStep = steps.length === 1 ? steps.at(0) : undefined;
|
|
116
|
-
const retry = singleStep ? getTimeoutStepRetry(singleStep) : undefined;
|
|
117
|
-
return singleStep && retry ? { ...singleStep, retry } : undefined;
|
|
118
|
-
}
|
|
119
|
-
function currentPageSource(recoveredUrl, plannedUrl, title) {
|
|
120
|
-
if ((recoveredUrl ?? "") !== "") {
|
|
121
|
-
return "live";
|
|
122
|
-
}
|
|
123
|
-
if ((plannedUrl ?? "") !== "") {
|
|
124
|
-
return "planned";
|
|
125
|
-
}
|
|
126
|
-
return (title ?? "") !== "" ? "live" : undefined;
|
|
127
|
-
}
|
|
128
|
-
async function probeTimeoutPage(options) {
|
|
129
|
-
const urlData = await runSessionCommandData({
|
|
130
|
-
args: ["get", "url"],
|
|
131
|
-
cwd: options.cwd,
|
|
132
|
-
namespace: options.namespace,
|
|
133
|
-
sessionName: options.sessionName,
|
|
134
|
-
});
|
|
135
|
-
const recoveredUrl = extractStringResultField(urlData, "result") ?? extractStringResultField(urlData, "url");
|
|
136
|
-
const titleData = (recoveredUrl ?? "") !== ""
|
|
137
|
-
? await runSessionCommandData({
|
|
138
|
-
args: ["get", "title"],
|
|
139
|
-
cwd: options.cwd,
|
|
140
|
-
namespace: options.namespace,
|
|
141
|
-
sessionName: options.sessionName,
|
|
142
|
-
})
|
|
143
|
-
: undefined;
|
|
144
|
-
const title = extractStringResultField(titleData, "result") ?? extractStringResultField(titleData, "title");
|
|
145
|
-
return { recoveredUrl, title };
|
|
146
|
-
}
|
|
147
|
-
function timeoutPageSummary(recoveredUrl, title, plannedUrl) {
|
|
148
|
-
if ((recoveredUrl ?? "") !== "" || (title ?? "") !== "") {
|
|
149
|
-
return " and current page state";
|
|
150
|
-
}
|
|
151
|
-
return (plannedUrl ?? "") !== "" ? " and planned page URL" : "";
|
|
152
|
-
}
|
|
153
|
-
function buildTimeoutPage(observed, steps) {
|
|
154
|
-
const { recoveredUrl, title } = observed;
|
|
155
|
-
const plannedUrl = (recoveredUrl ?? "") !== "" ? undefined : getPlannedCurrentPageUrl(steps);
|
|
156
|
-
const url = recoveredUrl ?? plannedUrl;
|
|
157
|
-
const source = currentPageSource(recoveredUrl, plannedUrl, title);
|
|
158
|
-
return {
|
|
159
|
-
currentPage: (url ?? "") !== "" || (title ?? "") !== "" ? { source, title, url } : undefined,
|
|
160
|
-
liveUrlRecovered: recoveredUrl !== undefined,
|
|
161
|
-
summary: timeoutPageSummary(recoveredUrl, title, plannedUrl),
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function formatTimeoutSummary(stepCount, artifacts, pageSummary) {
|
|
165
|
-
const foundArtifacts = artifacts.filter((artifact) => artifact.exists).length;
|
|
166
|
-
return `Timed out before upstream returned final results; ${stepCount} planned step outcome${stepCount === 1 ? " is" : "s are"} unknown. Found ${foundArtifacts}/${artifacts.length} declared artifact path${artifacts.length === 1 ? "" : "s"}${pageSummary}; these observations do not prove step execution.`;
|
|
167
|
-
}
|
|
168
|
-
export async function collectTimeoutPartialProgress(options) {
|
|
169
|
-
if ((options.commandTokens[0] === "session" && options.commandTokens[1] === "info") ||
|
|
170
|
-
isBrowserIndependentRead(options.commandTokens, options.stdin)) {
|
|
171
|
-
return undefined;
|
|
172
|
-
}
|
|
173
|
-
const rawSteps = getTimeoutProgressSteps(options);
|
|
174
|
-
const artifacts = await collectTimeoutArtifactEvidence(options.operationCwd ?? options.cwd, rawSteps);
|
|
175
|
-
const page = buildTimeoutPage(await probeTimeoutPage(options), rawSteps);
|
|
176
|
-
if (rawSteps.length === 0 && artifacts.length === 0 && !page.currentPage) {
|
|
177
|
-
return undefined;
|
|
178
|
-
}
|
|
179
|
-
// A matching URL or existing file is current state, not an execution receipt.
|
|
180
|
-
const steps = rawSteps;
|
|
181
|
-
return {
|
|
182
|
-
artifacts,
|
|
183
|
-
currentPage: page.currentPage,
|
|
184
|
-
liveUrlRecovered: page.liveUrlRecovered,
|
|
185
|
-
retryStep: timeoutRetryStep(steps),
|
|
186
|
-
steps: steps.length > 0 ? steps : undefined,
|
|
187
|
-
summary: formatTimeoutSummary(steps.length, artifacts, page.summary),
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function formatTimeoutSteps(steps) {
|
|
191
|
-
if (!steps || steps.length === 0) {
|
|
192
|
-
return [];
|
|
193
|
-
}
|
|
194
|
-
const shownSteps = steps.slice(0, 6);
|
|
195
|
-
const lines = [
|
|
196
|
-
"Planned steps:",
|
|
197
|
-
...shownSteps.map((step) => {
|
|
198
|
-
const commandText = redactSensitivePathSegmentsForDiagnostic(redactInvocationArgs(step.args).join(" "));
|
|
199
|
-
const generatedFrom = step.generatedFrom !== undefined && step.generatedFrom !== ""
|
|
200
|
-
? `, generated from ${step.generatedFrom}`
|
|
201
|
-
: "";
|
|
202
|
-
const reason = step.reason !== undefined && step.reason !== ""
|
|
203
|
-
? ` — ${redactSensitivePathSegmentsForDiagnostic(redactSensitiveText(step.reason))}`
|
|
204
|
-
: "";
|
|
205
|
-
return `- Step ${step.index} [${step.status}${generatedFrom}]: ${commandText}${reason}`;
|
|
206
|
-
}),
|
|
207
|
-
];
|
|
208
|
-
if (steps.length > shownSteps.length) {
|
|
209
|
-
lines.push(`- ... ${steps.length - shownSteps.length} more step${steps.length - shownSteps.length === 1 ? "" : "s"} omitted`);
|
|
210
|
-
}
|
|
211
|
-
return lines;
|
|
212
|
-
}
|
|
213
|
-
function formatTimeoutRetry(step, pageTargetUnknown) {
|
|
214
|
-
if (!step?.retry) {
|
|
215
|
-
return undefined;
|
|
216
|
-
}
|
|
217
|
-
const payload = JSON.stringify({
|
|
218
|
-
...step.retry,
|
|
219
|
-
stdin: JSON.stringify([redactInvocationArgs(step.args)]),
|
|
220
|
-
});
|
|
221
|
-
return pageTargetUnknown
|
|
222
|
-
? `Retry candidate for step ${step.index}: ${payload}. Verify the current URL before running it.`
|
|
223
|
-
: `Retry candidate for step ${step.index} (outcome unknown): ${payload}`;
|
|
224
|
-
}
|
|
225
|
-
function formatTimeoutArtifact(artifact) {
|
|
226
|
-
const size = typeof artifact.sizeBytes === "number" ? `, ${artifact.sizeBytes} bytes` : "";
|
|
227
|
-
const state = artifact.exists ? `exists${size}` : "missing";
|
|
228
|
-
return `Artifact from step ${artifact.stepIndex}: ${redactSensitivePathSegmentsForDiagnostic(artifact.path)} (${state})`;
|
|
229
|
-
}
|
|
230
|
-
function formatTimeoutCurrentPage(page) {
|
|
231
|
-
if (!page) {
|
|
232
|
-
return undefined;
|
|
233
|
-
}
|
|
234
|
-
const title = page.title ?? "";
|
|
235
|
-
const url = page.url ?? "";
|
|
236
|
-
if (title === "" && url === "") {
|
|
237
|
-
return undefined;
|
|
238
|
-
}
|
|
239
|
-
const currentPageTitle = title !== "" ? redactSensitivePathSegmentsForDiagnostic(redactSensitiveText(title)) : undefined;
|
|
240
|
-
const currentPageUrl = url !== "" ? sanitizeCurrentPageUrlForTimeoutDiagnostic(url) : undefined;
|
|
241
|
-
return `Current page: ${[currentPageTitle, currentPageUrl].filter(Boolean).join(" — ")}`;
|
|
242
|
-
}
|
|
243
|
-
export function formatTimeoutPartialProgressText(progress, pageTargetUnknown = false) {
|
|
244
|
-
const lines = [`Timeout partial progress: ${progress.summary}`];
|
|
245
|
-
const currentPage = formatTimeoutCurrentPage(progress.currentPage);
|
|
246
|
-
if (currentPage !== undefined) {
|
|
247
|
-
lines.push(currentPage);
|
|
248
|
-
}
|
|
249
|
-
lines.push(...formatTimeoutSteps(progress.steps));
|
|
250
|
-
const retry = formatTimeoutRetry(progress.retryStep, pageTargetUnknown);
|
|
251
|
-
if (retry !== undefined) {
|
|
252
|
-
lines.push(retry);
|
|
253
|
-
}
|
|
254
|
-
lines.push(...progress.artifacts.map(formatTimeoutArtifact));
|
|
255
|
-
return lines.join("\n");
|
|
256
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../../parsing.js";
|
|
2
|
-
import { redactSensitiveText } from "../../runtime-redaction.js";
|
|
3
|
-
function isStringList(value) {
|
|
4
|
-
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
5
|
-
}
|
|
6
|
-
function optionalStringFields(value, fields) {
|
|
7
|
-
return fields.every((field) => value[field] === undefined || typeof value[field] === "string");
|
|
8
|
-
}
|
|
9
|
-
function isTimeoutArtifact(value) {
|
|
10
|
-
return (isRecord(value) &&
|
|
11
|
-
typeof value.absolutePath === "string" &&
|
|
12
|
-
typeof value.exists === "boolean" &&
|
|
13
|
-
typeof value.path === "string" &&
|
|
14
|
-
(value.sizeBytes === undefined || typeof value.sizeBytes === "number") &&
|
|
15
|
-
(value.state === "missing" || value.state === "verified") &&
|
|
16
|
-
typeof value.stepIndex === "number");
|
|
17
|
-
}
|
|
18
|
-
function isTimeoutRetry(value) {
|
|
19
|
-
return (value === undefined ||
|
|
20
|
-
(isRecord(value) && isStringList(value.args) && typeof value.stdin === "string"));
|
|
21
|
-
}
|
|
22
|
-
function isTimeoutStep(value) {
|
|
23
|
-
return (isRecord(value) &&
|
|
24
|
-
isStringList(value.args) &&
|
|
25
|
-
typeof value.index === "number" &&
|
|
26
|
-
value.status === "unknown" &&
|
|
27
|
-
optionalStringFields(value, ["generatedFrom", "reason"]) &&
|
|
28
|
-
isTimeoutRetry(value.retry));
|
|
29
|
-
}
|
|
30
|
-
function isTimeoutCurrentPage(value) {
|
|
31
|
-
return (value === undefined ||
|
|
32
|
-
(isRecord(value) &&
|
|
33
|
-
(value.source === undefined || value.source === "live" || value.source === "planned") &&
|
|
34
|
-
optionalStringFields(value, ["title", "url"])));
|
|
35
|
-
}
|
|
36
|
-
function isTimeoutSteps(value) {
|
|
37
|
-
return value === undefined || (Array.isArray(value) && value.every(isTimeoutStep));
|
|
38
|
-
}
|
|
39
|
-
export function isTimeoutPartialProgress(value) {
|
|
40
|
-
if (!isRecord(value) ||
|
|
41
|
-
!Array.isArray(value.artifacts) ||
|
|
42
|
-
!value.artifacts.every(isTimeoutArtifact)) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
return (typeof value.summary === "string" &&
|
|
46
|
-
isTimeoutCurrentPage(value.currentPage) &&
|
|
47
|
-
(value.liveUrlRecovered === undefined || typeof value.liveUrlRecovered === "boolean") &&
|
|
48
|
-
(value.retryStep === undefined || isTimeoutStep(value.retryStep)) &&
|
|
49
|
-
isTimeoutSteps(value.steps));
|
|
50
|
-
}
|
|
51
|
-
export function redactSensitivePathSegmentsForDiagnostic(path) {
|
|
52
|
-
return path
|
|
53
|
-
.split(/([/\\]+)/)
|
|
54
|
-
.map((segment) => {
|
|
55
|
-
if (segment === "/" || segment === "\\" || /^[/\\]+$/.test(segment)) {
|
|
56
|
-
return segment;
|
|
57
|
-
}
|
|
58
|
-
return redactSensitiveText(segment) !== segment ||
|
|
59
|
-
/(?:secret|token|password|passwd|credential|auth|api[-_]?key|bearer)/i.test(segment)
|
|
60
|
-
? "[REDACTED]"
|
|
61
|
-
: segment;
|
|
62
|
-
})
|
|
63
|
-
.join("");
|
|
64
|
-
}
|
|
65
|
-
export function sanitizeCurrentPageUrlForTimeoutDiagnostic(url) {
|
|
66
|
-
try {
|
|
67
|
-
const parsedUrl = new URL(url);
|
|
68
|
-
parsedUrl.pathname = parsedUrl.pathname
|
|
69
|
-
.split("/")
|
|
70
|
-
.map(redactSensitivePathSegmentsForDiagnostic)
|
|
71
|
-
.join("/");
|
|
72
|
-
for (const [key, value] of parsedUrl.searchParams.entries()) {
|
|
73
|
-
if (redactSensitiveText(key) !== key ||
|
|
74
|
-
redactSensitiveText(value) !== value ||
|
|
75
|
-
/(?:secret|token|password|passwd|credential|auth|api[-_]?key|bearer)/i.test(`${key} ${value}`)) {
|
|
76
|
-
parsedUrl.searchParams.set(key, "[REDACTED]");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (parsedUrl.hash !== "") {
|
|
80
|
-
parsedUrl.hash = redactSensitivePathSegmentsForDiagnostic(redactSensitiveText(parsedUrl.hash));
|
|
81
|
-
}
|
|
82
|
-
return redactSensitiveText(parsedUrl.toString());
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
return redactSensitivePathSegmentsForDiagnostic(redactSensitiveText(url));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function redactProgressValue(value) {
|
|
89
|
-
if (typeof value === "string") {
|
|
90
|
-
return /^https?:\/\//i.test(value)
|
|
91
|
-
? sanitizeCurrentPageUrlForTimeoutDiagnostic(value)
|
|
92
|
-
: redactSensitivePathSegmentsForDiagnostic(redactSensitiveText(value));
|
|
93
|
-
}
|
|
94
|
-
if (Array.isArray(value)) {
|
|
95
|
-
return value.map(redactProgressValue);
|
|
96
|
-
}
|
|
97
|
-
if (isRecord(value)) {
|
|
98
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, redactProgressValue(item)]));
|
|
99
|
-
}
|
|
100
|
-
return value;
|
|
101
|
-
}
|
|
102
|
-
export function redactTimeoutPartialProgress(progress) {
|
|
103
|
-
const redacted = redactProgressValue(progress);
|
|
104
|
-
if (!isTimeoutPartialProgress(redacted)) {
|
|
105
|
-
throw new Error("Invalid timeout partial-progress evidence.");
|
|
106
|
-
}
|
|
107
|
-
return redacted;
|
|
108
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|