llm-large-files 0.3.5 → 0.4.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 +74 -0
- package/dist/cache.d.ts +40 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +81 -0
- package/dist/cache.js.map +1 -0
- package/dist/extract.d.ts +1 -1
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +204 -22
- package/dist/extract.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/library.d.ts +28 -1
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +155 -47
- package/dist/library.js.map +1 -1
- package/dist/limiter.d.ts +20 -0
- package/dist/limiter.d.ts.map +1 -0
- package/dist/limiter.js +55 -0
- package/dist/limiter.js.map +1 -0
- package/dist/map-reduce.d.ts +8 -4
- package/dist/map-reduce.d.ts.map +1 -1
- package/dist/map-reduce.js +65 -24
- package/dist/map-reduce.js.map +1 -1
- package/dist/node/handlers.d.ts +9 -0
- package/dist/node/handlers.d.ts.map +1 -1
- package/dist/node/handlers.js +56 -13
- package/dist/node/handlers.js.map +1 -1
- package/dist/pdf-pictures.d.ts.map +1 -1
- package/dist/pdf-pictures.js +52 -9
- package/dist/pdf-pictures.js.map +1 -1
- package/dist/plan.d.ts +7 -5
- package/dist/plan.d.ts.map +1 -1
- package/dist/plan.js +9 -8
- package/dist/plan.js.map +1 -1
- package/dist/ranged.d.ts +102 -0
- package/dist/ranged.d.ts.map +1 -0
- package/dist/ranged.js +314 -0
- package/dist/ranged.js.map +1 -0
- package/dist/search.d.ts +79 -15
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +388 -130
- package/dist/search.js.map +1 -1
- package/dist/stores.d.ts +22 -2
- package/dist/stores.d.ts.map +1 -1
- package/dist/stores.js +132 -15
- package/dist/stores.js.map +1 -1
- package/dist/text-index.d.ts +64 -0
- package/dist/text-index.d.ts.map +1 -0
- package/dist/text-index.js +211 -0
- package/dist/text-index.js.map +1 -0
- package/dist/text.d.ts +2 -1
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +13 -4
- package/dist/text.js.map +1 -1
- package/dist/tools.d.ts +2 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +20 -14
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/api.md +21 -5
- package/docs/configuration.md +50 -4
- package/docs/getting-started.md +3 -1
- package/docs/how-it-works.md +3 -1
- package/docs/security.md +8 -0
- package/package.json +7 -3
- package/src/cache.ts +83 -0
- package/src/extract.ts +198 -19
- package/src/index.ts +1 -1
- package/src/library.ts +176 -44
- package/src/limiter.ts +51 -0
- package/src/map-reduce.ts +70 -25
- package/src/node/handlers.ts +61 -9
- package/src/pdf-pictures.ts +60 -10
- package/src/plan.ts +10 -9
- package/src/ranged.ts +348 -0
- package/src/search.ts +432 -120
- package/src/stores.ts +136 -17
- package/src/text-index.ts +228 -0
- package/src/text.ts +13 -4
- package/src/tools.ts +22 -16
- package/src/types.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,80 @@ All notable changes to this package are recorded here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
5
5
|
[semantic versioning](https://semver.org).
|
|
6
6
|
|
|
7
|
+
## [0.4.0] - 2026-11-12
|
|
8
|
+
|
|
9
|
+
Nothing to change in your code: the API, the tools and their results are those of 0.3.6 (compared
|
|
10
|
+
call by call). Servers of 0.3.x and 0.4.0 can share a `FileDocumentStore` during a rolling update;
|
|
11
|
+
0.3.x servers ignore the new index files. The delete fix below holds once every server runs 0.4.0.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **A document deleted on one server is no longer served by another.** Servers sharing a store
|
|
16
|
+
kept a document in memory and answered from it until it expired, up to 72 hours after a delete.
|
|
17
|
+
Every use of a kept document now asks the store first (`getMeta`, about a millisecond).
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **The memory cache is bounded in bytes** (`cacheBytes`, default 256 MB), not in documents. Six
|
|
22
|
+
documents of 50 MB took over 600 MB before. `cacheSize` still caps the number when given. Calls
|
|
23
|
+
that arrive together for a document that is not in memory open it once.
|
|
24
|
+
- **Large documents are read by range on a store that can** (`FileDocumentStore`, or your own with
|
|
25
|
+
`readTextRange`): a tool call reads the lines it needs, and a search reads the text 1 MB at a time,
|
|
26
|
+
so memory no longer grows with file size and the number of users. Documents up to
|
|
27
|
+
`wholeDocumentBytes` (2 MB) are loaded whole as before. Results are the same.
|
|
28
|
+
- `FileDocumentStore` writes every file whole (to a temporary name, then renamed), and `sweep` no
|
|
29
|
+
longer deletes a document whose metadata cannot be read unless that file is an hour old: on a
|
|
30
|
+
shared volume it may be an upload in progress.
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- A line index per document (`<id>.idx` in `FileDocumentStore`, a few bytes a line), written at
|
|
35
|
+
ingest. Documents from older versions get one the first time they are used.
|
|
36
|
+
- `DocumentStore.readTextRange`, `putIndex` and `getIndex`: optional, for stores of your own.
|
|
37
|
+
- `sweep` removes files that belong to no document, and temporary files, once they are an hour old
|
|
38
|
+
(`orphanAgeMs`).
|
|
39
|
+
- Options `wholeDocumentBytes`, `scanChunkBytes` and `maxConcurrentScans` (at most 4 searches of
|
|
40
|
+
large documents at once per process; the others wait, and those of the same document share one
|
|
41
|
+
pass over it). Decoded pieces of documents in use are kept within `cacheBytes`.
|
|
42
|
+
- `get_document_overview` works out the number of parts of a file once per document, not on every call.
|
|
43
|
+
|
|
44
|
+
## [0.3.6] - 2026-11-11
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- **A terminal escape without an end no longer deletes the rest of a file.** An `ESC ]` whose end
|
|
49
|
+
(BEL, or `ESC \`) was not on its line removed everything up to the next escape, or to the end of
|
|
50
|
+
the file: a log of 10,000 lines whose third line held a logged user agent `ua="evil␛]"` was
|
|
51
|
+
stored as 3 lines, with no error. Now only those two characters go. The escapes that save and
|
|
52
|
+
restore the cursor (`ESC 7`, `ESC 8`) and the like no longer leave a character behind.
|
|
53
|
+
- **DOCX and PPTX files are read in one pass, a piece at a time.** The paragraph pattern scanned
|
|
54
|
+
to the end of the file from every paragraph that was not closed: a DOCX of 900 bytes held the
|
|
55
|
+
server for 8 seconds, and one of 10 KB would have held it for an hour. The new reader looks at
|
|
56
|
+
each character once. It also:
|
|
57
|
+
- refuses a file that unpacks to more than 100 times its size (past the first 16 MB) or to more
|
|
58
|
+
than 128 MB of XML, as it unpacks, before that much is in memory. A DOCX of 160 KB that unpacked
|
|
59
|
+
to 50 MB of XML was stored as 29 million characters; it is now refused at 16 MB, in 0.2 s;
|
|
60
|
+
- reads a text box once, after the paragraph it is anchored in. Word writes each text box twice,
|
|
61
|
+
and the paragraph it was anchored in lost its text after the box: a resume template lost its
|
|
62
|
+
"Objective" heading;
|
|
63
|
+
- no longer takes the tab stops of a paragraph for tabs, and reads PowerPoint's line breaks
|
|
64
|
+
(`<a:br>` with its run properties inside), which were lost.
|
|
65
|
+
- **Picture marks: forms painted inside forms cannot hold the server.** A form was read again each
|
|
66
|
+
time it was painted, and the time limit was checked only between pages: a PDF of 3 KB whose
|
|
67
|
+
forms each paint the next one 30 times ran the process out of memory. Now each form is decoded
|
|
68
|
+
once per file, a page that paints more than 20,000 images or makes the reader go through more
|
|
69
|
+
than 16 MB of content is marked as a drawing at once, and the time limit holds within a page.
|
|
70
|
+
Such a file is now read in 0.6 s.
|
|
71
|
+
- **`llm-large-files/node`: `get` and `remove` answer their errors.** A `getOwner` that threw, or a
|
|
72
|
+
store call that failed, rejected the handler's promise, which ends a Node process that has no
|
|
73
|
+
handler for it (Express 4, plain `node:http`). All three handlers now answer every error
|
|
74
|
+
themselves:
|
|
75
|
+
- an error with a `status` between 400 and 599, as `getOwner` can now throw to refuse a request,
|
|
76
|
+
is answered with that status and its message;
|
|
77
|
+
- a store that fails is a 500 that gives the error's code (`Upload failed (ENOSPC).`). It was a
|
|
78
|
+
422 with the error's message, which named the server's paths;
|
|
79
|
+
- `getOwner` runs before the upload is read, so a refused upload is not buffered.
|
|
80
|
+
|
|
7
81
|
## [0.3.5] - 2026-11-11
|
|
8
82
|
|
|
9
83
|
### Added
|
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DocumentMeta } from "./types.js";
|
|
2
|
+
/** Something the cache can hold: it says how much memory it takes. */
|
|
3
|
+
export type Sized = {
|
|
4
|
+
readonly memoryBytes: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* What identifies the contents of a document. A document ID is never reused, but a store can be
|
|
8
|
+
* restored from a backup or written by another program: a cached copy is used only while the
|
|
9
|
+
* store still describes the same text.
|
|
10
|
+
*/
|
|
11
|
+
export declare function documentVersion(meta: DocumentMeta): string;
|
|
12
|
+
/**
|
|
13
|
+
* Documents ready to read and search, kept between tool calls, the least recently used dropped
|
|
14
|
+
* first. Bounded by the memory the documents take, not by their number: six small files and
|
|
15
|
+
* six 50 MB files are not the same load.
|
|
16
|
+
*
|
|
17
|
+
* The cache never decides whether a document still exists. The caller asks the store first,
|
|
18
|
+
* every time (see `createLargeFiles`), so a document deleted or expired on another server is
|
|
19
|
+
* not served from here.
|
|
20
|
+
*/
|
|
21
|
+
export declare class DocumentCache<T extends Sized> {
|
|
22
|
+
private readonly maxBytes;
|
|
23
|
+
/** An optional cap on the number of documents too (the `cacheSize` of 0.3.x). */
|
|
24
|
+
private readonly maxEntries;
|
|
25
|
+
private readonly entries;
|
|
26
|
+
private total;
|
|
27
|
+
constructor(maxBytes: number,
|
|
28
|
+
/** An optional cap on the number of documents too (the `cacheSize` of 0.3.x). */
|
|
29
|
+
maxEntries?: number);
|
|
30
|
+
/** Memory taken by the cached documents, by their own estimate. */
|
|
31
|
+
get bytes(): number;
|
|
32
|
+
get size(): number;
|
|
33
|
+
get(id: string, version: string): T | undefined;
|
|
34
|
+
/** Keeps a document. One larger than the whole cache is not kept: it is used for this call only. */
|
|
35
|
+
set(id: string, version: string, value: T): void;
|
|
36
|
+
delete(id: string): void;
|
|
37
|
+
/** Drops every entry whose key starts with `prefix`: all the pieces of one document. */
|
|
38
|
+
deletePrefix(prefix: string): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,sEAAsE;AACtE,MAAM,MAAM,KAAK,GAAG;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAE1D;AAED;;;;;;;;GAQG;AACH,qBAAa,aAAa,CAAC,CAAC,SAAS,KAAK;IAKtC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAC,UAAU;IAN7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmE;IAC3F,OAAO,CAAC,KAAK,CAAK;gBAGC,QAAQ,EAAE,MAAM;IACjC,iFAAiF;IAChE,UAAU,SAA2B;IAGxD,mEAAmE;IACnE,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAa/C,oGAAoG;IACpG,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAehD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAOxB,wFAAwF;IACxF,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAGnC"}
|
package/dist/cache.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What identifies the contents of a document. A document ID is never reused, but a store can be
|
|
3
|
+
* restored from a backup or written by another program: a cached copy is used only while the
|
|
4
|
+
* store still describes the same text.
|
|
5
|
+
*/
|
|
6
|
+
export function documentVersion(meta) {
|
|
7
|
+
return `${meta.createdAt}|${meta.textBytes}|${meta.characters}|${meta.lines}`;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Documents ready to read and search, kept between tool calls, the least recently used dropped
|
|
11
|
+
* first. Bounded by the memory the documents take, not by their number: six small files and
|
|
12
|
+
* six 50 MB files are not the same load.
|
|
13
|
+
*
|
|
14
|
+
* The cache never decides whether a document still exists. The caller asks the store first,
|
|
15
|
+
* every time (see `createLargeFiles`), so a document deleted or expired on another server is
|
|
16
|
+
* not served from here.
|
|
17
|
+
*/
|
|
18
|
+
export class DocumentCache {
|
|
19
|
+
maxBytes;
|
|
20
|
+
maxEntries;
|
|
21
|
+
entries = new Map();
|
|
22
|
+
total = 0;
|
|
23
|
+
constructor(maxBytes,
|
|
24
|
+
/** An optional cap on the number of documents too (the `cacheSize` of 0.3.x). */
|
|
25
|
+
maxEntries = Number.POSITIVE_INFINITY) {
|
|
26
|
+
this.maxBytes = maxBytes;
|
|
27
|
+
this.maxEntries = maxEntries;
|
|
28
|
+
}
|
|
29
|
+
/** Memory taken by the cached documents, by their own estimate. */
|
|
30
|
+
get bytes() {
|
|
31
|
+
return this.total;
|
|
32
|
+
}
|
|
33
|
+
get size() {
|
|
34
|
+
return this.entries.size;
|
|
35
|
+
}
|
|
36
|
+
get(id, version) {
|
|
37
|
+
const entry = this.entries.get(id);
|
|
38
|
+
if (!entry)
|
|
39
|
+
return undefined;
|
|
40
|
+
if (entry.version !== version) {
|
|
41
|
+
this.delete(id);
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
// Most recently used last.
|
|
45
|
+
this.entries.delete(id);
|
|
46
|
+
this.entries.set(id, entry);
|
|
47
|
+
return entry.value;
|
|
48
|
+
}
|
|
49
|
+
/** Keeps a document. One larger than the whole cache is not kept: it is used for this call only. */
|
|
50
|
+
set(id, version, value) {
|
|
51
|
+
const existing = this.entries.get(id);
|
|
52
|
+
if (existing?.value === value && existing.version === version)
|
|
53
|
+
return;
|
|
54
|
+
this.delete(id);
|
|
55
|
+
const bytes = Math.max(0, value.memoryBytes);
|
|
56
|
+
if (bytes > this.maxBytes || this.maxEntries < 1)
|
|
57
|
+
return;
|
|
58
|
+
this.entries.set(id, { version, value, bytes });
|
|
59
|
+
this.total += bytes;
|
|
60
|
+
for (const [oldest, entry] of this.entries) {
|
|
61
|
+
if (this.total <= this.maxBytes && this.entries.size <= this.maxEntries)
|
|
62
|
+
break;
|
|
63
|
+
this.entries.delete(oldest);
|
|
64
|
+
this.total -= entry.bytes;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
delete(id) {
|
|
68
|
+
const entry = this.entries.get(id);
|
|
69
|
+
if (!entry)
|
|
70
|
+
return;
|
|
71
|
+
this.entries.delete(id);
|
|
72
|
+
this.total -= entry.bytes;
|
|
73
|
+
}
|
|
74
|
+
/** Drops every entry whose key starts with `prefix`: all the pieces of one document. */
|
|
75
|
+
deletePrefix(prefix) {
|
|
76
|
+
for (const key of [...this.entries.keys()])
|
|
77
|
+
if (key.startsWith(prefix))
|
|
78
|
+
this.delete(key);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAkB;IAChD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AE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3F,CAAC;CACF"}
|
package/dist/extract.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function detectFormat(name: string, mimeType: string): DocumentFo
|
|
|
6
6
|
* Throws a readable error for compressed and other binary files.
|
|
7
7
|
*/
|
|
8
8
|
export declare function decodeText(bytes: Uint8Array): string;
|
|
9
|
-
/** Text of each
|
|
9
|
+
/** Text of each paragraph of Office XML, in the order the paragraphs start. See `OfficeText`. */
|
|
10
10
|
export declare function officeXmlParagraphs(xml: string, prefix: "w" | "a"): string[];
|
|
11
11
|
export type PdfExtractorOptions = {
|
|
12
12
|
/**
|
package/dist/extract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAmBzF,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAG3E;AAID;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAkCpD;
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAmBzF,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAG3E;AAID;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAkCpD;AA6ID,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,MAAM,EAAE,CAI5E;AA4GD,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,eAAe,sDAAsD,CAAC;AAEnF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,SAAS,CAoD/E;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,cAAc,EAAE,SAAS,CAS/D,CAAC;AAEF,wBAAsB,WAAW,CAC/B,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,YAAY,EACnB,UAAU,GAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,CAAM,GAC1D,OAAO,CAAC,aAAa,CAAC,CAGxB"}
|
package/dist/extract.js
CHANGED
|
@@ -88,22 +88,206 @@ function decodeXmlEntities(value) {
|
|
|
88
88
|
return Number.isFinite(code) && code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : match;
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
/**
|
|
91
|
+
/** A tag name is read up to this many characters: the names that matter here are short. */
|
|
92
|
+
const MAX_TAG_NAME = 64;
|
|
93
|
+
/**
|
|
94
|
+
* Collects the text of each paragraph of Office XML (`<w:p>` in Word, `<a:p>` in PowerPoint) in one
|
|
95
|
+
* pass, with no XML parser. The XML can come in pieces, as it is unpacked: a tag cut between two
|
|
96
|
+
* pieces is read whole. Every character is looked at once, so the time follows the length of the
|
|
97
|
+
* XML whatever its shape: a file of unclosed tags costs what a file of closed ones does.
|
|
98
|
+
*
|
|
99
|
+
* - A paragraph inside another one (the text box of a shape anchored in a paragraph) is a paragraph
|
|
100
|
+
* of its own, after the one it is anchored in, which keeps its text before and after the box.
|
|
101
|
+
* - `mc:Fallback` repeats `mc:Choice` for older programs, so it is skipped: a text box is read once.
|
|
102
|
+
* - Paragraph properties hold no text. Their tab stops are not tabs.
|
|
103
|
+
*/
|
|
104
|
+
class OfficeText {
|
|
105
|
+
paragraphTag;
|
|
106
|
+
paragraphEnd;
|
|
107
|
+
textTag;
|
|
108
|
+
textEnd;
|
|
109
|
+
propertiesTag;
|
|
110
|
+
propertiesEnd;
|
|
111
|
+
tabTag;
|
|
112
|
+
breakTags;
|
|
113
|
+
/** The pieces of text of each paragraph, in the order the paragraphs start. */
|
|
114
|
+
paragraphs = [];
|
|
115
|
+
/** The paragraphs that are open, the innermost last. */
|
|
116
|
+
open = [];
|
|
117
|
+
inText = false;
|
|
118
|
+
inProperties = 0;
|
|
119
|
+
inFallback = 0;
|
|
120
|
+
/** The tag being read, from its "<": its name so far, the quote of a value it is in, its last character. */
|
|
121
|
+
tag;
|
|
122
|
+
constructor(prefix) {
|
|
123
|
+
this.paragraphTag = `${prefix}:p`;
|
|
124
|
+
this.paragraphEnd = `/${prefix}:p`;
|
|
125
|
+
this.textTag = `${prefix}:t`;
|
|
126
|
+
this.textEnd = `/${prefix}:t`;
|
|
127
|
+
this.propertiesTag = `${prefix}:pPr`;
|
|
128
|
+
this.propertiesEnd = `/${prefix}:pPr`;
|
|
129
|
+
this.tabTag = `${prefix}:tab`;
|
|
130
|
+
this.breakTags = new Set([`${prefix}:br`, `${prefix}:cr`]);
|
|
131
|
+
}
|
|
132
|
+
write(xml) {
|
|
133
|
+
const length = xml.length;
|
|
134
|
+
let at = 0;
|
|
135
|
+
while (at < length) {
|
|
136
|
+
const tag = this.tag;
|
|
137
|
+
if (!tag) {
|
|
138
|
+
const start = xml.indexOf("<", at);
|
|
139
|
+
const end = start === -1 ? length : start;
|
|
140
|
+
if (end > at && this.inText && this.inProperties === 0 && this.inFallback === 0)
|
|
141
|
+
this.open.at(-1)?.push(xml.slice(at, end));
|
|
142
|
+
if (start === -1)
|
|
143
|
+
return;
|
|
144
|
+
this.tag = { name: "", named: false, quote: 0, last: 0 };
|
|
145
|
+
at = start + 1;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
for (; at < length; at++) {
|
|
149
|
+
const code = xml.charCodeAt(at);
|
|
150
|
+
if (tag.quote !== 0) {
|
|
151
|
+
if (code === tag.quote)
|
|
152
|
+
tag.quote = 0;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (!tag.named) {
|
|
156
|
+
// A name ends at white space, at ">", or at the "/" of "<w:br/>". "</w:p>" starts with one.
|
|
157
|
+
if (code === 62 || code === 32 || code === 9 || code === 10 || code === 13 || (code === 47 && tag.name !== ""))
|
|
158
|
+
tag.named = true;
|
|
159
|
+
else {
|
|
160
|
+
if (tag.name.length < MAX_TAG_NAME)
|
|
161
|
+
tag.name += xml[at];
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (code === 62)
|
|
166
|
+
break;
|
|
167
|
+
if (code === 34 || code === 39)
|
|
168
|
+
tag.quote = code;
|
|
169
|
+
else if (code !== 32 && code !== 9 && code !== 10 && code !== 13)
|
|
170
|
+
tag.last = code;
|
|
171
|
+
}
|
|
172
|
+
if (at === length)
|
|
173
|
+
return; // The tag goes on in the next piece.
|
|
174
|
+
this.tag = undefined;
|
|
175
|
+
this.read(tag.name, tag.last === 47);
|
|
176
|
+
at++;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/** The text of each paragraph that has some, in the order the paragraphs start. */
|
|
180
|
+
texts() {
|
|
181
|
+
return this.paragraphs.map((pieces) => decodeXmlEntities(pieces.join(""))).filter((text) => text.trim());
|
|
182
|
+
}
|
|
183
|
+
/** Acts on a tag that has been read. `empty` is a tag that closes itself, as `<w:br/>`. */
|
|
184
|
+
read(name, empty) {
|
|
185
|
+
if (name === "mc:Fallback") {
|
|
186
|
+
if (!empty)
|
|
187
|
+
this.inFallback++;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (name === "/mc:Fallback") {
|
|
191
|
+
if (this.inFallback > 0)
|
|
192
|
+
this.inFallback--;
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (this.inFallback > 0)
|
|
196
|
+
return;
|
|
197
|
+
if (name === this.paragraphTag) {
|
|
198
|
+
if (!empty) {
|
|
199
|
+
const pieces = [];
|
|
200
|
+
this.paragraphs.push(pieces);
|
|
201
|
+
this.open.push(pieces);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else if (name === this.paragraphEnd) {
|
|
205
|
+
this.open.pop();
|
|
206
|
+
this.inText = false;
|
|
207
|
+
this.inProperties = 0;
|
|
208
|
+
}
|
|
209
|
+
else if (name === this.textTag) {
|
|
210
|
+
this.inText = !empty;
|
|
211
|
+
}
|
|
212
|
+
else if (name === this.textEnd) {
|
|
213
|
+
this.inText = false;
|
|
214
|
+
}
|
|
215
|
+
else if (name === this.propertiesTag) {
|
|
216
|
+
if (!empty)
|
|
217
|
+
this.inProperties++;
|
|
218
|
+
}
|
|
219
|
+
else if (name === this.propertiesEnd) {
|
|
220
|
+
if (this.inProperties > 0)
|
|
221
|
+
this.inProperties--;
|
|
222
|
+
}
|
|
223
|
+
else if (this.inProperties === 0) {
|
|
224
|
+
if (name === this.tabTag)
|
|
225
|
+
this.open.at(-1)?.push("\t");
|
|
226
|
+
else if (this.breakTags.has(name))
|
|
227
|
+
this.open.at(-1)?.push("\n");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/** Text of each paragraph of Office XML, in the order the paragraphs start. See `OfficeText`. */
|
|
92
232
|
export function officeXmlParagraphs(xml, prefix) {
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
233
|
+
const text = new OfficeText(prefix);
|
|
234
|
+
text.write(xml);
|
|
235
|
+
return text.texts();
|
|
236
|
+
}
|
|
237
|
+
/** The most XML read from one DOCX or PPTX, whatever its size: a document of thousands of pages. */
|
|
238
|
+
const MAX_OFFICE_XML = 128 * 1024 * 1024;
|
|
239
|
+
/**
|
|
240
|
+
* The parts read from an Office file unpack to less than its size: pictures, fonts and styles stay
|
|
241
|
+
* packed. A generated report that repeats one paragraph 50,000 times unpacks to 90 times its size.
|
|
242
|
+
* A file that unpacks to more than this many times its size, past the first 16 MB, is taken for a
|
|
243
|
+
* zip bomb, as Apache POI does.
|
|
244
|
+
*/
|
|
245
|
+
const MAX_OFFICE_EXPANSION = 100;
|
|
246
|
+
const OFFICE_ALLOWANCE = 16 * 1024 * 1024;
|
|
247
|
+
const megabytes = (size) => `${Math.round(size / 1024 / 1024)} MB`;
|
|
248
|
+
/**
|
|
249
|
+
* Reads the paragraphs of the parts of one DOCX or PPTX, each a piece at a time as it is unpacked,
|
|
250
|
+
* counting what is unpacked: a file that grows far past its size is refused as it grows, before
|
|
251
|
+
* that much is in memory. Unpacking yields to other work between pieces.
|
|
252
|
+
*/
|
|
253
|
+
function officeReader(archive, kind, size) {
|
|
254
|
+
const limit = Math.min(MAX_OFFICE_XML, Math.max(OFFICE_ALLOWANCE, size * MAX_OFFICE_EXPANSION));
|
|
255
|
+
const refusal = limit === MAX_OFFICE_XML
|
|
256
|
+
? `This ${kind} unpacks to more than ${megabytes(limit)} of XML, more than is read from one file. Save it as text or PDF, and attach that.`
|
|
257
|
+
: `This ${kind} unpacks to more than ${megabytes(limit)}, over ${MAX_OFFICE_EXPANSION} times its size. A file that grows that much is not read: it may be a zip bomb. Save it as text or PDF, and attach that.`;
|
|
258
|
+
let unpacked = 0;
|
|
259
|
+
return (name, prefix) => new Promise((resolve, reject) => {
|
|
260
|
+
const file = archive.file(name);
|
|
261
|
+
if (!file) {
|
|
262
|
+
resolve([]);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const text = new OfficeText(prefix);
|
|
266
|
+
let stopped = false;
|
|
267
|
+
const stream = file.internalStream("string");
|
|
268
|
+
stream
|
|
269
|
+
.on("data", (chunk) => {
|
|
270
|
+
if (stopped)
|
|
271
|
+
return;
|
|
272
|
+
unpacked += chunk.length;
|
|
273
|
+
if (unpacked > limit) {
|
|
274
|
+
stopped = true;
|
|
275
|
+
stream.pause();
|
|
276
|
+
reject(new Error(refusal));
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
text.write(chunk);
|
|
280
|
+
})
|
|
281
|
+
.on("error", (error) => {
|
|
282
|
+
stopped = true;
|
|
283
|
+
reject(error);
|
|
284
|
+
})
|
|
285
|
+
.on("end", () => {
|
|
286
|
+
if (!stopped)
|
|
287
|
+
resolve(text.texts());
|
|
288
|
+
})
|
|
289
|
+
.resume();
|
|
290
|
+
});
|
|
107
291
|
}
|
|
108
292
|
async function loadZip(bytes) {
|
|
109
293
|
let JSZip;
|
|
@@ -122,12 +306,10 @@ const docx = async (bytes) => {
|
|
|
122
306
|
.sort((left, right) => left === "word/document.xml" ? -1 : right === "word/document.xml" ? 1 : left.localeCompare(right));
|
|
123
307
|
if (!names.includes("word/document.xml"))
|
|
124
308
|
throw new Error("This DOCX does not contain word/document.xml.");
|
|
309
|
+
const read = officeReader(archive, "DOCX", bytes.byteLength);
|
|
125
310
|
const sections = [];
|
|
126
|
-
for (const name of names)
|
|
127
|
-
|
|
128
|
-
if (xml)
|
|
129
|
-
sections.push(officeXmlParagraphs(xml, "w").join("\n"));
|
|
130
|
-
}
|
|
311
|
+
for (const name of names)
|
|
312
|
+
sections.push((await read(name, "w")).join("\n"));
|
|
131
313
|
return { text: sections.filter(Boolean).join("\n\n") };
|
|
132
314
|
};
|
|
133
315
|
const pptx = async (bytes) => {
|
|
@@ -138,10 +320,10 @@ const pptx = async (bytes) => {
|
|
|
138
320
|
.sort((left, right) => slideNumber(left) - slideNumber(right));
|
|
139
321
|
if (names.length === 0)
|
|
140
322
|
throw new Error("This PPTX does not contain any slides.");
|
|
323
|
+
const read = officeReader(archive, "PPTX", bytes.byteLength);
|
|
141
324
|
const slides = [];
|
|
142
325
|
for (const name of names) {
|
|
143
|
-
const
|
|
144
|
-
const text = xml ? officeXmlParagraphs(xml, "a").join("\n") : "";
|
|
326
|
+
const text = (await read(name, "a")).join("\n");
|
|
145
327
|
slides.push(`## Slide ${slideNumber(name)}\n${text || "[No text on this slide]"}`);
|
|
146
328
|
}
|
|
147
329
|
return { text: slides.join("\n\n"), pages: names.length };
|
package/dist/extract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAoC,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAqB,MAAM,mBAAmB,CAAC;AAGxE,MAAM,iBAAiB,GAAmC;IACxD,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK;IAClC,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU;IACpC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC3C,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK;IACtB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CACvC,CAAC;AAEF,MAAM,YAAY,GAAmC;IACnD,iBAAiB,EAAE,KAAK;IACxB,yEAAyE,EAAE,MAAM;IACjF,2EAA2E,EAAE,MAAM;IACnF,eAAe,EAAE,UAAU;IAC3B,kBAAkB,EAAE,MAAM;IAC1B,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,iGAAiG;AACjG,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,QAAgB;IACzD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EA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iB,GAAsC;IAClE,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,kBAAkB,EAAE;IACzB,IAAI;IACJ,IAAI;CACL,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAiB,EACjB,KAAmB,EACnB,aAAyD,EAAE;IAE3D,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9E,OAAO,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createLargeFiles, DEFAULT_BUDGET, isDocumentId, toDocumentSummary } from "./library.js";
|
|
1
|
+
export { createLargeFiles, DEFAULT_BUDGET, DEFAULT_CACHE_BYTES, DEFAULT_WHOLE_DOCUMENT_BYTES, isDocumentId, toDocumentSummary } from "./library.js";
|
|
2
2
|
export type { AccessOptions, IngestInput, LargeFiles, LargeFilesOptions, PrepareOptions, ToolOptions } from "./library.js";
|
|
3
3
|
export { FileDocumentStore, MemoryDocumentStore, DOCUMENT_ID_PATTERN } from "./stores.js";
|
|
4
4
|
export { createPdfExtractor, defaultExtractors, detectFormat } from "./extract.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpJ,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3H,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnF,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3E,mBAAmB,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Core: provider-neutral. Gemini helpers live in "llm-large-files/gemini",
|
|
2
2
|
// Node HTTP handlers in "llm-large-files/node".
|
|
3
|
-
export { createLargeFiles, DEFAULT_BUDGET, isDocumentId, toDocumentSummary } from "./library.js";
|
|
3
|
+
export { createLargeFiles, DEFAULT_BUDGET, DEFAULT_CACHE_BYTES, DEFAULT_WHOLE_DOCUMENT_BYTES, isDocumentId, toDocumentSummary } from "./library.js";
|
|
4
4
|
export { FileDocumentStore, MemoryDocumentStore, DOCUMENT_ID_PATTERN } from "./stores.js";
|
|
5
5
|
export { createPdfExtractor, defaultExtractors, detectFormat } from "./extract.js";
|
|
6
6
|
export { estimateTokens, utf8Bytes, jsonBytes } from "./text.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,gDAAgD;AAChD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,gDAAgD;AAChD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEpJ,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/library.d.ts
CHANGED
|
@@ -24,8 +24,31 @@ export type LargeFilesOptions = {
|
|
|
24
24
|
* is accepted. Defaults to 30. 0 refuses every PDF without text, as before.
|
|
25
25
|
*/
|
|
26
26
|
scannedPdfPages?: number;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The most memory, in bytes, that documents kept ready for repeated tool calls may take.
|
|
29
|
+
* Defaults to 256 MB. A document larger than this is read again for each call. 0 keeps none.
|
|
30
|
+
*
|
|
31
|
+
* Every use of a kept document first asks the store whether it is still there, so a document
|
|
32
|
+
* deleted or expired on another server sharing the store is never served from memory here.
|
|
33
|
+
*/
|
|
34
|
+
cacheBytes?: number;
|
|
35
|
+
/** Also caps the number of documents kept (the only limit before 0.4). Unset: no cap on the number. */
|
|
28
36
|
cacheSize?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Documents whose text is at most this many bytes are loaded whole into memory (and kept there
|
|
39
|
+
* within `cacheBytes`). Larger ones are read by range, when the store can (`readTextRange`, as
|
|
40
|
+
* `FileDocumentStore` does): a tool call reads the lines it needs, and a search reads the text a
|
|
41
|
+
* piece at a time, so memory does not grow with the size of the files or the number of users.
|
|
42
|
+
* Defaults to 2 MB. `Infinity` loads every document whole, as before 0.4; 0 reads every one by range.
|
|
43
|
+
*/
|
|
44
|
+
wholeDocumentBytes?: number;
|
|
45
|
+
/** Reading by range: about this many bytes of text are read and searched at a time. Defaults to 1 MB. */
|
|
46
|
+
scanChunkBytes?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Reading by range: how many scans of whole documents (searches, counting the parts of a file)
|
|
49
|
+
* run at once in this process. The others wait their turn. Defaults to 4.
|
|
50
|
+
*/
|
|
51
|
+
maxConcurrentScans?: number;
|
|
29
52
|
/** Clock override, for tests. */
|
|
30
53
|
now?: () => Date;
|
|
31
54
|
};
|
|
@@ -95,5 +118,9 @@ export declare function toDocumentSummary(meta: DocumentMeta): DocumentSummary;
|
|
|
95
118
|
* not be able to start a new line of the prompt or disguise its extension.
|
|
96
119
|
*/
|
|
97
120
|
export declare function cleanFileName(raw: string): string;
|
|
121
|
+
/** Default for `cacheBytes`. */
|
|
122
|
+
export declare const DEFAULT_CACHE_BYTES: number;
|
|
123
|
+
/** Default for `wholeDocumentBytes`. */
|
|
124
|
+
export declare const DEFAULT_WHOLE_DOCUMENT_BYTES: number;
|
|
98
125
|
export declare function createLargeFiles(options: LargeFilesOptions): LargeFiles;
|
|
99
126
|
//# sourceMappingURL=library.d.ts.map
|
package/dist/library.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../src/library.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../src/library.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,MAAM,EACN,cAAc,EACd,YAAY,EACZ,aAAa,EACb,eAAe,EACf,SAAS,EACT,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,OAAO,EACR,MAAM,YAA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