diff options
| author | Tianren Dong <tianrendong.dtr@gmail.com> | 2026-09-26 16:37:25 -0400 |
|---|---|---|
| committer | Tianren Dong <tianrendong.dtr@gmail.com> | 2026-09-26 16:37:25 -0400 |
| commit | c49dc15fa5c33d5b1d210b0185677ce29640e2d5 (patch) | |
| tree | b1f6ddcf387edb51213a6f9f1beb011fbe5c0bd3 /test-suite/unit/background-policy.test.mjs | |
| parent | 4811ee616d2bbd5ead669a7e2f33a0bb14bd43ef (diff) | |
Absorb fork fixes and features; release 0.15.53
Adapted from community forks (ardhiqii, kkunkunya, nihar-oracle, steimerbyte):
- Abort stalled /next long polls after 45s; time out, retry, and single-post results.
- Fall back to CDP Runtime.evaluate when chrome.scripting is refused (about:blank automation tabs).
- Load pi-chrome in same-process subagent sessions as a bridge client; client chrome_launch reports owner status.
- Add chrome_cdp (validated raw CDP passthrough, background-guarded, payload summarization) and chrome_cdp_targets.
- chrome_type reports before/after values, insertedAt, splice/unchanged warnings; add replace=true.
- includeSnapshot waits for navigations started by the action; tab.new reports the settled tab.
- CDP timeouts surface as timeouts and are not re-sent after the cleanup detach.
- Activate/deactivate chrome_find and chrome_inspect with the rest of the chrome_* tools.
- New unit suites: bridge-resilience, cdp-passthrough, type-evidence.
Diffstat (limited to 'test-suite/unit/background-policy.test.mjs')
| -rw-r--r-- | test-suite/unit/background-policy.test.mjs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test-suite/unit/background-policy.test.mjs b/test-suite/unit/background-policy.test.mjs index e78fa49..fe71634 100644 --- a/test-suite/unit/background-policy.test.mjs +++ b/test-suite/unit/background-policy.test.mjs @@ -24,7 +24,7 @@ function piHarness({ session = "alpha", send } = {}) { let authorized = true; const ctx = { key: `session:${session}`, title: `Pi Session: ${session}`, cwd: "/fixture", ui: { notify: (...args) => notices.push(args) } }; const bridge = { - connected: true, status: () => ({}), + connected: true, status: () => ({}), connectionStatus: async () => ({ connected: true }), async send(action, params, timeout, signal) { calls.push({ action, params: clone(params), timeout, signal }); if (signal?.aborted) throw new Error("Chrome command aborted"); @@ -48,6 +48,7 @@ function piHarness({ session = "alpha", send } = {}) { tabActionValues: [], snapshotModeValues: [], waitForValues: [], imageFormatValues: [], safeJson: JSON.stringify, truncateText: (s) => s, formatChromeSnapshot: JSON.stringify, formatChromeInspect: JSON.stringify, summarizeActionResult: () => "", formatIncludedSnapshotText: (_r, text) => text, + describeTypeEvidence: () => [], formatCdpResult: (_method, value) => ({ content: [{ type: "text", text: JSON.stringify(value) }], details: { value } }), workspaceCwd: () => ctx.cwd, ...path, mkdir: async () => {}, writeFile: async (...args) => writes.push(args), }; @@ -107,6 +108,7 @@ test("every registered page tool, tab.new, and chrome_launch(url) use the centra ["chrome_get_network_request", { requestId: "1" }, "page.network.get"], ["chrome_screenshot", {}, "page.screenshot"], ["chrome_hover", {}, "page.hover"], ["chrome_drag", {}, "page.drag"], ["chrome_tap", {}, "page.tap"], ["chrome_scroll", {}, "page.scroll"], ["chrome_upload_file", { paths: ["fixture.txt"] }, "page.upload"], + ["chrome_cdp", { method: "Runtime.evaluate", params: { expression: "1" } }, "cdp.call"], ]; for (const [name, params, action] of cases) { await h.tool(name, { ...params, background: false, foreground: true }); |
