pi-agent-browser-native 0.2.77 → 0.5.0
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 +154 -0
- package/README.md +69 -35
- package/dist/extensions/agent-browser/index.js +911 -121
- package/dist/extensions/agent-browser/lib/argv-descriptor.js +35 -8
- package/dist/extensions/agent-browser/lib/argv-grammar.js +48 -7
- package/dist/extensions/agent-browser/lib/batch-lifecycle.js +71 -0
- package/dist/extensions/agent-browser/lib/command-policy.js +1 -6
- package/dist/extensions/agent-browser/lib/command-taxonomy.js +35 -8
- package/dist/extensions/agent-browser/lib/config-policy.js +0 -5
- package/dist/extensions/agent-browser/lib/config.js +0 -6
- package/dist/extensions/agent-browser/lib/electron/cdp.js +6 -7
- package/dist/extensions/agent-browser/lib/electron/cleanup.js +0 -7
- package/dist/extensions/agent-browser/lib/electron/discovery.js +0 -7
- package/dist/extensions/agent-browser/lib/electron/launch.js +0 -7
- package/dist/extensions/agent-browser/lib/input-modes/electron.js +0 -5
- package/dist/extensions/agent-browser/lib/input-modes/job.js +61 -9
- package/dist/extensions/agent-browser/lib/input-modes/lookups.js +2 -7
- package/dist/extensions/agent-browser/lib/input-modes/params.js +23 -29
- package/dist/extensions/agent-browser/lib/input-modes/script.js +462 -0
- package/dist/extensions/agent-browser/lib/input-modes/semantic-action.js +51 -17
- package/dist/extensions/agent-browser/lib/input-modes/shared.js +0 -5
- package/dist/extensions/agent-browser/lib/input-modes/types.js +0 -5
- package/dist/extensions/agent-browser/lib/json-schema.js +0 -5
- package/dist/extensions/agent-browser/lib/launch-scoped-flags.js +12 -5
- package/dist/extensions/agent-browser/lib/managed-session-capabilities.js +0 -2
- package/dist/extensions/agent-browser/lib/managed-session-policy-lock.js +3 -4
- package/dist/extensions/agent-browser/lib/managed-session-restore.js +55 -48
- package/dist/extensions/agent-browser/lib/managed-session-snapshots.js +2 -9
- package/dist/extensions/agent-browser/lib/managed-session-state-policy.js +48 -36
- package/dist/extensions/agent-browser/lib/managed-session-storage.js +50 -29
- package/dist/extensions/agent-browser/lib/navigation-policy.js +0 -5
- package/dist/extensions/agent-browser/lib/orchestration/batch-stdin.js +26 -5
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/artifact-paths.js +110 -30
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/click-dispatch.js +2 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/diagnostics.js +27 -26
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/final-result.js +58 -33
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/index.js +2 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/managed-session-daemon-policy.js +22 -14
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/direct-anchor-download.js +1 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/network-page-filter.js +1 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/scroll-shims.js +1 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare/snapshot-filter.js +1 -1
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/prepare.js +148 -34
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/process-output.js +225 -61
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-state.js +74 -30
- package/dist/extensions/agent-browser/lib/orchestration/electron-host/index.js +47 -26
- package/dist/extensions/agent-browser/lib/orchestration/input-plan.js +40 -19
- package/dist/extensions/agent-browser/lib/orchestration/output-file.js +42 -1
- package/dist/extensions/agent-browser/lib/orchestration/script-mode.js +299 -0
- package/dist/extensions/agent-browser/lib/parsing.js +0 -7
- package/dist/extensions/agent-browser/lib/pi-tool-rendering.js +36 -11
- package/dist/extensions/agent-browser/lib/playbook.js +20 -24
- package/dist/extensions/agent-browser/lib/process-environment.js +14 -0
- package/dist/extensions/agent-browser/lib/process-identity.js +4 -9
- package/dist/extensions/agent-browser/lib/process.js +131 -48
- package/dist/extensions/agent-browser/lib/prompt-policy.js +171 -27
- package/dist/extensions/agent-browser/lib/recording-reservations.js +183 -0
- package/dist/extensions/agent-browser/lib/results/action-recommendations.js +63 -13
- package/dist/extensions/agent-browser/lib/results/artifact-manifest.js +68 -11
- package/dist/extensions/agent-browser/lib/results/categories.js +7 -9
- package/dist/extensions/agent-browser/lib/results/confirmation.js +0 -7
- package/dist/extensions/agent-browser/lib/results/contracts.js +0 -7
- package/dist/extensions/agent-browser/lib/results/editable-ref-evidence.js +0 -7
- package/dist/extensions/agent-browser/lib/results/envelope.js +0 -7
- package/dist/extensions/agent-browser/lib/results/network.js +0 -7
- package/dist/extensions/agent-browser/lib/results/next-actions.js +19 -35
- package/dist/extensions/agent-browser/lib/results/presentation/artifacts.js +85 -44
- package/dist/extensions/agent-browser/lib/results/presentation/batch.js +66 -11
- package/dist/extensions/agent-browser/lib/results/presentation/browser-profile-recovery.js +0 -5
- package/dist/extensions/agent-browser/lib/results/presentation/common.js +18 -5
- package/dist/extensions/agent-browser/lib/results/presentation/content.js +0 -5
- package/dist/extensions/agent-browser/lib/results/presentation/diagnostics.js +7 -6
- package/dist/extensions/agent-browser/lib/results/presentation/errors.js +2 -1
- package/dist/extensions/agent-browser/lib/results/presentation/large-output.js +0 -5
- package/dist/extensions/agent-browser/lib/results/presentation/managed-list-filter.js +0 -5
- package/dist/extensions/agent-browser/lib/results/presentation/navigation.js +26 -16
- package/dist/extensions/agent-browser/lib/results/presentation/registry.js +58 -13
- package/dist/extensions/agent-browser/lib/results/presentation/semantic-action.js +1 -15
- package/dist/extensions/agent-browser/lib/results/presentation/skills.js +0 -5
- package/dist/extensions/agent-browser/lib/results/presentation.js +6 -8
- package/dist/extensions/agent-browser/lib/results/recovery-actions.js +2 -7
- package/dist/extensions/agent-browser/lib/results/recovery-next-actions.js +0 -7
- package/dist/extensions/agent-browser/lib/results/selector-recovery.js +51 -15
- package/dist/extensions/agent-browser/lib/results/snapshot-high-value-controls.js +13 -14
- package/dist/extensions/agent-browser/lib/results/snapshot-refs.js +0 -7
- package/dist/extensions/agent-browser/lib/results/snapshot-segments.js +0 -7
- package/dist/extensions/agent-browser/lib/results/snapshot-spill.js +0 -7
- package/dist/extensions/agent-browser/lib/results/snapshot.js +0 -7
- package/dist/extensions/agent-browser/lib/results/text.js +0 -7
- package/dist/extensions/agent-browser/lib/runtime.js +119 -52
- package/dist/extensions/agent-browser/lib/session-page-state.js +62 -17
- package/dist/extensions/agent-browser/lib/string-enum-schema.js +0 -5
- package/dist/extensions/agent-browser/lib/temp.js +0 -7
- package/dist/extensions/agent-browser/lib/upstream-version.js +14 -0
- package/dist/extensions/agent-browser/lib/web-search.js +0 -5
- package/dist/extensions/agent-browser/script-worker.js +169 -0
- package/dist/scripts/agent-browser-target.mjs +3 -0
- package/docs/ARCHITECTURE.md +50 -31
- package/docs/COMMAND_REFERENCE.md +97 -41
- package/docs/ELECTRON.md +3 -19
- package/docs/RELEASE.md +8 -20
- package/docs/REQUIREMENTS.md +8 -6
- package/docs/SUPPORT_MATRIX.md +32 -25
- package/docs/TOOL_CONTRACT.md +107 -64
- package/docs/platform-smoke.md +1 -1
- package/package.json +7 -6
- package/platform-smoke.config.mjs +2 -2
- package/scripts/agent-browser-capability-baseline.mjs +24 -6
- package/scripts/agent-browser-target.mjs +3 -0
- package/scripts/build.mjs +41 -0
- package/scripts/doctor.mjs +8 -7
- package/scripts/platform-smoke/browser-dogfood-windows.ps1 +9 -3
- package/scripts/platform-smoke/targets.mjs +12 -6
- package/dist/extensions/agent-browser/lib/electron/text.js +0 -13
- package/dist/extensions/agent-browser/lib/input-modes.js +0 -10
- package/dist/extensions/agent-browser/lib/orchestration/browser-run/session-artifacts.js +0 -5
- package/dist/extensions/agent-browser/lib/results/artifact-state.js +0 -13
- package/dist/extensions/agent-browser/lib/results.js +0 -14
package/docs/platform-smoke.md
CHANGED
|
@@ -98,7 +98,7 @@ Each required target runs `platform-build` and `browser-dogfood-smoke` on one Cr
|
|
|
98
98
|
4. Run `npm pack`.
|
|
99
99
|
5. Create a clean target-local Pi project.
|
|
100
100
|
6. Install the packed tarball with `npm install --no-save`.
|
|
101
|
-
7. Run `pi install -l --approve ./node_modules/pi-agent-browser-native` from the clean project so Pi 0.
|
|
101
|
+
7. Run `pi install -l --approve ./node_modules/pi-agent-browser-native` from the clean project so Pi 0.84.0+ trusts the generated project-local settings for that command.
|
|
102
102
|
8. Run `pi list --approve` and assert the package is registered under project packages from the packed install.
|
|
103
103
|
9. Assert the release proof did not use `pi -e .` or `pi --extension .`.
|
|
104
104
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-browser-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "pi extension that exposes agent-browser as a native tool for browser automation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Mitch Fultz (https://github.com/fitchmultz)",
|
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
"scripts/config.mjs",
|
|
37
37
|
"scripts/doctor.mjs",
|
|
38
38
|
"scripts/prepare.mjs",
|
|
39
|
+
"scripts/build.mjs",
|
|
39
40
|
"scripts/agent-browser-capability-baseline.mjs",
|
|
41
|
+
"scripts/agent-browser-target.mjs",
|
|
40
42
|
"scripts/platform-smoke.mjs",
|
|
41
43
|
"scripts/platform-smoke",
|
|
42
44
|
"README.md",
|
|
@@ -63,9 +65,9 @@
|
|
|
63
65
|
"typebox": "*"
|
|
64
66
|
},
|
|
65
67
|
"devDependencies": {
|
|
66
|
-
"@earendil-works/pi-ai": "
|
|
67
|
-
"@earendil-works/pi-coding-agent": "
|
|
68
|
-
"@earendil-works/pi-tui": "
|
|
68
|
+
"@earendil-works/pi-ai": "0.84.0",
|
|
69
|
+
"@earendil-works/pi-coding-agent": "0.84.0",
|
|
70
|
+
"@earendil-works/pi-tui": "0.84.0",
|
|
69
71
|
"@types/node": "^25.9.3",
|
|
70
72
|
"tsx": "^4.21.0",
|
|
71
73
|
"typebox": "^1.1.38",
|
|
@@ -74,12 +76,11 @@
|
|
|
74
76
|
"overrides": {
|
|
75
77
|
"basic-ftp": "6.0.1",
|
|
76
78
|
"esbuild": "0.28.1",
|
|
77
|
-
"protobufjs": "7.6.
|
|
79
|
+
"protobufjs": "7.6.5"
|
|
78
80
|
},
|
|
79
81
|
"scripts": {
|
|
80
82
|
"docs": "node ./scripts/project.mjs docs",
|
|
81
83
|
"doctor": "node ./scripts/doctor.mjs",
|
|
82
|
-
"benchmark:agent-browser": "node ./scripts/agent-browser-efficiency-benchmark.mjs",
|
|
83
84
|
"check:platform-smoke": "node --check platform-smoke.config.mjs && node --check scripts/platform-smoke.mjs && node --check scripts/platform-smoke/doctor.mjs && node --check scripts/platform-smoke/crabbox-runner.mjs && node --check scripts/platform-smoke/targets.mjs && node --check scripts/platform-smoke/artifacts.mjs && tsx --test test/platform-smoke.test.ts",
|
|
84
85
|
"smoke:platform": "node scripts/platform-smoke.mjs",
|
|
85
86
|
"smoke:platform:doctor": "node scripts/platform-smoke.mjs doctor",
|
|
@@ -22,9 +22,9 @@ export default {
|
|
|
22
22
|
ubuntuContainerImage: PLATFORM_SMOKE_UBUNTU_IMAGE,
|
|
23
23
|
windowsParallels: {
|
|
24
24
|
sourceVm: "pi-extension-windows-template",
|
|
25
|
-
// Shared template snapshot; refresh when the Windows image moves past agent-browser 0.
|
|
25
|
+
// Shared template snapshot; refresh when the Windows image moves past agent-browser 0.34.0.
|
|
26
26
|
// Parent crabbox-ready remains for other projects' linked clones.
|
|
27
|
-
snapshot: "crabbox-ready-ab-0.
|
|
27
|
+
snapshot: "crabbox-ready-ab-0.34.0-d",
|
|
28
28
|
},
|
|
29
29
|
nodeValidationMajor: 22,
|
|
30
30
|
agentBrowserVersion: PLATFORM_SMOKE_AGENT_BROWSER_VERSION,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Purpose: Define the canonical upstream agent-browser capability baseline targeted by this package.
|
|
3
|
-
* Responsibilities:
|
|
3
|
+
* Responsibilities: Combine the canonical target from agent-browser-target.mjs with sampled help commands and verifier/doc token expectations.
|
|
4
4
|
* Scope: Versioned capability metadata only; it does not execute agent-browser or validate documentation by itself.
|
|
5
|
-
* Usage: Imported by command-reference verifier, generated docs checker, and tests when upstream agent-browser is re-baselined.
|
|
5
|
+
* Usage: Imported by command-reference verifier, generated docs checker, and tests when upstream agent-browser is re-baselined; runtime imports only agent-browser-target.mjs.
|
|
6
6
|
* Invariants/Assumptions: This package targets the current installed upstream agent-browser only and does not keep compatibility shims for older versions.
|
|
7
7
|
* Related: `docs/SUPPORT_MATRIX.md` maps `CAPABILITY_BASELINE.inventorySections` to human docs, runtime behavior, tests, and verification gates; refresh that matrix whenever this baseline changes.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { TARGET_AGENT_BROWSER_VERSION } from "./agent-browser-target.mjs";
|
|
11
|
+
|
|
10
12
|
export const CAPABILITY_BASELINE_SOURCE = "scripts/agent-browser-capability-baseline.mjs";
|
|
11
13
|
export const COMMAND_REFERENCE_DOC_PATH = "docs/COMMAND_REFERENCE.md";
|
|
12
14
|
export const CAPABILITY_BASELINE_BLOCK_MARKER_PREFIX = "agent-browser-capability-baseline";
|
|
@@ -14,8 +16,8 @@ export const COMMAND_REFERENCE_BASELINE_BLOCK_IDS = Object.freeze(["upstream-bas
|
|
|
14
16
|
|
|
15
17
|
const sourceEvidence = Object.freeze({
|
|
16
18
|
repository: "vercel-labs/agent-browser",
|
|
17
|
-
upstreamHead: "
|
|
18
|
-
upstreamPackageVersion: "0.
|
|
19
|
+
upstreamHead: "548b159b30eef119ccf6846c8bc807d0eaa3f6f8",
|
|
20
|
+
upstreamPackageVersion: "0.34.0",
|
|
19
21
|
inspectedSources: Object.freeze([
|
|
20
22
|
"agent-browser --version",
|
|
21
23
|
"agent-browser --help",
|
|
@@ -36,6 +38,7 @@ const sourceEvidence = Object.freeze({
|
|
|
36
38
|
"cli/src/native/actions.rs",
|
|
37
39
|
"cli/src/native/a11y/mod.rs",
|
|
38
40
|
"cli/src/native/browser.rs",
|
|
41
|
+
"cli/src/native/tab_binding.rs",
|
|
39
42
|
"cli/src/native/daemon.rs",
|
|
40
43
|
"cli/src/output.rs",
|
|
41
44
|
"docs/src/app/webgpu/page.mdx",
|
|
@@ -365,6 +368,10 @@ const inventorySections = Object.freeze([
|
|
|
365
368
|
"tab new --label <name> [url]",
|
|
366
369
|
"tab close [target]",
|
|
367
370
|
"tab <t<N>|label>",
|
|
371
|
+
"tab_gone",
|
|
372
|
+
"data.targetId",
|
|
373
|
+
"data.lastUrl",
|
|
374
|
+
"CDP target ids",
|
|
368
375
|
"frame <selector|main>",
|
|
369
376
|
"dialog accept [text]",
|
|
370
377
|
"dialog dismiss",
|
|
@@ -387,8 +394,13 @@ const inventorySections = Object.freeze([
|
|
|
387
394
|
["state help", "clean --older-than <days>"],
|
|
388
395
|
["tab help", "new [url]"],
|
|
389
396
|
["tab help", "new --label <name> [url]"],
|
|
390
|
-
["tab help", "close [t<N>|label]"],
|
|
397
|
+
["tab help", "close [t<N>|label|target]"],
|
|
391
398
|
["tab help", "Stable tab ids"],
|
|
399
|
+
["tab help", "tab_gone"],
|
|
400
|
+
["tab help", "data.targetId"],
|
|
401
|
+
["tab help", "data.lastUrl"],
|
|
402
|
+
["core skill full", "--pin-tab"],
|
|
403
|
+
["core skill full", "tab_gone"],
|
|
392
404
|
["frame help", "frame <selector|main>"],
|
|
393
405
|
["dialog help", "dialog <accept|dismiss|status> [text]"],
|
|
394
406
|
["window help", "window <operation>"],
|
|
@@ -615,6 +627,9 @@ const inventorySections = Object.freeze([
|
|
|
615
627
|
"AGENT_BROWSER_STATE",
|
|
616
628
|
"--auto-connect",
|
|
617
629
|
"AGENT_BROWSER_AUTO_CONNECT",
|
|
630
|
+
"--pin-tab",
|
|
631
|
+
"--no-pin-tab",
|
|
632
|
+
"AGENT_BROWSER_PIN_TAB",
|
|
618
633
|
"--headers <json>",
|
|
619
634
|
"--init-script <path>",
|
|
620
635
|
"AGENT_BROWSER_INIT_SCRIPTS",
|
|
@@ -759,6 +774,9 @@ const inventorySections = Object.freeze([
|
|
|
759
774
|
root("AGENT_BROWSER_STATE"),
|
|
760
775
|
root("--auto-connect"),
|
|
761
776
|
root("AGENT_BROWSER_AUTO_CONNECT"),
|
|
777
|
+
root("--pin-tab"),
|
|
778
|
+
root("--no-pin-tab"),
|
|
779
|
+
root("AGENT_BROWSER_PIN_TAB"),
|
|
762
780
|
root("--headers <json>"),
|
|
763
781
|
root("--init-script <path>"),
|
|
764
782
|
root("AGENT_BROWSER_INIT_SCRIPTS"),
|
|
@@ -852,7 +870,7 @@ const inventorySections = Object.freeze([
|
|
|
852
870
|
]);
|
|
853
871
|
|
|
854
872
|
export const CAPABILITY_BASELINE = Object.freeze({
|
|
855
|
-
targetVersion:
|
|
873
|
+
targetVersion: TARGET_AGENT_BROWSER_VERSION,
|
|
856
874
|
sourceEvidence,
|
|
857
875
|
helpCommands,
|
|
858
876
|
inventorySections,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Purpose: Produce the compiled runtime files that the published Pi package loads.
|
|
4
|
+
* Responsibilities: Remove stale dist output, run TypeScript emit through the local compiler, and fail with clear build output.
|
|
5
|
+
* Scope: Maintainer/package build only; runtime behavior remains in extensions/agent-browser TypeScript sources.
|
|
6
|
+
* Usage: `npm run build` before package verification, lifecycle validation, and npm pack/publish.
|
|
7
|
+
* Invariants/Assumptions: `node_modules` is installed and provides `typescript`; deleting `dist/` is safe because it is generated output.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { execFile as execFileCallback } from "node:child_process";
|
|
11
|
+
import { rm } from "node:fs/promises";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import process from "node:process";
|
|
14
|
+
import { promisify } from "node:util";
|
|
15
|
+
|
|
16
|
+
const execFile = promisify(execFileCallback);
|
|
17
|
+
const binSuffix = process.platform === "win32" ? ".cmd" : "";
|
|
18
|
+
const tscPath = join(process.cwd(), "node_modules", ".bin", `tsc${binSuffix}`);
|
|
19
|
+
|
|
20
|
+
async function main() {
|
|
21
|
+
await rm(join(process.cwd(), "dist"), { force: true, maxRetries: 5, recursive: true, retryDelay: 100 });
|
|
22
|
+
const options = process.platform === "win32" ? { shell: true } : {};
|
|
23
|
+
try {
|
|
24
|
+
const { stderr, stdout } = await execFile(tscPath, ["-p", "tsconfig.build.json"], {
|
|
25
|
+
...options,
|
|
26
|
+
cwd: process.cwd(),
|
|
27
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
28
|
+
});
|
|
29
|
+
if (stdout) process.stdout.write(stdout);
|
|
30
|
+
if (stderr) process.stderr.write(stderr);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error?.stdout) process.stdout.write(error.stdout);
|
|
33
|
+
if (error?.stderr) process.stderr.write(error.stderr);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
main().catch((error) => {
|
|
39
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
40
|
+
process.exitCode = 1;
|
|
41
|
+
});
|
package/scripts/doctor.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Responsibilities: Check upstream agent-browser PATH/version, inspect Pi settings for duplicate package/checkout sources, and print actionable remediation.
|
|
5
5
|
* Scope: Read-only package diagnostics only; upstream browser runtime health remains the responsibility of upstream `agent-browser doctor`.
|
|
6
6
|
* Usage: Run via `pi-agent-browser-doctor`, `npm exec --package pi-agent-browser-native -- pi-agent-browser-doctor`, or `npm run doctor` from this repository.
|
|
7
|
-
* Invariants/Assumptions: The wrapper targets
|
|
7
|
+
* Invariants/Assumptions: The wrapper targets TARGET_AGENT_BROWSER_VERSION, does not bundle agent-browser, and must not edit Pi settings or run fixing commands.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { execFile as execFileCallback } from "node:child_process";
|
|
@@ -15,7 +15,8 @@ import { dirname, resolve, sep } from "node:path";
|
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
import { promisify } from "node:util";
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { CAPABILITY_BASELINE_SOURCE } from "./agent-browser-capability-baseline.mjs";
|
|
19
|
+
import { TARGET_AGENT_BROWSER_SOURCE, TARGET_AGENT_BROWSER_VERSION } from "./agent-browser-target.mjs";
|
|
19
20
|
|
|
20
21
|
const execFile = promisify(execFileCallback);
|
|
21
22
|
const PACKAGE_NAME = "pi-agent-browser-native";
|
|
@@ -24,8 +25,8 @@ const EXTENSION_ENTRYPOINTS = Object.freeze([
|
|
|
24
25
|
"extensions/agent-browser/index.ts",
|
|
25
26
|
"dist/extensions/agent-browser/index.js",
|
|
26
27
|
]);
|
|
27
|
-
const EXPECTED_VERSION =
|
|
28
|
-
const MINIMUM_PI_VERSION = "0.
|
|
28
|
+
const EXPECTED_VERSION = TARGET_AGENT_BROWSER_VERSION;
|
|
29
|
+
const MINIMUM_PI_VERSION = "0.84.0";
|
|
29
30
|
const DEFAULT_AGENT_DIR = resolve(homedir(), ".pi/agent");
|
|
30
31
|
const THIS_PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
31
32
|
|
|
@@ -69,7 +70,7 @@ Options:
|
|
|
69
70
|
|
|
70
71
|
Checks:
|
|
71
72
|
1. agent-browser is installed on PATH.
|
|
72
|
-
2. agent-browser --version matches the package
|
|
73
|
+
2. agent-browser --version matches the package target version.
|
|
73
74
|
3. pi --version is at least the minimum Pi runtime version for this release.
|
|
74
75
|
4. Pi settings and repo-local autoload locations do not point at multiple active pi-agent-browser-native sources.
|
|
75
76
|
|
|
@@ -345,8 +346,8 @@ async function checkAgentBrowserVersion({ runAgentBrowser }) {
|
|
|
345
346
|
status: "fail",
|
|
346
347
|
title: `agent-browser version drift: expected ${EXPECTED_VERSION}, found ${version || "<empty>"}.`,
|
|
347
348
|
lines: [
|
|
348
|
-
`This wrapper targets the current
|
|
349
|
-
`Update upstream agent-browser to ${EXPECTED_VERSION}, or if you intentionally re-baselined upstream, update ${CAPABILITY_BASELINE_SOURCE}, run \`npm run docs -- command-reference write\`, refresh docs/COMMAND_REFERENCE.md, and rerun \`npm run verify -- command-reference\` plus \`npm run verify -- real-upstream\` with test/fixtures/agent-browser-real-output-shapes.json aligned to the new target version.`,
|
|
349
|
+
`This wrapper targets the current version from ${TARGET_AGENT_BROWSER_SOURCE} and does not provide backwards-compatibility shims.`,
|
|
350
|
+
`Update upstream agent-browser to ${EXPECTED_VERSION}, or if you intentionally re-baselined upstream, update ${TARGET_AGENT_BROWSER_SOURCE} plus ${CAPABILITY_BASELINE_SOURCE}, run \`npm run docs -- command-reference write\`, refresh docs/COMMAND_REFERENCE.md, and rerun \`npm run verify -- command-reference\` plus \`npm run verify -- real-upstream\` with test/fixtures/agent-browser-real-output-shapes.json aligned to the new target version.`,
|
|
350
351
|
],
|
|
351
352
|
};
|
|
352
353
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
param(
|
|
2
|
-
[Parameter(Mandatory=$true)][string]$AgentBrowserVersion
|
|
2
|
+
[Parameter(Mandatory=$true)][string]$AgentBrowserVersion,
|
|
3
|
+
[switch]$SkipNpmCi
|
|
3
4
|
)
|
|
4
5
|
|
|
5
6
|
$ErrorActionPreference = "Continue"
|
|
@@ -90,8 +91,13 @@ Write-Output "PLATFORM_DOGFOOD_ARTIFACT_DIR=$DogfoodArtifactDir"
|
|
|
90
91
|
$NodeVersion = (& node --version 2>$null)
|
|
91
92
|
Write-Output "PLATFORM_NODE_VERSION=$NodeVersion"
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
if ($SkipNpmCi -and (Test-Path (Join-Path $SourceRoot "node_modules"))) {
|
|
95
|
+
Write-Output "PLATFORM_NPM_CI_SKIPPED=1"
|
|
96
|
+
$NpmCiExit = 0
|
|
97
|
+
} else {
|
|
98
|
+
& npm ci 2>&1
|
|
99
|
+
$NpmCiExit = $LASTEXITCODE
|
|
100
|
+
}
|
|
95
101
|
Write-Output "PLATFORM_NPM_CI_EXIT=$NpmCiExit"
|
|
96
102
|
|
|
97
103
|
$AgentBrowserPath = Get-AgentBrowserCommandPath
|
|
@@ -305,9 +305,9 @@ export function buildPlatformBuildCommand(targetName, packageName = "pi-agent-br
|
|
|
305
305
|
return lines.join("\n");
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
export function buildBrowserDogfoodCommand(targetName, agentBrowserVersion = CAPABILITY_BASELINE.targetVersion) {
|
|
308
|
+
export function buildBrowserDogfoodCommand(targetName, agentBrowserVersion = CAPABILITY_BASELINE.targetVersion, dependenciesReady = false) {
|
|
309
309
|
if (platformFor(targetName) === "powershell") {
|
|
310
|
-
return `powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\\scripts\\platform-smoke\\browser-dogfood-windows.ps1 -AgentBrowserVersion ${psSingleQuote(agentBrowserVersion)}`;
|
|
310
|
+
return `powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\\scripts\\platform-smoke\\browser-dogfood-windows.ps1 -AgentBrowserVersion ${psSingleQuote(agentBrowserVersion)}${dependenciesReady ? " -SkipNpmCi" : ""}`;
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
const lines = [];
|
|
@@ -329,8 +329,12 @@ export function buildBrowserDogfoodCommand(targetName, agentBrowserVersion = CAP
|
|
|
329
329
|
lines.push(`echo "PLATFORM_AGENT_BROWSER_VERSION=$AGENT_BROWSER_VERSION_OUTPUT"`);
|
|
330
330
|
lines.push(`if [ "$AGENT_BROWSER_VERSION_COMMAND_EXIT" -eq 0 ] && [ "$AGENT_BROWSER_VERSION_OUTPUT" = "$EXPECTED_AGENT_BROWSER_VERSION" ]; then AGENT_BROWSER_READY_EXIT=0; else AGENT_BROWSER_READY_EXIT=1; fi`);
|
|
331
331
|
lines.push(`echo "PLATFORM_AGENT_BROWSER_READY_EXIT=$AGENT_BROWSER_READY_EXIT"`);
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
if (dependenciesReady) {
|
|
333
|
+
lines.push(`if [ -d node_modules ]; then echo "PLATFORM_NPM_CI_SKIPPED=1"; NPM_CI_EXIT=0; else npm ci 2>&1; NPM_CI_EXIT=$?; fi`);
|
|
334
|
+
} else {
|
|
335
|
+
lines.push(`npm ci 2>&1`);
|
|
336
|
+
lines.push(`NPM_CI_EXIT=$?`);
|
|
337
|
+
}
|
|
334
338
|
lines.push(`echo "PLATFORM_NPM_CI_EXIT=$NPM_CI_EXIT"`);
|
|
335
339
|
lines.push(`TSX_CLI="$SOURCE_ROOT/node_modules/.bin/tsx"`);
|
|
336
340
|
lines.push(`if [ ! -x "$TSX_CLI" ]; then TSX_CLI="$(command -v tsx || true)"; fi`);
|
|
@@ -349,7 +353,7 @@ async function runBrowserDogfoodSuite(config, targetName, suiteName, leaseSessio
|
|
|
349
353
|
const startedAt = Date.now();
|
|
350
354
|
const platform = platformFor(targetName);
|
|
351
355
|
const slug = `${config.packageName}-${targetName}`;
|
|
352
|
-
const command = buildBrowserDogfoodCommand(targetName, config.agentBrowserVersion);
|
|
356
|
+
const command = buildBrowserDogfoodCommand(targetName, config.agentBrowserVersion, leaseSession?.dependenciesReady === true);
|
|
353
357
|
writeFileSync(resolve(suiteDir, "target.json"), JSON.stringify(targetEvidence(config, targetName, runId, slug), null, 2));
|
|
354
358
|
writeFileSync(resolve(suiteDir, "suite.json"), JSON.stringify({ suiteName, modelCalls: 0, realBrowser: true }, null, 2));
|
|
355
359
|
writeCommand(suiteDir, command);
|
|
@@ -496,12 +500,14 @@ export async function runTargetSuites(config, targetName, suiteNames) {
|
|
|
496
500
|
let staleCleanupResult;
|
|
497
501
|
try {
|
|
498
502
|
let sync = true;
|
|
503
|
+
let dependenciesReady = false;
|
|
499
504
|
for (const suiteName of suiteNames) {
|
|
500
505
|
console.log(` Suite: ${suiteName}`);
|
|
501
|
-
const result = await runTargetSuite(config, targetName, suiteName, { ...lease, sync }, runId);
|
|
506
|
+
const result = await runTargetSuite(config, targetName, suiteName, { ...lease, dependenciesReady, sync }, runId);
|
|
502
507
|
results.push(result);
|
|
503
508
|
console.log(` ${result.ok ? "PASS" : "FAIL"} ${suiteName} on ${targetName}`);
|
|
504
509
|
sync = false;
|
|
510
|
+
if (result.ok && suiteName === "platform-build") dependenciesReady = true;
|
|
505
511
|
if (!result.ok) break;
|
|
506
512
|
}
|
|
507
513
|
} finally {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Purpose: Keep small Electron presentation string helpers in one place.
|
|
3
|
-
* Responsibilities: Trim optional probe strings and bound them to model-visible lengths.
|
|
4
|
-
* Scope: Electron diagnostics/probe text helpers only; redaction and result formatting stay with their owning modules.
|
|
5
|
-
* Usage: Imported by Electron host probes and browser-run Electron diagnostics.
|
|
6
|
-
* Invariants/Assumptions: Empty or whitespace-only strings stay omitted, and truncation keeps the prior ellipsis behavior.
|
|
7
|
-
*/
|
|
8
|
-
export function boundElectronProbeString(value, maxLength = 240) {
|
|
9
|
-
const trimmed = value?.trim();
|
|
10
|
-
if (!trimmed)
|
|
11
|
-
return undefined;
|
|
12
|
-
return trimmed.length > maxLength ? `${trimmed.slice(0, Math.max(0, maxLength - 3))}...` : trimmed;
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Purpose: Re-export focused input-mode schema, compiler, and analysis modules for the agent_browser wrapper.
|
|
3
|
-
* Responsibilities: Preserve the extension entrypoint's import surface while keeping input-mode code split by concern.
|
|
4
|
-
* Scope: Barrel only; add behavior to focused files under ./input-modes/.
|
|
5
|
-
*/
|
|
6
|
-
export { AGENT_BROWSER_PARAMS } from "./input-modes/params.js";
|
|
7
|
-
export { analyzeQaPresetResults, analyzeQaPresetTimeout, buildQaCompactPassText, compileAgentBrowserJob, compileAgentBrowserQaPreset, extractQaPageContext, isHttpOrHttpsUrl, } from "./input-modes/job.js";
|
|
8
|
-
export { analyzeNetworkSourceLookupResults, analyzeSourceLookupResults, compileAgentBrowserNetworkSourceLookup, compileAgentBrowserSourceLookup, redactNetworkSourceLookupAnalysis, redactNetworkSourceLookupArgs, redactNetworkSourceLookupSurface, redactNetworkSourceLookupUrl, } from "./input-modes/lookups.js";
|
|
9
|
-
export { compileAgentBrowserElectron } from "./input-modes/electron.js";
|
|
10
|
-
export { compileAgentBrowserSemanticAction, getCompiledSemanticActionCommandIndex, getCompiledSemanticActionSessionPrefix, isCompiledSemanticActionFindCommand, } from "./input-modes/semantic-action.js";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export function getPersistentSessionArtifactStore(ctx) {
|
|
2
|
-
const sessionDir = typeof ctx.sessionManager.getSessionDir === "function" ? ctx.sessionManager.getSessionDir() : undefined;
|
|
3
|
-
const sessionId = ctx.sessionManager.getSessionId();
|
|
4
|
-
return sessionDir && sessionId ? { sessionDir, sessionId } : undefined;
|
|
5
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Purpose: Centralize small artifact state predicates shared by result classifiers, recommendations, and presentation.
|
|
3
|
-
* Responsibilities: Identify pending recording artifacts whose output is not durable until record stop completes.
|
|
4
|
-
* Scope: Artifact predicates only; verification summaries, manifests, and user-facing formatting live in neighboring modules.
|
|
5
|
-
* Usage: Imported by categories, action recommendations, and presentation to avoid divergent artifact-state rules.
|
|
6
|
-
* Invariants/Assumptions: `record start` / `record restart` video artifacts are pending and should not be treated like verified saved files.
|
|
7
|
-
*/
|
|
8
|
-
export function isPendingRecordingCommand(command, subcommand, kind) {
|
|
9
|
-
return command === "record" && (subcommand === "start" || subcommand === "restart") && kind === "video";
|
|
10
|
-
}
|
|
11
|
-
export function isPendingRecordingArtifact(artifact) {
|
|
12
|
-
return isPendingRecordingCommand(artifact.command, artifact.subcommand, artifact.kind);
|
|
13
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Purpose: Provide the public result-rendering facade for the pi-agent-browser extension.
|
|
3
|
-
* Responsibilities: Re-export focused envelope parsing, snapshot rendering, and presentation helpers from smaller modules while preserving the stable import surface used by the extension entrypoint and tests.
|
|
4
|
-
* Scope: Facade only; implementation details live in `lib/results/*` modules.
|
|
5
|
-
* Usage: Imported by the extension entrypoint after upstream `agent-browser` execution completes.
|
|
6
|
-
* Invariants/Assumptions: Public exports remain stable even as result-rendering internals are split into narrower modules.
|
|
7
|
-
*/
|
|
8
|
-
export { getAgentBrowserErrorText, parseAgentBrowserEnvelope } from "./results/envelope.js";
|
|
9
|
-
export { buildToolPresentation } from "./results/presentation.js";
|
|
10
|
-
export { applyNetworkRouteRecords, buildNetworkRouteDiagnostics } from "./results/network-routes.js";
|
|
11
|
-
export { buildAgentBrowserResultCategoryDetails, classifyAgentBrowserFailureCategory, classifyAgentBrowserSuccessCategory, } from "./results/categories.js";
|
|
12
|
-
export { buildAgentBrowserNextActions } from "./results/action-recommendations.js";
|
|
13
|
-
export { compareRefIds } from "./results/text.js";
|
|
14
|
-
export { AGENT_BROWSER_RECOVERY_NEXT_ACTION_IDS, AGENT_BROWSER_RICH_INPUT_RECOVERY_NEXT_ACTION_IDS, getAgentBrowserRichInputRecoveryNextActionId, getAgentBrowserRichInputRecoveryNextActionIds, } from "./results/recovery-actions.js";
|