@william_jin/vireo 0.0.0-stage → 0.19.1

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 +24 -0
  13. package/dist/cli.js +496 -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 +25 -0
  28. package/dist/media.js +63 -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 +2103 -0
  34. package/dist/schema.js +362 -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 +1068 -0
  40. package/dist/store.js +1226 -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 @@
1
+ {"version":3,"file":"board.js","sourceRoot":"","sources":["../src/board.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAA2B,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,SAAS,EAA8B,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAoDnF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,QAAQ,GAA8C;IACjE,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;IACxB,KAAK,EAAE,EAAE,CAAC,EA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,CAAC;IAC9F,IAAI,EAAE,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAC7D,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE;SACnB,MAAM,CAAC,IAAI,CAAC;SACZ,GAAG,CACF,EAAE;QACA,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,GAAG,CAAA,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,SAAS,EAAE,GAAG,CAAA,OAAO,EAAE;QACvF,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,CAAA,OAAO,EAAE,CAC1D;SACA,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;SACtB,SAAS,EAAE,CAAC;IACf,OAAO,GAAa,CAAC;AACvB,CAAC;AAED,2CAA2C;AAC3C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAM,EAAE,EAAU,EAAE,KAAa;IACjE,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE;SACnB,MAAM,CAAC,IAAI,CAAC;SACZ,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;SACd,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;SAC3B,SAAS,EAAE,CAAC;IACf,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,UAAU,CAAC,UAAU,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IACpD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,19 @@
1
+ /** A person's call, pure (no drizzle): hosts' browsers import it (`./calls`). D9. */
2
+ /** The call on a whole sample, best first: a zone of the 1-10 score. */
3
+ export declare const VERDICTS: readonly ["amazing", "good", "okay", "bad"];
4
+ export type Verdict = (typeof VERDICTS)[number];
5
+ /** Lowest score of each zone: 9-10 amazing, 7-8 good, 4-6 okay, 1-3 bad. */
6
+ export declare const ZONE_FLOOR: {
7
+ readonly amazing: 9;
8
+ readonly good: 7;
9
+ readonly okay: 4;
10
+ readonly bad: 1;
11
+ };
12
+ /** The score a plain call (a tap, `judge 3 good`) sets. */
13
+ export declare const TAP: {
14
+ readonly amazing: 9;
15
+ readonly good: 7;
16
+ readonly okay: 5;
17
+ readonly bad: 2;
18
+ };
19
+ export declare const verdictOf: (score: number) => Verdict;
package/dist/calls.js ADDED
@@ -0,0 +1,9 @@
1
+ /** A person's call, pure (no drizzle): hosts' browsers import it (`./calls`). D9. */
2
+ /** The call on a whole sample, best first: a zone of the 1-10 score. */
3
+ export const VERDICTS = ["amazing", "good", "okay", "bad"];
4
+ /** Lowest score of each zone: 9-10 amazing, 7-8 good, 4-6 okay, 1-3 bad. */
5
+ export const ZONE_FLOOR = { amazing: 9, good: 7, okay: 4, bad: 1 };
6
+ /** The score a plain call (a tap, `judge 3 good`) sets. */
7
+ export const TAP = { amazing: 9, good: 7, okay: 5, bad: 2 };
8
+ export const verdictOf = (score) => VERDICTS.find((v) => score >= ZONE_FLOOR[v]) ?? "bad";
9
+ //# sourceMappingURL=calls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.js","sourceRoot":"","sources":["../src/calls.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,wEAAwE;AACxE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAEpE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAG/D,CAAC;AACF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAGxD,CAAC;AACF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAW,EAAE,CAClD,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type { Command } from "commander";
2
+ import type { Db } from "./db.js";
3
+ import { type Bucket } from "./media.js";
4
+ import { type NewSample, type Vireo } from "./store.js";
5
+ export interface CliHost {
6
+ /** One command's vireo over the host's db, collectors and hooks; closes after. */
7
+ withVireo<T>(fn: (v: Vireo, db: Db) => Promise<T>): Promise<T>;
8
+ /** Who acts: the audit actor and each row's `by`. */
9
+ by: string;
10
+ /** Where `file`/`posterFile` go; none refuses them. */
11
+ bucket?: Bucket;
12
+ /** A live page's poster as JPEG bytes (wren: its render Lambda); none: posterless pages stay so. */
13
+ shoot?(url: string): Promise<Uint8Array>;
14
+ /** Content types a subject may take (wren: its playbook's list); none: any text. */
15
+ contentTypes?: readonly string[];
16
+ /** Fills a batch file's own fields (wren: `studio` → source); runs before upload. */
17
+ resolve?(raw: Record<string, unknown>, db: Db): Promise<Partial<NewSample>>;
18
+ /** A link's title and still from its page (wren: its `og:` tags); none: a pin shows its link. */
19
+ unfurl?(url: string): Promise<{
20
+ title?: string | null;
21
+ poster?: string | null;
22
+ }>;
23
+ }
24
+ export declare function registerCommands(c: Command, host: CliHost): Command;
package/dist/cli.js ADDED
@@ -0,0 +1,496 @@
1
+ /**
2
+ * The agent's hands: `registerCommands(cmd, host)` adds every vireo command to a commander
3
+ * command (the host's `variants`, or `vireo` itself). JSON out.
4
+ */
5
+ import { readFile } from "node:fs/promises";
6
+ import { resolve } from "node:path";
7
+ import { upload } from "./media.js";
8
+ import { GUIDE_SOURCES, KINDS, TONES, VERDICTS, WIDTHS, } from "./schema.js";
9
+ import { BATCH_SORTS, } from "./store.js";
10
+ const json = (v) => console.log(JSON.stringify(v, null, 2));
11
+ const sayView = (v) => {
12
+ if (v)
13
+ console.error(`::view ${v[0]} ${JSON.stringify(v[1])}`);
14
+ };
15
+ const batchView = (ref) => typeof ref === "string" || typeof ref === "number"
16
+ ? ["vireo.batch", { batch: String(ref) }]
17
+ : null;
18
+ const subjectView = (id) => typeof id === "number" ? ["vireo.subject", { subject: id }] : null;
19
+ const id = (v) => {
20
+ const n = Number(v);
21
+ if (!Number.isSafeInteger(n) || n <= 0)
22
+ throw new Error(`not an id: ${v}`);
23
+ return n;
24
+ };
25
+ const oneOf = (v, all, what) => {
26
+ if (!all.includes(v))
27
+ throw new Error(`${what}: one of ${all.join(", ")}`);
28
+ return v;
29
+ };
30
+ const many = (v, acc) => [...acc, v];
31
+ /** render Lambda calls at once */
32
+ const SHOTS_AT_ONCE = 4;
33
+ /** `fn` over `xs`, at most `n` at once; results in input order */
34
+ async function inPool(xs, n, fn) {
35
+ const out = new Array(xs.length);
36
+ let next = 0;
37
+ const lane = async () => {
38
+ while (next < xs.length) {
39
+ const i = next++;
40
+ out[i] = await fn(xs[i]);
41
+ }
42
+ };
43
+ await Promise.all(Array.from({ length: Math.min(n, xs.length) }, lane));
44
+ return out;
45
+ }
46
+ export function registerCommands(c, host) {
47
+ const by = host.by;
48
+ // host list set: a type is required and must be on it
49
+ const typeOf = (t) => {
50
+ const v = t?.trim() || null;
51
+ const all = host.contentTypes;
52
+ if (!all?.length)
53
+ return v;
54
+ if (!v)
55
+ throw new Error(`--type: one of ${all.join(", ")}`);
56
+ return oneOf(v, all, "type");
57
+ };
58
+ const run = (fn, view) => host.withVireo(async (v, db) => {
59
+ const out = await fn(v, db);
60
+ json(out);
61
+ sayView(view?.(out) ?? null);
62
+ });
63
+ c.command("new <slug>")
64
+ .description("A subject to iterate on; --brief is the person's direction (none: from scratch)")
65
+ .requiredOption("--name <name>")
66
+ .requiredOption("--kind <kind>", KINDS.join("|"))
67
+ .option("--type <type>", "what the piece is; required when the host lists types")
68
+ .option("--brief <text>")
69
+ .option("--seed <ref>", "a study, doc path, sample id or file (repeat)", many, [])
70
+ .action((slug, o) => run((v) => v.newSubject({
71
+ slug,
72
+ name: o.name,
73
+ kind: oneOf(o.kind, KINDS, "kind"),
74
+ contentType: typeOf(o.type),
75
+ brief: o.brief ?? null,
76
+ seeds: o.seed,
77
+ by,
78
+ }), (out) => subjectView(out.id)));
79
+ c.command("posters [subject]")
80
+ .description("Shoots a poster for each live-page sample (https media) that has none, so its batch row shows a thumb")
81
+ .action((subject) => run(async (v) => {
82
+ if (!host.shoot || !host.bucket)
83
+ throw new Error("no shooter or bucket on this host");
84
+ const done = [];
85
+ const failed = [];
86
+ const rows = await v.posterless(subject);
87
+ const uris = await inPool(rows, SHOTS_AT_ONCE, (x) => shot(x.media));
88
+ for (const [i, x] of rows.entries()) {
89
+ const uri = uris[i];
90
+ if (uri)
91
+ done.push(await v.setPoster(x.id, uri, by));
92
+ else
93
+ failed.push({ id: x.id, media: x.media });
94
+ }
95
+ return { done, failed };
96
+ }));
97
+ c.command("list")
98
+ .description("Subjects with sample, kept and to-pick counts")
99
+ .action(() => run((v) => v.listSubjects()));
100
+ c.command("show <subject>")
101
+ .description("Everything for the next batch: brief, guides with with-vs-without rates, each batch's why, note, calls, anchored notes, strengths, live numbers")
102
+ .action((s) => run((v) => v.feedback(s), (f) => subjectView(f.subject.id)));
103
+ c.command("board <subject>")
104
+ .description("A subject's board: every pin (link, image, video, note, sample, frame), with its board x and y")
105
+ .action((s) => run((v) => v.board(s), (b) => subjectView(b.subject.id)));
106
+ /** A pin from flags or a JSON item: a local file uploaded, a bare link unfurled. */
107
+ const pinIn = async (x, base) => {
108
+ const file = x.file && !/^s3:\/\//i.test(x.file)
109
+ ? await (async () => {
110
+ if (!host.bucket)
111
+ throw new Error("no bucket: set one to upload files");
112
+ return upload(host.bucket, resolve(base, x.file));
113
+ })()
114
+ : (x.file ?? null);
115
+ let { title = null, poster = null } = x;
116
+ if (x.url && (!title || !poster) && host.unfurl && !x.sampleId) {
117
+ const u = await host.unfurl(x.url).catch(() => null);
118
+ title ||= u?.title ?? null;
119
+ poster ||= u?.poster ?? null;
120
+ }
121
+ return { ...x, file, title, poster };
122
+ };
123
+ const coord = (v) => (v == null ? undefined : Number(v));
124
+ c.command("pin <subject>")
125
+ .description("Pins on a subject's board: --url, --file, --note, --sample, or --json {pins: [...]} for many. No --x/--y: the first free cell")
126
+ .option("--url <link>", "a post, a page, a picture or a video")
127
+ .option("--file <path>", "a local picture or video (uploaded)")
128
+ .option("--note <text>", "a note: words on the board")
129
+ .option("--sample <id>", "a sample of this subject")
130
+ .option("--title <text>")
131
+ .option("--why <text>", "why it is here: what to take from it")
132
+ .option("--poster <uri>", "a still (https or s3)")
133
+ .option("--frame <id>", "the frame it goes in")
134
+ .option("--from <json>", 'where it came from: {"weaver": {"run": "…", "page": "…"}}')
135
+ .option("--x <n>")
136
+ .option("--y <n>")
137
+ .option("--w <n>")
138
+ .option("--h <n>")
139
+ .option("--json <file>", "many pins; - reads stdin")
140
+ .action((subject, o) => run(async (v) => {
141
+ const base = o.json && o.json !== "-" ? resolve(o.json, "..") : process.cwd();
142
+ const raw = o.json
143
+ ? (JSON.parse(o.json === "-" ? await stdin() : await readFile(o.json, "utf8")).pins ?? [])
144
+ : [
145
+ {
146
+ url: o.url ?? null,
147
+ file: o.file ?? null,
148
+ body: o.note ?? null,
149
+ sampleId: o.sample ? id(o.sample) : null,
150
+ title: o.title ?? null,
151
+ why: o.why ?? null,
152
+ poster: o.poster ?? null,
153
+ frameId: o.frame ? id(o.frame) : null,
154
+ from: o.from ? JSON.parse(o.from) : null,
155
+ x: coord(o.x) ?? null,
156
+ y: coord(o.y) ?? null,
157
+ w: coord(o.w) ?? null,
158
+ h: coord(o.h) ?? null,
159
+ },
160
+ ];
161
+ const list = await inPool(raw, SHOTS_AT_ONCE, (x) => pinIn(x, base));
162
+ return v.pin(subject, list, by);
163
+ }));
164
+ c.command("frame <subject> <title>")
165
+ .description("A frame on the board: a titled region; pins put in it move with it")
166
+ .option("--x <n>")
167
+ .option("--y <n>")
168
+ .option("--w <n>")
169
+ .option("--h <n>")
170
+ .option("--why <text>")
171
+ .action((subject, title, o) => run((v) => v.pin(subject, [
172
+ {
173
+ kind: "frame",
174
+ title,
175
+ why: o.why ?? null,
176
+ x: coord(o.x) ?? null,
177
+ y: coord(o.y) ?? null,
178
+ w: coord(o.w) ?? null,
179
+ h: coord(o.h) ?? null,
180
+ },
181
+ ], by)));
182
+ c.command("move <pin>")
183
+ .description("Moves or resizes a pin; --frame puts it in a frame (x and y then count from its corner), --out takes it out")
184
+ .option("--x <n>")
185
+ .option("--y <n>")
186
+ .option("--w <n>")
187
+ .option("--h <n>")
188
+ .option("--z <n>", "stack order: higher is on top")
189
+ .option("--frame <id>")
190
+ .option("--out", "out of its frame, onto the board")
191
+ .action((pin, o) => run((v) => v.movePins([
192
+ {
193
+ id: id(pin),
194
+ ...(o.x != null ? { x: Number(o.x) } : {}),
195
+ ...(o.y != null ? { y: Number(o.y) } : {}),
196
+ ...(o.w != null ? { w: Number(o.w) } : {}),
197
+ ...(o.h != null ? { h: Number(o.h) } : {}),
198
+ ...(o.z != null ? { z: Number(o.z) } : {}),
199
+ ...(o.out ? { frameId: null } : o.frame ? { frameId: id(String(o.frame)) } : {}),
200
+ },
201
+ ], by)));
202
+ c.command("pin-edit <pin>")
203
+ .description("A pin's words: --title, --body (a note's text), --why, --url, --poster; \"\" clears")
204
+ .option("--title <text>")
205
+ .option("--body <text>")
206
+ .option("--why <text>")
207
+ .option("--url <link>")
208
+ .option("--poster <uri>")
209
+ .action((pin, o) => run((v) => v.editPin({ id: id(pin), ...o }, by)));
210
+ c.command("unpin <pins...>")
211
+ .description("Takes pins off the board; a frame's pins stay where they were")
212
+ .action((ids) => run((v) => v.unpin(ids.map((x) => id(x)), by)));
213
+ /** A live page's poster in the bucket; a failed shot leaves none (the page still opens). */
214
+ const shot = async (media) => {
215
+ if (typeof media !== "string" || !/^https:\/\//i.test(media))
216
+ return null;
217
+ if (!host.shoot || !host.bucket)
218
+ return null;
219
+ try {
220
+ return await host.bucket.put(await host.shoot(media), ".jpg");
221
+ }
222
+ catch (err) {
223
+ console.error(`no poster for ${media}: ${err.message}`);
224
+ return null;
225
+ }
226
+ };
227
+ /** Samples from JSON (file or stdin), files uploaded; for add and append. */
228
+ const samplesIn = async (file, db) => {
229
+ const b = JSON.parse(file ? await readFile(file, "utf8") : await stdin());
230
+ const base = file ? resolve(file, "..") : process.cwd();
231
+ if (b.samples?.some((x) => x.file || x.posterFile) && !host.bucket)
232
+ throw new Error("no bucket: set one to upload files");
233
+ const up = (p) => typeof p === "string" ? upload(host.bucket, resolve(base, p)) : null;
234
+ const samples = [];
235
+ for (const x of b.samples ?? []) {
236
+ const own = host.resolve ? await host.resolve(x, db) : {};
237
+ const y = { ...x, ...own };
238
+ if ("parent" in y)
239
+ throw new Error("parent is now parents: [id] or [{id, took}]");
240
+ samples.push({
241
+ body: y.body ?? null,
242
+ media: y.media ?? (await up(y.file)),
243
+ poster: y.poster ?? (await up(y.posterFile)),
244
+ name: y.name ?? null,
245
+ parents: y.parents ?? [],
246
+ guides: y.guides ?? [],
247
+ change: y.change ?? null,
248
+ source: y.source ?? null,
249
+ });
250
+ }
251
+ // live pages: shots in parallel, ~10 s each
252
+ const shots = await inPool(samples, SHOTS_AT_ONCE, async (x) => x.poster ? null : shot(x.media));
253
+ for (const [i, x] of samples.entries())
254
+ x.poster ??= shots[i] ?? null;
255
+ return { title: b.title ?? null, why: b.why, agent: b.agent ?? by, samples };
256
+ };
257
+ /** Edits from flags or JSON; files uploaded, a new page's still shot. */
258
+ const editsIn = async (sample, o, db) => {
259
+ const base = o.json && o.json !== "-" ? resolve(o.json, "..") : process.cwd();
260
+ const raw = o.json
261
+ ? (JSON.parse(o.json === "-" ? await stdin() : await readFile(o.json, "utf8")).samples ?? [])
262
+ : [
263
+ {
264
+ id: id(sample),
265
+ ...(o.name !== undefined ? { name: o.name } : {}),
266
+ ...(o.change !== undefined ? { change: o.change } : {}),
267
+ ...(o.guides !== undefined
268
+ ? {
269
+ guides: o.guides
270
+ .split(",")
271
+ .filter(Boolean)
272
+ .map((g) => id(g.trim())),
273
+ }
274
+ : {}),
275
+ ...(o.body !== undefined ? { body: o.body } : {}),
276
+ ...(o.file !== undefined ? { file: o.file } : {}),
277
+ ...(o.media !== undefined ? { media: o.media } : {}),
278
+ ...(o.poster !== undefined ? { poster: o.poster } : {}),
279
+ ...(o.posterFile !== undefined ? { posterFile: o.posterFile } : {}),
280
+ },
281
+ ];
282
+ if (raw.some((x) => x.file || x.posterFile) && !host.bucket)
283
+ throw new Error("no bucket: set one to upload files");
284
+ const out = [];
285
+ for (const x of raw) {
286
+ const own = host.resolve ? await host.resolve(x, db) : {};
287
+ const { file, posterFile, ...y } = { ...x, ...own };
288
+ const e = { ...y, id: Number(y.id) };
289
+ if (file)
290
+ e.media = await upload(host.bucket, resolve(base, file));
291
+ if (posterFile)
292
+ e.poster = await upload(host.bucket, resolve(base, posterFile));
293
+ // a new file and no still: a page gets a new shot, else the old still goes
294
+ if (e.media !== undefined && e.poster === undefined)
295
+ e.poster = await shot(e.media);
296
+ out.push(e);
297
+ }
298
+ return out;
299
+ };
300
+ const SHAPE = "JSON (file or stdin): {title (one line the person sees: what the batch is; append keeps it), why, agent, samples:[{body | file | media, posterFile?, name?, parents?: [id | {id, took}], guides?, change?, source?}]}. Files go to the bucket; media may be an https:// url (a live page)";
301
+ c.command("add <subject> [file]")
302
+ .description(`A new batch from ${SHAPE}`)
303
+ .action((s, file) => run(async (v, db) => {
304
+ await v.subjectOf(s);
305
+ return v.addBatch(s, await samplesIn(file, db));
306
+ }, (b) => batchView(b.batch)));
307
+ c.command("append <batch> [file]")
308
+ .description(`More samples in an open batch (<subject>:<n> or id), from the same ${SHAPE}. A closed batch is refused`)
309
+ .action((b, file) => run(async (v, db) => v.appendBatch(b, await samplesIn(file, db)), (out) => batchView(out.batch)));
310
+ c.command("queue [ref]")
311
+ .description("Open batches waiting on the person, with their samples and notes (a subject, or <subject>:<n>)")
312
+ .action((s) => run((v) => v.queue(s), () => (s && /:\d+$/.test(s) ? batchView(s) : null)));
313
+ c.command("batches")
314
+ .description("A page of batches: counts, tally and good rate (an open batch shows only --as's own marks)")
315
+ .option("--subject <subject>", "one subject")
316
+ .option("--kind <kind>", KINDS.join("|"))
317
+ .option("--state <state>", "open|closed|waits")
318
+ .option("--who <person>", "batches this person called in")
319
+ .option("--sort <sort>", BATCH_SORTS.join("|"))
320
+ .option("--limit <n>", "30 by default, 100 at most")
321
+ .option("--after <n>", "the next of the page before")
322
+ .option("--as <person>", "read as this person (blind on open batches)")
323
+ .action((o) => run((v) => v.batches({
324
+ ...(o.subject ? { subject: o.subject } : {}),
325
+ ...(o.kind ? { kind: oneOf(o.kind, KINDS, "kind") } : {}),
326
+ ...(o.state
327
+ ? { state: oneOf(o.state, ["open", "closed", "waits"], "state") }
328
+ : {}),
329
+ ...(o.who ? { who: o.who } : {}),
330
+ ...(o.sort ? { sort: oneOf(o.sort, BATCH_SORTS, "sort") } : {}),
331
+ ...(o.limit ? { limit: Number(o.limit) } : {}),
332
+ ...(o.after ? { after: Number(o.after) } : {}),
333
+ }, o.as ?? null)));
334
+ c.command("batch <batch>")
335
+ .description("One batch whole (<subject>:<n> or id), every call by who made it")
336
+ .option("--as <person>", "read as this person (blind while open)")
337
+ .action((b, o) => run((v) => v.batch(b, o.as ?? null), (w) => batchView(w.ref)));
338
+ c.command("judge <sample> <call>")
339
+ .description(`1-10, ${VERDICTS.join("|")} (its tap score) or clear. One call per person: --for names whose`)
340
+ .option("--for <person>", "the person whose call this is (their spoken call); default the actor")
341
+ .action((s, call, o) => run((v) => v.judge(id(s), call === "clear"
342
+ ? null
343
+ : /^\d+$/.test(call)
344
+ ? Number(call)
345
+ : oneOf(call, VERDICTS, "call"), o.for ?? by)));
346
+ c.command("note <sample> [text]")
347
+ .description("A note on a sample; --quote, --at or --box anchors it")
348
+ .option("--tone <tone>", TONES.join("|"))
349
+ .option("--quote <words>", "the exact words it points at")
350
+ .option("--at <range>", "seconds on a video: 12.5 or 12.5-15")
351
+ .option("--box <x,y,w,h>", "fractions of the frame")
352
+ .action((s, text, o) => run((v) => {
353
+ const box = o.box ? boxOf(o.box) : undefined;
354
+ const [start, end] = (o.at ?? "").split("-").map(Number);
355
+ const anchor = o.quote
356
+ ? { type: "quote", exact: o.quote }
357
+ : o.at
358
+ ? {
359
+ type: "time",
360
+ start: start ?? 0,
361
+ ...(end ? { end } : {}),
362
+ ...(box ? { box } : {}),
363
+ }
364
+ : box
365
+ ? { type: "box", ...box }
366
+ : null;
367
+ const tone = o.tone ? oneOf(o.tone, TONES, "tone") : null;
368
+ return v.addNote(id(s), { anchor, tone, text: text ?? null }, by);
369
+ }));
370
+ c.command("close <batch>")
371
+ .description("Close a batch (id or <subject>:<n>); --note is the guide for the next one")
372
+ .option("--note <text>")
373
+ .action((b, o) => run((v) => v.closeBatch(b, o.note ?? null, by), () => batchView(b)));
374
+ c.command("merge <from> <into>")
375
+ .description("Move an open batch's samples into another open batch of its subject, then delete the empty one (<subject>:<n> or id)")
376
+ .action((a, b) => run((v) => v.mergeBatch(a, b, by)));
377
+ c.command("keep <sample>")
378
+ .description("Put a sample in the catalog (--off takes it out)")
379
+ .option("--off")
380
+ .action((s, o) => run((v) => v.keep(id(s), !o.off, by)));
381
+ c.command("catalog")
382
+ .description("Kept samples, newest first")
383
+ .option("--kind <kind>")
384
+ .option("--subject <subject>")
385
+ .action((o) => run((v) => v.catalog({
386
+ ...(o.kind ? { kind: oneOf(o.kind, KINDS, "kind") } : {}),
387
+ ...(o.subject ? { subject: o.subject } : {}),
388
+ })));
389
+ c.command("ship <sample> <channel> <target>")
390
+ .description("A sample goes live on a channel's target; its numbers come back per segment (`live`). `channels` lists them")
391
+ .option("--why <text>")
392
+ .action((s, channel, target, o) => run((v) => v.ship(id(s), { channel, target, why: o.why ?? null }, by)));
393
+ c.command("channels")
394
+ .description("Channels this host collects: target id shape, rates, means")
395
+ .action(() => run(async (v) => v.collectors.map((x) => ({
396
+ channel: x.channel,
397
+ target: x.target,
398
+ rates: x.rates,
399
+ means: x.means ?? null,
400
+ }))));
401
+ c.command("unship <ship>")
402
+ .description("End a ship; its numbers stay")
403
+ .action((x) => run((v) => v.unship(id(x), by)));
404
+ c.command("live <subject>")
405
+ .description("Live numbers per segment: each shipped sample's rates, 95% range, P(best); and its ships")
406
+ .action((s) => run(async (v) => ({ ...(await v.feedback(s)).live, ships: await v.shipsOf(s) })));
407
+ c.command("collect")
408
+ .description("Read every live ship's numbers now (a host's loop runs this)")
409
+ .option("--ship <ship>")
410
+ .action((o) => run((v) => v.collect(o.ship ? { ship: id(o.ship) } : {})));
411
+ c.command("edit [sample]")
412
+ .description("Fix a sample in place, never by a new batch. The agent's words any time; what the person sees (body, file, media, poster, source) only before a call or a note. Many at once: --json <file|-> with {samples: [{id, ...the same fields}]}, all or nothing")
413
+ .option("--name <text>", 'up to 60 characters; "" clears it')
414
+ .option("--change <text>", 'what differs from its parent; "" clears it')
415
+ .option("--guides <ids>", 'the guide ids it applies, comma separated; "" clears them')
416
+ .option("--body <text>", "the inline text or page html")
417
+ .option("--file <path>", "a new file, uploaded")
418
+ .option("--media <uri>", "an s3:// or https:// uri")
419
+ .option("--poster <uri>", "a still's s3:// or https:// uri")
420
+ .option("--poster-file <path>", "a new still, uploaded")
421
+ .option("--json <file>", "edits for many samples; - reads stdin")
422
+ .action(async (sample, o) => {
423
+ if (!sample === !o.json)
424
+ throw new Error("one sample with flags, or --json, not both");
425
+ await run(async (v, db) => v.editSamples(await editsIn(sample, o, db), by));
426
+ });
427
+ c.command("type <subject> <type>")
428
+ .description("Set what a subject's pieces are (content type)")
429
+ .action((s, t) => run((v) => v.setContentType(s, typeOf(t), by)));
430
+ const rn = c.command("rename").description("A new shown name; a subject's slug stays its ref");
431
+ rn.command("subject <subject> <name>").action((s, n) => run((v) => v.renameSubject(s, n, by)));
432
+ rn.command("batch <batch> <title>")
433
+ .description("A batch's one-line title (<subject>:<n> or id), up to 120 characters")
434
+ .action((b, t) => run((v) => v.renameBatch(b, t, by)));
435
+ const st = c
436
+ .command("steer")
437
+ .description("The person's hand on the tree: pin, prune, cross, width; lift ends one. `add` refuses a batch that breaks a live steer");
438
+ st.command("pin <sample>")
439
+ .description("Every new batch grows at least one sample from it")
440
+ .option("--why <text>")
441
+ .action((x, o) => run((v) => v.steer({ kind: "pin", sample: id(x), why: o.why ?? null }, by)));
442
+ st.command("prune <sample>")
443
+ .description("No new sample grows from it or from anything that grew from it")
444
+ .option("--why <text>")
445
+ .action((x, o) => run((v) => v.steer({ kind: "prune", sample: id(x), why: o.why ?? null }, by)));
446
+ st.command("cross <a> <b>")
447
+ .description("The next batch has a sample with both as parents; that batch ends it")
448
+ .option("--why <text>")
449
+ .action((a, b, o) => run((v) => v.steer({ kind: "cross", sample: id(a), other: id(b), why: o.why ?? null }, by)));
450
+ st.command("width <subject> <width>")
451
+ .description(`How far samples move from their parents: ${WIDTHS.join("|")}`)
452
+ .option("--why <text>")
453
+ .action((s, w, o) => run((v) => v.steer({ kind: "width", subject: s, width: oneOf(w, WIDTHS, "width"), why: o.why ?? null }, by)));
454
+ st.command("lift <steer>")
455
+ .description("End a live steer")
456
+ .action((x) => run((v) => v.unsteer(id(x), by)));
457
+ st.command("list <subject>")
458
+ .description("Live steers, and every sample a prune covers")
459
+ .action((s) => run((v) => v.steersOf(s)));
460
+ const g = c
461
+ .command("guide")
462
+ .description("Tips the agent writes from: testing, locked (a rule), dropped");
463
+ g.command("add <text>")
464
+ .option("--subject <subject>", "only this subject")
465
+ .option("--kind <kind>", "every subject of this kind")
466
+ .option("--source <source>", GUIDE_SOURCES.join("|"), "person")
467
+ .option("--ref <ref>", "study, doc path or skill name")
468
+ .action((text, o) => run((v) => v.addGuide({
469
+ text,
470
+ subject: o.subject ?? null,
471
+ kind: o.kind ? oneOf(o.kind, KINDS, "kind") : null,
472
+ source: oneOf(o.source, GUIDE_SOURCES, "source"),
473
+ ref: o.ref ?? null,
474
+ by,
475
+ })));
476
+ for (const [verb, state] of [
477
+ ["lock", "locked"],
478
+ ["drop", "dropped"],
479
+ ["test", "testing"],
480
+ ])
481
+ g.command(`${verb} <guide>`).action((x) => run((v) => v.setGuide(id(x), state, by)));
482
+ return c;
483
+ }
484
+ function boxOf(s) {
485
+ const [x, y, w, h] = s.split(",").map(Number);
486
+ if ([x, y, w, h].some((n) => n == null || !Number.isFinite(n)))
487
+ throw new Error("--box x,y,w,h");
488
+ return { x: x, y: y, w: w, h: h };
489
+ }
490
+ async function stdin() {
491
+ const chunks = [];
492
+ for await (const c of process.stdin)
493
+ chunks.push(c);
494
+ return Buffer.concat(chunks).toString("utf8");
495
+ }
496
+ //# sourceMappingURL=cli.js.map