donsetch 3.6.0 → 3.6.2

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 +11 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donsetch",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
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
@@ -397,14 +397,19 @@ function getSearchProvider(sc: any): string {
397
397
  }
398
398
 
399
399
  /**
400
- * Extract the fetch source label from structuredContent.
400
+ * Extract the fetch source label from model state with a
401
+ * client-only diagnostics fallback. Compact MCP contracts keep
402
+ * transport telemetry in _meta["com.donsetch/fetch-debug"], so the
403
+ * tier can live there; older servers still expose it on
404
+ * structuredContent.
401
405
  * Returns "cache" when tier is "1(warm)" (warm cookies, not a
402
406
  * fresh fetch), "ghost" when tier starts with "2" (browser
403
407
  * escalation), or "" for a normal tier-1 fetch.
404
408
  */
405
- function getFetchSource(sc: any): string {
406
- if (!sc) return "";
407
- const tier = String(sc.tier || "");
409
+ function getFetchSource(sc: any, dbg: any): string {
410
+ const tier = String(
411
+ (sc && sc.tier) || (dbg && dbg.tier) || ""
412
+ );
408
413
  if (tier.includes("warm")) return "cache";
409
414
  if (tier.startsWith("2")) return "ghost";
410
415
  return "";
@@ -487,6 +492,7 @@ export default function (pi: ExtensionAPI) {
487
492
  .join("") || "";
488
493
  const isErr = result?.isError ?? false;
489
494
  const sc = result?.structuredContent ?? null;
495
+ const dbg = result?._meta?.["com.donsetch/fetch-debug"] ?? null;
490
496
 
491
497
  // Build details for TUI rendering
492
498
  const details: any = {
@@ -500,7 +506,7 @@ export default function (pi: ExtensionAPI) {
500
506
  details.topResult = getFirstResultTitle(text);
501
507
  details.provider = getSearchProvider(sc);
502
508
  } else if (toolName === "web_fetch") {
503
- details.source = getFetchSource(sc);
509
+ details.source = getFetchSource(sc, dbg);
504
510
  details.status = getFetchStatus(sc);
505
511
  if (sc?.stitched) details.stitched = sc.stitched;
506
512
  } else if (toolName === "web_crawl") {