@steipete/summarize 0.17.1 → 0.17.3

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 (61) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +26 -10
  3. package/dist/esm/daemon/flow-context.js +8 -0
  4. package/dist/esm/daemon/flow-context.js.map +1 -1
  5. package/dist/esm/daemon/server.js +27 -8
  6. package/dist/esm/daemon/server.js.map +1 -1
  7. package/dist/esm/llm/provider-profile.js +1 -1
  8. package/dist/esm/llm/provider-profile.js.map +1 -1
  9. package/dist/esm/logging/daemon.js +36 -40
  10. package/dist/esm/logging/daemon.js.map +1 -1
  11. package/dist/esm/run/flows/asset/media.js +75 -8
  12. package/dist/esm/run/flows/asset/media.js.map +1 -1
  13. package/dist/esm/run/flows/asset/summary.js.map +1 -1
  14. package/dist/esm/run/flows/url/extraction-session.js +67 -6
  15. package/dist/esm/run/flows/url/extraction-session.js.map +1 -1
  16. package/dist/esm/run/flows/url/fetch-options.js +1 -0
  17. package/dist/esm/run/flows/url/fetch-options.js.map +1 -1
  18. package/dist/esm/run/flows/url/flow.js +8 -2
  19. package/dist/esm/run/flows/url/flow.js.map +1 -1
  20. package/dist/esm/run/flows/url/source-metrics.js +8 -0
  21. package/dist/esm/run/flows/url/source-metrics.js.map +1 -0
  22. package/dist/esm/run/flows/url/summary.js +12 -4
  23. package/dist/esm/run/flows/url/summary.js.map +1 -1
  24. package/dist/esm/run/help.js +2 -1
  25. package/dist/esm/run/help.js.map +1 -1
  26. package/dist/esm/run/run-media-cache.js +63 -0
  27. package/dist/esm/run/run-media-cache.js.map +1 -0
  28. package/dist/esm/run/run-metrics.js +23 -10
  29. package/dist/esm/run/run-metrics.js.map +1 -1
  30. package/dist/esm/run/runner-contexts.js +8 -0
  31. package/dist/esm/run/runner-contexts.js.map +1 -1
  32. package/dist/esm/run/runner-plan.js +10 -3
  33. package/dist/esm/run/runner-plan.js.map +1 -1
  34. package/dist/esm/run/runner-setup.js +6 -1
  35. package/dist/esm/run/runner-setup.js.map +1 -1
  36. package/dist/esm/slides/download.js +2 -1
  37. package/dist/esm/slides/download.js.map +1 -1
  38. package/dist/esm/speaker-identification/identify.js +4 -0
  39. package/dist/esm/speaker-identification/identify.js.map +1 -1
  40. package/dist/esm/speaker-identification/openai.js +138 -14
  41. package/dist/esm/speaker-identification/openai.js.map +1 -1
  42. package/dist/esm/tty/spinner.js +100 -32
  43. package/dist/esm/tty/spinner.js.map +1 -1
  44. package/dist/esm/version.js +1 -1
  45. package/dist/types/daemon/server.d.ts +5 -0
  46. package/dist/types/logging/daemon.d.ts +8 -3
  47. package/dist/types/run/flows/asset/summary.d.ts +10 -1
  48. package/dist/types/run/flows/url/source-metrics.d.ts +2 -0
  49. package/dist/types/run/flows/url/summary-json.d.ts +1 -1
  50. package/dist/types/run/run-media-cache.d.ts +5 -0
  51. package/dist/types/speaker-identification/identify.d.ts +1 -0
  52. package/dist/types/tty/spinner.d.ts +2 -2
  53. package/dist/types/version.d.ts +1 -1
  54. package/docs/chrome-extension.md +11 -6
  55. package/docs/commands/summarize.md +1 -1
  56. package/docs/extract-only.md +1 -0
  57. package/docs/install.md +1 -1
  58. package/docs/media.md +7 -2
  59. package/docs/transcript-provider-flow.md +7 -1
  60. package/docs/youtube.md +1 -1
  61. package/package.json +2 -5
@@ -13,7 +13,7 @@ Goal: Chrome **Side Panel** (“real sidebar”) summarizes **what you see** on
13
13
  Quickstart:
14
14
 
15
15
  - Build/load extension: `apps/chrome-extension/README.md`
16
- - Chrome Browser mode works immediately without a daemon for page summaries and fetchable video slides.
16
+ - Chrome Browser mode works immediately without a daemon for page summaries, fetchable video slides, and fetchable YouTube/direct/embedded media transcription.
17
17
  - Optional: install summarize for daemon-backed media support:
18
18
  - `npm i -g @steipete/summarize`
19
19
  - `brew install summarize` (macOS, Linux)
@@ -27,7 +27,7 @@ Quickstart:
27
27
  Firefox notes:
28
28
 
29
29
  - Sidebar UX differs from Chrome’s side panel (persistent sidebar instead of slide-in panel).
30
- - Firefox testing is limited in Playwright; see `apps/chrome-extension/tests/README-firefox.md`.
30
+ - Firefox loading is smoke-tested with Mozilla `web-ext`; Playwright page-level Firefox tests remain diagnostic-only. See `apps/chrome-extension/tests/README-firefox.md`.
31
31
  - Compatibility details: `apps/chrome-extension/docs/firefox.md`.
32
32
 
33
33
  Dev (repo checkout):
@@ -59,6 +59,10 @@ Dev (repo checkout):
59
59
  - “Need extension-side traces”:
60
60
  - Options → Logs → `extension.log` (panel/background events).
61
61
  - Enable “Extended logging” in Advanced settings for full pipeline traces.
62
+ - Captionless YouTube transcription is slow on first use:
63
+ - Chrome downloads and caches the multilingual Whisper Tiny model on demand.
64
+ - WebGPU is preferred; a slower WASM/CPU path is used when WebGPU is unavailable.
65
+ - Offline model bundling and subscription/download workflows are not currently provided.
62
66
  - “Stream ended unexpectedly” / empty chat response:
63
67
  - The daemon likely stopped mid-stream. Restart it, then click “Try again”.
64
68
  - `summarize daemon restart`
@@ -81,7 +85,7 @@ Dev (repo checkout):
81
85
  - **Extension (MV3, WXT)**
82
86
  - Side Panel UI: length + typography controls (font family + size), auto/manual toggle.
83
87
  - Background service worker: tab + navigation tracking, content extraction, starts summarize runs.
84
- - Chrome offscreen page: runs bundled FFmpeg WebAssembly workers for daemonless video slides.
88
+ - Chrome offscreen page: runs MediaBunny with native WebCodecs for ranged video slides and chunked local media transcription, plus an idle-evictable Whisper runtime.
85
89
  - Content script: extract readable article text from the **rendered DOM** via Readability; also detect SPA URL changes.
86
90
  - Panel page streams SSE directly (MV3 service workers can be flaky for long-lived streams).
87
91
  - **Daemon (local, autostart service)**
@@ -94,8 +98,9 @@ Dev (repo checkout):
94
98
  1. User opens side panel (click extension icon).
95
99
  2. Panel sends a “ready” message to the background (plus periodic “ping” heartbeats while open).
96
100
  3. On nav/tab change (and auto enabled): background asks the content script to extract `{ url, title, text }` (best-effort).
97
- 4. Background `POST`s payload to daemon `/v1/summarize` with `Authorization: Bearer <token>`.
98
- 5. Panel opens `/v1/summarize/<id>/events` (SSE) and renders streamed Markdown.
101
+ 4. In Chrome Browser mode, fetchable audio is decoded in bounded chunks through MediaBunny/WebCodecs and transcribed locally. YouTube prefers active-player/watch-page direct audio, then Android VR, buffered direct audio, and captured SABR.
102
+ 5. In Daemon mode, background `POST`s payload to `/v1/summarize` with `Authorization: Bearer <token>`.
103
+ 6. Panel opens `/v1/summarize/<id>/events` (SSE) and renders streamed Markdown.
99
104
 
100
105
  ## Auto Mode (URL + Page Text)
101
106
 
@@ -120,7 +125,7 @@ See `docs/media.md` for detection and transcript rules.
120
125
  ## Slides (Side Panel)
121
126
 
122
127
  - The slides toggle lights up on media-friendly URLs (YouTube/watch|shorts, youtu.be, direct media) or when the page reports video/audio. Defaults to Video on those pages.
123
- - Turning slides **on** refreshes the current summary and requests slide extraction. Chrome Browser mode uses bundled FFmpeg WebAssembly for fetchable videos up to 128 MB and falls back to visible-tab capture. Daemon mode adds `yt-dlp`, native ffmpeg, and optional `tesseract` OCR.
128
+ - Turning slides **on** refreshes the current summary and requests slide extraction. Chrome Browser mode uses MediaBunny with native WebCodecs and ranged reads for fetchable videos, then falls back to visible-tab capture. Daemon mode adds `yt-dlp`, native ffmpeg, and optional `tesseract` OCR.
124
129
  - Active slide mode is slide-first:
125
130
  - vertical image/text cards
126
131
  - transcript-first text; OCR fallback
@@ -70,7 +70,7 @@ If `[input]` is omitted, summarize prints concise help and exits.
70
70
  : Include timestamps in transcripts when available.
71
71
 
72
72
  `--diarize [provider]`
73
- : Force speaker-labelled YouTube audio transcription. Provider: `auto`, `elevenlabs`, or `openai`.
73
+ : Add speaker labels to YouTube, local audio/video, or direct media URLs. Provider: `auto`, `elevenlabs`, or `openai`.
74
74
 
75
75
  `--identify-speakers` / `--no-identify-speakers`
76
76
  : Resolve generic diarization labels to names, or disable configured resolution for one run. Uses authoritative anchors and OpenAI GPT-5.5 context inference.
@@ -20,6 +20,7 @@ Deprecated alias: `--extract-only`.
20
20
  - `--format md` may still convert HTML to Markdown (depending on `--markdown-mode` and available tools).
21
21
  - `--length` is intended for summarization guidance; extraction prints full content.
22
22
  - `--timestamps` keeps the plain transcript text but also exposes `transcriptSegments` and `transcriptTimedText` (JSON) and prints a timed transcript block when available.
23
+ - YouTube transcript output includes the public view count when available. JSON exposes `extracted.sourceMetrics` with `platform`, `videoId`, `viewCount`, and `observedAt`; human output prints `YouTube views: <count>` before the transcript. Metrics refresh at least hourly even when the transcript remains cached.
23
24
  - `--slides` runs slide detection (YouTube/direct video URLs/local video files). Slide metadata is included in JSON output and written to `slides.json` in the slide directory.
24
25
  - When combined with `--extract` for videos that have timed transcripts, the CLI interleaves slide images inline at matching timestamps.
25
26
  - Scene detection auto-tunes using sampled frame hashes.
package/docs/install.md CHANGED
@@ -88,7 +88,7 @@ export OPENAI_API_KEY=...
88
88
  export FAL_KEY=...
89
89
  ```
90
90
 
91
- If native `ffmpeg`/`ffprobe` are missing, summarize falls back to its bundled LGPL FFmpeg WebAssembly build. Native ffmpeg remains recommended for speed and broader codec/filter support. YouTube downloads still require `yt-dlp`.
91
+ If native `ffmpeg`/`ffprobe` are missing, summarize falls back to its bundled LGPL FFmpeg WebAssembly build. Native ffmpeg remains recommended for speed and broader codec/filter support. Automatic YouTube transcription can resolve Android VR direct audio without `yt-dlp`; explicit `--youtube yt-dlp`, diarization, and some slide/media flows still require it.
92
92
 
93
93
  Set `SUMMARIZE_DISABLE_FFMPEG_WASM=1` to disable the bundled fallback.
94
94
 
package/docs/media.md CHANGED
@@ -17,18 +17,21 @@ read_when:
17
17
 
18
18
  1. Embedded captions (VTT/JSON) when available.
19
19
  2. yt-dlp download + transcription (Groq first; then ONNX/local whisper.cpp; then AssemblyAI/Gemini/OpenAI/FAL fallback).
20
+ 3. YouTube only: Android VR direct audio + the same transcription chain when yt-dlp is missing or fails.
20
21
 
21
22
  ## CLI behavior
22
23
 
23
24
  - `--video-mode transcript` prefers transcript-first media handling even when a page has text.
24
25
  - Direct media URLs (mp4/webm/m4a/etc) skip HTML and transcribe.
25
26
  - Local audio/video files are routed through the same transcript-first pipeline.
26
- - YouTube still uses the YouTube transcript pipeline (captions → yt-dlp fallback).
27
+ - `--diarize [auto|elevenlabs|openai]` adds speaker labels to local files and direct media URLs; `--identify-speakers`, anchors, profiles, and remembered mappings use the same naming pass as YouTube. Local files do not require `yt-dlp`. Local video is converted once to mono 16 kHz MP3 before upload, then reused if diarization falls back between providers.
28
+ - YouTube diarization selects audio-only media. Combined `--slides --diarize` downloads separate video-only and audio-only streams in one yt-dlp run, then shares the video with slide extraction.
29
+ - YouTube still uses the YouTube transcript pipeline (captions → yt-dlp → Android VR direct audio fallback).
27
30
  - X/Twitter status URLs with detected video auto-switch to transcript-first (yt-dlp), even in auto mode.
28
31
  - X broadcasts (`/i/broadcasts/...`) are treated as media-only and go transcript-first by default.
29
32
  - Local media files are capped at 2 GB. Remote podcast/media transcription downloads are capped at 512 MB by default and fail closed with `Remote media too large` even when the server omits or under-reports `Content-Length`; other remote media URLs are best-effort via yt-dlp.
30
33
  - Operators who accept the disk/DoS tradeoff for larger remote podcast/media files can opt in with `SUMMARIZE_REMOTE_MEDIA_MAX_BYTES=<positive integer byte limit>`. The override must be a finite positive integer byte count; fractional, sub-byte, or otherwise invalid values are ignored and the default 512 MB cap remains in effect.
31
- - Remote transcription providers: `ASSEMBLYAI_API_KEY`, `GEMINI_API_KEY` / `GOOGLE_GENERATIVE_AI_API_KEY` / `GOOGLE_API_KEY`, `OPENAI_API_KEY`, `FAL_KEY` (plus `GROQ_API_KEY` before local/remote fallback).
34
+ - Remote transcription providers: `ASSEMBLYAI_API_KEY`, `GEMINI_API_KEY` / `GOOGLE_GENERATIVE_AI_API_KEY` / `GOOGLE_API_KEY`, `OPENAI_API_KEY`, `FAL_KEY` (plus `GROQ_API_KEY` before local/remote fallback). Diarization uses `ELEVENLABS_API_KEY` or `OPENAI_API_KEY`.
32
35
  - Gemini uses the Files API automatically for larger uploads.
33
36
 
34
37
  ## Shared helpers
@@ -42,6 +45,8 @@ read_when:
42
45
  - When media is detected on a page, the Summarize button gains a dropdown caret (Page/Video or Page/Audio).
43
46
  - Selecting Video/Audio forces URL mode + transcript-first extraction for that run only.
44
47
  - Selection is not stored.
48
+ - Chrome Browser mode transcribes fetchable direct and embedded media in bounded MediaBunny/WebCodecs chunks with browser-cached multilingual Whisper Tiny. YouTube prefers active-player/watch-page direct audio, then Android VR, buffered direct audio, and captured SABR.
49
+ - Browser slide extraction uses ranged MediaBunny URL reads instead of buffering the complete video. The Whisper runtime is disposed after an idle period while the downloaded model remains in browser cache.
45
50
 
46
51
  ## Known limits
47
52
 
@@ -16,7 +16,9 @@ Goal: keep provider entrypoints thin; keep provider policy explicit.
16
16
  - `packages/core/src/content/transcript/providers/youtube.ts`
17
17
  YouTube orchestration only.
18
18
  Web captions first.
19
- `yt-dlp` or Apify fallback next.
19
+ `yt-dlp`, Android VR direct media, then Apify fallback.
20
+ - `packages/core/src/content/transcript/providers/youtube/native-media.ts`
21
+ Android VR direct-audio resolution + shared media transcription only.
20
22
  - `packages/core/src/content/transcript/providers/podcast.ts`
21
23
  Podcast orchestration only.
22
24
  Feed/Spotify/Apple/enclosure/`yt-dlp` chain.
@@ -55,7 +57,11 @@ Goal: keep provider entrypoints thin; keep provider policy explicit.
55
57
  OpenAI chunk/delegate policy.
56
58
  - `packages/core/src/transcription/whisper/diarization.ts`
57
59
  Explicit speaker-label requests only.
60
+ Extracts local video audio once before provider attempts.
58
61
  ElevenLabs Scribe v2 first in auto mode, then OpenAI `gpt-4o-transcribe-diarize`.
62
+ - YouTube yt-dlp media:
63
+ Diarization-only downloads audio.
64
+ Combined slides + diarization downloads separate audio/video streams once and shares the video cache entry with slide extraction.
59
65
  - `src/speaker-identification/`
60
66
  Optional post-processing for generic diarization labels.
61
67
  Timestamp anchors first, exact-transcript remembered mappings second, OpenAI GPT-5.5 context inference last.
package/docs/youtube.md CHANGED
@@ -57,7 +57,7 @@ summarize "https://www.youtube.com/watch?v=..." --extract --diarize openai --tim
57
57
  - `auto`: ElevenLabs Scribe v2 first, then OpenAI `gpt-4o-transcribe-diarize`.
58
58
  - `elevenlabs`: requires `ELEVENLABS_API_KEY`.
59
59
  - `openai`: requires `OPENAI_API_KEY`.
60
- - All modes require `yt-dlp`; OpenAI uses `ffmpeg` to compress uploads above its size limit when available.
60
+ - YouTube diarization requires `yt-dlp` and downloads audio only. With `--slides`, one yt-dlp invocation downloads separate audio-only and video-only streams so diarization uploads audio while slide extraction reuses video without a merge. Local media diarization does not require `yt-dlp`; local video audio is extracted with native or bundled FFmpeg before upload and reused across provider fallbacks. OpenAI uploads are compressed to stay under its size limit when possible, and long recordings are split into bounded chunks with offset timestamps and distinct chunk-local labels.
61
61
 
62
62
  ## Speaker identification
63
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steipete/summarize",
3
- "version": "0.17.1",
3
+ "version": "0.17.3",
4
4
  "description": "Link → clean text → summary.",
5
5
  "bin": {
6
6
  "summarize": "./dist/cli.js",
@@ -39,15 +39,12 @@
39
39
  "json5": "^2.2.3",
40
40
  "markdansi": "^0.3.1",
41
41
  "mime": "^4.1.0",
42
- "ora": "^9.4.0",
43
42
  "osc-progress": "^0.3.0",
44
43
  "tokentally": "^0.1.1",
45
- "tslog": "^4.10.2",
46
44
  "undici": "8.4.1",
47
- "@steipete/summarize-core": "0.17.1"
45
+ "@steipete/summarize-core": "0.17.3"
48
46
  },
49
47
  "devDependencies": {
50
- "@fal-ai/client": "^1.10.1",
51
48
  "@types/node": "^24.13.1",
52
49
  "@types/sanitize-html": "^2.16.1",
53
50
  "@typescript/native-preview": "7.0.0-dev.20260609.1",