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,208 +0,0 @@
|
|
|
1
|
-
import { isAbsolute } from "node:path";
|
|
2
|
-
import { getAgentBrowserSessionIdentityKey } from "./argv-grammar.js";
|
|
3
|
-
import { isRecord } from "./parsing.js";
|
|
4
|
-
import { isPendingRecordingArtifact } from "./results/artifact-manifest.js";
|
|
5
|
-
export const RECORDING_RESERVATION_ENTRY_TYPE = "agent-browser-recording-reservation";
|
|
6
|
-
function getReservationKey(reservation) {
|
|
7
|
-
return getAgentBrowserSessionIdentityKey(reservation.sessionName, reservation.namespace);
|
|
8
|
-
}
|
|
9
|
-
function getArtifactReservation(artifact) {
|
|
10
|
-
if (artifact.session === undefined ||
|
|
11
|
-
artifact.session.length === 0 ||
|
|
12
|
-
artifact.command !== "record" ||
|
|
13
|
-
artifact.kind !== "video") {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
absolutePath: artifact.absolutePath,
|
|
18
|
-
cwd: artifact.cwd ?? process.cwd(),
|
|
19
|
-
namespace: artifact.namespace,
|
|
20
|
-
path: artifact.path,
|
|
21
|
-
...(typeof artifact.recording?.recordingId === "string" &&
|
|
22
|
-
artifact.recording.recordingId.length > 0
|
|
23
|
-
? { recordingId: artifact.recording.recordingId }
|
|
24
|
-
: {}),
|
|
25
|
-
...(artifact.recordingStartedAtMs !== undefined
|
|
26
|
-
? { startedAtMs: artifact.recordingStartedAtMs }
|
|
27
|
-
: {}),
|
|
28
|
-
sessionName: artifact.session,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function artifactReservations(artifacts) {
|
|
32
|
-
const pendingBySession = new Map();
|
|
33
|
-
const terminalBySession = new Map();
|
|
34
|
-
for (const artifact of artifacts) {
|
|
35
|
-
let reservation = getArtifactReservation(artifact);
|
|
36
|
-
if (!reservation) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
const sheet = artifacts.find((candidate) => candidate.command === "record" &&
|
|
40
|
-
candidate.kind === "image" &&
|
|
41
|
-
candidate.session === artifact.session &&
|
|
42
|
-
candidate.namespace === artifact.namespace &&
|
|
43
|
-
isPendingRecordingArtifact(candidate));
|
|
44
|
-
if (sheet) {
|
|
45
|
-
reservation = { ...reservation, contactSheetPath: sheet.absolutePath };
|
|
46
|
-
}
|
|
47
|
-
const key = getReservationKey(reservation);
|
|
48
|
-
if (isPendingRecordingArtifact(artifact)) {
|
|
49
|
-
pendingBySession.set(key, reservation);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
terminalBySession.set(key, reservation);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return { pendingBySession, terminalBySession };
|
|
56
|
-
}
|
|
57
|
-
function reservationChanged(existing, pending) {
|
|
58
|
-
return (!existing ||
|
|
59
|
-
existing.absolutePath !== pending.absolutePath ||
|
|
60
|
-
existing.cwd !== pending.cwd ||
|
|
61
|
-
existing.recordingId !== pending.recordingId ||
|
|
62
|
-
existing.startedAtMs !== pending.startedAtMs ||
|
|
63
|
-
existing.contactSheetPath !== pending.contactSheetPath);
|
|
64
|
-
}
|
|
65
|
-
export function applyRecordingArtifactsToReservations(
|
|
66
|
-
// This mutator owns changes to the namespace/session reservation index, not to reservation values.
|
|
67
|
-
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types
|
|
68
|
-
reservations, artifacts) {
|
|
69
|
-
const { pendingBySession, terminalBySession } = artifactReservations(artifacts);
|
|
70
|
-
const transitions = [];
|
|
71
|
-
for (const key of terminalBySession.keys()) {
|
|
72
|
-
if (pendingBySession.has(key)) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const existing = reservations.get(key);
|
|
76
|
-
if (!existing) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
reservations.delete(key);
|
|
80
|
-
transitions.push({ reservation: existing, state: "closed" });
|
|
81
|
-
}
|
|
82
|
-
for (const [key, pending] of pendingBySession) {
|
|
83
|
-
const existing = reservations.get(key);
|
|
84
|
-
reservations.set(key, pending);
|
|
85
|
-
if (reservationChanged(existing, pending)) {
|
|
86
|
-
transitions.push({ reservation: pending, state: "active" });
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return transitions;
|
|
90
|
-
}
|
|
91
|
-
export function retireRecordingReservation(
|
|
92
|
-
// This mutator owns changes to the namespace/session reservation index, not to reservation values.
|
|
93
|
-
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types
|
|
94
|
-
reservations, sessionName, namespace) {
|
|
95
|
-
const key = getAgentBrowserSessionIdentityKey(sessionName, namespace);
|
|
96
|
-
const reservation = reservations.get(key);
|
|
97
|
-
if (reservation) {
|
|
98
|
-
reservations.delete(key);
|
|
99
|
-
}
|
|
100
|
-
return reservation;
|
|
101
|
-
}
|
|
102
|
-
export function appendRecordingReservationTransition(pi, transition) {
|
|
103
|
-
const { reservation, state } = transition;
|
|
104
|
-
pi.appendEntry(RECORDING_RESERVATION_ENTRY_TYPE, {
|
|
105
|
-
absolutePath: state === "active" ? reservation.absolutePath : undefined,
|
|
106
|
-
contactSheetPath: state === "active" ? reservation.contactSheetPath : undefined,
|
|
107
|
-
cwd: state === "active" ? reservation.cwd : undefined,
|
|
108
|
-
namespace: reservation.namespace,
|
|
109
|
-
path: state === "active" ? reservation.path : undefined,
|
|
110
|
-
recordingId: state === "active" ? reservation.recordingId : undefined,
|
|
111
|
-
startedAtMs: state === "active" ? reservation.startedAtMs : undefined,
|
|
112
|
-
sessionName: reservation.sessionName,
|
|
113
|
-
state,
|
|
114
|
-
version: 1,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function optionalReservationMetadata(data) {
|
|
118
|
-
if (data.contactSheetPath !== undefined &&
|
|
119
|
-
(typeof data.contactSheetPath !== "string" || !isAbsolute(data.contactSheetPath))) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
if (data.recordingId !== undefined &&
|
|
123
|
-
(typeof data.recordingId !== "string" || data.recordingId.length === 0)) {
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
return (data.startedAtMs === undefined ||
|
|
127
|
-
(typeof data.startedAtMs === "number" && Number.isFinite(data.startedAtMs)));
|
|
128
|
-
}
|
|
129
|
-
function parseActiveReservation(data, identity) {
|
|
130
|
-
if (!optionalReservationMetadata(data)) {
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
if (typeof data.absolutePath !== "string" ||
|
|
134
|
-
!isAbsolute(data.absolutePath) ||
|
|
135
|
-
typeof data.cwd !== "string" ||
|
|
136
|
-
!isAbsolute(data.cwd) ||
|
|
137
|
-
typeof data.path !== "string") {
|
|
138
|
-
return undefined;
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
...identity,
|
|
142
|
-
absolutePath: data.absolutePath,
|
|
143
|
-
cwd: data.cwd,
|
|
144
|
-
path: data.path,
|
|
145
|
-
...(typeof data.contactSheetPath === "string"
|
|
146
|
-
? { contactSheetPath: data.contactSheetPath }
|
|
147
|
-
: {}),
|
|
148
|
-
...(typeof data.recordingId === "string" ? { recordingId: data.recordingId } : {}),
|
|
149
|
-
...(typeof data.startedAtMs === "number" ? { startedAtMs: data.startedAtMs } : {}),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function hasReservationIdentity(data) {
|
|
153
|
-
return (typeof data.sessionName === "string" &&
|
|
154
|
-
data.sessionName.length > 0 &&
|
|
155
|
-
(data.namespace === undefined || typeof data.namespace === "string"));
|
|
156
|
-
}
|
|
157
|
-
function parseReservationTransition(data) {
|
|
158
|
-
if (!isRecord(data) ||
|
|
159
|
-
data.version !== 1 ||
|
|
160
|
-
(data.state !== "active" && data.state !== "closed")) {
|
|
161
|
-
return undefined;
|
|
162
|
-
}
|
|
163
|
-
if (!hasReservationIdentity(data)) {
|
|
164
|
-
return undefined;
|
|
165
|
-
}
|
|
166
|
-
if (data.state === "closed") {
|
|
167
|
-
return {
|
|
168
|
-
reservation: {
|
|
169
|
-
absolutePath: "",
|
|
170
|
-
cwd: "",
|
|
171
|
-
namespace: data.namespace,
|
|
172
|
-
path: "",
|
|
173
|
-
sessionName: data.sessionName,
|
|
174
|
-
},
|
|
175
|
-
state: "closed",
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
const reservation = parseActiveReservation(data, {
|
|
179
|
-
sessionName: data.sessionName,
|
|
180
|
-
namespace: data.namespace,
|
|
181
|
-
});
|
|
182
|
-
return reservation ? { reservation, state: "active" } : undefined;
|
|
183
|
-
}
|
|
184
|
-
export function restoreRecordingReservationStateFromBranch(branch) {
|
|
185
|
-
const reservations = new Map();
|
|
186
|
-
const terminal = new Map();
|
|
187
|
-
for (const entry of branch) {
|
|
188
|
-
if (!isRecord(entry) ||
|
|
189
|
-
entry.type !== "custom" ||
|
|
190
|
-
entry.customType !== RECORDING_RESERVATION_ENTRY_TYPE) {
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
const transition = parseReservationTransition(entry.data);
|
|
194
|
-
if (!transition) {
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
const key = getReservationKey(transition.reservation);
|
|
198
|
-
if (transition.state === "active") {
|
|
199
|
-
reservations.set(key, transition.reservation);
|
|
200
|
-
terminal.delete(key);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
reservations.delete(key);
|
|
204
|
-
terminal.set(key, transition.reservation);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return { active: reservations, terminal };
|
|
208
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
const SENSITIVE_FIELD_NAME_PATTERN = /^(?:[A-Za-z0-9_-]*(?:api[_-]?key|access[_-]?key|private[_-]?key|secret(?:[_-]?(?:key|access[_-]?key))?|token|password|passwd|credentials?|database[_-]?url|db[_-]?url|connection[_-]?string|mongo(?:db)?[_-]?uri|redis[_-]?url)|[A-Za-z0-9]*(?:apiKey|ApiKey|apikey|privateKey|PrivateKey|databaseUrl|DatabaseUrl|dbUrl|DbUrl|connectionString|ConnectionString|mongoUri|MongoUri|mongodbUri|MongodbUri|mongoDbUri|MongoDbUri|redisUrl|RedisUrl|Token|Secret|Password|Credential|Credentials)|auth(?:orization)?|bearer|client(?:_|-)?secret|cookie|id(?:_|-)?token|pass(?:word)?|proxy(?:_|-)?authorization|refresh(?:_|-)?token|sentry(?:_|-)?key|session(?:_|-)?id|set(?:_|-)?cookie|sig(?:nature)?|write(?:_|-)?key|x(?:_|-)?api(?:_|-)?key)$/i;
|
|
2
|
-
const ENV_SECRET_ASSIGNMENT_PATTERN = /\b((?:export\s+)?([A-Za-z_][A-Za-z0-9_-]*)(\s*[:=]\s*))(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s,;]+)/g;
|
|
3
|
-
export function isSensitiveFieldName(key) {
|
|
4
|
-
SENSITIVE_FIELD_NAME_PATTERN.lastIndex = 0;
|
|
5
|
-
return SENSITIVE_FIELD_NAME_PATTERN.test(key);
|
|
6
|
-
}
|
|
7
|
-
function isEnvSecretAssignmentKey(key) {
|
|
8
|
-
if (!isSensitiveFieldName(key)) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
if (key === "password" || key.includes("_") || key.includes("-") || key === key.toUpperCase()) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
return /(?:apiKey|ApiKey|privateKey|PrivateKey|databaseUrl|DatabaseUrl|dbUrl|DbUrl|connectionString|ConnectionString|mongoUri|MongoUri|mongodbUri|MongodbUri|mongoDbUri|MongoDbUri|redisUrl|RedisUrl|Token|Secret|Password|Credential|Credentials)$/.test(key);
|
|
15
|
-
}
|
|
16
|
-
function isLineBoundary(text, index) {
|
|
17
|
-
return index < 0 || index >= text.length || text[index] === "\n" || text[index] === "\r";
|
|
18
|
-
}
|
|
19
|
-
function redactPasswordAssignment(text, match, prefix, offset) {
|
|
20
|
-
// The loose matcher cannot safely distinguish inline punctuation from password characters.
|
|
21
|
-
const end = offset + match.length;
|
|
22
|
-
if (!isLineBoundary(text, offset - 1) ||
|
|
23
|
-
!isLineBoundary(text, end) ||
|
|
24
|
-
/^(?:\[REDACTED\]|%5Bredacted%5D)/i.test(match.slice(prefix.length))) {
|
|
25
|
-
return match;
|
|
26
|
-
}
|
|
27
|
-
const value = match.slice(prefix.length);
|
|
28
|
-
const boundary = value[0] === '"' || value[0] === "'" ? -1 : value.search(/[&#](?=[A-Za-z_][A-Za-z0-9_-]*\s*=)/);
|
|
29
|
-
return `${prefix}[REDACTED]${boundary < 0 ? "" : value.slice(boundary)}`;
|
|
30
|
-
}
|
|
31
|
-
export function redactEnvSecretAssignments(text) {
|
|
32
|
-
return text.replace(ENV_SECRET_ASSIGNMENT_PATTERN,
|
|
33
|
-
// String.replace supplies match, three captures, then the source offset.
|
|
34
|
-
(match, prefix, key, _separator, offset) => {
|
|
35
|
-
if (!isEnvSecretAssignmentKey(key)) {
|
|
36
|
-
return match;
|
|
37
|
-
}
|
|
38
|
-
return key === "password"
|
|
39
|
-
? redactPasswordAssignment(text, match, prefix, offset)
|
|
40
|
-
: `${prefix}[REDACTED]`;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function credentialTrailingPunctuation(credential) {
|
|
44
|
-
return credential.match(/[,.:;!?]+$/)?.[0] ?? "";
|
|
45
|
-
}
|
|
46
|
-
function formatRedactedCredential(label, credential, trailing = "") {
|
|
47
|
-
return `${label} [REDACTED]${credentialTrailingPunctuation(credential)}${trailing}`;
|
|
48
|
-
}
|
|
49
|
-
export function redactBearerCredentials(text) {
|
|
50
|
-
return text
|
|
51
|
-
.replace(/((?:\b([A-Za-z][A-Za-z0-9_-]*)\s*[:=]\s*|(?:^|\s)(?:-H\s*|--header(?:\s+|=)))["']?Bearer)\s+([^\s"',)[\]]+)([),.]?)/gi,
|
|
52
|
-
// String.replace supplies the match followed by this expression's four captures.
|
|
53
|
-
(match, label, field, credential, trailing) => {
|
|
54
|
-
if (field !== undefined && field.length > 0 && !isSensitiveFieldName(field)) {
|
|
55
|
-
return match;
|
|
56
|
-
}
|
|
57
|
-
return formatRedactedCredential(label, credential, trailing);
|
|
58
|
-
})
|
|
59
|
-
.replace(/\b(Bearer)\s+([^\s\\"',)[\]]+)([),.]?)/gi, (match, label, credential, trailing) => {
|
|
60
|
-
// Require a bearer-token shape without a credential field/header, not prose, HTML or a URL.
|
|
61
|
-
const token = credential.slice(0, credential.length - credentialTrailingPunctuation(credential).length);
|
|
62
|
-
if (!/^[A-Za-z0-9._~+/-]+=*$/.test(token) || !/[0-9._~+/=-]/.test(token)) {
|
|
63
|
-
return match;
|
|
64
|
-
}
|
|
65
|
-
return formatRedactedCredential(label, credential, trailing);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
export function redactStandaloneBasicCredential(text) {
|
|
69
|
-
return text.replace(/\b(Basic)\s+([A-Za-z0-9+/=]{12,})/gi, (match, label, credential) => {
|
|
70
|
-
if (!/[0-9+/=]/.test(credential)) {
|
|
71
|
-
return match;
|
|
72
|
-
}
|
|
73
|
-
return `${label} [REDACTED]`;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { isSensitiveFieldName } from "./redaction-fields.js";
|
|
2
|
-
function nextQuotePosition(options) {
|
|
3
|
-
// Inside a string, backslash skips one character; outside, it is ordinary text.
|
|
4
|
-
if (options.char === '"') {
|
|
5
|
-
return options.index;
|
|
6
|
-
}
|
|
7
|
-
return options.char === "\\" ? options.quoteAfterNext : options.quoteAtNext;
|
|
8
|
-
}
|
|
9
|
-
function buildJsonBoundaries(text) {
|
|
10
|
-
// Resolve each suffix once: skip strings and balanced groups to its first unmatched closer.
|
|
11
|
-
const boundaries = new Int32Array(text.length + 1).fill(-1);
|
|
12
|
-
let quoteAtNext = -1;
|
|
13
|
-
let quoteAfterNext = -1;
|
|
14
|
-
for (let index = text.length - 1; index >= 0; index -= 1) {
|
|
15
|
-
const char = text[index];
|
|
16
|
-
switch (char) {
|
|
17
|
-
case "}":
|
|
18
|
-
case "]":
|
|
19
|
-
boundaries[index] = index;
|
|
20
|
-
break;
|
|
21
|
-
case '"':
|
|
22
|
-
boundaries[index] = quoteAtNext < 0 ? -1 : boundaries[quoteAtNext + 1];
|
|
23
|
-
break;
|
|
24
|
-
case "{":
|
|
25
|
-
case "[": {
|
|
26
|
-
const end = boundaries[index + 1];
|
|
27
|
-
boundaries[index] =
|
|
28
|
-
end >= 0 && text[end] === (char === "{" ? "}" : "]") ? boundaries[end + 1] : -1;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
default:
|
|
32
|
-
boundaries[index] = boundaries[index + 1];
|
|
33
|
-
}
|
|
34
|
-
const quote = nextQuotePosition({ char, index, quoteAtNext, quoteAfterNext });
|
|
35
|
-
quoteAfterNext = quoteAtNext;
|
|
36
|
-
quoteAtNext = quote;
|
|
37
|
-
}
|
|
38
|
-
return boundaries;
|
|
39
|
-
}
|
|
40
|
-
function createBalancedJsonEndFinder(text) {
|
|
41
|
-
let boundaries;
|
|
42
|
-
return (startIndex) => {
|
|
43
|
-
const opener = text[startIndex];
|
|
44
|
-
if (opener !== "{" && opener !== "[") {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
boundaries ??= buildJsonBoundaries(text);
|
|
48
|
-
const end = boundaries[startIndex + 1];
|
|
49
|
-
return end >= 0 && text[end] === (opener === "{" ? "}" : "]") ? end : undefined;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function parseJsonString(token) {
|
|
53
|
-
const value = JSON.parse(token);
|
|
54
|
-
if (typeof value !== "string") {
|
|
55
|
-
throw new Error("Expected a JSON string token");
|
|
56
|
-
}
|
|
57
|
-
return value;
|
|
58
|
-
}
|
|
59
|
-
function isSerializedJson(text) {
|
|
60
|
-
if (text === "[REDACTED]" || !/^\s*[[{"\d\-tfn]/.test(text)) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
// Validate grammar only; rebuilding parsed values loses duplicates and numeric spelling.
|
|
64
|
-
try {
|
|
65
|
-
JSON.parse(text);
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
catch {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function findJsonValueEnd(text, start, findEnd) {
|
|
73
|
-
const balancedEnd = findEnd(start);
|
|
74
|
-
if (balancedEnd !== undefined) {
|
|
75
|
-
return balancedEnd + 1;
|
|
76
|
-
}
|
|
77
|
-
if (text[start] === '"') {
|
|
78
|
-
const strings = /"(?:\\.|[^"\\])*"/g;
|
|
79
|
-
strings.lastIndex = start;
|
|
80
|
-
const fieldValue = strings.exec(text);
|
|
81
|
-
if (fieldValue === null) {
|
|
82
|
-
throw new Error("Expected a validated JSON string field value");
|
|
83
|
-
}
|
|
84
|
-
return parseJsonString(fieldValue[0]) === "[REDACTED]" ? undefined : strings.lastIndex;
|
|
85
|
-
}
|
|
86
|
-
let end = start;
|
|
87
|
-
while (end < text.length && !/[\s,\]}]/.test(text[end])) {
|
|
88
|
-
end += 1;
|
|
89
|
-
}
|
|
90
|
-
return end;
|
|
91
|
-
}
|
|
92
|
-
export function redactSerializedJson(text, redact) {
|
|
93
|
-
if (!isSerializedJson(text)) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
let output = "";
|
|
97
|
-
let cursor = 0;
|
|
98
|
-
const findEnd = createBalancedJsonEndFinder(text);
|
|
99
|
-
const strings = /"(?:\\.|[^"\\])*"/g;
|
|
100
|
-
let match;
|
|
101
|
-
while ((match = strings.exec(text)) !== null) {
|
|
102
|
-
const end = strings.lastIndex;
|
|
103
|
-
const value = parseJsonString(match[0]);
|
|
104
|
-
const redacted = redact(value);
|
|
105
|
-
if (redacted !== value) {
|
|
106
|
-
output += text.slice(cursor, match.index) + JSON.stringify(redacted);
|
|
107
|
-
cursor = end;
|
|
108
|
-
}
|
|
109
|
-
const separator = /^\s*:\s*/.exec(text.slice(end));
|
|
110
|
-
if (separator === null || !isSensitiveFieldName(value)) {
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
const valueStart = end + separator[0].length;
|
|
114
|
-
const valueEnd = findJsonValueEnd(text, valueStart, findEnd);
|
|
115
|
-
if (valueEnd === undefined) {
|
|
116
|
-
// Skip the already-redacted string as the original scanner did.
|
|
117
|
-
strings.lastIndex = valueStart;
|
|
118
|
-
strings.exec(text);
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
output += text.slice(cursor, valueStart) + '"[REDACTED]"';
|
|
122
|
-
cursor = valueEnd;
|
|
123
|
-
strings.lastIndex = valueEnd;
|
|
124
|
-
}
|
|
125
|
-
return output + text.slice(cursor);
|
|
126
|
-
}
|
|
127
|
-
export function redactEmbeddedStructuredText(text, redact) {
|
|
128
|
-
let output = "";
|
|
129
|
-
let cursor = 0;
|
|
130
|
-
const findEnd = createBalancedJsonEndFinder(text);
|
|
131
|
-
while (cursor < text.length) {
|
|
132
|
-
const char = text[cursor];
|
|
133
|
-
if (char !== "{" && char !== "[") {
|
|
134
|
-
output += char;
|
|
135
|
-
cursor += 1;
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
const endIndex = findEnd(cursor);
|
|
139
|
-
if (endIndex === undefined) {
|
|
140
|
-
output += char;
|
|
141
|
-
cursor += 1;
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
const candidate = text.slice(cursor, endIndex + 1);
|
|
145
|
-
output += redactSerializedJson(candidate, redact) ?? candidate;
|
|
146
|
-
cursor = endIndex + 1;
|
|
147
|
-
}
|
|
148
|
-
return output;
|
|
149
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { isSensitiveFieldName } from "./redaction-fields.js";
|
|
2
|
-
const SENSITIVE_QUERY_PARAM_PATTERN = /^(?:access(?:_|-)?token|api(?:_|-)?key|auth|authorization|authorization(?:_|-)?session(?:_|-)?id|bearer|client(?:_|-)?secret|code|cookie|id(?:_|-)?token|key|pass(?:word)?|refresh(?:_|-)?token|relay(?:_|-)?state|saml(?:_|-)?request|saml(?:_|-)?response|secret|sentry(?:_|-)?key|session(?:_|-)?id|sig(?:nature)?|token|write(?:_|-)?key)$/i;
|
|
3
|
-
const AUTH_STATE_QUERY_PARAM_PATTERN = /^(?:nonce|state)$/i;
|
|
4
|
-
const AUTH_URL_CONTEXT_PATTERN = /(?:^|[./_-])(?:auth|authorize|callback|login|oauth2?|oidc|saml|sso)(?:[./?#_-]|$)/i;
|
|
5
|
-
function shouldRedactQueryParam(name) {
|
|
6
|
-
return SENSITIVE_QUERY_PARAM_PATTERN.test(name) || isSensitiveFieldName(name);
|
|
7
|
-
}
|
|
8
|
-
function isSensitiveParameter(name, authContext) {
|
|
9
|
-
return shouldRedactQueryParam(name) || (authContext && AUTH_STATE_QUERY_PARAM_PATTERN.test(name));
|
|
10
|
-
}
|
|
11
|
-
function redactParameters(params, authContext) {
|
|
12
|
-
let mutated = false;
|
|
13
|
-
for (const [name] of params) {
|
|
14
|
-
if (isSensitiveParameter(name, authContext)) {
|
|
15
|
-
params.set(name, "[REDACTED]");
|
|
16
|
-
mutated = true;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return mutated;
|
|
20
|
-
}
|
|
21
|
-
function getHashParameters(hash) {
|
|
22
|
-
const text = hash.startsWith("#") ? hash.slice(1) : hash;
|
|
23
|
-
return text.includes("=") ? new URLSearchParams(text) : undefined;
|
|
24
|
-
}
|
|
25
|
-
export function redactUrlToken(token) {
|
|
26
|
-
let parsed;
|
|
27
|
-
try {
|
|
28
|
-
parsed = new URL(token);
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return token;
|
|
32
|
-
}
|
|
33
|
-
const originalHref = parsed.href;
|
|
34
|
-
if (parsed.username.length > 0) {
|
|
35
|
-
parsed.username = "[REDACTED]";
|
|
36
|
-
}
|
|
37
|
-
if (parsed.password.length > 0) {
|
|
38
|
-
parsed.password = "[REDACTED]";
|
|
39
|
-
}
|
|
40
|
-
const hashParams = getHashParameters(parsed.hash);
|
|
41
|
-
const authContext = AUTH_URL_CONTEXT_PATTERN.test(`${parsed.hostname}${parsed.pathname}`) ||
|
|
42
|
-
[...parsed.searchParams.keys(), ...(hashParams?.keys() ?? [])].some(shouldRedactQueryParam);
|
|
43
|
-
redactParameters(parsed.searchParams, authContext);
|
|
44
|
-
if (hashParams && redactParameters(hashParams, authContext)) {
|
|
45
|
-
parsed.hash = `#${hashParams.toString()}`;
|
|
46
|
-
}
|
|
47
|
-
return parsed.href === originalHref ? token : parsed.href;
|
|
48
|
-
}
|
|
49
|
-
function decodeParameterName(raw) {
|
|
50
|
-
try {
|
|
51
|
-
return decodeURIComponent(raw.replace(/\+/g, " "));
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return raw;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function redactLooseUrlParameterText(text) {
|
|
58
|
-
return text.replace(/(?<![^\s"'`<>\])}])[^\s"'`<>\])}]*[?#&][^\s"'`<>\])}]*/g, (token) => {
|
|
59
|
-
const queryNames = [...token.matchAll(/[?#&]([^=&#\s"'`<>\])}]+)=/g)].map((match) => decodeParameterName(match[1]));
|
|
60
|
-
const authContext = AUTH_URL_CONTEXT_PATTERN.test(token) || queryNames.some(shouldRedactQueryParam);
|
|
61
|
-
return token.replace(/([?#&])([^=&#\s"'`<>\])}]+)=([^&#\s"'`<>\])}]*)/g, (match, separator, rawName, rawValue) => {
|
|
62
|
-
if (rawValue === "[REDACTED" ||
|
|
63
|
-
rawValue === "[REDACTED]" ||
|
|
64
|
-
/%5Bredacted%5D/i.test(rawValue)) {
|
|
65
|
-
return match;
|
|
66
|
-
}
|
|
67
|
-
if (!isSensitiveParameter(decodeParameterName(rawName), authContext)) {
|
|
68
|
-
return match;
|
|
69
|
-
}
|
|
70
|
-
return `${separator}${rawName}=[REDACTED]`;
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function redactLooseUrlUserinfo(text) {
|
|
75
|
-
return text.replace(/\b([A-Za-z][A-Za-z0-9+.-]*:\/\/)([^\s"'`/@]+)@([^\s"'`]+)/g, (match, prefix, userinfo, suffix) => {
|
|
76
|
-
if (/%5Bredacted%5D/i.test(userinfo)) {
|
|
77
|
-
return match;
|
|
78
|
-
}
|
|
79
|
-
if (userinfo.includes("[REDACTED]")) {
|
|
80
|
-
return redactLooseUrlParameterText(match);
|
|
81
|
-
}
|
|
82
|
-
return redactLooseUrlParameterText(`${prefix}${userinfo.includes(":") ? "[REDACTED]:[REDACTED]" : "[REDACTED]"}@${suffix}`);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
export function redactLooseUrls(text) {
|
|
86
|
-
const urls = text.replace(/\b[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s"'`<>\])]+/g, (match) => redactUrlToken(match));
|
|
87
|
-
return redactLooseUrlParameterText(redactLooseUrlUserinfo(urls));
|
|
88
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { isOpenNavigationCommand, isPageMutationCommand } from "../command-taxonomy.js";
|
|
2
|
-
import { applySessionToNextActions, buildNextToolAction } from "./next-actions.js";
|
|
3
|
-
import { buildRecoveryNextActions } from "./recovery-actions.js";
|
|
4
|
-
import { buildElectronNextActions } from "./electron-recommendations.js";
|
|
5
|
-
import { buildPendingRecordingNextActions, buildSavedArtifactNextActions, } from "./artifact-recommendations.js";
|
|
6
|
-
import { buildFailureNextActions } from "./failure-recommendations.js";
|
|
7
|
-
function buildSuccessNavigationActions(options) {
|
|
8
|
-
if (isOpenNavigationCommand(options.command)) {
|
|
9
|
-
return [
|
|
10
|
-
buildNextToolAction({
|
|
11
|
-
args: ["snapshot", "-i"],
|
|
12
|
-
id: "inspect-opened-page",
|
|
13
|
-
reason: "Inspect the opened page before choosing interactive refs.",
|
|
14
|
-
}),
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
return isPageMutationCommand(options.command, options.subcommand)
|
|
18
|
-
? [
|
|
19
|
-
buildNextToolAction({
|
|
20
|
-
args: ["snapshot", "-i"],
|
|
21
|
-
id: "inspect-after-mutation",
|
|
22
|
-
reason: "Refresh interactive refs after a browser mutation, navigation, scroll, or rerender.",
|
|
23
|
-
safety: "Do not reuse prior @refs until a fresh snapshot confirms they still exist.",
|
|
24
|
-
}),
|
|
25
|
-
]
|
|
26
|
-
: [];
|
|
27
|
-
}
|
|
28
|
-
export function buildAgentBrowserNextActions(options) {
|
|
29
|
-
const actions = [
|
|
30
|
-
...(options.recovery ? buildRecoveryNextActions(options.recovery) : []),
|
|
31
|
-
...buildElectronNextActions(options),
|
|
32
|
-
...(options.resultCategory === "success"
|
|
33
|
-
? [...buildSuccessNavigationActions(options), ...buildSavedArtifactNextActions(options)]
|
|
34
|
-
: buildFailureNextActions(options)),
|
|
35
|
-
...buildPendingRecordingNextActions(options.artifacts),
|
|
36
|
-
];
|
|
37
|
-
return applySessionToNextActions(actions.length > 0 ? actions : undefined, options.sessionName);
|
|
38
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|