pi-quiver 6.16.1 → 6.16.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/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  Format follows sibling pi packages (e.g. [`pi-condense`](https://github.com/jjuraszek/pi-condense/blob/main/CHANGELOG.md)):
4
4
  one entry per `vX.Y.Z` tag, newest first, terse bullets, dated.
5
5
 
6
+ ## v6.16.2 - 2026-11-15
7
+
8
+ - `fast-mode` covers every model in Anthropic's fast-mode availability table: Claude Fable 5.2 and Mythos 5.2 join Opus 5.5, Opus 5, and Opus 4.8. The `fast-mode-2026-02-01` beta header goes only to Opus 5 (research preview) and Opus 4.8 (deprecated), the two models Anthropic still requires it on; Fable 5.2, Mythos 5.2, and Opus 5.5 get `speed: "fast"` alone and keep the `anthropic-beta` header pi built. Opus 5.5 previously got the header through the `claude-opus-5` prefix, which dropped pi's `message-threads-2026-08-12` beta and cost a rejected first attempt on every request. Cost correction stays 2x, checked against the rate card for all five models. (#40)
9
+
6
10
  ## v6.16.1 - 2026-11-09
7
11
 
8
12
  - doc_to_md result and option enums share one declaration in `lib/`, so members cannot drift between TypeScript types and tool schemas. (#38)
package/README.md CHANGED
@@ -68,7 +68,7 @@ A 300 KB changelog page never touches your context window - you get a preview an
68
68
  | `extensions/doc_to_md.ts` | `doc_to_md` | Convert a local PDF/DOCX/DOC/PPTX/XLSX/XLSM/XLS, MSG/EML, HTML, or image file to a Markdown bundle on disk (`<stem>.md` + `images/`, spreadsheet `sheets/`, optional `pageImages` in `pages/`, and email `attachments/`) and return a handle (paths, page count, outline, diagnostics) - never inline Markdown. `info` inspects PDF/Office inputs; `pages` selects 1-based PDF/Office pages (DOCX: explicit-page-break segments); HTML, image, and email inputs reject both; every selected PDF/PPTX page or DOCX segment when `pageCount > 1` ends with `--- end of page.page_number=N ---`. Tiers: pymupdf4llm -> PyMuPDF text (degraded) -> unpdf worker (no Python only). Excel -> sheet inventory, full CSVs, bounded previews, and optional rendered views. HTML keeps local and `data:` images in the bundle and remote images as links; image inputs keep the original image. Scanned PDF pages keep a page picture on both Python tiers; eligible single full-page images are delivered as their embedded stream, without re-encoding or render DPI; opt-in OCR needs Tesseract language data. DOCX converts directly (mammoth, python-docx fallback); LibreOffice pagination marks the degraded route. The Outline lists `L<line>` and `p<page>` per heading. Settings under `quiver.docToMd`. Every conversion that goes through the Python PDF tiers (PDF, PPTX, `.doc`, DOCX via LibreOffice) writes `<stem>.pages.json` (per-page chars, image count, image coverage; handle line `Page-Stats:`); unpdf writes no stats. `ocrMode: "all"` with `ocr: true` and an explicit `pages` forces OCR on those pages into `ocr/<stem>-pNNN.md` sidecars, leaving the Markdown byte-identical to the same selected-page call without OCR. `words: true` (CLI `--words`, per-call only - no settings key) writes `<stem>.words.json` with every word's bbox per selected PDF/image page (`source` `text` or `ocr`), plus `ocr/<stem>-pNNN.words.json` beside each forced-OCR sidecar; it never triggers OCR. |
69
69
  | `extensions/session-name.ts` | `/session-name` | Manual + opt-in automatic session naming, naming rules and deny list, long-session revisits, and Ghostty/Herdr tab rename. OFF by default. |
70
70
  | `extensions/sword-header.ts` | `/builtin-header` | Themed ASCII startup header replacing pi's default logo. OFF by default. |
71
- | `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. |
71
+ | `extensions/fast-mode.ts` | `/fast` | Inject Anthropic fast-mode (`speed: "fast"`, plus `anthropic-beta: fast-mode-2026-02-01` where the model needs it) into every Claude Fable 5.2 / Mythos 5.2 / Opus 5.5 / Opus 5 / Opus 4.8 request, any thinking level. `--fast` flag + `/fast [on\|off\|status]`. OFF by default. |
72
72
  | `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. Each stall is aborted; while pi's `retry.enabled` is true and the stall retry budget (`maxStallRetries`, default = `retry.maxRetries`) remains, its aborted attempt is hidden from the model and re-driven by the watchdog after pi's backoff; behavior guide: [doc/provider-stall-watchdog.md](doc/provider-stall-watchdog.md). OFF by default. |
73
73
  | `extensions/slack.ts` | `slack_search`, `slack_thread`, `slack_post`, `slack_update`, `slack_delete`, `slack_pin`, `slack_upload`, `slack_cache_refresh` | Context-safe Slack search/threads/posting with dual `user`/`bot` token identities, Block Kit flattening and optional raw JSON output for threads, a workspace-keyed channel/user name->ID cache, DM targets by `@name` / user ID, fetch-style output size gating, and a transactional headline+detail-thread announce protocol with a documented recovery path. Pi registration is OFF by default. Behavior lives in `lib/slack-core.ts` and `lib/slack-cache.ts`; the [Slack CLI](doc/slack.md#cli) exposes `post`, `reply`, `dm`, and `canvas` without enabling pi registration. |
74
74
  | `prompts/rebase-worktree.md` | `/rebase-worktree [base]` | Prompt template, pi only. Rebases the current worktree onto `origin/<base>` (default `main`), resolves conflicts inline with the authorization stated in the prompt, runs only the tests that cover the resolved files, and reports the resolutions and fix commits. Never pushes; it syncs the branch so a later CI run or `/skill:gatekeep-pr` sees current `main`. |
@@ -210,7 +210,7 @@ survive untouched.
210
210
 
211
211
  `swordHeader` swaps the header at `session_start`, which runs after pi has already drawn its built-in pixel logo, so the logo shows for a moment before the sword replaces it. To skip that flash set pi's own `"quietStartup": true` in `~/.pi/agent/settings.json`: pi then draws an empty header slot at startup and the sword fills it. Quiet startup also drops pi's key-hint lines, which the sword header does not reproduce.
212
212
 
213
- `fastMode` only affects `claude-opus-4-8` and `claude-opus-5` requests on Anthropic's `anthropic-messages` API; enabling it opts into premium fast-mode pricing. `--fast` forces it on for one launch; `/fast on|off` toggles live. Proxy providers (opencode, cloudflare-ai-gateway) are excluded. `fastMode`'s header injection needs the `before_provider_headers` hook (pi bundling `@earendil-works/pi-coding-agent` >= 0.80.5); on older pi the beta header is silently not sent. The `anthropic-beta` header is discovered at request time by probing pi's own request assembly (no network), so conditional betas pi adds - e.g. `server-side-fallback-2026-07-01` for models with server-side fallback - are preserved alongside `fast-mode-2026-02-01`. If the probe fails, the header falls back to the static OAuth-identity + fast-mode list. See [doc/fetch.md](doc/fetch.md) and [doc/doc-to-md.md](doc/doc-to-md.md) for the ingestion tools' full reference; session-name/sword-header behavior above is complete.
213
+ `fastMode` only affects `claude-fable-5-2`, `claude-mythos-5-2`, `claude-opus-5-5`, `claude-opus-5`, and `claude-opus-4-8` requests on Anthropic's `anthropic-messages` API - the models in Anthropic's [fast-mode availability table](https://platform.claude.com/docs/en/build-with-claude/fast-mode#feature-availability); enabling it opts into premium fast-mode pricing. `--fast` forces it on for one launch; `/fast on|off` toggles live. Proxy providers (opencode, cloudflare-ai-gateway) are excluded. Fable 5.2, Mythos 5.2, and Opus 5.5 get `speed: "fast"` alone, and pi's `anthropic-beta` header goes out as pi built it. Opus 5 (research preview) and Opus 4.8 (deprecated by Anthropic, removal date 2026-11-30) also get the `fast-mode-2026-02-01` beta header. That header injection needs the `before_provider_headers` hook (pi bundling `@earendil-works/pi-coding-agent` >= 0.80.5); on older pi the beta header is silently not sent. The `anthropic-beta` header is discovered at request time by probing pi's own request assembly (no network), so conditional betas pi adds - e.g. `server-side-fallback-2026-07-01` for models with server-side fallback - are preserved alongside `fast-mode-2026-02-01`. If the probe fails, the header falls back to the static OAuth-identity + fast-mode list. See [doc/fetch.md](doc/fetch.md) and [doc/doc-to-md.md](doc/doc-to-md.md) for the ingestion tools' full reference; session-name/sword-header behavior above is complete.
214
214
 
215
215
  `pi-ai` prices every fast request at standard rates - it has no `usage.speed` support and no request-level pricing modifier - so `fastMode` corrects the reported cost itself: a `message_end` handler scales all four `usage.cost` components by `FAST_MODE_COST_MULTIPLIER` (2x) and returns the corrected message. Persisted session JSONL and pi's own native cost display are always exact, since they're written from this corrected message. pi-cohort's live `Σ$` reflects the correction only when pi-quiver's `message_end` handler runs before pi-cohort's - best-effort, depending on extension load order - and is reconciled on pi-cohort's next `session_start` regardless. The upstream fix (teaching `pi-ai`'s `Usage`/`calculateCost` about `usage.speed`) is the better long-term path and is tracked separately.
216
216
 
@@ -1,10 +1,13 @@
1
1
  /**
2
- * Fast mode for Claude Opus 4.8 / Opus 5.
2
+ * Fast mode for the Claude models Anthropic serves it on (FAST_MODE_MODELS).
3
3
  *
4
4
  * When enabled, injects Anthropic's fast-mode signals into every qualifying
5
- * Opus 4.8 / Opus 5 request on the anthropic-messages API, regardless of thinking level:
5
+ * request on the anthropic-messages API, regardless of thinking level:
6
6
  * - payload: { ...payload, speed: "fast" } (before_provider_request)
7
7
  * - header: anthropic-beta: ...,fast-mode-2026-02-01 (before_provider_headers)
8
+ * The header goes only to the models that still need the beta (Opus 5,
9
+ * Opus 4.8); on the rest `speed` is the whole contract and pi's own
10
+ * `anthropic-beta` list is left untouched.
8
11
  *
9
12
  * OFF BY DEFAULT. Three control surfaces, lowest precedence first:
10
13
  * 1. settings.json "fastMode": true | { "enabled": true } (default false)
@@ -33,14 +36,27 @@ import { resolveConfig } from "../lib/extension-config.ts";
33
36
 
34
37
  export const FAST_MODE_BETA = "fast-mode-2026-02-01";
35
38
  export const FAST_SPEED = "fast";
36
- // Loose prefixes: match dated snapshots (claude-opus-4-8-*, claude-opus-5-*).
37
- // Opus 4.7 is out of scope (D1); a future model needs a one-line addition here.
38
- export const FAST_MODE_MODEL_PREFIXES = ["claude-opus-4-8", "claude-opus-5"];
39
-
40
- // Anthropic bills Opus 4.8/5 fast mode at exactly 2x standard rates; input,
41
- // output, and cache read/write all scale by the same factor because caching
42
- // multipliers "apply on top of fast mode pricing". Rate card:
43
- // https://docs.claude.com/en/docs/build-with-claude/fast-mode (retrieved 2026-08-04).
39
+ // One row per model in Anthropic's fast-mode availability table:
40
+ // https://platform.claude.com/docs/en/build-with-claude/fast-mode#feature-availability
41
+ // (retrieved 2026-11-13). `beta` marks the models that need the fast-mode beta
42
+ // header - Opus 5 (research preview) and Opus 4.8 (deprecated, removal
43
+ // 2026-11-30); the rest take `speed` alone. A prefix matches the id itself or
44
+ // the id up to a `-`, so a dated claude-fable-5-2026... snapshot is not
45
+ // Fable 5.2. The first match wins, so claude-opus-5-5 must stay ahead of
46
+ // claude-opus-5. A model added to or dropped from that table is a one-row
47
+ // change here.
48
+ export const FAST_MODE_MODELS = [
49
+ { prefix: "claude-fable-5-2", beta: false },
50
+ { prefix: "claude-mythos-5-2", beta: false },
51
+ { prefix: "claude-opus-5-5", beta: false },
52
+ { prefix: "claude-opus-5", beta: true },
53
+ { prefix: "claude-opus-4-8", beta: true },
54
+ ];
55
+
56
+ // Anthropic bills fast mode at exactly 2x standard rates on every model in
57
+ // FAST_MODE_MODELS; input, output, and cache read/write all scale by the same
58
+ // factor because caching multipliers "apply on top of fast mode pricing". Rate card:
59
+ // https://platform.claude.com/docs/en/build-with-claude/fast-mode#pricing (retrieved 2026-11-13).
44
60
  export const FAST_MODE_COST_MULTIPLIER = 2;
45
61
 
46
62
  export function scaleCost(cost: Usage["cost"], multiplier: number): Usage["cost"] {
@@ -81,13 +97,21 @@ export function coerce(raw: unknown): Partial<Config> | undefined {
81
97
 
82
98
  type ModelLike = { id?: string; api?: string; provider?: string } | undefined;
83
99
 
100
+ function fastModeModel(model: ModelLike) {
101
+ const id = model?.id;
102
+ if (typeof id !== "string") return undefined;
103
+ return FAST_MODE_MODELS.find((m) => id === m.prefix || id.startsWith(`${m.prefix}-`));
104
+ }
105
+
84
106
  export function shouldInject(enabled: boolean, model: ModelLike): boolean {
85
107
  if (!enabled || !model) return false;
86
108
  if (model.provider !== "anthropic") return false;
87
109
  if (model.api !== "anthropic-messages") return false;
88
- const id = model.id;
89
- if (typeof id !== "string") return false;
90
- return FAST_MODE_MODEL_PREFIXES.some((p) => id.startsWith(p));
110
+ return fastModeModel(model) !== undefined;
111
+ }
112
+
113
+ export function needsFastModeBeta(model: ModelLike): boolean {
114
+ return fastModeModel(model)?.beta === true;
91
115
  }
92
116
 
93
117
  export function injectSpeed(payload: unknown): unknown {
@@ -185,6 +209,7 @@ export default function (pi: ExtensionAPI) {
185
209
  // requests per session (headers -> request -> message_end, awaited in order).
186
210
  let pendingFastSpeed = false;
187
211
  let pendingFastHeader = false;
212
+ let pendingBetaRequired = false;
188
213
 
189
214
  const readFlag = (): boolean => pi.getFlag("fast") === true;
190
215
 
@@ -221,7 +246,7 @@ export default function (pi: ExtensionAPI) {
221
246
 
222
247
  pi.registerFlag("fast", {
223
248
  type: "boolean",
224
- description: "Enable Anthropic fast mode for Opus 4.8/5 requests this launch",
249
+ description: "Enable Anthropic fast mode for supported Claude models this launch",
225
250
  });
226
251
 
227
252
  pi.on("session_start", async (_event, ctx) => {
@@ -241,11 +266,12 @@ export default function (pi: ExtensionAPI) {
241
266
  const next = injectSpeed(event.payload);
242
267
  pendingFastSpeed =
243
268
  typeof next === "object" && next !== null && (next as Record<string, unknown>).speed === FAST_SPEED;
269
+ pendingBetaRequired = needsFastModeBeta(ctx.model);
244
270
  return next;
245
271
  });
246
272
 
247
273
  pi.on("before_provider_headers", async (event, ctx) => {
248
- if (!shouldInject(enabled, ctx.model) || !event.headers) {
274
+ if (!shouldInject(enabled, ctx.model) || !needsFastModeBeta(ctx.model) || !event.headers) {
249
275
  pendingFastHeader = false;
250
276
  return;
251
277
  }
@@ -267,7 +293,9 @@ export default function (pi: ExtensionAPI) {
267
293
  pi.on("message_end", (event) => {
268
294
  const msg = event.message;
269
295
  if (msg.role !== "assistant") return;
270
- const corrected = pendingFastSpeed && pendingFastHeader && !!msg.usage?.cost;
296
+ // Billed fast: `speed` went out, plus the beta header where the model needs one.
297
+ const billedFast = pendingFastSpeed && (pendingFastHeader || !pendingBetaRequired);
298
+ const corrected = billedFast && !!msg.usage?.cost;
271
299
  pendingFastSpeed = false;
272
300
  pendingFastHeader = false;
273
301
  if (!corrected) return;
@@ -280,7 +308,7 @@ export default function (pi: ExtensionAPI) {
280
308
  });
281
309
 
282
310
  pi.registerCommand("fast", {
283
- description: "Manage Opus 4.8/5 fast mode: /fast [on|off|status]",
311
+ description: "Manage Anthropic fast mode: /fast [on|off|status]",
284
312
  getArgumentCompletions: (prefix) => {
285
313
  const p = prefix.trim().toLowerCase();
286
314
  if (p.includes(" ")) return null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-quiver",
3
- "version": "6.16.1",
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.",
3
+ "version": "6.16.2",
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, Anthropic fast mode, and a provider-stall watchdog.",
5
5
  "author": "Jacek Juraszek",
6
6
  "license": "MIT",
7
7
  "type": "module",