pi-lean-portal 0.2.3 → 0.3.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 CHANGED
@@ -61,7 +61,7 @@ The browser tools are **enabled by default**. You can:
61
61
 
62
62
  ## Extending it
63
63
 
64
- Beyond the toggle, two surfaces are user-extensible rather than hardcoded:
64
+ Beyond the toggle, three surfaces are extensible or shared rather than hardcoded:
65
65
 
66
66
  - **Navigation guides** — `web-learn` saves site-specific playbooks that
67
67
  auto-match by domain and resurface in later sessions. See
@@ -71,6 +71,14 @@ Beyond the toggle, two surfaces are user-extensible rather than hardcoded:
71
71
  and drive a patched engine like [Camoufox](https://github.com/daijro/camoufox)
72
72
  yourself. The full flow lives in [Backend Architecture](#backend-architecture)
73
73
  and [`contributed/README.md`](./contributed/README.md).
74
+ - **Toolset toggles** — the `/web` toggle is powered by the shared
75
+ [`pi-tool-masking`](https://github.com/coreyryanhanson/pi-tool-masking/) peer dep,
76
+ which handles active-set masking, sibling-tool union math, and the
77
+ `TOOLSET_EVENTS` protocol that keeps the `browser`/`search` status-bar
78
+ glyphs in sync across extensions. It's published as a general toggle
79
+ mechanism — any extension that hides/shows its own tools can build on the
80
+ same scheme so masking and glyph events stay consistent across the whole
81
+ agent, rather than each toggle reinventing its own.
74
82
 
75
83
  ---
76
84
 
@@ -265,6 +273,28 @@ HTML to Markdown. It does **not** create a browser session.
265
273
  | `pagination` | On-demand | Next buttons, infinite scroll, pages |
266
274
  | `search` | On-demand | Search boxes, comboboxes, result lists |
267
275
 
276
+ ### Overriding Built-in Guides
277
+
278
+ A same-named `.md` file in `~/.pi/agent/pi-lean-portal/web-guides/` (e.g.
279
+ `bot-detection.md`) **shadows the builtin entirely** — the whole guide is
280
+ replaced, not field-merged. To keep a pattern guide firing, include
281
+ `trigger.signal: botDetected` (or `dialogDetected`) in the frontmatter;
282
+ omitting it disables the trigger.
283
+
284
+ ```yaml
285
+ ---
286
+ category: pattern
287
+ trigger.signal: botDetected
288
+ icon: 🤖
289
+ shortName: my bot guide
290
+ ---
291
+ Custom guidance text for bot challenges.
292
+ ```
293
+
294
+ Site guides and pattern guides live in **disjoint namespaces** — a site guide
295
+ for `www.botdetection.com` does not collide with the `bot-detection` pattern
296
+ guide; both fire when applicable.
297
+
268
298
  ### Viewing Guides
269
299
 
270
300
  ```text
@@ -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).isBlocked;
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 `BrowserBridge` protocol)
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
- // Phase 0b: make the shared `pi_browser_bridge` library
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 (Phase 0) ──
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 BrowserBridge and PlaywrightBridge base classes for Python browser backends.
3
+ Provides PlaywrightBridge base class for Python browser backends.
4
4
  """
5
5
 
6
- from .bridge import BrowserBridge, SessionNotFoundError, InvalidParamsError
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",