pi-agent-browser-native 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +106 -5
- package/README.md +58 -791
- package/dist/extensions/agent-browser/index.js +43101 -2031
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +49 -26
- package/dist/extensions/agent-browser/lib/argv-grammar.js +82 -93
- package/dist/extensions/agent-browser/lib/bash-guard.js +129 -126
- package/dist/extensions/agent-browser/lib/batch-lifecycle.js +112 -51
- package/dist/extensions/agent-browser/lib/browser-execution-claim-codec.js +61 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claim-storage.js +232 -0
- package/dist/extensions/agent-browser/lib/browser-execution-claims.js +202 -0
- package/dist/extensions/agent-browser/lib/browser-execution-identity.js +77 -0
- package/dist/extensions/agent-browser/lib/browser-journal-branch.js +98 -0
- package/dist/extensions/agent-browser/lib/browser-journal-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-journal-projection.js +221 -0
- package/dist/extensions/agent-browser/lib/browser-journal-reader.js +89 -0
- package/dist/extensions/agent-browser/lib/browser-journal-replay.js +246 -0
- package/dist/extensions/agent-browser/lib/browser-journal.js +103 -394
- package/dist/extensions/agent-browser/lib/browser-legacy-pages.js +220 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-projection.js +282 -0
- package/dist/extensions/agent-browser/lib/browser-legacy-types.js +1 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion-stream.js +217 -0
- package/dist/extensions/agent-browser/lib/browser-session-conversion.js +80 -335
- package/dist/extensions/agent-browser/lib/browser-transcript-contracts.js +35 -0
- package/dist/extensions/agent-browser/lib/browser-transcript-validation.js +166 -0
- package/dist/extensions/agent-browser/lib/browser-transcript.js +137 -82
- package/dist/extensions/agent-browser/lib/browser-value-parsing.js +15 -0
- package/dist/extensions/agent-browser/lib/command-capabilities.js +340 -0
- package/dist/extensions/agent-browser/lib/command-policy.js +107 -88
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +49 -322
- package/dist/extensions/agent-browser/lib/config-policy.js +138 -343
- package/dist/extensions/agent-browser/lib/config-providers.js +71 -0
- package/dist/extensions/agent-browser/lib/config-validation.js +231 -0
- package/dist/extensions/agent-browser/lib/config.js +20 -8
- package/dist/extensions/agent-browser/lib/electron/cdp.js +20 -8
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +128 -83
- package/dist/extensions/agent-browser/lib/electron/discovery-darwin.js +109 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-desktop.js +136 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-evidence.js +90 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-linux.js +93 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-packages.js +162 -0
- package/dist/extensions/agent-browser/lib/electron/discovery-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/discovery.js +140 -549
- package/dist/extensions/agent-browser/lib/electron/launch-monitor.js +102 -0
- package/dist/extensions/agent-browser/lib/electron/launch-process.js +209 -0
- package/dist/extensions/agent-browser/lib/electron/launch-types.js +2 -0
- package/dist/extensions/agent-browser/lib/electron/launch.js +261 -355
- package/dist/extensions/agent-browser/lib/executable-path.js +21 -12
- package/dist/extensions/agent-browser/lib/execution-cwd.js +35 -18
- package/dist/extensions/agent-browser/lib/fs-utils.js +1 -9
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +162 -121
- package/dist/extensions/agent-browser/lib/input-modes/job.js +123 -317
- package/dist/extensions/agent-browser/lib/input-modes/lookup-network-evidence.js +116 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-plan.js +132 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-redaction.js +57 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-source-evidence.js +151 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookup-workspace.js +142 -0
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +58 -412
- package/dist/extensions/agent-browser/lib/input-modes/params.js +86 -40
- package/dist/extensions/agent-browser/lib/input-modes/qa-analysis.js +268 -0
- package/dist/extensions/agent-browser/lib/input-modes/qa-presentation.js +117 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-child.js +396 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-protocol.js +86 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-types.js +1 -0
- package/dist/extensions/agent-browser/lib/input-modes/script-validation.js +60 -0
- package/dist/extensions/agent-browser/lib/input-modes/script.js +60 -409
- package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +218 -128
- package/dist/extensions/agent-browser/lib/input-modes/shared.js +15 -4
- package/dist/extensions/agent-browser/lib/input-modes/types.js +56 -7
- package/dist/extensions/agent-browser/lib/json-schema.js +22 -10
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +17 -5
- package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +92 -425
- package/dist/extensions/agent-browser/lib/managed-session-posix-storage.js +58 -0
- package/dist/extensions/agent-browser/lib/managed-session-project-identity.js +244 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-context.js +84 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-policy.js +119 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore-state.js +83 -0
- package/dist/extensions/agent-browser/lib/managed-session-restore.js +168 -300
- package/dist/extensions/agent-browser/lib/managed-session-snapshot-records.js +277 -0
- package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +128 -305
- package/dist/extensions/agent-browser/lib/managed-session-storage.js +56 -253
- package/dist/extensions/agent-browser/lib/native-confirmation.js +140 -0
- package/dist/extensions/agent-browser/lib/native-output.js +43 -9
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +106 -59
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-merge.js +14 -6
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +109 -57
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/browser-observation-result.js +82 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +164 -60
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostic-values.js +31 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +152 -781
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-observation.js +203 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/electron-text-diagnostics.js +109 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/fill-diagnostics.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-action-recovery.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-actions.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-content.js +123 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-details.js +156 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-electron.js +187 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-evidence.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-missing-binary.js +89 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-recovery.js +97 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-redaction.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result-timeout.js +110 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +41 -538
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +199 -154
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/interaction-diagnostics.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-close.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-inspection.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +127 -205
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/native-helper-observation.js +65 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/observation-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/overlay-diagnostics.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +113 -30
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +109 -28
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter-data.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +147 -253
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-rendered-text.js +147 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/wait-timeouts.js +59 -24
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-artifacts.js +159 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-command.js +131 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-daemon.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-failure.js +42 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-guards.js +242 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-input.js +75 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-observations.js +92 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-selection.js +254 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-page-state.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-refs.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-resources.js +114 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-semantic.js +121 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-session-plan.js +222 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare-timeouts.js +68 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +176 -1123
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-analysis.js +191 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-confirmation.js +152 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-electron.js +150 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle-phase.js +115 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-lifecycle.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-managed.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native-phase.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-native.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-navigation.js +316 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-ownership.js +28 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-page-phase.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-presentation.js +333 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication-phase.js +71 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-publication.js +201 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-receipts.js +183 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-refs.js +200 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output-tabs.js +142 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +18 -968
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prompt-guards.js +23 -13
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-receipt-reconciliation.js +198 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery-presentation.js +154 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/recording-recovery.js +68 -151
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-capture.js +14 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/screenshot-observation.js +169 -46
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-commands.js +130 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-electron.js +212 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-observations.js +61 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-outcomes.js +187 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-refs.js +169 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state-tabs.js +228 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +77 -765
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/text-visibility-diagnostics.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-diagnostics.js +256 -0
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/timeout-progress.js +108 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-artifact-observation.js +39 -0
- package/dist/extensions/agent-browser/lib/orchestration/code-image-observation.js +119 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/branch.js +93 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup-result.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/cleanup.js +78 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/discovery.js +106 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +48 -821
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/policy.js +86 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-collection.js +68 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-data.js +169 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe-presentation.js +182 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/probe.js +161 -0
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/status.js +167 -0
- package/dist/extensions/agent-browser/lib/orchestration/execution-queue.js +22 -10
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifact-preflight.js +211 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-artifacts.js +23 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-attachment-replay.js +99 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-branch-restore.js +275 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-code.js +280 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-admission.js +303 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-output.js +36 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-result.js +335 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-run.js +227 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-command-state.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-electron-ownership.js +204 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-locks.js +139 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-execution-queue.js +24 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-coordination.js +98 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-host-run.js +295 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-intent-replay.js +41 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-invocation.js +7 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-lifecycle.js +102 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-managed-ownership.js +133 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-observation.js +120 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-prompt.js +180 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-recording.js +290 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-resource-replay.js +269 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-result-state.js +113 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-runtime.js +146 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-script-leases.js +58 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-tool-boundary.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/extension-version-check.js +54 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan-types.js +1 -0
- package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +261 -185
- package/dist/extensions/agent-browser/lib/orchestration/input-redaction.js +62 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-config.js +144 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-root-launch.js +77 -0
- package/dist/extensions/agent-browser/lib/orchestration/native-session-defaults.js +210 -157
- package/dist/extensions/agent-browser/lib/orchestration/operation-paths.js +124 -58
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +197 -99
- package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +199 -96
- package/dist/extensions/agent-browser/lib/owned-managed-session-context.js +55 -0
- package/dist/extensions/agent-browser/lib/page-target-batch.js +118 -0
- package/dist/extensions/agent-browser/lib/page-target-guards.js +50 -0
- package/dist/extensions/agent-browser/lib/page-target-navigation.js +104 -0
- package/dist/extensions/agent-browser/lib/page-target-validation.js +55 -246
- package/dist/extensions/agent-browser/lib/parsing.js +13 -4
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +133 -68
- package/dist/extensions/agent-browser/lib/playbook.js +16 -12
- package/dist/extensions/agent-browser/lib/process-child.js +284 -0
- package/dist/extensions/agent-browser/lib/process-environment.js +13 -6
- package/dist/extensions/agent-browser/lib/process-errors.js +23 -0
- package/dist/extensions/agent-browser/lib/process-identity.js +47 -15
- package/dist/extensions/agent-browser/lib/process-socket-storage.js +256 -0
- package/dist/extensions/agent-browser/lib/process-stdout.js +74 -0
- package/dist/extensions/agent-browser/lib/process.js +145 -536
- package/dist/extensions/agent-browser/lib/prompt-artifacts.js +287 -0
- package/dist/extensions/agent-browser/lib/prompt-policy.js +15 -194
- package/dist/extensions/agent-browser/lib/read-command.js +41 -0
- package/dist/extensions/agent-browser/lib/read-confirmation.js +131 -68
- package/dist/extensions/agent-browser/lib/recording-reservations.js +118 -45
- package/dist/extensions/agent-browser/lib/redaction-fields.js +75 -0
- package/dist/extensions/agent-browser/lib/redaction-json.js +149 -0
- package/dist/extensions/agent-browser/lib/redaction-url.js +88 -0
- package/dist/extensions/agent-browser/lib/results/action-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/action-recommendations.js +28 -271
- package/dist/extensions/agent-browser/lib/results/artifact-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +96 -94
- package/dist/extensions/agent-browser/lib/results/artifact-recommendations.js +73 -0
- package/dist/extensions/agent-browser/lib/results/categories.js +111 -54
- package/dist/extensions/agent-browser/lib/results/confirmation.js +29 -13
- package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +62 -27
- package/dist/extensions/agent-browser/lib/results/electron-recommendations.js +83 -0
- package/dist/extensions/agent-browser/lib/results/envelope-decoding.js +48 -0
- package/dist/extensions/agent-browser/lib/results/envelope.js +90 -67
- package/dist/extensions/agent-browser/lib/results/evidence-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/failure-recommendations.js +180 -0
- package/dist/extensions/agent-browser/lib/results/network-routes.js +86 -45
- package/dist/extensions/agent-browser/lib/results/network.js +35 -12
- package/dist/extensions/agent-browser/lib/results/next-actions.js +49 -19
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-files.js +320 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-format.js +138 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-images.js +113 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifact-verification.js +145 -0
- package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +99 -555
- package/dist/extensions/agent-browser/lib/results/presentation/batch-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-recording.js +118 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-redaction.js +68 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-rendering.js +135 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-step.js +227 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch-summary.js +91 -0
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +91 -460
- package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +9 -5
- package/dist/extensions/agent-browser/lib/results/presentation/command-presenters.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/common.js +26 -9
- package/dist/extensions/agent-browser/lib/results/presentation/content.js +86 -29
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-a11y.js +67 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-health.js +79 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-identity.js +199 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-logs.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network-actions.js +216 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-network.js +124 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-redaction.js +64 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-storage.js +209 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-stream.js +69 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostic-summary.js +222 -0
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +103 -1052
- package/dist/extensions/agent-browser/lib/results/presentation/early-result.js +70 -0
- package/dist/extensions/agent-browser/lib/results/presentation/errors.js +130 -60
- package/dist/extensions/agent-browser/lib/results/presentation/input-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +60 -145
- package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +147 -88
- package/dist/extensions/agent-browser/lib/results/presentation/notices.js +75 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/presentation/observation-rendering.js +127 -0
- package/dist/extensions/agent-browser/lib/results/presentation/outcomes.js +120 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-completion.js +77 -0
- package/dist/extensions/agent-browser/lib/results/presentation/output-spill.js +51 -0
- package/dist/extensions/agent-browser/lib/results/presentation/registry.js +116 -240
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +35 -21
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +109 -73
- package/dist/extensions/agent-browser/lib/results/presentation/source.js +109 -0
- package/dist/extensions/agent-browser/lib/results/presentation.js +17 -261
- package/dist/extensions/agent-browser/lib/results/recommendation-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/results/recording.js +52 -14
- package/dist/extensions/agent-browser/lib/results/recovery-actions.js +14 -5
- package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +30 -22
- package/dist/extensions/agent-browser/lib/results/selector-recovery-target.js +83 -0
- package/dist/extensions/agent-browser/lib/results/selector-recovery.js +119 -119
- package/dist/extensions/agent-browser/lib/results/snapshot-compact.js +266 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-content.js +32 -0
- package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +104 -71
- package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +31 -11
- package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +125 -66
- package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +26 -7
- package/dist/extensions/agent-browser/lib/results/snapshot.js +28 -248
- package/dist/extensions/agent-browser/lib/results/text.js +16 -5
- package/dist/extensions/agent-browser/lib/runtime-args-validation.js +133 -0
- package/dist/extensions/agent-browser/lib/runtime-compatibility.js +81 -0
- package/dist/extensions/agent-browser/lib/runtime-contracts.js +1 -0
- package/dist/extensions/agent-browser/lib/runtime-redaction.js +118 -0
- package/dist/extensions/agent-browser/lib/runtime-replay-events.js +144 -0
- package/dist/extensions/agent-browser/lib/runtime-session-identity.js +76 -0
- package/dist/extensions/agent-browser/lib/runtime-session-plan.js +114 -0
- package/dist/extensions/agent-browser/lib/runtime-session-replay.js +123 -0
- package/dist/extensions/agent-browser/lib/runtime-tab-correction.js +65 -0
- package/dist/extensions/agent-browser/lib/runtime-timeouts.js +28 -0
- package/dist/extensions/agent-browser/lib/runtime.js +137 -1041
- package/dist/extensions/agent-browser/lib/session-identity.js +51 -0
- package/dist/extensions/agent-browser/lib/session-page-observation.js +357 -0
- package/dist/extensions/agent-browser/lib/session-page-state.js +178 -333
- package/dist/extensions/agent-browser/lib/session-page-types.js +1 -0
- package/dist/extensions/agent-browser/lib/temp-artifact-budget.js +81 -0
- package/dist/extensions/agent-browser/lib/temp-mutation-queue.js +7 -0
- package/dist/extensions/agent-browser/lib/temp-root-ownership.js +234 -0
- package/dist/extensions/agent-browser/lib/temp-root.js +211 -0
- package/dist/extensions/agent-browser/lib/temp.js +33 -446
- package/dist/extensions/agent-browser/lib/tool-surface.js +94 -24
- package/dist/extensions/agent-browser/lib/upstream-version.js +3 -2
- package/dist/extensions/agent-browser/lib/web-search-providers.js +193 -0
- package/dist/extensions/agent-browser/lib/web-search-request.js +102 -0
- package/dist/extensions/agent-browser/lib/web-search-results.js +281 -0
- package/dist/extensions/agent-browser/lib/web-search-schema.js +82 -0
- package/dist/extensions/agent-browser/lib/web-search.js +124 -614
- package/dist/extensions/agent-browser/lib/webmcp-observation.js +13 -6
- package/dist/extensions/agent-browser/lib/windows-stock-launcher.js +63 -37
- package/dist/extensions/agent-browser/script-worker.js +80 -43
- package/dist/scripts/agent-browser-target.mjs +4 -2
- package/docs/ARCHITECTURE.md +19 -6
- package/docs/CODE_QUALITY.md +267 -0
- package/docs/COMMAND_REFERENCE.md +272 -241
- package/docs/ELECTRON.md +77 -46
- package/docs/REFERENCE.md +869 -0
- package/docs/RELEASE.md +25 -22
- package/docs/REQUIREMENTS.md +2 -1
- package/docs/SUPPORT_MATRIX.md +81 -79
- package/docs/TOOL_CONTRACT.md +158 -125
- package/docs/platform-smoke.md +8 -8
- package/package.json +144 -120
- package/scripts/agent-browser-capability-baseline.mjs +361 -957
- package/scripts/agent-browser-target.mjs +6 -2
- package/scripts/build.mjs +37 -8
- package/scripts/capability-core-commands.mjs +193 -0
- package/scripts/capability-options.mjs +283 -0
- package/scripts/capability-samples.mjs +133 -0
- package/scripts/capability-section.mjs +11 -0
- package/scripts/config.mjs +235 -132
- package/scripts/convert-browser-session.mjs +30 -9
- package/scripts/doctor-sources.mjs +195 -0
- package/scripts/doctor.mjs +94 -249
- package/scripts/platform-smoke/artifacts.mjs +38 -11
- package/scripts/platform-smoke/commands.mjs +104 -0
- package/scripts/platform-smoke/crabbox-runner.mjs +167 -80
- package/scripts/platform-smoke/doctor-support.mjs +157 -0
- package/scripts/platform-smoke/doctor-windows.mjs +230 -0
- package/scripts/platform-smoke/doctor.mjs +212 -320
- package/scripts/platform-smoke/lease-evidence.mjs +132 -0
- package/scripts/platform-smoke/linux-image/Dockerfile +8 -2
- package/scripts/platform-smoke/suite-checks.mjs +98 -0
- package/scripts/platform-smoke/suite-evidence.mjs +281 -0
- package/scripts/platform-smoke/targets.mjs +154 -472
- package/scripts/platform-smoke.mjs +55 -40
- package/scripts/prepare.mjs +16 -7
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { isAgentBrowserBatchResultArray } from "./batch.js";
|
|
2
|
+
import { redactModelFacingText } from "./common.js";
|
|
3
|
+
import { redactPresentationData } from "./diagnostics.js";
|
|
4
|
+
import { buildErrorPresentation } from "./errors.js";
|
|
5
|
+
import { compactLargePresentationOutput } from "./large-output.js";
|
|
6
|
+
import { stringifyUnknown } from "../text.js";
|
|
7
|
+
function getNativeTextSummary(text) {
|
|
8
|
+
const first = text.split("\n", 1).at(0);
|
|
9
|
+
return first !== undefined && first.length > 0 ? first : "Native text command completed.";
|
|
10
|
+
}
|
|
11
|
+
export function sanitizeModelFacingPresentation(presentation) {
|
|
12
|
+
return {
|
|
13
|
+
...presentation,
|
|
14
|
+
content: presentation.content.map((item) => item.type === "text" ? { ...item, text: redactModelFacingText(item.text) } : item),
|
|
15
|
+
summary: redactModelFacingText(presentation.summary),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async function buildNativeTextPresentation(options, commandInfo) {
|
|
19
|
+
const value = redactPresentationData(commandInfo, typeof options.envelope?.data === "string" ? options.envelope.data : "", options.stdin);
|
|
20
|
+
const text = typeof value === "string" ? value : stringifyUnknown(value);
|
|
21
|
+
const failure = options.errorText !== undefined && options.errorText.length > 0
|
|
22
|
+
? buildErrorPresentation({
|
|
23
|
+
args: options.args,
|
|
24
|
+
commandInfo: options.commandInfo,
|
|
25
|
+
errorText: options.errorText,
|
|
26
|
+
sessionName: options.sessionName,
|
|
27
|
+
})
|
|
28
|
+
: undefined;
|
|
29
|
+
const presentation = {
|
|
30
|
+
...failure,
|
|
31
|
+
content: options.modelVisible === false
|
|
32
|
+
? []
|
|
33
|
+
: [{ type: "text", text: [options.errorText, text].filter(Boolean).join("\n\n") }],
|
|
34
|
+
data: text,
|
|
35
|
+
summary: failure?.summary ?? getNativeTextSummary(text),
|
|
36
|
+
};
|
|
37
|
+
return sanitizeModelFacingPresentation(options.modelVisible === false
|
|
38
|
+
? presentation
|
|
39
|
+
: await compactLargePresentationOutput({
|
|
40
|
+
artifactManifest: options.artifactManifest,
|
|
41
|
+
commandInfo: options.commandInfo,
|
|
42
|
+
data: presentation.data,
|
|
43
|
+
persistentArtifactStore: options.persistentArtifactStore,
|
|
44
|
+
presentation,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
export async function buildEarlyPresentation(options, commands) {
|
|
48
|
+
if (options.textOutput === true) {
|
|
49
|
+
return buildNativeTextPresentation(options, commands.commandInfo);
|
|
50
|
+
}
|
|
51
|
+
const recordingBatch = options.commandInfo.command === "batch" &&
|
|
52
|
+
isAgentBrowserBatchResultArray(options.envelope?.data) &&
|
|
53
|
+
options.envelope.data.some((row) => row.command?.[0] === "record");
|
|
54
|
+
if (options.errorText !== undefined &&
|
|
55
|
+
options.errorText.length > 0 &&
|
|
56
|
+
options.commandInfo.command !== "record" &&
|
|
57
|
+
!recordingBatch) {
|
|
58
|
+
return {
|
|
59
|
+
...buildErrorPresentation({
|
|
60
|
+
args: options.args,
|
|
61
|
+
commandInfo: options.commandInfo,
|
|
62
|
+
errorText: options.errorText,
|
|
63
|
+
presentationCommand: commands.presentationCommandInfo.command,
|
|
64
|
+
sessionName: options.sessionName,
|
|
65
|
+
}),
|
|
66
|
+
data: redactPresentationData(commands.commandInfo, options.envelope?.data),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { isOpenNavigationCommand } from "../../command-taxonomy.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isRecord } from "../../parsing.js";
|
|
3
|
+
import { extractUpstreamCommandTokens } from "../../argv-descriptor.js";
|
|
4
|
+
import { redactSensitiveText } from "../../runtime-redaction.js";
|
|
3
5
|
import { buildBrowserProfileConfigRecovery } from "./browser-profile-recovery.js";
|
|
4
6
|
import { redactModelFacingText } from "./common.js";
|
|
5
7
|
import { buildAgentBrowserNextActions } from "../action-recommendations.js";
|
|
@@ -23,13 +25,11 @@ const KEYBOARD_PRESS_ERROR_HINT = [
|
|
|
23
25
|
"Agent-browser keyboard hint: upstream keyboard commands are `keyboard type <text>` and `keyboard inserttext <text>`; `keyboard press` is not a supported subcommand in the targeted upstream version.",
|
|
24
26
|
'For Enter in text fields, use `keyboard type "\\n"` after focusing the intended control, then verify with a fresh snapshot, URL, or page-state check.',
|
|
25
27
|
].join(" ");
|
|
26
|
-
function isRecord(value) {
|
|
27
|
-
return typeof value === "object" && value !== null;
|
|
28
|
-
}
|
|
29
28
|
function getSelectorRecoveryHint(errorText) {
|
|
30
29
|
const normalized = errorText.trim();
|
|
31
|
-
if (normalized.length === 0)
|
|
30
|
+
if (normalized.length === 0) {
|
|
32
31
|
return undefined;
|
|
32
|
+
}
|
|
33
33
|
if (/\bUnknown ref\b|\bstale ref\b|\bref\b.*\b(?:not found|missing|expired)\b/i.test(normalized)) {
|
|
34
34
|
return STALE_REF_ERROR_HINT;
|
|
35
35
|
}
|
|
@@ -45,90 +45,143 @@ function getSelectorRecoveryHint(errorText) {
|
|
|
45
45
|
return undefined;
|
|
46
46
|
}
|
|
47
47
|
function getClipboardPermissionHint(commandInfo, errorText) {
|
|
48
|
-
if (commandInfo.command !== "clipboard")
|
|
48
|
+
if (commandInfo.command !== "clipboard") {
|
|
49
49
|
return undefined;
|
|
50
|
+
}
|
|
50
51
|
if (!/\bNotAllowedError\b|\bclipboard\b.*\bpermission denied\b|\bpermission denied\b.*\bclipboard\b/i.test(errorText)) {
|
|
51
52
|
return undefined;
|
|
52
53
|
}
|
|
53
54
|
return CLIPBOARD_PERMISSION_ERROR_HINT;
|
|
54
55
|
}
|
|
55
56
|
function getKeyboardPressHint(commandInfo, errorText) {
|
|
56
|
-
if (commandInfo.command !== "keyboard" || commandInfo.subcommand !== "press")
|
|
57
|
+
if (commandInfo.command !== "keyboard" || commandInfo.subcommand !== "press") {
|
|
57
58
|
return undefined;
|
|
58
|
-
|
|
59
|
+
}
|
|
60
|
+
if (!/\bunknown\s+subcommand\b|\bvalid options?\b/i.test(errorText)) {
|
|
59
61
|
return undefined;
|
|
62
|
+
}
|
|
60
63
|
return KEYBOARD_PRESS_ERROR_HINT;
|
|
61
64
|
}
|
|
62
65
|
export function isOverlayBlockedClickError(command, errorText, args) {
|
|
63
66
|
const tokens = args ? extractUpstreamCommandTokens(args) : [];
|
|
64
67
|
const action = tokens[0] === "find"
|
|
65
|
-
? tokens[tokens[1] === "nth" ? 4 : 3] ?? "click"
|
|
66
|
-
: tokens[0] ?? command;
|
|
67
|
-
return action === "click" &&
|
|
68
|
+
? (tokens[tokens[1] === "nth" ? 4 : 3] ?? "click")
|
|
69
|
+
: (tokens[0] ?? command);
|
|
70
|
+
return (action === "click" &&
|
|
71
|
+
errorText !== undefined &&
|
|
72
|
+
/\bis covered by\b[\s\S]*\bat its click point\b/i.test(errorText));
|
|
68
73
|
}
|
|
69
74
|
export function redactClipboardPermissionEcho(commandInfo, errorText) {
|
|
70
|
-
if (commandInfo.command !== "clipboard")
|
|
75
|
+
if (commandInfo.command !== "clipboard") {
|
|
71
76
|
return errorText;
|
|
77
|
+
}
|
|
72
78
|
return errorText
|
|
73
79
|
.replace(/(\b(?:read|write)\s+permission denied\b(?:\s+for)?\s+)([\s\S]+)$/gi, "$1[REDACTED]")
|
|
74
80
|
.replace(/(\bFailed to execute '[^']+' on 'Clipboard':\s*)([\s\S]+)$/gi, (match, prefix, suffix) => {
|
|
75
|
-
if (!/\bpermission denied\b/i.test(suffix))
|
|
81
|
+
if (!/\bpermission denied\b/i.test(suffix)) {
|
|
76
82
|
return match;
|
|
83
|
+
}
|
|
77
84
|
return `${prefix}${suffix.replace(/(\bpermission denied\b(?:\s+for)?\s+)([\s\S]+)$/i, "$1[REDACTED]")}`;
|
|
78
85
|
});
|
|
79
86
|
}
|
|
80
87
|
export function getClipboardWritePayloadCandidates(commandTokens) {
|
|
81
|
-
if (commandTokens[0] !== "clipboard" || commandTokens[1] !== "write")
|
|
88
|
+
if (commandTokens[0] !== "clipboard" || commandTokens[1] !== "write") {
|
|
82
89
|
return [];
|
|
90
|
+
}
|
|
83
91
|
const payloadTokens = commandTokens.slice(2).filter((value) => value.length > 0);
|
|
84
|
-
return [
|
|
92
|
+
return [
|
|
93
|
+
...new Set([...payloadTokens, payloadTokens.join(" ")].filter((value) => value.length > 0)),
|
|
94
|
+
];
|
|
85
95
|
}
|
|
86
96
|
function shouldRedactClipboardPayloadField(key, value, payloadCandidates) {
|
|
87
97
|
return payloadCandidates.some((candidate) => {
|
|
88
|
-
if (value === candidate)
|
|
98
|
+
if (value === candidate) {
|
|
89
99
|
return true;
|
|
90
|
-
|
|
100
|
+
}
|
|
101
|
+
if (candidate.length < 8 || !/payload|clipboard|argument/i.test(key)) {
|
|
91
102
|
return false;
|
|
103
|
+
}
|
|
92
104
|
return value.includes(candidate);
|
|
93
105
|
});
|
|
94
106
|
}
|
|
95
107
|
export function redactClipboardPermissionErrorValue(commandInfo, value, payloadCandidates = []) {
|
|
96
|
-
if (commandInfo.command !== "clipboard")
|
|
108
|
+
if (commandInfo.command !== "clipboard") {
|
|
97
109
|
return value;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
}
|
|
111
|
+
if (typeof value === "string") {
|
|
112
|
+
return payloadCandidates.includes(value)
|
|
113
|
+
? "[REDACTED]"
|
|
114
|
+
: redactClipboardPermissionEcho(commandInfo, value);
|
|
115
|
+
}
|
|
116
|
+
if (Array.isArray(value)) {
|
|
101
117
|
return value.map((item) => redactClipboardPermissionErrorValue(commandInfo, item, payloadCandidates));
|
|
102
|
-
|
|
118
|
+
}
|
|
119
|
+
if (!isRecord(value)) {
|
|
103
120
|
return value;
|
|
121
|
+
}
|
|
104
122
|
return Object.fromEntries(Object.entries(value).map(([key, entryValue]) => [
|
|
105
123
|
key,
|
|
106
|
-
typeof entryValue === "string" &&
|
|
124
|
+
typeof entryValue === "string" &&
|
|
125
|
+
shouldRedactClipboardPayloadField(key, entryValue, payloadCandidates)
|
|
107
126
|
? "[REDACTED]"
|
|
108
127
|
: redactClipboardPermissionErrorValue(commandInfo, entryValue, payloadCandidates),
|
|
109
128
|
]));
|
|
110
129
|
}
|
|
111
130
|
const UNKNOWN_COMMAND_SUGGESTIONS = {
|
|
112
|
-
attr: [
|
|
131
|
+
attr: [
|
|
132
|
+
{
|
|
133
|
+
description: "Use `get attr <selector> <name>` to read an attribute from a selector or current `@ref`.",
|
|
134
|
+
},
|
|
135
|
+
],
|
|
113
136
|
count: [{ description: "Use `get count <selector>` to count matching elements." }],
|
|
114
|
-
html: [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
137
|
+
html: [
|
|
138
|
+
{
|
|
139
|
+
description: "Use `get html <selector>` to read element HTML from a selector or current `@ref`; use `get html body` when you need whole-page body HTML.",
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
text: [
|
|
143
|
+
{
|
|
144
|
+
description: "Use `get text <selector>` to read text from a selector or current `@ref`; run `snapshot -i` first when you need a safe `@ref`.",
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
title: [
|
|
148
|
+
{
|
|
149
|
+
args: ["get", "title"],
|
|
150
|
+
description: "Use `get title` to read the current page title.",
|
|
151
|
+
id: "use-get-title",
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
url: [
|
|
155
|
+
{
|
|
156
|
+
args: ["get", "url"],
|
|
157
|
+
description: "Use `get url` to read the current page URL.",
|
|
158
|
+
id: "use-get-url",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
value: [
|
|
162
|
+
{
|
|
163
|
+
description: "Use `get value <selector>` to read form control value from a selector or current `@ref`.",
|
|
164
|
+
},
|
|
165
|
+
],
|
|
119
166
|
};
|
|
120
167
|
function getUnknownCommandSuggestions(command, errorText) {
|
|
121
|
-
if (
|
|
168
|
+
if (command === undefined || command.length === 0) {
|
|
122
169
|
return [];
|
|
170
|
+
}
|
|
123
171
|
const normalizedCommand = command.trim().toLowerCase();
|
|
124
|
-
if (!/\bunknown\s+command\b|\bunknown\s+subcommand\b|\bunrecognized\s+command\b/i.test(errorText))
|
|
172
|
+
if (!/\bunknown\s+command\b|\bunknown\s+subcommand\b|\bunrecognized\s+command\b/i.test(errorText)) {
|
|
125
173
|
return [];
|
|
174
|
+
}
|
|
126
175
|
return UNKNOWN_COMMAND_SUGGESTIONS[normalizedCommand] ?? [];
|
|
127
176
|
}
|
|
128
177
|
function formatUnknownCommandSuggestionText(suggestions) {
|
|
129
|
-
if (suggestions.length === 0)
|
|
178
|
+
if (suggestions.length === 0) {
|
|
130
179
|
return undefined;
|
|
131
|
-
|
|
180
|
+
}
|
|
181
|
+
return [
|
|
182
|
+
"Agent-browser hint: This looks like a getter shortcut, but upstream getter commands are grouped under `get`.",
|
|
183
|
+
...suggestions.map((suggestion) => suggestion.description),
|
|
184
|
+
].join(" ");
|
|
132
185
|
}
|
|
133
186
|
function buildUnknownCommandSuggestionActions(suggestions, sessionName) {
|
|
134
187
|
const actions = suggestions
|
|
@@ -143,10 +196,14 @@ function buildUnknownCommandSuggestionActions(suggestions, sessionName) {
|
|
|
143
196
|
return actions.length > 0 ? actions : undefined;
|
|
144
197
|
}
|
|
145
198
|
function getLocalhostNavigationHint(commandInfo, errorText) {
|
|
146
|
-
if (!
|
|
199
|
+
if (!isOpenNavigationCommand(commandInfo.command) ||
|
|
200
|
+
commandInfo.subcommand === undefined ||
|
|
201
|
+
commandInfo.subcommand.length === 0) {
|
|
147
202
|
return undefined;
|
|
148
|
-
|
|
203
|
+
}
|
|
204
|
+
if (!/\bnet::ERR_(?:EMPTY_RESPONSE|CONNECTION_REFUSED|ADDRESS_UNREACHABLE|TIMED_OUT|CONNECTION_RESET)\b/i.test(errorText)) {
|
|
149
205
|
return undefined;
|
|
206
|
+
}
|
|
150
207
|
let targetUrl;
|
|
151
208
|
try {
|
|
152
209
|
targetUrl = new URL(commandInfo.subcommand);
|
|
@@ -154,8 +211,9 @@ function getLocalhostNavigationHint(commandInfo, errorText) {
|
|
|
154
211
|
catch {
|
|
155
212
|
return undefined;
|
|
156
213
|
}
|
|
157
|
-
if (!["localhost", "127.0.0.1", "::1", "[::1]"].includes(targetUrl.hostname.toLowerCase()))
|
|
214
|
+
if (!["localhost", "127.0.0.1", "::1", "[::1]"].includes(targetUrl.hostname.toLowerCase())) {
|
|
158
215
|
return undefined;
|
|
216
|
+
}
|
|
159
217
|
return [
|
|
160
218
|
"Agent-browser local fixture hint: the browser process could not read a loopback URL from its own network namespace or browser host.",
|
|
161
219
|
"Verify the server is still running and bound to an address the browser host can reach; if curl works from the shell but browser navigation fails, try the other loopback alias, add a proxy bypass for localhost/127.0.0.1 if a proxy is configured, or use a browser-host-reachable URL.",
|
|
@@ -164,29 +222,39 @@ function getLocalhostNavigationHint(commandInfo, errorText) {
|
|
|
164
222
|
}
|
|
165
223
|
export function appendSelectorRecoveryHint(errorText) {
|
|
166
224
|
const hint = getSelectorRecoveryHint(errorText);
|
|
167
|
-
if (
|
|
225
|
+
if (hint === undefined || hint.length === 0 || errorText.includes("Agent-browser hint:")) {
|
|
168
226
|
return errorText;
|
|
227
|
+
}
|
|
169
228
|
return `${errorText}\n\n${hint}`;
|
|
170
229
|
}
|
|
230
|
+
function buildHintedErrorText(commandInfo, errorText, unknownSuggestion, profileHint) {
|
|
231
|
+
const selectorHinted = appendSelectorRecoveryHint(errorText);
|
|
232
|
+
return [
|
|
233
|
+
selectorHinted,
|
|
234
|
+
unknownSuggestion !== undefined &&
|
|
235
|
+
unknownSuggestion.length > 0 &&
|
|
236
|
+
!selectorHinted.includes("Agent-browser hint:")
|
|
237
|
+
? unknownSuggestion
|
|
238
|
+
: undefined,
|
|
239
|
+
profileHint,
|
|
240
|
+
getLocalhostNavigationHint(commandInfo, errorText),
|
|
241
|
+
getClipboardPermissionHint(commandInfo, errorText),
|
|
242
|
+
getKeyboardPressHint(commandInfo, errorText),
|
|
243
|
+
]
|
|
244
|
+
.filter((part) => part !== undefined && part.length > 0)
|
|
245
|
+
.join("\n\n");
|
|
246
|
+
}
|
|
171
247
|
export function buildErrorPresentation(options) {
|
|
172
248
|
const { args, commandInfo, errorText, presentationCommand, sessionName } = options;
|
|
173
249
|
const safeErrorText = redactModelFacingText(redactSensitiveText(redactClipboardPermissionEcho(commandInfo, errorText)));
|
|
174
|
-
const selectorHintedErrorText = appendSelectorRecoveryHint(safeErrorText);
|
|
175
250
|
const unknownCommandSuggestions = getUnknownCommandSuggestions(commandInfo.command, safeErrorText);
|
|
176
251
|
const unknownCommandSuggestionText = formatUnknownCommandSuggestionText(unknownCommandSuggestions);
|
|
177
|
-
const browserProfileConfigRecovery = buildBrowserProfileConfigRecovery({
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
unknownCommandSuggestionText && !selectorHintedErrorText.includes("Agent-browser hint:") ? unknownCommandSuggestionText : undefined,
|
|
184
|
-
browserProfileConfigRecovery?.hint,
|
|
185
|
-
localhostNavigationHint,
|
|
186
|
-
clipboardPermissionHint,
|
|
187
|
-
keyboardPressHint,
|
|
188
|
-
].filter((part) => Boolean(part));
|
|
189
|
-
const hintedErrorText = hintedErrorParts.join("\n\n");
|
|
252
|
+
const browserProfileConfigRecovery = buildBrowserProfileConfigRecovery({
|
|
253
|
+
args,
|
|
254
|
+
commandInfo,
|
|
255
|
+
errorText: safeErrorText,
|
|
256
|
+
});
|
|
257
|
+
const hintedErrorText = buildHintedErrorText(commandInfo, safeErrorText, unknownCommandSuggestionText, browserProfileConfigRecovery?.hint);
|
|
190
258
|
const categoryDetails = buildAgentBrowserResultCategoryDetails({
|
|
191
259
|
args: [commandInfo.command, commandInfo.subcommand].filter((item) => item !== undefined),
|
|
192
260
|
command: commandInfo.command,
|
|
@@ -196,15 +264,17 @@ export function buildErrorPresentation(options) {
|
|
|
196
264
|
const nextActions = [
|
|
197
265
|
...(buildUnknownCommandSuggestionActions(unknownCommandSuggestions, sessionName) ?? []),
|
|
198
266
|
...(browserProfileConfigRecovery?.actions ?? []),
|
|
199
|
-
...(browserProfileConfigRecovery
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
267
|
+
...(browserProfileConfigRecovery
|
|
268
|
+
? []
|
|
269
|
+
: (buildAgentBrowserNextActions({
|
|
270
|
+
args,
|
|
271
|
+
command: commandInfo.command,
|
|
272
|
+
failureCategory: categoryDetails.failureCategory,
|
|
273
|
+
overlayBlockedClick: isOverlayBlockedClickError(presentationCommand ?? commandInfo.command, safeErrorText, args ?? commandInfo.commandTokens),
|
|
274
|
+
resultCategory: "failure",
|
|
275
|
+
sessionName,
|
|
276
|
+
subcommand: commandInfo.subcommand,
|
|
277
|
+
}) ?? [])),
|
|
208
278
|
];
|
|
209
279
|
return {
|
|
210
280
|
...categoryDetails,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { buildEvictedSessionArtifactEntries } from "../artifact-manifest.js";
|
|
3
|
-
import { countLines, truncateText } from "../text.js";
|
|
1
|
+
import { countLines, stringifyUnknown, truncateText } from "../text.js";
|
|
4
2
|
import { applyArtifactManifest } from "./artifacts.js";
|
|
5
|
-
import { getPresentationText
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const LARGE_OUTPUT_PREVIEW_MAX_CHARS = 2_500;
|
|
10
|
-
const LARGE_OUTPUT_PREVIEW_MAX_LINES = 40;
|
|
11
|
-
const LARGE_OUTPUT_PREVIEW_MAX_LINE_CHARS = 240;
|
|
12
|
-
const LARGE_OUTPUT_FAILURE_COMMAND_MAX_CHARS = 240;
|
|
13
|
-
const LARGE_OUTPUT_FILE_PREFIX = "pi-agent-browser-output";
|
|
3
|
+
import { getPresentationText } from "./content.js";
|
|
4
|
+
import { buildSpillArtifactEntries, writeLargeOutputSpillFile, } from "./output-spill.js";
|
|
5
|
+
export { OBSERVATION_INLINE_MAX_CHARS } from "./content.js";
|
|
6
|
+
export { renderAgentBrowserObservation } from "./observation-rendering.js";
|
|
14
7
|
function shouldCompactLargeOutput(text) {
|
|
15
|
-
return text.length >
|
|
8
|
+
return text.length > 8_000 || countLines(text) > 120;
|
|
16
9
|
}
|
|
17
10
|
function buildLargeOutputPreview(text) {
|
|
18
11
|
const lines = text.split("\n");
|
|
19
12
|
const previewLines = [];
|
|
20
13
|
let previewChars = 0;
|
|
21
14
|
for (const line of lines) {
|
|
22
|
-
if (previewLines.length >=
|
|
15
|
+
if (previewLines.length >= 40 || previewChars >= 2_500) {
|
|
23
16
|
break;
|
|
24
17
|
}
|
|
25
|
-
const remainingChars =
|
|
26
|
-
const previewLine = truncateText(line, Math.min(Math.max(40, remainingChars),
|
|
18
|
+
const remainingChars = 2_500 - previewChars;
|
|
19
|
+
const previewLine = truncateText(line, Math.min(Math.max(40, remainingChars), 240));
|
|
27
20
|
previewLines.push(previewLine);
|
|
28
21
|
previewChars += previewLine.length + 1;
|
|
29
22
|
}
|
|
@@ -34,132 +27,44 @@ function buildLargeOutputPreview(text) {
|
|
|
34
27
|
}
|
|
35
28
|
function buildLargeOutputFailureContext(presentation) {
|
|
36
29
|
const failure = presentation.batchFailure;
|
|
37
|
-
if (!failure)
|
|
30
|
+
if (!failure) {
|
|
38
31
|
return [];
|
|
32
|
+
}
|
|
39
33
|
const failedStep = failure.failedStep;
|
|
40
|
-
const commandText = truncateText(failedStep.commandText,
|
|
34
|
+
const commandText = truncateText(failedStep.commandText, 240);
|
|
41
35
|
const lines = [
|
|
42
36
|
"Failure context:",
|
|
43
37
|
`- First failing step: ${failedStep.index + 1} — ${commandText}`,
|
|
44
38
|
`- Batch result: ${failure.successCount}/${failure.totalCount} succeeded${failure.failureCount > 1 ? `; ${failure.failureCount} failed` : ""}`,
|
|
45
39
|
];
|
|
46
|
-
if (failedStep.failureCategory)
|
|
40
|
+
if (failedStep.failureCategory !== undefined) {
|
|
47
41
|
lines.push(`- Failure category: ${failedStep.failureCategory}`);
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
}
|
|
43
|
+
const failureText = (failedStep.text.length > 0 ? failedStep.text : failedStep.summary)
|
|
44
|
+
.replace(/\s+/g, " ")
|
|
45
|
+
.trim();
|
|
46
|
+
if (failureText.length > 0) {
|
|
50
47
|
lines.push(`- Failure detail: ${truncateText(failureText, 700)}`);
|
|
48
|
+
}
|
|
51
49
|
const stepPaths = [failedStep.fullOutputPath, ...(failedStep.fullOutputPaths ?? [])].filter((path, index, paths) => typeof path === "string" && path.length > 0 && paths.indexOf(path) === index);
|
|
52
|
-
if (stepPaths.length > 0)
|
|
50
|
+
if (stepPaths.length > 0) {
|
|
53
51
|
lines.push(`- Failed-step spill path${stepPaths.length === 1 ? "" : "s"}: ${stepPaths.join(", ")}`);
|
|
54
|
-
return lines;
|
|
55
|
-
}
|
|
56
|
-
async function writeLargeOutputSpillFile(options) {
|
|
57
|
-
const payload = typeof options.data === "string"
|
|
58
|
-
? redactModelFacingText(options.data)
|
|
59
|
-
: typeof options.data === "number" || typeof options.data === "boolean"
|
|
60
|
-
? String(options.data)
|
|
61
|
-
: options.data === undefined
|
|
62
|
-
? redactModelFacingText(options.text)
|
|
63
|
-
: stringifyModelFacing(options.data);
|
|
64
|
-
const isStructuredPayload = typeof options.data !== "string" && typeof options.data !== "number" && typeof options.data !== "boolean";
|
|
65
|
-
const fileOptions = {
|
|
66
|
-
content: payload,
|
|
67
|
-
prefix: LARGE_OUTPUT_FILE_PREFIX,
|
|
68
|
-
suffix: isStructuredPayload ? ".json" : ".txt",
|
|
69
|
-
};
|
|
70
|
-
if (options.persistentArtifactStore) {
|
|
71
|
-
const result = await writePersistentSessionArtifactFile({ ...fileOptions, store: options.persistentArtifactStore });
|
|
72
|
-
return { ...result, storageScope: "persistent-session" };
|
|
73
52
|
}
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
function buildSpillArtifactEntries(options) {
|
|
77
|
-
const nowMs = Date.now();
|
|
78
|
-
return [
|
|
79
|
-
{
|
|
80
|
-
command: options.commandInfo.command,
|
|
81
|
-
createdAtMs: nowMs,
|
|
82
|
-
kind: "spill",
|
|
83
|
-
path: options.path,
|
|
84
|
-
retentionState: options.storageScope === "persistent-session" ? "live" : "ephemeral",
|
|
85
|
-
storageScope: options.storageScope,
|
|
86
|
-
subcommand: options.commandInfo.subcommand,
|
|
87
|
-
},
|
|
88
|
-
...buildEvictedSessionArtifactEntries(options.evictedArtifacts, nowMs),
|
|
89
|
-
];
|
|
90
|
-
}
|
|
91
|
-
export { OBSERVATION_INLINE_MAX_CHARS } from "./content.js";
|
|
92
|
-
/** Bound the final model-visible result, after recovery/diagnostic assembly. Never truncate executable actions. */
|
|
93
|
-
export async function renderAgentBrowserObservation(options) {
|
|
94
|
-
const observation = projectAgentBrowserObservation(options.details, options.succeeded);
|
|
95
|
-
let structuredContent = observation;
|
|
96
|
-
const images = options.content.filter(part => part.type === "image");
|
|
97
|
-
const prose = options.content.filter(part => part.type === "text").map(part => part.text).join("\n\n");
|
|
98
|
-
const { data: _data, error: _error, summary: _summary, ...metadata } = observation;
|
|
99
|
-
let text = options.json ? JSON.stringify(observation, null, 2) : `${prose}\n\nObservation: ${JSON.stringify(metadata)}`;
|
|
100
|
-
let artifactManifest = options.details.artifactManifest;
|
|
101
|
-
if (text.length > OBSERVATION_INLINE_MAX_CHARS || JSON.stringify(observation).length > OBSERVATION_INLINE_MAX_CHARS) {
|
|
102
|
-
let spill;
|
|
103
|
-
let spillError;
|
|
104
|
-
try {
|
|
105
|
-
const write = () => writeLargeOutputSpillFile({ data: { ...observation, ...(!options.json ? { text: prose } : {}) }, persistentArtifactStore: options.persistentArtifactStore, text });
|
|
106
|
-
spill = await (options.withArtifactWrite ? options.withArtifactWrite(write) : write());
|
|
107
|
-
artifactManifest = applyArtifactManifest({ content: [], summary: "" }, artifactManifest, buildSpillArtifactEntries({
|
|
108
|
-
commandInfo: { command: typeof options.details.command === "string" ? options.details.command : undefined },
|
|
109
|
-
evictedArtifacts: spill.evictedArtifacts, path: spill.path, storageScope: spill.storageScope,
|
|
110
|
-
})).artifactManifest;
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
spillError = error instanceof Error ? error.message : String(error);
|
|
114
|
-
}
|
|
115
|
-
const compact = {
|
|
116
|
-
success: options.succeeded, resultCategory: observation.resultCategory,
|
|
117
|
-
failureCategory: observation.failureCategory, successCategory: observation.successCategory,
|
|
118
|
-
summary: typeof observation.summary === "string" ? truncateText(observation.summary, 700)
|
|
119
|
-
: typeof observation.error === "string" ? truncateText(observation.error, 700) : undefined,
|
|
120
|
-
compacted: true,
|
|
121
|
-
...(spill ? { observationPath: spill.path, retrieve: "Read observationPath for the complete redacted observation, including exact recovery actions and requested data." }
|
|
122
|
-
: { observationUnavailable: truncateText(redactModelFacingText(spillError ?? "Spill could not be written; request a smaller result."), 1_000) }),
|
|
123
|
-
};
|
|
124
|
-
for (const key of ["sessionName", "namespace", "codeRun", "error", "failures", "nextActions", "artifactVerification", "imageObservations", "data", "fullOutputPath", "fullOutputPaths"]) {
|
|
125
|
-
if (observation[key] !== undefined && JSON.stringify({ ...compact, [key]: observation[key] }, null, 2).length <= OBSERVATION_INLINE_MAX_CHARS - 500)
|
|
126
|
-
compact[key] = observation[key];
|
|
127
|
-
}
|
|
128
|
-
structuredContent = compact;
|
|
129
|
-
if (options.preserveContent)
|
|
130
|
-
text = prose;
|
|
131
|
-
else {
|
|
132
|
-
text = JSON.stringify(compact, null, 2);
|
|
133
|
-
if (!options.json)
|
|
134
|
-
text = `Browser observation compacted.\n${text}`;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return { content: [{ type: "text", text }, ...images], artifactManifest, structuredContent: JSON.parse(JSON.stringify(structuredContent)) };
|
|
53
|
+
return lines;
|
|
138
54
|
}
|
|
139
|
-
|
|
140
|
-
const text = getPresentationText(options.presentation);
|
|
141
|
-
if (text.length === 0 || !shouldCompactLargeOutput(text)) {
|
|
142
|
-
return options.presentation;
|
|
143
|
-
}
|
|
144
|
-
let fullOutputPath;
|
|
145
|
-
let spill;
|
|
146
|
-
let spillErrorText;
|
|
55
|
+
async function tryWritePresentationSpill(options) {
|
|
147
56
|
try {
|
|
148
|
-
spill
|
|
149
|
-
data: options.data,
|
|
150
|
-
persistentArtifactStore: options.persistentArtifactStore,
|
|
151
|
-
text,
|
|
152
|
-
});
|
|
153
|
-
fullOutputPath = spill.path;
|
|
57
|
+
return { spill: await writeLargeOutputSpillFile(options) };
|
|
154
58
|
}
|
|
155
59
|
catch (error) {
|
|
156
|
-
|
|
60
|
+
return { error: error instanceof Error ? error.message : stringifyUnknown(error) };
|
|
157
61
|
}
|
|
62
|
+
}
|
|
63
|
+
function buildCompactedText(command, text, presentation, persisted) {
|
|
158
64
|
const { omittedLineCount, previewText } = buildLargeOutputPreview(text);
|
|
159
|
-
const
|
|
160
|
-
const failureContext = buildLargeOutputFailureContext(options.presentation);
|
|
65
|
+
const failureContext = buildLargeOutputFailureContext(presentation);
|
|
161
66
|
const lines = [
|
|
162
|
-
`Large ${
|
|
67
|
+
`Large ${command ?? "agent-browser"} output compacted.`,
|
|
163
68
|
...(failureContext.length > 0 ? ["", ...failureContext] : []),
|
|
164
69
|
"",
|
|
165
70
|
"Preview:",
|
|
@@ -168,35 +73,45 @@ export async function compactLargePresentationOutput(options) {
|
|
|
168
73
|
if (omittedLineCount > 0) {
|
|
169
74
|
lines.push(`- ... (${omittedLineCount} additional lines omitted)`);
|
|
170
75
|
}
|
|
171
|
-
lines.push("",
|
|
172
|
-
? `Full output path: ${
|
|
173
|
-
: `Full output unavailable: ${
|
|
174
|
-
|
|
175
|
-
|
|
76
|
+
lines.push("", persisted.spill
|
|
77
|
+
? `Full output path: ${persisted.spill.path}`
|
|
78
|
+
: `Full output unavailable: ${persisted.error ?? "spill file could not be created."}`);
|
|
79
|
+
return { compactedText: lines.join("\n"), previewText };
|
|
80
|
+
}
|
|
81
|
+
// The presentation owner supplies its mutable assembly draft; compaction preserves that identity.
|
|
82
|
+
function applyCompactedPresentation(draft, text, rendered, persisted) {
|
|
83
|
+
const firstTextIndex = draft.content.findIndex((part) => part.type === "text");
|
|
176
84
|
if (firstTextIndex >= 0) {
|
|
177
|
-
|
|
85
|
+
draft.content[firstTextIndex] = { type: "text", text: rendered.compactedText };
|
|
178
86
|
}
|
|
179
87
|
else {
|
|
180
|
-
|
|
88
|
+
draft.content.unshift({ type: "text", text: rendered.compactedText });
|
|
181
89
|
}
|
|
182
|
-
|
|
90
|
+
draft.data = {
|
|
183
91
|
compacted: true,
|
|
184
|
-
fullOutputPath,
|
|
92
|
+
fullOutputPath: persisted.spill?.path,
|
|
185
93
|
outputCharCount: text.length,
|
|
186
94
|
outputLineCount: countLines(text),
|
|
187
|
-
previewCharCount: previewText.length,
|
|
188
|
-
previewLineCount: countLines(previewText),
|
|
189
|
-
spillError:
|
|
95
|
+
previewCharCount: rendered.previewText.length,
|
|
96
|
+
previewLineCount: countLines(rendered.previewText),
|
|
97
|
+
spillError: persisted.error,
|
|
190
98
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
storageScope: spill.storageScope,
|
|
199
|
-
}));
|
|
99
|
+
draft.fullOutputPath = persisted.spill?.path;
|
|
100
|
+
draft.summary = `${draft.summary} (compact)`;
|
|
101
|
+
}
|
|
102
|
+
export async function compactLargePresentationOutput(options) {
|
|
103
|
+
const text = getPresentationText(options.presentation);
|
|
104
|
+
if (text.length === 0 || !shouldCompactLargeOutput(text)) {
|
|
105
|
+
return options.presentation;
|
|
200
106
|
}
|
|
201
|
-
|
|
107
|
+
const persisted = await tryWritePresentationSpill({
|
|
108
|
+
data: options.data,
|
|
109
|
+
persistentArtifactStore: options.persistentArtifactStore,
|
|
110
|
+
text,
|
|
111
|
+
});
|
|
112
|
+
const rendered = buildCompactedText(options.commandInfo.command, text, options.presentation, persisted);
|
|
113
|
+
applyCompactedPresentation(options.presentation, text, rendered, persisted);
|
|
114
|
+
return persisted.spill
|
|
115
|
+
? applyArtifactManifest(options.presentation, options.presentation.artifactManifest ?? options.artifactManifest, buildSpillArtifactEntries({ ...persisted.spill, commandInfo: options.commandInfo }))
|
|
116
|
+
: options.presentation;
|
|
202
117
|
}
|