@steipete/summarize 0.21.13 → 0.21.15

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 (109) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/esm/cache-database.js +32 -0
  3. package/dist/esm/cache-database.js.map +1 -0
  4. package/dist/esm/cache-keys.js +33 -0
  5. package/dist/esm/cache-keys.js.map +1 -1
  6. package/dist/esm/cache-store.js +194 -0
  7. package/dist/esm/cache-store.js.map +1 -0
  8. package/dist/esm/cache.js +33 -295
  9. package/dist/esm/cache.js.map +1 -1
  10. package/dist/esm/cli-args.js +13 -0
  11. package/dist/esm/cli-args.js.map +1 -0
  12. package/dist/esm/cli-main.js +2 -2
  13. package/dist/esm/cli-main.js.map +1 -1
  14. package/dist/esm/costs.js +4 -14
  15. package/dist/esm/costs.js.map +1 -1
  16. package/dist/esm/daemon/agent-model.js +1 -1
  17. package/dist/esm/daemon/agent-model.js.map +1 -1
  18. package/dist/esm/daemon/cli.js +6 -18
  19. package/dist/esm/daemon/cli.js.map +1 -1
  20. package/dist/esm/daemon/server.js +1 -1
  21. package/dist/esm/daemon/server.js.map +1 -1
  22. package/dist/esm/engine/web-summary.js +0 -1
  23. package/dist/esm/engine/web-summary.js.map +1 -1
  24. package/dist/esm/llm/generate-text.js +0 -1
  25. package/dist/esm/llm/generate-text.js.map +1 -1
  26. package/dist/esm/model-auto.js +1 -1
  27. package/dist/esm/model-auto.js.map +1 -1
  28. package/dist/esm/refresh-free/presentation.js +2 -16
  29. package/dist/esm/refresh-free/presentation.js.map +1 -1
  30. package/dist/esm/run/bird.js +1 -12
  31. package/dist/esm/run/bird.js.map +1 -1
  32. package/dist/esm/run/cli-preflight.js +5 -16
  33. package/dist/esm/run/cli-preflight.js.map +1 -1
  34. package/dist/esm/run/cli-summarize-command.js +1 -1
  35. package/dist/esm/run/cli-summarize-command.js.map +1 -1
  36. package/dist/esm/run/flows/asset/summary-attempts.js +0 -1
  37. package/dist/esm/run/flows/asset/summary-attempts.js.map +1 -1
  38. package/dist/esm/run/flows/url/flow.js +1 -1
  39. package/dist/esm/run/flows/url/flow.js.map +1 -1
  40. package/dist/esm/run/flows/url/slides-output-render.js +1 -1
  41. package/dist/esm/run/flows/url/slides-output-render.js.map +1 -1
  42. package/dist/esm/run/flows/url/slides-output-stream.js +3 -14
  43. package/dist/esm/run/flows/url/slides-output-stream.js.map +1 -1
  44. package/dist/esm/run/flows/url/slides-output.js +0 -1
  45. package/dist/esm/run/flows/url/slides-output.js.map +1 -1
  46. package/dist/esm/run/flows/url/summary-finish.js.map +1 -1
  47. package/dist/esm/run/flows/url/summary-json.js +26 -0
  48. package/dist/esm/run/flows/url/summary-json.js.map +1 -1
  49. package/dist/esm/run/flows/url/summary.js +2 -29
  50. package/dist/esm/run/flows/url/summary.js.map +1 -1
  51. package/dist/esm/run/format.js +1 -11
  52. package/dist/esm/run/format.js.map +1 -1
  53. package/dist/esm/run/markdown-streamer.js +15 -0
  54. package/dist/esm/run/markdown-streamer.js.map +1 -0
  55. package/dist/esm/run/run-settings.js +1 -1
  56. package/dist/esm/run/run-settings.js.map +1 -1
  57. package/dist/esm/run/runner.js +1 -2
  58. package/dist/esm/run/runner.js.map +1 -1
  59. package/dist/esm/run/stream-output.js +5 -20
  60. package/dist/esm/run/stream-output.js.map +1 -1
  61. package/dist/esm/run/summary-stream.js +3 -14
  62. package/dist/esm/run/summary-stream.js.map +1 -1
  63. package/dist/esm/run/terminal.js +10 -16
  64. package/dist/esm/run/terminal.js.map +1 -1
  65. package/dist/esm/run/transcriber-cli.js +3 -14
  66. package/dist/esm/run/transcriber-cli.js.map +1 -1
  67. package/dist/esm/shared/numbers.js +12 -0
  68. package/dist/esm/shared/numbers.js.map +1 -0
  69. package/dist/esm/slides/extract.js +12 -127
  70. package/dist/esm/slides/extract.js.map +1 -1
  71. package/dist/esm/slides/frame-extraction.js +2 -1
  72. package/dist/esm/slides/frame-extraction.js.map +1 -1
  73. package/dist/esm/slides/runtime.js +82 -0
  74. package/dist/esm/slides/runtime.js.map +1 -0
  75. package/dist/esm/slides/scene-calibration.js +111 -0
  76. package/dist/esm/slides/scene-calibration.js.map +1 -0
  77. package/dist/esm/slides/scene-detection.js +1 -111
  78. package/dist/esm/slides/scene-detection.js.map +1 -1
  79. package/dist/esm/slides/store.js +33 -0
  80. package/dist/esm/slides/store.js.map +1 -1
  81. package/dist/esm/tty/progress/transcript-state.js +0 -13
  82. package/dist/esm/tty/progress/transcript-state.js.map +1 -1
  83. package/dist/esm/version.js +1 -1
  84. package/dist/types/cache-database.d.ts +12 -0
  85. package/dist/types/cache-keys.d.ts +28 -0
  86. package/dist/types/cache-store.d.ts +16 -0
  87. package/dist/types/cache.d.ts +4 -45
  88. package/dist/types/cli-args.d.ts +1 -0
  89. package/dist/types/run/flows/url/slides-output-render.d.ts +1 -4
  90. package/dist/types/run/flows/url/summary-json.d.ts +19 -0
  91. package/dist/types/run/format.d.ts +1 -1
  92. package/dist/types/run/markdown-streamer.d.ts +6 -0
  93. package/dist/types/run/terminal.d.ts +2 -2
  94. package/dist/types/shared/numbers.d.ts +1 -0
  95. package/dist/types/slides/runtime.d.ts +22 -0
  96. package/dist/types/slides/scene-calibration.d.ts +12 -0
  97. package/dist/types/slides/scene-detection.d.ts +0 -11
  98. package/dist/types/slides/store.d.ts +2 -0
  99. package/dist/types/version.d.ts +1 -1
  100. package/docs/README.md +1 -1
  101. package/docs/agent.md +4 -2
  102. package/docs/cache.md +3 -1
  103. package/docs/commands/refresh-free.md +2 -0
  104. package/docs/commands/slides.md +23 -10
  105. package/docs/engine.md +2 -0
  106. package/docs/media.md +1 -0
  107. package/docs/nvidia-onnx-transcription.md +2 -0
  108. package/docs/slides-rendering-flow.md +2 -0
  109. package/package.json +11 -11
package/docs/README.md CHANGED
@@ -24,4 +24,4 @@ summary: "Docs index for summarize behaviors and modes."
24
24
 
25
25
  ## Website
26
26
 
27
- - Jekyll site source: `docs/` (Markdown → HTML via GitHub Pages Actions)
27
+ - Site source: `docs/`, rendered by `scripts/build-docs-site.mjs` and deployed through GitHub Pages Actions.
package/docs/agent.md CHANGED
@@ -57,7 +57,7 @@ Service installation keeps launchd, systemd, and Scheduled Task policy in separa
57
57
 
58
58
  Defined in `apps/chrome-extension/wxt.config.ts`:
59
59
 
60
- - `userScripts` – optional; requested via Options for `browserjs()` main-world script execution.
60
+ - `userScripts` – optional; requested via Options for `browserjs()` page-context script execution.
61
61
  - `debugger` – required only in `build:automation` for **native input** and the **debugger** tool.
62
62
 
63
63
  Neither permission is needed for summarization. The standard Chrome build omits `debugger` because
@@ -66,6 +66,8 @@ and it hides debugger-backed tools. The separate automation build declares it as
66
66
 
67
67
  #### Chrome: enable User Scripts (if needed)
68
68
 
69
+ Immediate `browserjs()` execution requires [Chrome 135+](https://developer.chrome.com/docs/extensions/reference/api/userScripts#method-execute). The extension installation minimum remains Chrome 120+.
70
+
69
71
  1. `chrome://extensions`
70
72
  2. Open extension details
71
73
  3. Enable **Allow User Scripts**
@@ -206,7 +208,7 @@ REPL environment:
206
208
 
207
209
  - Runs in a **sandboxed iframe** (no DOM access to the panel).
208
210
  - `browserjs(fn, ...args)` runs the function **in the page context**.
209
- - Uses `chrome.userScripts.execute` in the main world.
211
+ - Uses `chrome.userScripts.execute` (Chrome 135+) for page-context execution.
210
212
  - `navigate({ url })` available inside the REPL (always use for navigation).
211
213
  - `sleep(ms)` helper.
212
214
  - Console output is captured and returned; return values are appended as `=> value`.
package/docs/cache.md CHANGED
@@ -10,6 +10,8 @@ read_when:
10
10
 
11
11
  Lightweight, CLI-only SQLite cache. Single DB file.
12
12
 
13
+ `src/cache.ts` exposes cache configuration, keys, and maintenance operations. `cache-store.ts` owns SQLite rows, eviction, slide-file cleanup, and the transcript adapter; `cache-database.ts` isolates the Node/Bun database binding. Versioned key construction lives in `cache-keys.ts`.
14
+
13
15
  ## Goals
14
16
 
15
17
  - Avoid repeated transcripts/extractions/summaries.
@@ -97,6 +99,6 @@ Media cache eviction:
97
99
  ## Notes
98
100
 
99
101
  - Core owns the transcript-source inventory used by both extraction and SQLite reads, including embedded captions and native YouTube media. Cache hits retain their original source diagnostics.
100
- - No extension cache (daemon uses CLI cache).
102
+ - The extension has a separate browser panel cache in `chrome.storage.local`: URL-keyed entries use a 30-day TTL and an 8 MB size limit. It shares portable row formatting with core; daemon extraction and summary caches still use SQLite.
101
103
  - No third-party SQLite deps.
102
104
  - Transcript namespace currently includes the YouTube mode (e.g. `yt:auto`, `yt:web`).
@@ -76,6 +76,8 @@ summarize refresh-free --runs 3 --smart 5 --verbose
76
76
 
77
77
  A short summary of survivors and rejected candidates is printed on stdout.
78
78
 
79
+ Color follows the rest of the CLI: `FORCE_COLOR=0` disables it, while a nonzero `FORCE_COLOR` takes precedence over `NO_COLOR`. Without an override, color requires a capable terminal.
80
+
79
81
  ## See also
80
82
 
81
83
  - [LLM overview](../llm.md) — `--model` syntax, including `free`.
@@ -34,7 +34,7 @@ If a required tool is missing, summarize prints a clear warning and exits non-ze
34
34
  ## Flags
35
35
 
36
36
  `--slides-ocr`
37
- : Run OCR on every extracted slide. Saves a `.txt` next to each PNG.
37
+ : Run OCR on every extracted slide. Stores `ocrText` and `ocrConfidence` in `slides.json` and the JSON response.
38
38
 
39
39
  `--slides-dir <dir>`
40
40
  : Output base directory. Default: `./slides`. A per-video subfolder is created inside.
@@ -77,20 +77,33 @@ If a required tool is missing, summarize prints a clear warning and exits non-ze
77
77
  Each run writes a directory like:
78
78
 
79
79
  ```text
80
- slides/<video-id>/
81
- 001.png
82
- 002.png
80
+ slides/<source-id>/
81
+ slide_0001_18.60s.png
82
+ slide_0002_42.20s.png
83
83
  ...
84
- 001.txt # only with --slides-ocr
84
+ slides.json
85
85
  ```
86
86
 
87
- In `--json` mode, stdout is:
87
+ The filenames include the slide index and timestamp. `slides.json` records the manifest, including OCR results when requested; OCR does not create separate text files. `ocrConfidence` uses a 0–1 scale.
88
+
89
+ In `--json` mode, stdout contains an envelope like this (additional extraction metadata omitted):
88
90
 
89
91
  ```json
90
92
  {
91
- "url": "...",
92
- "outDir": "slides/<id>",
93
- "slides": [{ "index": 1, "path": "...001.png", "timeSeconds": 18.6, "ocr": "..." }]
93
+ "ok": true,
94
+ "slides": {
95
+ "sourceUrl": "https://example.com/lecture.mp4",
96
+ "slidesDir": "/absolute/path/slides/<id>",
97
+ "slides": [
98
+ {
99
+ "index": 1,
100
+ "timestamp": 18.6,
101
+ "imagePath": "/absolute/path/slides/<id>/slide_0001_18.60s.png",
102
+ "ocrText": "Recognized slide text",
103
+ "ocrConfidence": 0.92
104
+ }
105
+ ]
106
+ }
94
107
  }
95
108
  ```
96
109
 
@@ -109,7 +122,7 @@ summarize slides "https://youtu.be/..." \
109
122
  --slides-max 24 --slides-scene-threshold 0.2
110
123
 
111
124
  # Pipe-friendly JSON for an automation.
112
- summarize slides "https://youtu.be/..." --json | jq '.slides[].path'
125
+ summarize slides "https://youtu.be/..." --json | jq '.slides.slides[].imagePath'
113
126
 
114
127
  # Force re-extraction after editing the source video.
115
128
  summarize slides "./talk.mp4" --no-cache -o ./out
package/docs/engine.md CHANGED
@@ -46,6 +46,8 @@ Core owns file-summary instruction construction and timed-transcript parsing/for
46
46
 
47
47
  The engine never writes summary text to stdout.
48
48
 
49
+ CLI summary and slide adapters share the terminal Markdown streamer factory in `src/run/markdown-streamer.ts`; each adapter retains its own progress and stream lifecycle. Standalone command preflight uses `src/cli-args.ts` for the same equals-form and separate-value option semantics.
50
+
49
51
  Each provider attempt resolves one request shared by streaming, direct completion, and fallback completion. Stream consumption owns output-handler lifecycle and marks visible or handler failures as interrupted; only an uncommitted provider failure can fall back to completion. Usage collection happens after successful stream consumption and does not trigger another model call.
50
52
 
51
53
  `SummaryStreamHandler` receives normalized chunks:
package/docs/media.md CHANGED
@@ -22,6 +22,7 @@ read_when:
22
22
  ## CLI behavior
23
23
 
24
24
  - RSS and Atom feed URLs use the podcast/content pipeline rather than raw XML file handling. Published feed transcripts take precedence over media transcription; ordinary XML documents remain file inputs.
25
+ - Podcast episode title matching preserves non-Latin letters and combining marks while ignoring case, punctuation, and Latin accents. Explicit titles without letters or numbers do not select an arbitrary RSS episode; feed requests without an episode title still use the first available transcript.
25
26
  - `--video-mode transcript` prefers transcript-first media handling even when a page has text.
26
27
  - Direct media URLs (mp4/webm/m4a/etc) skip HTML and transcribe.
27
28
  - Local audio/video files are routed through the same transcript-first pipeline.
@@ -44,12 +44,14 @@ For the Chrome extension, you can pick a permanent default under **Settings →
44
44
  - Artifacts are stored under `${SUMMARIZE_ONNX_CACHE_DIR || $XDG_CACHE_HOME || ~/.cache}/summarize/onnx/<model>/`.
45
45
  - Set `SUMMARIZE_ONNX_MODEL_BASE_URL` to point at a mirror (defaults to the Hugging Face repo for the chosen model).
46
46
  - The first run downloads `model.onnx` and `vocab.txt`; subsequent runs reuse cached files.
47
+ - Downloads are committed to the cache only after the full response is written. Failed downloads remove their temporary files, so the next run retries instead of using a partial model. If an older version left a corrupt cached artifact, remove that artifact once to download it again.
47
48
 
48
49
  ## Behavior
49
50
 
50
51
  - Input audio is transcoded to 16kHz mono WAV via `ffmpeg` when available; otherwise the original file is passed to the CLI.
51
52
  - Onnx errors (missing command, non-zero exit, empty output) fall back to the existing Whisper flow with a note recorded in the transcript metadata.
52
53
  - Progress UI shows "ONNX (Parakeet/Canary)" while the external transcriber runs.
54
+ - In-memory audio is staged until the external transcriber exits, then removed on success or failure.
53
55
 
54
56
  ## Notes
55
57
 
@@ -30,6 +30,8 @@ Rule: keep terminal I/O in render helpers; keep state mutations in the state sto
30
30
 
31
31
  `src/slides/process.ts` owns media-tool spawning, deadlines, exit errors, and output collection. Line callbacks, text capture, and binary capture share that lifecycle; OCR uses binary capture to avoid logging recognized text. Ignored stdout is drained so child processes cannot block on a full pipe.
32
32
 
33
+ `src/slides/runtime.ts` owns tool resolution, worker/sample settings, and progress/log adapters. `scene-calibration.ts` owns optional frame sampling and hash-based threshold calibration; `scene-detection.ts` owns scene timestamps and selection. Output-directory preparation and per-directory serialization live with cache paths in `store.ts`, keeping extraction orchestration focused on the pipeline.
34
+
33
35
  Frame extraction trims decoded input before collecting `showinfo` and signal statistics. Timestamp conversion uses the explicit input-seek origin, including zero, so pre-seek frames cannot move a later slide backward or cause final duration filtering to discard it.
34
36
 
35
37
  Completed slide results carry an extractor version in memory and `slides.json`. Cache validation rejects older/unversioned extraction results, including SQLite copies, so corrected timing regenerates stale frames without invalidating unrelated transcript or summary caches.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steipete/summarize",
3
- "version": "0.21.13",
3
+ "version": "0.21.15",
4
4
  "description": "Link → clean text → summary.",
5
5
  "bin": {
6
6
  "summarize": "./dist/cli.js",
@@ -33,8 +33,8 @@
33
33
  }
34
34
  },
35
35
  "dependencies": {
36
- "@earendil-works/pi-ai": "^0.84.4",
37
- "@steipete/summarize-core": "0.21.13",
36
+ "@earendil-works/pi-ai": "^0.85.1",
37
+ "@steipete/summarize-core": "0.21.15",
38
38
  "bpe-lite": "^0.5.2",
39
39
  "commander": "^15.0.0",
40
40
  "file-type": "^22.0.2",
@@ -42,20 +42,20 @@
42
42
  "markdansi": "^0.3.3",
43
43
  "mime": "^4.1.0",
44
44
  "osc-progress": "^0.3.3",
45
- "tokentally": "^0.1.4",
46
- "undici": "8.10.1"
45
+ "tokentally": "^0.1.5",
46
+ "undici": "8.10.2"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^24.13.3",
50
50
  "@types/sanitize-html": "^2.16.1",
51
- "@vitest/coverage-v8": "^4.1.11",
52
- "happy-dom": "^20.12.0",
53
- "oxc-parser": "^0.147.0",
54
- "oxfmt": "0.65.0",
55
- "oxlint": "^1.80.0",
51
+ "@vitest/coverage-v8": "^5.0.0",
52
+ "happy-dom": "^20.14.0",
53
+ "oxc-parser": "^0.148.0",
54
+ "oxfmt": "0.66.0",
55
+ "oxlint": "^1.81.0",
56
56
  "oxlint-tsgolint": "^7.0.2001",
57
57
  "typescript": "^7.0.2",
58
- "vitest": "^4.1.11"
58
+ "vitest": "^5.0.0"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=24"