pi-lean-portal 0.3.2 → 0.4.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 +21 -6
- package/browser-toggle.ts +23 -26
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -115,8 +115,10 @@ toggles guide-saving mode, and manages browser profiles.
|
|
|
115
115
|
### Persistence
|
|
116
116
|
|
|
117
117
|
The toggle state is stored in the conversation's branch history. A fresh
|
|
118
|
-
conversation starts with the default from `settings.json`
|
|
119
|
-
|
|
118
|
+
conversation starts with the default from `settings.json` — the
|
|
119
|
+
`pi-tool-masking` library's `toolsetDefaults` block (see
|
|
120
|
+
[Configuration (`settings.json`)](#configuration-settingsjson)), falling back
|
|
121
|
+
to the toolset's packaged default (`true` for `web`).
|
|
120
122
|
|
|
121
123
|
---
|
|
122
124
|
|
|
@@ -606,18 +608,31 @@ a `profile` parameter:
|
|
|
606
608
|
}
|
|
607
609
|
```
|
|
608
610
|
|
|
609
|
-
### `
|
|
611
|
+
### `toolsetDefaults` *(settings-based toolset defaults)*
|
|
610
612
|
|
|
611
|
-
Whether browser tools are enabled on fresh conversations
|
|
613
|
+
Whether browser tools are enabled on fresh conversations. Read by the
|
|
614
|
+
`pi-tool-masking` library at restore time, between the chat-branch tier and
|
|
615
|
+
the toolset's packaged default:
|
|
612
616
|
|
|
613
617
|
```jsonc
|
|
614
618
|
{
|
|
615
|
-
"
|
|
616
|
-
"
|
|
619
|
+
"toolsetDefaults": {
|
|
620
|
+
"toolset-state:pi-lean-dimension.web": { "enabled": true },
|
|
621
|
+
"toolset-state:pi-lean-dimension.web-learn": { "enabled": false },
|
|
622
|
+
"toolset-state:pi-lean-dimension.search": { "enabled": true }
|
|
617
623
|
}
|
|
618
624
|
}
|
|
619
625
|
```
|
|
620
626
|
|
|
627
|
+
- Keys are the toolsets' `persistKey` values (`toolset-state:<id>`).
|
|
628
|
+
- Omit a `toolsetDefaults` key to use the toolset's packaged default (`web`
|
|
629
|
+
and `search` default `true`; `web-learn` defaults `false`).
|
|
630
|
+
- The `search` key only applies when `pi-lean-search` is installed.
|
|
631
|
+
|
|
632
|
+
> The legacy `browserToggle.defaultEnabled` key is **removed in 0.4.0** — it
|
|
633
|
+
> is no longer read. If you pinned it, move the value into the matching
|
|
634
|
+
> `toolsetDefaults` entry above.
|
|
635
|
+
|
|
621
636
|
### `browser.maxStorageStateSize`
|
|
622
637
|
|
|
623
638
|
Size threshold for profile state warnings (default: 10 MB):
|
package/browser-toggle.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ExtensionAPI,
|
|
3
|
-
ExtensionCommandContext,
|
|
4
3
|
ExtensionContext,
|
|
5
4
|
ThemeColor,
|
|
6
5
|
} from "@earendil-works/pi-coding-agent";
|
|
@@ -10,7 +9,14 @@ import {
|
|
|
10
9
|
getDefaultResolutionMode,
|
|
11
10
|
} from "pi-tool-masking";
|
|
12
11
|
import type { ToolsetSpec } from "pi-tool-masking";
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
// Focus-mode guard: refuse actuating subcommands while the library holds the
|
|
14
|
+
// line — inclusion mode or allowlist focus (an upstream pi-tool-masking
|
|
15
|
+
// consumer).
|
|
16
|
+
function isFocusHolding(): boolean {
|
|
17
|
+
const mode = getDefaultResolutionMode();
|
|
18
|
+
return mode === "inclusion" || mode === "allowlist";
|
|
19
|
+
}
|
|
14
20
|
|
|
15
21
|
// ---- Toolset specs -----------------------------------------------
|
|
16
22
|
|
|
@@ -139,21 +145,10 @@ function renderBrowserGlyph(
|
|
|
139
145
|
// ---- Toggle initializer ------------------------------------------
|
|
140
146
|
|
|
141
147
|
export default function initBrowserToggle(pi: ExtensionAPI) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const webDefault =
|
|
147
|
-
browserToggleSegment &&
|
|
148
|
-
typeof browserToggleSegment["defaultEnabled"] === "boolean"
|
|
149
|
-
? (browserToggleSegment["defaultEnabled"] as boolean)
|
|
150
|
-
: true;
|
|
151
|
-
|
|
152
|
-
const webSpec: ToolsetSpec = {
|
|
153
|
-
...PORTAL_WEB_SPEC,
|
|
154
|
-
defaultEnabled: webDefault,
|
|
155
|
-
};
|
|
156
|
-
const webToolset = defineToolset(pi, webSpec);
|
|
148
|
+
// Settings-based toolset defaults (`toolsetDefaults` tier) are read by
|
|
149
|
+
// pi-tool-masking itself inside defineToolset/restore — pass the packaged
|
|
150
|
+
// spec straight through.
|
|
151
|
+
const webToolset = defineToolset(pi, PORTAL_WEB_SPEC);
|
|
157
152
|
const learnToolset = defineToolset(pi, PORTAL_LEARN_SPEC);
|
|
158
153
|
|
|
159
154
|
// ── Keep cached state in sync with library events ─────────
|
|
@@ -180,16 +175,18 @@ export default function initBrowserToggle(pi: ExtensionAPI) {
|
|
|
180
175
|
const cmd = args.trim().toLowerCase();
|
|
181
176
|
|
|
182
177
|
// Focus-mode guard (§13.2): refuse actuating subcommands while the
|
|
183
|
-
// library holds the line
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
178
|
+
// library holds the line — either inclusion mode or allowlist focus
|
|
179
|
+
// (an upstream pi-tool-masking consumer). Either way a sibling
|
|
180
|
+
// toggle must not write a focus-indistinguishable {enabled} entry.
|
|
181
|
+
// Read-only subcommands (status/profile/cookies/bare /web) stay
|
|
182
|
+
// unguarded, matching the focus controller's treatment of its own
|
|
183
|
+
// read-only commands.
|
|
184
|
+
if (["on", "off", "learn"].includes(cmd) && isFocusHolding()) {
|
|
185
|
+
const inInclusion = getDefaultResolutionMode() === "inclusion";
|
|
191
186
|
ctx.ui.notify(
|
|
192
|
-
|
|
187
|
+
inInclusion
|
|
188
|
+
? "Another plugin has active inclusion mode — this toolset can't be toggled while inclusion is holding the line. Deactivate it there first."
|
|
189
|
+
: "Focus mode (allowlist) is active — this toolset can't be toggled while focus is holding the line. Exit focus there first.",
|
|
193
190
|
"warning",
|
|
194
191
|
);
|
|
195
192
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-lean-portal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"node-html-parser": "^6.1.0",
|
|
59
|
-
"pi-tool-masking": "^1.
|
|
59
|
+
"pi-tool-masking": "^1.2.0",
|
|
60
60
|
"playwright": "^1.60.0",
|
|
61
61
|
"turndown": "^7.2.0"
|
|
62
62
|
},
|