donsetch 4.4.1 → 4.4.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.
package/README.md CHANGED
@@ -72,7 +72,7 @@ Downloads the prebuilt binary for your platform from [GitHub Releases](https://g
72
72
 
73
73
  Prefer HTTP over stdio? `donsetch mcp --http --port 8765`, clients connect to `http://localhost:8765/mcp`. Sessions, cancellation, `/health`, token auth (`DONSETCH_HTTP_TOKEN`) and per-request timeouts are documented in `donsetch mcp --help`.
74
74
 
75
- If your client shows only half of each result (tool metadata but no page text, or text but no citable URLs), it is dropping one of the two MCP result surfaces. `DONSETCH_MCP_TEXT_ONLY=1 donsetch mcp` forces the `[meta]` fold that fixes it for every client.
75
+ If your client shows only half of each result (tool metadata but no page text, or text but no citable URLs), it is dropping one of the two MCP result surfaces. Claude Code, VS Code, OpenCode, and the Pi extension get the `[meta]` fold automatically; `DONSETCH_MCP_TEXT_ONLY=1 donsetch mcp` forces it for every other client.
76
76
 
77
77
  ### 2. As a CLI (for humans and scripts)
78
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donsetch",
3
- "version": "4.4.1",
3
+ "version": "4.4.2",
4
4
  "description": "MCP server that gives AI agents the web: fetch, search, crawl and screenshot from one local Rust binary. Zero API keys, zero accounts, Chrome-true TLS.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "author": "Bishesh Bhandari",
package/pi-extension.ts CHANGED
@@ -388,6 +388,19 @@ function getPreview(text: string, maxLen = 72): string {
388
388
  return "";
389
389
  }
390
390
 
391
+ /** Parse the server's folded state block: a leading "[meta] {json}". */
392
+ function parseFoldedMeta(blocks: string[]): any {
393
+ for (const b of blocks) {
394
+ if (!b.startsWith("[meta] ")) continue;
395
+ try {
396
+ return JSON.parse(b.slice("[meta] ".length).trim());
397
+ } catch {
398
+ return null;
399
+ }
400
+ }
401
+ return null;
402
+ }
403
+
391
404
  /** Count numbered search results in text. */
392
405
  function countSearchResults(text: string): number {
393
406
  const matches = text.match(/^\d+\.\s/gm);
@@ -525,17 +538,22 @@ export default function (pi: ExtensionAPI) {
525
538
  _signal,
526
539
  callTimeoutFor(toolName, params)
527
540
  );
528
- // Join all content text blocks, skipping [meta] blocks.
529
- // [meta] blocks contain compact metadata for clients
530
- // (Claude Code, VSCode) that drop text when
531
- // structuredContent is present. Pi reads structuredContent
532
- // directly for details, so meta blocks are redundant here.
533
- const text = (result?.content ?? [])
534
- .map((b: any) => b?.text ?? "")
535
- .filter((t: string) => !t.startsWith("[meta]"))
536
- .join("") || "";
541
+ // Every content block, joined verbatim: this is exactly
542
+ // what pi hands the model. The server folds state into a
543
+ // leading [meta] block for the clients whose model sees
544
+ // only `content` (pi among them), and that block carries
545
+ // the result URLs behind the S handles, next_offset and
546
+ // error codes, so it must not be dropped here. The detail
547
+ // helpers below skip meta-shaped lines where they look
548
+ // for prose.
549
+ const blocks = (result?.content ?? []).map((b: any) => b?.text ?? "");
550
+ const text = blocks.join("") || "";
537
551
  const isErr = result?.isError ?? false;
538
- const sc = result?.structuredContent ?? null;
552
+ // Folded sessions omit structuredContent; when it is
553
+ // absent, recover the same state from the [meta] block so
554
+ // the TUI badge readers (blocked / thin / source) keep
555
+ // working.
556
+ const sc = result?.structuredContent ?? parseFoldedMeta(blocks);
539
557
  const dbg = result?._meta?.["com.donsetch/fetch-debug"] ?? null;
540
558
  // Issue #172: provider moved to _meta for compact search
541
559
  // responses, so the BYOK label must read the telemetry