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,165 +0,0 @@
|
|
|
1
|
-
import { inspectElectronLaunchStatus } from "../../electron/cleanup.js";
|
|
2
|
-
import { getAgentBrowserProcessEnvironment } from "../../process-environment.js";
|
|
3
|
-
import { buildAgentBrowserNextActions } from "../../results/action-recommendations.js";
|
|
4
|
-
import { buildAgentBrowserResultCategoryDetails } from "../../results/categories.js";
|
|
5
|
-
import { appendUniqueAgentBrowserNextActions } from "../../results/next-actions.js";
|
|
6
|
-
import { redactSensitiveText } from "../../runtime-redaction.js";
|
|
7
|
-
import { getSessionPageStateKey } from "../../session-page-state.js";
|
|
8
|
-
import { buildElectronHostFailureResult, formatElectronTargetLines, redactToolDetails, } from "../browser-run/final-result.js";
|
|
9
|
-
import { buildElectronIdentifiers, buildElectronMismatchNextActions, buildElectronSessionMismatch, formatElectronSessionMismatchText, } from "../browser-run/session-state.js";
|
|
10
|
-
import { selectElectronRecords } from "./branch.js";
|
|
11
|
-
import { collectOwnedElectronManagedSessionTarget } from "./policy.js";
|
|
12
|
-
function pidStatusText(pidAlive) {
|
|
13
|
-
if (pidAlive === undefined) {
|
|
14
|
-
return "";
|
|
15
|
-
}
|
|
16
|
-
return pidAlive ? ", pid alive" : ", pid dead";
|
|
17
|
-
}
|
|
18
|
-
function formatLaunchHeadline(status, record) {
|
|
19
|
-
const sessionName = record?.sessionName;
|
|
20
|
-
const sessionText = sessionName !== undefined && sessionName.length > 0 ? `, sessionName ${sessionName}` : "";
|
|
21
|
-
const historyText = status.cleanupState === "cleaned" ? "; historical cleaned launch record" : "";
|
|
22
|
-
return `- ${status.launchId}: ${record?.appName ?? "Electron launch"}${sessionText}${historyText}; ${status.portAlive ? "debug port alive" : "debug port dead"}${pidStatusText(status.pidAlive)} (port ${status.port})`;
|
|
23
|
-
}
|
|
24
|
-
function formatLaunchStatus(status, record, managedSession) {
|
|
25
|
-
const sessionName = record?.sessionName;
|
|
26
|
-
const lines = [
|
|
27
|
-
formatLaunchHeadline(status, record),
|
|
28
|
-
` Tracked profile path: ${status.userDataDirState}.`,
|
|
29
|
-
` Identifiers: launchId ${status.launchId}; sessionName ${sessionName ?? "not attached"}.`,
|
|
30
|
-
...formatElectronTargetLines(status.targets, 4).map((line) => ` ${line}`),
|
|
31
|
-
];
|
|
32
|
-
if (managedSession?.error !== undefined && managedSession.error.length > 0) {
|
|
33
|
-
lines.push(` Managed session warning: ${managedSession.error}`);
|
|
34
|
-
}
|
|
35
|
-
return lines;
|
|
36
|
-
}
|
|
37
|
-
function formatElectronStatusVisibleText(options) {
|
|
38
|
-
if (options.statuses.length === 0) {
|
|
39
|
-
return "Electron status: no active wrapper-tracked launches.";
|
|
40
|
-
}
|
|
41
|
-
const recordsByLaunchId = new Map(options.records.map((record) => [record.launchId, record]));
|
|
42
|
-
const sessionsByName = new Map(options.managedSessions.map((session) => [session.sessionName, session]));
|
|
43
|
-
const lines = [`Electron status: ${options.statuses.length} wrapper-tracked launch(es).`];
|
|
44
|
-
for (const status of options.statuses) {
|
|
45
|
-
const record = recordsByLaunchId.get(status.launchId);
|
|
46
|
-
const name = record?.sessionName;
|
|
47
|
-
const session = name !== undefined && name.length > 0 ? sessionsByName.get(name) : undefined;
|
|
48
|
-
lines.push(...formatLaunchStatus(status, record, session));
|
|
49
|
-
}
|
|
50
|
-
for (const mismatch of options.mismatches) {
|
|
51
|
-
lines.push("", formatElectronSessionMismatchText(mismatch));
|
|
52
|
-
}
|
|
53
|
-
return lines.join("\n");
|
|
54
|
-
}
|
|
55
|
-
function statusNextActions(options) {
|
|
56
|
-
const base = options.records.flatMap((record) => buildAgentBrowserNextActions({
|
|
57
|
-
electron: {
|
|
58
|
-
launchId: record.launchId,
|
|
59
|
-
sessionName: record.sessionName,
|
|
60
|
-
status: record.cleanupState,
|
|
61
|
-
},
|
|
62
|
-
resultCategory: "success",
|
|
63
|
-
successCategory: "completed",
|
|
64
|
-
}) ?? []);
|
|
65
|
-
const mismatch = options.mismatches.flatMap((row) => {
|
|
66
|
-
const record = options.records.find((candidate) => candidate.launchId === row.launchId);
|
|
67
|
-
return record ? buildElectronMismatchNextActions(record, row.liveTarget) : [];
|
|
68
|
-
});
|
|
69
|
-
return options.mismatches.length > 0
|
|
70
|
-
? appendUniqueAgentBrowserNextActions([...mismatch], base)
|
|
71
|
-
: appendUniqueAgentBrowserNextActions([...base], mismatch);
|
|
72
|
-
}
|
|
73
|
-
function buildElectronStatusResult(options) {
|
|
74
|
-
const nextActions = statusNextActions(options);
|
|
75
|
-
const soleRecord = options.records.length === 1 ? options.records[0] : undefined;
|
|
76
|
-
const details = {
|
|
77
|
-
args: [],
|
|
78
|
-
compiledElectron: options.compiledElectron,
|
|
79
|
-
electron: {
|
|
80
|
-
action: "status",
|
|
81
|
-
identifierList: options.records.length > 1 ? options.records.map(buildElectronIdentifiers) : undefined,
|
|
82
|
-
identifiers: soleRecord ? buildElectronIdentifiers(soleRecord) : undefined,
|
|
83
|
-
launches: options.records,
|
|
84
|
-
managedSession: options.managedSessions.length === 1 ? options.managedSessions[0] : undefined,
|
|
85
|
-
managedSessions: options.managedSessions.length > 0 ? options.managedSessions : undefined,
|
|
86
|
-
sessionMismatch: options.mismatches.length === 1 ? options.mismatches[0] : undefined,
|
|
87
|
-
sessionMismatches: options.mismatches.length > 1 ? options.mismatches : undefined,
|
|
88
|
-
status: "succeeded",
|
|
89
|
-
statuses: options.statuses,
|
|
90
|
-
targets: options.statuses.flatMap((status) => status.targets),
|
|
91
|
-
},
|
|
92
|
-
nextActions: nextActions.length > 0 ? nextActions : undefined,
|
|
93
|
-
...buildAgentBrowserResultCategoryDetails({ args: [], succeeded: true }),
|
|
94
|
-
summary: options.statuses.length === 0
|
|
95
|
-
? "Electron status found no active wrapper-tracked launches."
|
|
96
|
-
: `Electron status inspected ${options.statuses.length} launch(es).`,
|
|
97
|
-
};
|
|
98
|
-
return {
|
|
99
|
-
content: [
|
|
100
|
-
{ type: "text", text: redactSensitiveText(formatElectronStatusVisibleText(options)) },
|
|
101
|
-
],
|
|
102
|
-
details: redactToolDetails(details, []),
|
|
103
|
-
isError: false,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function collectStatusManagedSessions(options, records, timeoutMs) {
|
|
107
|
-
return Promise.all(records
|
|
108
|
-
.filter((record) => typeof record.sessionName === "string")
|
|
109
|
-
.map((record) => {
|
|
110
|
-
const key = getSessionPageStateKey(record.sessionName, record.namespace) ?? record.sessionName;
|
|
111
|
-
const owner = options.ownedManagedSessions.get(key);
|
|
112
|
-
return collectOwnedElectronManagedSessionTarget({
|
|
113
|
-
confirmActions: options.sessionPageState.get(key).confirmActions ??
|
|
114
|
-
getAgentBrowserProcessEnvironment().AGENT_BROWSER_CONFIRM_ACTIONS,
|
|
115
|
-
cwd: options.cwd,
|
|
116
|
-
electronLaunchRecord: record,
|
|
117
|
-
headedManagedAutosaveDisabled: owner?.headedManagedAutosaveDisabled,
|
|
118
|
-
headedManagedAutosaveInterval: owner?.headedManagedAutosaveInterval,
|
|
119
|
-
namespace: record.namespace,
|
|
120
|
-
restoreState: options.managedSessionRestoreState,
|
|
121
|
-
sessionName: record.sessionName,
|
|
122
|
-
signal: options.signal,
|
|
123
|
-
timeoutMs,
|
|
124
|
-
});
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
function statusMismatches(records, statuses, managedSessions) {
|
|
128
|
-
return managedSessions
|
|
129
|
-
.map((session) => {
|
|
130
|
-
const record = records.find((candidate) => candidate.sessionName === session.sessionName &&
|
|
131
|
-
candidate.namespace === session.namespace);
|
|
132
|
-
const status = record
|
|
133
|
-
? statuses.find((candidate) => candidate.launchId === record.launchId)
|
|
134
|
-
: undefined;
|
|
135
|
-
return record && status
|
|
136
|
-
? buildElectronSessionMismatch({
|
|
137
|
-
managedSession: session,
|
|
138
|
-
record,
|
|
139
|
-
statusTargets: status.targets,
|
|
140
|
-
})
|
|
141
|
-
: undefined;
|
|
142
|
-
})
|
|
143
|
-
.filter((mismatch) => mismatch !== undefined);
|
|
144
|
-
}
|
|
145
|
-
export async function inspectElectronHostLaunches(options, compiledElectron, visibleInput) {
|
|
146
|
-
const selection = selectElectronRecords(compiledElectron, options.electronLaunchRecords);
|
|
147
|
-
if (selection.error !== undefined && selection.error.length > 0) {
|
|
148
|
-
return buildElectronHostFailureResult({
|
|
149
|
-
compiledElectron: visibleInput,
|
|
150
|
-
errorText: selection.error,
|
|
151
|
-
failureCategory: "validation-error",
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
const records = selection.records ?? [];
|
|
155
|
-
const statuses = await Promise.all(records.map((record) => inspectElectronLaunchStatus(record)));
|
|
156
|
-
const managedSessions = await collectStatusManagedSessions(options, records, compiledElectron.timeoutMs);
|
|
157
|
-
const mismatches = statusMismatches(records, statuses, managedSessions);
|
|
158
|
-
return buildElectronStatusResult({
|
|
159
|
-
compiledElectron: visibleInput,
|
|
160
|
-
managedSessions,
|
|
161
|
-
mismatches,
|
|
162
|
-
records,
|
|
163
|
-
statuses,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import { getAgentBrowserSessionIdentityKey, isAgentBrowserSessionIdentityKeyInNamespace, } from "../argv-grammar.js";
|
|
3
|
-
// Serializes managed-session read/modify/write work so overlapping tool calls cannot promote stale state or close an in-use session.
|
|
4
|
-
export class AsyncExecutionQueue {
|
|
5
|
-
tail = Promise.resolve();
|
|
6
|
-
active = new AsyncLocalStorage();
|
|
7
|
-
isCurrent() {
|
|
8
|
-
return this.active.getStore()?.active === true;
|
|
9
|
-
}
|
|
10
|
-
run(work, signal, barrier = Promise.resolve()) {
|
|
11
|
-
if (this.isCurrent()) {
|
|
12
|
-
signal?.throwIfAborted();
|
|
13
|
-
return work();
|
|
14
|
-
}
|
|
15
|
-
const previous = this.tail;
|
|
16
|
-
let release;
|
|
17
|
-
this.tail = new Promise((resolve) => {
|
|
18
|
-
release = resolve;
|
|
19
|
-
});
|
|
20
|
-
let rejectWaiting;
|
|
21
|
-
const cancelled = new Promise((_resolve, reject) => {
|
|
22
|
-
rejectWaiting = reject;
|
|
23
|
-
});
|
|
24
|
-
const abortWaiting = () => {
|
|
25
|
-
rejectWaiting(signal?.reason);
|
|
26
|
-
};
|
|
27
|
-
signal?.addEventListener("abort", abortWaiting, { once: true });
|
|
28
|
-
if (signal?.aborted === true) {
|
|
29
|
-
abortWaiting();
|
|
30
|
-
}
|
|
31
|
-
const execution = (async () => {
|
|
32
|
-
await Promise.all([previous, barrier]);
|
|
33
|
-
signal?.removeEventListener("abort", abortWaiting);
|
|
34
|
-
try {
|
|
35
|
-
signal?.throwIfAborted();
|
|
36
|
-
const scope = { active: true };
|
|
37
|
-
try {
|
|
38
|
-
return await this.active.run(scope, work);
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
scope.active = false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
finally {
|
|
45
|
-
release();
|
|
46
|
-
}
|
|
47
|
-
})();
|
|
48
|
-
return signal ? Promise.race([execution, cancelled]) : execution;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export class KeyedAsyncExecutionQueue {
|
|
52
|
-
barriers = new Map();
|
|
53
|
-
entries = new Map();
|
|
54
|
-
async run(key, namespace, work, signal) {
|
|
55
|
-
const entry = this.entries.get(key) ?? { queue: new AsyncExecutionQueue(), users: 0 };
|
|
56
|
-
if (entry.queue.isCurrent()) {
|
|
57
|
-
return work();
|
|
58
|
-
}
|
|
59
|
-
const barrier = this.barriers.get(getAgentBrowserSessionIdentityKey("", namespace)) ?? Promise.resolve();
|
|
60
|
-
entry.users += 1;
|
|
61
|
-
this.entries.set(key, entry);
|
|
62
|
-
try {
|
|
63
|
-
return await entry.queue.run(work, signal, barrier);
|
|
64
|
-
}
|
|
65
|
-
finally {
|
|
66
|
-
entry.users -= 1;
|
|
67
|
-
if (entry.users === 0 && this.entries.get(key) === entry) {
|
|
68
|
-
this.entries.delete(key);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async runExclusive(namespace, work) {
|
|
73
|
-
const namespaceKey = getAgentBrowserSessionIdentityKey("", namespace);
|
|
74
|
-
const previous = this.barriers.get(namespaceKey) ?? Promise.resolve();
|
|
75
|
-
let release;
|
|
76
|
-
const blocked = new Promise((resolve) => {
|
|
77
|
-
release = resolve;
|
|
78
|
-
});
|
|
79
|
-
const barrier = previous.then(() => blocked);
|
|
80
|
-
this.barriers.set(namespaceKey, barrier);
|
|
81
|
-
const drains = [...this.entries]
|
|
82
|
-
.filter(([key]) => isAgentBrowserSessionIdentityKeyInNamespace(key, namespace))
|
|
83
|
-
.map(([, { queue }]) => queue.run(async () => {
|
|
84
|
-
// This queued marker only waits for earlier work; it has no browser operation.
|
|
85
|
-
}));
|
|
86
|
-
await previous;
|
|
87
|
-
await Promise.all(drains);
|
|
88
|
-
try {
|
|
89
|
-
return await work();
|
|
90
|
-
}
|
|
91
|
-
finally {
|
|
92
|
-
release();
|
|
93
|
-
if (this.barriers.get(namespaceKey) === barrier) {
|
|
94
|
-
this.barriers.delete(namespaceKey);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { extractUpstreamCommandTokens, validateToolArgs } from "../runtime.js";
|
|
2
|
-
import { isCloseAllCommand, isCloseCommand } from "../command-taxonomy.js";
|
|
3
|
-
import { canonicalizeExplicitArtifactDestination, getExplicitArtifactDestination, getRecordContactSheetDestination, } from "./browser-run/artifact-paths.js";
|
|
4
|
-
import { parseBatchCommandArgument, parseUserBatchStdin } from "./batch-stdin.js";
|
|
5
|
-
import { normalizeRequestedOutputPath } from "./output-file.js";
|
|
6
|
-
function parseRawArtifactSteps(commands) {
|
|
7
|
-
const steps = [];
|
|
8
|
-
for (const command of commands) {
|
|
9
|
-
if (command === "--bail") {
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
const parsed = parseBatchCommandArgument(command);
|
|
13
|
-
if ((parsed.error !== undefined && parsed.error !== "") || !parsed.step) {
|
|
14
|
-
return {
|
|
15
|
-
batch: true,
|
|
16
|
-
error: `Unsupported batch step ${steps.length + 1}: ${parsed.error ?? "command could not be parsed safely"}`,
|
|
17
|
-
steps,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
steps.push(parsed.step);
|
|
21
|
-
}
|
|
22
|
-
return { batch: true, steps };
|
|
23
|
-
}
|
|
24
|
-
export function getArtifactCommandSteps(args, stdin) {
|
|
25
|
-
const tokens = extractUpstreamCommandTokens([...args]);
|
|
26
|
-
if (tokens[0] !== "batch") {
|
|
27
|
-
return { batch: false, steps: tokens.length > 0 ? [tokens] : [] };
|
|
28
|
-
}
|
|
29
|
-
const parsed = parseRawArtifactSteps(tokens.slice(1));
|
|
30
|
-
if (parsed.error !== undefined && parsed.error !== "") {
|
|
31
|
-
return parsed;
|
|
32
|
-
}
|
|
33
|
-
// Raw native rows exclusively win over stdin, including artifact and lifecycle preflight.
|
|
34
|
-
if (parsed.steps.length > 0) {
|
|
35
|
-
return parsed;
|
|
36
|
-
}
|
|
37
|
-
const input = parseUserBatchStdin(stdin);
|
|
38
|
-
return input.error !== undefined && input.error !== ""
|
|
39
|
-
? { batch: true, error: input.error, steps: [] }
|
|
40
|
-
: { batch: true, steps: input.steps ?? [] };
|
|
41
|
-
}
|
|
42
|
-
class ArtifactPreflight {
|
|
43
|
-
options;
|
|
44
|
-
active = new Set();
|
|
45
|
-
destinations = new Map();
|
|
46
|
-
plan;
|
|
47
|
-
canonicalOutputPath;
|
|
48
|
-
sawClose = false;
|
|
49
|
-
constructor(options) {
|
|
50
|
-
this.options = options;
|
|
51
|
-
this.plan = getArtifactCommandSteps(options.args, options.stdin);
|
|
52
|
-
}
|
|
53
|
-
cleanupOnly() {
|
|
54
|
-
return (this.plan.steps.length > 0 &&
|
|
55
|
-
this.plan.steps.every(([command, subcommand]) => isCloseCommand(command) || (command === "record" && subcommand === "stop")));
|
|
56
|
-
}
|
|
57
|
-
reserveActiveDestinations() {
|
|
58
|
-
for (const reservation of this.options.activeRecordingReservations ?? []) {
|
|
59
|
-
try {
|
|
60
|
-
this.active.add(canonicalizeExplicitArtifactDestination(reservation.cwd, reservation.absolutePath));
|
|
61
|
-
if (reservation.contactSheetPath !== undefined && reservation.contactSheetPath !== "") {
|
|
62
|
-
this.active.add(canonicalizeExplicitArtifactDestination(reservation.cwd, reservation.contactSheetPath));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
if (!this.cleanupOnly()) {
|
|
67
|
-
return error instanceof Error
|
|
68
|
-
? error.message
|
|
69
|
-
: "An active recording destination could not be resolved safely.";
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
validateOutputPath() {
|
|
76
|
-
const path = this.options.outputPath;
|
|
77
|
-
if (path === undefined || path === "") {
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
this.canonicalOutputPath = canonicalizeExplicitArtifactDestination(this.options.cwd, normalizeRequestedOutputPath(path));
|
|
82
|
-
if (this.active.has(this.canonicalOutputPath)) {
|
|
83
|
-
return `Unsupported outputPath: ${path} is reserved by an active recording. Stop that recording first or use a distinct path.`;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
return error instanceof Error
|
|
88
|
-
? error.message
|
|
89
|
-
: `outputPath ${path} could not be resolved safely.`;
|
|
90
|
-
}
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
validateBatchStep(step, index) {
|
|
94
|
-
if (!this.plan.batch) {
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
const error = validateToolArgs([...step], { batchStep: true });
|
|
98
|
-
if (error !== undefined && error !== "") {
|
|
99
|
-
return `Unsupported batch step ${index + 1}: ${error}`;
|
|
100
|
-
}
|
|
101
|
-
if (this.sawClose && step[0] === "record" && (step[1] === "start" || step[1] === "restart")) {
|
|
102
|
-
return `Unsupported batch step ${index + 1}: record ${step[1]} cannot follow close, quit, or exit in one upstream batch because upstream can report success without starting a recording. Split the close and recording into separate agent_browser calls.`;
|
|
103
|
-
}
|
|
104
|
-
if (isCloseCommand(step[0])) {
|
|
105
|
-
this.sawClose = true;
|
|
106
|
-
}
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
validateDestination(destination, index) {
|
|
110
|
-
let canonical;
|
|
111
|
-
try {
|
|
112
|
-
canonical = canonicalizeExplicitArtifactDestination(this.options.cwd, destination);
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
return error instanceof Error
|
|
116
|
-
? error.message
|
|
117
|
-
: `Artifact destination ${destination} could not be resolved safely.`;
|
|
118
|
-
}
|
|
119
|
-
if (this.canonicalOutputPath === canonical) {
|
|
120
|
-
return `Unsupported outputPath: ${this.options.outputPath ?? ""} resolves to the same destination as artifact path ${destination}. Use distinct paths so the tool-result JSON cannot overwrite the browser artifact.`;
|
|
121
|
-
}
|
|
122
|
-
if (this.active.has(canonical)) {
|
|
123
|
-
const prefix = this.plan.batch
|
|
124
|
-
? `Unsupported batch artifact destination in step ${index + 1}`
|
|
125
|
-
: "Unsupported artifact destination";
|
|
126
|
-
return `${prefix}: ${destination} is reserved by an active recording. Stop that recording first or use a distinct path.`;
|
|
127
|
-
}
|
|
128
|
-
const prior = this.destinations.get(canonical);
|
|
129
|
-
if (prior !== undefined) {
|
|
130
|
-
return `Unsupported batch artifact destination in step ${index + 1}: ${destination} is already written by step ${prior + 1}. Use distinct paths or split the batch so each artifact can be verified independently.`;
|
|
131
|
-
}
|
|
132
|
-
this.destinations.set(canonical, index);
|
|
133
|
-
return undefined;
|
|
134
|
-
}
|
|
135
|
-
validateStepDestinations(step, index) {
|
|
136
|
-
for (const destination of [
|
|
137
|
-
getExplicitArtifactDestination([...step]),
|
|
138
|
-
getRecordContactSheetDestination([...step]),
|
|
139
|
-
]) {
|
|
140
|
-
if (destination === undefined || destination === "") {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
const failure = this.validateDestination(destination, index);
|
|
144
|
-
if (failure !== undefined && failure !== "") {
|
|
145
|
-
return failure;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return undefined;
|
|
149
|
-
}
|
|
150
|
-
validateStep(step, index) {
|
|
151
|
-
if (step.length === 0) {
|
|
152
|
-
return undefined;
|
|
153
|
-
}
|
|
154
|
-
const error = this.validateBatchStep(step, index);
|
|
155
|
-
if (error !== undefined && error !== "") {
|
|
156
|
-
return error;
|
|
157
|
-
}
|
|
158
|
-
const destinationFailure = this.validateStepDestinations(step, index);
|
|
159
|
-
if (destinationFailure !== undefined && destinationFailure !== "") {
|
|
160
|
-
return destinationFailure;
|
|
161
|
-
}
|
|
162
|
-
if (this.plan.batch && step[0] === "screenshot" && step.includes("--annotate")) {
|
|
163
|
-
return [
|
|
164
|
-
`Unsupported batch screenshot annotation in step ${index + 1}: put --annotate in top-level args, not inside the batch step.`,
|
|
165
|
-
`Use: { "args": ["--annotate", "batch"], "stdin": "[[\\"screenshot\\",\\"/path/to/image.png\\"]]" }`,
|
|
166
|
-
].join("\n");
|
|
167
|
-
}
|
|
168
|
-
return undefined;
|
|
169
|
-
}
|
|
170
|
-
run() {
|
|
171
|
-
const error = this.plan.error;
|
|
172
|
-
if (error !== undefined && error !== "") {
|
|
173
|
-
return error;
|
|
174
|
-
}
|
|
175
|
-
const activeError = this.reserveActiveDestinations();
|
|
176
|
-
if (activeError !== undefined && activeError !== "") {
|
|
177
|
-
return activeError;
|
|
178
|
-
}
|
|
179
|
-
const outputError = this.validateOutputPath();
|
|
180
|
-
if (outputError !== undefined && outputError !== "") {
|
|
181
|
-
return outputError;
|
|
182
|
-
}
|
|
183
|
-
for (const [index, step] of this.plan.steps.entries()) {
|
|
184
|
-
const failure = this.validateStep(step, index);
|
|
185
|
-
if (failure !== undefined && failure !== "") {
|
|
186
|
-
return failure;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return undefined;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
export function getArtifactPreflightValidationError(options) {
|
|
193
|
-
return new ArtifactPreflight(options).run();
|
|
194
|
-
}
|
|
195
|
-
export function commandClosesAllSessions(args, stdin) {
|
|
196
|
-
const parsed = getArtifactCommandSteps(args, stdin);
|
|
197
|
-
return ((parsed.error === undefined || parsed.error === "") && parsed.steps.some(isCloseAllCommand));
|
|
198
|
-
}
|
|
199
|
-
export function commandTouchesArtifactLifecycle(args, stdin, outputPath) {
|
|
200
|
-
if (outputPath !== undefined && outputPath !== "") {
|
|
201
|
-
return true;
|
|
202
|
-
}
|
|
203
|
-
const parsed = getArtifactCommandSteps(args, stdin);
|
|
204
|
-
if (parsed.error !== undefined && parsed.error !== "") {
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
return parsed.steps.some((step) => getExplicitArtifactDestination(step) !== undefined ||
|
|
208
|
-
step[0] === "record" ||
|
|
209
|
-
step[0] === "screenshot" ||
|
|
210
|
-
isCloseCommand(step[0]));
|
|
211
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { retirePendingRecordingManifestEntries } from "../results/artifact-manifest.js";
|
|
2
|
-
import { mergeBrowserRunArtifactManifest } from "./browser-run/artifact-merge.js";
|
|
3
|
-
import { AsyncExecutionQueue } from "./execution-queue.js";
|
|
4
|
-
/** One extension's artifact publication queue and bounded manifest. */
|
|
5
|
-
export class BrowserArtifacts {
|
|
6
|
-
pi;
|
|
7
|
-
queue = new AsyncExecutionQueue();
|
|
8
|
-
manifest;
|
|
9
|
-
constructor(pi) {
|
|
10
|
-
this.pi = pi;
|
|
11
|
-
}
|
|
12
|
-
commit(prior, rendered) {
|
|
13
|
-
this.manifest = mergeBrowserRunArtifactManifest(this.manifest, prior, rendered);
|
|
14
|
-
return this.manifest;
|
|
15
|
-
}
|
|
16
|
-
retireRecording(sessionName, namespace) {
|
|
17
|
-
const previous = this.manifest;
|
|
18
|
-
if (this.manifest) {
|
|
19
|
-
this.manifest = retirePendingRecordingManifestEntries(this.manifest, sessionName, namespace);
|
|
20
|
-
}
|
|
21
|
-
return this.manifest !== previous;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { getSuccessfulBatchCloseLifecycle } from "../batch-lifecycle.js";
|
|
2
|
-
import { getBrowserResultMessage } from "../browser-transcript.js";
|
|
3
|
-
import { extractExplicitNamespace, extractExplicitSessionName, deleteIdentityKeysInNamespace, } from "../argv-grammar.js";
|
|
4
|
-
import { extractUpstreamCommandTokens } from "../runtime.js";
|
|
5
|
-
import { isCloseCommand } from "../command-taxonomy.js";
|
|
6
|
-
import { isSuccessfulNativeConfirmedClose } from "../read-confirmation.js";
|
|
7
|
-
import { isRecord } from "../parsing.js";
|
|
8
|
-
import { getSessionContextKey } from "./browser-run/session-state.js";
|
|
9
|
-
import { getCleanupResultClosedManagedSessionIdentities } from "./extension-electron-ownership.js";
|
|
10
|
-
import { getToolResultArgs, getSuccessfulToolResult, detailsReportCloseAllApplied, isAttachedBrowserInvocation, } from "./extension-resource-replay.js";
|
|
11
|
-
function parseAttachmentRow(entry) {
|
|
12
|
-
const message = getBrowserResultMessage(entry);
|
|
13
|
-
const details = isRecord(message?.details) ? message.details : undefined;
|
|
14
|
-
if (!message || !details) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
const outcome = isRecord(details.managedSessionOutcome)
|
|
18
|
-
? details.managedSessionOutcome
|
|
19
|
-
: undefined;
|
|
20
|
-
const args = getToolResultArgs(details);
|
|
21
|
-
return {
|
|
22
|
-
details,
|
|
23
|
-
args,
|
|
24
|
-
succeeded: getSuccessfulToolResult(details, message),
|
|
25
|
-
batchCloseLifecycle: getSuccessfulBatchCloseLifecycle(details.batchSteps),
|
|
26
|
-
namespace: typeof details.namespace === "string" ? details.namespace : extractExplicitNamespace(args),
|
|
27
|
-
sessionName: typeof details.sessionName === "string"
|
|
28
|
-
? details.sessionName
|
|
29
|
-
: extractExplicitSessionName(args),
|
|
30
|
-
retainedFailedAttachment: details.attachedBrowserSession === true && outcome?.activeAfter === true,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
class AttachmentReplay {
|
|
34
|
-
keys = new Set();
|
|
35
|
-
cleanupElectron(row) {
|
|
36
|
-
const electron = isRecord(row.details.electron) ? row.details.electron : undefined;
|
|
37
|
-
const cleanup = isRecord(electron?.cleanup) ? electron.cleanup : undefined;
|
|
38
|
-
for (const result of Array.isArray(cleanup?.results) ? cleanup.results : []) {
|
|
39
|
-
for (const identity of getCleanupResultClosedManagedSessionIdentities(result, row.namespace)) {
|
|
40
|
-
this.keys.delete(getSessionContextKey(identity.sessionName, identity.namespace) ?? identity.sessionName);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
restoreCloseAll(row) {
|
|
45
|
-
if (!detailsReportCloseAllApplied(row.details, row.succeeded)) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
deleteIdentityKeysInNamespace(this.keys, row.namespace);
|
|
49
|
-
if (row.sessionName !== undefined &&
|
|
50
|
-
row.sessionName !== "" &&
|
|
51
|
-
row.details.attachedBrowserSession === true &&
|
|
52
|
-
row.batchCloseLifecycle?.endsClosed === false) {
|
|
53
|
-
this.keys.add(getSessionContextKey(row.sessionName, row.namespace) ?? row.sessionName);
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
closesAttachment(row) {
|
|
58
|
-
if (row.batchCloseLifecycle?.endsClosed === true) {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
const tokens = extractUpstreamCommandTokens([...row.args]);
|
|
62
|
-
const command = typeof row.details.command === "string" ? row.details.command : tokens[0];
|
|
63
|
-
return (row.succeeded &&
|
|
64
|
-
(isCloseCommand(command) || isSuccessfulNativeConfirmedClose(tokens, row.details.data)));
|
|
65
|
-
}
|
|
66
|
-
canRestore(row) {
|
|
67
|
-
return (row.succeeded || row.retainedFailedAttachment || row.batchCloseLifecycle?.endsClosed === true);
|
|
68
|
-
}
|
|
69
|
-
apply(row) {
|
|
70
|
-
this.cleanupElectron(row);
|
|
71
|
-
if (this.restoreCloseAll(row)) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (!this.canRestore(row)) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (row.sessionName === undefined || row.sessionName === "") {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const key = getSessionContextKey(row.sessionName, row.namespace) ?? row.sessionName;
|
|
81
|
-
if (this.closesAttachment(row)) {
|
|
82
|
-
this.keys.delete(key);
|
|
83
|
-
}
|
|
84
|
-
else if (row.details.attachedBrowserSession === true ||
|
|
85
|
-
isAttachedBrowserInvocation(row.args, {})) {
|
|
86
|
-
this.keys.add(key);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
export function restoreAttachedSessionKeysFromBranch(branch) {
|
|
91
|
-
const replay = new AttachmentReplay();
|
|
92
|
-
for (const entry of branch) {
|
|
93
|
-
const row = parseAttachmentRow(entry);
|
|
94
|
-
if (row) {
|
|
95
|
-
replay.apply(row);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return replay.keys;
|
|
99
|
-
}
|