narrarium-engine 0.1.23 → 0.1.25
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.
- package/README.md +21 -2
- package/dist/autopilot/campaign.d.ts +9 -2
- package/dist/autopilot/campaign.d.ts.map +1 -1
- package/dist/autopilot/campaign.js +84 -14
- package/dist/autopilot/campaign.js.map +1 -1
- package/dist/autopilot/design.d.ts +77 -0
- package/dist/autopilot/design.d.ts.map +1 -0
- package/dist/autopilot/design.js +234 -0
- package/dist/autopilot/design.js.map +1 -0
- package/dist/autopilot/estimate-texts.d.ts +6 -0
- package/dist/autopilot/estimate-texts.d.ts.map +1 -1
- package/dist/autopilot/estimate-texts.js +20 -7
- package/dist/autopilot/estimate-texts.js.map +1 -1
- package/dist/autopilot/estimate.d.ts +29 -1
- package/dist/autopilot/estimate.d.ts.map +1 -1
- package/dist/autopilot/estimate.js +98 -32
- package/dist/autopilot/estimate.js.map +1 -1
- package/dist/autopilot/frozen.d.ts +2 -0
- package/dist/autopilot/frozen.d.ts.map +1 -1
- package/dist/autopilot/frozen.js.map +1 -1
- package/dist/autopilot/outline-check.d.ts +9 -0
- package/dist/autopilot/outline-check.d.ts.map +1 -1
- package/dist/autopilot/outline-check.js +16 -0
- package/dist/autopilot/outline-check.js.map +1 -1
- package/dist/autopilot/outline-compose.d.ts +3 -3
- package/dist/autopilot/outline-compose.d.ts.map +1 -1
- package/dist/autopilot/outline-compose.js +4 -4
- package/dist/autopilot/outline-compose.js.map +1 -1
- package/dist/autopilot/planner.d.ts +10 -10
- package/dist/autopilot/planner.d.ts.map +1 -1
- package/dist/autopilot/planner.js +220 -37
- package/dist/autopilot/planner.js.map +1 -1
- package/dist/autopilot/prompts.d.ts +18 -0
- package/dist/autopilot/prompts.d.ts.map +1 -1
- package/dist/autopilot/prompts.js +163 -0
- package/dist/autopilot/prompts.js.map +1 -1
- package/dist/autopilot/review-policy.d.ts +25 -5
- package/dist/autopilot/review-policy.d.ts.map +1 -1
- package/dist/autopilot/review-policy.js +84 -2
- package/dist/autopilot/review-policy.js.map +1 -1
- package/dist/autopilot/review-readers.d.ts +69 -0
- package/dist/autopilot/review-readers.d.ts.map +1 -0
- package/dist/autopilot/review-readers.js +79 -0
- package/dist/autopilot/review-readers.js.map +1 -0
- package/dist/autopilot/runner.d.ts.map +1 -1
- package/dist/autopilot/runner.js +22 -3
- package/dist/autopilot/runner.js.map +1 -1
- package/dist/autopilot/state.d.ts +20 -1
- package/dist/autopilot/state.d.ts.map +1 -1
- package/dist/autopilot/state.js +139 -5
- package/dist/autopilot/state.js.map +1 -1
- package/dist/autopilot/tasks.d.ts +3 -1
- package/dist/autopilot/tasks.d.ts.map +1 -1
- package/dist/autopilot/tasks.js +509 -67
- package/dist/autopilot/tasks.js.map +1 -1
- package/dist/autopilot/types.d.ts +164 -8
- package/dist/autopilot/types.d.ts.map +1 -1
- package/dist/autopilot/types.js +6 -0
- package/dist/autopilot/types.js.map +1 -1
- package/dist/book/design.d.ts +265 -0
- package/dist/book/design.d.ts.map +1 -0
- package/dist/book/design.js +632 -0
- package/dist/book/design.js.map +1 -0
- package/dist/book/outline.d.ts +20 -4
- package/dist/book/outline.d.ts.map +1 -1
- package/dist/book/outline.js +46 -9
- package/dist/book/outline.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/server/client.d.ts +2 -1
- package/dist/server/client.d.ts.map +1 -1
- package/dist/server/client.js +15 -3
- package/dist/server/client.js.map +1 -1
- package/dist/server/protocol.d.ts +28 -0
- package/dist/server/protocol.d.ts.map +1 -1
- package/dist/server/protocol.js +34 -0
- package/dist/server/protocol.js.map +1 -1
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +67 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -14,4 +14,22 @@ export declare const FINDINGS_TOOL: AiJsonSchema;
|
|
|
14
14
|
export declare const CHAPTER_REVIEW_TOOL: AiJsonSchema;
|
|
15
15
|
export declare const CONSOLIDATION_TOOL: AiJsonSchema;
|
|
16
16
|
export declare const IMPACT_TOOL: AiJsonSchema;
|
|
17
|
+
/** The foundation of a design: the concept's, with the relationships of the cast, the items that matter, the rules of the world and what each secret misleads and changes. */
|
|
18
|
+
export declare const DESIGN_CONCEPT_TOOL: AiJsonSchema;
|
|
19
|
+
/** The design of a batch of chapters (no prose), and where the secrets fall in it. */
|
|
20
|
+
export declare const DESIGN_PLAN_TOOL: AiJsonSchema;
|
|
21
|
+
/** A reader's reaction to a design: the plan's, with what falls flat and the reader's own proposal. */
|
|
22
|
+
export declare const DESIGN_REACTION_TOOL: AiJsonSchema;
|
|
23
|
+
/** The director's review of a design: the plan's, with the critical inconsistencies and the devil's advocate. */
|
|
24
|
+
export declare const DESIGN_REVIEW_TOOL: AiJsonSchema;
|
|
25
|
+
/** The role of the architect in a design run: the Brainstormer of the writers' room. */
|
|
26
|
+
export declare const DESIGN_ARCHITECT_ROLE: string;
|
|
27
|
+
/** The role of a simulated reader reading a design: the reader keeps the personality of the panel. */
|
|
28
|
+
export declare const DESIGN_READER_ROLE: string;
|
|
29
|
+
/** The director's instructions for a review of a design. */
|
|
30
|
+
export declare const DESIGN_DIRECTOR_RULES: string[];
|
|
31
|
+
/** What a design asks of every chapter. */
|
|
32
|
+
export declare const DESIGN_CHAPTER_RULE = "For every chapter give its summary and its design: the narrative goal, the point of view, the characters on stage, the setting and the time, the main events, the planned scenes (2 to 4, a line each), the conflicts, the emotional evolution, what the reader learns, what stays hidden, the clues planted, what it picks up and what it sets up, how it ends (and whether on a cliffhanger), and notes for the ghostwriter. Never write the prose.";
|
|
33
|
+
/** What a design asks of the secrets, batch by batch. */
|
|
34
|
+
export declare const DESIGN_LEDGER_RULE = "For every secret that has something in these chapters, give its ledger for these chapters: who learns it and where, what the reader knows chapter by chapter, the clues and the red herrings planted, and the reveal chapter. Every secret needs clues before its reveal; nobody acts on a secret before learning it; no reveal comes before its chapter.";
|
|
17
35
|
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/autopilot/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMnD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM9D;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU3D;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQhE;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED,eAAO,MAAM,YAAY,EAAE,YAiD1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,YAyBvB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAahC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAuB9B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,YAyBzB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAQhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,YAQlC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,YAyB3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,YAuCjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAgBhC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,YAczB,CAAC"}
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/autopilot/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMnD,wBAAgB,qBAAqB,CAAC,QAA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kB,8VAA8V,CAAC"}
|
|
@@ -290,4 +290,167 @@ export const IMPACT_TOOL = {
|
|
|
290
290
|
required: ["summary", "targets"],
|
|
291
291
|
},
|
|
292
292
|
};
|
|
293
|
+
// ─── The design of a book (`AutopilotDesign`) ───────────────────────────────
|
|
294
|
+
//
|
|
295
|
+
// The prompts and the schemas of a design run: the steps are the autopilot's own (concept, plan, readers, director), each with its configured personality (the
|
|
296
|
+
// director's profile, the readers' panel, the book's ghostwriter), and a role for the design of a book that is not written yet. Every reviewer must contest as well
|
|
297
|
+
// as judge: a counter-proposal is part of every reply.
|
|
298
|
+
const chapterNote = { type: "object", properties: { chapter: { type: "number" }, note: string }, required: ["chapter", "note"] };
|
|
299
|
+
const conceptProperties = CONCEPT_TOOL.parameters.properties;
|
|
300
|
+
const conceptCharacter = conceptProperties.characters.items;
|
|
301
|
+
const conceptSecret = conceptProperties.secrets.items;
|
|
302
|
+
/** The foundation of a design: the concept's, with the relationships of the cast, the items that matter, the rules of the world and what each secret misleads and changes. */
|
|
303
|
+
export const DESIGN_CONCEPT_TOOL = {
|
|
304
|
+
name: "design_concept",
|
|
305
|
+
description: "Return the foundation of the design of the novel: story design, world frame and rules, cast with arcs and relationships, places, factions, items and secrets.",
|
|
306
|
+
parameters: {
|
|
307
|
+
type: "object",
|
|
308
|
+
properties: {
|
|
309
|
+
...conceptProperties,
|
|
310
|
+
characters: {
|
|
311
|
+
type: "array",
|
|
312
|
+
items: {
|
|
313
|
+
type: "object",
|
|
314
|
+
properties: { ...conceptCharacter.properties, relationships: { ...strings, description: "How the character stands with the others, a line each (\"Elio: owes her his life, and hides it\")." } },
|
|
315
|
+
required: [...conceptCharacter.required, "relationships"],
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
items: { type: "array", items: { type: "object", properties: { name: string, description: string, significance: { ...string, description: "Why it matters to the story." } }, required: ["name", "description", "significance"] } },
|
|
319
|
+
worldRules: { ...strings, description: "The rules of the world the story must never break, a line each: how things work, what is possible and what is not." },
|
|
320
|
+
secrets: {
|
|
321
|
+
type: "array",
|
|
322
|
+
items: {
|
|
323
|
+
type: "object",
|
|
324
|
+
properties: {
|
|
325
|
+
...conceptSecret.properties,
|
|
326
|
+
redHerrings: { ...strings, description: "The false trails that will mislead the reader." },
|
|
327
|
+
consequences: { ...strings, description: "What the reveal changes in the story and for the characters." },
|
|
328
|
+
},
|
|
329
|
+
required: [...conceptSecret.required, "consequences"],
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
required: [...CONCEPT_TOOL.parameters.required, "items", "worldRules"],
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
/** The fields of the design of one chapter (`OutlineChapterDesign`), as the model writes them. */
|
|
337
|
+
const chapterDesign = {
|
|
338
|
+
type: "object",
|
|
339
|
+
properties: {
|
|
340
|
+
goal: { ...string, description: "The narrative goal: why the chapter exists in the book." },
|
|
341
|
+
pov: { ...strings, description: "Point-of-view character names." },
|
|
342
|
+
characters: { ...strings, description: "The characters on stage." },
|
|
343
|
+
setting: { ...string, description: "Where it happens (a place of the canon when there is one)." },
|
|
344
|
+
time: { ...string, description: "When it happens: its place in the time of the story." },
|
|
345
|
+
events: { ...strings, description: "The main events, in order." },
|
|
346
|
+
scenes: { ...strings, description: "The scenes it should have, one line each (2 to 4)." },
|
|
347
|
+
conflicts: strings,
|
|
348
|
+
emotions: { ...string, description: "How the characters change inside through the chapter." },
|
|
349
|
+
reveals: { ...strings, description: "What the reader learns here; name a secret by its exact title when it is revealed." },
|
|
350
|
+
withholds: { ...strings, description: "What is deliberately kept from the reader." },
|
|
351
|
+
clues: { ...strings, description: "Clues and foreshadowing planted here." },
|
|
352
|
+
previous: { ...string, description: "What it picks up from the chapters before." },
|
|
353
|
+
next: { ...string, description: "What it sets up for the chapters after." },
|
|
354
|
+
ending: { ...string, description: "How the chapter closes." },
|
|
355
|
+
cliffhanger: { type: "boolean", description: "Whether it closes on a cliffhanger." },
|
|
356
|
+
notes: { ...string, description: "Notes for the ghostwriter who will write it: what to stress, what to avoid." },
|
|
357
|
+
},
|
|
358
|
+
required: ["goal", "pov", "characters", "setting", "time", "events", "scenes", "conflicts", "emotions", "reveals", "withholds", "clues", "previous", "next", "ending", "cliffhanger", "notes"],
|
|
359
|
+
};
|
|
360
|
+
/** The design of a batch of chapters (no prose), and where the secrets fall in it. */
|
|
361
|
+
export const DESIGN_PLAN_TOOL = {
|
|
362
|
+
name: "chapter_design",
|
|
363
|
+
description: "Return the design of the chapters of the novel (never their prose) and the ledger of the secrets in these chapters.",
|
|
364
|
+
parameters: {
|
|
365
|
+
type: "object",
|
|
366
|
+
properties: {
|
|
367
|
+
chapters: {
|
|
368
|
+
type: "array",
|
|
369
|
+
items: {
|
|
370
|
+
type: "object",
|
|
371
|
+
properties: {
|
|
372
|
+
number: { type: "number" },
|
|
373
|
+
title: string,
|
|
374
|
+
summary: { ...string, description: "What happens, in 2-4 sentences." },
|
|
375
|
+
design: chapterDesign,
|
|
376
|
+
},
|
|
377
|
+
required: ["number", "title", "summary", "design"],
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
secrets: {
|
|
381
|
+
type: "array",
|
|
382
|
+
description: "The ledger of every secret that has something in these chapters.",
|
|
383
|
+
items: {
|
|
384
|
+
type: "object",
|
|
385
|
+
properties: {
|
|
386
|
+
title: { ...string, description: "The exact title of the secret." },
|
|
387
|
+
revealChapter: { type: "number", description: "The chapter where the reader learns the truth (0 when it is revealed outside these chapters)." },
|
|
388
|
+
learnedBy: { type: "array", items: { type: "object", properties: { character: string, chapter: { type: "number" } }, required: ["character", "chapter"] }, description: "Who learns it in these chapters, and where." },
|
|
389
|
+
readerKnows: { type: "array", items: chapterNote, description: "What the reader knows of it at each of these chapters where that changes." },
|
|
390
|
+
clues: { type: "array", items: chapterNote, description: "The clues planted in these chapters." },
|
|
391
|
+
redHerrings: { type: "array", items: chapterNote, description: "The false trails planted in these chapters." },
|
|
392
|
+
},
|
|
393
|
+
required: ["title", "revealChapter", "learnedBy", "readerKnows", "clues", "redHerrings"],
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
required: ["chapters", "secrets"],
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
const reactionProperties = PLAN_REACTION_TOOL.parameters.properties;
|
|
401
|
+
/** A reader's reaction to a design: the plan's, with what falls flat and the reader's own proposal. */
|
|
402
|
+
export const DESIGN_REACTION_TOOL = {
|
|
403
|
+
name: "design_reaction",
|
|
404
|
+
description: "React, as the configured reader, to the design of a novel not written yet.",
|
|
405
|
+
parameters: {
|
|
406
|
+
type: "object",
|
|
407
|
+
properties: {
|
|
408
|
+
...reactionProperties,
|
|
409
|
+
weakSpots: { ...strings, description: "What is predictable, inconsistent, superfluous or dull, chapter by chapter (\"Chapter 4: …\")." },
|
|
410
|
+
counterProposal: { ...string, description: "A concrete alternative you would prefer to the weakest part: never empty." },
|
|
411
|
+
},
|
|
412
|
+
required: [...PLAN_REACTION_TOOL.parameters.required, "weakSpots", "counterProposal"],
|
|
413
|
+
},
|
|
414
|
+
};
|
|
415
|
+
const reviewProperties = PLAN_REVIEW_TOOL.parameters.properties;
|
|
416
|
+
/** The director's review of a design: the plan's, with the critical inconsistencies and the devil's advocate. */
|
|
417
|
+
export const DESIGN_REVIEW_TOOL = {
|
|
418
|
+
name: "design_review",
|
|
419
|
+
description: "Review the design of the novel before any prose is written.",
|
|
420
|
+
parameters: {
|
|
421
|
+
type: "object",
|
|
422
|
+
properties: {
|
|
423
|
+
...reviewProperties,
|
|
424
|
+
critical: {
|
|
425
|
+
type: "array",
|
|
426
|
+
description: "Every critical inconsistency still in the design (a contradiction, a plot hole, an impossible knowledge, a premature reveal, a mystery without a resolution). Empty when there is none.",
|
|
427
|
+
items: { type: "object", properties: { chapterNumber: { type: "number" }, issue: string }, required: ["issue"] },
|
|
428
|
+
},
|
|
429
|
+
counterProposal: { ...string, description: "Devil's advocate: the strongest alternative to the weakest part of the design, before you decide." },
|
|
430
|
+
},
|
|
431
|
+
required: [...PLAN_REVIEW_TOOL.parameters.required, "critical", "counterProposal"],
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
/** The role of the architect in a design run: the Brainstormer of the writers' room. */
|
|
435
|
+
export const DESIGN_ARCHITECT_ROLE = [
|
|
436
|
+
"This is the design of the book, before any prose: you are the brainstormer of a writers' room. Develop the author's idea into a complete, coherent, original and engaging design.",
|
|
437
|
+
"Propose, do not only confirm: when a better narrative choice exists, take it and say why. Every secret needs a truth, clues before its reveal, a reveal chapter and consequences; every setup needs a payoff.",
|
|
438
|
+
"Never write the prose of a chapter: only what a writer needs to write it later.",
|
|
439
|
+
].join("\n");
|
|
440
|
+
/** The role of a simulated reader reading a design: the reader keeps the personality of the panel. */
|
|
441
|
+
export const DESIGN_READER_ROLE = [
|
|
442
|
+
"You are reading the design of a novel that is not written yet: the pitch, the cast, the world, the secrets and the design of every chapter.",
|
|
443
|
+
"React as this reader would: engagement, originality, pace, suspense, credibility, emotional impact. Point out what is predictable, inconsistent, superfluous or dull.",
|
|
444
|
+
"Do not merely agree: you must make at least one concrete counter-proposal.",
|
|
445
|
+
].join("\n");
|
|
446
|
+
/** The director's instructions for a review of a design. */
|
|
447
|
+
export const DESIGN_DIRECTOR_RULES = [
|
|
448
|
+
"Play devil's advocate before you decide: name the strongest alternative to the weakest part of the design (counterProposal).",
|
|
449
|
+
"A score alone never approves: list every critical inconsistency still in the design (critical), and approve only when none is left. Every critical inconsistency becomes a change, chapter by chapter.",
|
|
450
|
+
"Weigh the DESIGN CHECKS: they are found without a model and may be noise; act on the real ones.",
|
|
451
|
+
];
|
|
452
|
+
/** What a design asks of every chapter. */
|
|
453
|
+
export const DESIGN_CHAPTER_RULE = "For every chapter give its summary and its design: the narrative goal, the point of view, the characters on stage, the setting and the time, the main events, the planned scenes (2 to 4, a line each), the conflicts, the emotional evolution, what the reader learns, what stays hidden, the clues planted, what it picks up and what it sets up, how it ends (and whether on a cliffhanger), and notes for the ghostwriter. Never write the prose.";
|
|
454
|
+
/** What a design asks of the secrets, batch by batch. */
|
|
455
|
+
export const DESIGN_LEDGER_RULE = "For every secret that has something in these chapters, give its ledger for these chapters: who learns it and where, what the reader knows chapter by chapter, the clues and the red herrings planted, and the reveal chapter. Every secret needs clues before its reveal; nobody acts on a secret before learning it; no reveal comes before its chapter.";
|
|
293
456
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/autopilot/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAW,CAAC;AAC3C,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAW,CAAC;AAEtE,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,OAAO;QACL,sOAAsO;QACtO,+JAA+J;QAC/J,6BAA6B,YAAY,CAAC,QAAQ,CAAC,GAAG;KACvD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,OAAO;QACL,kFAAkF,YAAY,CAAC,QAAQ,CAAC,GAAG;QAC3G,8FAA8F;QAC9F,iGAAiG;QACjG,kFAAkF;QAClF,0FAA0F;QAC1F,2DAA2D;QAC3D,iHAAiH;KAClH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,OAAO;QACL,8LAA8L;QAC9L,8KAA8K;QAC9K,yHAAyH;QACzH,iEAAiE;QACjE,6BAA6B,YAAY,CAAC,QAAQ,CAAC,GAAG;KACvD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,sBAAsB,CAA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KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE;aACjH;YACD,eAAe,EAAE,EAAE,GAAG,MAAM,EAAE,WAAW,EAAE,mGAAmG,EAAE;SACjJ;QACD,QAAQ,EAAE,CAAC,GAAI,gBAAgB,CAAC,UAAU,CAAC,QAAqB,EAAE,UAAU,EAAE,iBAAiB,CAAC;KACjG;CACF,CAAC;AAEF,wFAAwF;AACxF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,mLAAmL;IACnL,+MAA+M;IAC/M,iFAAiF;CAClF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,sGAAsG;AACtG,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,6IAA6I;IAC7I,uKAAuK;IACvK,4EAA4E;CAC7E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,4DAA4D;AAC5D,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,8HAA8H;IAC9H,wMAAwM;IACxM,iGAAiG;CAClG,CAAC;AAEF,2CAA2C;AAC3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,ubAAub,CAAC;AAE3d,yDAAyD;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,2VAA2V,CAAC"}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import type { DirectorProfile } from "../profiles/director.js";
|
|
2
2
|
import { type AutopilotState, type ReviewPolicy } from "./types.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* read
|
|
6
|
-
* the run's options (`options.review`) say otherwise for a run, and a review of the book launched later (`state.campaign.review`) for itself. One place says
|
|
7
|
-
* which wins, for the planner and the tasks alike. Pure.
|
|
4
|
+
* The policy as the options keep it: each value in its range, a value that is not a number left out; `null` (or nothing usable) is no policy. The targets of the readers
|
|
5
|
+
* are read softly, as the rest: a vote out of range is brought into it, a reader or a vote that cannot be read is left out, and nothing makes the whole policy fail.
|
|
8
6
|
*/
|
|
9
|
-
/** The policy as the options keep it: each value in its range, a value that is not a number left out; `null` (or nothing usable) is no policy. */
|
|
10
7
|
export declare function normalizeReviewPolicy(value: unknown, base?: ReviewPolicy): ReviewPolicy | undefined;
|
|
8
|
+
/** The readers' targets of a policy, as a review reads them. */
|
|
9
|
+
export interface ReaderTargets {
|
|
10
|
+
/** The vote the average of the readers that count must reach. */
|
|
11
|
+
average?: number;
|
|
12
|
+
/** The vote each reader must reach, by slug. */
|
|
13
|
+
each: Readonly<Record<string, number>>;
|
|
14
|
+
/** The readers that do not count. */
|
|
15
|
+
excluded: ReadonlySet<string>;
|
|
16
|
+
}
|
|
17
|
+
/** The targets for the readers a policy (or a review of the book) names; `undefined` when it names none. Pure. */
|
|
18
|
+
export declare function readerTargetsFrom(policy: Pick<ReviewPolicy, "readersTarget" | "readerTargets" | "readersExcluded"> | undefined, fallback?: Pick<ReviewPolicy, "readersTarget" | "readerTargets" | "readersExcluded">): ReaderTargets | undefined;
|
|
19
|
+
/** Whether the targets ask something of the readers (a vote for their average, or for one of them): leaving some out asks nothing, it only changes the average. */
|
|
20
|
+
export declare function readersGated(targets: ReaderTargets | undefined): targets is ReaderTargets;
|
|
11
21
|
type PolicyState = Pick<AutopilotState, "options"> & Partial<Pick<AutopilotState, "campaign">>;
|
|
12
22
|
/** The vote a chapter and the book must reach: the review of the book in progress, else the run's policy, else the director's approval score. */
|
|
13
23
|
export declare function reviewTarget(state: PolicyState, director: Pick<DirectorProfile, "approvalScore">): number;
|
|
@@ -18,5 +28,15 @@ export declare function reviewMaxRounds(state: PolicyState, director: Pick<Direc
|
|
|
18
28
|
* progress (0: they do not read again), else the run's policy, else 1 (the first round only, as it always was).
|
|
19
29
|
*/
|
|
20
30
|
export declare function reviewReaderRounds(state: PolicyState): number;
|
|
31
|
+
/** The readers' targets in force: the review of the book in progress's, else the run's; `undefined` when neither names any. */
|
|
32
|
+
export declare function reviewReaderTargets(state: PolicyState): ReaderTargets | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The targets the readers must meet in a review: `own` (what the review itself names, when it is a review of the book) over the run's policy, when they ask something
|
|
35
|
+
* (`readersGated`), the readers read in this run (`options.readers`) and one of those that read counts (`active` are the readers that read, by slug; absent: the host does
|
|
36
|
+
* not say, and any does). `undefined` otherwise: a review without it is the one the engine always made.
|
|
37
|
+
*/
|
|
38
|
+
export declare function gateFor(options: Pick<AutopilotState["options"], "readers" | "review">, own: Pick<ReviewPolicy, "readersTarget" | "readerTargets" | "readersExcluded"> | undefined, active?: readonly string[]): ReaderTargets | undefined;
|
|
39
|
+
/** The targets the readers must meet in the review that goes on (see `gateFor`): the review of the book in progress's own over the run's. */
|
|
40
|
+
export declare function readerGate(state: PolicyState, active?: readonly string[]): ReaderTargets | undefined;
|
|
21
41
|
export {};
|
|
22
42
|
//# sourceMappingURL=review-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-policy.d.ts","sourceRoot":"","sources":["../../src/autopilot/review-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,
|
|
1
|
+
{"version":3,"file":"review-policy.d.ts","sourceRoot":"","sources":["../../src/autopilot/review-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAA4E,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAwC9I;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,CAyBnG;AAED,gEAAgE;AAChE,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,OAAO,CAAC,EAAE,MA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AAI,CAAC,YAAY,EAAE,eAAe,GAAG,eAAe,GAAG,iBAAiB,CAAC,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa,GAAG,SAAS,CAMzO;AAED,6IAA6I;AAC7I,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa,GAAG,SAAS,CAEpG"}
|
|
@@ -1,12 +1,49 @@
|
|
|
1
1
|
import { clampNumber, numericValue } from "../profiles/read.js";
|
|
2
|
-
import { REVIEW_MAX_CAMPAIGN_ROUNDS, REVIEW_MAX_ROUNDS } from "./types.js";
|
|
2
|
+
import { REVIEW_MAX_CAMPAIGN_ROUNDS, REVIEW_MAX_READER_ENTRIES, REVIEW_MAX_ROUNDS } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* How the chapters and the book are reviewed (`ReviewPolicy`): the vote they must reach, the rounds of review of a chapter, the rounds the simulated readers
|
|
5
5
|
* read in, the rounds a review of the book makes before it waits for the author. The director's profile gives the defaults (its approval score, its rounds);
|
|
6
6
|
* the run's options (`options.review`) say otherwise for a run, and a review of the book launched later (`state.campaign.review`) for itself. One place says
|
|
7
7
|
* which wins, for the planner and the tasks alike. Pure.
|
|
8
8
|
*/
|
|
9
|
-
/**
|
|
9
|
+
/** A reader as the policy names it: its slug, a short text without control characters; anything else is no reader. */
|
|
10
|
+
function readerSlug(value) {
|
|
11
|
+
if (typeof value !== "string")
|
|
12
|
+
return undefined;
|
|
13
|
+
const slug = value.trim();
|
|
14
|
+
return slug && slug.length <= 120 && !/[\u0000-\u001f\u007f]/.test(slug) ? slug : undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The target of each reader as the options keep it (the slugs that are readers, each vote from 1 to 10 to a tenth, at most `REVIEW_MAX_READER_ENTRIES`): a vote that is not a
|
|
18
|
+
* number leaves the reader without a target. Given whole, it replaces what there was; a value that is not a mapping leaves what there was.
|
|
19
|
+
*/
|
|
20
|
+
function readerTargetsOf(value, base) {
|
|
21
|
+
if (value === null)
|
|
22
|
+
return undefined;
|
|
23
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
24
|
+
return base;
|
|
25
|
+
const targets = {};
|
|
26
|
+
for (const [name, vote] of Object.entries(value)) {
|
|
27
|
+
const slug = readerSlug(name);
|
|
28
|
+
const read = numericValue(vote);
|
|
29
|
+
if (slug && read !== undefined && Object.keys(targets).length < REVIEW_MAX_READER_ENTRIES)
|
|
30
|
+
targets[slug] = clampNumber(read, 1, 10, 1);
|
|
31
|
+
}
|
|
32
|
+
return Object.keys(targets).length ? targets : undefined;
|
|
33
|
+
}
|
|
34
|
+
/** The readers that do not count as the options keep them (each once, at most `REVIEW_MAX_READER_ENTRIES`); a value that is not a list leaves what there was. */
|
|
35
|
+
function readersExcludedOf(value, base) {
|
|
36
|
+
if (value === null)
|
|
37
|
+
return undefined;
|
|
38
|
+
if (!Array.isArray(value))
|
|
39
|
+
return base;
|
|
40
|
+
const slugs = [...new Set(value.map(readerSlug).filter((slug) => slug !== undefined))].slice(0, REVIEW_MAX_READER_ENTRIES);
|
|
41
|
+
return slugs.length ? slugs : undefined;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The policy as the options keep it: each value in its range, a value that is not a number left out; `null` (or nothing usable) is no policy. The targets of the readers
|
|
45
|
+
* are read softly, as the rest: a vote out of range is brought into it, a reader or a vote that cannot be read is left out, and nothing makes the whole policy fail.
|
|
46
|
+
*/
|
|
10
47
|
export function normalizeReviewPolicy(value, base) {
|
|
11
48
|
if (value === null)
|
|
12
49
|
return undefined;
|
|
@@ -24,6 +61,9 @@ export function normalizeReviewPolicy(value, base) {
|
|
|
24
61
|
const maxRounds = pick("maxRounds", 1, REVIEW_MAX_ROUNDS, 0);
|
|
25
62
|
const readerRounds = pick("readerRounds", 1, REVIEW_MAX_ROUNDS, 0);
|
|
26
63
|
const campaignMaxRounds = pick("campaignMaxRounds", 0, REVIEW_MAX_CAMPAIGN_ROUNDS, 0);
|
|
64
|
+
const readersTarget = pick("readersTarget", 1, 10, 1);
|
|
65
|
+
const readerTargets = readerTargetsOf(source.readerTargets, base?.readerTargets);
|
|
66
|
+
const readersExcluded = readersExcludedOf(source.readersExcluded, base?.readersExcluded);
|
|
27
67
|
if (targetScore !== undefined)
|
|
28
68
|
policy.targetScore = targetScore;
|
|
29
69
|
if (maxRounds !== undefined)
|
|
@@ -32,8 +72,27 @@ export function normalizeReviewPolicy(value, base) {
|
|
|
32
72
|
policy.readerRounds = readerRounds;
|
|
33
73
|
if (campaignMaxRounds)
|
|
34
74
|
policy.campaignMaxRounds = campaignMaxRounds;
|
|
75
|
+
if (readersTarget !== undefined)
|
|
76
|
+
policy.readersTarget = readersTarget;
|
|
77
|
+
if (readerTargets)
|
|
78
|
+
policy.readerTargets = readerTargets;
|
|
79
|
+
if (readersExcluded)
|
|
80
|
+
policy.readersExcluded = readersExcluded;
|
|
35
81
|
return Object.keys(policy).length ? policy : undefined;
|
|
36
82
|
}
|
|
83
|
+
/** The targets for the readers a policy (or a review of the book) names; `undefined` when it names none. Pure. */
|
|
84
|
+
export function readerTargetsFrom(policy, fallback) {
|
|
85
|
+
const average = policy?.readersTarget ?? fallback?.readersTarget;
|
|
86
|
+
const each = policy?.readerTargets ?? fallback?.readerTargets ?? {};
|
|
87
|
+
const excluded = policy?.readersExcluded ?? fallback?.readersExcluded ?? [];
|
|
88
|
+
if (average === undefined && !Object.keys(each).length && !excluded.length)
|
|
89
|
+
return undefined;
|
|
90
|
+
return { ...(average !== undefined ? { average } : {}), each, excluded: new Set(excluded) };
|
|
91
|
+
}
|
|
92
|
+
/** Whether the targets ask something of the readers (a vote for their average, or for one of them): leaving some out asks nothing, it only changes the average. */
|
|
93
|
+
export function readersGated(targets) {
|
|
94
|
+
return Boolean(targets && (targets.average !== undefined || Object.keys(targets.each).length > 0));
|
|
95
|
+
}
|
|
37
96
|
/** The review of the book in progress, when there is one: its policy wins over the run's. */
|
|
38
97
|
function reviewInProgress(state) {
|
|
39
98
|
return state.campaign?.reason === "review-target" ? state.campaign.review : undefined;
|
|
@@ -53,4 +112,27 @@ export function reviewMaxRounds(state, director) {
|
|
|
53
112
|
export function reviewReaderRounds(state) {
|
|
54
113
|
return reviewInProgress(state)?.readerRounds ?? state.options.review?.readerRounds ?? 1;
|
|
55
114
|
}
|
|
115
|
+
/** The readers' targets in force: the review of the book in progress's, else the run's; `undefined` when neither names any. */
|
|
116
|
+
export function reviewReaderTargets(state) {
|
|
117
|
+
return readerTargetsFrom(reviewInProgress(state), state.options.review);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The targets the readers must meet in a review: `own` (what the review itself names, when it is a review of the book) over the run's policy, when they ask something
|
|
121
|
+
* (`readersGated`), the readers read in this run (`options.readers`) and one of those that read counts (`active` are the readers that read, by slug; absent: the host does
|
|
122
|
+
* not say, and any does). `undefined` otherwise: a review without it is the one the engine always made.
|
|
123
|
+
*/
|
|
124
|
+
export function gateFor(options, own, active) {
|
|
125
|
+
if (!options.readers)
|
|
126
|
+
return undefined;
|
|
127
|
+
const targets = readerTargetsFrom(own, options.review);
|
|
128
|
+
if (!readersGated(targets))
|
|
129
|
+
return undefined;
|
|
130
|
+
if (active && !active.some((slug) => !targets.excluded.has(slug)))
|
|
131
|
+
return undefined;
|
|
132
|
+
return targets;
|
|
133
|
+
}
|
|
134
|
+
/** The targets the readers must meet in the review that goes on (see `gateFor`): the review of the book in progress's own over the run's. */
|
|
135
|
+
export function readerGate(state, active) {
|
|
136
|
+
return gateFor(state.options, reviewInProgress(state), active);
|
|
137
|
+
}
|
|
56
138
|
//# sourceMappingURL=review-policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-policy.js","sourceRoot":"","sources":["../../src/autopilot/review-policy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;A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,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACpF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,6IAA6I;AAC7I,MAAM,UAAU,UAAU,CAAC,KAAkB,EAAE,MAA0B;IACvE,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ReaderTargets } from "./review-policy.js";
|
|
2
|
+
import type { ChapterRound } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* What the readers say of a chapter, compared with the targets the author set for them (`ReviewPolicy.readersTarget`, `readerTargets`, `readersExcluded`): the average of
|
|
5
|
+
* the readers that count, what is under its target, and whether a vote the chapter has is still the vote of its text. Pure: the review (`planner.ts`, `tasks.ts`) and the
|
|
6
|
+
* review of the book (`campaign.ts`) read the same rules from here, and a host that shows the votes reads them too.
|
|
7
|
+
*/
|
|
8
|
+
/** The vote of one reader. */
|
|
9
|
+
export interface ReaderVote {
|
|
10
|
+
slug: string;
|
|
11
|
+
score: number;
|
|
12
|
+
}
|
|
13
|
+
/** The average of the votes of the readers that count, to a tenth; `null` when none does. */
|
|
14
|
+
export declare function countingAverage(votes: readonly ReaderVote[], excluded: ReadonlySet<string>): number | null;
|
|
15
|
+
/** What stands between a chapter and a target of the readers: their average, or one reader. */
|
|
16
|
+
export type ReaderBlocker = {
|
|
17
|
+
subject: "average";
|
|
18
|
+
vote: number;
|
|
19
|
+
target: number;
|
|
20
|
+
} | {
|
|
21
|
+
subject: "reader";
|
|
22
|
+
slug: string;
|
|
23
|
+
vote: number;
|
|
24
|
+
target: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* How the votes of the readers stand against their targets: the average of those that count, what is under its target (the average first, then the readers in the order
|
|
28
|
+
* they voted), and how far it all is from the targets in tenths of a vote (the sum of what each lacks): a round of corrections got closer when it is smaller.
|
|
29
|
+
*/
|
|
30
|
+
export interface ReaderStanding {
|
|
31
|
+
average: number | null;
|
|
32
|
+
blockers: ReaderBlocker[];
|
|
33
|
+
shortfall: number;
|
|
34
|
+
}
|
|
35
|
+
/** Judge the votes of the readers by their targets. A reader that does not count has no say, whatever its vote or its target; with no vote there is nothing under a target. */
|
|
36
|
+
export declare function readerStanding(votes: readonly ReaderVote[], targets: ReaderTargets): ReaderStanding;
|
|
37
|
+
/** What the readers last said of a chapter, from the rounds of its review: the entry, the votes it has, and whether they are of the text as it is now. */
|
|
38
|
+
export interface ChapterReading {
|
|
39
|
+
/** The vote of each reader, when the round recorded them (`ChapterRound.readerVotes`); an older round has the average alone. */
|
|
40
|
+
votes?: ReaderVote[];
|
|
41
|
+
/** The average the round recorded: of the readers that counted when it was made; `null` when none did. */
|
|
42
|
+
average: number | null;
|
|
43
|
+
/** The round of the review it belongs to, when the round says it. */
|
|
44
|
+
round?: number;
|
|
45
|
+
reading?: ChapterRound["reading"];
|
|
46
|
+
/** Nothing was corrected after they read: this is the vote of the text as it is. */
|
|
47
|
+
current: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The last reading of a chapter among its rounds (`null` when the readers never read it). It is the vote of the text as it is while it is the last entry and no
|
|
51
|
+
* correction followed it: a reading of its own is the last thing that happened, and the round of the director that read it has no fix accepted (`accepted`); any
|
|
52
|
+
* later round, or fixes after it, make it a vote of the text before.
|
|
53
|
+
*/
|
|
54
|
+
export declare function chapterReading(rounds: readonly ChapterRound[] | undefined): ChapterReading | null;
|
|
55
|
+
/**
|
|
56
|
+
* Where a chapter stands against the readers' targets: the standing, when there is a vote of the text as it is that the targets can be read from (`null` otherwise), and
|
|
57
|
+
* whether the readers must read it for that (`needsReading`: they never did, what they said is of the text before the corrections, or a target is for one reader, or
|
|
58
|
+
* some readers do not count, and the round only has the average of them all).
|
|
59
|
+
*/
|
|
60
|
+
export declare function chapterStanding(rounds: readonly ChapterRound[] | undefined, targets: ReaderTargets): {
|
|
61
|
+
standing: ReaderStanding | null;
|
|
62
|
+
reading: ChapterReading | null;
|
|
63
|
+
needsReading: boolean;
|
|
64
|
+
};
|
|
65
|
+
/** What stands in the way, in words: «the readers' average 6.4/10 is under 7.5/10», «Anna's 5/10 is under the 8/10 asked of her». `names` says a reader by its slug. */
|
|
66
|
+
export declare function blockerText(blocker: ReaderBlocker, language: string, names?: (slug: string) => string): string;
|
|
67
|
+
/** All that stands in the way in one sentence («the readers' average 6.4/10 is under 7.5/10; Anna gives 5/10, under the 8/10 asked of this reader»). */
|
|
68
|
+
export declare function blockersText(blockers: readonly ReaderBlocker[], language: string, names?: (slug: string) => string): string;
|
|
69
|
+
//# sourceMappingURL=review-readers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-readers.d.ts","sourceRoot":"","sources":["../../src/autopilot/review-readers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AAEH,8BAA8B;AAC9B,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAID,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAG1G;AAED,+FAA+F;AAC/F,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;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E,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAE3H"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { isItalian } from "../util/text.js";
|
|
2
|
+
const tenth = (value) => Math.round(value * 10) / 10;
|
|
3
|
+
/** The average of the votes of the readers that count, to a tenth; `null` when none does. */
|
|
4
|
+
export function countingAverage(votes, excluded) {
|
|
5
|
+
const counting = votes.filter((vote) => !excluded.has(vote.slug));
|
|
6
|
+
return counting.length ? tenth(counting.reduce((sum, vote) => sum + vote.score, 0) / counting.length) : null;
|
|
7
|
+
}
|
|
8
|
+
/** Judge the votes of the readers by their targets. A reader that does not count has no say, whatever its vote or its target; with no vote there is nothing under a target. */
|
|
9
|
+
export function readerStanding(votes, targets) {
|
|
10
|
+
const average = countingAverage(votes, targets.excluded);
|
|
11
|
+
const blockers = [];
|
|
12
|
+
if (targets.average !== undefined && average !== null && average < targets.average)
|
|
13
|
+
blockers.push({ subject: "average", vote: average, target: targets.average });
|
|
14
|
+
for (const vote of votes) {
|
|
15
|
+
const target = targets.each[vote.slug];
|
|
16
|
+
const score = tenth(vote.score);
|
|
17
|
+
if (target !== undefined && !targets.excluded.has(vote.slug) && score < target)
|
|
18
|
+
blockers.push({ subject: "reader", slug: vote.slug, vote: score, target });
|
|
19
|
+
}
|
|
20
|
+
return { average, blockers, shortfall: blockers.reduce((sum, blocker) => sum + Math.round((blocker.target - blocker.vote) * 10), 0) };
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The last reading of a chapter among its rounds (`null` when the readers never read it). It is the vote of the text as it is while it is the last entry and no
|
|
24
|
+
* correction followed it: a reading of its own is the last thing that happened, and the round of the director that read it has no fix accepted (`accepted`); any
|
|
25
|
+
* later round, or fixes after it, make it a vote of the text before.
|
|
26
|
+
*/
|
|
27
|
+
export function chapterReading(rounds) {
|
|
28
|
+
if (!rounds?.length)
|
|
29
|
+
return null;
|
|
30
|
+
for (let index = rounds.length - 1; index >= 0; index -= 1) {
|
|
31
|
+
const entry = rounds[index];
|
|
32
|
+
if (entry?.readers === undefined && !entry?.readerVotes)
|
|
33
|
+
continue;
|
|
34
|
+
const votes = entry.readerVotes ? Object.entries(entry.readerVotes).map(([slug, score]) => ({ slug, score })) : undefined;
|
|
35
|
+
return {
|
|
36
|
+
...(votes ? { votes } : {}),
|
|
37
|
+
average: entry.readers ?? null,
|
|
38
|
+
...(entry.round !== undefined ? { round: entry.round } : {}),
|
|
39
|
+
...(entry.reading ? { reading: entry.reading } : {}),
|
|
40
|
+
current: index === rounds.length - 1 && (entry.reading !== undefined || !((entry.accepted ?? 0) > 0)),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Where a chapter stands against the readers' targets: the standing, when there is a vote of the text as it is that the targets can be read from (`null` otherwise), and
|
|
47
|
+
* whether the readers must read it for that (`needsReading`: they never did, what they said is of the text before the corrections, or a target is for one reader, or
|
|
48
|
+
* some readers do not count, and the round only has the average of them all).
|
|
49
|
+
*/
|
|
50
|
+
export function chapterStanding(rounds, targets) {
|
|
51
|
+
const reading = chapterReading(rounds);
|
|
52
|
+
if (!reading || !reading.current)
|
|
53
|
+
return { standing: null, reading, needsReading: true };
|
|
54
|
+
if (reading.votes)
|
|
55
|
+
return { standing: readerStanding(reading.votes, targets), reading, needsReading: false };
|
|
56
|
+
const detailed = Object.keys(targets.each).length > 0 || targets.excluded.size > 0;
|
|
57
|
+
if (detailed || reading.average === null)
|
|
58
|
+
return { standing: null, reading, needsReading: true };
|
|
59
|
+
return { standing: readerStanding([{ slug: "", score: reading.average }], { ...targets, each: {}, excluded: new Set() }), reading, needsReading: false };
|
|
60
|
+
}
|
|
61
|
+
const vote = (value) => `${value}/10`;
|
|
62
|
+
/** What stands in the way, in words: «the readers' average 6.4/10 is under 7.5/10», «Anna's 5/10 is under the 8/10 asked of her». `names` says a reader by its slug. */
|
|
63
|
+
export function blockerText(blocker, language, names = (slug) => slug) {
|
|
64
|
+
const italian = isItalian(language);
|
|
65
|
+
if (blocker.subject === "average") {
|
|
66
|
+
return italian
|
|
67
|
+
? `la media dei lettori ${vote(blocker.vote)} è sotto ${vote(blocker.target)}`
|
|
68
|
+
: `the readers' average ${vote(blocker.vote)} is under ${vote(blocker.target)}`;
|
|
69
|
+
}
|
|
70
|
+
const name = names(blocker.slug);
|
|
71
|
+
return italian
|
|
72
|
+
? `${name} dà ${vote(blocker.vote)}, sotto i ${vote(blocker.target)} chiesti a questo lettore`
|
|
73
|
+
: `${name} gives ${vote(blocker.vote)}, under the ${vote(blocker.target)} asked of this reader`;
|
|
74
|
+
}
|
|
75
|
+
/** All that stands in the way in one sentence («the readers' average 6.4/10 is under 7.5/10; Anna gives 5/10, under the 8/10 asked of this reader»). */
|
|
76
|
+
export function blockersText(blockers, language, names) {
|
|
77
|
+
return blockers.map((blocker) => blockerText(blocker, language, names)).join("; ");
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=review-readers.js.map
|