pi-agent-browser-native 0.9.5 → 0.9.7
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 +114 -1
- package/README.md +17 -6
- package/dist/extensions/agent-browser/index.js +2482 -925
- package/dist/packaged/lib/browser-session-conversion.js +2946 -0
- package/dist/packaged/lib/config-policy.js +599 -0
- package/dist/packaged/lib/parsing.js +34 -0
- package/dist/packaged/lib/playbook.js +728 -0
- package/dist/packaged/lib/results/snapshot.js +2800 -0
- package/dist/packaged/lib/runtime.js +3075 -0
- package/docs/ARCHITECTURE.md +29 -10
- package/docs/CODE_QUALITY.md +32 -5
- package/docs/COMMAND_REFERENCE.md +156 -40
- package/docs/ELECTRON.md +1 -1
- package/docs/PERFORMANCE.md +252 -0
- package/docs/REFERENCE.md +15 -15
- package/docs/RELEASE.md +41 -18
- package/docs/REQUIREMENTS.md +6 -0
- package/docs/SESSION_STORAGE.md +13 -5
- package/docs/SUPPORT_MATRIX.md +31 -25
- package/docs/TOOL_CONTRACT.md +41 -18
- package/docs/performance/2026-10-12.json +7257 -0
- package/docs/platform-smoke.md +18 -14
- package/package.json +18 -4
- package/platform-smoke.config.mjs +3 -2
- package/scripts/agent-browser-capability-baseline.mjs +16 -2
- package/scripts/agent-browser-target.mjs +1 -1
- package/scripts/build.mjs +16 -5
- package/scripts/capability-options.mjs +20 -0
- package/scripts/capability-samples.mjs +23 -10
- package/scripts/config.mjs +1 -1
- package/scripts/convert-browser-session.mjs +1 -1
- package/scripts/platform-smoke/commands.mjs +30 -4
- package/scripts/platform-smoke/doctor-support.mjs +11 -2
- package/scripts/platform-smoke/doctor-windows.mjs +1 -1
- package/scripts/platform-smoke/doctor.mjs +26 -11
- package/scripts/platform-smoke/linux-image/Dockerfile +6 -3
- package/scripts/platform-smoke/platform-build-windows.ps1 +23 -3
- package/scripts/platform-smoke/suite-checks.mjs +11 -1
- package/scripts/platform-smoke/targets.mjs +4 -3
- package/scripts/platform-smoke.mjs +68 -25
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +0 -123
- package/dist/extensions/agent-browser/lib/argv-grammar.js +0 -320
- package/dist/extensions/agent-browser/lib/bash-guard.js +0 -193
- package/dist/extensions/agent-browser/lib/batch-lifecycle.js +0 -131
- package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +0 -61
- package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +0 -232
- package/dist/extensions/agent-browser/lib/browser-execution-claims.js +0 -202
- package/dist/extensions/agent-browser/lib/browser-execution-identity.js +0 -77
- package/dist/extensions/agent-browser/lib/browser-journal-branch.js +0 -98
- package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/browser-journal-projection.js +0 -221
- package/dist/extensions/agent-browser/lib/browser-journal-reader.js +0 -89
- package/dist/extensions/agent-browser/lib/browser-journal-replay.js +0 -246
- package/dist/extensions/agent-browser/lib/browser-journal.js +0 -148
- package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +0 -220
- package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +0 -282
- package/dist/extensions/agent-browser/lib/browser-legacy-types.js +0 -1
- package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +0 -217
- package/dist/extensions/agent-browser/lib/browser-session-conversion.js +0 -126
- package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +0 -35
- package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +0 -166
- package/dist/extensions/agent-browser/lib/browser-transcript.js +0 -189
- package/dist/extensions/agent-browser/lib/browser-value-parsing.js +0 -15
- package/dist/extensions/agent-browser/lib/command-capabilities.js +0 -340
- package/dist/extensions/agent-browser/lib/command-policy.js +0 -155
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +0 -105
- package/dist/extensions/agent-browser/lib/config-policy.js +0 -450
- package/dist/extensions/agent-browser/lib/config-providers.js +0 -71
- package/dist/extensions/agent-browser/lib/config-validation.js +0 -231
- package/dist/extensions/agent-browser/lib/config.js +0 -69
- package/dist/extensions/agent-browser/lib/electron/cdp.js +0 -62
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +0 -274
- package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +0 -109
- package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +0 -136
- package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +0 -90
- package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +0 -93
- package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +0 -162
- package/dist/extensions/agent-browser/lib/electron/discovery-types.js +0 -2
- package/dist/extensions/agent-browser/lib/electron/discovery.js +0 -217
- package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +0 -102
- package/dist/extensions/agent-browser/lib/electron/launch-process.js +0 -209
- package/dist/extensions/agent-browser/lib/electron/launch-types.js +0 -2
- package/dist/extensions/agent-browser/lib/electron/launch.js +0 -340
- package/dist/extensions/agent-browser/lib/executable-path.js +0 -29
- package/dist/extensions/agent-browser/lib/execution-cwd.js +0 -67
- package/dist/extensions/agent-browser/lib/fs-utils.js +0 -10
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +0 -201
- package/dist/extensions/agent-browser/lib/input-modes/job.js +0 -198
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +0 -116
- package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +0 -132
- package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +0 -57
- package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +0 -151
- package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +0 -142
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +0 -84
- package/dist/extensions/agent-browser/lib/input-modes/params.js +0 -195
- package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +0 -268
- package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +0 -117
- package/dist/extensions/agent-browser/lib/input-modes/script-child.js +0 -396
- package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +0 -86
- package/dist/extensions/agent-browser/lib/input-modes/script-types.js +0 -1
- package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +0 -60
- package/dist/extensions/agent-browser/lib/input-modes/script.js +0 -108
- package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +0 -243
- package/dist/extensions/agent-browser/lib/input-modes/shared.js +0 -48
- package/dist/extensions/agent-browser/lib/input-modes/types.js +0 -65
- package/dist/extensions/agent-browser/lib/json-schema.js +0 -65
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +0 -212
- package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +0 -165
- package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +0 -58
- package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +0 -244
- package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +0 -84
- package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +0 -119
- package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +0 -83
- package/dist/extensions/agent-browser/lib/managed-session-restore.js +0 -212
- package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +0 -277
- package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +0 -181
- package/dist/extensions/agent-browser/lib/managed-session-storage.js +0 -126
- package/dist/extensions/agent-browser/lib/native-confirmation.js +0 -140
- package/dist/extensions/agent-browser/lib/native-output.js +0 -81
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +0 -30
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +0 -188
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +0 -82
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +0 -406
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +0 -31
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +0 -240
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +0 -203
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +0 -109
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +0 -119
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +0 -147
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +0 -144
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +0 -123
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +0 -156
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +0 -187
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +0 -39
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +0 -89
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +0 -97
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +0 -106
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +0 -110
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +0 -53
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +0 -224
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +0 -290
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +0 -167
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +0 -108
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +0 -174
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +0 -65
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +0 -120
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +0 -192
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +0 -225
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +0 -150
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +0 -174
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +0 -147
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +0 -145
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +0 -159
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +0 -131
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +0 -93
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +0 -42
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +0 -242
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +0 -75
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +0 -92
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +0 -254
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +0 -121
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +0 -130
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +0 -114
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +0 -121
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +0 -222
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +0 -68
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +0 -202
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +0 -191
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +0 -152
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +0 -150
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +0 -115
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +0 -256
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +0 -256
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +0 -93
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +0 -113
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +0 -316
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +0 -28
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +0 -142
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +0 -333
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +0 -71
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +0 -201
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +0 -183
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +0 -200
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +0 -142
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +0 -25
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +0 -50
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +0 -198
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +0 -154
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +0 -80
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +0 -14
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +0 -206
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +0 -130
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +0 -212
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +0 -61
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +0 -187
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +0 -169
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +0 -228
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +0 -117
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +0 -256
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +0 -108
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/types.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +0 -39
- package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +0 -119
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +0 -93
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +0 -58
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +0 -78
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +0 -106
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +0 -60
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +0 -86
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +0 -68
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +0 -169
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +0 -182
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +0 -161
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +0 -167
- package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +0 -98
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +0 -211
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +0 -23
- package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +0 -99
- package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +0 -275
- package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +0 -280
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +0 -303
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +0 -36
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +0 -335
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +0 -227
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +0 -204
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +0 -139
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +0 -24
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +0 -98
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +0 -295
- package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +0 -41
- package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +0 -7
- package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +0 -102
- package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +0 -133
- package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +0 -120
- package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +0 -180
- package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +0 -290
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +0 -269
- package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +0 -113
- package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +0 -146
- package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +0 -58
- package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +0 -62
- package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +0 -54
- package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +0 -1
- package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +0 -313
- package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +0 -62
- package/dist/extensions/agent-browser/lib/orchestration/native-config.js +0 -144
- package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +0 -77
- package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +0 -231
- package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +0 -142
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +0 -276
- package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +0 -220
- package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +0 -55
- package/dist/extensions/agent-browser/lib/page-target-batch.js +0 -118
- package/dist/extensions/agent-browser/lib/page-target-guards.js +0 -50
- package/dist/extensions/agent-browser/lib/page-target-navigation.js +0 -104
- package/dist/extensions/agent-browser/lib/page-target-validation.js +0 -90
- package/dist/extensions/agent-browser/lib/parsing.js +0 -30
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +0 -343
- package/dist/extensions/agent-browser/lib/playbook.js +0 -146
- package/dist/extensions/agent-browser/lib/process-child.js +0 -284
- package/dist/extensions/agent-browser/lib/process-environment.js +0 -48
- package/dist/extensions/agent-browser/lib/process-errors.js +0 -23
- package/dist/extensions/agent-browser/lib/process-identity.js +0 -127
- package/dist/extensions/agent-browser/lib/process-socket-storage.js +0 -256
- package/dist/extensions/agent-browser/lib/process-stdout.js +0 -74
- package/dist/extensions/agent-browser/lib/process.js +0 -216
- package/dist/extensions/agent-browser/lib/prompt-artifacts.js +0 -287
- package/dist/extensions/agent-browser/lib/prompt-policy.js +0 -54
- package/dist/extensions/agent-browser/lib/read-command.js +0 -41
- package/dist/extensions/agent-browser/lib/read-confirmation.js +0 -162
- package/dist/extensions/agent-browser/lib/recording-reservations.js +0 -208
- package/dist/extensions/agent-browser/lib/redaction-fields.js +0 -75
- package/dist/extensions/agent-browser/lib/redaction-json.js +0 -149
- package/dist/extensions/agent-browser/lib/redaction-url.js +0 -88
- package/dist/extensions/agent-browser/lib/results/action-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/action-recommendations.js +0 -38
- package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +0 -133
- package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +0 -173
- package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +0 -73
- package/dist/extensions/agent-browser/lib/results/categories.js +0 -152
- package/dist/extensions/agent-browser/lib/results/confirmation.js +0 -75
- package/dist/extensions/agent-browser/lib/results/contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +0 -99
- package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +0 -83
- package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +0 -48
- package/dist/extensions/agent-browser/lib/results/envelope.js +0 -198
- package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +0 -180
- package/dist/extensions/agent-browser/lib/results/network-routes.js +0 -133
- package/dist/extensions/agent-browser/lib/results/network.js +0 -89
- package/dist/extensions/agent-browser/lib/results/next-actions.js +0 -111
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +0 -320
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +0 -138
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +0 -113
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +0 -145
- package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +0 -165
- package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +0 -118
- package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +0 -68
- package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +0 -135
- package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +0 -227
- package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +0 -91
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +0 -123
- package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +0 -54
- package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +0 -216
- package/dist/extensions/agent-browser/lib/results/presentation/common.js +0 -81
- package/dist/extensions/agent-browser/lib/results/presentation/content.js +0 -119
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +0 -67
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +0 -79
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +0 -199
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +0 -75
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +0 -216
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +0 -124
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +0 -64
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +0 -209
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +0 -69
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +0 -222
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +0 -124
- package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +0 -70
- package/dist/extensions/agent-browser/lib/results/presentation/errors.js +0 -285
- package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +0 -117
- package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +0 -231
- package/dist/extensions/agent-browser/lib/results/presentation/notices.js +0 -75
- package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +0 -127
- package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +0 -120
- package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +0 -77
- package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +0 -51
- package/dist/extensions/agent-browser/lib/results/presentation/registry.js +0 -145
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +0 -104
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +0 -183
- package/dist/extensions/agent-browser/lib/results/presentation/source.js +0 -109
- package/dist/extensions/agent-browser/lib/results/presentation.js +0 -19
- package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/results/recording.js +0 -88
- package/dist/extensions/agent-browser/lib/results/recovery-actions.js +0 -118
- package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +0 -60
- package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +0 -83
- package/dist/extensions/agent-browser/lib/results/selector-recovery.js +0 -261
- package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +0 -266
- package/dist/extensions/agent-browser/lib/results/snapshot-content.js +0 -32
- package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +0 -240
- package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +0 -103
- package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +0 -383
- package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +0 -53
- package/dist/extensions/agent-browser/lib/results/snapshot.js +0 -44
- package/dist/extensions/agent-browser/lib/results/text.js +0 -44
- package/dist/extensions/agent-browser/lib/runtime-args-validation.js +0 -133
- package/dist/extensions/agent-browser/lib/runtime-compatibility.js +0 -81
- package/dist/extensions/agent-browser/lib/runtime-contracts.js +0 -1
- package/dist/extensions/agent-browser/lib/runtime-redaction.js +0 -118
- package/dist/extensions/agent-browser/lib/runtime-replay-events.js +0 -144
- package/dist/extensions/agent-browser/lib/runtime-session-identity.js +0 -76
- package/dist/extensions/agent-browser/lib/runtime-session-plan.js +0 -114
- package/dist/extensions/agent-browser/lib/runtime-session-replay.js +0 -123
- package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +0 -65
- package/dist/extensions/agent-browser/lib/runtime-timeouts.js +0 -28
- package/dist/extensions/agent-browser/lib/runtime.js +0 -163
- package/dist/extensions/agent-browser/lib/session-identity.js +0 -51
- package/dist/extensions/agent-browser/lib/session-page-observation.js +0 -357
- package/dist/extensions/agent-browser/lib/session-page-state.js +0 -353
- package/dist/extensions/agent-browser/lib/session-page-types.js +0 -1
- package/dist/extensions/agent-browser/lib/string-enum-schema.js +0 -8
- package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +0 -81
- package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +0 -7
- package/dist/extensions/agent-browser/lib/temp-root-ownership.js +0 -234
- package/dist/extensions/agent-browser/lib/temp-root.js +0 -211
- package/dist/extensions/agent-browser/lib/temp.js +0 -91
- package/dist/extensions/agent-browser/lib/tool-surface.js +0 -239
- package/dist/extensions/agent-browser/lib/upstream-version.js +0 -15
- package/dist/extensions/agent-browser/lib/web-search-providers.js +0 -193
- package/dist/extensions/agent-browser/lib/web-search-request.js +0 -102
- package/dist/extensions/agent-browser/lib/web-search-results.js +0 -281
- package/dist/extensions/agent-browser/lib/web-search-schema.js +0 -82
- package/dist/extensions/agent-browser/lib/web-search.js +0 -167
- package/dist/extensions/agent-browser/lib/webmcp-observation.js +0 -35
- package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +0 -96
- package/dist/scripts/agent-browser-target.mjs +0 -23
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
-
import { basename, join } from "node:path";
|
|
3
|
-
import { pathExists } from "../fs-utils.js";
|
|
4
|
-
import { hasElectronAppPayload, isDirectory } from "./discovery-evidence.js";
|
|
5
|
-
function readPlistString(plist, key) {
|
|
6
|
-
const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7
|
-
const match = new RegExp(`<key>\\s*${escapedKey}\\s*</key>\\s*<string>([\\s\\S]*?)</string>`, "i").exec(plist);
|
|
8
|
-
return match?.[1]
|
|
9
|
-
?.trim()
|
|
10
|
-
.replaceAll("&", "&")
|
|
11
|
-
.replaceAll("<", "<")
|
|
12
|
-
.replaceAll(">", ">")
|
|
13
|
-
.replaceAll(""", '"')
|
|
14
|
-
.replaceAll("'", "'");
|
|
15
|
-
}
|
|
16
|
-
async function readMacInfoPlist(appPath) {
|
|
17
|
-
try {
|
|
18
|
-
const plist = await readFile(join(appPath, "Contents", "Info.plist"), "utf8");
|
|
19
|
-
return {
|
|
20
|
-
CFBundleDisplayName: readPlistString(plist, "CFBundleDisplayName") ?? "",
|
|
21
|
-
CFBundleExecutable: readPlistString(plist, "CFBundleExecutable") ?? "",
|
|
22
|
-
CFBundleIdentifier: readPlistString(plist, "CFBundleIdentifier") ?? "",
|
|
23
|
-
CFBundleName: readPlistString(plist, "CFBundleName") ?? "",
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return {};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
async function resolveMacExecutablePath(appPath, executableName, fallbackName) {
|
|
31
|
-
const directory = join(appPath, "Contents", "MacOS");
|
|
32
|
-
if (executableName !== undefined && executableName.trim().length > 0) {
|
|
33
|
-
const path = join(directory, executableName);
|
|
34
|
-
return (await pathExists(path)) ? path : undefined;
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
const entries = await readdir(directory, { withFileTypes: true });
|
|
38
|
-
const candidate = entries.find((entry) => entry.isFile() && entry.name === fallbackName) ??
|
|
39
|
-
entries.find((entry) => entry.isFile());
|
|
40
|
-
return candidate ? join(directory, candidate.name) : undefined;
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function firstNonempty(values) {
|
|
47
|
-
return values.find((value) => value !== undefined && value.length > 0);
|
|
48
|
-
}
|
|
49
|
-
export async function inspectDarwinApp(appPath) {
|
|
50
|
-
const framework = join(appPath, "Contents", "Frameworks", "Electron Framework.framework");
|
|
51
|
-
const hasFramework = await isDirectory(framework);
|
|
52
|
-
const hasPayload = await hasElectronAppPayload(join(appPath, "Contents", "Resources"));
|
|
53
|
-
if (!hasFramework || !hasPayload) {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
const info = await readMacInfoPlist(appPath);
|
|
57
|
-
const directoryName = basename(appPath, ".app");
|
|
58
|
-
const executablePath = await resolveMacExecutablePath(appPath, info.CFBundleExecutable, directoryName);
|
|
59
|
-
if (executablePath === undefined) {
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
appPath,
|
|
64
|
-
bundleId: firstNonempty([info.CFBundleIdentifier]),
|
|
65
|
-
executablePath,
|
|
66
|
-
name: firstNonempty([info.CFBundleDisplayName, info.CFBundleName]) ?? directoryName,
|
|
67
|
-
platform: "darwin",
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
async function inspectDirectory(directory) {
|
|
71
|
-
let entries;
|
|
72
|
-
try {
|
|
73
|
-
entries = await readdir(directory, { withFileTypes: true });
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return { apps: [], skippedCount: 0 };
|
|
77
|
-
}
|
|
78
|
-
const apps = [];
|
|
79
|
-
let skippedCount = 0;
|
|
80
|
-
for (const entry of entries) {
|
|
81
|
-
if (!entry.name.endsWith(".app")) {
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
try {
|
|
85
|
-
// Inspect in filesystem order and count failures without overlapping app reads.
|
|
86
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
87
|
-
const app = await inspectDarwinApp(join(directory, entry.name));
|
|
88
|
-
if (app) {
|
|
89
|
-
apps.push(app);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
skippedCount += 1;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return { apps, skippedCount };
|
|
97
|
-
}
|
|
98
|
-
export async function discoverDarwinApps(directories) {
|
|
99
|
-
const apps = [];
|
|
100
|
-
let skippedCount = 0;
|
|
101
|
-
for (const directory of directories) {
|
|
102
|
-
// Location priority is observable when duplicate bundles are discovered.
|
|
103
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
104
|
-
const scan = await inspectDirectory(directory);
|
|
105
|
-
apps.push(...scan.apps);
|
|
106
|
-
skippedCount += scan.skippedCount;
|
|
107
|
-
}
|
|
108
|
-
return { apps, skippedCount };
|
|
109
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { basename } from "node:path";
|
|
2
|
-
function unescapeDesktopValue(value) {
|
|
3
|
-
return value
|
|
4
|
-
.replace(/\\s/g, " ")
|
|
5
|
-
.replace(/\\n/g, "\n")
|
|
6
|
-
.replace(/\\r/g, "\r")
|
|
7
|
-
.replace(/\\t/g, "\t")
|
|
8
|
-
.replace(/\\\\/g, "\\");
|
|
9
|
-
}
|
|
10
|
-
function parseDesktopFields(text) {
|
|
11
|
-
const fields = new Map();
|
|
12
|
-
let inDesktopEntry = false;
|
|
13
|
-
for (const rawLine of text.split(/\r?\n/)) {
|
|
14
|
-
const line = rawLine.trim();
|
|
15
|
-
if (line.length === 0 || line.startsWith("#")) {
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
if (line.startsWith("[") && line.endsWith("]")) {
|
|
19
|
-
inDesktopEntry = line === "[Desktop Entry]";
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
const separator = line.indexOf("=");
|
|
23
|
-
if (inDesktopEntry && separator > 0) {
|
|
24
|
-
fields.set(line.slice(0, separator), unescapeDesktopValue(line.slice(separator + 1)));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return fields;
|
|
28
|
-
}
|
|
29
|
-
function nonempty(value) {
|
|
30
|
-
return value !== undefined && value.length > 0 ? value : undefined;
|
|
31
|
-
}
|
|
32
|
-
export function parseDesktopFile(text, filePath) {
|
|
33
|
-
const fields = parseDesktopFields(text);
|
|
34
|
-
if (fields.get("Type") !== "Application") {
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
if (["NoDisplay", "Hidden"].some((key) => fields.get(key)?.trim().toLowerCase() === "true")) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
const exec = nonempty(fields.get("Exec")?.trim());
|
|
41
|
-
if (exec === undefined) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
const desktopId = basename(filePath, ".desktop");
|
|
45
|
-
return {
|
|
46
|
-
comment: nonempty(fields.get("Comment")),
|
|
47
|
-
desktopId,
|
|
48
|
-
exec,
|
|
49
|
-
filePath,
|
|
50
|
-
icon: nonempty(fields.get("Icon")),
|
|
51
|
-
name: nonempty(fields.get("Name")) ?? desktopId,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function stripDesktopExecFieldCodes(exec) {
|
|
55
|
-
const placeholder = "\u0000PERCENT\u0000";
|
|
56
|
-
return exec
|
|
57
|
-
.replaceAll("%%", placeholder)
|
|
58
|
-
.replace(/%[A-Za-z]/g, "")
|
|
59
|
-
.replaceAll(placeholder, "%");
|
|
60
|
-
}
|
|
61
|
-
class DesktopExecWords {
|
|
62
|
-
tokens = [];
|
|
63
|
-
current = "";
|
|
64
|
-
quote;
|
|
65
|
-
escaped = false;
|
|
66
|
-
parse(exec) {
|
|
67
|
-
for (const char of stripDesktopExecFieldCodes(exec)) {
|
|
68
|
-
this.accept(char);
|
|
69
|
-
}
|
|
70
|
-
if (this.escaped) {
|
|
71
|
-
this.current += "\\";
|
|
72
|
-
}
|
|
73
|
-
this.flush();
|
|
74
|
-
return this.tokens;
|
|
75
|
-
}
|
|
76
|
-
flush() {
|
|
77
|
-
if (this.current.length > 0) {
|
|
78
|
-
this.tokens.push(this.current);
|
|
79
|
-
this.current = "";
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
accept(char) {
|
|
83
|
-
if (this.escaped) {
|
|
84
|
-
this.current += char;
|
|
85
|
-
this.escaped = false;
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (char === "\\") {
|
|
89
|
-
this.escaped = true;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (this.quote !== undefined) {
|
|
93
|
-
if (char === this.quote) {
|
|
94
|
-
this.quote = undefined;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
this.current += char;
|
|
98
|
-
}
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (char === '"' || char === "'") {
|
|
102
|
-
this.quote = char;
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (/\s/.test(char)) {
|
|
106
|
-
this.flush();
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
this.current += char;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
export function tokenizeDesktopExec(exec) {
|
|
113
|
-
return new DesktopExecWords().parse(exec);
|
|
114
|
-
}
|
|
115
|
-
function envOptionWidth(token) {
|
|
116
|
-
return ["-u", "--unset", "--chdir"].includes(token) ? 2 : 1;
|
|
117
|
-
}
|
|
118
|
-
export function stripEnvLauncher(tokens) {
|
|
119
|
-
if (tokens.length === 0 || basename(tokens[0] ?? "") !== "env") {
|
|
120
|
-
return tokens;
|
|
121
|
-
}
|
|
122
|
-
let index = 1;
|
|
123
|
-
while (index < tokens.length) {
|
|
124
|
-
const token = tokens[index] ?? "";
|
|
125
|
-
if (token.startsWith("-")) {
|
|
126
|
-
index += envOptionWidth(token);
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(token)) {
|
|
130
|
-
index += 1;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
return tokens.slice(index);
|
|
136
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { constants as fsConstants } from "node:fs";
|
|
2
|
-
import { access, readdir, realpath, stat } from "node:fs/promises";
|
|
3
|
-
import { basename, dirname, extname, join } from "node:path";
|
|
4
|
-
import { pathExists } from "../fs-utils.js";
|
|
5
|
-
export async function isDirectory(path) {
|
|
6
|
-
try {
|
|
7
|
-
return (await stat(path)).isDirectory();
|
|
8
|
-
}
|
|
9
|
-
catch {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export async function isFile(path) {
|
|
14
|
-
try {
|
|
15
|
-
return (await stat(path)).isFile();
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export async function isExecutableFile(path) {
|
|
22
|
-
try {
|
|
23
|
-
if (!(await stat(path)).isFile()) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
await access(path, fsConstants.X_OK);
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export async function resolveRealPath(path) {
|
|
34
|
-
try {
|
|
35
|
-
return await realpath(path);
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return path;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export async function directoryContainsChromePak(directory) {
|
|
42
|
-
try {
|
|
43
|
-
const entries = await readdir(directory, { withFileTypes: true });
|
|
44
|
-
return entries.some((entry) => entry.isFile() && /^chrome_.*\.pak$/i.test(entry.name));
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export async function hasElectronAppPayload(resourcesDirectory) {
|
|
51
|
-
return ((await pathExists(join(resourcesDirectory, "app.asar"))) ||
|
|
52
|
-
(await pathExists(join(resourcesDirectory, "default_app.asar"))) ||
|
|
53
|
-
(await isDirectory(join(resourcesDirectory, "app"))));
|
|
54
|
-
}
|
|
55
|
-
export async function hasLinuxElectronEvidence(executablePath) {
|
|
56
|
-
const resolved = await resolveRealPath(executablePath);
|
|
57
|
-
if (!(await isExecutableFile(resolved))) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
const directory = dirname(resolved);
|
|
61
|
-
if (!(await directoryContainsChromePak(directory))) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
for (const base of [directory, dirname(directory)]) {
|
|
65
|
-
// Ordered evidence checks avoid unnecessary filesystem work after the first match.
|
|
66
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
67
|
-
if (await hasElectronAppPayload(join(base, "resources"))) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
export async function inspectWin32Executable(executablePath) {
|
|
74
|
-
const resolved = await resolveRealPath(executablePath);
|
|
75
|
-
if (!(await isExecutableFile(resolved))) {
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
const directory = dirname(resolved);
|
|
79
|
-
const hasAppPayload = await hasElectronAppPayload(join(directory, "resources"));
|
|
80
|
-
const hasPak = (await directoryContainsChromePak(directory)) ||
|
|
81
|
-
(await pathExists(join(directory, "resources.pak")));
|
|
82
|
-
if (!hasAppPayload || !hasPak) {
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
executablePath: resolved,
|
|
87
|
-
name: basename(resolved, extname(resolved)),
|
|
88
|
-
platform: "win32",
|
|
89
|
-
};
|
|
90
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
-
import { basename, extname, isAbsolute, join } from "node:path";
|
|
3
|
-
import { parseDesktopFile, stripEnvLauncher, tokenizeDesktopExec } from "./discovery-desktop.js";
|
|
4
|
-
import { hasLinuxElectronEvidence, resolveRealPath } from "./discovery-evidence.js";
|
|
5
|
-
import { findExecutableInPath, pathIsWithin, resolveFlatpakExecutable, resolveSnapExecutable, } from "./discovery-packages.js";
|
|
6
|
-
async function resolveLinuxExecutable(entry, locations) {
|
|
7
|
-
const tokens = stripEnvLauncher(tokenizeDesktopExec(entry.exec));
|
|
8
|
-
const token = tokens.at(0);
|
|
9
|
-
if (token === undefined || token.length === 0) {
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
|
-
if (basename(token) === "flatpak") {
|
|
13
|
-
const path = await resolveFlatpakExecutable(tokens, entry, locations);
|
|
14
|
-
return path === undefined ? undefined : { executablePath: path, packageSource: "flatpak" };
|
|
15
|
-
}
|
|
16
|
-
const executablePath = isAbsolute(token)
|
|
17
|
-
? token
|
|
18
|
-
: await findExecutableInPath(token, locations.pathEnv);
|
|
19
|
-
if (executablePath === undefined) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
if (pathIsWithin(executablePath, locations.snapBinDirectory)) {
|
|
23
|
-
const path = await resolveSnapExecutable(executablePath, entry, locations);
|
|
24
|
-
return path === undefined ? undefined : { executablePath: path, packageSource: "snap" };
|
|
25
|
-
}
|
|
26
|
-
return { executablePath: await resolveRealPath(executablePath), packageSource: "desktop" };
|
|
27
|
-
}
|
|
28
|
-
async function inspectLinuxDesktopFile(filePath, locations) {
|
|
29
|
-
let text;
|
|
30
|
-
try {
|
|
31
|
-
text = await readFile(filePath, "utf8");
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
const entry = parseDesktopFile(text, filePath);
|
|
37
|
-
if (!entry) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
const resolution = await resolveLinuxExecutable(entry, locations);
|
|
41
|
-
if (!resolution || !(await hasLinuxElectronEvidence(resolution.executablePath))) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
comment: entry.comment,
|
|
46
|
-
desktopId: entry.desktopId,
|
|
47
|
-
executablePath: resolution.executablePath,
|
|
48
|
-
icon: entry.icon,
|
|
49
|
-
name: entry.name,
|
|
50
|
-
packageSource: resolution.packageSource,
|
|
51
|
-
platform: "linux",
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
async function inspectDirectory(directory, locations) {
|
|
55
|
-
let entries;
|
|
56
|
-
try {
|
|
57
|
-
entries = await readdir(directory, { withFileTypes: true });
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
return { apps: [], skippedCount: 0 };
|
|
61
|
-
}
|
|
62
|
-
const apps = [];
|
|
63
|
-
let skippedCount = 0;
|
|
64
|
-
for (const entry of entries) {
|
|
65
|
-
if (!entry.isFile() || extname(entry.name) !== ".desktop") {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
// Preserve desktop-file priority and bound concurrent package scans to one.
|
|
70
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
71
|
-
const app = await inspectLinuxDesktopFile(join(directory, entry.name), locations);
|
|
72
|
-
if (app) {
|
|
73
|
-
apps.push(app);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
skippedCount += 1;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return { apps, skippedCount };
|
|
81
|
-
}
|
|
82
|
-
export async function discoverLinuxApps(locations) {
|
|
83
|
-
const apps = [];
|
|
84
|
-
let skippedCount = 0;
|
|
85
|
-
for (const directory of locations.linuxDesktopDirectories) {
|
|
86
|
-
// Location order determines which duplicate desktop entry is retained.
|
|
87
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
88
|
-
const scan = await inspectDirectory(directory, locations);
|
|
89
|
-
apps.push(...scan.apps);
|
|
90
|
-
skippedCount += scan.skippedCount;
|
|
91
|
-
}
|
|
92
|
-
return { apps, skippedCount };
|
|
93
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { readdir } from "node:fs/promises";
|
|
2
|
-
import { basename, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
3
|
-
import { hasLinuxElectronEvidence, isDirectory, isFile, resolveRealPath, } from "./discovery-evidence.js";
|
|
4
|
-
const MAX_DEPTH = 7;
|
|
5
|
-
const MAX_ENTRIES = 5_000;
|
|
6
|
-
const NON_EXECUTABLE_EXTENSIONS = new Set([
|
|
7
|
-
".asar",
|
|
8
|
-
".dat",
|
|
9
|
-
".desktop",
|
|
10
|
-
".json",
|
|
11
|
-
".md",
|
|
12
|
-
".pak",
|
|
13
|
-
".png",
|
|
14
|
-
".so",
|
|
15
|
-
".txt",
|
|
16
|
-
]);
|
|
17
|
-
export function pathIsWithin(path, parent) {
|
|
18
|
-
const relativePath = relative(resolve(parent), resolve(path));
|
|
19
|
-
return relativePath.length === 0 || (!relativePath.startsWith("..") && !isAbsolute(relativePath));
|
|
20
|
-
}
|
|
21
|
-
export async function findExecutableInPath(command, pathEnv) {
|
|
22
|
-
if (command.includes("/")) {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
for (const directory of pathEnv.split(":")) {
|
|
26
|
-
if (directory.length === 0) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const candidate = join(directory, command);
|
|
30
|
-
// PATH priority requires returning the first present file, not the fastest stat.
|
|
31
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
32
|
-
if (await isFile(candidate)) {
|
|
33
|
-
return candidate;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
class ElectronBinarySearch {
|
|
39
|
-
preferredNames;
|
|
40
|
-
candidates = [];
|
|
41
|
-
visitedEntries = 0;
|
|
42
|
-
constructor(preferredNames) {
|
|
43
|
-
this.preferredNames = new Set(preferredNames.filter((name) => name.length > 0));
|
|
44
|
-
}
|
|
45
|
-
async find(root) {
|
|
46
|
-
if (!(await isDirectory(root))) {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
const preferred = await this.visit(root, 0);
|
|
50
|
-
if (preferred !== undefined) {
|
|
51
|
-
return preferred;
|
|
52
|
-
}
|
|
53
|
-
for (const candidate of this.candidates) {
|
|
54
|
-
// Keep DFS candidate order and stop at the first verified fallback executable.
|
|
55
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
56
|
-
if (await hasLinuxElectronEvidence(candidate)) {
|
|
57
|
-
return resolveRealPath(candidate);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
async visit(directory, depth) {
|
|
63
|
-
if (depth > MAX_DEPTH || this.visitedEntries >= MAX_ENTRIES) {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
let entries;
|
|
67
|
-
try {
|
|
68
|
-
entries = await readdir(directory, { withFileTypes: true });
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
for (const entry of entries) {
|
|
74
|
-
this.visitedEntries += 1;
|
|
75
|
-
if (this.visitedEntries > MAX_ENTRIES) {
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
// The shared entry budget and preferred-match DFS ordering require serialized traversal.
|
|
79
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
80
|
-
const found = await this.inspectEntry(directory, entry, depth);
|
|
81
|
-
if (found !== undefined) {
|
|
82
|
-
return found;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
async inspectEntry(directory, entry, depth) {
|
|
88
|
-
const path = join(directory, entry.name);
|
|
89
|
-
if (entry.isDirectory()) {
|
|
90
|
-
return this.visit(path, depth + 1);
|
|
91
|
-
}
|
|
92
|
-
if (!entry.isFile() || NON_EXECUTABLE_EXTENSIONS.has(extname(path).toLowerCase())) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
if (this.preferredNames.has(entry.name) && (await hasLinuxElectronEvidence(path))) {
|
|
96
|
-
return resolveRealPath(path);
|
|
97
|
-
}
|
|
98
|
-
this.candidates.push(path);
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
export async function resolveSnapExecutable(commandPath, entry, locations) {
|
|
103
|
-
const commandName = basename(commandPath);
|
|
104
|
-
const names = [commandName, commandName.split(".")[0] ?? "", entry.desktopId.split(".")[0] ?? ""];
|
|
105
|
-
for (const snapName of new Set(names.filter((name) => name.length > 0))) {
|
|
106
|
-
const root = join(locations.snapMountDirectory, snapName, "current");
|
|
107
|
-
// Native package name priority determines which executable wins.
|
|
108
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
109
|
-
const candidate = await new ElectronBinarySearch([
|
|
110
|
-
commandName,
|
|
111
|
-
commandName.split(".").at(-1) ?? commandName,
|
|
112
|
-
]).find(root);
|
|
113
|
-
if (candidate !== undefined) {
|
|
114
|
-
return candidate;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
function getFlatpakAppId(tokens, desktopId) {
|
|
120
|
-
for (let index = tokens.length - 1; index >= 0; index -= 1) {
|
|
121
|
-
const token = tokens[index] ?? "";
|
|
122
|
-
if (!token.startsWith("-") && token.includes(".") && token !== "flatpak") {
|
|
123
|
-
return token;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return desktopId;
|
|
127
|
-
}
|
|
128
|
-
function getFlatpakCommandName(tokens) {
|
|
129
|
-
for (let index = 0; index < tokens.length; index += 1) {
|
|
130
|
-
const token = tokens[index] ?? "";
|
|
131
|
-
if (token.startsWith("--command=")) {
|
|
132
|
-
return token.slice("--command=".length);
|
|
133
|
-
}
|
|
134
|
-
if (token === "--command") {
|
|
135
|
-
return tokens[index + 1];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return undefined;
|
|
139
|
-
}
|
|
140
|
-
function getFlatpakRoots(entry, locations) {
|
|
141
|
-
const userExport = join(locations.homeDir, ".local", "share", "flatpak", "exports", "share", "applications");
|
|
142
|
-
if (pathIsWithin(entry.filePath, userExport)) {
|
|
143
|
-
return [locations.flatpakUserAppDirectory, locations.flatpakSystemAppDirectory];
|
|
144
|
-
}
|
|
145
|
-
if (pathIsWithin(entry.filePath, "/var/lib/flatpak/exports/share/applications")) {
|
|
146
|
-
return [locations.flatpakSystemAppDirectory, locations.flatpakUserAppDirectory];
|
|
147
|
-
}
|
|
148
|
-
return [locations.flatpakUserAppDirectory, locations.flatpakSystemAppDirectory];
|
|
149
|
-
}
|
|
150
|
-
export async function resolveFlatpakExecutable(tokens, entry, locations) {
|
|
151
|
-
const appId = getFlatpakAppId(tokens, entry.desktopId);
|
|
152
|
-
const commandName = getFlatpakCommandName(tokens);
|
|
153
|
-
for (const root of getFlatpakRoots(entry, locations)) {
|
|
154
|
-
// Preserve user/system installation priority; each root has its own bounded scan.
|
|
155
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
156
|
-
const candidate = await new ElectronBinarySearch(commandName === undefined ? [] : [commandName]).find(join(root, appId, "current", "active", "files"));
|
|
157
|
-
if (candidate !== undefined) {
|
|
158
|
-
return candidate;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return undefined;
|
|
162
|
-
}
|