pi-agent-browser-native 0.9.3 → 0.9.5
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 +106 -5
- package/README.md +58 -791
- package/dist/extensions/agent-browser/index.js +43101 -2031
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +49 -26
- package/dist/extensions/agent-browser/lib/argv-grammar.js +82 -93
- package/dist/extensions/agent-browser/lib/bash-guard.js +129 -126
- package/dist/extensions/agent-browser/lib/batch-lifecycle.js +112 -51
- package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +61 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +232 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claims.js +202 -0
- package/dist/extensions/agent-browser/lib/browser-execution-identity.js +77 -0
- package/dist/extensions/agent-browser/lib/browser-journal-branch.js +98 -0
- package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-journal-projection.js +221 -0
- package/dist/extensions/agent-browser/lib/browser-journal-reader.js +89 -0
- package/dist/extensions/agent-browser/lib/browser-journal-replay.js +246 -0
- package/dist/extensions/agent-browser/lib/browser-journal.js +103 -394
- package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +220 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +282 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-types.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +217 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion.js +80 -335
- package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +35 -0
- package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +166 -0
- package/dist/extensions/agent-browser/lib/browser-transcript.js +137 -82
- package/dist/extensions/agent-browser/lib/browser-value-parsing.js +15 -0
- package/dist/extensions/agent-browser/lib/command-capabilities.js +340 -0
- package/dist/extensions/agent-browser/lib/command-policy.js +107 -88
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +49 -322
- package/dist/extensions/agent-browser/lib/config-policy.js +138 -343
- package/dist/extensions/agent-browser/lib/config-providers.js +71 -0
- package/dist/extensions/agent-browser/lib/config-validation.js +231 -0
- package/dist/extensions/agent-browser/lib/config.js +20 -8
- package/dist/extensions/agent-browser/lib/electron/cdp.js +20 -8
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +128 -83
- package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +109 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +136 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +90 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +93 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +162 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/discovery.js +140 -549
- package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +102 -0
- package/dist/extensions/agent-browser/lib/electron/launch-process.js +209 -0
- package/dist/extensions/agent-browser/lib/electron/launch-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/launch.js +261 -355
- package/dist/extensions/agent-browser/lib/executable-path.js +21 -12
- package/dist/extensions/agent-browser/lib/execution-cwd.js +35 -18
- package/dist/extensions/agent-browser/lib/fs-utils.js +1 -9
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +162 -121
- package/dist/extensions/agent-browser/lib/input-modes/job.js +123 -317
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +116 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +132 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +57 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +151 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +142 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +58 -412
- package/dist/extensions/agent-browser/lib/input-modes/params.js +86 -40
- package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +268 -0
- package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +117 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-child.js +396 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +86 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-types.js +1 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +60 -0
- package/dist/extensions/agent-browser/lib/input-modes/script.js +60 -409
- package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +218 -128
- package/dist/extensions/agent-browser/lib/input-modes/shared.js +15 -4
- package/dist/extensions/agent-browser/lib/input-modes/types.js +56 -7
- package/dist/extensions/agent-browser/lib/json-schema.js +22 -10
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +17 -5
- package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +92 -425
- package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +58 -0
- package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +244 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +84 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +119 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +83 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore.js +168 -300
- package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +277 -0
- package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +128 -305
- package/dist/extensions/agent-browser/lib/managed-session-storage.js +56 -253
- package/dist/extensions/agent-browser/lib/native-confirmation.js +140 -0
- package/dist/extensions/agent-browser/lib/native-output.js +43 -9
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +106 -59
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +14 -6
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +109 -57
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +82 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +164 -60
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +31 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +152 -781
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +203 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +109 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +123 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +156 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +187 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +89 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +97 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +110 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +41 -538
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +199 -154
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +127 -205
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +65 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +113 -30
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +109 -28
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +147 -253
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +59 -24
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +159 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +131 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +42 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +242 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +75 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +92 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +254 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +114 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +222 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +68 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +176 -1123
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +191 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +152 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +115 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +316 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +28 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +333 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +71 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +201 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +183 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +200 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +18 -968
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +23 -13
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +198 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +154 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +68 -151
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +14 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +169 -46
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +212 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +61 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +187 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +169 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +228 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +77 -765
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +78 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +48 -821
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +86 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +68 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +169 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +161 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +22 -10
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +211 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +23 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +99 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +275 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +280 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +303 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +36 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +335 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +227 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +204 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +139 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +24 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +98 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +295 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +41 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +7 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +102 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +133 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +180 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +269 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +146 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +54 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +261 -185
- package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-config.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +77 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +210 -157
- package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +124 -58
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +197 -99
- package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +199 -96
- package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +55 -0
- package/dist/extensions/agent-browser/lib/page-target-batch.js +118 -0
- package/dist/extensions/agent-browser/lib/page-target-guards.js +50 -0
- package/dist/extensions/agent-browser/lib/page-target-navigation.js +104 -0
- package/dist/extensions/agent-browser/lib/page-target-validation.js +55 -246
- package/dist/extensions/agent-browser/lib/parsing.js +13 -4
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +133 -68
- package/dist/extensions/agent-browser/lib/playbook.js +16 -12
- package/dist/extensions/agent-browser/lib/process-child.js +284 -0
- package/dist/extensions/agent-browser/lib/process-environment.js +13 -6
- package/dist/extensions/agent-browser/lib/process-errors.js +23 -0
- package/dist/extensions/agent-browser/lib/process-identity.js +47 -15
- package/dist/extensions/agent-browser/lib/process-socket-storage.js +256 -0
- package/dist/extensions/agent-browser/lib/process-stdout.js +74 -0
- package/dist/extensions/agent-browser/lib/process.js +145 -536
- package/dist/extensions/agent-browser/lib/prompt-artifacts.js +287 -0
- package/dist/extensions/agent-browser/lib/prompt-policy.js +15 -194
- package/dist/extensions/agent-browser/lib/read-command.js +41 -0
- package/dist/extensions/agent-browser/lib/read-confirmation.js +131 -68
- package/dist/extensions/agent-browser/lib/recording-reservations.js +118 -45
- package/dist/extensions/agent-browser/lib/redaction-fields.js +75 -0
- package/dist/extensions/agent-browser/lib/redaction-json.js +149 -0
- package/dist/extensions/agent-browser/lib/redaction-url.js +88 -0
- package/dist/extensions/agent-browser/lib/results/action-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/action-recommendations.js +28 -271
- package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +96 -94
- package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +73 -0
- package/dist/extensions/agent-browser/lib/results/categories.js +111 -54
- package/dist/extensions/agent-browser/lib/results/confirmation.js +29 -13
- package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +62 -27
- package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +83 -0
- package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +48 -0
- package/dist/extensions/agent-browser/lib/results/envelope.js +90 -67
- package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +180 -0
- package/dist/extensions/agent-browser/lib/results/network-routes.js +86 -45
- package/dist/extensions/agent-browser/lib/results/network.js +35 -12
- package/dist/extensions/agent-browser/lib/results/next-actions.js +49 -19
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +320 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +138 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +113 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +145 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +99 -555
- package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +118 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +68 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +135 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +227 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +91 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +91 -460
- package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +9 -5
- package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/common.js +26 -9
- package/dist/extensions/agent-browser/lib/results/presentation/content.js +86 -29
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +67 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +79 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +199 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +124 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +64 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +209 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +69 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +222 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +103 -1052
- package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +70 -0
- package/dist/extensions/agent-browser/lib/results/presentation/errors.js +130 -60
- package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +60 -145
- package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +147 -88
- package/dist/extensions/agent-browser/lib/results/presentation/notices.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +127 -0
- package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +120 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +77 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +51 -0
- package/dist/extensions/agent-browser/lib/results/presentation/registry.js +116 -240
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +35 -21
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +109 -73
- package/dist/extensions/agent-browser/lib/results/presentation/source.js +109 -0
- package/dist/extensions/agent-browser/lib/results/presentation.js +17 -261
- package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/recording.js +52 -14
- package/dist/extensions/agent-browser/lib/results/recovery-actions.js +14 -5
- package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +30 -22
- package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +83 -0
- package/dist/extensions/agent-browser/lib/results/selector-recovery.js +119 -119
- package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +266 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-content.js +32 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +104 -71
- package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +31 -11
- package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +125 -66
- package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +26 -7
- package/dist/extensions/agent-browser/lib/results/snapshot.js +28 -248
- package/dist/extensions/agent-browser/lib/results/text.js +16 -5
- package/dist/extensions/agent-browser/lib/runtime-args-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/runtime-compatibility.js +81 -0
- package/dist/extensions/agent-browser/lib/runtime-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/runtime-redaction.js +118 -0
- package/dist/extensions/agent-browser/lib/runtime-replay-events.js +144 -0
- package/dist/extensions/agent-browser/lib/runtime-session-identity.js +76 -0
- package/dist/extensions/agent-browser/lib/runtime-session-plan.js +114 -0
- package/dist/extensions/agent-browser/lib/runtime-session-replay.js +123 -0
- package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +65 -0
- package/dist/extensions/agent-browser/lib/runtime-timeouts.js +28 -0
- package/dist/extensions/agent-browser/lib/runtime.js +137 -1041
- package/dist/extensions/agent-browser/lib/session-identity.js +51 -0
- package/dist/extensions/agent-browser/lib/session-page-observation.js +357 -0
- package/dist/extensions/agent-browser/lib/session-page-state.js +178 -333
- package/dist/extensions/agent-browser/lib/session-page-types.js +1 -0
- package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +81 -0
- package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +7 -0
- package/dist/extensions/agent-browser/lib/temp-root-ownership.js +234 -0
- package/dist/extensions/agent-browser/lib/temp-root.js +211 -0
- package/dist/extensions/agent-browser/lib/temp.js +33 -446
- package/dist/extensions/agent-browser/lib/tool-surface.js +94 -24
- package/dist/extensions/agent-browser/lib/upstream-version.js +3 -2
- package/dist/extensions/agent-browser/lib/web-search-providers.js +193 -0
- package/dist/extensions/agent-browser/lib/web-search-request.js +102 -0
- package/dist/extensions/agent-browser/lib/web-search-results.js +281 -0
- package/dist/extensions/agent-browser/lib/web-search-schema.js +82 -0
- package/dist/extensions/agent-browser/lib/web-search.js +124 -614
- package/dist/extensions/agent-browser/lib/webmcp-observation.js +13 -6
- package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +63 -37
- package/dist/extensions/agent-browser/script-worker.js +80 -43
- package/dist/scripts/agent-browser-target.mjs +4 -2
- package/docs/ARCHITECTURE.md +19 -6
- package/docs/CODE_QUALITY.md +267 -0
- package/docs/COMMAND_REFERENCE.md +272 -241
- package/docs/ELECTRON.md +77 -46
- package/docs/REFERENCE.md +869 -0
- package/docs/RELEASE.md +25 -22
- package/docs/REQUIREMENTS.md +2 -1
- package/docs/SUPPORT_MATRIX.md +81 -79
- package/docs/TOOL_CONTRACT.md +158 -125
- package/docs/platform-smoke.md +8 -8
- package/package.json +144 -120
- package/scripts/agent-browser-capability-baseline.mjs +361 -957
- package/scripts/agent-browser-target.mjs +6 -2
- package/scripts/build.mjs +37 -8
- package/scripts/capability-core-commands.mjs +193 -0
- package/scripts/capability-options.mjs +283 -0
- package/scripts/capability-samples.mjs +133 -0
- package/scripts/capability-section.mjs +11 -0
- package/scripts/config.mjs +235 -132
- package/scripts/convert-browser-session.mjs +30 -9
- package/scripts/doctor-sources.mjs +195 -0
- package/scripts/doctor.mjs +94 -249
- package/scripts/platform-smoke/artifacts.mjs +38 -11
- package/scripts/platform-smoke/commands.mjs +104 -0
- package/scripts/platform-smoke/crabbox-runner.mjs +167 -80
- package/scripts/platform-smoke/doctor-support.mjs +157 -0
- package/scripts/platform-smoke/doctor-windows.mjs +230 -0
- package/scripts/platform-smoke/doctor.mjs +212 -320
- package/scripts/platform-smoke/lease-evidence.mjs +132 -0
- package/scripts/platform-smoke/linux-image/Dockerfile +8 -2
- package/scripts/platform-smoke/suite-checks.mjs +98 -0
- package/scripts/platform-smoke/suite-evidence.mjs +281 -0
- package/scripts/platform-smoke/targets.mjs +154 -472
- package/scripts/platform-smoke.mjs +55 -40
- package/scripts/prepare.mjs +16 -7
|
@@ -1,99 +1,162 @@
|
|
|
1
1
|
import { extractUpstreamCommandTokens } from "./argv-descriptor.js";
|
|
2
|
-
import { extractExplicitSessionName, getAgentBrowserSessionIdentityKey, resolveAgentBrowserNamespace, scanUpstreamGlobalFlagOccurrences } from "./argv-grammar.js";
|
|
2
|
+
import { extractExplicitSessionName, getAgentBrowserSessionIdentityKey, resolveAgentBrowserNamespace, scanUpstreamGlobalFlagOccurrences, } from "./argv-grammar.js";
|
|
3
3
|
import { getExplicitReadUrl } from "./command-policy.js";
|
|
4
4
|
import { isCloseCommand } from "./command-taxonomy.js";
|
|
5
|
-
import { getExplicitNavigationTarget } from "./page-target-validation.js";
|
|
6
|
-
import { isRecord } from "./parsing.js";
|
|
7
5
|
import { getUpstreamEffectiveBatchSteps } from "./orchestration/batch-stdin.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return undefined;
|
|
11
|
-
if (typeof value.id !== "string" || !value.id || typeof value.sessionName !== "string" || !value.sessionName || (value.namespace !== undefined && typeof value.namespace !== "string"))
|
|
12
|
-
return undefined;
|
|
13
|
-
if (value.source === "native-guarded-action" && (typeof value.command !== "string" || !value.command || typeof value.action !== "string" || !value.action))
|
|
14
|
-
return undefined;
|
|
15
|
-
return { ...(value.source === "native-explicit-url-read" && isRecord(value.capabilities) && value.capabilities.readRequiresConfirmation === true ? { capabilities: { readRequiresConfirmation: true } } : {}), id: value.id, sessionName: value.sessionName, namespace: value.namespace, source: value.source, state: value.state,
|
|
16
|
-
...(value.source === "native-guarded-action" ? { command: typeof value.command === "string" ? value.command : undefined, action: typeof value.action === "string" ? value.action : undefined } : {}),
|
|
17
|
-
...(value.source === "native-guarded-action" && value.state === "cleared" && value.command === "snapshot" && value.action === "snapshot" && value.refSnapshotFresh === true ? { refSnapshotFresh: true } : {}) };
|
|
18
|
-
}
|
|
6
|
+
import { getConfirmedNativeResult, getNativePendingControl, } from "./native-confirmation.js";
|
|
7
|
+
export { parseReadConfirmation, getNativeTabContinuationGuidance, isSuccessfulNativeConfirmedClose, } from "./native-confirmation.js";
|
|
19
8
|
export function isBrowserIndependentConfirmation(value) {
|
|
20
|
-
return value?.source === "native-explicit-url-read" &&
|
|
9
|
+
return (value?.source === "native-explicit-url-read" &&
|
|
10
|
+
value.capabilities?.readRequiresConfirmation === true);
|
|
21
11
|
}
|
|
22
12
|
export function suppressConfirmationPageHelpers(value) {
|
|
23
|
-
return value?.state === "pending" &&
|
|
24
|
-
|
|
25
|
-
export function isSuccessfulNativeConfirmedClose(commandTokens, data) {
|
|
26
|
-
return commandTokens[0] === "confirm" && commandTokens.length === 2 && isRecord(data) && data.confirmed === true
|
|
27
|
-
&& data.action === "close" && isRecord(data.result) && data.result.success === true
|
|
28
|
-
&& isRecord(data.result.data) && data.result.data.closed === true;
|
|
13
|
+
return (value?.state === "pending" &&
|
|
14
|
+
(value.source === "native-guarded-action" || isBrowserIndependentConfirmation(value)));
|
|
29
15
|
}
|
|
30
|
-
export function findReadConfirmation(args,
|
|
16
|
+
export function findReadConfirmation(args,
|
|
17
|
+
// lib.es2015.iterable.d.ts exposes a mutable iterator cursor; only deeply readonly confirmation values are consumed.
|
|
18
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types
|
|
19
|
+
confirmations, namespace, stdin) {
|
|
31
20
|
const command = extractUpstreamCommandTokens(args);
|
|
32
|
-
const tokens = command[0] === "batch" ? getUpstreamEffectiveBatchSteps(command, stdin)[0] ?? [] : command;
|
|
33
|
-
if (tokens.length !== 2 || !["confirm", "deny"].includes(tokens[0]))
|
|
21
|
+
const tokens = command[0] === "batch" ? (getUpstreamEffectiveBatchSteps(command, stdin)[0] ?? []) : command;
|
|
22
|
+
if (tokens.length !== 2 || !["confirm", "deny"].includes(tokens[0])) {
|
|
34
23
|
return undefined;
|
|
24
|
+
}
|
|
35
25
|
const sessionName = extractExplicitSessionName(args);
|
|
36
26
|
const effectiveNamespace = resolveAgentBrowserNamespace(args, namespace);
|
|
37
|
-
const matches = [...confirmations].filter(value => value.state === "pending" &&
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
const matches = [...confirmations].filter((value) => value.state === "pending" &&
|
|
28
|
+
value.id === tokens[1] &&
|
|
29
|
+
(command[0] !== "batch" || value.source === "native-guarded-action") &&
|
|
30
|
+
(sessionName === undefined ||
|
|
31
|
+
getAgentBrowserSessionIdentityKey(sessionName, value.namespace) ===
|
|
32
|
+
getAgentBrowserSessionIdentityKey(value.sessionName, value.namespace)) &&
|
|
33
|
+
(effectiveNamespace === undefined ||
|
|
34
|
+
getAgentBrowserSessionIdentityKey(value.sessionName, effectiveNamespace) ===
|
|
35
|
+
getAgentBrowserSessionIdentityKey(value.sessionName, value.namespace)));
|
|
41
36
|
return matches.length === 1 ? matches[0] : undefined;
|
|
42
37
|
}
|
|
43
38
|
export function scopeReadConfirmationArgs(args, confirmation) {
|
|
44
39
|
return [
|
|
45
|
-
...(scanUpstreamGlobalFlagOccurrences(args, "--namespace").length === 0
|
|
46
|
-
|
|
40
|
+
...(scanUpstreamGlobalFlagOccurrences(args, "--namespace").length === 0
|
|
41
|
+
? ["--namespace", confirmation.namespace ?? ""]
|
|
42
|
+
: []),
|
|
43
|
+
...(extractExplicitSessionName(args) === undefined
|
|
44
|
+
? ["--session", confirmation.sessionName]
|
|
45
|
+
: []),
|
|
47
46
|
...args,
|
|
48
47
|
];
|
|
49
48
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
function isExplicitReadProvenance(pending, tokens, confirmed) {
|
|
50
|
+
return (pending.action === "read" &&
|
|
51
|
+
(typeof getExplicitReadUrl(tokens) === "string" ||
|
|
52
|
+
confirmed?.source === "native-explicit-url-read"));
|
|
53
|
+
}
|
|
54
|
+
function isOriginalGuardedAction(command) {
|
|
55
|
+
return command !== undefined && command.length > 0 && !["confirm", "deny"].includes(command);
|
|
56
|
+
}
|
|
57
|
+
function pendingConfirmation(pending, tokens, identity) {
|
|
58
|
+
if (isExplicitReadProvenance(pending, tokens, identity.confirmed)) {
|
|
59
|
+
return {
|
|
60
|
+
...(pending.capabilities !== undefined ? { capabilities: pending.capabilities } : {}),
|
|
61
|
+
id: pending.id,
|
|
62
|
+
namespace: identity.namespace,
|
|
63
|
+
sessionName: identity.sessionName,
|
|
64
|
+
source: "native-explicit-url-read",
|
|
65
|
+
state: "pending",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const command = tokens.at(0);
|
|
69
|
+
if (isOriginalGuardedAction(command) || identity.confirmed?.source === "native-guarded-action") {
|
|
70
|
+
return {
|
|
71
|
+
id: pending.id,
|
|
72
|
+
namespace: identity.namespace,
|
|
73
|
+
sessionName: identity.sessionName,
|
|
74
|
+
source: "native-guarded-action",
|
|
75
|
+
command: identity.confirmed !== undefined ? identity.confirmed.command : command,
|
|
76
|
+
action: pending.action,
|
|
77
|
+
state: "pending",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
function settlesPendingConfirmation(tokens, current) {
|
|
83
|
+
return (current?.state === "pending" &&
|
|
84
|
+
tokens.length === 2 &&
|
|
85
|
+
["confirm", "deny"].includes(tokens[0]) &&
|
|
86
|
+
tokens[1] === current.id);
|
|
87
|
+
}
|
|
88
|
+
function confirmedDecisionResult(tokens, current, data) {
|
|
89
|
+
if (tokens[0] !== "confirm" ||
|
|
90
|
+
current === undefined ||
|
|
91
|
+
!settlesPendingConfirmation(tokens, current)) {
|
|
58
92
|
return undefined;
|
|
59
|
-
|
|
60
|
-
return data
|
|
93
|
+
}
|
|
94
|
+
return getConfirmedNativeResult(data, current);
|
|
95
|
+
}
|
|
96
|
+
function clearedConfirmation(current, command, succeeded, settles) {
|
|
97
|
+
return succeeded && current?.state === "pending" && (settles || isCloseCommand(command))
|
|
98
|
+
? { ...current, state: "cleared" }
|
|
99
|
+
: undefined;
|
|
61
100
|
}
|
|
62
101
|
export function nextReadConfirmation(options) {
|
|
63
102
|
const { commandTokens: tokens, current } = options;
|
|
64
|
-
const settles =
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return { id: control.confirmation_id, namespace: options.namespace, sessionName: options.sessionName, source: "native-guarded-action", command: confirmed ? current.command : tokens[0], action: control.action, state: "pending" };
|
|
103
|
+
const settles = settlesPendingConfirmation(tokens, current);
|
|
104
|
+
const confirmedResult = confirmedDecisionResult(tokens, current, options.data);
|
|
105
|
+
const pending = options.succeeded
|
|
106
|
+
? getNativePendingControl(tokens, confirmedResult !== undefined ? confirmedResult.data : options.data)
|
|
107
|
+
: undefined;
|
|
108
|
+
if (pending !== undefined) {
|
|
109
|
+
const next = pendingConfirmation(pending, tokens, {
|
|
110
|
+
namespace: options.namespace,
|
|
111
|
+
sessionName: options.sessionName,
|
|
112
|
+
confirmed: confirmedResult !== undefined ? current : undefined,
|
|
113
|
+
});
|
|
114
|
+
if (next !== undefined) {
|
|
115
|
+
return next;
|
|
78
116
|
}
|
|
79
|
-
if (current?.state === "pending")
|
|
117
|
+
if (current?.state === "pending") {
|
|
80
118
|
return { ...current, state: "cleared" };
|
|
119
|
+
}
|
|
81
120
|
}
|
|
82
|
-
return
|
|
121
|
+
return clearedConfirmation(current, tokens[0], options.succeeded, settles);
|
|
122
|
+
}
|
|
123
|
+
function confirmationSafety(confirmation) {
|
|
124
|
+
if (isBrowserIndependentConfirmation(confirmation)) {
|
|
125
|
+
return "Review the requested read first. The native capability proves ID matching; no DOM confirmation is implied.";
|
|
126
|
+
}
|
|
127
|
+
return confirmation.source === "native-guarded-action"
|
|
128
|
+
? "Review the original guarded action. Exact wrapper observation preserves its session and avoids overwriting helpers; native ID validation is not implied."
|
|
129
|
+
: "Native ID matching/browser independence is unproven. The exact native session is preserved, but this confirmation retains normal page checks.";
|
|
83
130
|
}
|
|
84
131
|
export function buildReadConfirmationNextActions(confirmation, pendingResponse) {
|
|
85
|
-
if (confirmation.state === "cleared")
|
|
132
|
+
if (confirmation.state === "cleared") {
|
|
86
133
|
return [];
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
: "
|
|
134
|
+
}
|
|
135
|
+
const prefix = [
|
|
136
|
+
"--namespace",
|
|
137
|
+
confirmation.namespace ?? "",
|
|
138
|
+
"--session",
|
|
139
|
+
confirmation.sessionName,
|
|
140
|
+
];
|
|
141
|
+
if (!pendingResponse) {
|
|
142
|
+
return [
|
|
143
|
+
{
|
|
144
|
+
id: "inspect-read-confirmation-session",
|
|
145
|
+
tool: "agent_browser",
|
|
146
|
+
params: { args: [...prefix, "session", "info"] },
|
|
147
|
+
reason: "Inspect the exact native session after the confirmation failed; rerun the original command if its ID expired.",
|
|
148
|
+
safety: "Read-only status, without browser launch or tab changes. Do not substitute a different pending confirmation ID.",
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
const subject = confirmation.source === "native-explicit-url-read"
|
|
153
|
+
? "this explicit URL read"
|
|
154
|
+
: `${confirmation.command ?? ""} (${confirmation.action ?? ""})`;
|
|
155
|
+
return ["confirm", "deny"].map((command) => ({
|
|
156
|
+
id: command === "confirm" ? "approve-confirmation" : "deny-confirmation",
|
|
157
|
+
tool: "agent_browser",
|
|
158
|
+
params: { args: [...prefix, command, confirmation.id] },
|
|
159
|
+
reason: `${command === "confirm" ? "Approve" : "Deny"} the native confirmation for ${subject}.`,
|
|
160
|
+
safety: confirmationSafety(confirmation),
|
|
98
161
|
}));
|
|
99
162
|
}
|
|
@@ -7,58 +7,96 @@ function getReservationKey(reservation) {
|
|
|
7
7
|
return getAgentBrowserSessionIdentityKey(reservation.sessionName, reservation.namespace);
|
|
8
8
|
}
|
|
9
9
|
function getArtifactReservation(artifact) {
|
|
10
|
-
if (
|
|
10
|
+
if (artifact.session === undefined ||
|
|
11
|
+
artifact.session.length === 0 ||
|
|
12
|
+
artifact.command !== "record" ||
|
|
13
|
+
artifact.kind !== "video") {
|
|
11
14
|
return undefined;
|
|
15
|
+
}
|
|
12
16
|
return {
|
|
13
17
|
absolutePath: artifact.absolutePath,
|
|
14
18
|
cwd: artifact.cwd ?? process.cwd(),
|
|
15
19
|
namespace: artifact.namespace,
|
|
16
20
|
path: artifact.path,
|
|
17
|
-
...(artifact.recording?.recordingId
|
|
18
|
-
|
|
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
|
+
: {}),
|
|
19
28
|
sessionName: artifact.session,
|
|
20
29
|
};
|
|
21
30
|
}
|
|
22
|
-
|
|
31
|
+
function artifactReservations(artifacts) {
|
|
23
32
|
const pendingBySession = new Map();
|
|
24
33
|
const terminalBySession = new Map();
|
|
25
34
|
for (const artifact of artifacts) {
|
|
26
|
-
|
|
27
|
-
if (!reservation)
|
|
35
|
+
let reservation = getArtifactReservation(artifact);
|
|
36
|
+
if (!reservation) {
|
|
28
37
|
continue;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
}
|
|
32
47
|
const key = getReservationKey(reservation);
|
|
33
|
-
if (isPendingRecordingArtifact(artifact))
|
|
48
|
+
if (isPendingRecordingArtifact(artifact)) {
|
|
34
49
|
pendingBySession.set(key, reservation);
|
|
35
|
-
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
36
52
|
terminalBySession.set(key, reservation);
|
|
53
|
+
}
|
|
37
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);
|
|
38
70
|
const transitions = [];
|
|
39
71
|
for (const key of terminalBySession.keys()) {
|
|
40
|
-
if (pendingBySession.has(key))
|
|
72
|
+
if (pendingBySession.has(key)) {
|
|
41
73
|
continue;
|
|
74
|
+
}
|
|
42
75
|
const existing = reservations.get(key);
|
|
43
|
-
if (!existing)
|
|
76
|
+
if (!existing) {
|
|
44
77
|
continue;
|
|
78
|
+
}
|
|
45
79
|
reservations.delete(key);
|
|
46
80
|
transitions.push({ reservation: existing, state: "closed" });
|
|
47
81
|
}
|
|
48
82
|
for (const [key, pending] of pendingBySession) {
|
|
49
83
|
const existing = reservations.get(key);
|
|
50
84
|
reservations.set(key, pending);
|
|
51
|
-
if (
|
|
85
|
+
if (reservationChanged(existing, pending)) {
|
|
52
86
|
transitions.push({ reservation: pending, state: "active" });
|
|
53
87
|
}
|
|
54
88
|
}
|
|
55
89
|
return transitions;
|
|
56
90
|
}
|
|
57
|
-
export function retireRecordingReservation(
|
|
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) {
|
|
58
95
|
const key = getAgentBrowserSessionIdentityKey(sessionName, namespace);
|
|
59
96
|
const reservation = reservations.get(key);
|
|
60
|
-
if (reservation)
|
|
97
|
+
if (reservation) {
|
|
61
98
|
reservations.delete(key);
|
|
99
|
+
}
|
|
62
100
|
return reservation;
|
|
63
101
|
}
|
|
64
102
|
export function appendRecordingReservationTransition(pi, transition) {
|
|
@@ -76,51 +114,86 @@ export function appendRecordingReservationTransition(pi, transition) {
|
|
|
76
114
|
version: 1,
|
|
77
115
|
});
|
|
78
116
|
}
|
|
79
|
-
function
|
|
80
|
-
if (
|
|
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") {
|
|
81
138
|
return undefined;
|
|
82
|
-
|
|
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")) {
|
|
83
161
|
return undefined;
|
|
84
|
-
|
|
162
|
+
}
|
|
163
|
+
if (!hasReservationIdentity(data)) {
|
|
85
164
|
return undefined;
|
|
165
|
+
}
|
|
86
166
|
if (data.state === "closed") {
|
|
87
167
|
return {
|
|
88
|
-
reservation: {
|
|
168
|
+
reservation: {
|
|
169
|
+
absolutePath: "",
|
|
170
|
+
cwd: "",
|
|
171
|
+
namespace: data.namespace,
|
|
172
|
+
path: "",
|
|
173
|
+
sessionName: data.sessionName,
|
|
174
|
+
},
|
|
89
175
|
state: "closed",
|
|
90
176
|
};
|
|
91
177
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return undefined;
|
|
98
|
-
if (typeof data.absolutePath !== "string" || !isAbsolute(data.absolutePath)
|
|
99
|
-
|| typeof data.cwd !== "string" || !isAbsolute(data.cwd) || typeof data.path !== "string")
|
|
100
|
-
return undefined;
|
|
101
|
-
return {
|
|
102
|
-
reservation: {
|
|
103
|
-
absolutePath: data.absolutePath,
|
|
104
|
-
...(typeof data.contactSheetPath === "string" ? { contactSheetPath: data.contactSheetPath } : {}),
|
|
105
|
-
cwd: data.cwd,
|
|
106
|
-
namespace: data.namespace,
|
|
107
|
-
path: data.path,
|
|
108
|
-
...(typeof data.recordingId === "string" ? { recordingId: data.recordingId } : {}),
|
|
109
|
-
...(typeof data.startedAtMs === "number" ? { startedAtMs: data.startedAtMs } : {}),
|
|
110
|
-
sessionName: data.sessionName,
|
|
111
|
-
},
|
|
112
|
-
state: "active",
|
|
113
|
-
};
|
|
178
|
+
const reservation = parseActiveReservation(data, {
|
|
179
|
+
sessionName: data.sessionName,
|
|
180
|
+
namespace: data.namespace,
|
|
181
|
+
});
|
|
182
|
+
return reservation ? { reservation, state: "active" } : undefined;
|
|
114
183
|
}
|
|
115
184
|
export function restoreRecordingReservationStateFromBranch(branch) {
|
|
116
185
|
const reservations = new Map();
|
|
117
186
|
const terminal = new Map();
|
|
118
187
|
for (const entry of branch) {
|
|
119
|
-
if (!isRecord(entry) ||
|
|
188
|
+
if (!isRecord(entry) ||
|
|
189
|
+
entry.type !== "custom" ||
|
|
190
|
+
entry.customType !== RECORDING_RESERVATION_ENTRY_TYPE) {
|
|
120
191
|
continue;
|
|
192
|
+
}
|
|
121
193
|
const transition = parseReservationTransition(entry.data);
|
|
122
|
-
if (!transition)
|
|
194
|
+
if (!transition) {
|
|
123
195
|
continue;
|
|
196
|
+
}
|
|
124
197
|
const key = getReservationKey(transition.reservation);
|
|
125
198
|
if (transition.state === "active") {
|
|
126
199
|
reservations.set(key, transition.reservation);
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
}
|