llm-large-files 0.8.1 → 0.9.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.
Files changed (204) hide show
  1. package/CHANGELOG.md +631 -0
  2. package/README.md +9 -10
  3. package/dist/access.d.ts +86 -0
  4. package/dist/access.d.ts.map +1 -0
  5. package/dist/access.js +131 -0
  6. package/dist/access.js.map +1 -0
  7. package/dist/ask.d.ts +45 -1
  8. package/dist/ask.d.ts.map +1 -1
  9. package/dist/ask.js +181 -20
  10. package/dist/ask.js.map +1 -1
  11. package/dist/cache.d.ts +12 -3
  12. package/dist/cache.d.ts.map +1 -1
  13. package/dist/cache.js +18 -5
  14. package/dist/cache.js.map +1 -1
  15. package/dist/encoding.js +5 -3
  16. package/dist/encoding.js.map +1 -1
  17. package/dist/error-info.d.ts +57 -0
  18. package/dist/error-info.d.ts.map +1 -0
  19. package/dist/error-info.js +217 -0
  20. package/dist/error-info.js.map +1 -0
  21. package/dist/errors.d.ts +72 -8
  22. package/dist/errors.d.ts.map +1 -1
  23. package/dist/errors.js +102 -15
  24. package/dist/errors.js.map +1 -1
  25. package/dist/events.d.ts +35 -9
  26. package/dist/events.d.ts.map +1 -1
  27. package/dist/events.js +42 -11
  28. package/dist/events.js.map +1 -1
  29. package/dist/evidence.d.ts +4 -2
  30. package/dist/evidence.d.ts.map +1 -1
  31. package/dist/evidence.js +14 -3
  32. package/dist/evidence.js.map +1 -1
  33. package/dist/extract.d.ts +32 -8
  34. package/dist/extract.d.ts.map +1 -1
  35. package/dist/extract.js +46 -35
  36. package/dist/extract.js.map +1 -1
  37. package/dist/gemini/adapter.d.ts +19 -3
  38. package/dist/gemini/adapter.d.ts.map +1 -1
  39. package/dist/gemini/adapter.js +84 -12
  40. package/dist/gemini/adapter.js.map +1 -1
  41. package/dist/gemini/chat.d.ts +18 -6
  42. package/dist/gemini/chat.d.ts.map +1 -1
  43. package/dist/gemini/chat.js +2 -0
  44. package/dist/gemini/chat.js.map +1 -1
  45. package/dist/gemini/index.d.ts +1 -1
  46. package/dist/gemini/index.d.ts.map +1 -1
  47. package/dist/index.d.ts +9 -6
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +4 -3
  50. package/dist/index.js.map +1 -1
  51. package/dist/ingest.d.ts +70 -0
  52. package/dist/ingest.d.ts.map +1 -0
  53. package/dist/ingest.js +868 -0
  54. package/dist/ingest.js.map +1 -0
  55. package/dist/library.d.ts +176 -34
  56. package/dist/library.d.ts.map +1 -1
  57. package/dist/library.js +332 -512
  58. package/dist/library.js.map +1 -1
  59. package/dist/limiter.d.ts +2 -2
  60. package/dist/limiter.js +2 -2
  61. package/dist/map-reduce.js +3 -3
  62. package/dist/map-reduce.js.map +1 -1
  63. package/dist/model.d.ts +43 -2
  64. package/dist/model.d.ts.map +1 -1
  65. package/dist/model.js +63 -3
  66. package/dist/model.js.map +1 -1
  67. package/dist/node/handlers.d.ts +234 -7
  68. package/dist/node/handlers.d.ts.map +1 -1
  69. package/dist/node/handlers.js +482 -121
  70. package/dist/node/handlers.js.map +1 -1
  71. package/dist/node/index.d.ts +3 -2
  72. package/dist/node/index.d.ts.map +1 -1
  73. package/dist/node/index.js +2 -1
  74. package/dist/node/index.js.map +1 -1
  75. package/dist/node/ingest-child.d.ts +7 -1
  76. package/dist/node/ingest-child.d.ts.map +1 -1
  77. package/dist/node/ingest-child.js +18 -3
  78. package/dist/node/ingest-child.js.map +1 -1
  79. package/dist/node/isolated.d.ts +3 -1
  80. package/dist/node/isolated.d.ts.map +1 -1
  81. package/dist/node/isolated.js +11 -4
  82. package/dist/node/isolated.js.map +1 -1
  83. package/dist/node/originals.d.ts +19 -0
  84. package/dist/node/originals.d.ts.map +1 -0
  85. package/dist/node/originals.js +82 -0
  86. package/dist/node/originals.js.map +1 -0
  87. package/dist/node/spool.d.ts +102 -0
  88. package/dist/node/spool.d.ts.map +1 -0
  89. package/dist/node/spool.js +365 -0
  90. package/dist/node/spool.js.map +1 -0
  91. package/dist/node/sse.d.ts +4 -3
  92. package/dist/node/sse.d.ts.map +1 -1
  93. package/dist/node/sse.js +7 -6
  94. package/dist/node/sse.js.map +1 -1
  95. package/dist/pdf-layout.d.ts.map +1 -1
  96. package/dist/pdf-layout.js +71 -12
  97. package/dist/pdf-layout.js.map +1 -1
  98. package/dist/ranged.d.ts +22 -11
  99. package/dist/ranged.d.ts.map +1 -1
  100. package/dist/ranged.js +50 -12
  101. package/dist/ranged.js.map +1 -1
  102. package/dist/retry.d.ts +3 -1
  103. package/dist/retry.d.ts.map +1 -1
  104. package/dist/retry.js +6 -2
  105. package/dist/retry.js.map +1 -1
  106. package/dist/scope.d.ts +25 -0
  107. package/dist/scope.d.ts.map +1 -0
  108. package/dist/scope.js +60 -0
  109. package/dist/scope.js.map +1 -0
  110. package/dist/source.d.ts +60 -0
  111. package/dist/source.d.ts.map +1 -0
  112. package/dist/source.js +170 -0
  113. package/dist/source.js.map +1 -0
  114. package/dist/stores.d.ts +120 -31
  115. package/dist/stores.d.ts.map +1 -1
  116. package/dist/stores.js +582 -139
  117. package/dist/stores.js.map +1 -1
  118. package/dist/testing/fake-fetch.d.ts +31 -0
  119. package/dist/testing/fake-fetch.d.ts.map +1 -0
  120. package/dist/testing/fake-fetch.js +66 -0
  121. package/dist/testing/fake-fetch.js.map +1 -0
  122. package/dist/testing/fake-model.d.ts +38 -0
  123. package/dist/testing/fake-model.d.ts.map +1 -0
  124. package/dist/testing/fake-model.js +62 -0
  125. package/dist/testing/fake-model.js.map +1 -0
  126. package/dist/testing/index.d.ts +7 -0
  127. package/dist/testing/index.d.ts.map +1 -0
  128. package/dist/testing/index.js +9 -0
  129. package/dist/testing/index.js.map +1 -0
  130. package/dist/testing/store-checks.d.ts +72 -0
  131. package/dist/testing/store-checks.d.ts.map +1 -0
  132. package/dist/testing/store-checks.js +619 -0
  133. package/dist/testing/store-checks.js.map +1 -0
  134. package/dist/tools.d.ts +25 -0
  135. package/dist/tools.d.ts.map +1 -1
  136. package/dist/tools.js +135 -13
  137. package/dist/tools.js.map +1 -1
  138. package/dist/types.d.ts +116 -13
  139. package/dist/types.d.ts.map +1 -1
  140. package/docs/README.md +17 -8
  141. package/docs/getting-started.md +18 -13
  142. package/docs/guides/anthropic.md +12 -8
  143. package/docs/guides/conversations.md +112 -47
  144. package/docs/guides/costs-and-limits.md +16 -7
  145. package/docs/guides/deployment.md +309 -87
  146. package/docs/guides/errors-and-reliability.md +161 -23
  147. package/docs/guides/own-adapter-and-loop.md +27 -10
  148. package/docs/guides/pdfs.md +123 -29
  149. package/docs/guides/storage.md +634 -143
  150. package/docs/guides/testing.md +78 -129
  151. package/docs/guides/vertex-and-gemini.md +10 -7
  152. package/docs/guides/web-app.md +322 -77
  153. package/docs/how-it-works.md +35 -8
  154. package/docs/measurements.md +63 -8
  155. package/docs/publishing.md +112 -36
  156. package/docs/reference/ask.md +154 -13
  157. package/docs/reference/errors-and-retries.md +166 -14
  158. package/docs/reference/events.md +53 -20
  159. package/docs/reference/gemini.md +70 -21
  160. package/docs/reference/library.md +709 -165
  161. package/docs/reference/node.md +633 -104
  162. package/docs/reference/testing.md +311 -0
  163. package/docs/reference/tools.md +15 -5
  164. package/docs/security.md +316 -70
  165. package/docs/troubleshooting.md +165 -58
  166. package/docs/upgrading-0.9.md +890 -0
  167. package/package.json +12 -3
  168. package/src/access.ts +144 -0
  169. package/src/ask.ts +230 -19
  170. package/src/cache.ts +20 -5
  171. package/src/encoding.ts +6 -4
  172. package/src/error-info.ts +255 -0
  173. package/src/errors.ts +129 -15
  174. package/src/events.ts +86 -21
  175. package/src/evidence.ts +14 -3
  176. package/src/extract.ts +50 -33
  177. package/src/gemini/adapter.ts +97 -11
  178. package/src/gemini/chat.ts +20 -6
  179. package/src/gemini/index.ts +1 -1
  180. package/src/index.ts +9 -6
  181. package/src/ingest.ts +927 -0
  182. package/src/library.ts +482 -523
  183. package/src/limiter.ts +2 -2
  184. package/src/map-reduce.ts +3 -3
  185. package/src/model.ts +69 -5
  186. package/src/node/handlers.ts +691 -117
  187. package/src/node/index.ts +13 -2
  188. package/src/node/ingest-child.ts +23 -5
  189. package/src/node/isolated.ts +11 -4
  190. package/src/node/originals.ts +78 -0
  191. package/src/node/spool.ts +365 -0
  192. package/src/node/sse.ts +7 -6
  193. package/src/pdf-layout.ts +69 -11
  194. package/src/ranged.ts +42 -14
  195. package/src/retry.ts +6 -2
  196. package/src/scope.ts +63 -0
  197. package/src/source.ts +178 -0
  198. package/src/stores.ts +635 -140
  199. package/src/testing/fake-fetch.ts +80 -0
  200. package/src/testing/fake-model.ts +78 -0
  201. package/src/testing/index.ts +11 -0
  202. package/src/testing/store-checks.ts +660 -0
  203. package/src/tools.ts +150 -14
  204. package/src/types.ts +106 -13
package/README.md CHANGED
@@ -205,7 +205,7 @@ A large PDF goes to the model as text, and text cannot show a chart. Keep the up
205
205
  the model gets a tool, `view_pages`, that hands it the pages it asks for as a small PDF:
206
206
 
207
207
  ```bash
208
- npm install unpdf @cantoo/pdf-lib # Node 24; for Node 20 and 22, see Requirements
208
+ npm install unpdf @cantoo/pdf-lib # Node 24; for Node 22, see Requirements
209
209
  ```
210
210
 
211
211
  ```ts
@@ -306,6 +306,7 @@ Reference, one page per module:
306
306
  - [`llm-large-files/openai`](docs/reference/openai.md): `openAiCompatible()` and its options.
307
307
  - [`llm-large-files/anthropic`](docs/reference/anthropic.md): `anthropic()` and its options.
308
308
  - [`llm-large-files/node`](docs/reference/node.md): `createDocumentHandlers`, its routes and responses, `createIsolatedExtractors`.
309
+ - [`llm-large-files/testing`](docs/reference/testing.md): `fakeModel` and `fakeFetch`, for your tests (new in 0.9.0).
309
310
 
310
311
  [Changelog](CHANGELOG.md): what each version changed, and what to change in your code when you upgrade.
311
312
 
@@ -315,21 +316,19 @@ maintainers: [Contributing](https://github.com/renanbazinin/llm-large-files/blob
315
316
 
316
317
  ## Requirements
317
318
 
318
- Node.js 20.19 or newer. The package is ESM; CommonJS code can `require()` it on Node 20.19+ and
319
- 22.12+. For DOCX, PPTX and XLSX install `jszip`, for PDF install `unpdf`, and to mark and show the
320
- pages of a PDF, and refuse a page built to hold the server before it is read, install
321
- `@cantoo/pdf-lib`. All three are optional:
319
+ Node.js 22.12 or newer. The package is ESM, and CommonJS code can `require()` it. For DOCX, PPTX
320
+ and XLSX install `jszip`, for PDF install `unpdf`, and to mark and show the pages of a PDF, and
321
+ refuse a page built to hold the server before it is read, install `@cantoo/pdf-lib`. All three are
322
+ optional:
322
323
 
323
324
  ```bash
324
325
  npm install jszip unpdf @cantoo/pdf-lib # Node 24 and later
325
326
  npm install jszip unpdf@1 @cantoo/pdf-lib # Node 22
326
- npm install jszip unpdf@1.7.0 @cantoo/pdf-lib # Node 20
327
327
  ```
328
328
 
329
- On Node 24 and later, `npm install unpdf` installs unpdf 2, which asks for Node 24. On Node 20,
330
- unpdf 1.9 and later cannot load pdf.js, and on Node 20 and 22 the pdf.js of unpdf 1.5.0 to 1.6.0
331
- would stop the whole process. Such an unpdf is refused at the first PDF, with a message that says
332
- what to install.
329
+ On Node 24 and later, `npm install unpdf` installs unpdf 2, which asks for Node 24. On Node 22, the
330
+ pdf.js of unpdf 1.5.0 to 1.6.0 would stop the whole process. Such an unpdf is refused at the first
331
+ PDF, with a message that says what to install.
333
332
 
334
333
  ## License
335
334
 
@@ -0,0 +1,86 @@
1
+ import { type DocumentStoreOperation } from "./errors.js";
2
+ import type { DocumentContext, DocumentMeta, DocumentScope } from "./types.js";
3
+ /** The TypeError of a call without an owner, when the library requires one (`requireOwner`). */
4
+ export declare const OWNER_REQUIRED = "owner is required: requireOwner is on";
5
+ /** The TypeError of a call without a scope, when the library requires one (`requireScope`). */
6
+ export declare const SCOPE_REQUIRED = "scope is required: requireScope is on";
7
+ /**
8
+ * Refuses an owner that every caller without a user would share: an empty string (what
9
+ * `user?.id ?? ""` gives), one of spaces only, or null. Undefined is no owner. A number is let
10
+ * through, as before, for JavaScript code that passes numeric user IDs.
11
+ */
12
+ export declare function checkOwner(owner: unknown): void;
13
+ /** What a library requires of every call (`LargeFilesOptions.requireOwner` and `requireScope`). */
14
+ export type AccessRules = {
15
+ readonly requireOwner: boolean;
16
+ readonly requireScope: boolean;
17
+ };
18
+ /** A caller, checked: its owner, its scope (a frozen copy), and what the store calls made for it carry. */
19
+ export type Caller = {
20
+ readonly owner?: string;
21
+ readonly scope?: DocumentScope;
22
+ /** The context of the store calls made for this caller. */
23
+ readonly context: DocumentContext;
24
+ /** The key of the scope (`scopeKey`): what this caller's copies of documents are kept under in memory. */
25
+ readonly key: string;
26
+ };
27
+ /** The context of a store call: a frozen object, without the fields that are absent. */
28
+ export declare function storeContext(scope: DocumentScope | undefined, owner: string | undefined): DocumentContext;
29
+ /**
30
+ * The caller of a call made with `access`. Null is no owner and no scope, as a database gives a
31
+ * field that was left out. The scope is checked (`checkScope`: a `DocumentScopeError` when it is
32
+ * not valid). Under `requireOwner`, a call without an owner, or with one that `checkOwner` refuses,
33
+ * is a TypeError; under `requireScope`, a call without a scope.
34
+ */
35
+ export declare function callerOf(access: {
36
+ readonly owner?: unknown;
37
+ readonly scope?: unknown;
38
+ } | undefined, rules: AccessRules): Caller;
39
+ /**
40
+ * Whether `caller` may use the document `meta` describes. A document with an owner serves only that
41
+ * owner, and one with a scope only a caller of the same scope, segment by segment. A document
42
+ * without an owner serves any caller, unless the library requires owners; the same for scopes.
43
+ * Null is no owner and no scope, as a database gives a field that was left out. A refusal is never
44
+ * told: the document reads as missing.
45
+ */
46
+ export declare function mayUse(meta: DocumentMeta, caller: Caller, rules: AccessRules): boolean;
47
+ /**
48
+ * Whether the document `found` has exactly this owner and this scope: no owner is the same as no
49
+ * owner only, and so for scopes. An owner or a scope of null counts as none. A scope that is not a
50
+ * list of segments (damaged, or written by hand) is nobody's.
51
+ */
52
+ export declare function heldBy(found: DocumentMeta, owner: string | undefined, scope: DocumentScope | undefined): boolean;
53
+ /**
54
+ * The context of the reads of a document's text (`get`, `readTextRange`, `getIndex`, and `putIndex`
55
+ * when its index is built again), once `caller` may use it (`mayUse`): the caller's scope, where
56
+ * `getMeta` found the document, and the owner only when the document has one. The copy kept in memory
57
+ * is kept under the caller's scope, and shared by every caller of it, whose owners differ when the
58
+ * document has none: so its reads carry one context whoever makes them. A document whose metadata
59
+ * has no scope (one of 0.8, moved into a scope) is still read in the scope it was found in. The
60
+ * owner sent is the caller's, which `mayUse` found the same as the document's; it is left out when
61
+ * the document has none.
62
+ */
63
+ export declare function documentContext(meta: DocumentMeta, caller: Caller): DocumentContext;
64
+ /**
65
+ * The metadata a store gave for `id`, when it is that of `id`: metadata of another document (a
66
+ * store that looked up the wrong one) is none. An owner or a scope of null, as a database gives a
67
+ * field that was left out, is left out.
68
+ */
69
+ export declare function metaOf(found: DocumentMeta | undefined, id: string): DocumentMeta | undefined;
70
+ /**
71
+ * A call of the store. What it throws is passed on as a `DocumentStoreError` of `operation`, with
72
+ * the store's error as `cause`: the store's own error may name a path, a host or a bucket, and a
73
+ * store that failed is not a document that is gone. A `DocumentStoreError` is passed on as it is,
74
+ * and so is a `DocumentScopeError`: a scope the store cannot use is a mistake of the call, and the
75
+ * same call would fail again.
76
+ */
77
+ export declare function storeCall<T>(operation: DocumentStoreOperation, call: () => Promise<T>): Promise<T>;
78
+ /**
79
+ * Refuses metadata written by a newer version of the package (`metaVersion` above
80
+ * `DOCUMENT_META_VERSION`), which may mean what this version cannot tell: a `DocumentStoreError`
81
+ * with code "NEWER_VERSION", not a document that is missing, so that an application does not
82
+ * ingest the file again over it. Metadata without a version (before 0.9.0), or with null as a
83
+ * database gives a field that was left out, is read as before.
84
+ */
85
+ export declare function checkMetaVersion(meta: DocumentMeta): void;
86
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0C,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGlG,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE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AO,CAIhH;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAEnF;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAM5F;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMxG;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAKzD"}
package/dist/access.js ADDED
@@ -0,0 +1,131 @@
1
+ // Who is asking, and what they may use: the owner and the scope of a call, the context the store is
2
+ // given for it, and the rule that decides which documents serve it. New in 0.9.0.
3
+ import { DocumentScopeError, DocumentStoreError } from "./errors.js";
4
+ import { checkScope, sameScope, scopeKey } from "./scope.js";
5
+ import { DOCUMENT_META_VERSION } from "./stores.js";
6
+ /** The TypeError of a call without an owner, when the library requires one (`requireOwner`). */
7
+ export const OWNER_REQUIRED = "owner is required: requireOwner is on";
8
+ /** The TypeError of a call without a scope, when the library requires one (`requireScope`). */
9
+ export const SCOPE_REQUIRED = "scope is required: requireScope is on";
10
+ /**
11
+ * Refuses an owner that every caller without a user would share: an empty string (what
12
+ * `user?.id ?? ""` gives), one of spaces only, or null. Undefined is no owner. A number is let
13
+ * through, as before, for JavaScript code that passes numeric user IDs.
14
+ */
15
+ export function checkOwner(owner) {
16
+ if (owner === undefined || (typeof owner === "string" && owner.trim() !== "") || (typeof owner === "number" && Number.isFinite(owner)))
17
+ return;
18
+ throw new TypeError("owner must be a string that is not empty or only spaces, such as the signed-in user's ID. To let anyone with the document's ID use it, leave owner out.");
19
+ }
20
+ /** The context of a store call: a frozen object, without the fields that are absent. */
21
+ export function storeContext(scope, owner) {
22
+ return Object.freeze({ ...(scope !== undefined ? { scope } : {}), ...(owner !== undefined ? { owner } : {}) });
23
+ }
24
+ /**
25
+ * The caller of a call made with `access`. Null is no owner and no scope, as a database gives a
26
+ * field that was left out. The scope is checked (`checkScope`: a `DocumentScopeError` when it is
27
+ * not valid). Under `requireOwner`, a call without an owner, or with one that `checkOwner` refuses,
28
+ * is a TypeError; under `requireScope`, a call without a scope.
29
+ */
30
+ export function callerOf(access, rules) {
31
+ const owner = (access?.owner ?? undefined);
32
+ if (rules.requireOwner) {
33
+ if (owner === undefined)
34
+ throw new TypeError(OWNER_REQUIRED);
35
+ checkOwner(owner);
36
+ }
37
+ const scope = checkScope(access?.scope ?? undefined);
38
+ if (rules.requireScope && scope === undefined)
39
+ throw new TypeError(SCOPE_REQUIRED);
40
+ return {
41
+ ...(owner !== undefined ? { owner } : {}),
42
+ ...(scope !== undefined ? { scope } : {}),
43
+ context: storeContext(scope, owner),
44
+ key: scopeKey(scope),
45
+ };
46
+ }
47
+ /**
48
+ * Whether `caller` may use the document `meta` describes. A document with an owner serves only that
49
+ * owner, and one with a scope only a caller of the same scope, segment by segment. A document
50
+ * without an owner serves any caller, unless the library requires owners; the same for scopes.
51
+ * Null is no owner and no scope, as a database gives a field that was left out. A refusal is never
52
+ * told: the document reads as missing.
53
+ */
54
+ export function mayUse(meta, caller, rules) {
55
+ const owner = meta.owner ?? undefined;
56
+ if (owner === undefined ? rules.requireOwner : owner !== caller.owner)
57
+ return false;
58
+ const scope = meta.scope ?? undefined;
59
+ if (scope === undefined)
60
+ return !rules.requireScope;
61
+ // A scope that is not a list of segments (damaged, or written by hand) serves nobody.
62
+ return Array.isArray(scope) && sameScope(scope, caller.scope);
63
+ }
64
+ /**
65
+ * Whether the document `found` has exactly this owner and this scope: no owner is the same as no
66
+ * owner only, and so for scopes. An owner or a scope of null counts as none. A scope that is not a
67
+ * list of segments (damaged, or written by hand) is nobody's.
68
+ */
69
+ export function heldBy(found, owner, scope) {
70
+ const theirs = found.scope ?? undefined;
71
+ if ((found.owner ?? undefined) !== owner)
72
+ return false;
73
+ return theirs === undefined ? scope === undefined : Array.isArray(theirs) && sameScope(theirs, scope);
74
+ }
75
+ /**
76
+ * The context of the reads of a document's text (`get`, `readTextRange`, `getIndex`, and `putIndex`
77
+ * when its index is built again), once `caller` may use it (`mayUse`): the caller's scope, where
78
+ * `getMeta` found the document, and the owner only when the document has one. The copy kept in memory
79
+ * is kept under the caller's scope, and shared by every caller of it, whose owners differ when the
80
+ * document has none: so its reads carry one context whoever makes them. A document whose metadata
81
+ * has no scope (one of 0.8, moved into a scope) is still read in the scope it was found in. The
82
+ * owner sent is the caller's, which `mayUse` found the same as the document's; it is left out when
83
+ * the document has none.
84
+ */
85
+ export function documentContext(meta, caller) {
86
+ return storeContext(caller.scope, (meta.owner ?? undefined) === undefined ? undefined : caller.owner);
87
+ }
88
+ /**
89
+ * The metadata a store gave for `id`, when it is that of `id`: metadata of another document (a
90
+ * store that looked up the wrong one) is none. An owner or a scope of null, as a database gives a
91
+ * field that was left out, is left out.
92
+ */
93
+ export function metaOf(found, id) {
94
+ if (typeof found !== "object" || found === null || found.id !== id)
95
+ return undefined;
96
+ const { owner, scope } = found;
97
+ if (owner !== null && scope !== null)
98
+ return found;
99
+ const { owner: _owner, scope: _scope, ...rest } = found;
100
+ return { ...rest, ...(owner !== null && owner !== undefined ? { owner: owner } : {}), ...(scope !== null && scope !== undefined ? { scope: scope } : {}) };
101
+ }
102
+ /**
103
+ * A call of the store. What it throws is passed on as a `DocumentStoreError` of `operation`, with
104
+ * the store's error as `cause`: the store's own error may name a path, a host or a bucket, and a
105
+ * store that failed is not a document that is gone. A `DocumentStoreError` is passed on as it is,
106
+ * and so is a `DocumentScopeError`: a scope the store cannot use is a mistake of the call, and the
107
+ * same call would fail again.
108
+ */
109
+ export async function storeCall(operation, call) {
110
+ try {
111
+ return await call();
112
+ }
113
+ catch (error) {
114
+ throw DocumentStoreError.is(error) || DocumentScopeError.is(error) ? error : new DocumentStoreError(error, { operation });
115
+ }
116
+ }
117
+ /**
118
+ * Refuses metadata written by a newer version of the package (`metaVersion` above
119
+ * `DOCUMENT_META_VERSION`), which may mean what this version cannot tell: a `DocumentStoreError`
120
+ * with code "NEWER_VERSION", not a document that is missing, so that an application does not
121
+ * ingest the file again over it. Metadata without a version (before 0.9.0), or with null as a
122
+ * database gives a field that was left out, is read as before.
123
+ */
124
+ export function checkMetaVersion(meta) {
125
+ const version = meta.metaVersion ?? 0;
126
+ if (typeof version === "number" && version <= DOCUMENT_META_VERSION)
127
+ return;
128
+ const found = new RangeError(`The metadata of ${String(meta.id)} has metaVersion ${String(version)}; this version of llm-large-files reads up to ${DOCUMENT_META_VERSION}.`);
129
+ throw new DocumentStoreError(found, { operation: "read", code: "NEWER_VERSION" });
130
+ }
131
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,kFAAkF;AAClF,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAA+B,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD,gGAAgG;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,uCAAuC,CAAC;AACtE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,cAAc,GAAG,uCAAuC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC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C,WAAW,IAAI,CAAC,CAAC;IAC/C,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,IAAI,qBAAqB;QAAE,OAAO;IAC5E,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,mBAAmB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,oBAAoB,MAAM,CAAC,OAAO,CAAC,iDAAiD,qBAAqB,GAAG,CAAC,CAAC;IAC7K,MAAM,IAAI,kBAAkB,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;AACpF,CAAC"}
package/dist/ask.d.ts CHANGED
@@ -3,7 +3,7 @@ import { type Evidence } from "./evidence.js";
3
3
  import type { LargeFiles } from "./library.js";
4
4
  import { type ChatMessage, type ModelAdapter, type ToolTurn, type UsageTotals } from "./model.js";
5
5
  import { type RetryOptions } from "./retry.js";
6
- import type { Budget, DocumentPlan } from "./types.js";
6
+ import type { Budget, DocumentPlan, DocumentScope } from "./types.js";
7
7
  /** Sent (invisibly to the user) when the model must stop using tools and answer. */
8
8
  export declare const FINAL_ANSWER_REQUEST = "Stop using tools now. Answer my question using only what the tools returned above, with line citations. Say plainly what you could not find. Answer in the language of my question.";
9
9
  /** The same, when the only tool was `view_pages`: the text of the files is in the prompt, not in tool results. */
@@ -79,6 +79,26 @@ export type AskOptions = {
79
79
  system?: string;
80
80
  /** The user asking. Documents ingested with a different owner are treated as missing. */
81
81
  owner?: string;
82
+ /**
83
+ * The scope of the question, such as [userId, chatId] (`DocumentScope`). It is passed to every
84
+ * store call, and documents ingested with another scope are treated as missing. New in 0.9.0.
85
+ */
86
+ scope?: DocumentScope;
87
+ /**
88
+ * What to do when documents of `documentIds` are missing: expired, deleted, never ingested, or of
89
+ * another owner or scope, which look the same. It is settled before any model request.
90
+ * - "throw" (the default): the question fails with `DocumentsNotFoundError`, as before 0.9.0.
91
+ * - "drop": the question is answered without them. The system instruction gets one line that says
92
+ * how many files are no longer available, `AskResult.missing` lists them, and a
93
+ * "documents_missing" notice names them. With no document left, it is a plain chat: no tools.
94
+ * - A function, given the missing IDs, that returns what to do (`MissingDocumentsAction`): "throw",
95
+ * "drop", `{ retry: true }` once it has ingested them again under the same IDs, or
96
+ * `{ replace: { [oldId]: newId } }` for the IDs it ingested them under. A retry or replace plans
97
+ * the question again, once: an ID still missing then fails it with `DocumentsNotFoundError`.
98
+ * What the function throws fails the question.
99
+ * New in 0.9.0.
100
+ */
101
+ onMissingDocuments?: "throw" | "drop" | ((missing: string[], context: MissingDocumentsContext) => MissingDocumentsAction | Promise<MissingDocumentsAction>);
82
102
  limits?: AskLimits;
83
103
  /** How a model request that failed is sent again. Defaults to three more tries, with a wait that doubles. */
84
104
  retry?: RetryOptions;
@@ -157,6 +177,11 @@ export type AskResult = {
157
177
  toolTurns: ToolTurn[];
158
178
  /** Which documents went in whole and which were searched. */
159
179
  plan: DocumentPlan;
180
+ /**
181
+ * The documents of `documentIds` that were missing, and that the question was answered without
182
+ * (`onMissingDocuments` "drop"). Absent when none was. New in 0.9.0.
183
+ */
184
+ missing?: string[];
160
185
  /** The budget the question ran with: the library's, fitted to the models. */
161
186
  budget: Budget;
162
187
  /** Model requests made for the chat itself, an explorer model's among them (whole-document part reads not included). */
@@ -167,6 +192,25 @@ export type AskResult = {
167
192
  /** The provider's own usage object of the last chat response, as it came. */
168
193
  lastUsage?: Record<string, unknown>;
169
194
  };
195
+ /**
196
+ * What `AskOptions.onMissingDocuments` says to do with the documents that are missing:
197
+ * - "throw": fail the question with `DocumentsNotFoundError`;
198
+ * - "drop": answer it without them;
199
+ * - `{ retry: true }`: plan it again with the same IDs, under which the documents were ingested again;
200
+ * - `{ replace: { [oldId]: newId } }`: plan it again with each new ID in place of its old one.
201
+ * New in 0.9.0.
202
+ */
203
+ export type MissingDocumentsAction = "throw" | "drop" | {
204
+ retry: true;
205
+ } | {
206
+ replace: Record<string, string>;
207
+ };
208
+ /** What a function of `AskOptions.onMissingDocuments` is told besides the IDs: who asks, and the question's signal. New in 0.9.0. */
209
+ export type MissingDocumentsContext = {
210
+ owner?: string;
211
+ scope?: DocumentScope;
212
+ signal?: AbortSignal;
213
+ };
170
214
  /**
171
215
  * Shares `room` characters among tool calls whose results may be up to `caps` characters. A call
172
216
  * gets no more than its cap, and the others split what it leaves. Calls that cannot each get
package/dist/ask.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqD,KAAK,QAAQ,EAAsC,KAAK,WAAW,EAA4E,MAAM,aAAa,CAAC;AAC/N,OAAO,EAA0B,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,YAAY,EAQjB,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAyC,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAetF,OAAO,KAAK,EAAE,MAAM,EAAgB,YAAY,EAA4H,MAAM,YAAY,CAAC;AAE/L,oFAAoF;AACpF,eAAO,MAAM,oBAAoB,wLAAwL,CAAC;AAC1N,kHAAkH;AAClH,eAAO,MAAM,wBAAwB,wLAAwL,CAAC;AAC9N;;;GAGG;AACH,eAAO,MAAM,0BAA0B,0NAA0N,CAAC;AAClQ;;;GAGG;AACH,eAAO,MAAM,oBAAoB,oWAAoW,CAAC;AAEtY,kCAAkC;AAClC,MAAM,MAAM,SAAS,GAAG;IACtB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kGAAkG;I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