donsetch 3.6.7 → 4.1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pi-extension.ts +7 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donsetch",
3
- "version": "3.6.7",
3
+ "version": "4.1.1",
4
4
  "description": "Web fetch, search and crawl for AI agents. Zero API keys. Chrome-true TLS.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "author": "Bishesh Bhandari",
package/pi-extension.ts CHANGED
@@ -389,9 +389,8 @@ function shortUrl(url: string): string {
389
389
  * engine), or the provider name ("exa", "tavily", "serper",
390
390
  * "tinyfish") for BYOK.
391
391
  */
392
- function getSearchProvider(sc: any): string {
393
- if (!sc) return "local";
394
- const provider = sc.provider;
392
+ function getSearchProvider(sc: any, dbg: any): string {
393
+ const provider = (sc && sc.provider) || (dbg && dbg.provider) || null;
395
394
  if (!provider || provider === "null") return "local";
396
395
  return String(provider);
397
396
  }
@@ -493,6 +492,10 @@ export default function (pi: ExtensionAPI) {
493
492
  const isErr = result?.isError ?? false;
494
493
  const sc = result?.structuredContent ?? null;
495
494
  const dbg = result?._meta?.["com.donsetch/fetch-debug"] ?? null;
495
+ // Issue #172: provider moved to _meta for compact search
496
+ // responses, so the BYOK label must read the telemetry
497
+ // object too instead of blaming "local" on every search.
498
+ const sdbg = result?._meta?.["com.donsetch/search-debug"] ?? null;
496
499
 
497
500
  // Build details for TUI rendering
498
501
  const details: any = {
@@ -504,7 +507,7 @@ export default function (pi: ExtensionAPI) {
504
507
  if (toolName === "web_search") {
505
508
  details.results = countSearchResults(text);
506
509
  details.topResult = getFirstResultTitle(text);
507
- details.provider = getSearchProvider(sc);
510
+ details.provider = getSearchProvider(sc, sdbg);
508
511
  } else if (toolName === "web_fetch") {
509
512
  details.source = getFetchSource(sc, dbg);
510
513
  details.status = getFetchStatus(sc);