ceulen 0.12.0 → 0.13.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 +49 -0
- package/extensions/lib/registry.ts +15 -1
- package/extensions/modules/composer/test/module.test.ts +2 -2
- package/extensions/modules/config/test/renderTools.test.ts +1 -1
- package/extensions/modules/jfind/index.ts +115 -0
- package/extensions/modules/jfind/lib/cascade.ts +377 -0
- package/extensions/modules/jfind/lib/format.ts +12 -0
- package/extensions/modules/jfind/lib/judge.ts +74 -0
- package/extensions/modules/jfind/lib/lexical.ts +232 -0
- package/extensions/modules/jfind/lib/questions.ts +178 -0
- package/extensions/modules/jfind/lib/tree.ts +374 -0
- package/extensions/modules/jfind/test/cascade.test.ts +305 -0
- package/extensions/modules/notify/index.ts +33 -0
- package/extensions/modules/notify/lib/notify.ts +99 -0
- package/extensions/modules/notify/test/notify.test.ts +95 -0
- package/extensions/modules/plan/lib/plan-tools.ts +13 -0
- package/extensions/modules/repair/configPanel.ts +7 -1
- package/extensions/modules/repair/index.ts +132 -1
- package/extensions/modules/repair/lib/auto-generated.ts +89 -0
- package/extensions/modules/repair/lib/read-archive.ts +101 -0
- package/extensions/modules/repair/lib/read-sqlite.ts +185 -0
- package/extensions/modules/repair/lib/settings.ts +4 -1
- package/extensions/modules/repair/test/readers.test.ts +291 -0
- package/extensions/modules/repair/test/settings.test.ts +2 -1
- package/extensions/modules/sg/index.ts +129 -0
- package/extensions/modules/sg/lib/ops.ts +144 -0
- package/extensions/modules/sg/lib/sg-cli.ts +104 -0
- package/extensions/modules/sg/test/sg.test.ts +128 -0
- package/extensions/modules/shells/index.ts +210 -0
- package/extensions/modules/shells/lib/sessions.ts +344 -0
- package/extensions/modules/shells/test/sessions.test.ts +275 -0
- package/extensions/modules/web/index.ts +34 -0
- package/extensions/modules/web/lib/pdf.ts +181 -0
- package/extensions/modules/web/test/extension.test.ts +2 -1
- package/extensions/modules/web/vendor/pdfjs/LICENSE +177 -0
- package/extensions/modules/web/vendor/pdfjs/README.md +16 -0
- package/extensions/modules/web/vendor/pdfjs/pdf.min.mjs +21 -0
- package/extensions/modules/web/vendor/pdfjs/pdf.worker.mjs +21 -0
- package/package.json +3 -3
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// read_pdf — local PDF text extraction via the vendored pdf.js build.
|
|
2
|
+
//
|
|
3
|
+
// ponytail: the plan's CDP-viewer path was live-probed and is DEAD — headless
|
|
4
|
+
// Chrome renders file:// PDFs as a blank frame (out-of-process viewer never
|
|
5
|
+
// paints) and --virtual-time-budget hangs outright (2026-10-06). The honest
|
|
6
|
+
// text-only shape is the vendored pdf.js engine (vendor/pdfjs/README): zero
|
|
7
|
+
// deps, zero external binaries, workerless. Page IMAGES are out of scope —
|
|
8
|
+
// scanned PDFs come back as "no extractable text" with that explanation.
|
|
9
|
+
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
|
|
14
|
+
// ── Shapes ──────────────────────────────────────────────────────────────────
|
|
15
|
+
|
|
16
|
+
export interface PdfPageText {
|
|
17
|
+
page: number;
|
|
18
|
+
lines: string[];
|
|
19
|
+
chars: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface PdfReadResult {
|
|
23
|
+
path: string;
|
|
24
|
+
totalPages: number;
|
|
25
|
+
pages: PdfPageText[];
|
|
26
|
+
/** Pages where text extraction found nothing (scanned/image PDFs). */
|
|
27
|
+
emptyPages: number[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ReadPdfOpts {
|
|
31
|
+
path: string;
|
|
32
|
+
/** 1-based pages to extract, pre-validated by the caller. */
|
|
33
|
+
pages: number[];
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
/** Test seam — swap the vendored engine. */
|
|
36
|
+
engine?: PdfEngine;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The slice of the pdf.js API the tool uses. */
|
|
40
|
+
export interface PdfEngine {
|
|
41
|
+
getDocument(src: { data: Uint8Array; verbosity?: number }): { promise: Promise<PdfDocument> };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface PdfDocument {
|
|
45
|
+
numPages: number;
|
|
46
|
+
getPage(n: number): Promise<PdfPage>;
|
|
47
|
+
destroy?(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface PdfPage {
|
|
51
|
+
getTextContent(): Promise<{ items: Array<{ str?: string; transform?: number[] }> }>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ── Engine load (lazy — never on the entry import graph, vendor/axe rule) ──
|
|
55
|
+
|
|
56
|
+
let cachedEngine: PdfEngine | undefined;
|
|
57
|
+
|
|
58
|
+
export async function loadPdfEngine(): Promise<PdfEngine> {
|
|
59
|
+
if (cachedEngine) return cachedEngine;
|
|
60
|
+
// fileURLToPath(import.meta.url) → lib/pdf.ts; vendor sits at ../vendor.
|
|
61
|
+
const file = path.join(path.dirname(fileURLToPath(import.meta.url)), "../vendor/pdfjs/pdf.min.mjs");
|
|
62
|
+
// Lazily dynamic-import the vendored module by FILE URL so the bundler /
|
|
63
|
+
// typechecker never sees a static dependency.
|
|
64
|
+
const mod = (await import(`file://${file}`)) as PdfEngine & Record<string, unknown>;
|
|
65
|
+
cachedEngine = mod;
|
|
66
|
+
return mod;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Test hook: forget the cached engine (module state outlives a test). */
|
|
70
|
+
export function resetPdfEngineCache(): void {
|
|
71
|
+
cachedEngine = undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ── Page text ───────────────────────────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Reconstruct reading-order lines from pdf.js text items: group by rounded
|
|
78
|
+
* baseline y (desc order — PDF y grows upward), then sort runs by x within a
|
|
79
|
+
* line. Exported for tests.
|
|
80
|
+
*/
|
|
81
|
+
export function itemsToLines(items: Array<{ str?: string; transform?: number[] }>): string[] {
|
|
82
|
+
const lines = new Map<number, Array<{ x: number; s: string }>>();
|
|
83
|
+
for (const item of items) {
|
|
84
|
+
if (!item.str) continue;
|
|
85
|
+
const t = item.transform;
|
|
86
|
+
if (!t) continue;
|
|
87
|
+
const y = Math.round(t[5]!);
|
|
88
|
+
if (!lines.has(y)) lines.set(y, []);
|
|
89
|
+
lines.get(y)!.push({ x: t[4]!, s: item.str });
|
|
90
|
+
}
|
|
91
|
+
return [...lines.entries()]
|
|
92
|
+
.sort((a, b) => b[0] - a[0])
|
|
93
|
+
.map(([, parts]) =>
|
|
94
|
+
parts
|
|
95
|
+
.sort((p, q) => p.x - q.x)
|
|
96
|
+
.map((p) => p.s)
|
|
97
|
+
.join(" ")
|
|
98
|
+
.replace(/ +/g, " ")
|
|
99
|
+
.trim(),
|
|
100
|
+
)
|
|
101
|
+
.filter((l) => l.length > 0);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Extract text for the requested pages. One engine instantiation per call. */
|
|
105
|
+
export async function readPdfText(opts: ReadPdfOpts): Promise<PdfReadResult> {
|
|
106
|
+
const engine = opts.engine ?? (await loadPdfEngine());
|
|
107
|
+
const data = new Uint8Array(readFileSync(opts.path));
|
|
108
|
+
// verbosity 0 (ERRORS) silences the benign canvas/DOMMatrix polyfill
|
|
109
|
+
// warnings the legacy build prints on Node (text extraction needs none of
|
|
110
|
+
// them — those gates only matter for page RENDERING, which we don't do).
|
|
111
|
+
const doc = await engine.getDocument({ data, verbosity: 0 }).promise;
|
|
112
|
+
try {
|
|
113
|
+
const pages: PdfPageText[] = [];
|
|
114
|
+
const emptyPages: number[] = [];
|
|
115
|
+
for (const n of opts.pages) {
|
|
116
|
+
if (n < 1 || n > doc.numPages) throw new Error(`page ${n} out of range (1-${doc.numPages})`);
|
|
117
|
+
if (opts.signal?.aborted) throw new Error("read_pdf aborted");
|
|
118
|
+
const page = await doc.getPage(n);
|
|
119
|
+
const tc = await page.getTextContent();
|
|
120
|
+
const lines = itemsToLines(tc.items);
|
|
121
|
+
const chars = lines.reduce((a, l) => a + l.length, 0);
|
|
122
|
+
pages.push({ page: n, lines, chars });
|
|
123
|
+
if (chars === 0) emptyPages.push(n);
|
|
124
|
+
}
|
|
125
|
+
return { path: opts.path, totalPages: doc.numPages, pages, emptyPages };
|
|
126
|
+
} finally {
|
|
127
|
+
await doc.destroy?.().catch(() => {});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ── Formatting ──────────────────────────────────────────────────────────────
|
|
132
|
+
|
|
133
|
+
const MAX_CHARS_PER_PAGE = 16_000;
|
|
134
|
+
|
|
135
|
+
/** Model-facing text. Exported for tests. */
|
|
136
|
+
export function formatPdfText(result: PdfReadResult): string {
|
|
137
|
+
const lines = [`${result.path} — ${result.totalPages} page(s), showing ${result.pages.length}`];
|
|
138
|
+
for (const page of result.pages) {
|
|
139
|
+
lines.push("", `── page ${page.page} ──`);
|
|
140
|
+
let budget = MAX_CHARS_PER_PAGE;
|
|
141
|
+
for (const l of page.lines) {
|
|
142
|
+
if (budget <= 0) {
|
|
143
|
+
lines.push(`[… page ${page.page} truncated at ${MAX_CHARS_PER_PAGE} chars …]`);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
const slice = l.length > budget ? l.slice(0, budget) : l;
|
|
147
|
+
lines.push(slice);
|
|
148
|
+
budget -= slice.length + 1;
|
|
149
|
+
}
|
|
150
|
+
if (page.chars === 0) lines.push("(no extractable text — likely a scanned/image page)");
|
|
151
|
+
}
|
|
152
|
+
if (result.emptyPages.length > 0) {
|
|
153
|
+
lines.push(`[empty pages: ${result.emptyPages.join(", ")}]`);
|
|
154
|
+
}
|
|
155
|
+
return lines.join("\n");
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Parse a `pages` param: "3" | "1-5" | "2,4,6-8" → 1-based list (cap 10,
|
|
159
|
+
* caller-enforced). Exported for tests. */
|
|
160
|
+
export function parsePagesParam(raw: string | undefined, totalPages: number): number[] {
|
|
161
|
+
if (!raw || !raw.trim()) {
|
|
162
|
+
return Array.from({ length: Math.min(5, totalPages) }, (_, i) => i + 1);
|
|
163
|
+
}
|
|
164
|
+
const out: number[] = [];
|
|
165
|
+
for (const part of raw.split(",")) {
|
|
166
|
+
const p = part.trim();
|
|
167
|
+
const range = /^(\d+)-(\d+)$/.exec(p);
|
|
168
|
+
if (range) {
|
|
169
|
+
const a = Number(range[1]);
|
|
170
|
+
const b = Number(range[2]);
|
|
171
|
+
for (let n = a; n <= b; n++) out.push(n);
|
|
172
|
+
} else if (/^\d+$/.test(p)) {
|
|
173
|
+
out.push(Number(p));
|
|
174
|
+
} else {
|
|
175
|
+
throw new Error(`invalid pages spec "${part}" — use "3", "1-5", or "2,4,6-8"`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const unique = [...new Set(out)].filter((n) => n >= 1 && n <= totalPages);
|
|
179
|
+
if (unique.length === 0) throw new Error(`no valid pages in "${raw}" (document has ${totalPages} page(s))`);
|
|
180
|
+
return unique.slice(0, 10);
|
|
181
|
+
}
|
|
@@ -13,6 +13,7 @@ import webExtension from "../index";
|
|
|
13
13
|
const ALL_TOOLS = [
|
|
14
14
|
"web_search", "web_extract", "web_map", "web_crawl", "web_screenshot", "web_pdf",
|
|
15
15
|
"web_interact", "web_research", "web_image", "web_chat", "web_status", "web_a11y",
|
|
16
|
+
"read_pdf",
|
|
16
17
|
];
|
|
17
18
|
|
|
18
19
|
function harness(opts: { disabledTools?: string[]; activeTools?: string[] } = {}) {
|
|
@@ -71,7 +72,7 @@ describe("web module ceulen contract", () => {
|
|
|
71
72
|
else process.env.PI_CODING_AGENT_DIR = oldAgentDir;
|
|
72
73
|
});
|
|
73
74
|
|
|
74
|
-
it("registers exactly the
|
|
75
|
+
it("registers exactly the thirteen web tools (12 web_* + read_pdf)", () => {
|
|
75
76
|
const { tools } = harness();
|
|
76
77
|
assert.deepEqual(Object.keys(tools).sort(), [...ALL_TOOLS].sort());
|
|
77
78
|
});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# vendor/pdfjs — pdf.js (pdfjs-dist) legacy build
|
|
2
|
+
|
|
3
|
+
`pdf.min.mjs` is the **unmodified** minified legacy ESM build from the npm
|
|
4
|
+
package `pdfjs-dist@4.10.38` (Apache-2.0; see `LICENSE`). Vendored per the
|
|
5
|
+
bundle's no-runtime-dependency rule (the vendor/axe precedent) so `read_pdf`
|
|
6
|
+
can extract PDF text locally without a poppler/pdftotext install — the CDP
|
|
7
|
+
viewer path renders blank in headless Chrome and `--virtual-time-budget`
|
|
8
|
+
hangs (live-probed 2026-10-06), so an in-process text engine is the only
|
|
9
|
+
reliable route.
|
|
10
|
+
|
|
11
|
+
- Source: https://github.com/mozilla/pdf.js (npm: pdfjs-dist)
|
|
12
|
+
- Pinned: 4.10.38, `legacy/build/pdf.min.mjs`
|
|
13
|
+
- Loaded LAZY (`fs.readFileSync` at first read_pdf call) — never on the
|
|
14
|
+
entry import graph, same contract as vendor/axe.
|
|
15
|
+
- Runs WORKERLESS (no `pdf.worker` import; the legacy build degrades to
|
|
16
|
+
in-thread parsing when no worker is wired — verified against a real PDF).
|