File size: 678 Bytes
1a6d0d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
 * Messages exchanged with `pageExcerptWorker`, shared by both sides.
 *
 * Each allocation gets its own worker, terminated as soon as the excerpts
 * come back, so there is no cancel message and no need for the worker to
 * tell requests apart.
 */

export interface WorkerRequest {
  /** Full body of every page read by `/page-content`, in result order. */
  contents: string[];
  /** Tokens the excerpts may occupy together. */
  tokenBudget: number;
}

export type WorkerResponse =
  | {
      type: "excerpts";
      /** One entry per request entry, same order; empty when a page got no share. */
      excerpts: string[];
    }
  | { type: "error"; message: string };