pi-chrome-search 2.2.0 → 2.2.1
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/package.json +1 -1
- package/src/tools/web_doctor.ts +13 -2
- package/src/tools/web_search.ts +14 -4
package/package.json
CHANGED
package/src/tools/web_doctor.ts
CHANGED
|
@@ -31,6 +31,7 @@ import type { DoctorCdp, DoctorDeps, DoctorEngine, DoctorReport, DoctorVerdict }
|
|
|
31
31
|
import { applyDoctorFix, buildDoctorReport } from "../runtime/doctor.ts";
|
|
32
32
|
import type { FailureJson, ToolTextBlock } from "../runtime/errors.ts";
|
|
33
33
|
import { fail, renderToolFailure, toFailure } from "../runtime/errors.ts";
|
|
34
|
+
import { tildify } from "../runtime/host.ts";
|
|
34
35
|
|
|
35
36
|
// ---------------------------------------------------------------------------
|
|
36
37
|
// Input schema (plain literals: provider-safe, no enum helper)
|
|
@@ -85,9 +86,16 @@ export interface WebDoctorTool {
|
|
|
85
86
|
): Promise<WebDoctorResult>;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Kept well under the 350-char per-tool cap; measured in the lane test.
|
|
91
|
+
*
|
|
92
|
+
* S3.7: it names the config file path and the per-engine enabled state because
|
|
93
|
+
* that is how an agent finds the file it may be asked to edit — a `find /` is
|
|
94
|
+
* not a diagnosis, and a deferred tool whose description omits the path is not
|
|
95
|
+
* discoverable by "where is my web-search config".
|
|
96
|
+
*/
|
|
89
97
|
export const WEB_DOCTOR_DESCRIPTION =
|
|
90
|
-
"Diagnose
|
|
98
|
+
"Diagnose Chrome attach, lock, window, and per-engine enabled state plus probe verdicts; it prints the config file path to edit. fix reconnects, closes only owned tabs, prunes artifacts.";
|
|
91
99
|
|
|
92
100
|
const INPUT_HINT = "check the web_doctor arguments: probe and fix are booleans";
|
|
93
101
|
|
|
@@ -148,6 +156,9 @@ export function renderWebDoctorText(report: DoctorReport, actions: readonly stri
|
|
|
148
156
|
`web_doctor: ${report.verdict} — cdp ${report.cdp.status}, webdriver ${webdriver}, ` +
|
|
149
157
|
`lock ${report.cdp.lock.locked ? "held" : "free"}`,
|
|
150
158
|
);
|
|
159
|
+
// S3.7: the config path is a first-class answer, not a detail buried in the
|
|
160
|
+
// CLI's full report. An agent asked to enable an engine edits this file.
|
|
161
|
+
lines.push(`config: ${tildify(report.config.path)}`);
|
|
151
162
|
if (report.cdp.error !== undefined) {
|
|
152
163
|
lines.push(`cdp error [${report.cdp.error.code}] ${report.cdp.error.stage}: ${report.cdp.error.hint}`);
|
|
153
164
|
}
|
package/src/tools/web_search.ts
CHANGED
|
@@ -194,20 +194,30 @@ export interface WebSearchTool {
|
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
196
|
* Kept under 350 chars (asserted in the unit test and re-measured by P2-E's
|
|
197
|
-
* tool-budget test). It names the real browser, the
|
|
198
|
-
*
|
|
197
|
+
* tool-budget test). It names the real browser, the engines, the summary and
|
|
198
|
+
* the syntax that needs no rewriting, and nothing else: the prompt pays for
|
|
199
199
|
* every word.
|
|
200
|
+
*
|
|
201
|
+
* "Only when named" rather than "opt-in": the latter reads as "check the config
|
|
202
|
+
* before searching" and sent an agent hunting for `web-search.json` while both
|
|
203
|
+
* marketplaces were already enabled (S3.7). Naming an engine attempts it; a
|
|
204
|
+
* disabled one answers with E_UNSUPPORTED naming the key and the file.
|
|
200
205
|
*/
|
|
201
206
|
export const WEB_SEARCH_DESCRIPTION =
|
|
202
|
-
"Search the web for free in the user's visible Chrome (Google, DuckDuckGo, Yandex; Avito and Ozon
|
|
207
|
+
"Search the web for free in the user's visible Chrome (Google, DuckDuckGo, Yandex; Avito and Ozon only when named) with each engine's native AI summary. Compact results, n<=10. Call web_read on a result URL to get that page as paged Markdown. site:/filetype:/quoted queries pass through; engines: id, list, or auto.";
|
|
203
208
|
|
|
204
209
|
/**
|
|
205
210
|
* SPEC S3.6: `q` is passed verbatim, so narrowing happens in the query. The
|
|
206
211
|
* guideline is prompt text, not an argument, and stays under 400 chars.
|
|
212
|
+
*
|
|
213
|
+
* S3.7: the marketplace line must not send the agent to the config file before
|
|
214
|
+
* it has tried the call. It names the two ids, says `auto` never picks them and
|
|
215
|
+
* that a disabled engine explains itself, which is the whole decision an agent
|
|
216
|
+
* needs; pre-reading `web-search.json` is not part of it.
|
|
207
217
|
*/
|
|
208
218
|
export const WEB_SEARCH_GUIDELINES: readonly string[] = [
|
|
209
219
|
"web_search passes q verbatim: use quoted phrases, -term, OR, site:, filetype:; narrow by date with after:/before: on Google or date: on Yandex (there is no date argument).",
|
|
210
|
-
"engines:\"avito\" (listings)
|
|
220
|
+
"Marketplaces are named-only: engines:\"avito\" (listings) or \"ozon\" (goods); auto never picks them. Just name one — no config read first; if disabled, the error names the config key and file.",
|
|
211
221
|
];
|
|
212
222
|
|
|
213
223
|
/**
|