@william_jin/vireo 0.0.0-stage → 0.20.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 (70) hide show
  1. package/LICENSE.md +61 -0
  2. package/README.md +136 -2
  3. package/dist/bin.d.ts +2 -0
  4. package/dist/bin.js +61 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/board.d.ts +87 -0
  7. package/dist/board.js +310 -0
  8. package/dist/board.js.map +1 -0
  9. package/dist/calls.d.ts +19 -0
  10. package/dist/calls.js +9 -0
  11. package/dist/calls.js.map +1 -0
  12. package/dist/cli.d.ts +26 -0
  13. package/dist/cli.js +530 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/collect.d.ts +43 -0
  16. package/dist/collect.js +41 -0
  17. package/dist/collect.js.map +1 -0
  18. package/dist/db.d.ts +18 -0
  19. package/dist/db.js +18 -0
  20. package/dist/db.js.map +1 -0
  21. package/dist/index.d.ts +10 -0
  22. package/dist/index.js +8 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/live.d.ts +28 -0
  25. package/dist/live.js +121 -0
  26. package/dist/live.js.map +1 -0
  27. package/dist/media.d.ts +36 -0
  28. package/dist/media.js +87 -0
  29. package/dist/media.js.map +1 -0
  30. package/dist/migrations.d.ts +5 -0
  31. package/dist/migrations.js +12 -0
  32. package/dist/migrations.js.map +1 -0
  33. package/dist/schema.d.ts +2105 -0
  34. package/dist/schema.js +364 -0
  35. package/dist/schema.js.map +1 -0
  36. package/dist/stats.d.ts +72 -0
  37. package/dist/stats.js +185 -0
  38. package/dist/stats.js.map +1 -0
  39. package/dist/store.d.ts +1078 -0
  40. package/dist/store.js +1242 -0
  41. package/dist/store.js.map +1 -0
  42. package/dist/sync.d.ts +26 -0
  43. package/dist/sync.js +47 -0
  44. package/dist/sync.js.map +1 -0
  45. package/drizzle/0000_init.sql +116 -0
  46. package/drizzle/0001_lineage.sql +18 -0
  47. package/drizzle/0002_drop_parent_id.sql +1 -0
  48. package/drizzle/0003_batch_n.sql +8 -0
  49. package/drizzle/0004_score.sql +7 -0
  50. package/drizzle/0005_steers.sql +26 -0
  51. package/drizzle/0006_steers_fk_index.sql +3 -0
  52. package/drizzle/0007_batch_title.sql +1 -0
  53. package/drizzle/0008_calls.sql +24 -0
  54. package/drizzle/0009_content_type.sql +1 -0
  55. package/drizzle/0010_board_pins.sql +33 -0
  56. package/drizzle/0011_pins_fk_indexes.sql +2 -0
  57. package/drizzle/meta/0000_snapshot.json +816 -0
  58. package/drizzle/meta/0001_snapshot.json +918 -0
  59. package/drizzle/meta/0002_snapshot.json +912 -0
  60. package/drizzle/meta/0003_snapshot.json +927 -0
  61. package/drizzle/meta/0004_snapshot.json +941 -0
  62. package/drizzle/meta/0005_snapshot.json +1120 -0
  63. package/drizzle/meta/0006_snapshot.json +1165 -0
  64. package/drizzle/meta/0007_snapshot.json +1171 -0
  65. package/drizzle/meta/0008_snapshot.json +1256 -0
  66. package/drizzle/meta/0009_snapshot.json +1262 -0
  67. package/drizzle/meta/0010_snapshot.json +1493 -0
  68. package/drizzle/meta/0011_snapshot.json +1523 -0
  69. package/drizzle/meta/_journal.json +90 -0
  70. package/package.json +91 -4
@@ -0,0 +1,1078 @@
1
+ import * as pinboard from "./board.js";
2
+ import { type Collector } from "./collect.js";
3
+ import { type Db, type Hooks, type Tx } from "./db.js";
4
+ import { type Anchor, batches, calls, type GuideState, guides, type Kind, notes, samples, ships, steers, subjects, type Tone, type Verdict, type Width } from "./schema.js";
5
+ import { type Strength } from "./stats.js";
6
+ import { type Source } from "./sync.js";
7
+ export interface Ports {
8
+ db: Db;
9
+ /** One per channel samples ship to; none means ships are kept but never read. */
10
+ collectors?: readonly Collector[] | undefined;
11
+ hooks?: Hooks | undefined;
12
+ }
13
+ /** `s3://` (the bucket signs it) or `https://` (served as is: a live page on its own origin). */
14
+ export declare const isMediaUri: (uri: string) => boolean;
15
+ export interface NewSample {
16
+ body?: string | null;
17
+ /** `s3://` uri (the CLI uploads a local file first), or `https://` for a live page. */
18
+ media?: string | null;
19
+ poster?: string | null;
20
+ /** Short name (60 chars at most), hidden while the person judges. */
21
+ name?: string | null;
22
+ /** Earlier samples of the same subject; the first is the main parent. Two or more = a cross. */
23
+ parents?: readonly Parent[];
24
+ guides?: number[];
25
+ change?: string | null;
26
+ /** A video's footage and kept spans, for synced play. */
27
+ source?: Source | null;
28
+ }
29
+ /** A parent's id, or the id with what the child took from it. */
30
+ export type Parent = number | {
31
+ id: number;
32
+ took?: string | null;
33
+ };
34
+ export type SubjectRow = typeof subjects.$inferSelect;
35
+ export type BatchRow = typeof batches.$inferSelect;
36
+ export type SampleRow = typeof samples.$inferSelect;
37
+ /** One sample's fix; a field left out stays, `null` clears it. */
38
+ export interface SampleEdit {
39
+ id: number;
40
+ name?: string | null;
41
+ change?: string | null;
42
+ guides?: number[] | null;
43
+ body?: string | null;
44
+ media?: string | null;
45
+ poster?: string | null;
46
+ source?: Source | null;
47
+ }
48
+ export type CallRow = typeof calls.$inferSelect;
49
+ /** `by` of calls made before calls had a judge (migration 0008); a host may name them after. */
50
+ export declare const EARLIER_JUDGE = "person";
51
+ export type NoteRow = typeof notes.$inferSelect;
52
+ export type GuideRow = typeof guides.$inferSelect;
53
+ export type ShipRow = typeof ships.$inferSelect;
54
+ export type SteerRow = typeof steers.$inferSelect;
55
+ export declare const BATCH_SORTS: readonly ["waiting", "newest", "oldest", "subject", "good"];
56
+ export type BatchSort = (typeof BATCH_SORTS)[number];
57
+ /** A page of batches (D11). `subjects`: only these (a host's folder); `who`: batches they called in. */
58
+ export interface BatchQuery {
59
+ subjects?: readonly number[];
60
+ subject?: string | number;
61
+ kind?: Kind;
62
+ /** waits = open and its subject's newest */
63
+ state?: "open" | "closed" | "waits";
64
+ who?: string;
65
+ /** default waiting: what waits first, then newest */
66
+ sort?: BatchSort;
67
+ limit?: number;
68
+ /** offset: the `next` of the page before */
69
+ after?: number;
70
+ }
71
+ /** A steer to set (D10). pin, prune: `sample`. cross: `sample` and `other`. width: `subject`. */
72
+ export type NewSteer = {
73
+ kind: "pin" | "prune";
74
+ sample: number;
75
+ why?: string | null;
76
+ } | {
77
+ kind: "cross";
78
+ sample: number;
79
+ other: number;
80
+ why?: string | null;
81
+ } | {
82
+ kind: "width";
83
+ subject: string | number;
84
+ width: Width;
85
+ why?: string | null;
86
+ };
87
+ type Called = Pick<CallRow, "sampleId" | "by" | "score" | "verdict">;
88
+ /**
89
+ * One sheet per (batch, person) who called in it: each sample of the batch with that person's
90
+ * call, or none (unmarked). The unit of every rank and rate (D11).
91
+ */
92
+ export declare function sheets(rows: readonly Pick<SampleRow, "id" | "batchId">[], cs: readonly Called[]): {
93
+ batchId: number;
94
+ by: string;
95
+ marks: {
96
+ id: number;
97
+ call: Called | null;
98
+ }[];
99
+ }[];
100
+ /**
101
+ * Strength per judged sample: each sheet is a partial ranking by score, 10 down to 1, ties
102
+ * unordered; unmarked reads as 5. Wins from 9 and up count double.
103
+ */
104
+ export declare function strengths(rows: readonly Pick<SampleRow, "id" | "batchId">[], cs: readonly Called[]): Strength[];
105
+ /** Good or better over every (sample, person) mark of these sheets; null with none. */
106
+ export declare function goodRateOf(ss: ReturnType<typeof sheets>): number | null;
107
+ /** With-vs-without good rate per guide, over every mark in judged batches. */
108
+ export declare function guideStats(guideRows: readonly GuideRow[], judged: readonly SampleRow[], cs: readonly Called[]): {
109
+ effect: {
110
+ with: {
111
+ good: number;
112
+ n: number;
113
+ };
114
+ without: {
115
+ good: number;
116
+ n: number;
117
+ };
118
+ diff: number | null;
119
+ early: boolean;
120
+ };
121
+ text: string;
122
+ id: number;
123
+ kind: "text" | "image" | "video" | "page" | null;
124
+ state: "testing" | "locked" | "dropped";
125
+ by: string | null;
126
+ createdAt: Date;
127
+ subjectId: number | null;
128
+ source: "person" | "study" | "sop" | "skill" | "agent";
129
+ ref: string | null;
130
+ decidedAt: Date | null;
131
+ }[];
132
+ /** How people and agents name a batch: its number within the subject. The id is secondary. */
133
+ export declare const refOf: (slug: string, n: number) => string;
134
+ export declare class Vireo {
135
+ readonly db: Db;
136
+ readonly collectors: readonly Collector[];
137
+ private readonly hooks;
138
+ constructor(p: Ports);
139
+ private write;
140
+ /** The host's push after a commit; a host transaction commits later, so none then. */
141
+ private told;
142
+ subjectOf(ref: string | number, db?: Db | Tx): Promise<SubjectRow>;
143
+ /** A batch by id, or `<subject>:<n>` (its number within the subject). */
144
+ batchOf(ref: string | number, db?: Db | Tx): Promise<number>;
145
+ /** More samples in an open batch: `addBatch` with `into`, the subject read from the batch. */
146
+ appendBatch(ref: string | number, b: {
147
+ why: string;
148
+ title?: string | null;
149
+ agent?: string | null;
150
+ samples: NewSample[];
151
+ }): Promise<{
152
+ samples: number[];
153
+ appended?: boolean;
154
+ batch: string;
155
+ id: number;
156
+ n: number;
157
+ subject: string;
158
+ }>;
159
+ /** A sample of an open batch: a closed batch's calls and notes are its finished ranking. Share lock: a close waits. */
160
+ private markable;
161
+ /** An open batch of this subject, for more samples; a closed one is refused. */
162
+ private openBatch;
163
+ /** Each sample's parent ids in a batch. */
164
+ private parentSetsOf;
165
+ /**
166
+ * Moves an open batch's samples into another open batch of the subject, then deletes the
167
+ * empty one. For a batch that should have been an append.
168
+ */
169
+ mergeBatch(from: string | number, into: string | number, by: string | null): Promise<{
170
+ batch: string;
171
+ id: number;
172
+ merged: {
173
+ batch: string;
174
+ id: number;
175
+ };
176
+ samples: number[];
177
+ }>;
178
+ newSubject(s: {
179
+ slug: string;
180
+ name: string;
181
+ kind: Kind;
182
+ contentType?: string | null;
183
+ brief?: string | null;
184
+ seeds?: string[];
185
+ by?: string | null;
186
+ }): Promise<{
187
+ id: number;
188
+ name: string;
189
+ slug: string;
190
+ kind: "text" | "image" | "video" | "page";
191
+ contentType: string | null;
192
+ brief: string | null;
193
+ seeds: string[];
194
+ state: "open" | "paused" | "done";
195
+ by: string | null;
196
+ createdAt: Date;
197
+ }>;
198
+ listSubjects(): Promise<{
199
+ samples: number;
200
+ kept: number;
201
+ toPick: number;
202
+ id: number;
203
+ slug: string;
204
+ name: string;
205
+ kind: "text" | "image" | "video" | "page";
206
+ contentType: string | null;
207
+ brief: string | null;
208
+ seeds: string[];
209
+ state: "open" | "paused" | "done";
210
+ by: string | null;
211
+ createdAt: Date;
212
+ }[]>;
213
+ /** One batch for review: samples in a shuffled order. */
214
+ /** A new batch, or with `into` (id or `<subject>:<n>`) more samples in an open one. */
215
+ addBatch(ref: string | number, b: {
216
+ why: string;
217
+ title?: string | null;
218
+ agent?: string | null;
219
+ samples: NewSample[];
220
+ into?: string | number | null;
221
+ }): Promise<{
222
+ samples: number[];
223
+ appended?: boolean;
224
+ batch: string;
225
+ id: number;
226
+ n: number;
227
+ subject: string;
228
+ }>;
229
+ /** Live steers of a subject, oldest first. */
230
+ private steersIn;
231
+ /** Pruned sample id → the prune steer that covers it (the oldest, when two do). */
232
+ private prunedIn;
233
+ /** Set a steer (D10). The same live pin, prune or cross again returns the one there. */
234
+ steer(n: NewSteer, by: string | null): Promise<{
235
+ width: "narrow" | "normal" | "wide" | null;
236
+ id: number;
237
+ kind: "pin" | "prune" | "cross" | "width";
238
+ by: string | null;
239
+ createdAt: Date;
240
+ subjectId: number;
241
+ why: string | null;
242
+ sampleId: number | null;
243
+ otherId: number | null;
244
+ endedAt: Date | null;
245
+ endedBy: number | null;
246
+ }>;
247
+ /** Lift a live steer. */
248
+ unsteer(id: number, by: string | null): Promise<{
249
+ id: number;
250
+ subjectId: number;
251
+ kind: "pin" | "prune" | "cross" | "width";
252
+ sampleId: number | null;
253
+ otherId: number | null;
254
+ width: "narrow" | "normal" | "wide" | null;
255
+ why: string | null;
256
+ by: string | null;
257
+ createdAt: Date;
258
+ endedAt: Date | null;
259
+ endedBy: number | null;
260
+ }>;
261
+ /** A subject's live steers, and every sample a prune covers. */
262
+ steersOf(ref: string | number): Promise<{
263
+ steers: {
264
+ id: number;
265
+ subjectId: number;
266
+ kind: "pin" | "prune" | "cross" | "width";
267
+ sampleId: number | null;
268
+ otherId: number | null;
269
+ width: "narrow" | "normal" | "wide" | null;
270
+ why: string | null;
271
+ by: string | null;
272
+ createdAt: Date;
273
+ endedAt: Date | null;
274
+ endedBy: number | null;
275
+ }[];
276
+ pruned: number[];
277
+ }>;
278
+ /**
279
+ * Batches that wait on the person, oldest first, with samples and notes: what they have to pick.
280
+ * `viewer`: a person sees only their own calls and notes (D11).
281
+ */
282
+ queue(ref?: string | number, viewer?: string | null): Promise<{
283
+ batch: {
284
+ id: number;
285
+ subjectId: number;
286
+ n: number;
287
+ title: string | null;
288
+ why: string;
289
+ agent: string | null;
290
+ state: "open" | "closed";
291
+ note: string | null;
292
+ closedAt: Date | null;
293
+ createdAt: Date;
294
+ ref: string;
295
+ };
296
+ subject: {
297
+ id: number;
298
+ slug: string;
299
+ name: string;
300
+ kind: "text" | "image" | "video" | "page";
301
+ contentType: string | null;
302
+ brief: string | null;
303
+ seeds: string[];
304
+ state: "open" | "paused" | "done";
305
+ by: string | null;
306
+ createdAt: Date;
307
+ };
308
+ samples: ({
309
+ calls: {
310
+ id: number;
311
+ sampleId: number;
312
+ by: string;
313
+ score: number;
314
+ verdict: "amazing" | "good" | "okay" | "bad";
315
+ at: Date;
316
+ }[];
317
+ notes: {
318
+ id: number;
319
+ sampleId: number;
320
+ anchor: Anchor | null;
321
+ tone: "good" | "bad" | null;
322
+ text: string | null;
323
+ by: string | null;
324
+ createdAt: Date;
325
+ }[];
326
+ score: null;
327
+ verdict: null;
328
+ id: number;
329
+ batchId: number;
330
+ subjectId: number;
331
+ position: number;
332
+ body: string | null;
333
+ media: string | null;
334
+ poster: string | null;
335
+ source: Source | null;
336
+ name: string | null;
337
+ guides: number[];
338
+ change: string | null;
339
+ agent: string | null;
340
+ keptAt: Date | null;
341
+ createdAt: Date;
342
+ } | {
343
+ calls: {
344
+ id: number;
345
+ sampleId: number;
346
+ by: string;
347
+ score: number;
348
+ verdict: "amazing" | "good" | "okay" | "bad";
349
+ at: Date;
350
+ }[];
351
+ notes: {
352
+ id: number;
353
+ sampleId: number;
354
+ anchor: Anchor | null;
355
+ tone: "good" | "bad" | null;
356
+ text: string | null;
357
+ by: string | null;
358
+ createdAt: Date;
359
+ }[];
360
+ score: number;
361
+ verdict: "amazing" | "good" | "okay" | "bad";
362
+ id: number;
363
+ batchId: number;
364
+ subjectId: number;
365
+ position: number;
366
+ body: string | null;
367
+ media: string | null;
368
+ poster: string | null;
369
+ source: Source | null;
370
+ name: string | null;
371
+ guides: number[];
372
+ change: string | null;
373
+ agent: string | null;
374
+ keptAt: Date | null;
375
+ createdAt: Date;
376
+ })[];
377
+ }[]>;
378
+ private callsOf;
379
+ private notesOf;
380
+ /** Parent edges of these children, main parent first. */
381
+ private lineageOf;
382
+ /**
383
+ * `by`'s call: a 1-10 score, a verdict (its tap score) or null to clear. The verdict follows.
384
+ * One call per person per sample (D11).
385
+ */
386
+ judge(sampleId: number, call: number | Verdict | null, by: string | null): Promise<{
387
+ id: number;
388
+ by: string;
389
+ score: null;
390
+ verdict: null;
391
+ } | {
392
+ id: number;
393
+ by: string;
394
+ score: number;
395
+ verdict: "amazing" | "good" | "okay" | "bad";
396
+ }>;
397
+ addNote(sampleId: number, n: {
398
+ anchor?: Anchor | null;
399
+ tone?: Tone | null;
400
+ text?: string | null;
401
+ }, by: string | null): Promise<{
402
+ text: string | null;
403
+ id: number;
404
+ anchor: Anchor | null;
405
+ by: string | null;
406
+ createdAt: Date;
407
+ sampleId: number;
408
+ tone: "good" | "bad" | null;
409
+ }>;
410
+ dropNote(noteId: number, by: string | null): Promise<{
411
+ done: number[];
412
+ }>;
413
+ /** Close a batch: the person's note goes to the agent with the marks. */
414
+ closeBatch(ref: number | string, note: string | null, by: string | null): Promise<{
415
+ id: number;
416
+ n: number;
417
+ subjectId: number;
418
+ batch: string;
419
+ }>;
420
+ keep(sampleId: number, on: boolean, by: string | null): Promise<{
421
+ id: number;
422
+ keptAt: Date | null;
423
+ }>;
424
+ /** A subject's shown name; the slug stays its ref. */
425
+ setContentType(ref: string | number, type: string, by: string | null): Promise<{
426
+ id: number;
427
+ slug: string;
428
+ contentType: string | null;
429
+ } | undefined>;
430
+ renameSubject(ref: string | number, name: string, by: string | null): Promise<{
431
+ id: number;
432
+ slug: string;
433
+ name: string;
434
+ } | undefined>;
435
+ /** A batch's title (id or `<subject>:<n>`); blank refused. */
436
+ renameBatch(ref: string | number, title: string, by: string | null): Promise<{
437
+ id: number;
438
+ n: number;
439
+ title: string | null;
440
+ }>;
441
+ /** Samples with no poster that can have one: images (a thumb) and live pages (`https://`, a shot); oldest first; one subject or all. */
442
+ posterless(ref?: string | number): Promise<{
443
+ id: number;
444
+ media: string | null;
445
+ }[]>;
446
+ /**
447
+ * A sample's poster (`s3://…` or `https://…`): the thumb a batch row shows. `from`: the media it
448
+ * was made from; the write skips (null) when the sample got a poster or new media meanwhile, so a
449
+ * slow backfill never puts back an old still.
450
+ */
451
+ setPoster(sampleId: number, poster: string, by: string | null, from?: string): Promise<{
452
+ id: number;
453
+ poster: string | null;
454
+ } | null>;
455
+ /**
456
+ * Fix samples in place, all or nothing: the agent's words (`name`, `change`, `guides`) any time;
457
+ * what the person sees (`body`, `media`, `poster`, `source`) only before anyone judged or noted
458
+ * it, since a call or a note points at what was seen. Blank `name` or `change` clears it.
459
+ */
460
+ editSamples(edits: readonly SampleEdit[], by: string | null): Promise<{
461
+ agent: string | null;
462
+ id: number;
463
+ name: string | null;
464
+ createdAt: Date;
465
+ subjectId: number;
466
+ batchId: number;
467
+ position: number;
468
+ body: string | null;
469
+ media: string | null;
470
+ poster: string | null;
471
+ source: Source | null;
472
+ guides: number[];
473
+ change: string | null;
474
+ keptAt: Date | null;
475
+ }[]>;
476
+ addGuide(g: {
477
+ text: string;
478
+ source?: GuideRow["source"];
479
+ ref?: string | null;
480
+ subject?: string | number | null;
481
+ kind?: Kind | null;
482
+ by?: string | null;
483
+ }): Promise<{
484
+ text: string;
485
+ id: number;
486
+ kind: "text" | "image" | "video" | "page" | null;
487
+ state: "testing" | "locked" | "dropped";
488
+ by: string | null;
489
+ createdAt: Date;
490
+ subjectId: number | null;
491
+ source: "person" | "study" | "sop" | "skill" | "agent";
492
+ ref: string | null;
493
+ decidedAt: Date | null;
494
+ }>;
495
+ setGuide(id: number, state: GuideState, by: string | null): Promise<{
496
+ id: number;
497
+ text: string;
498
+ source: "person" | "study" | "sop" | "skill" | "agent";
499
+ ref: string | null;
500
+ subjectId: number | null;
501
+ kind: "text" | "image" | "video" | "page" | null;
502
+ state: "testing" | "locked" | "dropped";
503
+ by: string | null;
504
+ decidedAt: Date | null;
505
+ createdAt: Date;
506
+ }>;
507
+ /** Guides that reach a subject: its own, its kind's, and everyone's. */
508
+ private guidesFor;
509
+ /** Everything about a subject: for the agent's next batch and a page's subject view. */
510
+ feedback(ref: string | number): Promise<{
511
+ /** the subject's board: what people and agents pinned for it (the brief's references) */
512
+ board: pinboard.PinView[];
513
+ steers: {
514
+ id: number;
515
+ subjectId: number;
516
+ kind: "pin" | "prune" | "cross" | "width";
517
+ sampleId: number | null;
518
+ otherId: number | null;
519
+ width: "narrow" | "normal" | "wide" | null;
520
+ why: string | null;
521
+ by: string | null;
522
+ createdAt: Date;
523
+ endedAt: Date | null;
524
+ endedBy: number | null;
525
+ }[];
526
+ pruned: number[];
527
+ subject: {
528
+ id: number;
529
+ name: string;
530
+ slug: string;
531
+ kind: "text" | "image" | "video" | "page";
532
+ contentType: string | null;
533
+ brief: string | null;
534
+ seeds: string[];
535
+ state: "open" | "paused" | "done";
536
+ by: string | null;
537
+ createdAt: Date;
538
+ };
539
+ guides: {
540
+ effect: {
541
+ with: {
542
+ good: number;
543
+ n: number;
544
+ };
545
+ without: {
546
+ good: number;
547
+ n: number;
548
+ };
549
+ diff: number | null;
550
+ early: boolean;
551
+ };
552
+ text: string;
553
+ id: number;
554
+ kind: "text" | "image" | "video" | "page" | null;
555
+ state: "testing" | "locked" | "dropped";
556
+ by: string | null;
557
+ createdAt: Date;
558
+ subjectId: number | null;
559
+ source: "person" | "study" | "sop" | "skill" | "agent";
560
+ ref: string | null;
561
+ decidedAt: Date | null;
562
+ }[];
563
+ batches: {
564
+ goodRate: number | null;
565
+ judges: string[];
566
+ samples: ({
567
+ calls: {
568
+ id: number;
569
+ sampleId: number;
570
+ by: string;
571
+ score: number;
572
+ verdict: "amazing" | "good" | "okay" | "bad";
573
+ at: Date;
574
+ }[];
575
+ strength: Strength | null;
576
+ notes: {
577
+ id: number;
578
+ sampleId: number;
579
+ anchor: Anchor | null;
580
+ tone: "good" | "bad" | null;
581
+ text: string | null;
582
+ by: string | null;
583
+ createdAt: Date;
584
+ }[];
585
+ parents: {
586
+ id: number;
587
+ took: string | null;
588
+ }[];
589
+ score: null;
590
+ verdict: null;
591
+ id: number;
592
+ batchId: number;
593
+ subjectId: number;
594
+ position: number;
595
+ body: string | null;
596
+ media: string | null;
597
+ poster: string | null;
598
+ source: Source | null;
599
+ name: string | null;
600
+ guides: number[];
601
+ change: string | null;
602
+ agent: string | null;
603
+ keptAt: Date | null;
604
+ createdAt: Date;
605
+ } | {
606
+ calls: {
607
+ id: number;
608
+ sampleId: number;
609
+ by: string;
610
+ score: number;
611
+ verdict: "amazing" | "good" | "okay" | "bad";
612
+ at: Date;
613
+ }[];
614
+ strength: Strength | null;
615
+ notes: {
616
+ id: number;
617
+ sampleId: number;
618
+ anchor: Anchor | null;
619
+ tone: "good" | "bad" | null;
620
+ text: string | null;
621
+ by: string | null;
622
+ createdAt: Date;
623
+ }[];
624
+ parents: {
625
+ id: number;
626
+ took: string | null;
627
+ }[];
628
+ score: number;
629
+ verdict: "amazing" | "good" | "okay" | "bad";
630
+ id: number;
631
+ batchId: number;
632
+ subjectId: number;
633
+ position: number;
634
+ body: string | null;
635
+ media: string | null;
636
+ poster: string | null;
637
+ source: Source | null;
638
+ name: string | null;
639
+ guides: number[];
640
+ change: string | null;
641
+ agent: string | null;
642
+ keptAt: Date | null;
643
+ createdAt: Date;
644
+ })[];
645
+ id: number;
646
+ subjectId: number;
647
+ n: number;
648
+ title: string | null;
649
+ why: string;
650
+ agent: string | null;
651
+ state: "open" | "closed";
652
+ note: string | null;
653
+ closedAt: Date | null;
654
+ createdAt: Date;
655
+ ref: string;
656
+ }[];
657
+ leaders: {
658
+ sample: number;
659
+ strength: number;
660
+ se: number;
661
+ }[];
662
+ live: import("./live.js").Live;
663
+ }>;
664
+ /** A subject's board: every pin, with its board position. */
665
+ board(ref: string | number): Promise<{
666
+ subject: {
667
+ id: number;
668
+ slug: string;
669
+ name: string;
670
+ };
671
+ pins: pinboard.PinView[];
672
+ }>;
673
+ /** Pins on a subject's board, in one write. */
674
+ pin(ref: string | number, list: readonly pinboard.NewPin[], by: string | null): Promise<{
675
+ id: number;
676
+ kind: "image" | "video" | "link" | "note" | "sample" | "frame";
677
+ by: string | null;
678
+ createdAt: Date;
679
+ subjectId: number;
680
+ title: string | null;
681
+ why: string | null;
682
+ body: string | null;
683
+ poster: string | null;
684
+ keptAt: Date | null;
685
+ sampleId: number | null;
686
+ url: string | null;
687
+ file: string | null;
688
+ frameId: number | null;
689
+ from: ({
690
+ weaver?: {
691
+ run: string;
692
+ page?: string;
693
+ };
694
+ canon?: string;
695
+ } & Record<string, unknown>) | null;
696
+ x: number;
697
+ y: number;
698
+ w: number | null;
699
+ h: number | null;
700
+ z: number;
701
+ keptBy: string | null;
702
+ canon: string | null;
703
+ updatedAt: Date;
704
+ }[]>;
705
+ movePins(moves: readonly pinboard.PinMove[], by: string | null): Promise<{
706
+ id: number;
707
+ kind: "image" | "video" | "link" | "note" | "sample" | "frame";
708
+ by: string | null;
709
+ createdAt: Date;
710
+ subjectId: number;
711
+ title: string | null;
712
+ why: string | null;
713
+ body: string | null;
714
+ poster: string | null;
715
+ keptAt: Date | null;
716
+ sampleId: number | null;
717
+ url: string | null;
718
+ file: string | null;
719
+ frameId: number | null;
720
+ from: ({
721
+ weaver?: {
722
+ run: string;
723
+ page?: string;
724
+ };
725
+ canon?: string;
726
+ } & Record<string, unknown>) | null;
727
+ x: number;
728
+ y: number;
729
+ w: number | null;
730
+ h: number | null;
731
+ z: number;
732
+ keptBy: string | null;
733
+ canon: string | null;
734
+ updatedAt: Date;
735
+ }[]>;
736
+ editPin(e: pinboard.PinEdit, by: string | null): Promise<{
737
+ id: number;
738
+ kind: "image" | "video" | "link" | "note" | "sample" | "frame";
739
+ by: string | null;
740
+ createdAt: Date;
741
+ subjectId: number;
742
+ title: string | null;
743
+ why: string | null;
744
+ body: string | null;
745
+ poster: string | null;
746
+ keptAt: Date | null;
747
+ sampleId: number | null;
748
+ url: string | null;
749
+ file: string | null;
750
+ frameId: number | null;
751
+ from: ({
752
+ weaver?: {
753
+ run: string;
754
+ page?: string;
755
+ };
756
+ canon?: string;
757
+ } & Record<string, unknown>) | null;
758
+ x: number;
759
+ y: number;
760
+ w: number | null;
761
+ h: number | null;
762
+ z: number;
763
+ keptBy: string | null;
764
+ canon: string | null;
765
+ updatedAt: Date;
766
+ }>;
767
+ unpin(ids: readonly number[], by: string | null): Promise<number[]>;
768
+ /** A person keeps a pin; the host sends it to Canon and stores what it made (`setPinCanon`). */
769
+ keepPin(id: number, on: boolean, by: string | null): Promise<{
770
+ id: number;
771
+ kind: "image" | "video" | "link" | "note" | "sample" | "frame";
772
+ by: string | null;
773
+ createdAt: Date;
774
+ subjectId: number;
775
+ title: string | null;
776
+ why: string | null;
777
+ body: string | null;
778
+ poster: string | null;
779
+ keptAt: Date | null;
780
+ sampleId: number | null;
781
+ url: string | null;
782
+ file: string | null;
783
+ frameId: number | null;
784
+ from: ({
785
+ weaver?: {
786
+ run: string;
787
+ page?: string;
788
+ };
789
+ canon?: string;
790
+ } & Record<string, unknown>) | null;
791
+ x: number;
792
+ y: number;
793
+ w: number | null;
794
+ h: number | null;
795
+ z: number;
796
+ keptBy: string | null;
797
+ canon: string | null;
798
+ updatedAt: Date;
799
+ }>;
800
+ setPinCanon(id: number, canon: string, by: string | null): Promise<{
801
+ id: number;
802
+ kind: "image" | "video" | "link" | "note" | "sample" | "frame";
803
+ by: string | null;
804
+ createdAt: Date;
805
+ subjectId: number;
806
+ title: string | null;
807
+ why: string | null;
808
+ body: string | null;
809
+ poster: string | null;
810
+ keptAt: Date | null;
811
+ sampleId: number | null;
812
+ url: string | null;
813
+ file: string | null;
814
+ frameId: number | null;
815
+ from: ({
816
+ weaver?: {
817
+ run: string;
818
+ page?: string;
819
+ };
820
+ canon?: string;
821
+ } & Record<string, unknown>) | null;
822
+ x: number;
823
+ y: number;
824
+ w: number | null;
825
+ h: number | null;
826
+ z: number;
827
+ keptBy: string | null;
828
+ canon: string | null;
829
+ updatedAt: Date;
830
+ }>;
831
+ /** A sample goes live on a channel's target; `collect` reads its numbers from then on. */
832
+ ship(sampleId: number, o: {
833
+ channel: string;
834
+ target: string;
835
+ why?: string | null;
836
+ }, by: string | null): Promise<{
837
+ id: number;
838
+ by: string | null;
839
+ why: string | null;
840
+ sampleId: number;
841
+ endedAt: Date | null;
842
+ channel: string;
843
+ target: string;
844
+ startedAt: Date;
845
+ }>;
846
+ /** Ends a ship: its numbers stay, frozen at the next collect. */
847
+ unship(shipId: number, by: string | null): Promise<{
848
+ id: number;
849
+ sampleId: number;
850
+ channel: string;
851
+ target: string;
852
+ why: string | null;
853
+ by: string | null;
854
+ startedAt: Date;
855
+ endedAt: Date | null;
856
+ }>;
857
+ /** A subject's ships, newest first. */
858
+ shipsOf(ref: string | number): Promise<{
859
+ id: number;
860
+ sampleId: number;
861
+ channel: string;
862
+ target: string;
863
+ why: string | null;
864
+ by: string | null;
865
+ startedAt: Date;
866
+ endedAt: Date | null;
867
+ }[]>;
868
+ /** Read every live ship's numbers now (or one ship's). */
869
+ collect(o?: {
870
+ ship?: number;
871
+ }): Promise<{
872
+ day: string;
873
+ ships: {
874
+ ship: number;
875
+ rows: number;
876
+ unread?: string;
877
+ }[];
878
+ }>;
879
+ /** Kept samples, newest first, with their subject. */
880
+ /**
881
+ * Batches as a page: filters, a sort and an offset (D11). `viewer` = the person reading: an open
882
+ * batch shows only their own marks, and none of the agent's words.
883
+ */
884
+ batches(q?: BatchQuery, viewer?: string | null): Promise<{
885
+ rows: {
886
+ ref: string;
887
+ id: number;
888
+ n: number;
889
+ title: string | null;
890
+ state: "open" | "closed";
891
+ note: string | null;
892
+ why: string | null;
893
+ createdAt: Date;
894
+ subject: {
895
+ id: number;
896
+ slug: string;
897
+ name: string;
898
+ kind: "text" | "image" | "video" | "page";
899
+ contentType: string | null;
900
+ brief: string | null;
901
+ seeds: string[];
902
+ state: "open" | "paused" | "done";
903
+ by: string | null;
904
+ createdAt: Date;
905
+ };
906
+ waits: boolean;
907
+ samples: number;
908
+ kept: number;
909
+ marked: number;
910
+ judges: number | null;
911
+ goodRate: number | null;
912
+ tally: {
913
+ amazing: number;
914
+ good: number;
915
+ okay: number;
916
+ bad: number;
917
+ unmarked: number;
918
+ } | null;
919
+ thumbs: {
920
+ id: number;
921
+ poster: string;
922
+ verdict: "amazing" | "good" | "okay" | "bad" | null;
923
+ }[];
924
+ }[];
925
+ next: number | null;
926
+ waiting: number;
927
+ }>;
928
+ /** One batch whole, for `viewer` (see `batches`); `newer` = the subject's newer open batch. */
929
+ batch(ref: string | number, viewer?: string | null): Promise<{
930
+ why: string | null;
931
+ subject: {
932
+ id: number;
933
+ slug: string;
934
+ name: string;
935
+ kind: "text" | "image" | "video" | "page";
936
+ contentType: string | null;
937
+ brief: string | null;
938
+ seeds: string[];
939
+ state: "open" | "paused" | "done";
940
+ by: string | null;
941
+ createdAt: Date;
942
+ };
943
+ goodRate: number | null;
944
+ judges: string[] | null;
945
+ newer: {
946
+ n: number;
947
+ ref: string;
948
+ } | null;
949
+ batches: {
950
+ ref: string;
951
+ n: number;
952
+ title: string | null;
953
+ state: "open" | "closed";
954
+ }[];
955
+ samples: ({
956
+ calls: {
957
+ id: number;
958
+ sampleId: number;
959
+ by: string;
960
+ score: number;
961
+ verdict: "amazing" | "good" | "okay" | "bad";
962
+ at: Date;
963
+ }[];
964
+ notes: {
965
+ id: number;
966
+ sampleId: number;
967
+ anchor: Anchor | null;
968
+ tone: "good" | "bad" | null;
969
+ text: string | null;
970
+ by: string | null;
971
+ createdAt: Date;
972
+ }[];
973
+ parents: {
974
+ id: number;
975
+ took: string | null;
976
+ }[];
977
+ score: null;
978
+ verdict: null;
979
+ change: string | null;
980
+ id: number;
981
+ batchId: number;
982
+ subjectId: number;
983
+ position: number;
984
+ body: string | null;
985
+ media: string | null;
986
+ poster: string | null;
987
+ source: Source | null;
988
+ name: string | null;
989
+ guides: number[];
990
+ agent: string | null;
991
+ keptAt: Date | null;
992
+ createdAt: Date;
993
+ } | {
994
+ calls: {
995
+ id: number;
996
+ sampleId: number;
997
+ by: string;
998
+ score: number;
999
+ verdict: "amazing" | "good" | "okay" | "bad";
1000
+ at: Date;
1001
+ }[];
1002
+ notes: {
1003
+ id: number;
1004
+ sampleId: number;
1005
+ anchor: Anchor | null;
1006
+ tone: "good" | "bad" | null;
1007
+ text: string | null;
1008
+ by: string | null;
1009
+ createdAt: Date;
1010
+ }[];
1011
+ parents: {
1012
+ id: number;
1013
+ took: string | null;
1014
+ }[];
1015
+ score: number;
1016
+ verdict: "amazing" | "good" | "okay" | "bad";
1017
+ change: string | null;
1018
+ id: number;
1019
+ batchId: number;
1020
+ subjectId: number;
1021
+ position: number;
1022
+ body: string | null;
1023
+ media: string | null;
1024
+ poster: string | null;
1025
+ source: Source | null;
1026
+ name: string | null;
1027
+ guides: number[];
1028
+ agent: string | null;
1029
+ keptAt: Date | null;
1030
+ createdAt: Date;
1031
+ })[];
1032
+ id: number;
1033
+ subjectId: number;
1034
+ n: number;
1035
+ title: string | null;
1036
+ agent: string | null;
1037
+ state: "open" | "closed";
1038
+ note: string | null;
1039
+ closedAt: Date | null;
1040
+ createdAt: Date;
1041
+ ref: string;
1042
+ }>;
1043
+ catalog(opts?: {
1044
+ kind?: Kind;
1045
+ subject?: string | number;
1046
+ }): Promise<{
1047
+ sample: {
1048
+ id: number;
1049
+ batchId: number;
1050
+ subjectId: number;
1051
+ position: number;
1052
+ body: string | null;
1053
+ media: string | null;
1054
+ poster: string | null;
1055
+ source: Source | null;
1056
+ name: string | null;
1057
+ guides: number[];
1058
+ change: string | null;
1059
+ agent: string | null;
1060
+ keptAt: Date | null;
1061
+ createdAt: Date;
1062
+ };
1063
+ subject: {
1064
+ slug: string;
1065
+ name: string;
1066
+ kind: "text" | "image" | "video" | "page";
1067
+ };
1068
+ }[]>;
1069
+ }
1070
+ /** Read models a host's page renders: no hand-copied types. */
1071
+ export type Queue = Awaited<ReturnType<Vireo["queue"]>>;
1072
+ export type BatchPage = Awaited<ReturnType<Vireo["batches"]>>;
1073
+ export type BatchWhole = Awaited<ReturnType<Vireo["batch"]>>;
1074
+ export type Feedback = Awaited<ReturnType<Vireo["feedback"]>>;
1075
+ export type SubjectList = Awaited<ReturnType<Vireo["listSubjects"]>>;
1076
+ export type Catalog = Awaited<ReturnType<Vireo["catalog"]>>;
1077
+ export type Steers = Awaited<ReturnType<Vireo["steersOf"]>>;
1078
+ export {};