@cerebriline/core 4.100.241 → 4.100.242

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.
@@ -117,7 +117,9 @@ export interface BookImage {
117
117
  export interface SourceImageInput {
118
118
  /** The name the source's text links it by: `images/<file>`. */
119
119
  file: string;
120
- data: Uint8Array;
120
+ /** The picture's bytes, or `path`: a file holding them, read when it is filed. */
121
+ data?: Uint8Array;
122
+ path?: string;
121
123
  mediaType: string;
122
124
  width?: number;
123
125
  height?: number;
@@ -151,8 +153,13 @@ export interface BookMatch {
151
153
  book: LibraryBook;
152
154
  source?: BookSource;
153
155
  reason: "same file" | "same link" | "same isbn" | "same title and author" | "same title" | "similar text";
154
- /** For "similar text": the share of the text the two have in common, 0 to 1. */
156
+ /**
157
+ * The share of the text the two have in common, 0 to 1: for "similar
158
+ * text", and for a title match when both have text to compare.
159
+ */
155
160
  similarity?: number;
161
+ /** The running heads of `source`, when it has pages: what document it is. */
162
+ runningHeads?: string[];
156
163
  }
157
164
  export interface FindSimilarInput {
158
165
  sha256?: string;
@@ -172,7 +179,21 @@ export type ExportScope = {
172
179
  shelfId: number;
173
180
  } | {
174
181
  bookId: number;
182
+ }
183
+ /**
184
+ * Whatever was ticked, together: whole sections, whole shelves and single
185
+ * books, from anywhere in the Library. A section or shelf brings
186
+ * everything on it; a book alone brings its shelf and section with only
187
+ * that book on them.
188
+ */
189
+ | {
190
+ selection: ExportSelection;
175
191
  };
192
+ export interface ExportSelection {
193
+ sectionIds?: readonly number[];
194
+ shelfIds?: readonly number[];
195
+ bookIds?: readonly number[];
196
+ }
176
197
  export interface ExportResult {
177
198
  file: string;
178
199
  books: number;
@@ -349,6 +370,12 @@ export declare class Catalogue {
349
370
  * trash are included, and say so.
350
371
  */
351
372
  findSimilar(input: FindSimilarInput): BookMatch[];
373
+ /**
374
+ * A source's running heads. Kept in its metadata from when it was added;
375
+ * a source added before that has them read from its text once, here, and
376
+ * kept. Empty for a source with no pages, or no text left to read.
377
+ */
378
+ private sourceRunningHeads;
352
379
  private bookFile;
353
380
  /** Write `book.json`: what the folder is, for a person and for import. */
354
381
  writeBookFile(bookId: number): void;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * A document's running heads: the lines printed on most of its pages, and
3
+ * what they say about which document it is.
4
+ *
5
+ * Text in common says two documents are related, not that one is a version of
6
+ * the other. Measured on a folder of AMD's processor manuals: two Processor
7
+ * Programming References for different processors share 77% of their five-word
8
+ * runs, more than two revisions of one revision guide (68%), because whole
9
+ * register chapters are reused from product to product. No threshold on the
10
+ * text separates them. The running head does: "55803 Rev 0.54 - Sep 12, 2019
11
+ * PPR for AMD Family 17h Model 31h B0" against "56176 Rev 3.06 - Jul 17, 2019
12
+ * PPR for AMD Family 17h Model 71h B0". Between revisions of one document only
13
+ * the revision and the date change; between two documents the number and the
14
+ * subject do.
15
+ *
16
+ * So the head is not stripped as boilerplate: it is read as the document's
17
+ * name. Only its identifying part is compared -- the tokens that carry a
18
+ * digit, once revision numbers and dates are taken out -- because the words
19
+ * around them ("AMD64 Technology", "PPR for AMD Family") are shared by a
20
+ * whole series.
21
+ */
22
+ /**
23
+ * The lines that repeat, word for word, on most pages. A page number printed
24
+ * on the same line makes it differ from page to page, so it drops out; a
25
+ * table heading that recurs is kept, and carries no identity (see below).
26
+ * Empty for a document without pages: an ebook has none to repeat on.
27
+ */
28
+ export declare function runningHeads(markdown: string): string[];
29
+ /** What the running heads say the document is, as sorted tokens; empty if they say nothing. */
30
+ export declare function documentIdentity(heads: readonly string[]): string[];
31
+ /**
32
+ * Whether two documents are the same one by their running heads: true when
33
+ * the identities match, false when both have one and they differ, undefined
34
+ * when either says nothing -- then the text and the title decide, as before.
35
+ */
36
+ export declare function sameDocument(a: readonly string[] | undefined, b: readonly string[] | undefined): boolean | undefined;
37
+ /** The head that names the document, for a message: the first with an identity. */
38
+ export declare function namingHead(heads: readonly string[] | undefined): string | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cerebriline/core",
3
3
  "description": "Cerebriline Core SDK for Node Runtime",
4
- "version": "4.100.241",
4
+ "version": "4.100.242",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/mann1x/cline.git",
@@ -69,9 +69,9 @@
69
69
  "ws": "^8.20.0",
70
70
  "yaml": "^2.8.2",
71
71
  "zod": "^4.3.6",
72
- "@cerebriline/agents": "4.100.241",
73
- "@cerebriline/llms": "4.100.241",
74
- "@cerebriline/shared": "4.100.241"
72
+ "@cerebriline/agents": "4.100.242",
73
+ "@cerebriline/llms": "4.100.242",
74
+ "@cerebriline/shared": "4.100.242"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "posthog-node": "^5.8.0"