pi-chrome-search 2.0.0 → 2.2.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 +18 -3
- package/package.json +5 -3
- package/src/config/defaults.ts +41 -1
- package/src/config/doc.ts +5 -0
- package/src/config/schema.ts +4 -0
- package/src/engines/avito.ts +552 -0
- package/src/engines/google.ts +87 -2
- package/src/engines/index.ts +14 -3
- package/src/engines/ozon.ts +493 -0
- package/src/engines/types.ts +67 -7
- package/src/engines/yandex.ts +29 -3
- package/src/extract/compact.ts +61 -5
- package/src/extract/facts.ts +39 -0
- package/src/runtime/doctor.ts +30 -3
- package/src/runtime/limiter.ts +5 -5
- package/src/runtime/panel.ts +2 -2
- package/src/tools/web_search.ts +46 -7
package/README.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# pi-chrome-search
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/pi-chrome-search)
|
|
4
|
+
[](https://www.npmjs.com/package/pi-chrome-search)
|
|
5
|
+
[](https://pi.dev/packages)
|
|
6
|
+
[](https://github.com/sh2nk/pi-chrome-search/actions/workflows/ci.yml)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](package.json)
|
|
9
|
+
|
|
3
10
|
Web search and page reading for [pi](https://pi.dev), through your own visible Chrome. Same profile,
|
|
4
11
|
cookies and IP. Google, DuckDuckGo and Yandex return compact Markdown and their native AI summary when
|
|
5
|
-
there is one
|
|
12
|
+
there is one; Avito listings (price, location, age) and Ozon goods (price, rating) are available opt-in.
|
|
13
|
+
No keys, no paid APIs, no headless mode, no fingerprint spoofing. Node 26+, Chrome 136+.
|
|
6
14
|
|
|
7
15
|
## Install
|
|
8
16
|
|
|
@@ -24,7 +32,7 @@ The window stays visible. The extension attaches to it and never launches, resta
|
|
|
24
32
|
<!-- tools:start -->
|
|
25
33
|
| Tool | Exposure | Arguments |
|
|
26
34
|
|---|---|---|
|
|
27
|
-
| `web_search` | direct | `q` string; `n?` integer 1..10; `engines?` "auto" or ("google" or "duckduckgo" or "yandex") or list of ("google" or "duckduckgo" or "yandex") 1..
|
|
35
|
+
| `web_search` | direct | `q` string; `n?` integer 1..10; `engines?` "auto" or ("google" or "duckduckgo" or "yandex" or "avito" or "ozon") or list of ("google" or "duckduckgo" or "yandex" or "avito" or "ozon") 1..5; `summary?` boolean; `page?` integer >=1; `format?` "md" or "json" |
|
|
28
36
|
| `web_read` | direct | `url` string; `offset?` integer >=0; `maxChars?` integer >=1; `format?` "md" or "text" |
|
|
29
37
|
| `image_search` | deferred | `q` string; `n?` integer 1..12; `engine?` "google" or "yandex"; `attach?` boolean or "bytes" |
|
|
30
38
|
| `web_research` | deferred | `q` string; `budget?` "quick" or "normal" or "deep" |
|
|
@@ -32,7 +40,14 @@ The window stays visible. The extension attaches to it and never launches, resta
|
|
|
32
40
|
<!-- tools:end -->
|
|
33
41
|
|
|
34
42
|
A call has one 60 second deadline. DuckDuckGo has no pagination: `page > 1` is reported as
|
|
35
|
-
`ignored.page
|
|
43
|
+
`ignored.page`; neither marketplace has an AI block, so `summary` is reported as `ignored.summary`. Every
|
|
44
|
+
unresolved link stays marked `unresolved`, and card facts (price/availability/rating/location) render on
|
|
45
|
+
their own line after the snippet.
|
|
46
|
+
|
|
47
|
+
`engines: "auto"` only ever means Google → DuckDuckGo → Yandex. Avito and Ozon are *special* engines:
|
|
48
|
+
off by default and reachable only by naming them. To turn one on, set `engines.avito.enabled` or
|
|
49
|
+
`engines.ozon.enabled` to `true` (Avito also takes `engines.avito.location`, a region slug such as
|
|
50
|
+
`kaluga` or `all`) in `~/.pi/agent/web-search.json` — ask your agent to do it, that is the intended path.
|
|
36
51
|
|
|
37
52
|
## Limits
|
|
38
53
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-chrome-search",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Free, keyless web search through the user's own visible Chrome (Google, DuckDuckGo, Yandex) for pi",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "Free, keyless web search through the user's own visible Chrome (Google, DuckDuckGo, Yandex, and opt-in Avito/Ozon listings) for pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"pi": {
|
|
@@ -45,7 +45,9 @@
|
|
|
45
45
|
"web-search",
|
|
46
46
|
"google",
|
|
47
47
|
"duckduckgo",
|
|
48
|
-
"yandex"
|
|
48
|
+
"yandex",
|
|
49
|
+
"avito",
|
|
50
|
+
"ozon"
|
|
49
51
|
],
|
|
50
52
|
"files": [
|
|
51
53
|
"index.ts",
|
package/src/config/defaults.ts
CHANGED
|
@@ -48,10 +48,39 @@ export interface YandexConfig {
|
|
|
48
48
|
lr: string;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
export interface AvitoConfig {
|
|
52
|
+
/**
|
|
53
|
+
* OFF by default (SPEC §15 D12): Avito is a *special* engine, so a fresh
|
|
54
|
+
* install must not touch its anti-bot machinery. Enabling it is one key in
|
|
55
|
+
* `web-search.json`; the disabled-engine hint names the file.
|
|
56
|
+
*/
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Region path slug in the Avito URL (`all`, `moskva`, `kaluga`), not a display
|
|
60
|
+
* name. `all` = every region; Avito itself falls back to nearby regions with
|
|
61
|
+
* delivery when the item is not sold locally.
|
|
62
|
+
*/
|
|
63
|
+
location: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface OzonConfig {
|
|
67
|
+
/**
|
|
68
|
+
* OFF by default (SPEC §15 D14), for the same reason as Avito: a marketplace
|
|
69
|
+
* is a special engine and a fresh install must not visit it by itself.
|
|
70
|
+
*
|
|
71
|
+
* There is no `location`: Ozon's region is a cookie-backed UI choice, not a
|
|
72
|
+
* URL parameter, so a config key for it would be a key that cannot work
|
|
73
|
+
* (S7.5).
|
|
74
|
+
*/
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
51
78
|
export interface EnginesConfig {
|
|
52
79
|
google: GoogleConfig;
|
|
53
80
|
duckduckgo: DuckDuckGoConfig;
|
|
54
81
|
yandex: YandexConfig;
|
|
82
|
+
avito: AvitoConfig;
|
|
83
|
+
ozon: OzonConfig;
|
|
55
84
|
}
|
|
56
85
|
|
|
57
86
|
export type PacingWindow = [number, number];
|
|
@@ -60,6 +89,9 @@ export interface PacingConfig {
|
|
|
60
89
|
google: PacingWindow;
|
|
61
90
|
duckduckgo: PacingWindow;
|
|
62
91
|
yandex: PacingWindow;
|
|
92
|
+
/** Slowest windows: both marketplaces are aggressive about automation. */
|
|
93
|
+
avito: PacingWindow;
|
|
94
|
+
ozon: PacingWindow;
|
|
63
95
|
}
|
|
64
96
|
|
|
65
97
|
export interface SearchConfig {
|
|
@@ -130,8 +162,16 @@ export const DEFAULT_CONFIG: Config = {
|
|
|
130
162
|
google: { enabled: true, lang: "auto", gl: "auto" },
|
|
131
163
|
duckduckgo: { enabled: true, kl: "auto" },
|
|
132
164
|
yandex: { enabled: true, lr: "auto" },
|
|
165
|
+
avito: { enabled: false, location: "all" },
|
|
166
|
+
ozon: { enabled: false },
|
|
167
|
+
},
|
|
168
|
+
pacing: {
|
|
169
|
+
google: [2500, 5000],
|
|
170
|
+
yandex: [5000, 9000],
|
|
171
|
+
duckduckgo: [2000, 4000],
|
|
172
|
+
avito: [6000, 12000],
|
|
173
|
+
ozon: [6000, 12000],
|
|
133
174
|
},
|
|
134
|
-
pacing: { google: [2500, 5000], yandex: [5000, 9000], duckduckgo: [2000, 4000] },
|
|
135
175
|
search: {
|
|
136
176
|
budgetMs: 60000,
|
|
137
177
|
n: 5,
|
package/src/config/doc.ts
CHANGED
|
@@ -28,9 +28,14 @@ const CONFIG_DOCS: Readonly<Record<string, string>> = {
|
|
|
28
28
|
"engines.duckduckgo.kl": "Region/language; `auto` omits it.",
|
|
29
29
|
"engines.yandex.enabled": "Use Yandex.",
|
|
30
30
|
"engines.yandex.lr": "`lr`; `auto` omits it.",
|
|
31
|
+
"engines.avito.enabled": "Use the Avito marketplace engine (special: only an explicit `engines: \"avito\"` reaches it, `auto` never does). Off by default.",
|
|
32
|
+
"engines.avito.location": "Region path slug in the Avito URL (`all`, `moskva`, `kaluga`), not a display name.",
|
|
33
|
+
"engines.ozon.enabled": "Use the Ozon marketplace engine (special: only an explicit `engines: \"ozon\"` reaches it, `auto` never does). Off by default.",
|
|
31
34
|
"pacing.google": "Min/max gap in ms between Google searches.",
|
|
32
35
|
"pacing.duckduckgo": "Min/max gap in ms between DuckDuckGo searches.",
|
|
33
36
|
"pacing.yandex": "Min/max gap in ms between Yandex searches.",
|
|
37
|
+
"pacing.avito": "Min/max gap in ms between Avito searches.",
|
|
38
|
+
"pacing.ozon": "Min/max gap in ms between Ozon searches.",
|
|
34
39
|
"search.budgetMs": "Whole-call deadline in ms; pacing, settle, AI wait and link resolution draw from it (S8.1).",
|
|
35
40
|
"search.n": "Default result count.",
|
|
36
41
|
"search.nMax": "Hard ceiling for `n`; never above 10.",
|
package/src/config/schema.ts
CHANGED
|
@@ -54,6 +54,8 @@ export const CONFIG_SPEC: Spec = {
|
|
|
54
54
|
google: { kind: "object", fields: { enabled: BOOL, lang: STRING_NE, gl: STRING_NE } },
|
|
55
55
|
duckduckgo: { kind: "object", fields: { enabled: BOOL, kl: STRING_NE } },
|
|
56
56
|
yandex: { kind: "object", fields: { enabled: BOOL, lr: STRING_NE } },
|
|
57
|
+
avito: { kind: "object", fields: { enabled: BOOL, location: STRING_NE } },
|
|
58
|
+
ozon: { kind: "object", fields: { enabled: BOOL } },
|
|
57
59
|
},
|
|
58
60
|
},
|
|
59
61
|
pacing: {
|
|
@@ -62,6 +64,8 @@ export const CONFIG_SPEC: Spec = {
|
|
|
62
64
|
google: { kind: "tuple", items: [NUM(0), NUM(0)] },
|
|
63
65
|
duckduckgo: { kind: "tuple", items: [NUM(0), NUM(0)] },
|
|
64
66
|
yandex: { kind: "tuple", items: [NUM(0), NUM(0)] },
|
|
67
|
+
avito: { kind: "tuple", items: [NUM(0), NUM(0)] },
|
|
68
|
+
ozon: { kind: "tuple", items: [NUM(0), NUM(0)] },
|
|
65
69
|
},
|
|
66
70
|
},
|
|
67
71
|
search: {
|