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,51 +0,0 @@
|
|
|
1
|
-
import { writePersistentSessionArtifactFile, writeSecureTempFile, } from "../../temp.js";
|
|
2
|
-
import { buildEvictedSessionArtifactEntries } from "../artifact-manifest.js";
|
|
3
|
-
import { redactModelFacingText, stringifyModelFacing } from "./common.js";
|
|
4
|
-
function serializePayload(data, text) {
|
|
5
|
-
if (typeof data === "string") {
|
|
6
|
-
return redactModelFacingText(data);
|
|
7
|
-
}
|
|
8
|
-
if (typeof data === "number" || typeof data === "boolean") {
|
|
9
|
-
return String(data);
|
|
10
|
-
}
|
|
11
|
-
return data === undefined ? redactModelFacingText(text) : stringifyModelFacing(data);
|
|
12
|
-
}
|
|
13
|
-
export async function writeLargeOutputSpillFile(options) {
|
|
14
|
-
const isStructured = typeof options.data !== "string" &&
|
|
15
|
-
typeof options.data !== "number" &&
|
|
16
|
-
typeof options.data !== "boolean";
|
|
17
|
-
const fileOptions = {
|
|
18
|
-
content: serializePayload(options.data, options.text),
|
|
19
|
-
prefix: "pi-agent-browser-output",
|
|
20
|
-
suffix: isStructured ? ".json" : ".txt",
|
|
21
|
-
};
|
|
22
|
-
if (options.persistentArtifactStore) {
|
|
23
|
-
return {
|
|
24
|
-
...(await writePersistentSessionArtifactFile({
|
|
25
|
-
...fileOptions,
|
|
26
|
-
store: options.persistentArtifactStore,
|
|
27
|
-
})),
|
|
28
|
-
storageScope: "persistent-session",
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
evictedArtifacts: [],
|
|
33
|
-
path: await writeSecureTempFile(fileOptions),
|
|
34
|
-
storageScope: "process-temp",
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export function buildSpillArtifactEntries(options) {
|
|
38
|
-
const nowMs = Date.now();
|
|
39
|
-
return [
|
|
40
|
-
{
|
|
41
|
-
command: options.commandInfo.command,
|
|
42
|
-
createdAtMs: nowMs,
|
|
43
|
-
kind: "spill",
|
|
44
|
-
path: options.path,
|
|
45
|
-
retentionState: options.storageScope === "persistent-session" ? "live" : "ephemeral",
|
|
46
|
-
storageScope: options.storageScope,
|
|
47
|
-
subcommand: options.commandInfo.subcommand,
|
|
48
|
-
},
|
|
49
|
-
...buildEvictedSessionArtifactEntries(options.evictedArtifacts, nowMs),
|
|
50
|
-
];
|
|
51
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../../parsing.js";
|
|
2
|
-
import { getNativeTabContinuationGuidance } from "../../read-confirmation.js";
|
|
3
|
-
import { detectConfirmationRequired, } from "../confirmation.js";
|
|
4
|
-
import { getPageSummary, omitUpstreamLifecycle, redactModelFacingText, stringifyModelFacing, } from "./common.js";
|
|
5
|
-
import { formatDiagnosticSummary, formatDiagnosticText } from "./diagnostics.js";
|
|
6
|
-
import { formatExtractionSummary, formatExtractionText, formatNavigationActionResult, formatNavigationSummary, getNavigationSummary, isNavigationObservableCommand, } from "./navigation.js";
|
|
7
|
-
import { formatSemanticActionPresentationSummary, formatSemanticActionPresentationText, resolvePresentationCommandInfo, } from "./semantic-action.js";
|
|
8
|
-
import { COMMAND_PRESENTERS } from "./command-presenters.js";
|
|
9
|
-
function formatConfirmationRequiredText(confirmation) {
|
|
10
|
-
const lines = ["Confirmation required.", `Pending confirmation id: ${confirmation.id}`];
|
|
11
|
-
if (confirmation.actionText !== undefined && confirmation.actionText.length > 0) {
|
|
12
|
-
lines.push(`Action: ${confirmation.actionText}`);
|
|
13
|
-
}
|
|
14
|
-
lines.push("", "Next steps:", `- Approve: { "args": ["confirm", "${confirmation.id}"] }`, `- Deny: { "args": ["deny", "${confirmation.id}"] }`);
|
|
15
|
-
return lines.join("\n");
|
|
16
|
-
}
|
|
17
|
-
function formatBatchSummary(data) {
|
|
18
|
-
if (!Array.isArray(data)) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
const count = data.filter((item) => isRecord(item) && item.success !== false).length;
|
|
22
|
-
return count === data.length
|
|
23
|
-
? `Batch: ${count}/${data.length} succeeded`
|
|
24
|
-
: `Batch failed: ${count}/${data.length} succeeded`;
|
|
25
|
-
}
|
|
26
|
-
function firstNonemptyResult(formatters) {
|
|
27
|
-
for (const format of formatters) {
|
|
28
|
-
const result = format();
|
|
29
|
-
if (result !== undefined && result.length > 0) {
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
function formatObservedNavigation(mode, command, data) {
|
|
36
|
-
const navigation = getNavigationSummary(data);
|
|
37
|
-
if (!navigation || !isNavigationObservableCommand(command.command, command.subcommand)) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
const text = formatNavigationSummary(navigation);
|
|
41
|
-
if (text === undefined || text.length === 0) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
if (mode === "summary") {
|
|
45
|
-
return `${command.command ?? "navigation"} → ${text.split("\n", 1).at(0) ?? text}`;
|
|
46
|
-
}
|
|
47
|
-
const action = formatNavigationActionResult(data);
|
|
48
|
-
return action !== undefined && action.length > 0
|
|
49
|
-
? `${action}\n\nCurrent page:\n${text}`
|
|
50
|
-
: `Current page:\n${text}`;
|
|
51
|
-
}
|
|
52
|
-
function formatPageAction(mode, command, data, compiled) {
|
|
53
|
-
if (compiled) {
|
|
54
|
-
const format = mode === "summary"
|
|
55
|
-
? formatSemanticActionPresentationSummary
|
|
56
|
-
: formatSemanticActionPresentationText;
|
|
57
|
-
const text = format(compiled, data);
|
|
58
|
-
if (text !== undefined && text.length > 0) {
|
|
59
|
-
return text;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return formatObservedNavigation(mode, resolvePresentationCommandInfo(command, compiled), data);
|
|
63
|
-
}
|
|
64
|
-
function formatPageContentFallback(mode, data) {
|
|
65
|
-
const page = getPageSummary(data);
|
|
66
|
-
if (page !== undefined && page.length > 0) {
|
|
67
|
-
return mode === "summary"
|
|
68
|
-
? (page.split("\n", 1).at(0) ?? "agent-browser result")
|
|
69
|
-
: redactModelFacingText(page);
|
|
70
|
-
}
|
|
71
|
-
if (mode === "text") {
|
|
72
|
-
const { navigationSummary: _navigationSummary, ...content } = omitUpstreamLifecycle(data);
|
|
73
|
-
if (Object.keys(content).length > 0) {
|
|
74
|
-
return stringifyModelFacing(content);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
function formatPageFallback(mode, command, data) {
|
|
80
|
-
const diagnostic = mode === "summary" ? formatDiagnosticSummary : formatDiagnosticText;
|
|
81
|
-
const extraction = mode === "summary" ? formatExtractionSummary : formatExtractionText;
|
|
82
|
-
const formatters = mode === "summary" ? [diagnostic, extraction] : [extraction, diagnostic];
|
|
83
|
-
return (firstNonemptyResult(formatters.map((format) => () => format(command, data))) ??
|
|
84
|
-
formatPageContentFallback(mode, data));
|
|
85
|
-
}
|
|
86
|
-
function formatNativeCommand(mode, command, data) {
|
|
87
|
-
const presenter = command.command !== undefined ? COMMAND_PRESENTERS[command.command] : undefined;
|
|
88
|
-
const format = mode === "summary" ? presenter?.summary : presenter?.text;
|
|
89
|
-
return format?.(command, data);
|
|
90
|
-
}
|
|
91
|
-
export function formatPresentationSummary(command, data, compiled) {
|
|
92
|
-
const confirmation = detectConfirmationRequired(data);
|
|
93
|
-
if (confirmation) {
|
|
94
|
-
return `Confirmation required: ${confirmation.id}`;
|
|
95
|
-
}
|
|
96
|
-
const text = firstNonemptyResult([
|
|
97
|
-
() => (command.command === "batch" ? formatBatchSummary(data) : undefined),
|
|
98
|
-
() => (isRecord(data) ? formatPageAction("summary", command, data, compiled) : undefined),
|
|
99
|
-
() => formatNativeCommand("summary", command, data),
|
|
100
|
-
]);
|
|
101
|
-
if (text !== undefined) {
|
|
102
|
-
return text;
|
|
103
|
-
}
|
|
104
|
-
if (isRecord(data)) {
|
|
105
|
-
const fallback = formatPageFallback("summary", command, data);
|
|
106
|
-
if (fallback !== undefined) {
|
|
107
|
-
return fallback;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (typeof data === "string" && data.length > 0) {
|
|
111
|
-
return data.split("\n", 1).at(0) ?? data;
|
|
112
|
-
}
|
|
113
|
-
return `${resolvePresentationCommandInfo(command, compiled).command ?? command.command ?? "agent-browser"} completed`;
|
|
114
|
-
}
|
|
115
|
-
function formatPageResultText(command, data, compiled) {
|
|
116
|
-
const action = formatPageAction("text", command, data, compiled);
|
|
117
|
-
const text = action !== undefined && action.length > 0 ? action : formatPageFallback("text", command, data);
|
|
118
|
-
return (text ??
|
|
119
|
-
`${resolvePresentationCommandInfo(command, compiled).command ?? command.command ?? "agent-browser"} completed`);
|
|
120
|
-
}
|
|
121
|
-
function formatContentValue(data) {
|
|
122
|
-
if (typeof data === "string") {
|
|
123
|
-
return redactModelFacingText(data);
|
|
124
|
-
}
|
|
125
|
-
if (typeof data === "number" || typeof data === "boolean") {
|
|
126
|
-
return String(data);
|
|
127
|
-
}
|
|
128
|
-
return stringifyModelFacing(data);
|
|
129
|
-
}
|
|
130
|
-
export function formatPresentationContentText(command, data, compiled) {
|
|
131
|
-
const confirmation = detectConfirmationRequired(data);
|
|
132
|
-
if (confirmation) {
|
|
133
|
-
return [
|
|
134
|
-
formatConfirmationRequiredText(confirmation),
|
|
135
|
-
getNativeTabContinuationGuidance(command.commandTokens ?? [], data),
|
|
136
|
-
]
|
|
137
|
-
.filter(Boolean)
|
|
138
|
-
.join("\n\n");
|
|
139
|
-
}
|
|
140
|
-
const native = formatNativeCommand("text", command, data);
|
|
141
|
-
if (native !== undefined && native.length > 0) {
|
|
142
|
-
return native;
|
|
143
|
-
}
|
|
144
|
-
return isRecord(data) ? formatPageResultText(command, data, compiled) : formatContentValue(data);
|
|
145
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { getCompiledSemanticActionCommandIndex, isCompiledSemanticActionFindCommand, } from "../../input-modes/semantic-action.js";
|
|
2
|
-
import { isRecord } from "../../parsing.js";
|
|
3
|
-
import { formatNavigationSummary, getNavigationSummary, isNavigationObservableCommand, } from "./navigation.js";
|
|
4
|
-
import { getPageSummary, redactModelFacingText } from "./common.js";
|
|
5
|
-
const SEMANTIC_NAVIGATION_PROBE_ACTIONS = new Set(["check", "click"]);
|
|
6
|
-
const SEMANTIC_PRESENTATION_ACTIONS = new Set(["check", "click", "fill", "select"]);
|
|
7
|
-
function formatSemanticSelectTarget(compiled) {
|
|
8
|
-
const selector = compiled.selector ?? "selector";
|
|
9
|
-
const values = compiled.values !== undefined && compiled.values.length > 0 ? compiled.values.join(", ") : "";
|
|
10
|
-
return values.length > 0 ? `${selector} → ${values}` : selector;
|
|
11
|
-
}
|
|
12
|
-
function formatSemanticActionTarget(compiled) {
|
|
13
|
-
if (compiled.action === "select") {
|
|
14
|
-
return formatSemanticSelectTarget(compiled);
|
|
15
|
-
}
|
|
16
|
-
const commandIndex = getCompiledSemanticActionCommandIndex(compiled);
|
|
17
|
-
const locator = compiled.locator ?? compiled.args.at(commandIndex + 1) ?? "locator";
|
|
18
|
-
const locatorValue = compiled.args.at(commandIndex + 2);
|
|
19
|
-
const nameIndex = compiled.args.indexOf("--name");
|
|
20
|
-
const name = nameIndex >= 0 ? compiled.args.at(nameIndex + 1) : undefined;
|
|
21
|
-
const quotedValue = JSON.stringify(locatorValue ?? "");
|
|
22
|
-
const target = `${locator} ${quotedValue}`;
|
|
23
|
-
return name !== undefined && name.length > 0
|
|
24
|
-
? `${target} (name ${JSON.stringify(name)})`
|
|
25
|
-
: target;
|
|
26
|
-
}
|
|
27
|
-
function formatSemanticActionCompactLine(compiled) {
|
|
28
|
-
const target = formatSemanticActionTarget(compiled);
|
|
29
|
-
switch (compiled.action) {
|
|
30
|
-
case "click":
|
|
31
|
-
return `Clicked: ${target}`;
|
|
32
|
-
case "fill":
|
|
33
|
-
return `Filled: ${target}`;
|
|
34
|
-
case "check":
|
|
35
|
-
return `Checked: ${target}`;
|
|
36
|
-
case "select":
|
|
37
|
-
return `Selected: ${target}`;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function resolveSemanticPresentationCommand(compiled) {
|
|
41
|
-
if (!compiled || !SEMANTIC_PRESENTATION_ACTIONS.has(compiled.action)) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
if (compiled.action === "select") {
|
|
45
|
-
return "select";
|
|
46
|
-
}
|
|
47
|
-
if (isCompiledSemanticActionFindCommand(compiled)) {
|
|
48
|
-
return compiled.action;
|
|
49
|
-
}
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
export function resolvePresentationCommandInfo(commandInfo, compiledSemanticAction) {
|
|
53
|
-
const presentationCommand = resolveSemanticPresentationCommand(compiledSemanticAction);
|
|
54
|
-
if (presentationCommand === undefined) {
|
|
55
|
-
return commandInfo;
|
|
56
|
-
}
|
|
57
|
-
return { ...commandInfo, command: presentationCommand };
|
|
58
|
-
}
|
|
59
|
-
export function shouldCaptureSemanticActionNavigationSummary(compiled, data) {
|
|
60
|
-
if (!compiled || !SEMANTIC_NAVIGATION_PROBE_ACTIONS.has(compiled.action)) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
if (!isCompiledSemanticActionFindCommand(compiled)) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
return !isRecord(data) || (typeof data.title !== "string" && typeof data.url !== "string");
|
|
67
|
-
}
|
|
68
|
-
export function formatSemanticActionPresentationText(compiled, data) {
|
|
69
|
-
const presentationCommand = resolveSemanticPresentationCommand(compiled);
|
|
70
|
-
if (presentationCommand === undefined) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
const actionLine = formatSemanticActionCompactLine(compiled);
|
|
74
|
-
const navigationSummary = getNavigationSummary(data);
|
|
75
|
-
if (navigationSummary && isNavigationObservableCommand(presentationCommand)) {
|
|
76
|
-
const navigationText = formatNavigationSummary(navigationSummary);
|
|
77
|
-
if (navigationText !== undefined && navigationText.length > 0) {
|
|
78
|
-
return `${actionLine}\n\nCurrent page:\n${navigationText}`;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const pageSummary = getPageSummary(data);
|
|
82
|
-
if (pageSummary !== undefined && pageSummary.length > 0) {
|
|
83
|
-
return `${actionLine}\n\nCurrent page:\n${redactModelFacingText(pageSummary)}`;
|
|
84
|
-
}
|
|
85
|
-
return actionLine;
|
|
86
|
-
}
|
|
87
|
-
export function formatSemanticActionPresentationSummary(compiled, data) {
|
|
88
|
-
const presentationCommand = resolveSemanticPresentationCommand(compiled);
|
|
89
|
-
if (presentationCommand === undefined) {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
const navigationSummary = getNavigationSummary(data);
|
|
93
|
-
if (navigationSummary && isNavigationObservableCommand(presentationCommand)) {
|
|
94
|
-
const navigationText = formatNavigationSummary(navigationSummary);
|
|
95
|
-
if (navigationText !== undefined && navigationText.length > 0) {
|
|
96
|
-
return `${presentationCommand} → ${navigationText.split("\n", 1)[0] ?? navigationText}`;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const pageSummary = getPageSummary(data);
|
|
100
|
-
if (pageSummary !== undefined && pageSummary.length > 0) {
|
|
101
|
-
return `${presentationCommand} → ${pageSummary.split("\n", 1)[0] ?? pageSummary}`;
|
|
102
|
-
}
|
|
103
|
-
return `${presentationCommand} → ${formatSemanticActionTarget(compiled)}`;
|
|
104
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "../../parsing.js";
|
|
2
|
-
import { getStringField, redactModelFacingText, stringifyModelFacing } from "./common.js";
|
|
3
|
-
function formatSkillsListText(skills) {
|
|
4
|
-
if (skills.length === 0) {
|
|
5
|
-
return "No agent-browser skills found.";
|
|
6
|
-
}
|
|
7
|
-
return skills
|
|
8
|
-
.map((item, index) => {
|
|
9
|
-
if (!isRecord(item)) {
|
|
10
|
-
return `${index + 1}. ${stringifyModelFacing(item)}`;
|
|
11
|
-
}
|
|
12
|
-
const name = redactModelFacingText(getStringField(item, "name") ?? `(skill ${index + 1})`);
|
|
13
|
-
const description = getStringField(item, "description");
|
|
14
|
-
return description !== undefined
|
|
15
|
-
? `${index + 1}. ${name} — ${redactModelFacingText(description)}`
|
|
16
|
-
: `${index + 1}. ${name}`;
|
|
17
|
-
})
|
|
18
|
-
.join("\n");
|
|
19
|
-
}
|
|
20
|
-
function getSkillContent(data) {
|
|
21
|
-
if (typeof data === "string") {
|
|
22
|
-
return data;
|
|
23
|
-
}
|
|
24
|
-
if (isRecord(data) && typeof data.content === "string") {
|
|
25
|
-
return data.content;
|
|
26
|
-
}
|
|
27
|
-
if (!Array.isArray(data)) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
const content = data.flatMap((item) => isRecord(item) && typeof item.content === "string" ? [item.content] : []);
|
|
31
|
-
return content.length > 0 ? content.join("\n\n") : undefined;
|
|
32
|
-
}
|
|
33
|
-
class SkillShellWords {
|
|
34
|
-
words = [];
|
|
35
|
-
current = "";
|
|
36
|
-
quote;
|
|
37
|
-
index = 0;
|
|
38
|
-
input;
|
|
39
|
-
constructor(input) {
|
|
40
|
-
this.input = input;
|
|
41
|
-
}
|
|
42
|
-
flush() {
|
|
43
|
-
if (this.current.length > 0) {
|
|
44
|
-
this.words.push(this.current);
|
|
45
|
-
this.current = "";
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
appendEscape() {
|
|
49
|
-
if (this.index + 1 < this.input.length) {
|
|
50
|
-
this.index += 1;
|
|
51
|
-
this.current += this.input[this.index];
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
this.current += "\\";
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
consumeQuoted(char) {
|
|
58
|
-
const closing = this.quote === "single" ? "'" : '"';
|
|
59
|
-
if (char === closing) {
|
|
60
|
-
this.quote = undefined;
|
|
61
|
-
}
|
|
62
|
-
else if (this.quote === "double" && char === "\\") {
|
|
63
|
-
this.appendEscape();
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
this.current += char;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
consumeUnquoted(char) {
|
|
70
|
-
if (char === "'" || char === '"') {
|
|
71
|
-
this.quote = char === "'" ? "single" : "double";
|
|
72
|
-
}
|
|
73
|
-
else if (char === "\\") {
|
|
74
|
-
this.appendEscape();
|
|
75
|
-
}
|
|
76
|
-
else if (char === "#" && this.current.length === 0) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
else if (/\s/.test(char)) {
|
|
80
|
-
this.flush();
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
this.current += char;
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
parse() {
|
|
88
|
-
for (; this.index < this.input.length; this.index += 1) {
|
|
89
|
-
const char = this.input[this.index];
|
|
90
|
-
if (this.quote !== undefined) {
|
|
91
|
-
this.consumeQuoted(char);
|
|
92
|
-
}
|
|
93
|
-
else if (!this.consumeUnquoted(char)) {
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (this.quote !== undefined) {
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
this.flush();
|
|
101
|
-
return this.words;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function formatNativeAgentBrowserCall(args, stdin) {
|
|
105
|
-
return stdin === undefined
|
|
106
|
-
? `agent_browser { "args": ${JSON.stringify(args)} }`
|
|
107
|
-
: `agent_browser { "args": ${JSON.stringify(args)}, "stdin": ${JSON.stringify(stdin)} }`;
|
|
108
|
-
}
|
|
109
|
-
function readSkillHeredoc(lines, startIndex, delimiter, stripsLeadingTabs) {
|
|
110
|
-
const stdinLines = [];
|
|
111
|
-
for (let cursor = startIndex; cursor < lines.length; cursor += 1) {
|
|
112
|
-
const candidate = stripsLeadingTabs ? lines[cursor].replace(/^\t+/, "") : lines[cursor];
|
|
113
|
-
if (candidate === delimiter) {
|
|
114
|
-
return { stdin: stdinLines.join("\n"), endIndex: cursor };
|
|
115
|
-
}
|
|
116
|
-
stdinLines.push(candidate);
|
|
117
|
-
}
|
|
118
|
-
return undefined;
|
|
119
|
-
}
|
|
120
|
-
function formatNativeSkillContent(content) {
|
|
121
|
-
const lines = content
|
|
122
|
-
.replace(/^allowed-tools:.*agent-browser.*\n?/gim, "")
|
|
123
|
-
.replace(/^```bash\s*$/gim, "```text")
|
|
124
|
-
.split("\n");
|
|
125
|
-
const output = [];
|
|
126
|
-
for (let index = 0; index < lines.length; index += 1) {
|
|
127
|
-
const line = lines[index];
|
|
128
|
-
const commandMatch = /^(\s*)agent-browser\s+(.+?)\s*$/.exec(line);
|
|
129
|
-
if (!commandMatch) {
|
|
130
|
-
output.push(line);
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
const indent = commandMatch[1];
|
|
134
|
-
const rawArgsText = commandMatch[2];
|
|
135
|
-
const heredocMatch = /^(.*?)\s+(<<-?)['"]?([A-Za-z_][A-Za-z0-9_]*)['"]?\s*$/.exec(rawArgsText);
|
|
136
|
-
const argsText = heredocMatch?.[1] ?? rawArgsText;
|
|
137
|
-
const args = new SkillShellWords(argsText).parse();
|
|
138
|
-
if (!args || args.length === 0) {
|
|
139
|
-
output.push(line);
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
if (!heredocMatch) {
|
|
143
|
-
output.push(`${indent}${formatNativeAgentBrowserCall(args)}`);
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
const heredoc = readSkillHeredoc(lines, index + 1, heredocMatch[3], heredocMatch[2] === "<<-");
|
|
147
|
-
if (!heredoc) {
|
|
148
|
-
output.push(line);
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
output.push(`${indent}${formatNativeAgentBrowserCall(args, heredoc.stdin)}`);
|
|
152
|
-
index = heredoc.endIndex;
|
|
153
|
-
}
|
|
154
|
-
return output.join("\n");
|
|
155
|
-
}
|
|
156
|
-
export function formatSkillsText(commandInfo, data) {
|
|
157
|
-
if (commandInfo.command !== "skills") {
|
|
158
|
-
return undefined;
|
|
159
|
-
}
|
|
160
|
-
if (commandInfo.subcommand === "path") {
|
|
161
|
-
return typeof data === "string" ? redactModelFacingText(data) : undefined;
|
|
162
|
-
}
|
|
163
|
-
if (commandInfo.subcommand === "list" && Array.isArray(data)) {
|
|
164
|
-
return formatSkillsListText(data);
|
|
165
|
-
}
|
|
166
|
-
const content = getSkillContent(data);
|
|
167
|
-
if (content !== undefined && content.length > 0) {
|
|
168
|
-
const note = [
|
|
169
|
-
"Pi native-tool note: upstream skill text was adapted for this native tool.",
|
|
170
|
-
"Use args for CLI tokens and stdin only for batch, eval --stdin, or auth save --password-stdin; do not pipe heredocs through bash unless the user explicitly asks for a bash workflow.",
|
|
171
|
-
].join("\n");
|
|
172
|
-
return `${note}\n\n${redactModelFacingText(formatNativeSkillContent(content))}`;
|
|
173
|
-
}
|
|
174
|
-
if (typeof data === "string") {
|
|
175
|
-
return redactModelFacingText(formatNativeSkillContent(data));
|
|
176
|
-
}
|
|
177
|
-
return undefined;
|
|
178
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { extractUpstreamCommandTokens, parseCommandInfo, } from "../../argv-descriptor.js";
|
|
2
|
-
import { isRecord } from "../../parsing.js";
|
|
3
|
-
import { nextReadConfirmation } from "../../read-confirmation.js";
|
|
4
|
-
import { redactInvocationArgs } from "../../runtime-redaction.js";
|
|
5
|
-
import { detectConfirmationRequired } from "../confirmation.js";
|
|
6
|
-
import { buildSnapshotPresentation } from "../snapshot.js";
|
|
7
|
-
import { formatArtifactMetadataLines, formatArtifactSummary } from "./artifacts.js";
|
|
8
|
-
import { buildBatchPresentation, isAgentBrowserBatchResultArray, redactBatchStepErrorData, } from "./batch.js";
|
|
9
|
-
import { isStringArray } from "./content.js";
|
|
10
|
-
import { enrichStreamStatusData, redactPresentationData } from "./diagnostics.js";
|
|
11
|
-
import { formatPresentationContentText, formatPresentationSummary } from "./registry.js";
|
|
12
|
-
import { resolvePresentationCommandInfo } from "./semantic-action.js";
|
|
13
|
-
export function resolvePresentationCommands(options) {
|
|
14
|
-
const commandInfo = options.commandInfo.commandTokens || !options.args
|
|
15
|
-
? options.commandInfo
|
|
16
|
-
: { ...options.commandInfo, commandTokens: extractUpstreamCommandTokens(options.args) };
|
|
17
|
-
return {
|
|
18
|
-
commandInfo,
|
|
19
|
-
presentationCommandInfo: resolvePresentationCommandInfo(commandInfo, options.compiledSemanticAction),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function redactBatchSpillData(data) {
|
|
23
|
-
return data.map((row) => {
|
|
24
|
-
const command = isStringArray(row.command) ? row.command : undefined;
|
|
25
|
-
return {
|
|
26
|
-
...row,
|
|
27
|
-
command: command ? redactInvocationArgs(command) : row.command,
|
|
28
|
-
error: row.error === undefined ? undefined : redactBatchStepErrorData(command, row.error),
|
|
29
|
-
result: row.result === undefined
|
|
30
|
-
? undefined
|
|
31
|
-
: redactPresentationData(parseCommandInfo(command ?? []), row.result),
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export function buildPresentationSource(options, commands) {
|
|
36
|
-
const { commandInfo } = commands;
|
|
37
|
-
const data = enrichPresentationSource(options, commandInfo);
|
|
38
|
-
return {
|
|
39
|
-
...commands,
|
|
40
|
-
data,
|
|
41
|
-
presentationData: commandInfo.command === "batch" && isAgentBrowserBatchResultArray(data)
|
|
42
|
-
? redactBatchSpillData(data)
|
|
43
|
-
: redactPresentationData(commandInfo, data),
|
|
44
|
-
recordingCommand: commandInfo.command === "record",
|
|
45
|
-
recordingBatch: isRecordingBatch(commandInfo, data),
|
|
46
|
-
confirmationRequired: detectConfirmationRequired(data),
|
|
47
|
-
readConfirmation: nextReadConfirmation({
|
|
48
|
-
commandTokens: commandInfo.commandTokens ?? [],
|
|
49
|
-
data,
|
|
50
|
-
namespace: options.namespace,
|
|
51
|
-
sessionName: options.sessionName ?? "default",
|
|
52
|
-
succeeded: options.envelope?.success !== false,
|
|
53
|
-
}),
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function enrichPresentationSource(options, commandInfo) {
|
|
57
|
-
const data = enrichStreamStatusData(commandInfo, options.envelope?.data);
|
|
58
|
-
return commandInfo.command === "session" && commandInfo.subcommand === "info" && isRecord(data)
|
|
59
|
-
? { ...data, piCleanupOwnership: options.piCleanupOwnership ?? "unknown" }
|
|
60
|
-
: data;
|
|
61
|
-
}
|
|
62
|
-
function isRecordingBatch(command, data) {
|
|
63
|
-
return (command.command === "batch" &&
|
|
64
|
-
isAgentBrowserBatchResultArray(data) &&
|
|
65
|
-
data.some((row) => row.command?.[0] === "record"));
|
|
66
|
-
}
|
|
67
|
-
function buildNativeContent(options, source, artifacts) {
|
|
68
|
-
if (options.modelVisible === false) {
|
|
69
|
-
return [];
|
|
70
|
-
}
|
|
71
|
-
const text = artifacts.length > 0
|
|
72
|
-
? formatArtifactMetadataLines(artifacts).join("\n")
|
|
73
|
-
: formatPresentationContentText(source.commandInfo, source.data, options.compiledSemanticAction);
|
|
74
|
-
return [{ type: "text", text }];
|
|
75
|
-
}
|
|
76
|
-
export async function buildSourcePresentation(options, source, artifacts, buildNestedToolPresentation) {
|
|
77
|
-
const summary = formatArtifactSummary(artifacts) ??
|
|
78
|
-
formatPresentationSummary(source.commandInfo, source.data, options.compiledSemanticAction);
|
|
79
|
-
if (source.commandInfo.command === "batch" && isAgentBrowserBatchResultArray(source.data)) {
|
|
80
|
-
return buildBatchPresentation({
|
|
81
|
-
artifactManifest: options.artifactManifest,
|
|
82
|
-
artifactMaxUpdatedAtMs: options.artifactMaxUpdatedAtMs,
|
|
83
|
-
artifactMinUpdatedAtMs: options.artifactMinUpdatedAtMs,
|
|
84
|
-
artifactRequests: options.batchArtifactRequests,
|
|
85
|
-
buildNestedToolPresentation,
|
|
86
|
-
modelVisible: options.modelVisible,
|
|
87
|
-
cwd: options.cwd,
|
|
88
|
-
data: source.data,
|
|
89
|
-
namespace: options.namespace,
|
|
90
|
-
networkRoutes: options.networkRoutes,
|
|
91
|
-
persistentArtifactStore: options.persistentArtifactStore,
|
|
92
|
-
piCleanupOwnership: options.piCleanupOwnership,
|
|
93
|
-
sessionName: options.sessionName,
|
|
94
|
-
summary,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (options.modelVisible !== false &&
|
|
98
|
-
source.commandInfo.command === "snapshot" &&
|
|
99
|
-
isRecord(source.data) &&
|
|
100
|
-
!source.confirmationRequired) {
|
|
101
|
-
return buildSnapshotPresentation(source.data, options.persistentArtifactStore, options.artifactManifest);
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
artifacts: artifacts.length > 0 ? artifacts : undefined,
|
|
105
|
-
content: buildNativeContent(options, source, artifacts),
|
|
106
|
-
data: source.presentationData,
|
|
107
|
-
summary,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { completePresentationOutput, extractPresentationArtifacts, } from "./presentation/output-completion.js";
|
|
2
|
-
export async function buildToolPresentation(options) {
|
|
3
|
-
const { buildPresentationSource, buildSourcePresentation, resolvePresentationCommands } = await import("./presentation/source.js");
|
|
4
|
-
const { buildEarlyPresentation, sanitizeModelFacingPresentation } = await import("./presentation/early-result.js");
|
|
5
|
-
const { applyPresentationNotices } = await import("./presentation/notices.js");
|
|
6
|
-
const { applyPresentationOutcome } = await import("./presentation/outcomes.js");
|
|
7
|
-
const commands = resolvePresentationCommands(options);
|
|
8
|
-
const early = await buildEarlyPresentation(options, commands);
|
|
9
|
-
if (early) {
|
|
10
|
-
return early;
|
|
11
|
-
}
|
|
12
|
-
const source = buildPresentationSource(options, commands);
|
|
13
|
-
const artifacts = await extractPresentationArtifacts(options, source);
|
|
14
|
-
const draft = await buildSourcePresentation(options, source, artifacts, buildToolPresentation);
|
|
15
|
-
applyPresentationNotices(draft, options, source);
|
|
16
|
-
const completed = await completePresentationOutput(draft, options, source, artifacts);
|
|
17
|
-
applyPresentationOutcome(completed, options, source);
|
|
18
|
-
return sanitizeModelFacingPresentation(completed);
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|