pi-lean-search 0.3.2 → 0.3.3
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/index.ts +21 -1
- package/package.json +2 -2
package/index.ts
CHANGED
|
@@ -16,7 +16,11 @@ import type {
|
|
|
16
16
|
ExtensionContext,
|
|
17
17
|
ThemeColor,
|
|
18
18
|
} from "@earendil-works/pi-coding-agent";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
defineToolset,
|
|
21
|
+
TOOLSET_EVENTS,
|
|
22
|
+
getDefaultResolutionMode,
|
|
23
|
+
} from "pi-tool-masking";
|
|
20
24
|
import type { ToolsetSpec, ToolsetChangedEvent } from "pi-tool-masking";
|
|
21
25
|
import { readSearxngUrl } from "./search-config.js";
|
|
22
26
|
import { webSearchTool } from "./web-search-tool.js";
|
|
@@ -199,9 +203,25 @@ export default function (pi: ExtensionAPI) {
|
|
|
199
203
|
|
|
200
204
|
// ── Co-activation: mirror pi-lean-dimension.web changed events ─
|
|
201
205
|
// Listen on changed ONLY, not restored (§10.1).
|
|
206
|
+
//
|
|
207
|
+
// Focus-mode guard: while allowlist focus holds the line, skip
|
|
208
|
+
// co-activation. The focus set is authoritative, so a web `changed` event
|
|
209
|
+
// — including one a stale library `doRestore` emits during resume — must
|
|
210
|
+
// not disable search or write a focus-indistinguishable {enabled} entry.
|
|
211
|
+
// The published `DefaultResolutionMode` type doesn't name `"allowlist"`
|
|
212
|
+
// (it ships in pi-tool-masking 1.2.0), so the string cast is load-bearing:
|
|
213
|
+
// an allowlist-capable consumer sharing the `globalThis` module state
|
|
214
|
+
// writes `"allowlist"` into it and we read it back here. No-op for
|
|
215
|
+
// ordinary users on published versions, where nothing ever writes
|
|
216
|
+
// `"allowlist"`.
|
|
217
|
+
//
|
|
218
|
+
// Cleanup at the ^1.2.0 bump: drop the `as string` cast once
|
|
219
|
+
// `DefaultResolutionMode` names `"allowlist"` — same as the matching cast
|
|
220
|
+
// in pi-lean-portal's browser-toggle focus guard.
|
|
202
221
|
pi.events.on(TOOLSET_EVENTS.changed, (data: unknown) => {
|
|
203
222
|
const event = data as ToolsetChangedEvent;
|
|
204
223
|
if (event.id === "pi-lean-dimension.web") {
|
|
224
|
+
if ((getDefaultResolutionMode() as string) === "allowlist") return;
|
|
205
225
|
if (event.enabled) {
|
|
206
226
|
searchToolset.enable(pi);
|
|
207
227
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-lean-search",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"test": "vitest run"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"pi-tool-masking": "^1.
|
|
41
|
+
"pi-tool-masking": "^1.1.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@earendil-works/pi-ai": "*",
|