pi-lean-dimension 0.2.4 → 0.3.1
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/README.md +1 -1
- package/node_modules/pi-lean-portal/AGENTS.md +15 -23
- package/node_modules/pi-lean-portal/README.md +35 -7
- package/node_modules/pi-lean-portal/__tests__/browser-toggle-profile.test.ts +12 -1
- package/node_modules/pi-lean-portal/__tests__/browser-toggle.test.ts +263 -1126
- package/node_modules/pi-lean-portal/__tests__/fetch-backend.test.ts +6 -32
- package/node_modules/pi-lean-portal/__tests__/helpers/mock-python-bridge.py +1 -1
- package/node_modules/pi-lean-portal/__tests__/helpers/probe-user-backend.ts +1 -2
- package/node_modules/pi-lean-portal/__tests__/helpers/setup-temp-dir.ts +26 -0
- package/node_modules/pi-lean-portal/__tests__/plugin-config-browser.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/plugin-contract.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/plugin-loading.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/probe-user-backend.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/python-adapter.test.ts +65 -69
- package/node_modules/pi-lean-portal/__tests__/router-dispatch.test.ts +1 -14
- package/node_modules/pi-lean-portal/__tests__/run-contributed-suites.test.ts +31 -16
- package/node_modules/pi-lean-portal/__tests__/snapshot-cache.test.ts +1 -1
- package/node_modules/pi-lean-portal/__tests__/web-guides.test.ts +146 -19
- package/node_modules/pi-lean-portal/backends/playwright-base/playwright-plugin.ts +1 -1
- package/node_modules/pi-lean-portal/backends/python-adapter.ts +3 -3
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__init__.py +2 -4
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/__init__.cpython-312.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/__init__.cpython-313.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/playwright_base.cpython-312.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/playwright_base.cpython-313.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/playwright_base.py +572 -81
- package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_playwright_base_quirks.cpython-313-pytest-9.1.1.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/tests/test_playwright_base_quirks.py +13 -43
- package/node_modules/pi-lean-portal/browser-profile.ts +2 -3
- package/node_modules/pi-lean-portal/browser-toggle.ts +168 -385
- package/node_modules/pi-lean-portal/contributed/CHOOSING.md +2 -2
- package/node_modules/pi-lean-portal/contributed/README.md +65 -6
- package/node_modules/pi-lean-portal/contributed/camoufox-py/__pycache__/bridge.cpython-312.pyc +0 -0
- package/node_modules/pi-lean-portal/contributed/camoufox-py/bridge.py +108 -14
- package/node_modules/pi-lean-portal/contributed/camoufox-py/pin.json +4 -0
- package/node_modules/pi-lean-portal/core/fetch-backend.ts +10 -30
- package/node_modules/pi-lean-portal/core/guides.ts +14 -18
- package/node_modules/pi-lean-portal/core/router.ts +2 -20
- package/node_modules/pi-lean-portal/core/shared/bot-detection.ts +19 -30
- package/node_modules/pi-lean-portal/core/shared/browser-data.ts +4 -4
- package/node_modules/pi-lean-portal/core/shared/nav-settle.ts +2 -2
- package/node_modules/pi-lean-portal/core/shared/paths.ts +16 -2
- package/node_modules/pi-lean-portal/core/shared/settings-reader.ts +2 -7
- package/node_modules/pi-lean-portal/core/shared/snapshot-cache.ts +1 -1
- package/node_modules/pi-lean-portal/index.ts +8 -1
- package/node_modules/pi-lean-portal/package.json +2 -1
- package/node_modules/pi-lean-portal/tools/web-learn.ts +1 -4
- package/node_modules/pi-lean-search/__tests__/web-search.test.ts +87 -0
- package/node_modules/pi-lean-search/index.ts +134 -64
- package/node_modules/pi-lean-search/package.json +2 -1
- package/node_modules/playwright/README.md +3 -3
- package/node_modules/playwright/lib/agents/copilot-setup-steps.yml +2 -2
- package/node_modules/playwright/lib/cli/reportActions.js +2 -2
- package/node_modules/playwright/lib/common/index.js +77 -52
- package/node_modules/playwright/lib/common/index.js.txt +10 -11
- package/node_modules/playwright/lib/errorContext.js +2 -3
- package/node_modules/playwright/lib/index.js +30 -8
- package/node_modules/playwright/lib/matchers/expect.js +4811 -4379
- package/node_modules/playwright/lib/matchers/expect.js.LICENSE +87 -140
- package/node_modules/playwright/lib/matchers/expect.js.txt +30 -35
- package/node_modules/playwright/lib/program.js +19 -0
- package/node_modules/playwright/lib/runner/index.js +309 -153
- package/node_modules/playwright/lib/runner/index.js.txt +13 -12
- package/node_modules/playwright/lib/transform/babelBundle.js +12899 -11654
- package/node_modules/playwright/lib/transform/babelBundle.js.LICENSE +379 -354
- package/node_modules/playwright/lib/transform/babelBundle.js.txt +39 -39
- package/node_modules/playwright/lib/transform/esmLoader.js +3129 -1116
- package/node_modules/playwright/lib/transform/esmLoader.js.LICENSE +81 -61
- package/node_modules/playwright/lib/transform/esmLoader.js.txt +21 -18
- package/node_modules/playwright/lib/util.js +2 -29
- package/node_modules/playwright/lib/worker/workerProcessEntry.js +14 -32
- package/node_modules/playwright/lib/worker/workerProcessEntry.js.txt +7 -8
- package/node_modules/playwright/package.json +3 -6
- package/node_modules/playwright/types/test.d.ts +391 -4
- package/node_modules/playwright/types/testReporter.d.ts +79 -4
- package/node_modules/playwright-core/browsers.json +12 -18
- package/node_modules/playwright-core/lib/bootstrap.js +1 -1
- package/node_modules/playwright-core/lib/coreBundle.js +11344 -9900
- package/node_modules/playwright-core/lib/server/electron/loader.js +5 -2
- package/node_modules/playwright-core/lib/serverRegistry.js +5 -1
- package/node_modules/playwright-core/lib/tools/cli-client/help.json +21 -6
- package/node_modules/playwright-core/lib/tools/cli-client/program.js +1 -1
- package/node_modules/playwright-core/lib/tools/cli-client/session.js +4 -0
- package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/SKILL.md +21 -5
- package/node_modules/playwright-core/lib/tools/{cli-client/skill/references/spec-driven-testing.md → skills/playwright-cli/references/test-generation.md} +135 -7
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +143 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +85 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +67 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +75 -0
- package/node_modules/playwright-core/lib/tools/utils/extension.js +31 -8
- package/node_modules/playwright-core/lib/utilsBundle.js +37698 -33670
- package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +391 -268
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-CyWAfh-p.js +11 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-DhC616m4.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/index.html +2 -2
- package/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -1
- package/node_modules/playwright-core/lib/vite/htmlReport/report.js +15 -55
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-CwYYHbcZ.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-DYjdXIbE.js +129 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-l_lX622x.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/index.html +2 -2
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-By56iMx7.js +32 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-B34OrIms.js +181 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-COQkjINf.js +7 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.Dl36UVQT.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +5 -5
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +2 -2
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +3 -4
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.C7UW1sC9.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.D962mr9b.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +5 -5
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
- package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
- package/node_modules/playwright-core/lib/xdg-open +338 -137
- package/node_modules/playwright-core/package.json +2 -2
- package/node_modules/playwright-core/types/protocol.d.ts +249 -36
- package/node_modules/playwright-core/types/structs.d.ts +3 -1
- package/node_modules/playwright-core/types/types.d.ts +2009 -266
- package/package.json +3 -3
- package/node_modules/pi-lean-portal/__tests__/url-safety.test.ts +0 -188
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/bridge.py +0 -525
- package/node_modules/pi-lean-portal/core/shared/url-safety.ts +0 -164
- package/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +0 -2739
- package/node_modules/playwright-core/lib/tools/cli-client/skill/references/test-generation.md +0 -134
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-BY2S1tHT.css +0 -1
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-C_5TMfeg.js +0 -52
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DYBRYzYX.css +0 -1
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DeBYQozu.js +0 -32
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-4ZiSSCmn.css +0 -1
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-Bq-mQf8S.js +0 -193
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-LEHpjmcn.js +0 -32
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-BNmKHKpQ.js +0 -264
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-BYQrIQwR.js +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +0 -9
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.DYBRYzYX.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.CjdS-WJx.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/index.CzXZzn5A.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/index.DMMX1gXU.js +0 -2
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.v8KI4P3m.js +0 -2
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.BZQ54Kgt.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.Ut8wwJNp.js +0 -6
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +0 -32
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/element-attributes.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/playwright-tests.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/request-mocking.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/running-code.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/session-management.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/storage-state.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/tracing.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/video-recording.md +0 -0
- /package/node_modules/playwright-core/lib/tools/{trace → skills/playwright-trace}/SKILL.md +0 -0
|
@@ -17,12 +17,26 @@ import {
|
|
|
17
17
|
formatGuideFooter,
|
|
18
18
|
sortApplicableGuides,
|
|
19
19
|
getGuideContent,
|
|
20
|
-
invalidateGuideContent,
|
|
21
20
|
_setGuideContentForTest,
|
|
22
21
|
buildDomainMap,
|
|
23
22
|
BUILTIN_GUIDES,
|
|
24
23
|
} from "../core/guides.js";
|
|
25
24
|
|
|
25
|
+
// ── Isolate from on-disk user guides ──────────────────────────
|
|
26
|
+
// User guide files in ~/.pi/agent/pi-lean-portal/web-guides/ must not leak
|
|
27
|
+
// into tests. Mocking existsSync for the web-guides path ensures
|
|
28
|
+
// loadUserGuides() returns {} (guarded by existsSync at the top).
|
|
29
|
+
vi.mock("node:fs", async (importActual) => {
|
|
30
|
+
const actual = await importActual<typeof import("node:fs")>();
|
|
31
|
+
return {
|
|
32
|
+
...actual,
|
|
33
|
+
existsSync: (p: unknown) =>
|
|
34
|
+
typeof p === "string" && p.endsWith("web-guides")
|
|
35
|
+
? false
|
|
36
|
+
: actual.existsSync(p as string),
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
|
|
26
40
|
// ─── Types ──────────────────────────────────────────────────────
|
|
27
41
|
|
|
28
42
|
describe("types", () => {
|
|
@@ -93,7 +107,7 @@ describe("resolveApplicableGuides", () => {
|
|
|
93
107
|
});
|
|
94
108
|
|
|
95
109
|
afterEach(() => {
|
|
96
|
-
|
|
110
|
+
_setGuideContentForTest();
|
|
97
111
|
});
|
|
98
112
|
|
|
99
113
|
const hasDialog = true;
|
|
@@ -241,7 +255,9 @@ describe("formatGuideFooter", () => {
|
|
|
241
255
|
];
|
|
242
256
|
const result = formatGuideFooter(guides);
|
|
243
257
|
expect(result).toContain("Guides available for this page");
|
|
244
|
-
expect(result).toContain(
|
|
258
|
+
expect(result).toContain(
|
|
259
|
+
'• ⚠ bot detection — challenge page detected (web-guide guide="bot-detection")',
|
|
260
|
+
);
|
|
245
261
|
expect(result).not.toContain("Site:");
|
|
246
262
|
});
|
|
247
263
|
|
|
@@ -258,7 +274,9 @@ describe("formatGuideFooter", () => {
|
|
|
258
274
|
const result = formatGuideFooter(guides);
|
|
259
275
|
expect(result).toContain("Guides available for this page");
|
|
260
276
|
expect(result).toContain("Site:");
|
|
261
|
-
expect(result).toContain(
|
|
277
|
+
expect(result).toContain(
|
|
278
|
+
'• 📖 reddit — site guide for reddit.com (web-guide guide="reddit")',
|
|
279
|
+
);
|
|
262
280
|
});
|
|
263
281
|
|
|
264
282
|
it("renders mixed patterns + sites with correct ordering", () => {
|
|
@@ -316,7 +334,9 @@ describe("formatGuideFooter", () => {
|
|
|
316
334
|
},
|
|
317
335
|
];
|
|
318
336
|
const result = formatGuideFooter(guides);
|
|
319
|
-
expect(result).toMatch(
|
|
337
|
+
expect(result).toMatch(
|
|
338
|
+
/• ⚠ bot detection.*web-guide guide="bot-detection"/,
|
|
339
|
+
);
|
|
320
340
|
});
|
|
321
341
|
});
|
|
322
342
|
|
|
@@ -588,7 +608,7 @@ describe("buildDomainMap", () => {
|
|
|
588
608
|
});
|
|
589
609
|
|
|
590
610
|
afterEach(() => {
|
|
591
|
-
|
|
611
|
+
_setGuideContentForTest();
|
|
592
612
|
});
|
|
593
613
|
|
|
594
614
|
it("includes fixtures from guides with domains field", () => {
|
|
@@ -614,26 +634,15 @@ describe("buildDomainMap", () => {
|
|
|
614
634
|
});
|
|
615
635
|
});
|
|
616
636
|
|
|
617
|
-
describe("getGuideContent
|
|
618
|
-
beforeEach(() => {
|
|
619
|
-
invalidateGuideContent();
|
|
620
|
-
});
|
|
621
|
-
|
|
637
|
+
describe("getGuideContent", () => {
|
|
622
638
|
afterEach(() => {
|
|
623
|
-
|
|
639
|
+
_setGuideContentForTest();
|
|
624
640
|
});
|
|
625
641
|
|
|
626
642
|
it("returns builtin guides", () => {
|
|
627
643
|
const content = getGuideContent();
|
|
628
644
|
expect(content["bot-detection"]).toBeDefined();
|
|
629
645
|
});
|
|
630
|
-
|
|
631
|
-
it("after invalidation, returns fresh content (same keys)", () => {
|
|
632
|
-
const before = getGuideContent();
|
|
633
|
-
invalidateGuideContent();
|
|
634
|
-
const after = getGuideContent();
|
|
635
|
-
expect(Object.keys(after).sort()).toEqual(Object.keys(before).sort());
|
|
636
|
-
});
|
|
637
646
|
});
|
|
638
647
|
|
|
639
648
|
// ─── Builtin guide structure ────────────────────────────────────
|
|
@@ -705,3 +714,121 @@ describe("getGuideContent merge", () => {
|
|
|
705
714
|
expect(botGuide?.triggerSignal).toBe("botDetected");
|
|
706
715
|
});
|
|
707
716
|
});
|
|
717
|
+
|
|
718
|
+
// ─── Builtin guide override ────────────────────────────────────
|
|
719
|
+
|
|
720
|
+
describe("builtin guide override", () => {
|
|
721
|
+
afterEach(() => {
|
|
722
|
+
_setGuideContentForTest();
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
it("override wins and keeps firing — user bot-detection with custom shortName/icon", () => {
|
|
726
|
+
const base = getGuideContent();
|
|
727
|
+
_setGuideContentForTest({
|
|
728
|
+
...base,
|
|
729
|
+
"bot-detection": {
|
|
730
|
+
category: "pattern",
|
|
731
|
+
source: "user",
|
|
732
|
+
updated: "2026-07-01",
|
|
733
|
+
icon: "🤖",
|
|
734
|
+
shortName: "my bot guide",
|
|
735
|
+
triggerSignal: "botDetected",
|
|
736
|
+
content: "Custom bot guidance.",
|
|
737
|
+
},
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
const result = resolveApplicableGuides(
|
|
741
|
+
"https://example.com/page",
|
|
742
|
+
false,
|
|
743
|
+
true,
|
|
744
|
+
);
|
|
745
|
+
expect(result).toHaveLength(1);
|
|
746
|
+
expect(result[0]!.icon).toBe("🤖");
|
|
747
|
+
expect(result[0]!.shortName).toBe("my bot guide");
|
|
748
|
+
expect(result[0]!.name).toBe("bot-detection");
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
it("override that drops trigger.signal stops the pattern", () => {
|
|
752
|
+
const base = getGuideContent();
|
|
753
|
+
_setGuideContentForTest({
|
|
754
|
+
...base,
|
|
755
|
+
"bot-detection": {
|
|
756
|
+
category: "pattern",
|
|
757
|
+
source: "user",
|
|
758
|
+
updated: "2026-07-01",
|
|
759
|
+
icon: "🤖",
|
|
760
|
+
shortName: "my bot guide",
|
|
761
|
+
// No triggerSignal — override disables auto-fire
|
|
762
|
+
content: "Custom bot guidance, no trigger.",
|
|
763
|
+
},
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
const result = resolveApplicableGuides(
|
|
767
|
+
"https://example.com/page",
|
|
768
|
+
false,
|
|
769
|
+
true,
|
|
770
|
+
);
|
|
771
|
+
// bot-detection key exists but has no triggerSignal, so it should not fire
|
|
772
|
+
expect(result.filter((g) => g.name === "bot-detection")).toEqual([]);
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
it("site-vs-pattern namespaces are disjoint — site guide for www.botdetection.com coexists with builtin bot-detection pattern", () => {
|
|
776
|
+
const base = getGuideContent();
|
|
777
|
+
_setGuideContentForTest({
|
|
778
|
+
...base,
|
|
779
|
+
"www.botdetection.com": {
|
|
780
|
+
category: "site",
|
|
781
|
+
source: "user",
|
|
782
|
+
updated: "2026-07-01",
|
|
783
|
+
icon: "📖",
|
|
784
|
+
shortName: "Bot Detection Site",
|
|
785
|
+
domains: ["www.botdetection.com"],
|
|
786
|
+
content: "Site-specific guide for bot detection domain.",
|
|
787
|
+
},
|
|
788
|
+
});
|
|
789
|
+
|
|
790
|
+
const result = resolveApplicableGuides(
|
|
791
|
+
"https://www.botdetection.com/page",
|
|
792
|
+
false,
|
|
793
|
+
true,
|
|
794
|
+
);
|
|
795
|
+
expect(result).toHaveLength(2);
|
|
796
|
+
const names = result.map((g) => g.name).sort();
|
|
797
|
+
expect(names).toEqual(["bot-detection", "www.botdetection.com"]);
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
it("override with category:site + domains replaces the pattern entirely — pattern stops firing", () => {
|
|
801
|
+
const base = getGuideContent();
|
|
802
|
+
_setGuideContentForTest({
|
|
803
|
+
...base,
|
|
804
|
+
"bot-detection": {
|
|
805
|
+
category: "site",
|
|
806
|
+
source: "user",
|
|
807
|
+
updated: "2026-07-01",
|
|
808
|
+
icon: "📖",
|
|
809
|
+
shortName: "bot detection site",
|
|
810
|
+
domains: ["botdetection.example"],
|
|
811
|
+
// No triggerSignal — this is a site guide, not a pattern
|
|
812
|
+
content: "Site guide that shadows the builtin bot-detection.",
|
|
813
|
+
},
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
// botDetected=true, but the bot-detection key is now a site guide with no triggerSignal
|
|
817
|
+
const result = resolveApplicableGuides(
|
|
818
|
+
"https://example.com/page",
|
|
819
|
+
false,
|
|
820
|
+
true,
|
|
821
|
+
);
|
|
822
|
+
expect(result.filter((g) => g.name === "bot-detection")).toEqual([]);
|
|
823
|
+
|
|
824
|
+
// The site guide should match via its domain though
|
|
825
|
+
const domainResult = resolveApplicableGuides(
|
|
826
|
+
"https://botdetection.example/page",
|
|
827
|
+
false,
|
|
828
|
+
false,
|
|
829
|
+
);
|
|
830
|
+
expect(domainResult).toHaveLength(1);
|
|
831
|
+
expect(domainResult[0]!.name).toBe("bot-detection");
|
|
832
|
+
expect(domainResult[0]!.category).toBe("site");
|
|
833
|
+
});
|
|
834
|
+
});
|
|
@@ -491,7 +491,7 @@ export abstract class PlaywrightPluginBase implements BrowserPlugin {
|
|
|
491
491
|
);
|
|
492
492
|
// checkPage handles all three: title (challenge phrases),
|
|
493
493
|
// body (challenge phrases + CDN patterns), and HTML (CAPTCHA embeds).
|
|
494
|
-
return checkPage(title, bodyText, html)
|
|
494
|
+
return checkPage(title, bodyText, html);
|
|
495
495
|
} catch {
|
|
496
496
|
return false;
|
|
497
497
|
}
|
|
@@ -148,7 +148,7 @@ export interface QuirksDescriptor extends ResultBase {
|
|
|
148
148
|
// ─── PythonPluginAdapter ──────────────────────────────────────────────
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
|
-
* Adapts a Python browser backend (running the `
|
|
151
|
+
* Adapts a Python browser backend (running the `PlaywrightBridge` protocol)
|
|
152
152
|
* to the TypeScript `BrowserPlugin` interface.
|
|
153
153
|
*/
|
|
154
154
|
export class PythonPluginAdapter implements BrowserPlugin {
|
|
@@ -322,7 +322,7 @@ export class PythonPluginAdapter implements BrowserPlugin {
|
|
|
322
322
|
env: {
|
|
323
323
|
...process.env,
|
|
324
324
|
PYTHONUNBUFFERED: "1",
|
|
325
|
-
//
|
|
325
|
+
// Make the shared `pi_browser_bridge` library
|
|
326
326
|
// importable from any venv the user points `pythonPath`
|
|
327
327
|
// at, without requiring a `pip install` of the bridge.
|
|
328
328
|
// Appended to any existing PYTHONPATH so user entries keep
|
|
@@ -418,7 +418,7 @@ export class PythonPluginAdapter implements BrowserPlugin {
|
|
|
418
418
|
try {
|
|
419
419
|
await this._directRpcCall("ping", {}, PING_TIMEOUT_MS);
|
|
420
420
|
|
|
421
|
-
// ── Forward plugin config to the bridge
|
|
421
|
+
// ── Forward plugin config to the bridge ──
|
|
422
422
|
// Sent exactly once, immediately after the ping handshake and
|
|
423
423
|
// before any other RPC, so stealth subclasses can read launch
|
|
424
424
|
// options from `self.plugin_config.get("launch", {})` at
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
2
|
pi_browser_bridge — Shared Python bridge library for pi-lean-portal.
|
|
3
|
-
Provides
|
|
3
|
+
Provides PlaywrightBridge base class for Python browser backends.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from .
|
|
7
|
-
from .playwright_base import PlaywrightBridge
|
|
6
|
+
from .playwright_base import PlaywrightBridge, SessionNotFoundError, InvalidParamsError
|
|
8
7
|
from .accessibility import (
|
|
9
8
|
AriaCachedNode,
|
|
10
9
|
AriaParseResult,
|
|
@@ -16,7 +15,6 @@ from .accessibility import (
|
|
|
16
15
|
from .bot_detection import check_bot_detection
|
|
17
16
|
|
|
18
17
|
__all__ = [
|
|
19
|
-
"BrowserBridge",
|
|
20
18
|
"PlaywrightBridge",
|
|
21
19
|
"SessionNotFoundError",
|
|
22
20
|
"InvalidParamsError",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|