@steipete/summarize 0.1.0 → 0.1.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 +12 -0
- package/dist/cli.cjs +48 -9
- package/dist/cli.cjs.map +3 -3
- package/dist/esm/content/asset.js +42 -2
- package/dist/esm/content/asset.js.map +1 -1
- package/dist/esm/run.js +20 -6
- package/dist/esm/run.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/version.d.ts +1 -1
- package/docs/site/404.html +1 -1
- package/docs/site/assets/site.css +1 -1
- package/docs/site/docs/config.html +1 -1
- package/docs/site/docs/extract-only.html +1 -1
- package/docs/site/docs/firecrawl.html +1 -1
- package/docs/site/docs/index.html +1 -1
- package/docs/site/docs/llm.html +1 -1
- package/docs/site/docs/openai.html +1 -1
- package/docs/site/docs/website.html +1 -1
- package/docs/site/docs/youtube.html +1 -1
- package/docs/site/index.html +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.1.2 - 2025-12-20
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
- Avoid duplicate streamed output when providers emit cumulative chunks instead of deltas.
|
|
10
|
+
|
|
11
|
+
## 0.1.1 - 2025-12-19
|
|
12
|
+
|
|
13
|
+
### Fixes
|
|
14
|
+
|
|
15
|
+
- Accept common “pasted URL” patterns like `url (canonical)` and clean up accidental `\\?` / `\\=` / `%5C` before query separators.
|
|
16
|
+
|
|
5
17
|
## 0.1.0 - 2025-12-19
|
|
6
18
|
|
|
7
19
|
First public release.
|
package/dist/cli.cjs
CHANGED
|
@@ -66598,6 +66598,22 @@ var src_default = new Mime_default(standard_default, other_default)._freeze();
|
|
|
66598
66598
|
|
|
66599
66599
|
// src/content/asset.ts
|
|
66600
66600
|
var MAX_ASSET_BYTES_DEFAULT = 50 * 1024 * 1024;
|
|
66601
|
+
function normalizeUrlInput(raw) {
|
|
66602
|
+
return raw.replaceAll(/\\([?&=])/g, "$1").replaceAll(/%5c(?=[?&=])/gi, "");
|
|
66603
|
+
}
|
|
66604
|
+
function trimLikelyUrlPunctuation(raw) {
|
|
66605
|
+
let value = raw.trim();
|
|
66606
|
+
while (value.length > 0 && /[)\].,;:'">}”’»]/.test(value[value.length - 1] ?? "")) {
|
|
66607
|
+
value = value.slice(0, -1);
|
|
66608
|
+
}
|
|
66609
|
+
while (value.length > 0 && /^[('"<{[\]“‘«]/.test(value[0] ?? "")) {
|
|
66610
|
+
value = value.slice(1);
|
|
66611
|
+
}
|
|
66612
|
+
return value;
|
|
66613
|
+
}
|
|
66614
|
+
function extractHttpUrlsFromText(raw) {
|
|
66615
|
+
return [...raw.matchAll(/https?:\/\/\S+/g)].map((match) => trimLikelyUrlPunctuation(match[0] ?? "")).filter((candidate) => candidate.length > 0);
|
|
66616
|
+
}
|
|
66601
66617
|
function normalizeHeaderMediaType(value) {
|
|
66602
66618
|
if (!value) return null;
|
|
66603
66619
|
const trimmed = value.trim();
|
|
@@ -66629,9 +66645,22 @@ function resolveInputTarget(raw) {
|
|
|
66629
66645
|
if ((0, import_node_fs2.existsSync)(asPath)) {
|
|
66630
66646
|
return { kind: "file", filePath: asPath };
|
|
66631
66647
|
}
|
|
66648
|
+
const extractedUrls = extractHttpUrlsFromText(normalized);
|
|
66649
|
+
const extractedLast = extractedUrls.at(-1) ?? null;
|
|
66650
|
+
if (extractedLast && extractedLast !== normalized) {
|
|
66651
|
+
for (let i = extractedUrls.length - 1; i >= 0; i -= 1) {
|
|
66652
|
+
const candidate = extractedUrls[i];
|
|
66653
|
+
if (!candidate) continue;
|
|
66654
|
+
try {
|
|
66655
|
+
return resolveInputTarget(candidate);
|
|
66656
|
+
} catch {
|
|
66657
|
+
}
|
|
66658
|
+
}
|
|
66659
|
+
}
|
|
66632
66660
|
let parsed;
|
|
66661
|
+
const normalizedUrlInput = normalizeUrlInput(normalized);
|
|
66633
66662
|
try {
|
|
66634
|
-
parsed = new URL(
|
|
66663
|
+
parsed = new URL(normalizedUrlInput);
|
|
66635
66664
|
} catch {
|
|
66636
66665
|
throw new Error(`Invalid URL or file path: ${raw}`);
|
|
66637
66666
|
}
|
|
@@ -66651,7 +66680,7 @@ function resolveInputTarget(raw) {
|
|
|
66651
66680
|
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
66652
66681
|
throw new Error("Only HTTP and HTTPS URLs can be summarized");
|
|
66653
66682
|
}
|
|
66654
|
-
return { kind: "url", url:
|
|
66683
|
+
return { kind: "url", url: normalizedUrlInput };
|
|
66655
66684
|
}
|
|
66656
66685
|
async function classifyUrl({
|
|
66657
66686
|
url: url2,
|
|
@@ -72499,7 +72528,7 @@ function startSpinner({
|
|
|
72499
72528
|
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
72500
72529
|
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
72501
72530
|
var import_node_url = require("node:url");
|
|
72502
|
-
var FALLBACK_VERSION = "0.1.
|
|
72531
|
+
var FALLBACK_VERSION = "0.1.2";
|
|
72503
72532
|
function resolvePackageVersion(importMetaUrl) {
|
|
72504
72533
|
const injected = typeof process !== "undefined" && typeof process.env.SUMMARIZE_VERSION === "string" ? process.env.SUMMARIZE_VERSION.trim() : "";
|
|
72505
72534
|
if (injected.length > 0) return injected;
|
|
@@ -72856,6 +72885,13 @@ function formatUSD(value) {
|
|
|
72856
72885
|
if (!Number.isFinite(value)) return "n/a";
|
|
72857
72886
|
return `$${value.toFixed(4)}`;
|
|
72858
72887
|
}
|
|
72888
|
+
function mergeStreamingChunk(previous3, chunk) {
|
|
72889
|
+
if (!chunk) return { next: previous3, appended: "" };
|
|
72890
|
+
if (chunk.startsWith(previous3)) {
|
|
72891
|
+
return { next: chunk, appended: chunk.slice(previous3.length) };
|
|
72892
|
+
}
|
|
72893
|
+
return { next: previous3 + chunk, appended: chunk };
|
|
72894
|
+
}
|
|
72859
72895
|
function writeFinishLine({
|
|
72860
72896
|
stderr,
|
|
72861
72897
|
elapsedMs,
|
|
@@ -73217,9 +73253,10 @@ async function runCli(argv, { env: env3, fetch: fetch2, stdout, stderr }) {
|
|
|
73217
73253
|
clearProgressForStdout();
|
|
73218
73254
|
cleared = true;
|
|
73219
73255
|
}
|
|
73220
|
-
streamed
|
|
73256
|
+
const merged = mergeStreamingChunk(streamed, delta);
|
|
73257
|
+
streamed = merged.next;
|
|
73221
73258
|
if (shouldStreamSummaryToStdout) {
|
|
73222
|
-
stdout.write(
|
|
73259
|
+
if (merged.appended) stdout.write(merged.appended);
|
|
73223
73260
|
continue;
|
|
73224
73261
|
}
|
|
73225
73262
|
if (liveRenderer) {
|
|
@@ -73880,13 +73917,14 @@ async function runCli(argv, { env: env3, fetch: fetch2, stdout, stderr }) {
|
|
|
73880
73917
|
try {
|
|
73881
73918
|
let cleared = false;
|
|
73882
73919
|
for await (const delta of streamResult.textStream) {
|
|
73883
|
-
streamed
|
|
73920
|
+
const merged = mergeStreamingChunk(streamed, delta);
|
|
73921
|
+
streamed = merged.next;
|
|
73884
73922
|
if (shouldStreamSummaryToStdout) {
|
|
73885
73923
|
if (!cleared) {
|
|
73886
73924
|
clearProgressForStdout();
|
|
73887
73925
|
cleared = true;
|
|
73888
73926
|
}
|
|
73889
|
-
stdout.write(
|
|
73927
|
+
if (merged.appended) stdout.write(merged.appended);
|
|
73890
73928
|
continue;
|
|
73891
73929
|
}
|
|
73892
73930
|
if (liveRenderer) {
|
|
@@ -74071,9 +74109,10 @@ ${chunkNotes.filter((value) => value.length > 0).join("\n\n")}`;
|
|
|
74071
74109
|
clearProgressForStdout();
|
|
74072
74110
|
cleared = true;
|
|
74073
74111
|
}
|
|
74074
|
-
streamed
|
|
74112
|
+
const merged = mergeStreamingChunk(streamed, delta);
|
|
74113
|
+
streamed = merged.next;
|
|
74075
74114
|
if (shouldStreamSummaryToStdout) {
|
|
74076
|
-
stdout.write(
|
|
74115
|
+
if (merged.appended) stdout.write(merged.appended);
|
|
74077
74116
|
continue;
|
|
74078
74117
|
}
|
|
74079
74118
|
if (liveRenderer) {
|