pi-lean-dimension 0.2.3 → 0.2.4

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.
Files changed (27) hide show
  1. package/node_modules/pi-lean-portal/__tests__/browser-toggle.test.ts +24 -0
  2. package/node_modules/pi-lean-portal/backends/chromium-py/__pycache__/bridge.cpython-313.pyc +0 -0
  3. package/node_modules/pi-lean-portal/backends/firefox-py/__pycache__/bridge.cpython-313.pyc +0 -0
  4. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/__init__.cpython-312.pyc +0 -0
  5. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/__init__.cpython-313.pyc +0 -0
  6. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/bridge.cpython-312.pyc +0 -0
  7. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/playwright_base.cpython-312.pyc +0 -0
  8. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/playwright_base.cpython-313.pyc +0 -0
  9. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/conftest.cpython-313-pytest-9.1.1.pyc +0 -0
  10. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_accessibility.cpython-313-pytest-9.1.1.pyc +0 -0
  11. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_bot_detection.cpython-313-pytest-9.1.1.pyc +0 -0
  12. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_browser_data.cpython-313-pytest-9.1.1.pyc +0 -0
  13. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_playwright_base_quirks.cpython-313-pytest-9.1.1.pyc +0 -0
  14. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_py_bridges.cpython-313-pytest-9.1.1.pyc +0 -0
  15. package/node_modules/pi-lean-portal/browser-toggle.ts +8 -3
  16. package/node_modules/pi-lean-portal/contributed/invisible-py/bridge.py +1 -1
  17. package/node_modules/pi-lean-portal/package.json +1 -1
  18. package/node_modules/pi-lean-search/package.json +1 -1
  19. package/package.json +3 -3
  20. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/bridge.cpython-313.pyc +0 -0
  21. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/patch_playwright.cpython-313.pyc +0 -0
  22. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_accessibility.cpython-313.pyc +0 -0
  23. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_bot_detection.cpython-313.pyc +0 -0
  24. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_browser_data.cpython-313.pyc +0 -0
  25. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_chromium_py_bridge.cpython-313-pytest-9.1.1.pyc +0 -0
  26. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_firefox_py_bridge.cpython-313-pytest-9.1.1.pyc +0 -0
  27. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_playwright_base_quirks.cpython-313.pyc +0 -0
@@ -381,6 +381,30 @@ describe("applyBrowserState(false) — disable", () => {
381
381
  expect(calledWith).not.toContain(tool);
382
382
  }
383
383
  });
384
+
385
+ it("does not re-enable tools that were already inactive", () => {
386
+ // /web off must only remove portal's own tools. Any other tool that
387
+ // was inactive (disabled by a peer toggle, a config default, etc.)
388
+ // must stay inactive — a toggle affects no tools outside its own set.
389
+ // Regression guard: the previous implementation rebuilt the set from
390
+ // getAllTools(), silently re-activating every registered non-browser
391
+ // tool. We now filter from getActiveTools() so peer toggles compose.
392
+ const OTHER_TOOL = { name: "peer-ext-tool", description: "x" };
393
+ const pi = mockPi({
394
+ tools: [...ALL_BROWSER_TOOLS, OTHER_TOOL, ...NON_BROWSER_TOOLS],
395
+ activeTools: [
396
+ ...ALL_BROWSER_TOOLS.map((t) => t.name),
397
+ ...NON_BROWSER_TOOLS.map((t) => t.name),
398
+ ], // OTHER_TOOL intentionally absent (off)
399
+ });
400
+ applyBrowserState(pi, false);
401
+ const setActive = pi.setActiveTools as ReturnType<typeof vi.fn>;
402
+ const calledWith: string[] = setActive.mock.calls[0]![0] as string[];
403
+ expect(calledWith).not.toContain("peer-ext-tool");
404
+ for (const name of ALL_BROWSER_TOOLS.map((t) => t.name)) {
405
+ expect(calledWith).not.toContain(name);
406
+ }
407
+ });
384
408
  });
385
409
 
386
410
  // ==================================================================
@@ -142,9 +142,14 @@ function applyBrowserState(pi: ExtensionAPI, enable: boolean): void {
142
142
  const current = pi.getActiveTools();
143
143
  pi.setActiveTools([...new Set([...current, ...registered])]);
144
144
  } else {
145
- // Keep everything that is NOT a browser+sibling tool
146
- const all = pi.getAllTools().map((t) => t.name);
147
- pi.setActiveTools(all.filter((name) => !registered.has(name)));
145
+ // Keep everything that is NOT a browser+sibling tool — but only
146
+ // within the *currently active* set. Using getActiveTools() (not
147
+ // getAllTools()) is critical for peer-toggle composition: /web off
148
+ // must not re-enable tools that another toggle (e.g. host's /api off)
149
+ // has already disabled. getAllTools() would silently re-activate
150
+ // every registered tool outside our own set.
151
+ const current = pi.getActiveTools();
152
+ pi.setActiveTools(current.filter((name) => !registered.has(name)));
148
153
  }
149
154
  }
150
155
 
@@ -85,7 +85,7 @@ import time
85
85
  from typing import Any
86
86
 
87
87
  from pi_browser_bridge.playwright_base import PlaywrightBridge
88
- from pi_browser_bridge.bridge import SessionNotFoundError
88
+ from pi_browser_bridge.playwright_base import SessionNotFoundError
89
89
 
90
90
 
91
91
  class InvisiblePyBridge(PlaywrightBridge):
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-lean-portal",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Pi extension. Interactive web browsing for Pi — a /web toggle removes the tools from context when switched off, Playwright Chromium/Firefox deliver accessibility-tree snapshots, persistent profiles, cookies, and domain-matched guides; custom/stealth backends (Camoufox) plug in when a site blocks the shipped browsers.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-lean-search",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Pi extension. SearXNG search tool for Pi — pairs with pi-lean-portal's /web toggle; search-only installs are valid, or add it to a portal install for the full web-tools suite.",
5
5
  "keywords": [
6
6
  "pi-package",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-lean-dimension",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Pi extension. The full Pi web-tools suite in one install — interactive browsing (pi-lean-portal) plus SearXNG search (pi-lean-search), unified under a /web toggle that removes the tools from context when switched off.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -32,8 +32,8 @@
32
32
  ]
33
33
  },
34
34
  "dependencies": {
35
- "pi-lean-portal": "^0.2.3",
36
- "pi-lean-search": "^0.2.3"
35
+ "pi-lean-portal": "^0.2.4",
36
+ "pi-lean-search": "^0.2.4"
37
37
  },
38
38
  "bundledDependencies": [
39
39
  "pi-lean-portal",