@steipete/summarize 0.9.0 → 0.11.0
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 +121 -0
- package/LICENSE +1 -1
- package/README.md +391 -183
- package/dist/cli.js +1 -1
- package/dist/esm/cache.js +134 -64
- package/dist/esm/cache.js.map +1 -1
- package/dist/esm/cli-main.js +27 -27
- package/dist/esm/cli-main.js.map +1 -1
- package/dist/esm/cli.js +2 -2
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/config.js +396 -126
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/content/asset.js +53 -50
- package/dist/esm/content/asset.js.map +1 -1
- package/dist/esm/content/index.js +1 -1
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/costs.js +1 -1
- package/dist/esm/costs.js.map +1 -1
- package/dist/esm/daemon/agent.js +548 -0
- package/dist/esm/daemon/agent.js.map +1 -0
- package/dist/esm/daemon/auto-mode.js +3 -3
- package/dist/esm/daemon/auto-mode.js.map +1 -1
- package/dist/esm/daemon/chat.js +88 -178
- package/dist/esm/daemon/chat.js.map +1 -1
- package/dist/esm/daemon/cli-entrypoint.js +72 -0
- package/dist/esm/daemon/cli-entrypoint.js.map +1 -0
- package/dist/esm/daemon/cli.js +91 -83
- package/dist/esm/daemon/cli.js.map +1 -1
- package/dist/esm/daemon/config.js +15 -15
- package/dist/esm/daemon/config.js.map +1 -1
- package/dist/esm/daemon/constants.js +6 -6
- package/dist/esm/daemon/constants.js.map +1 -1
- package/dist/esm/daemon/env-merge.js.map +1 -1
- package/dist/esm/daemon/env-snapshot.js +36 -28
- package/dist/esm/daemon/env-snapshot.js.map +1 -1
- package/dist/esm/daemon/flow-context.js +86 -32
- package/dist/esm/daemon/flow-context.js.map +1 -1
- package/dist/esm/daemon/launchd.js +119 -47
- package/dist/esm/daemon/launchd.js.map +1 -1
- package/dist/esm/daemon/meta.js +5 -5
- package/dist/esm/daemon/meta.js.map +1 -1
- package/dist/esm/daemon/models.js +54 -31
- package/dist/esm/daemon/models.js.map +1 -1
- package/dist/esm/daemon/process-registry.js +206 -0
- package/dist/esm/daemon/process-registry.js.map +1 -0
- package/dist/esm/daemon/schtasks.js +96 -32
- package/dist/esm/daemon/schtasks.js.map +1 -1
- package/dist/esm/daemon/server.js +832 -158
- package/dist/esm/daemon/server.js.map +1 -1
- package/dist/esm/daemon/summarize-progress.js +11 -11
- package/dist/esm/daemon/summarize-progress.js.map +1 -1
- package/dist/esm/daemon/summarize.js +61 -32
- package/dist/esm/daemon/summarize.js.map +1 -1
- package/dist/esm/daemon/systemd.js +96 -35
- package/dist/esm/daemon/systemd.js.map +1 -1
- package/dist/esm/firecrawl.js +12 -12
- package/dist/esm/firecrawl.js.map +1 -1
- package/dist/esm/flags.js +55 -31
- package/dist/esm/flags.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/language.js +1 -1
- package/dist/esm/language.js.map +1 -1
- package/dist/esm/llm/cli.js +128 -64
- package/dist/esm/llm/cli.js.map +1 -1
- package/dist/esm/llm/errors.js +1 -1
- package/dist/esm/llm/errors.js.map +1 -1
- package/dist/esm/llm/generate-text.js +107 -98
- package/dist/esm/llm/generate-text.js.map +1 -1
- package/dist/esm/llm/google-models.js +17 -17
- package/dist/esm/llm/google-models.js.map +1 -1
- package/dist/esm/llm/html-to-markdown.js +3 -3
- package/dist/esm/llm/html-to-markdown.js.map +1 -1
- package/dist/esm/llm/model-id.js +38 -16
- package/dist/esm/llm/model-id.js.map +1 -1
- package/dist/esm/llm/prompt.js +5 -5
- package/dist/esm/llm/prompt.js.map +1 -1
- package/dist/esm/llm/providers/anthropic.js +33 -33
- package/dist/esm/llm/providers/anthropic.js.map +1 -1
- package/dist/esm/llm/providers/google.js +19 -19
- package/dist/esm/llm/providers/google.js.map +1 -1
- package/dist/esm/llm/providers/models.js +30 -30
- package/dist/esm/llm/providers/models.js.map +1 -1
- package/dist/esm/llm/providers/openai.js +36 -35
- package/dist/esm/llm/providers/openai.js.map +1 -1
- package/dist/esm/llm/providers/shared.js +8 -8
- package/dist/esm/llm/providers/shared.js.map +1 -1
- package/dist/esm/llm/transcript-to-markdown.js +9 -5
- package/dist/esm/llm/transcript-to-markdown.js.map +1 -1
- package/dist/esm/llm/usage.js +18 -18
- package/dist/esm/llm/usage.js.map +1 -1
- package/dist/esm/logging/daemon.js +21 -21
- package/dist/esm/logging/daemon.js.map +1 -1
- package/dist/esm/logging/ring-file.js +5 -5
- package/dist/esm/logging/ring-file.js.map +1 -1
- package/dist/esm/markitdown.js +21 -19
- package/dist/esm/markitdown.js.map +1 -1
- package/dist/esm/media-cache.js +251 -0
- package/dist/esm/media-cache.js.map +1 -0
- package/dist/esm/model-auto.js +175 -106
- package/dist/esm/model-auto.js.map +1 -1
- package/dist/esm/model-spec.js +52 -42
- package/dist/esm/model-spec.js.map +1 -1
- package/dist/esm/pricing/litellm.js +4 -4
- package/dist/esm/pricing/litellm.js.map +1 -1
- package/dist/esm/processes.js +2 -0
- package/dist/esm/processes.js.map +1 -0
- package/dist/esm/prompts/index.js +1 -1
- package/dist/esm/prompts/index.js.map +1 -1
- package/dist/esm/refresh-free.js +81 -81
- package/dist/esm/refresh-free.js.map +1 -1
- package/dist/esm/run/attachments.js +47 -44
- package/dist/esm/run/attachments.js.map +1 -1
- package/dist/esm/run/bird.js +125 -12
- package/dist/esm/run/bird.js.map +1 -1
- package/dist/esm/run/cache-state.js +7 -7
- package/dist/esm/run/cache-state.js.map +1 -1
- package/dist/esm/run/cli-fallback-state.js +45 -0
- package/dist/esm/run/cli-fallback-state.js.map +1 -0
- package/dist/esm/run/cli-preflight.js +40 -22
- package/dist/esm/run/cli-preflight.js.map +1 -1
- package/dist/esm/run/constants.js +12 -12
- package/dist/esm/run/constants.js.map +1 -1
- package/dist/esm/run/cookies/twitter.js +47 -47
- package/dist/esm/run/cookies/twitter.js.map +1 -1
- package/dist/esm/run/env.js +21 -15
- package/dist/esm/run/env.js.map +1 -1
- package/dist/esm/run/fetch-with-timeout.js +4 -4
- package/dist/esm/run/fetch-with-timeout.js.map +1 -1
- package/dist/esm/run/finish-line.js +78 -71
- package/dist/esm/run/finish-line.js.map +1 -1
- package/dist/esm/run/flows/asset/extract.js +70 -0
- package/dist/esm/run/flows/asset/extract.js.map +1 -0
- package/dist/esm/run/flows/asset/input.js +202 -37
- package/dist/esm/run/flows/asset/input.js.map +1 -1
- package/dist/esm/run/flows/asset/media-policy.js +3 -0
- package/dist/esm/run/flows/asset/media-policy.js.map +1 -0
- package/dist/esm/run/flows/asset/media.js +233 -0
- package/dist/esm/run/flows/asset/media.js.map +1 -0
- package/dist/esm/run/flows/asset/output.js +98 -0
- package/dist/esm/run/flows/asset/output.js.map +1 -0
- package/dist/esm/run/flows/asset/preprocess.js +79 -44
- package/dist/esm/run/flows/asset/preprocess.js.map +1 -1
- package/dist/esm/run/flows/asset/summary.js +306 -89
- package/dist/esm/run/flows/asset/summary.js.map +1 -1
- package/dist/esm/run/flows/url/extract.js +31 -31
- package/dist/esm/run/flows/url/extract.js.map +1 -1
- package/dist/esm/run/flows/url/flow.js +388 -82
- package/dist/esm/run/flows/url/flow.js.map +1 -1
- package/dist/esm/run/flows/url/markdown.js +61 -56
- package/dist/esm/run/flows/url/markdown.js.map +1 -1
- package/dist/esm/run/flows/url/slides-output.js +487 -0
- package/dist/esm/run/flows/url/slides-output.js.map +1 -0
- package/dist/esm/run/flows/url/slides-text.js +628 -0
- package/dist/esm/run/flows/url/slides-text.js.map +1 -0
- package/dist/esm/run/flows/url/summary.js +493 -152
- package/dist/esm/run/flows/url/summary.js.map +1 -1
- package/dist/esm/run/format.js +10 -10
- package/dist/esm/run/format.js.map +1 -1
- package/dist/esm/run/help.js +179 -84
- package/dist/esm/run/help.js.map +1 -1
- package/dist/esm/run/logging.js +20 -12
- package/dist/esm/run/logging.js.map +1 -1
- package/dist/esm/run/markdown.js +12 -12
- package/dist/esm/run/markdown.js.map +1 -1
- package/dist/esm/run/media-cache-state.js +33 -0
- package/dist/esm/run/media-cache-state.js.map +1 -0
- package/dist/esm/run/model-attempts.js.map +1 -1
- package/dist/esm/run/openrouter.js +11 -11
- package/dist/esm/run/openrouter.js.map +1 -1
- package/dist/esm/run/progress.js +19 -1
- package/dist/esm/run/progress.js.map +1 -1
- package/dist/esm/run/run-config.js +16 -16
- package/dist/esm/run/run-config.js.map +1 -1
- package/dist/esm/run/run-context.js +2 -2
- package/dist/esm/run/run-context.js.map +1 -1
- package/dist/esm/run/run-env.js +55 -54
- package/dist/esm/run/run-env.js.map +1 -1
- package/dist/esm/run/run-input.js +3 -3
- package/dist/esm/run/run-input.js.map +1 -1
- package/dist/esm/run/run-metrics.js +16 -16
- package/dist/esm/run/run-metrics.js.map +1 -1
- package/dist/esm/run/run-models.js +28 -23
- package/dist/esm/run/run-models.js.map +1 -1
- package/dist/esm/run/run-output.js +3 -3
- package/dist/esm/run/run-output.js.map +1 -1
- package/dist/esm/run/run-settings.js +108 -21
- package/dist/esm/run/run-settings.js.map +1 -1
- package/dist/esm/run/run-stream.js +4 -4
- package/dist/esm/run/run-stream.js.map +1 -1
- package/dist/esm/run/runner.js +327 -100
- package/dist/esm/run/runner.js.map +1 -1
- package/dist/esm/run/slides-cli.js +226 -0
- package/dist/esm/run/slides-cli.js.map +1 -0
- package/dist/esm/run/slides-render.js +163 -0
- package/dist/esm/run/slides-render.js.map +1 -0
- package/dist/esm/run/stdin-temp-file.js +77 -0
- package/dist/esm/run/stdin-temp-file.js.map +1 -0
- package/dist/esm/run/stream-output.js +17 -10
- package/dist/esm/run/stream-output.js.map +1 -1
- package/dist/esm/run/streaming.js +16 -16
- package/dist/esm/run/streaming.js.map +1 -1
- package/dist/esm/run/summary-engine.js +89 -57
- package/dist/esm/run/summary-engine.js.map +1 -1
- package/dist/esm/run/summary-llm.js +3 -3
- package/dist/esm/run/summary-llm.js.map +1 -1
- package/dist/esm/run/terminal.js +4 -4
- package/dist/esm/run/terminal.js.map +1 -1
- package/dist/esm/run/tips.js +2 -2
- package/dist/esm/run/tips.js.map +1 -1
- package/dist/esm/run/transcriber-cli.js +148 -0
- package/dist/esm/run/transcriber-cli.js.map +1 -0
- package/dist/esm/run.js +1 -1
- package/dist/esm/run.js.map +1 -1
- package/dist/esm/shared/contracts.js +1 -1
- package/dist/esm/shared/contracts.js.map +1 -1
- package/dist/esm/shared/sse-events.js +16 -12
- package/dist/esm/shared/sse-events.js.map +1 -1
- package/dist/esm/shared/streaming-merge.js +3 -3
- package/dist/esm/shared/streaming-merge.js.map +1 -1
- package/dist/esm/slides/extract.js +1951 -0
- package/dist/esm/slides/extract.js.map +1 -0
- package/dist/esm/slides/index.js +4 -0
- package/dist/esm/slides/index.js.map +1 -0
- package/dist/esm/slides/settings.js +73 -0
- package/dist/esm/slides/settings.js.map +1 -0
- package/dist/esm/slides/store.js +111 -0
- package/dist/esm/slides/store.js.map +1 -0
- package/dist/esm/slides/types.js +2 -0
- package/dist/esm/slides/types.js.map +1 -0
- package/dist/esm/tty/format.js +13 -13
- package/dist/esm/tty/format.js.map +1 -1
- package/dist/esm/tty/osc-progress.js +22 -2
- package/dist/esm/tty/osc-progress.js.map +1 -1
- package/dist/esm/tty/progress/fetch-html.js +20 -16
- package/dist/esm/tty/progress/fetch-html.js.map +1 -1
- package/dist/esm/tty/progress/transcript.js +127 -68
- package/dist/esm/tty/progress/transcript.js.map +1 -1
- package/dist/esm/tty/spinner.js +21 -10
- package/dist/esm/tty/spinner.js.map +1 -1
- package/dist/esm/tty/theme.js +189 -0
- package/dist/esm/tty/theme.js.map +1 -0
- package/dist/esm/tty/website-progress.js +38 -34
- package/dist/esm/tty/website-progress.js.map +1 -1
- package/dist/esm/version.js +29 -29
- package/dist/esm/version.js.map +1 -1
- package/dist/types/cache.d.ts +19 -7
- package/dist/types/config.d.ts +71 -6
- package/dist/types/content/asset.d.ts +8 -6
- package/dist/types/content/index.d.ts +1 -1
- package/dist/types/costs.d.ts +3 -3
- package/dist/types/daemon/agent.d.ts +25 -0
- package/dist/types/daemon/auto-mode.d.ts +3 -3
- package/dist/types/daemon/chat.d.ts +10 -18
- package/dist/types/daemon/cli-entrypoint.d.ts +2 -0
- package/dist/types/daemon/config.d.ts +2 -2
- package/dist/types/daemon/env-merge.d.ts +1 -1
- package/dist/types/daemon/env-snapshot.d.ts +1 -1
- package/dist/types/daemon/flow-context.d.ts +24 -4
- package/dist/types/daemon/launchd.d.ts +12 -0
- package/dist/types/daemon/models.d.ts +6 -2
- package/dist/types/daemon/process-registry.d.ts +73 -0
- package/dist/types/daemon/schtasks.d.ts +4 -0
- package/dist/types/daemon/server.d.ts +2 -2
- package/dist/types/daemon/summarize-progress.d.ts +1 -1
- package/dist/types/daemon/summarize.d.ts +38 -7
- package/dist/types/daemon/systemd.d.ts +4 -0
- package/dist/types/firecrawl.d.ts +1 -1
- package/dist/types/flags.d.ts +12 -11
- package/dist/types/index.d.ts +4 -4
- package/dist/types/language.d.ts +1 -1
- package/dist/types/llm/attachments.d.ts +1 -1
- package/dist/types/llm/cli.d.ts +3 -3
- package/dist/types/llm/generate-text.d.ts +7 -7
- package/dist/types/llm/html-to-markdown.d.ts +3 -3
- package/dist/types/llm/model-id.d.ts +1 -1
- package/dist/types/llm/prompt.d.ts +2 -2
- package/dist/types/llm/providers/anthropic.d.ts +3 -3
- package/dist/types/llm/providers/google.d.ts +3 -3
- package/dist/types/llm/providers/models.d.ts +2 -2
- package/dist/types/llm/providers/openai.d.ts +4 -4
- package/dist/types/llm/providers/shared.d.ts +2 -2
- package/dist/types/llm/transcript-to-markdown.d.ts +4 -2
- package/dist/types/llm/usage.d.ts +1 -1
- package/dist/types/logging/daemon.d.ts +4 -4
- package/dist/types/markitdown.d.ts +1 -1
- package/dist/types/media-cache.d.ts +22 -0
- package/dist/types/model-auto.d.ts +14 -4
- package/dist/types/model-spec.d.ts +10 -10
- package/dist/types/pricing/litellm.d.ts +1 -1
- package/dist/types/processes.d.ts +1 -0
- package/dist/types/prompts/index.d.ts +1 -1
- package/dist/types/run/attachments.d.ts +7 -7
- package/dist/types/run/bird.d.ts +7 -0
- package/dist/types/run/cache-state.d.ts +2 -2
- package/dist/types/run/cli-fallback-state.d.ts +6 -0
- package/dist/types/run/constants.d.ts +1 -1
- package/dist/types/run/cookies/twitter.d.ts +1 -1
- package/dist/types/run/env.d.ts +1 -1
- package/dist/types/run/finish-line.d.ts +7 -6
- package/dist/types/run/flows/asset/extract.d.ts +18 -0
- package/dist/types/run/flows/asset/input.d.ts +19 -3
- package/dist/types/run/flows/asset/media-policy.d.ts +2 -0
- package/dist/types/run/flows/asset/media.d.ts +21 -0
- package/dist/types/run/flows/asset/output.d.ts +42 -0
- package/dist/types/run/flows/asset/preprocess.d.ts +23 -17
- package/dist/types/run/flows/asset/summary.d.ts +24 -16
- package/dist/types/run/flows/url/extract.d.ts +3 -2
- package/dist/types/run/flows/url/flow.d.ts +1 -1
- package/dist/types/run/flows/url/markdown.d.ts +6 -6
- package/dist/types/run/flows/url/slides-output.d.ts +66 -0
- package/dist/types/run/flows/url/slides-text.d.ts +87 -0
- package/dist/types/run/flows/url/summary.d.ts +18 -10
- package/dist/types/run/flows/url/types.d.ts +52 -21
- package/dist/types/run/format.d.ts +3 -3
- package/dist/types/run/help.d.ts +4 -1
- package/dist/types/run/logging.d.ts +3 -2
- package/dist/types/run/media-cache-state.d.ts +7 -0
- package/dist/types/run/model-attempts.d.ts +1 -1
- package/dist/types/run/progress.d.ts +2 -1
- package/dist/types/run/run-config.d.ts +4 -4
- package/dist/types/run/run-context.d.ts +3 -1
- package/dist/types/run/run-env.d.ts +3 -1
- package/dist/types/run/run-input.d.ts +2 -2
- package/dist/types/run/run-metrics.d.ts +3 -3
- package/dist/types/run/run-models.d.ts +3 -2
- package/dist/types/run/run-output.d.ts +1 -1
- package/dist/types/run/run-settings.d.ts +20 -5
- package/dist/types/run/run-stream.d.ts +2 -2
- package/dist/types/run/runner.d.ts +3 -2
- package/dist/types/run/slides-cli.d.ts +9 -0
- package/dist/types/run/slides-render.d.ts +30 -0
- package/dist/types/run/stdin-temp-file.d.ts +9 -0
- package/dist/types/run/stream-output.d.ts +3 -2
- package/dist/types/run/streaming.d.ts +4 -4
- package/dist/types/run/summary-engine.d.ts +22 -12
- package/dist/types/run/summary-llm.d.ts +5 -5
- package/dist/types/run/transcriber-cli.d.ts +8 -0
- package/dist/types/run/types.d.ts +4 -4
- package/dist/types/run.d.ts +1 -1
- package/dist/types/shared/contracts.d.ts +2 -2
- package/dist/types/shared/sse-events.d.ts +26 -6
- package/dist/types/slides/extract.d.ts +43 -0
- package/dist/types/slides/index.d.ts +5 -0
- package/dist/types/slides/settings.d.ts +20 -0
- package/dist/types/slides/store.d.ts +15 -0
- package/dist/types/slides/types.d.ts +40 -0
- package/dist/types/tty/osc-progress.d.ts +5 -5
- package/dist/types/tty/progress/fetch-html.d.ts +5 -3
- package/dist/types/tty/progress/transcript.d.ts +5 -3
- package/dist/types/tty/spinner.d.ts +3 -1
- package/dist/types/tty/theme.d.ts +44 -0
- package/dist/types/tty/website-progress.d.ts +5 -3
- package/dist/types/version.d.ts +1 -1
- package/docs/README.md +1 -1
- package/docs/_config.yml +26 -0
- package/docs/_layouts/default.html +60 -0
- package/docs/agent.md +367 -0
- package/docs/assets/site.css +748 -0
- package/docs/assets/site.js +72 -0
- package/docs/assets/summarize-cli.png +0 -0
- package/docs/assets/summarize-extension.png +0 -0
- package/docs/assets/youtube-slides.png +0 -0
- package/docs/cache.md +29 -3
- package/docs/chrome-extension.md +72 -16
- package/docs/cli.md +59 -13
- package/docs/config.md +109 -12
- package/docs/extract-only.md +10 -0
- package/docs/index.html +224 -0
- package/docs/index.md +25 -0
- package/docs/llm.md +18 -5
- package/docs/manual-tests.md +2 -0
- package/docs/media.md +6 -2
- package/docs/model-auto.md +3 -2
- package/docs/nvidia-onnx-transcription.md +55 -0
- package/docs/openai.md +1 -1
- package/docs/releasing.md +3 -0
- package/docs/site/404.html +4 -1
- package/docs/site/assets/site.css +399 -228
- package/docs/site/assets/site.js +46 -46
- package/docs/site/assets/summarize-cli.png +0 -0
- package/docs/site/assets/summarize-extension.png +0 -0
- package/docs/site/docs/chrome-extension.html +101 -0
- package/docs/site/docs/config.html +30 -8
- package/docs/site/docs/extract-only.html +17 -4
- package/docs/site/docs/firecrawl.html +13 -3
- package/docs/site/docs/index.html +40 -6
- package/docs/site/docs/llm.html +20 -5
- package/docs/site/docs/openai.html +19 -5
- package/docs/site/docs/website.html +30 -9
- package/docs/site/docs/youtube.html +13 -3
- package/docs/site/index.html +168 -85
- package/docs/slides.md +82 -0
- package/docs/smoketest.md +29 -20
- package/docs/timestamps.md +124 -0
- package/docs/website.md +13 -0
- package/docs/youtube.md +20 -0
- package/package.json +57 -48
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AutoRuleKind, CliProvider, SummarizeConfig } from
|
|
2
|
-
import type { LiteLlmCatalog } from
|
|
1
|
+
import type { AutoRuleKind, CliProvider, SummarizeConfig } from "./config.js";
|
|
2
|
+
import type { LiteLlmCatalog } from "./pricing/litellm.js";
|
|
3
3
|
export type AutoSelectionInput = {
|
|
4
4
|
kind: AutoRuleKind;
|
|
5
5
|
promptTokens: number | null;
|
|
@@ -11,14 +11,24 @@ export type AutoSelectionInput = {
|
|
|
11
11
|
openrouterProvidersFromEnv: string[] | null;
|
|
12
12
|
openrouterModelIds?: string[] | null;
|
|
13
13
|
cliAvailability?: Partial<Record<CliProvider, boolean>>;
|
|
14
|
+
isImplicitAutoSelection?: boolean;
|
|
15
|
+
allowAutoCliFallback?: boolean;
|
|
16
|
+
lastSuccessfulCliProvider?: CliProvider | null;
|
|
14
17
|
};
|
|
15
18
|
export type AutoModelAttempt = {
|
|
16
|
-
transport:
|
|
19
|
+
transport: "native" | "openrouter" | "cli";
|
|
17
20
|
userModelId: string;
|
|
18
21
|
llmModelId: string | null;
|
|
19
22
|
openrouterProviders: string[] | null;
|
|
20
23
|
forceOpenRouter: boolean;
|
|
21
|
-
requiredEnv:
|
|
24
|
+
requiredEnv: "XAI_API_KEY" | "OPENAI_API_KEY" | "GEMINI_API_KEY" | "ANTHROPIC_API_KEY" | "OPENROUTER_API_KEY" | "Z_AI_API_KEY" | "CLI_CLAUDE" | "CLI_CODEX" | "CLI_GEMINI" | "CLI_AGENT";
|
|
22
25
|
debug: string;
|
|
23
26
|
};
|
|
27
|
+
export type ResolvedCliAutoFallbackConfig = {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
onlyWhenNoApiKeys: boolean;
|
|
30
|
+
order: CliProvider[];
|
|
31
|
+
};
|
|
32
|
+
export declare function resolveCliAutoFallbackConfig(config: SummarizeConfig | null): ResolvedCliAutoFallbackConfig;
|
|
33
|
+
export declare function envHasKey(env: Record<string, string | undefined>, requiredEnv: AutoModelAttempt["requiredEnv"]): boolean;
|
|
24
34
|
export declare function buildAutoModelAttempts(input: AutoSelectionInput): AutoModelAttempt[];
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import type { CliProvider } from
|
|
1
|
+
import type { CliProvider } from "./config.js";
|
|
2
2
|
export type FixedModelSpec = {
|
|
3
|
-
transport:
|
|
3
|
+
transport: "native";
|
|
4
4
|
userModelId: string;
|
|
5
5
|
llmModelId: string;
|
|
6
|
-
provider:
|
|
6
|
+
provider: "xai" | "openai" | "google" | "anthropic" | "zai";
|
|
7
7
|
openrouterProviders: string[] | null;
|
|
8
8
|
forceOpenRouter: false;
|
|
9
|
-
requiredEnv:
|
|
9
|
+
requiredEnv: "XAI_API_KEY" | "OPENAI_API_KEY" | "GEMINI_API_KEY" | "ANTHROPIC_API_KEY" | "Z_AI_API_KEY";
|
|
10
10
|
openaiBaseUrlOverride?: string | null;
|
|
11
11
|
forceChatCompletions?: boolean;
|
|
12
12
|
} | {
|
|
13
|
-
transport:
|
|
13
|
+
transport: "openrouter";
|
|
14
14
|
userModelId: string;
|
|
15
15
|
openrouterModelId: string;
|
|
16
16
|
llmModelId: string;
|
|
17
17
|
openrouterProviders: string[] | null;
|
|
18
18
|
forceOpenRouter: true;
|
|
19
|
-
requiredEnv:
|
|
19
|
+
requiredEnv: "OPENROUTER_API_KEY";
|
|
20
20
|
} | {
|
|
21
|
-
transport:
|
|
21
|
+
transport: "cli";
|
|
22
22
|
userModelId: string;
|
|
23
23
|
llmModelId: null;
|
|
24
24
|
openrouterProviders: null;
|
|
25
25
|
forceOpenRouter: false;
|
|
26
|
-
requiredEnv:
|
|
26
|
+
requiredEnv: "CLI_CLAUDE" | "CLI_CODEX" | "CLI_GEMINI" | "CLI_AGENT";
|
|
27
27
|
cliProvider: CliProvider;
|
|
28
28
|
cliModel: string | null;
|
|
29
29
|
};
|
|
30
30
|
export type RequestedModel = {
|
|
31
|
-
kind:
|
|
31
|
+
kind: "auto";
|
|
32
32
|
} | ({
|
|
33
|
-
kind:
|
|
33
|
+
kind: "fixed";
|
|
34
34
|
} & FixedModelSpec);
|
|
35
35
|
export declare function parseRequestedModelId(raw: string): RequestedModel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LiteLlmCatalog, type LiteLlmLoadResult } from
|
|
1
|
+
import { type LiteLlmCatalog, type LiteLlmLoadResult } from "tokentally/node";
|
|
2
2
|
export type { LiteLlmCatalog, LiteLlmLoadResult };
|
|
3
3
|
export declare function loadLiteLlmCatalog({ env, fetchImpl, nowMs, }: {
|
|
4
4
|
env: Record<string, string | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@steipete/summarize-core/processes";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "@steipete/summarize-core/prompts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { loadLocalAsset } from
|
|
2
|
-
export type AssetAttachment = Awaited<ReturnType<typeof loadLocalAsset>>[
|
|
1
|
+
import type { loadLocalAsset } from "../content/asset.js";
|
|
2
|
+
export type AssetAttachment = Awaited<ReturnType<typeof loadLocalAsset>>["attachment"];
|
|
3
3
|
export declare const MAX_DOCUMENT_BYTES_DEFAULT: number;
|
|
4
4
|
export declare function isUnsupportedAttachmentError(error: unknown): boolean;
|
|
5
5
|
export declare function isTextLikeMediaType(mediaType: string): boolean;
|
|
@@ -13,23 +13,23 @@ export declare function getTextContentFromAttachment(attachment: AssetAttachment
|
|
|
13
13
|
} | null;
|
|
14
14
|
export declare function getFileBytesFromAttachment(attachment: AssetAttachment): Uint8Array | null;
|
|
15
15
|
export declare function ensureCliAttachmentPath({ sourceKind, sourceLabel, attachment, }: {
|
|
16
|
-
sourceKind:
|
|
16
|
+
sourceKind: "file" | "asset-url";
|
|
17
17
|
sourceLabel: string;
|
|
18
18
|
attachment: AssetAttachment;
|
|
19
19
|
}): Promise<string>;
|
|
20
20
|
export declare function shouldMarkitdownConvertMediaType(mediaType: string): boolean;
|
|
21
21
|
export declare function supportsNativeFileAttachment({ provider, attachment, }: {
|
|
22
|
-
provider:
|
|
22
|
+
provider: "xai" | "openai" | "google" | "anthropic" | "zai";
|
|
23
23
|
attachment: {
|
|
24
|
-
kind:
|
|
24
|
+
kind: "image" | "file";
|
|
25
25
|
mediaType: string;
|
|
26
26
|
};
|
|
27
27
|
}): boolean;
|
|
28
28
|
export declare function assertProviderSupportsAttachment({ provider, modelId, attachment, }: {
|
|
29
|
-
provider:
|
|
29
|
+
provider: "xai" | "openai" | "google" | "anthropic" | "zai";
|
|
30
30
|
modelId: string;
|
|
31
31
|
attachment: {
|
|
32
|
-
kind:
|
|
32
|
+
kind: "image" | "file";
|
|
33
33
|
mediaType: string;
|
|
34
34
|
};
|
|
35
35
|
}): void;
|
package/dist/types/run/bird.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ type BirdTweetPayload = {
|
|
|
6
6
|
name?: string;
|
|
7
7
|
};
|
|
8
8
|
createdAt?: string;
|
|
9
|
+
media?: BirdTweetMedia | null;
|
|
10
|
+
};
|
|
11
|
+
type BirdTweetMedia = {
|
|
12
|
+
kind: "video" | "audio";
|
|
13
|
+
urls: string[];
|
|
14
|
+
preferredUrl: string | null;
|
|
15
|
+
source: "extended_entities" | "card" | "entities";
|
|
9
16
|
};
|
|
10
17
|
export declare function readTweetWithBird(args: {
|
|
11
18
|
url: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
1
|
+
import type { SummarizeConfig } from "../config.js";
|
|
2
|
+
import { type CacheState } from "../cache.js";
|
|
3
3
|
export declare function createCacheStateFromConfig({ envForRun, config, noCacheFlag, transcriptNamespace, }: {
|
|
4
4
|
envForRun: Record<string, string | undefined>;
|
|
5
5
|
config: SummarizeConfig | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CliProvider } from "../config.js";
|
|
2
|
+
export declare function readLastSuccessfulCliProvider(env: Record<string, string | undefined>): Promise<CliProvider | null>;
|
|
3
|
+
export declare function writeLastSuccessfulCliProvider({ env, provider, }: {
|
|
4
|
+
env: Record<string, string | undefined>;
|
|
5
|
+
provider: CliProvider;
|
|
6
|
+
}): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModelConfig } from
|
|
1
|
+
import type { ModelConfig } from "../config.js";
|
|
2
2
|
export declare const BIRD_TIP = "Tip: Install bird\uD83D\uDC26 for better Twitter support: https://github.com/steipete/bird";
|
|
3
3
|
export declare const UVX_TIP = "Tip: Install uv (uvx) for local Markdown conversion: brew install uv (or set UVX_PATH to your uvx binary).";
|
|
4
4
|
export declare const SUPPORT_URL = "https://github.com/steipete/summarize";
|
package/dist/types/run/env.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CliProvider, SummarizeConfig } from
|
|
1
|
+
import type { CliProvider, SummarizeConfig } from "../config.js";
|
|
2
2
|
type ConfigForCli = SummarizeConfig | null;
|
|
3
3
|
export declare function resolveExecutableInPath(binary: string, env: Record<string, string | undefined>): string | null;
|
|
4
4
|
export declare function hasBirdCli(env: Record<string, string | undefined>): boolean;
|
|
@@ -7,13 +7,13 @@ export type FinishLineModel = {
|
|
|
7
7
|
detailParts: string[];
|
|
8
8
|
};
|
|
9
9
|
export type ExtractDiagnosticsForFinishLine = {
|
|
10
|
-
strategy:
|
|
10
|
+
strategy: "bird" | "firecrawl" | "html" | "nitter";
|
|
11
11
|
firecrawl: {
|
|
12
12
|
used: boolean;
|
|
13
13
|
};
|
|
14
14
|
markdown: {
|
|
15
15
|
used: boolean;
|
|
16
|
-
provider:
|
|
16
|
+
provider: "firecrawl" | "llm" | null;
|
|
17
17
|
notes?: string | null;
|
|
18
18
|
};
|
|
19
19
|
transcript: {
|
|
@@ -33,7 +33,7 @@ export type ExtractedForLengths = {
|
|
|
33
33
|
transcriptionProvider: string | null;
|
|
34
34
|
mediaDurationSeconds: number | null;
|
|
35
35
|
video: {
|
|
36
|
-
kind:
|
|
36
|
+
kind: "youtube" | "direct";
|
|
37
37
|
url: string;
|
|
38
38
|
} | null;
|
|
39
39
|
isVideoOnly: boolean;
|
|
@@ -45,7 +45,7 @@ export type ExtractedForLengths = {
|
|
|
45
45
|
};
|
|
46
46
|
export declare function formatModelLabelForDisplay(model: string): string;
|
|
47
47
|
export declare function buildLengthPartsForFinishLine(extracted: ExtractedForLengths, detailed: boolean): string[] | null;
|
|
48
|
-
export declare function writeFinishLine({ stderr, elapsedMs, elapsedLabel, label, model, report, costUsd, detailed, extraParts, color, }: {
|
|
48
|
+
export declare function writeFinishLine({ stderr, elapsedMs, elapsedLabel, label, model, report, costUsd, detailed, extraParts, color, env, }: {
|
|
49
49
|
stderr: NodeJS.WritableStream;
|
|
50
50
|
elapsedMs: number;
|
|
51
51
|
elapsedLabel?: string | null;
|
|
@@ -71,6 +71,7 @@ export declare function writeFinishLine({ stderr, elapsedMs, elapsedLabel, label
|
|
|
71
71
|
detailed: boolean;
|
|
72
72
|
extraParts?: string[] | null;
|
|
73
73
|
color: boolean;
|
|
74
|
+
env?: Record<string, string | undefined>;
|
|
74
75
|
}): void;
|
|
75
76
|
export declare function buildFinishLineText({ elapsedMs, elapsedLabel, label, model, report, costUsd, detailed, extraParts, }: {
|
|
76
77
|
elapsedMs: number;
|
|
@@ -154,8 +155,8 @@ export declare function buildExtractFinishLabel(args: {
|
|
|
154
155
|
extracted: {
|
|
155
156
|
diagnostics: ExtractDiagnosticsForFinishLine;
|
|
156
157
|
};
|
|
157
|
-
format:
|
|
158
|
-
markdownMode:
|
|
158
|
+
format: "text" | "markdown";
|
|
159
|
+
markdownMode: "off" | "auto" | "llm" | "readability";
|
|
159
160
|
hasMarkdownLlmCall: boolean;
|
|
160
161
|
}): string;
|
|
161
162
|
export declare function buildSummaryFinishLabel(args: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ExecFileFn } from "../../../markitdown.js";
|
|
2
|
+
import type { ExtractDiagnosticsForFinishLine } from "../../finish-line.js";
|
|
3
|
+
import { type AssetAttachment } from "../../attachments.js";
|
|
4
|
+
export type AssetExtractContext = {
|
|
5
|
+
env: Record<string, string | undefined>;
|
|
6
|
+
envForRun: Record<string, string | undefined>;
|
|
7
|
+
execFileImpl: ExecFileFn;
|
|
8
|
+
timeoutMs: number;
|
|
9
|
+
preprocessMode: "off" | "auto" | "always";
|
|
10
|
+
};
|
|
11
|
+
export type AssetExtractResult = {
|
|
12
|
+
content: string;
|
|
13
|
+
diagnostics: ExtractDiagnosticsForFinishLine;
|
|
14
|
+
};
|
|
15
|
+
export declare function extractAssetContent({ ctx, attachment, }: {
|
|
16
|
+
ctx: AssetExtractContext;
|
|
17
|
+
attachment: AssetAttachment;
|
|
18
|
+
}): Promise<AssetExtractResult>;
|
|
@@ -1,14 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
1
|
+
import type { SummarizeAssetArgs } from "./summary.js";
|
|
2
|
+
import { type InputTarget, loadRemoteAsset } from "../../../content/asset.js";
|
|
3
|
+
import { startSpinner } from "../../../tty/spinner.js";
|
|
4
|
+
/**
|
|
5
|
+
* Check if a file extension indicates transcribable media.
|
|
6
|
+
* Used to route large audio/video files directly to the media handler
|
|
7
|
+
* which has a higher size limit (2GB vs 50MB).
|
|
8
|
+
*/
|
|
9
|
+
export declare function isTranscribableExtension(filePath: string): boolean;
|
|
3
10
|
export type AssetInputContext = {
|
|
4
11
|
env: Record<string, string | undefined>;
|
|
12
|
+
envForRun: Record<string, string | undefined>;
|
|
5
13
|
stderr: NodeJS.WritableStream;
|
|
6
14
|
progressEnabled: boolean;
|
|
7
15
|
timeoutMs: number;
|
|
8
16
|
trackedFetch: typeof fetch;
|
|
9
17
|
summarizeAsset: (args: SummarizeAssetArgs) => Promise<void>;
|
|
10
|
-
|
|
18
|
+
summarizeMediaFile?: (args: SummarizeAssetArgs) => Promise<void>;
|
|
19
|
+
setClearProgressBeforeStdout: (fn: (() => undefined | (() => void)) | null) => void;
|
|
11
20
|
clearProgressIfCurrent: (fn: () => void) => void;
|
|
12
21
|
};
|
|
22
|
+
type UrlAssetHandler = (args: {
|
|
23
|
+
loaded: Awaited<ReturnType<typeof loadRemoteAsset>>;
|
|
24
|
+
spinner: ReturnType<typeof startSpinner>;
|
|
25
|
+
clearProgressLine: () => void;
|
|
26
|
+
}) => Promise<void>;
|
|
13
27
|
export declare function handleFileInput(ctx: AssetInputContext, inputTarget: InputTarget): Promise<boolean>;
|
|
28
|
+
export declare function withUrlAsset(ctx: AssetInputContext, url: string, isYoutubeUrl: boolean, handler: UrlAssetHandler): Promise<boolean>;
|
|
14
29
|
export declare function handleUrlAsset(ctx: AssetInputContext, url: string, isYoutubeUrl: boolean): Promise<boolean>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media file transcription handler for local audio/video files.
|
|
3
|
+
* Phase 2: Transcript provider integration
|
|
4
|
+
* Phase 2.2: Local file path handling for transcript caching
|
|
5
|
+
*/
|
|
6
|
+
import type { AssetSummaryContext, SummarizeAssetArgs } from "./summary.js";
|
|
7
|
+
/**
|
|
8
|
+
* Handler for local audio/video files.
|
|
9
|
+
*
|
|
10
|
+
* Phase 2 Implementation:
|
|
11
|
+
* 1. Validates transcription provider availability
|
|
12
|
+
* 2. Creates LinkPreviewClient with necessary dependencies
|
|
13
|
+
* 3. Calls client.fetchLinkContent to trigger transcription
|
|
14
|
+
* 4. Converts transcript text to AssetAttachment
|
|
15
|
+
* 5. Calls summarizeAsset with the transcript
|
|
16
|
+
*
|
|
17
|
+
* Phase 2.2 Enhancement:
|
|
18
|
+
* - Captures file modification time for cache invalidation
|
|
19
|
+
* - Passes fileMtime to transcript cache for local file support
|
|
20
|
+
*/
|
|
21
|
+
export declare function summarizeMediaFile(ctx: AssetSummaryContext, args: SummarizeAssetArgs): Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RunMetricsReport } from "../../../costs.js";
|
|
2
|
+
import type { AssetAttachment } from "../../attachments.js";
|
|
3
|
+
import type { AssetExtractResult } from "./extract.js";
|
|
4
|
+
export declare function outputExtractedAsset({ io, flags, hooks, url, sourceLabel, attachment, extracted, apiStatus, }: {
|
|
5
|
+
io: {
|
|
6
|
+
env: Record<string, string | undefined>;
|
|
7
|
+
envForRun: Record<string, string | undefined>;
|
|
8
|
+
stdout: NodeJS.WritableStream;
|
|
9
|
+
stderr: NodeJS.WritableStream;
|
|
10
|
+
};
|
|
11
|
+
flags: {
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
preprocessMode: "off" | "auto" | "always";
|
|
14
|
+
format: "text" | "markdown";
|
|
15
|
+
plain: boolean;
|
|
16
|
+
json: boolean;
|
|
17
|
+
metricsEnabled: boolean;
|
|
18
|
+
metricsDetailed: boolean;
|
|
19
|
+
shouldComputeReport: boolean;
|
|
20
|
+
runStartedAtMs: number;
|
|
21
|
+
verboseColor: boolean;
|
|
22
|
+
};
|
|
23
|
+
hooks: {
|
|
24
|
+
clearProgressForStdout: () => void;
|
|
25
|
+
restoreProgressAfterStdout?: (() => void) | null;
|
|
26
|
+
buildReport: () => Promise<RunMetricsReport>;
|
|
27
|
+
estimateCostUsd: () => Promise<number | null>;
|
|
28
|
+
};
|
|
29
|
+
url: string;
|
|
30
|
+
sourceLabel: string;
|
|
31
|
+
attachment: AssetAttachment;
|
|
32
|
+
extracted: AssetExtractResult;
|
|
33
|
+
apiStatus: {
|
|
34
|
+
xaiApiKey: string | null;
|
|
35
|
+
apiKey: string | null;
|
|
36
|
+
openrouterApiKey: string | null;
|
|
37
|
+
apifyToken: string | null;
|
|
38
|
+
firecrawlConfigured: boolean;
|
|
39
|
+
googleConfigured: boolean;
|
|
40
|
+
anthropicConfigured: boolean;
|
|
41
|
+
};
|
|
42
|
+
}): Promise<void>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { OutputLanguage } from
|
|
2
|
-
import type { Attachment } from
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
5
|
-
import
|
|
6
|
-
import { type AssetAttachment } from
|
|
1
|
+
import type { OutputLanguage } from "../../../language.js";
|
|
2
|
+
import type { Attachment } from "../../../llm/attachments.js";
|
|
3
|
+
import type { FixedModelSpec } from "../../../model-spec.js";
|
|
4
|
+
import type { SummaryLength } from "../../../shared/contracts.js";
|
|
5
|
+
import { convertToMarkdownWithMarkitdown } from "../../../markitdown.js";
|
|
6
|
+
import { type AssetAttachment } from "../../attachments.js";
|
|
7
7
|
export type AssetPreprocessContext = {
|
|
8
8
|
env: Record<string, string | undefined>;
|
|
9
9
|
envForRun: Record<string, string | undefined>;
|
|
10
|
-
execFileImpl: Parameters<typeof convertToMarkdownWithMarkitdown>[0][
|
|
10
|
+
execFileImpl: Parameters<typeof convertToMarkdownWithMarkitdown>[0]["execFileImpl"];
|
|
11
11
|
timeoutMs: number;
|
|
12
|
-
preprocessMode:
|
|
13
|
-
format:
|
|
12
|
+
preprocessMode: "off" | "auto" | "always";
|
|
13
|
+
format: "text" | "markdown";
|
|
14
14
|
lengthArg: {
|
|
15
|
-
kind:
|
|
15
|
+
kind: "preset";
|
|
16
16
|
preset: SummaryLength;
|
|
17
17
|
} | {
|
|
18
|
-
kind:
|
|
18
|
+
kind: "chars";
|
|
19
19
|
maxCharacters: number;
|
|
20
20
|
};
|
|
21
21
|
outputLanguage: OutputLanguage;
|
|
@@ -23,6 +23,9 @@ export type AssetPreprocessContext = {
|
|
|
23
23
|
promptOverride?: string | null;
|
|
24
24
|
lengthInstruction?: string | null;
|
|
25
25
|
languageInstruction?: string | null;
|
|
26
|
+
openaiApiKey?: string | null;
|
|
27
|
+
openrouterApiKey?: string | null;
|
|
28
|
+
openaiBaseUrl?: string | null;
|
|
26
29
|
};
|
|
27
30
|
export type AssetPreprocessResult = {
|
|
28
31
|
promptText: string;
|
|
@@ -34,24 +37,27 @@ export type AssetPreprocessResult = {
|
|
|
34
37
|
} | null;
|
|
35
38
|
};
|
|
36
39
|
export type DocumentHandlingDecision = {
|
|
37
|
-
mode:
|
|
40
|
+
mode: "inline";
|
|
38
41
|
} | {
|
|
39
|
-
mode:
|
|
42
|
+
mode: "attach";
|
|
40
43
|
} | {
|
|
41
|
-
mode:
|
|
44
|
+
mode: "preprocess";
|
|
42
45
|
} | {
|
|
43
|
-
mode:
|
|
46
|
+
mode: "error";
|
|
44
47
|
error: Error;
|
|
45
48
|
};
|
|
46
|
-
export declare function resolveDocumentHandling({ attachment, textContent, fileBytes, preprocessMode, fixedModelSpec, }: {
|
|
49
|
+
export declare function resolveDocumentHandling({ attachment, textContent, fileBytes, preprocessMode, fixedModelSpec, openaiApiKey, openrouterApiKey, openaiBaseUrl, }: {
|
|
47
50
|
attachment: AssetAttachment;
|
|
48
51
|
textContent: {
|
|
49
52
|
content: string;
|
|
50
53
|
bytes: number;
|
|
51
54
|
} | null;
|
|
52
55
|
fileBytes: Uint8Array | null;
|
|
53
|
-
preprocessMode:
|
|
56
|
+
preprocessMode: "off" | "auto" | "always";
|
|
54
57
|
fixedModelSpec: FixedModelSpec | null;
|
|
58
|
+
openaiApiKey?: string | null;
|
|
59
|
+
openrouterApiKey?: string | null;
|
|
60
|
+
openaiBaseUrl?: string | null;
|
|
55
61
|
}): DocumentHandlingDecision;
|
|
56
62
|
export declare function prepareAssetPrompt({ ctx, attachment, }: {
|
|
57
63
|
ctx: AssetPreprocessContext;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type { LlmCall, RunMetricsReport } from
|
|
4
|
-
import type { OutputLanguage } from
|
|
5
|
-
import type { ExecFileFn } from
|
|
6
|
-
import type { FixedModelSpec, RequestedModel } from
|
|
7
|
-
import type { SummaryLength } from
|
|
8
|
-
import {
|
|
9
|
-
import type
|
|
1
|
+
import type { CliProvider, SummarizeConfig } from "../../../config.js";
|
|
2
|
+
import type { MediaCache } from "../../../content/index.js";
|
|
3
|
+
import type { LlmCall, RunMetricsReport } from "../../../costs.js";
|
|
4
|
+
import type { OutputLanguage } from "../../../language.js";
|
|
5
|
+
import type { ExecFileFn } from "../../../markitdown.js";
|
|
6
|
+
import type { FixedModelSpec, RequestedModel } from "../../../model-spec.js";
|
|
7
|
+
import type { SummaryLength } from "../../../shared/contracts.js";
|
|
8
|
+
import type { createSummaryEngine } from "../../summary-engine.js";
|
|
9
|
+
import { type CacheState } from "../../../cache.js";
|
|
10
|
+
import { type AssetAttachment } from "../../attachments.js";
|
|
10
11
|
export type AssetSummaryContext = {
|
|
11
12
|
env: Record<string, string | undefined>;
|
|
12
13
|
envForRun: Record<string, string | undefined>;
|
|
@@ -14,22 +15,26 @@ export type AssetSummaryContext = {
|
|
|
14
15
|
stderr: NodeJS.WritableStream;
|
|
15
16
|
execFileImpl: ExecFileFn;
|
|
16
17
|
timeoutMs: number;
|
|
17
|
-
preprocessMode:
|
|
18
|
-
format:
|
|
18
|
+
preprocessMode: "off" | "auto" | "always";
|
|
19
|
+
format: "text" | "markdown";
|
|
20
|
+
extractMode: boolean;
|
|
19
21
|
lengthArg: {
|
|
20
|
-
kind:
|
|
22
|
+
kind: "preset";
|
|
21
23
|
preset: SummaryLength;
|
|
22
24
|
} | {
|
|
23
|
-
kind:
|
|
25
|
+
kind: "chars";
|
|
24
26
|
maxCharacters: number;
|
|
25
27
|
};
|
|
28
|
+
forceSummary: boolean;
|
|
26
29
|
outputLanguage: OutputLanguage;
|
|
27
|
-
videoMode:
|
|
30
|
+
videoMode: "auto" | "transcript" | "understand";
|
|
28
31
|
fixedModelSpec: FixedModelSpec | null;
|
|
29
32
|
promptOverride?: string | null;
|
|
30
33
|
lengthInstruction?: string | null;
|
|
31
34
|
languageInstruction?: string | null;
|
|
32
35
|
isFallbackModel: boolean;
|
|
36
|
+
isImplicitAutoSelection: boolean;
|
|
37
|
+
allowAutoCliFallback: boolean;
|
|
33
38
|
desiredOutputTokens: number | null;
|
|
34
39
|
envForAuto: Record<string, string | undefined>;
|
|
35
40
|
configForModelSelection: SummarizeConfig | null;
|
|
@@ -53,11 +58,14 @@ export type AssetSummaryContext = {
|
|
|
53
58
|
trackedFetch: typeof fetch;
|
|
54
59
|
writeViaFooter: (parts: string[]) => void;
|
|
55
60
|
clearProgressForStdout: () => void;
|
|
56
|
-
|
|
61
|
+
restoreProgressAfterStdout?: (() => void) | null;
|
|
62
|
+
getLiteLlmCatalog: () => Promise<Awaited<ReturnType<typeof import("../../../pricing/litellm.js").loadLiteLlmCatalog>>["catalog"]>;
|
|
57
63
|
buildReport: () => Promise<RunMetricsReport>;
|
|
58
64
|
estimateCostUsd: () => Promise<number | null>;
|
|
59
65
|
llmCalls: LlmCall[];
|
|
60
66
|
cache: CacheState;
|
|
67
|
+
summaryCacheBypass: boolean;
|
|
68
|
+
mediaCache: MediaCache | null;
|
|
61
69
|
apiStatus: {
|
|
62
70
|
xaiApiKey: string | null;
|
|
63
71
|
apiKey: string | null;
|
|
@@ -77,7 +85,7 @@ export type AssetSummaryContext = {
|
|
|
77
85
|
};
|
|
78
86
|
};
|
|
79
87
|
export type SummarizeAssetArgs = {
|
|
80
|
-
sourceKind:
|
|
88
|
+
sourceKind: "file" | "asset-url";
|
|
81
89
|
sourceLabel: string;
|
|
82
90
|
attachment: AssetAttachment;
|
|
83
91
|
onModelChosen?: ((modelId: string) => void) | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractedLinkContent, FetchLinkContentOptions } from
|
|
1
|
+
import type { ExtractedLinkContent, FetchLinkContentOptions } from "../../../content/index.js";
|
|
2
2
|
export type UrlExtractionUi = {
|
|
3
3
|
contentSizeLabel: string;
|
|
4
4
|
viaSourceLabel: string;
|
|
@@ -14,9 +14,10 @@ export declare function fetchLinkContentWithBirdTip({ client, url, options, env,
|
|
|
14
14
|
env: Record<string, string | undefined>;
|
|
15
15
|
}): Promise<ExtractedLinkContent>;
|
|
16
16
|
export declare function deriveExtractionUi(extracted: ExtractedLinkContent): UrlExtractionUi;
|
|
17
|
-
export declare function logExtractionDiagnostics({ extracted, stderr, verbose, verboseColor, }: {
|
|
17
|
+
export declare function logExtractionDiagnostics({ extracted, stderr, verbose, verboseColor, env, }: {
|
|
18
18
|
extracted: ExtractedLinkContent;
|
|
19
19
|
stderr: NodeJS.WritableStream;
|
|
20
20
|
verbose: boolean;
|
|
21
21
|
verboseColor: boolean;
|
|
22
|
+
env?: Record<string, string | undefined>;
|
|
22
23
|
}): void;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type
|
|
1
|
+
import type { ModelAttempt } from "../../types.js";
|
|
2
|
+
import type { UrlFlowContext } from "./types.js";
|
|
3
|
+
import { type ConvertTranscriptToMarkdown } from "../../../llm/transcript-to-markdown.js";
|
|
4
4
|
export type MarkdownModel = {
|
|
5
5
|
llmModelId: string;
|
|
6
6
|
forceOpenRouter: boolean;
|
|
7
7
|
openaiApiKeyOverride?: string | null;
|
|
8
8
|
openaiBaseUrlOverride?: string | null;
|
|
9
9
|
forceChatCompletions?: boolean;
|
|
10
|
-
requiredEnv?: ModelAttempt[
|
|
10
|
+
requiredEnv?: ModelAttempt["requiredEnv"];
|
|
11
11
|
};
|
|
12
12
|
export type MarkdownConverters = {
|
|
13
13
|
markdownRequested: boolean;
|
|
14
14
|
transcriptMarkdownRequested: boolean;
|
|
15
|
-
effectiveMarkdownMode:
|
|
16
|
-
markdownProvider:
|
|
15
|
+
effectiveMarkdownMode: "off" | "auto" | "llm" | "readability";
|
|
16
|
+
markdownProvider: "none" | "xai" | "openai" | "google" | "anthropic" | "zai";
|
|
17
17
|
markdownModel: MarkdownModel | null;
|
|
18
18
|
convertHtmlToMarkdown: ((args: {
|
|
19
19
|
url: string;
|