pi-lean-dimension 0.5.0 → 0.6.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/README.md +5 -3
- package/node_modules/pi-lean-host/AGENTS.md +13 -6
- package/node_modules/pi-lean-host/__tests__/api-learn-fetch-recipe.test.ts +282 -10
- package/node_modules/pi-lean-host/__tests__/api-learn-multi-file.test.ts +8 -16
- package/node_modules/pi-lean-host/__tests__/api-probe.test.ts +276 -279
- package/node_modules/pi-lean-host/__tests__/api-scaffold.test.ts +12 -33
- package/node_modules/pi-lean-host/__tests__/api-toggle.test.ts +14 -12
- package/node_modules/pi-lean-host/__tests__/bootstrap-command.test.ts +1 -7
- package/node_modules/pi-lean-host/__tests__/delete-command.test.ts +1 -12
- package/node_modules/pi-lean-host/__tests__/guide-catalog.test.ts +484 -0
- package/node_modules/pi-lean-host/__tests__/helpers.test.ts +0 -132
- package/node_modules/pi-lean-host/__tests__/oauth-command.test.ts +95 -0
- package/node_modules/pi-lean-host/__tests__/oauth-flow.test.ts +163 -0
- package/node_modules/pi-lean-host/__tests__/oauth-mint.test.ts +79 -6
- package/node_modules/pi-lean-host/__tests__/parse-api-guide.test.ts +4 -409
- package/node_modules/pi-lean-host/__tests__/response-spill.test.ts +0 -1
- package/node_modules/pi-lean-host/__tests__/secrets-command.test.ts +19 -35
- package/node_modules/pi-lean-host/__tests__/smoke.test.ts +1 -82
- package/node_modules/pi-lean-host/__tests__/ssrf-guard.test.ts +98 -0
- package/node_modules/pi-lean-host/__tests__/test-utils.ts +73 -0
- package/node_modules/pi-lean-host/__tests__/tools.test.ts +2 -518
- package/node_modules/pi-lean-host/__tests__/transport.test.ts +178 -31
- package/node_modules/pi-lean-host/__tests__/verify-command.test.ts +1 -8
- package/node_modules/pi-lean-host/__tests__/verify-stamp.test.ts +1 -4
- package/node_modules/pi-lean-host/api-guides/boe/local-helper.test.ts +9 -20
- package/node_modules/pi-lean-host/api-guides/dnb/error-envelope.test.ts +6 -18
- package/node_modules/pi-lean-host/api-guides/dnb/resumption-token.test.ts +6 -18
- package/node_modules/pi-lean-host/api-guides/frost-sensorthings/dotted-key.test.ts +6 -18
- package/node_modules/pi-lean-host/api-guides/github/static-key.test.ts +7 -25
- package/node_modules/pi-lean-host/api-guides/inaturalist/derived-id.test.ts +6 -18
- package/node_modules/pi-lean-host/api-guides/internet-archive/multi-recipe.test.ts +6 -26
- package/node_modules/pi-lean-host/api-guides/stripe/has-more.test.ts +6 -18
- package/node_modules/pi-lean-host/api-guides/telegram-bot/path-auth.test.ts +7 -25
- package/node_modules/pi-lean-host/api-guides/twitch/oauth2.test.ts +12 -47
- package/node_modules/pi-lean-host/api-guides/twitch-user/oauth-user.test.ts +11 -52
- package/node_modules/pi-lean-host/api-guides/usgs/transform.test.ts +10 -27
- package/node_modules/pi-lean-host/api-guides/wikidata-search/numeric-cursor.test.ts +6 -18
- package/node_modules/pi-lean-host/api-guides/wikimedia-action/token-bag.test.ts +9 -20
- package/node_modules/pi-lean-host/core/auth.ts +2 -1
- package/node_modules/pi-lean-host/core/helpers.ts +29 -35
- package/node_modules/pi-lean-host/core/oauth-command.ts +10 -8
- package/node_modules/pi-lean-host/core/oauth-flow.ts +20 -4
- package/node_modules/pi-lean-host/core/parse-api-guide.ts +3 -5
- package/node_modules/pi-lean-host/core/transport.ts +1 -1
- package/node_modules/pi-lean-host/package.json +1 -1
- package/node_modules/pi-lean-host/tools/api-guide.ts +18 -57
- package/node_modules/pi-lean-host/tools/api-learn.ts +20 -49
- package/node_modules/pi-lean-host/tools/api-probe.ts +17 -26
- package/node_modules/pi-lean-host/tools/api-scaffold.ts +20 -42
- package/node_modules/pi-lean-host/tools/utils.ts +69 -0
- package/node_modules/pi-lean-portal/AGENTS.md +4 -3
- package/node_modules/pi-lean-portal/README.md +9 -9
- package/node_modules/pi-lean-portal/__tests__/accessibility-tree.test.ts +0 -15
- package/node_modules/pi-lean-portal/__tests__/browser-install.test.ts +737 -0
- package/node_modules/pi-lean-portal/__tests__/browser-navigate.test.ts +33 -2
- package/node_modules/pi-lean-portal/__tests__/browser-status.test.ts +48 -25
- package/node_modules/pi-lean-portal/__tests__/browser-toggle-profile.test.ts +3 -9
- package/node_modules/pi-lean-portal/__tests__/browser-toggle.test.ts +3 -29
- package/node_modules/pi-lean-portal/__tests__/fetch-backend.test.ts +51 -0
- package/node_modules/pi-lean-portal/__tests__/helpers/__pycache__/mock-python-bridge.cpython-313-pytest-9.1.1.pyc +0 -0
- package/node_modules/pi-lean-portal/__tests__/helpers/__pycache__/mock-python-bridge.cpython-313.pyc +0 -0
- package/node_modules/pi-lean-portal/__tests__/helpers/mock-pi.ts +34 -0
- package/node_modules/pi-lean-portal/__tests__/helpers/mock-python-bridge.py +14 -24
- package/node_modules/pi-lean-portal/__tests__/plugin-registry.test.ts +0 -90
- package/node_modules/pi-lean-portal/__tests__/python-adapter.test.ts +32 -125
- package/node_modules/pi-lean-portal/__tests__/router-dispatch.test.ts +12 -170
- package/node_modules/pi-lean-portal/__tests__/router-session.test.ts +39 -151
- package/node_modules/pi-lean-portal/__tests__/web-guides.test.ts +1 -44
- package/node_modules/pi-lean-portal/backends/chromium/index.ts +1 -1
- package/node_modules/pi-lean-portal/backends/firefox/index.ts +1 -1
- package/node_modules/pi-lean-portal/backends/playwright-base/playwright-plugin.ts +1 -1
- 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/__pycache__/transport.cpython-312.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/transport.cpython-313.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/playwright_base.py +43 -57
- package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/transport.py +6 -21
- package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_accessibility.cpython-313-pytest-9.1.1.pyc +0 -0
- 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/__pycache__/test_playwright_base_quirks.cpython-313.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_transport.cpython-313-pytest-9.1.1.pyc +0 -0
- package/node_modules/pi-lean-portal/backends/python-base/tests/test_playwright_base_quirks.py +157 -73
- package/node_modules/pi-lean-portal/backends/python-base/tests/test_transport.py +15 -41
- package/node_modules/pi-lean-portal/browser-install.ts +454 -0
- package/node_modules/pi-lean-portal/browser-status.ts +21 -0
- package/node_modules/pi-lean-portal/browser-toggle.ts +13 -11
- package/node_modules/pi-lean-portal/core/fetch-backend.ts +2 -2
- package/node_modules/pi-lean-portal/core/router.ts +7 -32
- package/node_modules/pi-lean-portal/core/shared/session-manager.ts +1 -3
- package/node_modules/pi-lean-portal/index.ts +1 -18
- package/node_modules/pi-lean-portal/package.json +2 -1
- package/node_modules/pi-lean-portal/tools/browser-navigate.ts +6 -2
- package/node_modules/pi-lean-portal/tools/utils.ts +5 -6
- package/node_modules/pi-lean-search/AGENTS.md +5 -3
- package/node_modules/pi-lean-search/__tests__/web-search.test.ts +180 -127
- package/node_modules/pi-lean-search/index.ts +0 -3
- package/node_modules/pi-lean-search/package.json +1 -1
- package/node_modules/pi-lean-search/web-search-tool.ts +22 -13
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +19 -18
- package/node_modules/yaml/browser/dist/nodes/Alias.js +25 -23
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +19 -18
- package/node_modules/yaml/dist/nodes/Alias.js +25 -23
- package/node_modules/yaml/package.json +1 -1
- package/package.json +4 -4
|
@@ -239,13 +239,13 @@ Playwright Firefox (Juggler) and Playwright Chromium (CDP) serialize ARIA trees
|
|
|
239
239
|
- `core/shared/` — utilities used by both framework and plugins
|
|
240
240
|
- Plugins import from `../../core/plugin-api.js` and `../../core/shared/*.js`
|
|
241
241
|
- The router imports from `../../core/plugin-api.js` and `../../core/shared/*.js`
|
|
242
|
-
- `browser-cookies.ts`, `browser-profile.ts`, `browser-status.ts` live at the portal package root and import from `core/` — they're command handlers, not plugins.
|
|
242
|
+
- `browser-cookies.ts`, `browser-profile.ts`, `browser-status.ts` live at the portal package root and import from `core/` — they're command handlers, not plugins. `browser-install.ts` is also a package-root command handler, but imports only node builtins and peer packages (playwright resolution happens at call time via `createRequire`).
|
|
243
243
|
|
|
244
244
|
## Testing (portal detail)
|
|
245
245
|
|
|
246
246
|
The monorepo root owns the test split principle and the summary counts table; this section is the per-file detail for tests that live in this package.
|
|
247
247
|
|
|
248
|
-
**Portal structural (
|
|
248
|
+
**Portal structural (25 files; `ship-manifest` lives at the package root, the rest in `__tests__/`):** router-dispatch, browser-toggle, browser-toggle-profile, browser-install, browser-navigate, browser-status, session-manager, browser-data, plugin-registry, plugin-contract, plugin-config-browser, python-adapter, fetch-backend, accessibility-tree, plugin-loading, snapshot-cache, browser-inspect, web-guides, guide-providers, router-session, settings-reader, storage-state, nav-settle, probe-user-backend, ship-manifest
|
|
249
249
|
|
|
250
250
|
**Python bridge unit tests (6 files, pytest):** test_accessibility, test_bot_detection, test_transport, test_browser_data, test_py_bridges, test_playwright_base_quirks (the stealth-quirk flags: `_fingerprint_managed_context`, `_skip_default_viewport`, `_scroll_via_wheel`, `_eval_prefix`)
|
|
251
251
|
|
|
@@ -255,13 +255,14 @@ The monorepo root owns the test split principle and the summary counts table; th
|
|
|
255
255
|
|
|
256
256
|
- `plugin-contract.ts` — `runContractTests(name, factory, opts?)` validates any BrowserPlugin
|
|
257
257
|
- `mock-plugin.ts` — MockPlugin for structural contract validation
|
|
258
|
+
- `mock-pi.ts` — `mockCtx()` ExtensionContext stub + `captureWebHandler()` for command-handler tests
|
|
258
259
|
- `test-server.ts` — `startTestServer()` returns a local HTTP server for integration tests
|
|
259
260
|
- `mock-python-bridge.py` — Python bridge stub used by python-adapter tests
|
|
260
261
|
|
|
261
262
|
## Known Constraints & Debt
|
|
262
263
|
|
|
263
264
|
- **Console capture in Python backends** — Both `chromium-py` and `firefox-py` inherit console capture (500-entry ring buffer) and dialog auto-dismissal from `PlaywrightBridge._setup_page_session()` in `python-base`. All Python browser backends must subclass `PlaywrightBridge` to get session setup and JSON-RPC dispatch.
|
|
264
|
-
- **AbortSignal not supported on Python bridge** — the router passes `signal` through unconditionally (no capability check). The Python adapter accepts and silently ignores the signal.
|
|
265
|
+
- **AbortSignal not supported on Python bridge** — the router passes `signal` through unconditionally (no capability check). The Python adapter accepts and silently ignores the signal.
|
|
265
266
|
- **Sessions are per taskId** — mapped to `browser-NNN` keys via `_sessionKeys`/`_sessionCounter` in `core/shared/task-id.ts`. Created on first navigate, cleaned up on `session_shutdown`.
|
|
266
267
|
- **Python shared-context machinery removed** — Named profiles now use disk persistence (load-on-navigate via `storageState`) matching the TS Chromium plugin. Both backends use `ensure_session(task_id, config)` for all sessions.
|
|
267
268
|
- **Python bridge reuses BrowserContexts across navigations** — `ensure_session()` returns the existing session on re-navigate (unlike the TS Chromium plugin which creates a fresh context per navigate). This means in-process cookies survive re-navigation without explicit save, but also means `storageState` from the router is ignored on re-navigate (the context already exists). The Python adapter's `_persistState()` saves current cookies to disk before the navigate RPC for cross-process persistence.
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
pi install npm:pi-lean-portal
|
|
19
|
-
npx playwright install chromium firefox
|
|
20
19
|
```
|
|
21
20
|
|
|
21
|
+
Then run **`/web install`** inside pi to download browser binaries (these are not installed via npm).
|
|
22
|
+
|
|
22
23
|
Once loaded, you'll see a notification like:
|
|
23
24
|
|
|
24
25
|
> 🌐 Browser extension loaded (plugins: chromium, firefox). Try: web-fetch for static pages or browser-navigate for interactive browsing.
|
|
@@ -27,10 +28,6 @@ The browser tools are **enabled by default**: `web-fetch` for static pages,
|
|
|
27
28
|
`browser-navigate` (plus click/type/scroll/screenshots via `@e` refs) for
|
|
28
29
|
interactive browsing.
|
|
29
30
|
|
|
30
|
-
> **Playwright browser binaries are not downloaded during `npm install`.**
|
|
31
|
-
> Run `npx playwright install chromium firefox` separately. On first
|
|
32
|
-
> `browser-navigate` without them, you'll be prompted with the exact command.
|
|
33
|
-
|
|
34
31
|
---
|
|
35
32
|
|
|
36
33
|
## `/web` Command — Browser Toggle & Profiles
|
|
@@ -51,13 +48,16 @@ toggles guide-saving mode, and manages browser profiles.
|
|
|
51
48
|
| Command | Effect |
|
|
52
49
|
| ------- | ------ |
|
|
53
50
|
| `/web` | Show current toggle status and available sub-commands. |
|
|
54
|
-
| `/web status` | **Detailed runtime status** including toggle state, plugin health, active sessions, and profiles on disk. |
|
|
51
|
+
| `/web status` | **Detailed runtime status** including toggle state, plugin health, browser-binary presence, active sessions, and profiles on disk. |
|
|
52
|
+
| `/web install` | **Install browser binaries** via the bundled playwright CLI (checkbox dialog in the TUI; prints the manual command elsewhere). |
|
|
53
|
+
| `/web install chromium\|firefox` | Directly download one engine, no dialog. |
|
|
55
54
|
|
|
56
55
|
```text
|
|
57
56
|
🌐 Browser tools: ✅ on | 📖 Learn mode: ❌ off
|
|
58
57
|
────────────────────────────────────────
|
|
59
58
|
Status: idle
|
|
60
59
|
Plugins: chromium, firefox, chromium-py (disabled), firefox-py (disabled)
|
|
60
|
+
Browsers: chromium ✓ firefox ✓
|
|
61
61
|
Use web-fetch for stateless HTTP fetches.
|
|
62
62
|
Active sessions: 1
|
|
63
63
|
PW [chromium] https://example.com — Example Domain [profile: session]
|
|
@@ -225,9 +225,9 @@ and the router dispatches tool calls to the right plugin based on a
|
|
|
225
225
|
| `chromium-py` | Chromium | Python/Playwright | Disabled |
|
|
226
226
|
| `firefox-py` | Firefox | Python/Playwright | Disabled |
|
|
227
227
|
|
|
228
|
-
> **Install Firefox:**
|
|
229
|
-
> `firefox` backend. For the Python parity
|
|
230
|
-
> inside `backends/python-base/.venv`.
|
|
228
|
+
> **Install Firefox:** run `/web install firefox` inside pi to download the
|
|
229
|
+
> Firefox binary for the Node `firefox` backend. For the Python parity
|
|
230
|
+
> backends, install Playwright inside `backends/python-base/.venv`.
|
|
231
231
|
|
|
232
232
|
All four shipped backends support screenshots (viewport-sized, not
|
|
233
233
|
full-page), console capture, JS evaluation, bot detection, and dialog
|
|
@@ -148,21 +148,6 @@ describe("parseSnapshot — duplicate occurrences", () => {
|
|
|
148
148
|
});
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
-
// ─── buildLocator — structural verification ───────────────────────
|
|
152
|
-
|
|
153
|
-
describe("buildLocator occurrenceIndex behavior", () => {
|
|
154
|
-
it("always uses .nth(occurrenceIndex) even when index is 0", () => {
|
|
155
|
-
// buildLocator now ALWAYS calls .nth(occurrenceIndex) to avoid strict-
|
|
156
|
-
// mode violations from duplicate role+name elements. For unique
|
|
157
|
-
// elements with occurrenceIndex=0, .nth(0) is equivalent to the bare
|
|
158
|
-
// locator in Playwright — it targets element at index 0 which is the
|
|
159
|
-
// same as the only match.
|
|
160
|
-
const result = parseSnapshot('- button "Unique"');
|
|
161
|
-
const node = result.elements.get("e1")!;
|
|
162
|
-
expect(node.occurrenceIndex).toBe(0);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
151
|
// ─── Snapshot text format — @e refs ──────────────────────────────
|
|
167
152
|
|
|
168
153
|
describe("parseSnapshot text format", () => {
|