@herbertgao/pi-extensions 2026.9.18 → 2026.9.19

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.
Files changed (48) hide show
  1. package/README.md +19 -20
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/working-message.ts +21 -6
  4. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +15 -4
  5. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/index.ts +43 -7
  6. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +7 -2
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +1 -1
  8. package/node_modules/@herbertgao/pi-cc-extensions/package.json +2 -2
  9. package/node_modules/pi-antigravity/README.md +29 -6
  10. package/node_modules/pi-antigravity/package.json +12 -7
  11. package/node_modules/pi-antigravity/src/auth/accounts.ts +327 -0
  12. package/node_modules/pi-antigravity/src/auth/index.ts +9 -0
  13. package/node_modules/pi-antigravity/src/client/client.ts +1 -1
  14. package/node_modules/pi-antigravity/src/image/image.ts +4 -4
  15. package/node_modules/pi-antigravity/src/index.ts +203 -13
  16. package/node_modules/pi-antigravity/src/search/index.ts +1 -0
  17. package/node_modules/pi-antigravity/src/search/search.ts +325 -0
  18. package/node_modules/pi-antigravity/src/stream/stream.ts +191 -14
  19. package/node_modules/pi-antigravity/src/types/enums.ts +45 -36
  20. package/node_modules/pi-antigravity/src/types/types.ts +5 -12
  21. package/node_modules/pi-antigravity/src/utils/http.ts +7 -2
  22. package/node_modules/pi-antigravity/src/utils/util.ts +31 -3
  23. package/node_modules/pi-typesafe/README.md +2 -0
  24. package/node_modules/pi-typesafe/package.json +2 -1
  25. package/node_modules/pi-web-access/CHANGELOG.md +72 -0
  26. package/node_modules/pi-web-access/README.md +34 -13
  27. package/node_modules/pi-web-access/chrome-cookies.ts +79 -25
  28. package/node_modules/pi-web-access/curator-page.ts +5 -1
  29. package/node_modules/pi-web-access/curator-server.ts +2 -0
  30. package/node_modules/pi-web-access/dist/index.js +1337 -1009
  31. package/node_modules/pi-web-access/exa.ts +20 -52
  32. package/node_modules/pi-web-access/extract.ts +41 -4
  33. package/node_modules/pi-web-access/gemini-search.ts +12 -4
  34. package/node_modules/pi-web-access/index.ts +29 -37
  35. package/node_modules/pi-web-access/openai-search.ts +35 -7
  36. package/node_modules/pi-web-access/package.json +6 -5
  37. package/node_modules/pi-web-access/page-query.ts +2 -2
  38. package/node_modules/pi-web-access/query-rewrite.ts +2 -3
  39. package/node_modules/pi-web-access/ssrf-protection.ts +27 -10
  40. package/node_modules/pi-web-access/storage.ts +48 -77
  41. package/node_modules/pi-web-access/summary-model-scope.ts +6 -77
  42. package/node_modules/pi-web-access/summary-review.ts +3 -4
  43. package/node_modules/pi-web-access/tavily.ts +67 -20
  44. package/node_modules/pi-web-access/tool-activation.ts +53 -33
  45. package/node_modules/pi-web-access/utils.ts +1 -1
  46. package/node_modules/pi-web-access/you.ts +164 -0
  47. package/node_modules/pi-web-access/zai.ts +161 -0
  48. package/package.json +6 -6
@@ -15,8 +15,16 @@ interface BrowserConfig {
15
15
  keychainService?: string;
16
16
  keychainAccount?: string;
17
17
  secretToolApp?: string;
18
+ kwalletFolder?: string;
19
+ kwalletEntry?: string;
18
20
  }
19
21
 
22
+ type BrowserPassword = {
23
+ value: string | null;
24
+ source?: "secret-service" | "kwallet";
25
+ warning?: string;
26
+ };
27
+
20
28
  type SqliteRow = Record<string, unknown>;
21
29
  type SqliteFailure = "unavailable" | "query";
22
30
 
@@ -67,8 +75,8 @@ const MACOS_BROWSER_CONFIGS: BrowserConfig[] = [
67
75
  ];
68
76
 
69
77
  const LINUX_BROWSER_CONFIGS: BrowserConfig[] = [
70
- { id: "chromium", name: "Chromium", baseDir: ".config/chromium", secretToolApp: "chromium" },
71
- { id: "chrome", name: "Chrome", baseDir: ".config/google-chrome", secretToolApp: "chrome" },
78
+ { id: "chromium", name: "Chromium", baseDir: ".config/chromium", secretToolApp: "chromium", kwalletFolder: "Chromium Keys", kwalletEntry: "Chromium Safe Storage" },
79
+ { id: "chrome", name: "Chrome", baseDir: ".config/google-chrome", secretToolApp: "chrome", kwalletFolder: "Chrome Keys", kwalletEntry: "Chrome Safe Storage" },
72
80
  ];
73
81
 
74
82
  const WINDOWS_BROWSER_CONFIGS: BrowserConfig[] = [
@@ -76,7 +84,7 @@ const WINDOWS_BROWSER_CONFIGS: BrowserConfig[] = [
76
84
  { id: "edge", name: "Edge", baseDir: "Microsoft/Edge/User Data", usesLocalAppData: true },
77
85
  ];
78
86
 
79
- const browserPasswordCache = new Map<string, Promise<string | null>>();
87
+ const browserPasswordCache = new Map<string, Promise<BrowserPassword[]>>();
80
88
  let lastCookieDiagnostic: string | null = null;
81
89
  let lastCookieDiagnosticDetails: BrowserCookieDiagnosticDetails | null = null;
82
90
  let sqliteModule: typeof import("node:sqlite") | null = null;
@@ -194,10 +202,13 @@ export async function getBrowserCookiesForHosts(
194
202
  sawRequiredCookies = true;
195
203
  }
196
204
 
197
- const key = currentPlatform === "win32"
198
- ? await readWindowsEncryptionKey(config, home)
199
- : await readBrowserPassword(config, currentPlatform).then((password) => password ? pbkdf2Sync(password, "saltysalt", currentPlatform === "darwin" ? 1003 : 1, 16, "sha1") : null);
200
- if (!key) {
205
+ const browserPasswords = currentPlatform === "win32" ? [] : await readBrowserPasswords(config, currentPlatform);
206
+ for (const password of browserPasswords) if (password.warning) warningSet.add(password.warning);
207
+ const windowsKey = currentPlatform === "win32" ? await readWindowsEncryptionKey(config, home) : null;
208
+ const browserKeys = browserPasswords.flatMap((password) => password.value
209
+ ? [pbkdf2Sync(password.value, "saltysalt", currentPlatform === "darwin" ? 1003 : 1, 16, "sha1")]
210
+ : []);
211
+ if (currentPlatform === "win32" ? !windowsKey : browserKeys.length === 0) {
201
212
  warningSet.add(currentPlatform === "win32"
202
213
  ? `Could not read ${config.name} Windows cookie encryption key`
203
214
  : `Could not read ${config.name} cookie encryption password`);
@@ -220,6 +231,7 @@ export async function getBrowserCookiesForHosts(
220
231
  const entries: BrowserCookieEntry[] = [];
221
232
  const cookies: CookieMap = {};
222
233
  const requiredDecryptFailures = new Set<string>();
234
+ let kwalletAttempted = browserPasswords.some((password) => password.source === "kwallet");
223
235
  for (const row of rowsResult.rows) {
224
236
  const name = typeof row.name === "string" ? row.name : "";
225
237
  if (!name) continue;
@@ -227,9 +239,28 @@ export async function getBrowserCookiesForHosts(
227
239
  if (!value && typeof row.encrypted_value_hex === "string" && /^[0-9a-f]*$/i.test(row.encrypted_value_hex)) {
228
240
  const encrypted = Buffer.from(row.encrypted_value_hex, "hex");
229
241
  if (currentPlatform === "win32" && encrypted.subarray(0, 3).toString("utf8") === "v20") sawWindowsAppBoundCookie = true;
230
- value = currentPlatform === "win32"
231
- ? decryptWindowsCookieValue(encrypted, key, metaVersion.value >= 24)
232
- : decryptCookieValue(encrypted, key, metaVersion.value >= 24);
242
+ if (currentPlatform === "win32") {
243
+ value = decryptWindowsCookieValue(encrypted, windowsKey!, metaVersion.value >= 24);
244
+ } else {
245
+ for (const key of browserKeys) {
246
+ value = decryptCookieValue(encrypted, key, metaVersion.value >= 24);
247
+ if (value) break;
248
+ }
249
+ }
250
+ if (!value && currentPlatform === "linux" && !kwalletAttempted && browserPasswords.some((password) => password.source === "secret-service") && requiredCookies?.includes(name)) {
251
+ kwalletAttempted = true;
252
+ const fallback = await readKWalletPassword(config);
253
+ if (fallback.warning) warningSet.add(fallback.warning);
254
+ if (fallback.value) {
255
+ const key = pbkdf2Sync(fallback.value, "saltysalt", 1, 16, "sha1");
256
+ browserKeys.push(key);
257
+ value = decryptCookieValue(encrypted, key, metaVersion.value >= 24);
258
+ if (value) {
259
+ browserPasswords.push(fallback);
260
+ browserPasswordCache.set(passwordCacheKey(config, currentPlatform), Promise.resolve([...browserPasswords]));
261
+ }
262
+ }
263
+ }
233
264
  if (!value && requiredCookies?.includes(name)) requiredDecryptFailures.add(name);
234
265
  }
235
266
  if (!value) continue;
@@ -417,20 +448,24 @@ function removePkcs7Padding(buf: Buffer): Buffer {
417
448
  return !padding || padding > 16 ? buf : buf.subarray(0, buf.length - padding);
418
449
  }
419
450
 
420
- function readBrowserPassword(config: BrowserConfig, currentPlatform: typeof process.platform): Promise<string | null> {
421
- const cacheKey = `${currentPlatform}:${config.name}`;
451
+ function passwordCacheKey(config: BrowserConfig, currentPlatform: typeof process.platform): string {
452
+ return `${currentPlatform}:${config.name}`;
453
+ }
454
+
455
+ function readBrowserPasswords(config: BrowserConfig, currentPlatform: typeof process.platform): Promise<BrowserPassword[]> {
456
+ const cacheKey = passwordCacheKey(config, currentPlatform);
422
457
  const cached = browserPasswordCache.get(cacheKey);
423
458
  if (cached) return cached;
424
459
  const passwordResult = currentPlatform === "darwin"
425
460
  ? config.keychainAccount && config.keychainService
426
- ? readKeychainPassword(config.keychainAccount, config.keychainService).then(password => ({ password, cacheable: Boolean(password) }))
427
- : Promise.resolve({ password: null, cacheable: false })
461
+ ? readKeychainPassword(config.keychainAccount, config.keychainService).then(value => ({ value, cacheable: Boolean(value) }))
462
+ : Promise.resolve({ value: null, cacheable: false })
428
463
  : currentPlatform === "linux"
429
- ? readLinuxPassword(config.secretToolApp)
430
- : Promise.resolve({ password: null, cacheable: false });
431
- const passwordPromise = passwordResult.then(({ password, cacheable }) => {
464
+ ? readLinuxPassword(config)
465
+ : Promise.resolve({ value: null, cacheable: false });
466
+ const passwordPromise = passwordResult.then(({ cacheable, ...password }) => {
432
467
  if (!cacheable) browserPasswordCache.delete(cacheKey);
433
- return password;
468
+ return [password];
434
469
  }, (error) => {
435
470
  browserPasswordCache.delete(cacheKey);
436
471
  throw error;
@@ -477,17 +512,36 @@ function readKeychainPassword(account: string, service: string): Promise<string
477
512
  });
478
513
  }
479
514
 
480
- function readLinuxPassword(secretToolApp: string | undefined): Promise<{ password: string; cacheable: boolean }> {
481
- if (!secretToolApp) return Promise.resolve({ password: "peanuts", cacheable: true });
515
+ function readLinuxCommandPassword(command: string, args: string[]): Promise<{ value: string | null; failed: boolean }> {
482
516
  return new Promise((resolve) => {
483
- execFile("secret-tool", ["lookup", "application", secretToolApp], { timeout: 5000 }, (err, stdout) => {
484
- if (err) { resolve({ password: "peanuts", cacheable: false }); return; }
485
- const password = stdout.trim();
486
- resolve(password ? { password, cacheable: true } : { password: "peanuts", cacheable: false });
487
- });
517
+ execFile(command, args, { timeout: 5000 }, (err, stdout) => resolve({ value: err ? null : stdout.trim() || null, failed: Boolean(err) }));
488
518
  });
489
519
  }
490
520
 
521
+ function isKdeSession(): boolean {
522
+ const desktop = process.env.XDG_CURRENT_DESKTOP?.toLowerCase().split(":") ?? [];
523
+ return process.env.KDE_FULL_SESSION?.toLowerCase() === "true" || desktop.includes("kde");
524
+ }
525
+
526
+ async function readKWalletPassword(config: BrowserConfig): Promise<BrowserPassword> {
527
+ if (!isKdeSession() || !config.kwalletFolder || !config.kwalletEntry) return { value: null };
528
+ const result = await readLinuxCommandPassword("kwallet-query", ["-f", config.kwalletFolder, "-r", config.kwalletEntry, "kdewallet"]);
529
+ return {
530
+ value: result.value,
531
+ source: result.value ? "kwallet" : undefined,
532
+ ...(result.failed ? { warning: `Could not read ${config.name} KWallet cookie encryption password` } : {}),
533
+ };
534
+ }
535
+
536
+ async function readLinuxPassword(config: BrowserConfig): Promise<BrowserPassword & { cacheable: boolean }> {
537
+ if (!config.secretToolApp) return { value: "peanuts", cacheable: false };
538
+ const secretService = await readLinuxCommandPassword("secret-tool", ["lookup", "application", config.secretToolApp]);
539
+ if (secretService.value) return { value: secretService.value, source: "secret-service", cacheable: true };
540
+ const kwallet = await readKWalletPassword(config);
541
+ if (kwallet.value) return { ...kwallet, cacheable: true };
542
+ return { value: "peanuts", warning: kwallet.warning, cacheable: false };
543
+ }
544
+
491
545
  async function importSqlite(): Promise<typeof import("node:sqlite") | null> {
492
546
  if (process.env.PI_WEB_ACCESS_DISABLE_NODE_SQLITE === "1") return null;
493
547
  if (sqliteImportAttempted) return sqliteModule;
@@ -46,7 +46,9 @@ function buildProviderButtons(
46
46
  { value: "serpapi", label: "SerpApi", available: available.serpapi },
47
47
  { value: "serper", label: "Serper", available: available.serper },
48
48
  { value: "serply", label: "Serply", available: available.serply },
49
+ { value: "you", label: "You.com", available: available.you },
49
50
  { value: "baizhi", label: "Baizhi", available: available.baizhi },
51
+ { value: "zai", label: "Z.ai", available: available.zai },
50
52
  { value: "valyu", label: "Valyu", available: available.valyu },
51
53
  ];
52
54
 
@@ -1474,7 +1476,7 @@ const SCRIPT = `(function() {
1474
1476
  var token = DATA.sessionToken;
1475
1477
  var timeoutSec = DATA.timeout;
1476
1478
  var queries = Array.isArray(DATA.queries) ? DATA.queries : [];
1477
- var providers = ["auto", "all", "openai", "exa", "brave", "parallel", "parallel-mcp", "tinyfish", "search1api", "searchinfinity", "querit", "tavily", "firecrawl", "jina", "serpdive", "kagi", "bocha", "ollama", "searxng", "duckduckgo", "perplexity", "gemini", "kimi", "anysearch", "xcrawl", "xai", "mistral", "brightdata", "serpbase", "serpapi", "serper", "serply", "valyu", "baizhi"];
1479
+ var providers = ["auto", "all", "openai", "exa", "brave", "parallel", "parallel-mcp", "tinyfish", "search1api", "searchinfinity", "querit", "tavily", "firecrawl", "jina", "serpdive", "kagi", "bocha", "ollama", "searxng", "duckduckgo", "perplexity", "gemini", "kimi", "anysearch", "xcrawl", "xai", "mistral", "brightdata", "serpbase", "serpapi", "serper", "serply", "valyu", "baizhi", "you", "zai"];
1478
1480
  var availProviders = DATA.availableProviders && typeof DATA.availableProviders === "object" ? DATA.availableProviders : {};
1479
1481
  var workflow = "summary-review";
1480
1482
  var initialDefaultProvider = typeof DATA.defaultProvider === "string" ? DATA.defaultProvider : "exa";
@@ -1709,7 +1711,9 @@ const SCRIPT = `(function() {
1709
1711
  if (provider === "serpapi") return "SerpApi";
1710
1712
  if (provider === "serper") return "Serper";
1711
1713
  if (provider === "serply") return "Serply";
1714
+ if (provider === "you") return "You.com";
1712
1715
  if (provider === "baizhi") return "Baizhi";
1716
+ if (provider === "zai") return "Z.ai";
1713
1717
  if (provider === "valyu") return "Valyu";
1714
1718
  return "Unknown";
1715
1719
  }
@@ -305,7 +305,9 @@ export function startCuratorServer(
305
305
  if (provider === "serpbase") return availableProviders.serpbase;
306
306
  if (provider === "serper") return availableProviders.serper;
307
307
  if (provider === "serply") return availableProviders.serply;
308
+ if (provider === "you") return availableProviders.you;
308
309
  if (provider === "baizhi") return availableProviders.baizhi;
310
+ if (provider === "zai") return availableProviders.zai;
309
311
  if (provider === "valyu") return availableProviders.valyu;
310
312
  return false;
311
313
  }