pi-quiver 3.4.1 → 4.0.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/CHANGELOG.md CHANGED
@@ -8,6 +8,16 @@ Published to npm as `pi-quiver` (`pi install npm:pi-quiver`). Pushing a
8
8
  via OIDC trusted publishing. The release helper at
9
9
  `.agents/skills/release/scripts/release.sh` cuts the tag; CI publishes.
10
10
 
11
+ ## v4.0.1 - 2026-08-04
12
+
13
+ - **Trimmed `fetch`/`doc_to_md` system-prompt guidelines that duplicated the tool descriptions** (~200 tokens). The two additive bits (degraded-result fidelity warning, grep-the-spilled-file guidance) moved into the tool descriptions; `promptGuidelines` dropped from both tools.
14
+
15
+ ## v4.0.0 - 2026-08-04
16
+
17
+ - **BREAKING: extension sources moved out of the package root** into `extensions/`; the shared config helper moved to `lib/extension-config.ts` (#4). If you disabled an extension through `pi config`, the stored filter (e.g. `-fast-mode.ts`) no longer matches any path and the extension will load again - re-disable it, or update the entry to `extensions/fast-mode.ts`. Hand-written `!fast-mode.ts` entries in `settings.json` are unaffected.
18
+ - **Local-checkout invocation changed:** `pi -e <path>/fetch.ts` is now `pi -e <path>/extensions/fetch.ts`.
19
+ - No behaviour change in any extension; `pi.extensions` is now a single directory entry and typecheck flags moved into `tsconfig.json`.
20
+
11
21
  ## v3.4.1 - 2026-08-04
12
22
 
13
23
  - **`fast-mode` now corrects reported `usage.cost` to true 2x fast pricing for Opus 4.8/5** (statusline, persisted cost, and pi-cohort `Σ$` per load order) (#6).
package/README.md CHANGED
@@ -62,12 +62,12 @@ A 300 KB changelog page never touches your context window - you get a preview an
62
62
 
63
63
  | Extension | Tool | What it does |
64
64
  | --- | --- | --- |
65
- | `fetch.ts` | `fetch` | Retrieve URLs over HTTP(S). HTML -> Markdown (Readability extraction, Turndown conversion). Binary saved untouched to a temp file. GitHub issue/PR/repo/actions-run URLs auto-route through `gh` (falls back to HTTP). Same size gate as `doc_to_md`. |
66
- | `doc_to_md.ts` | `doc_to_md` | Convert a local PDF/DOCX/PPTX to Markdown. High-fidelity via `pymupdf4llm` (run through `uv`); degraded pure-JS fallback (`unpdf`) when `uv`/Python is unavailable or conversion times out. DOCX/PPTX convert via LibreOffice first. |
67
- | `session-name.ts` | `/session-name` | Manual + opt-in automatic session naming, with Ghostty tab rename. OFF by default. |
68
- | `sword-header.ts` | `/builtin-header` | Themed ASCII startup header replacing pi's default logo. OFF by default. |
69
- | `fast-mode.ts` | `/fast` | Inject Anthropic fast-mode (`speed: "fast"` + `anthropic-beta: fast-mode-2026-02-01`) into every Claude Opus 4.8 / Opus 5 request, any thinking level. `--fast` flag + `/fast [on\|off\|status]`. OFF by default. |
70
- | `provider-stall-watchdog.ts` | - | Opt-in provider-stall recovery, in two tiers: a pre-first-event deadline (`firstEventMs`, 20s) on every provider request in every mode, and the mid-stream pair (warn at 2 min, recover at 4 min) in TUI runs only. Policy D offers each stall to Pi's retry loop until the stall retry budget (`maxStallRetries`, default = `retry.maxRetries`) is exhausted. OFF by default. |
65
+ | `extensions/fetch.ts` | `fetch` | Retrieve URLs over HTTP(S). HTML -> Markdown (Readability extraction, Turndown conversion). Binary saved untouched to a temp file. GitHub issue/PR/repo/actions-run URLs auto-route through `gh` (falls back to HTTP). Same size gate as `doc_to_md`. |
66
+ | `extensions/doc_to_md.ts` | `doc_to_md` | Convert a local PDF/DOCX/PPTX to Markdown. High-fidelity via `pymupdf4llm` (run through `uv`); degraded pure-JS fallback (`unpdf`) when `uv`/Python is unavailable or conversion times out. DOCX/PPTX convert via LibreOffice first. |
67
+ | `extensions/session-name.ts` | `/session-name` | Manual + opt-in automatic session naming, with Ghostty tab rename. OFF by default. |
68
+ | `extensions/sword-header.ts` | `/builtin-header` | Themed ASCII startup header replacing pi's default logo. OFF by default. |
69
+ | `extensions/fast-mode.ts` | `/fast` | Inject Anthropic fast-mode (`speed: "fast"` + `anthropic-beta: fast-mode-2026-02-01`) into every Claude Opus 4.8 / Opus 5 request, any thinking level. `--fast` flag + `/fast [on\|off\|status]`. OFF by default. |
70
+ | `extensions/provider-stall-watchdog.ts` | - | Opt-in provider-stall recovery, in two tiers: a pre-first-event deadline (`firstEventMs`, 20s) on every provider request in every mode, and the mid-stream pair (warn at 2 min, recover at 4 min) in TUI runs only. Policy D offers each stall to Pi's retry loop until the stall retry budget (`maxStallRetries`, default = `retry.maxRetries`) is exhausted. OFF by default. |
71
71
 
72
72
  Full routing rules, size-gate mechanics, and config: [doc/fetch.md](doc/fetch.md), [doc/doc-to-md.md](doc/doc-to-md.md).
73
73
 
@@ -120,7 +120,7 @@ pi -e npm:pi-quiver
120
120
 
121
121
  ```bash
122
122
  git clone git@github.com:jjuraszek/pi-quiver.git ~/repos/pi-quiver
123
- pi -e ~/repos/pi-quiver/fetch.ts
123
+ pi -e ~/repos/pi-quiver/extensions/fetch.ts
124
124
  ```
125
125
 
126
126
  ## Prerequisites
@@ -203,7 +203,7 @@ runtime deps; install them transiently and run the full check:
203
203
 
204
204
  ```bash
205
205
  npm install
206
- npm run test:all # node --test *.test.ts + tsc --noEmit typecheck
206
+ npm run test:all # node --test test/*.test.ts + tsc --noEmit typecheck
207
207
  ```
208
208
 
209
209
  `npm test` runs the unit tests alone; `npm run typecheck` runs the type pass.
@@ -250,7 +250,7 @@ let warmPromise: Promise<"warm" | "unavailable"> | null = null;
250
250
  let uvAvailable: boolean | null = null;
251
251
 
252
252
  function scriptPath(): string {
253
- return fileURLToPath(new URL("./scripts/pdf_to_md.py", import.meta.url));
253
+ return fileURLToPath(new URL("../scripts/pdf_to_md.py", import.meta.url));
254
254
  }
255
255
 
256
256
  async function onPath(cmd: string): Promise<boolean> {
@@ -357,15 +357,8 @@ export default function docToMdExtension(pi: ExtensionAPI) {
357
357
  name: "doc_to_md",
358
358
  label: "Convert doc to Markdown",
359
359
  description:
360
- "Convert a local PDF/DOCX/PPTX file to Markdown. High-fidelity conversion via pymupdf4llm (run through uv, fetched on first use); falls back to a degraded pure-JS text extractor (unpdf) when uv/Python is unavailable or conversion times out. DOCX/PPTX require LibreOffice (soffice) for the office->PDF step. Output over 32KB or 1000 lines is written to a temp .md file with a preview instead of inlined. Input must be a local file path (use fetch first for URLs).",
360
+ "Convert a local PDF/DOCX/PPTX file to Markdown. High-fidelity conversion via pymupdf4llm (run through uv, fetched on first use); falls back to a degraded pure-JS text extractor (unpdf) when uv/Python is unavailable or conversion times out. DOCX/PPTX require LibreOffice (soffice) for the office->PDF step. Output over 32KB or 1000 lines is written to a temp .md file with a preview instead of inlined - grep it or read with offset/limit. A degraded result (marked in the output) means the fallback ran: tables and headings are NOT faithfully preserved, treat structure with suspicion. Input must be a local file path (use fetch first for URLs).",
361
361
  promptSnippet: "Convert a local PDF/DOCX/PPTX to Markdown",
362
- promptGuidelines: [
363
- "Input is a LOCAL file path, not a URL — use the fetch tool first to download remote documents, then pass the saved path here.",
364
- "Supported types: .pdf, .docx, .pptx. Spreadsheets and other formats are not supported.",
365
- "DOCX/PPTX conversion requires LibreOffice (soffice) on PATH; without it those inputs error.",
366
- "A degraded result (marked in the output) means the pure-JS fallback ran — tables and headings are NOT faithfully preserved; treat structure with suspicion.",
367
- "When output is written to a file, grep it or read with offset/limit; Markdown is grep-able by heading (^#).",
368
- ],
369
362
  parameters: Type.Object({
370
363
  path: Type.String({ description: "Local path to a .pdf, .docx, or .pptx file" }),
371
364
  }),
@@ -23,7 +23,7 @@
23
23
 
24
24
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
25
25
  import type { Usage } from "@earendil-works/pi-ai";
26
- import { resolveConfig } from "./extension-config.ts";
26
+ import { resolveConfig } from "../lib/extension-config.ts";
27
27
 
28
28
  export const FAST_MODE_BETA = "fast-mode-2026-02-01";
29
29
  export const FAST_SPEED = "fast";
@@ -458,15 +458,8 @@ export default function fetchExtension(pi: ExtensionAPI) {
458
458
  name: "fetch",
459
459
  label: "Fetch URL",
460
460
  description:
461
- "Fetch a URL over HTTP(S). HTML is extracted to Markdown (readability + turndown). Binary content (images, PDFs, archives) is saved untouched to a temp file and only a path is returned. Text/Markdown/JSON over 32KB or 1000 lines is written to a temp file with a 60-line preview; smaller content is returned inline. Parsable downloads are capped at 1MB, binary at 50MB. GitHub issue/PR/repo/actions-run URLs are served via the gh CLI when available (falls back to HTTP otherwise).",
461
+ "Fetch a URL over HTTP(S). HTML is extracted to Markdown (readability + turndown). Binary content (images, PDFs, archives) is saved untouched to a temp file and only a path is returned. Text/Markdown/JSON over 32KB or 1000 lines is written to a temp file with a 60-line preview; smaller content is returned inline. Parsable downloads are capped at 1MB, binary at 50MB. When the body is written to a file, grep it or read with offset/limit; converted Markdown is grep-able by heading (^#). GitHub issue/PR/repo/actions-run URLs are served via the gh CLI when available (falls back to HTTP otherwise; raw=true forces the rendered HTML page).",
462
462
  promptSnippet: "Fetch the contents of a URL",
463
- promptGuidelines: [
464
- "Use fetch when the user provides a URL or asks to read web content.",
465
- "Binary responses return a file path only — pass that path to a tool that can process the bytes; do not expect inline content.",
466
- "When the body is written to a file, grep it or read with offset/limit. Converted Markdown is grep-able by heading (^#).",
467
- "Pass raw=true to skip Markdown/JSON conversion and get the decoded body as-is (still subject to the size gate).",
468
- "GitHub issue/PR/repo/actions-run links are fetched through the gh CLI automatically; pass raw=true to force the rendered HTML page.",
469
- ],
470
463
  parameters: Type.Object({
471
464
  url: Type.String({ description: "Absolute http(s) URL" }),
472
465
  method: Type.Optional(
@@ -1,5 +1,5 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { readSettings, resolveConfig, settingsPaths } from "./extension-config.ts";
2
+ import { readSettings, resolveConfig, settingsPaths } from "../lib/extension-config.ts";
3
3
 
4
4
  export const MAX_TIMER_MS = 2_147_483_647;
5
5
  export const DEFAULT_CONFIG = {
@@ -18,7 +18,7 @@
18
18
  */
19
19
 
20
20
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
21
- import { resolveConfig } from "./extension-config.ts";
21
+ import { resolveConfig } from "../lib/extension-config.ts";
22
22
 
23
23
  // `complete` moved between pi-ai layouts: older builds re-export it from the
24
24
  // package index, newer ones expose it only via the `/compat` subpath. A static
@@ -14,7 +14,7 @@
14
14
  */
15
15
 
16
16
  import type { ExtensionAPI, Theme, ThemeColor } from "@earendil-works/pi-coding-agent";
17
- import { resolveConfig } from "./extension-config.ts";
17
+ import { resolveConfig } from "../lib/extension-config.ts";
18
18
 
19
19
  type Config = { enabled: boolean };
20
20
  const DEFAULT_CONFIG: Config = { enabled: false };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-quiver",
3
- "version": "3.4.1",
3
+ "version": "4.0.1",
4
4
  "description": "Personal pack of Pi coding-agent extensions: context-safe fetch, doc_to_md PDF/DOCX/PPTX-to-Markdown conversion, session naming, a themed ASCII startup header, Opus 4.8 fast mode, and a provider-stall watchdog.",
5
5
  "author": "Jacek Juraszek",
6
6
  "license": "MIT",
@@ -28,13 +28,8 @@
28
28
  "node": ">=20"
29
29
  },
30
30
  "files": [
31
- "fetch.ts",
32
- "doc_to_md.ts",
33
- "session-name.ts",
34
- "sword-header.ts",
35
- "fast-mode.ts",
36
- "provider-stall-watchdog.ts",
37
- "extension-config.ts",
31
+ "extensions",
32
+ "lib",
38
33
  "scripts/pdf_to_md.py",
39
34
  "types/**/*.d.ts",
40
35
  "README.md",
@@ -42,18 +37,13 @@
42
37
  ],
43
38
  "scripts": {
44
39
  "check:agents-core": "node scripts/check-agents-core.mjs",
45
- "test": "node --test \"*.test.ts\"",
46
- "typecheck": "npx -y tsc --noEmit --allowImportingTsExtensions --target es2022 --module nodenext --moduleResolution nodenext --strict --skipLibCheck --esModuleInterop --resolveJsonModule --lib es2022 --types node fetch.ts fetch.test.ts doc_to_md.ts doc_to_md.test.ts session-name.ts session-name.test.ts sword-header.ts sword-header.test.ts fast-mode.ts fast-mode.test.ts provider-stall-watchdog.ts provider-stall-watchdog.test.ts extension-config.ts types/turndown-plugin-gfm.d.ts",
40
+ "test": "node --test \"test/*.test.ts\"",
41
+ "typecheck": "npx -y tsc --noEmit",
47
42
  "test:all": "npm run check:agents-core && npm run test && npm run typecheck"
48
43
  },
49
44
  "pi": {
50
45
  "extensions": [
51
- "./fetch.ts",
52
- "./doc_to_md.ts",
53
- "./session-name.ts",
54
- "./sword-header.ts",
55
- "./fast-mode.ts",
56
- "./provider-stall-watchdog.ts"
46
+ "./extensions"
57
47
  ],
58
48
  "image": "https://raw.githubusercontent.com/jjuraszek/pi-quiver/main/pi-quiver.png"
59
49
  },