narrarium-engine 0.1.21 → 0.1.23
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 +30 -3
- package/dist/autopilot/campaign.d.ts +168 -0
- package/dist/autopilot/campaign.d.ts.map +1 -0
- package/dist/autopilot/campaign.js +562 -0
- package/dist/autopilot/campaign.js.map +1 -0
- package/dist/autopilot/estimate.d.ts +13 -5
- package/dist/autopilot/estimate.d.ts.map +1 -1
- package/dist/autopilot/estimate.js +27 -14
- package/dist/autopilot/estimate.js.map +1 -1
- package/dist/autopilot/frozen.d.ts +35 -2
- package/dist/autopilot/frozen.d.ts.map +1 -1
- package/dist/autopilot/frozen.js +99 -25
- package/dist/autopilot/frozen.js.map +1 -1
- package/dist/autopilot/planner.d.ts +4 -1
- package/dist/autopilot/planner.d.ts.map +1 -1
- package/dist/autopilot/planner.js +23 -4
- package/dist/autopilot/planner.js.map +1 -1
- package/dist/autopilot/review-policy.d.ts +22 -0
- package/dist/autopilot/review-policy.d.ts.map +1 -0
- package/dist/autopilot/review-policy.js +56 -0
- package/dist/autopilot/review-policy.js.map +1 -0
- package/dist/autopilot/runner.d.ts +5 -3
- package/dist/autopilot/runner.d.ts.map +1 -1
- package/dist/autopilot/runner.js +42 -15
- package/dist/autopilot/runner.js.map +1 -1
- package/dist/autopilot/session.d.ts +19 -0
- package/dist/autopilot/session.d.ts.map +1 -1
- package/dist/autopilot/session.js +67 -1
- package/dist/autopilot/session.js.map +1 -1
- package/dist/autopilot/state.d.ts +16 -2
- package/dist/autopilot/state.d.ts.map +1 -1
- package/dist/autopilot/state.js +183 -2
- package/dist/autopilot/state.js.map +1 -1
- package/dist/autopilot/tasks.d.ts.map +1 -1
- package/dist/autopilot/tasks.js +50 -20
- package/dist/autopilot/tasks.js.map +1 -1
- package/dist/autopilot/types.d.ts +226 -4
- 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/outline-journal.d.ts +149 -0
- package/dist/book/outline-journal.d.ts.map +1 -0
- package/dist/book/outline-journal.js +321 -0
- package/dist/book/outline-journal.js.map +1 -0
- package/dist/book/outline.js +3 -3
- package/dist/book/outline.js.map +1 -1
- package/dist/book/paths.d.ts +7 -0
- package/dist/book/paths.d.ts.map +1 -1
- package/dist/book/paths.js +7 -0
- package/dist/book/paths.js.map +1 -1
- package/dist/director/opinion.d.ts +2 -0
- package/dist/director/opinion.d.ts.map +1 -1
- package/dist/director/opinion.js +4 -3
- package/dist/director/opinion.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 +15 -1
- package/dist/server/client.d.ts.map +1 -1
- package/dist/server/client.js +38 -3
- package/dist/server/client.js.map +1 -1
- package/dist/server/protocol.d.ts +40 -0
- package/dist/server/protocol.d.ts.map +1 -1
- package/dist/server/protocol.js +40 -0
- package/dist/server/protocol.js.map +1 -1
- package/dist/sync/files.d.ts +12 -0
- package/dist/sync/files.d.ts.map +1 -1
- package/dist/sync/files.js +40 -2
- package/dist/sync/files.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
import { inRevision, startedReview } from "./chapter-state.js";
|
|
2
|
+
import { authorHeldChapters, beginOutlineRewrite, campaignGoesOn, isFrozenQuestion, withDeferral, withoutDeferrals } from "./frozen.js";
|
|
3
|
+
import { CAMPAIGN_NOTE_CHARACTERS, MAX_BOOK_CHAPTERS, MAX_CAMPAIGN_CHAPTERS, MAX_REVIEW_RECORDS, MAX_REVIEW_ROUNDS_KEPT } from "./state.js";
|
|
4
|
+
import { REVIEW_MAX_CAMPAIGN_ROUNDS, REVIEW_MAX_ROUNDS, REVISION_CHAPTER_MODES, REVISION_REASONS, } from "./types.js";
|
|
5
|
+
import { randomId } from "../util/hash.js";
|
|
6
|
+
import { clipText, isItalian } from "../util/text.js";
|
|
7
|
+
/** The codes of `RevisionCampaignError`, which the personal server answers with as they are. */
|
|
8
|
+
export const REVISION_CAMPAIGN_ERROR_CODES = ["invalid_request", "campaign_active", "not_changed", "stale", "not_finished", "nothing_to_review"];
|
|
9
|
+
/** Whether a code is one of `RevisionCampaignError`'s. A host that sent a campaign reads the refusal of the server with it. */
|
|
10
|
+
export function isRevisionCampaignErrorCode(code) {
|
|
11
|
+
return typeof code === "string" && REVISION_CAMPAIGN_ERROR_CODES.includes(code);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A campaign that cannot be recorded: what was asked is not one (`invalid_request`), one goes on (`campaign_active`), a chapter has no such change (`not_changed`), or it
|
|
15
|
+
* changed since the author saw it (`stale`); a review of the book asked of a book that is not finished (`not_finished`), or whose chapters all have the target already
|
|
16
|
+
* (`nothing_to_review`).
|
|
17
|
+
*/
|
|
18
|
+
export class RevisionCampaignError extends Error {
|
|
19
|
+
code;
|
|
20
|
+
constructor(code, message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.code = code;
|
|
23
|
+
this.name = "RevisionCampaignError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function text(language, en, it) {
|
|
27
|
+
return isItalian(language) ? it : en;
|
|
28
|
+
}
|
|
29
|
+
/** The decisions of the author that a campaign replaces for its chapters: the ones that wait (not begun), the ones to decide later, the question about them. */
|
|
30
|
+
function withoutDecisionsFor(state, numbers, kind) {
|
|
31
|
+
let next = state;
|
|
32
|
+
for (const number of numbers)
|
|
33
|
+
next = withoutDeferrals(next, number, kind);
|
|
34
|
+
const pendingReviews = (next.pendingReviews ?? []).filter((entry) => entry.started || entry.kind !== kind || !numbers.has(entry.number));
|
|
35
|
+
const { pendingReviews: _before, ...rest } = next;
|
|
36
|
+
next = pendingReviews.length ? { ...rest, pendingReviews } : rest;
|
|
37
|
+
if (isFrozenQuestion(next.question) && next.question.frozen.kind === kind && numbers.has(next.question.frozen.number)) {
|
|
38
|
+
next = { ...next, question: null, message: null, status: next.status === "waiting-author" ? "paused" : next.status };
|
|
39
|
+
}
|
|
40
|
+
return next;
|
|
41
|
+
}
|
|
42
|
+
const outlineChange = {
|
|
43
|
+
check(input, items) {
|
|
44
|
+
return input.chapters.map((chapter) => {
|
|
45
|
+
const item = items.find((entry) => entry.kind === "outline" && entry.inPlan && entry.number === chapter.number);
|
|
46
|
+
if (!item)
|
|
47
|
+
throw new RevisionCampaignError("not_changed", `Chapter ${chapter.number} has no change of its synopsis entry to apply: it is not written, the autopilot has it in its hands, or its entry is the one it follows.`);
|
|
48
|
+
if (chapter.fingerprint !== undefined && chapter.fingerprint !== item.fingerprint)
|
|
49
|
+
throw new RevisionCampaignError("stale", `The synopsis entry of chapter ${chapter.number} changed again since it was looked at: look at it again.`);
|
|
50
|
+
const instruction = chapter.instruction?.trim() ? clipText(chapter.instruction.trim(), CAMPAIGN_NOTE_CHARACTERS) : undefined;
|
|
51
|
+
return { number: chapter.number, mode: chapter.mode, fingerprint: item.fingerprint, status: "waiting", ...(instruction ? { instruction } : {}) };
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
record(input, campaign, at, running) {
|
|
55
|
+
let state = withoutDecisionsFor(input, new Set(campaign.chapters.map((chapter) => chapter.number)), "outline");
|
|
56
|
+
state = structuredClone(state);
|
|
57
|
+
const chapters = campaign.chapters.map((item) => ({ ...item }));
|
|
58
|
+
for (const item of chapters) {
|
|
59
|
+
if (item.mode === "later") {
|
|
60
|
+
state = withDeferral(state, { kind: "outline", number: item.number, fingerprint: item.fingerprint ?? "" }, at);
|
|
61
|
+
Object.assign(item, { status: "done", endedAt: at });
|
|
62
|
+
}
|
|
63
|
+
else if (item.mode === "keep" && !running) {
|
|
64
|
+
// Nobody runs: the plan follows the entry now, in the same commit. While a run goes on the plan is its own, and it keeps it at its next step.
|
|
65
|
+
const planned = state.plan?.chapters.find((chapter) => chapter.number === item.number);
|
|
66
|
+
if (planned && item.fingerprint)
|
|
67
|
+
planned.outlineDigest = item.fingerprint;
|
|
68
|
+
Object.assign(item, { status: "done", endedAt: at });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const next = { ...campaign, chapters };
|
|
72
|
+
return chapters.some((item) => item.status === "waiting") ? { ...state, campaign: next } : state;
|
|
73
|
+
},
|
|
74
|
+
start(state, chapter, item, campaign, frozen) {
|
|
75
|
+
// The outline is compared with an approved plan only, and a chapter the autopilot has in its hands is not taken from it.
|
|
76
|
+
if (!state.plan?.approved || chapter.status !== "done")
|
|
77
|
+
return { outcome: "wait" };
|
|
78
|
+
const outline = frozen.outlineWritten.get(item.number);
|
|
79
|
+
if (!outline)
|
|
80
|
+
return { outcome: "skip", why: "gone" };
|
|
81
|
+
const note = [campaign.note, item.instruction].filter(Boolean).join("\n");
|
|
82
|
+
beginOutlineRewrite(state, chapter, outline, { id: `${campaign.id}-${item.number}`, createdAt: frozen.now, ...(note ? { note } : {}) });
|
|
83
|
+
// The book is rewritten: nobody has judged it as it is going to be.
|
|
84
|
+
state.finalDone = false;
|
|
85
|
+
delete state.finalReview;
|
|
86
|
+
return { outcome: "started" };
|
|
87
|
+
},
|
|
88
|
+
finished(state, chapter) {
|
|
89
|
+
return chapter.status === "done" && !inRevision(state, chapter.number) && state.review?.chapterNumber !== chapter.number;
|
|
90
|
+
},
|
|
91
|
+
keep(_state, chapter, item) {
|
|
92
|
+
if (item.fingerprint)
|
|
93
|
+
chapter.outlineDigest = item.fingerprint;
|
|
94
|
+
},
|
|
95
|
+
cancel(input, cancelled, at) {
|
|
96
|
+
// What the author did not see through is left for the author: decided later, so that nothing rewrites it, and nothing asks about it, until they decide.
|
|
97
|
+
let state = input;
|
|
98
|
+
for (const item of cancelled)
|
|
99
|
+
if (item.fingerprint)
|
|
100
|
+
state = withDeferral(state, { kind: "outline", number: item.number, fingerprint: item.fingerprint }, at);
|
|
101
|
+
return state;
|
|
102
|
+
},
|
|
103
|
+
texts: {
|
|
104
|
+
chapterDone: (number, done, total, language) => text(language, `Chapter ${number} now follows the new synopsis (${done} of ${total})`, `Il capitolo ${number} ora segue la nuova Sinossi (${done} di ${total})`),
|
|
105
|
+
skipped: (number, why, language) => why === "gone"
|
|
106
|
+
? text(language, `Chapter ${number}: its synopsis entry is again the one it follows, nothing to rewrite`, `Capitolo ${number}: la sua voce della Sinossi è di nuovo quella che segue, non c'è nulla da riscrivere`)
|
|
107
|
+
: text(language, `Chapter ${number} is no longer in the plan: it is left out`, `Il capitolo ${number} non è più nel piano: viene lasciato fuori`),
|
|
108
|
+
done: (worked, language) => text(language, `The synopsis is applied to the book: ${worked === 1 ? "1 chapter" : `${worked} chapters`} rewritten to follow it. The plan goes on.`, `La Sinossi è applicata al libro: ${worked === 1 ? "1 capitolo riscritto" : `${worked} capitoli riscritti`} per seguirla. Il piano prosegue.`),
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
// ─── A review of the book to a target (`review-target`) ─────────────────────
|
|
112
|
+
/** The vote of a chapter: the director's when it was last closed (`score`), else the last vote of its rounds; `null` for a chapter nobody voted. */
|
|
113
|
+
export function chapterVote(chapter) {
|
|
114
|
+
if (typeof chapter.score === "number" && Number.isFinite(chapter.score))
|
|
115
|
+
return chapter.score;
|
|
116
|
+
const rounds = chapter.rounds ?? [];
|
|
117
|
+
for (let index = rounds.length - 1; index >= 0; index -= 1) {
|
|
118
|
+
const vote = rounds[index]?.director;
|
|
119
|
+
if (typeof vote === "number" && Number.isFinite(vote))
|
|
120
|
+
return vote;
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The votes of a review of the book now: over the chapters it may revise (`scope`), the lowest vote and the chapters under the target (a chapter nobody voted is
|
|
126
|
+
* under it: it has never been judged), and the vote of the book (the director's last judgement of the whole book).
|
|
127
|
+
*/
|
|
128
|
+
export function reviewVotes(state, scope, target) {
|
|
129
|
+
const inScope = new Set(scope);
|
|
130
|
+
let lowest = null;
|
|
131
|
+
const chapters = [];
|
|
132
|
+
for (const chapter of state.plan?.chapters ?? []) {
|
|
133
|
+
if (!inScope.has(chapter.number))
|
|
134
|
+
continue;
|
|
135
|
+
const vote = chapterVote(chapter);
|
|
136
|
+
if (vote !== null)
|
|
137
|
+
lowest = lowest === null ? vote : Math.min(lowest, vote);
|
|
138
|
+
if (vote === null || vote < target)
|
|
139
|
+
chapters.push(chapter.number);
|
|
140
|
+
}
|
|
141
|
+
chapters.sort((left, right) => left - right);
|
|
142
|
+
return { lowest, book: state.finalReview?.score ?? null, below: chapters.length, chapters };
|
|
143
|
+
}
|
|
144
|
+
const plainVotes = (votes) => ({ lowest: votes.lowest, book: votes.book, below: votes.below });
|
|
145
|
+
const vote = (value) => (value === null || value === undefined ? "—" : `${value}/10`);
|
|
146
|
+
/** The review that is over, as the state remembers it, with how it ended. Mutates `state`. */
|
|
147
|
+
function rememberReview(state, campaign, outcome, at) {
|
|
148
|
+
const review = campaign.review;
|
|
149
|
+
if (!review)
|
|
150
|
+
return;
|
|
151
|
+
const last = review.history[review.history.length - 1];
|
|
152
|
+
const to = outcome === "cancelled" || !last ? plainVotes(reviewVotes(state, review.scope, review.targetScore)) : plainVotes(last);
|
|
153
|
+
const record = { targetScore: review.targetScore, rounds: review.history.length, outcome, from: plainVotes(review.start), to, startedAt: campaign.createdAt, endedAt: at };
|
|
154
|
+
state.reviews = [...(state.reviews ?? []), record].slice(-MAX_REVIEW_RECORDS);
|
|
155
|
+
}
|
|
156
|
+
const reviewTarget = {
|
|
157
|
+
check() {
|
|
158
|
+
throw new RevisionCampaignError("invalid_request", "A review of the book is asked with reviewBook (its target and its rounds), not as a list of chapters.");
|
|
159
|
+
},
|
|
160
|
+
record(state, campaign) {
|
|
161
|
+
return { ...state, campaign };
|
|
162
|
+
},
|
|
163
|
+
start(state, chapter, _item, campaign, frozen) {
|
|
164
|
+
if (!state.plan?.approved || chapter.status !== "done")
|
|
165
|
+
return { outcome: "wait" };
|
|
166
|
+
const review = campaign.review;
|
|
167
|
+
// The author's chapters keep their rules: one the author froze is reviewed only when the author included it, and one changed since it was frozen waits for the
|
|
168
|
+
// decision about that change. The review leaves them out, and its votes are of the others from now on.
|
|
169
|
+
const authors = (frozen.authorFrozen?.has(chapter.slug) && !review?.include?.includes(chapter.number)) || frozen.changedFrozen?.has(chapter.slug);
|
|
170
|
+
if (authors) {
|
|
171
|
+
if (review)
|
|
172
|
+
review.scope = review.scope.filter((number) => number !== chapter.number);
|
|
173
|
+
return { outcome: "skip", why: "author" };
|
|
174
|
+
}
|
|
175
|
+
// Reviewed again from its first round, with the target of the review; the simulated readers read it again only when the review asks for it.
|
|
176
|
+
chapter.status = "review";
|
|
177
|
+
if ((campaign.review?.readerRounds ?? 1) > 0)
|
|
178
|
+
delete chapter.skipReaders;
|
|
179
|
+
else
|
|
180
|
+
chapter.skipReaders = true;
|
|
181
|
+
if (state.review?.chapterNumber === chapter.number)
|
|
182
|
+
state.review = null;
|
|
183
|
+
// The book changes: the director judges it again at the end of the round.
|
|
184
|
+
state.finalDone = false;
|
|
185
|
+
delete state.finalReview;
|
|
186
|
+
return { outcome: "started" };
|
|
187
|
+
},
|
|
188
|
+
finished(state, chapter) {
|
|
189
|
+
return chapter.status === "done" && !inRevision(state, chapter.number) && state.review?.chapterNumber !== chapter.number;
|
|
190
|
+
},
|
|
191
|
+
keep() {
|
|
192
|
+
// A review has no chapter to keep.
|
|
193
|
+
},
|
|
194
|
+
cancel(input, _cancelled, at) {
|
|
195
|
+
// Remembered now when nothing is being worked; else when the chapter being worked is over (`complete`), which ends the campaign.
|
|
196
|
+
const campaign = input.campaign;
|
|
197
|
+
if (!campaign?.review || campaign.chapters.some((item) => item.status === "working"))
|
|
198
|
+
return input;
|
|
199
|
+
const state = structuredClone(input);
|
|
200
|
+
rememberReview(state, campaign, "cancelled", at);
|
|
201
|
+
return state;
|
|
202
|
+
},
|
|
203
|
+
complete(state, campaign) {
|
|
204
|
+
if (campaign.cancelledAt)
|
|
205
|
+
rememberReview(state, campaign, "cancelled", campaign.cancelledAt);
|
|
206
|
+
},
|
|
207
|
+
afterChapters(state, campaign, frozen, report, language) {
|
|
208
|
+
const review = campaign.review;
|
|
209
|
+
if (!review)
|
|
210
|
+
return "end";
|
|
211
|
+
if (review.phase === "chapters") {
|
|
212
|
+
// The round's chapters are over: the director judges the whole book again (the run's last step), and the round is judged by it. A round that reviewed
|
|
213
|
+
// nothing (the author has its chapters) left the book as it was judged: it is judged at once by the votes there are.
|
|
214
|
+
const reviewedAny = campaign.chapters.some((item) => item.mode === "follow" && item.status === "done");
|
|
215
|
+
if (reviewedAny || !state.finalDone) {
|
|
216
|
+
review.phase = "verdict";
|
|
217
|
+
state.finalDone = false;
|
|
218
|
+
delete state.finalReview;
|
|
219
|
+
return "wait";
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else if (!state.finalDone)
|
|
223
|
+
return "wait";
|
|
224
|
+
const target = review.targetScore;
|
|
225
|
+
const now = reviewVotes(state, review.scope, target);
|
|
226
|
+
const previous = review.history[review.history.length - 1] ?? review.start;
|
|
227
|
+
const raised = (current, before) => current !== null && (before === null || current > before);
|
|
228
|
+
review.stalled = raised(now.lowest, previous.lowest) || raised(now.book, previous.book) ? 0 : review.stalled + 1;
|
|
229
|
+
const reviewed = campaign.chapters.filter((item) => item.mode === "follow" && item.status === "done").map((item) => item.number);
|
|
230
|
+
review.history = [...review.history, { round: review.round, chapters: reviewed, ...plainVotes(now), endedAt: frozen.now }].slice(-MAX_REVIEW_ROUNDS_KEPT);
|
|
231
|
+
const figures = { round: review.round, target, ...(now.lowest !== null ? { lowest: now.lowest } : {}), ...(now.book !== null ? { book: now.book } : {}), below: now.below };
|
|
232
|
+
report({
|
|
233
|
+
key: `review-round:${campaign.id}:${review.round}`,
|
|
234
|
+
tone: "info",
|
|
235
|
+
code: "reviewRoundDone",
|
|
236
|
+
title: text(language, `Round ${review.round} of the review is over: the lowest chapter ${vote(now.lowest)}, the book ${vote(now.book)} (target ${target}/10)`, `Il giro ${review.round} della revisione è finito: il capitolo più basso ${vote(now.lowest)}, il libro ${vote(now.book)} (obiettivo ${target}/10)`),
|
|
237
|
+
figures,
|
|
238
|
+
});
|
|
239
|
+
const finish = (outcome, tone, code, title, detail) => {
|
|
240
|
+
rememberReview(state, campaign, outcome, frozen.now);
|
|
241
|
+
report({ key: `review-end:${campaign.id}`, tone, code, title, ...(detail ? { detail } : {}), figures: { ...figures, rounds: review.history.length, outcome } });
|
|
242
|
+
return "end";
|
|
243
|
+
};
|
|
244
|
+
const rounds = review.history.length;
|
|
245
|
+
if (now.below === 0 && now.book !== null && now.book >= target) {
|
|
246
|
+
return finish("target", "ok", "reviewDone", text(language, `The book reached the target: ${vote(now.book)}, every chapter at ${target}/10 or more (${rounds === 1 ? "1 round" : `${rounds} rounds`})`, `Il libro ha raggiunto l'obiettivo: ${vote(now.book)}, ogni capitolo a ${target}/10 o più (${rounds === 1 ? "1 giro" : `${rounds} giri`})`));
|
|
247
|
+
}
|
|
248
|
+
if (now.below === 0) {
|
|
249
|
+
return finish("chapters", "info", "reviewStopped", text(language, `Every chapter reached ${target}/10, the book as a whole got ${vote(now.book)}: the review ends here`, `Ogni capitolo ha raggiunto ${target}/10, il libro nel suo insieme ha ${vote(now.book)}: la revisione finisce qui`), text(language, "What the director asks of the whole book is in its last judgement: the chapters have nothing left under the target to review.", "Ciò che il direttore chiede al libro intero è nel suo ultimo giudizio: nei capitoli non resta nulla sotto l'obiettivo da rivedere."));
|
|
250
|
+
}
|
|
251
|
+
if (review.stalled >= 2) {
|
|
252
|
+
return finish("plateau", "warning", "reviewStopped", text(language, `The review stopped: two rounds in a row raised neither the lowest chapter (${vote(now.lowest)}) nor the book (${vote(now.book)})`, `La revisione si è fermata: due giri di fila non hanno alzato né il capitolo più basso (${vote(now.lowest)}) né il libro (${vote(now.book)})`), text(language, "Another round would spend without getting closer to the target: change the target, the director or the chapters, then review the book again.", "Un altro giro spenderebbe senza avvicinarsi all'obiettivo: cambia l'obiettivo, il direttore o i capitoli, poi rivedi di nuovo il libro."));
|
|
253
|
+
}
|
|
254
|
+
// Another round, with the chapters still under the target.
|
|
255
|
+
review.round += 1;
|
|
256
|
+
review.phase = "chapters";
|
|
257
|
+
campaign.chapters = now.chapters.map((number) => ({ number, mode: "follow", status: "waiting" }));
|
|
258
|
+
const cap = state.options.review?.campaignMaxRounds ?? 0;
|
|
259
|
+
if (cap > 0 && review.round - review.windowStart + 1 > cap) {
|
|
260
|
+
const done = review.round - review.windowStart;
|
|
261
|
+
const message = text(language, `${done === 1 ? "1 round" : `${done} rounds`} of the review done, as many as you allowed: start the autopilot again to go on for ${cap === 1 ? "1 more" : `${cap} more`}`, `${done === 1 ? "1 giro" : `${done} giri`} della revisione fatti, quanti ne hai permessi: riavvia l'autopilot per continuare per altri ${cap}`);
|
|
262
|
+
campaign.held = { at: frozen.now, message };
|
|
263
|
+
state.limitReached = { kind: "review-rounds", used: done, limit: cap, at: frozen.now };
|
|
264
|
+
report({ key: `review-held:${campaign.id}:${review.round}`, tone: "warning", code: "reviewHeld", title: message, figures: { ...figures, rounds: done, limit: cap } });
|
|
265
|
+
return "wait";
|
|
266
|
+
}
|
|
267
|
+
return "again";
|
|
268
|
+
},
|
|
269
|
+
resume(_state, campaign) {
|
|
270
|
+
// The rounds allowed are counted again from the round in progress.
|
|
271
|
+
if (campaign.review)
|
|
272
|
+
campaign.review.windowStart = campaign.review.round;
|
|
273
|
+
},
|
|
274
|
+
codes: { chapterDone: "reviewChapterDone", skipped: "reviewChapterSkipped" },
|
|
275
|
+
figures(chapter, campaign) {
|
|
276
|
+
const score = chapterVote(chapter);
|
|
277
|
+
return { ...(score !== null ? { score } : {}), ...(campaign.review ? { target: campaign.review.targetScore, round: campaign.review.round } : {}) };
|
|
278
|
+
},
|
|
279
|
+
texts: {
|
|
280
|
+
chapterDone: (number, _done, _total, language, context) => {
|
|
281
|
+
const score = context ? chapterVote(context.chapter) : null;
|
|
282
|
+
const target = context?.campaign.review?.targetScore;
|
|
283
|
+
return text(language, `Chapter ${number} reviewed again: ${vote(score)}${target !== undefined ? ` (target ${target}/10)` : ""}`, `Capitolo ${number} rivisto di nuovo: ${vote(score)}${target !== undefined ? ` (obiettivo ${target}/10)` : ""}`);
|
|
284
|
+
},
|
|
285
|
+
skipped: (number, why, language) => why === "author"
|
|
286
|
+
? text(language, `Chapter ${number} is yours now (you froze it, or changed it since it was frozen): the review leaves it out`, `Il capitolo ${number} ora è tuo (l'hai congelato, o modificato dopo il congelamento): la revisione lo lascia fuori`)
|
|
287
|
+
: text(language, `Chapter ${number} is no longer in the plan: the review leaves it out`, `Il capitolo ${number} non è più nel piano: la revisione lo lascia fuori`),
|
|
288
|
+
done: () => "",
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
/** The handlers of the reasons: the extension point of the campaigns. */
|
|
292
|
+
export const REVISION_REASON_HANDLERS = { "outline-change": outlineChange, "review-target": reviewTarget };
|
|
293
|
+
/** Whether the book is finished: an approved plan whose chapters are all closed, and the director's judgement of the whole book. */
|
|
294
|
+
export function bookFinished(state) {
|
|
295
|
+
return Boolean(state.plan?.approved && state.plan.chapters.length && state.plan.chapters.every((chapter) => chapter.status === "done") && state.finalDone);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* The chapters of the author's in a book: frozen by the author by hand, or written before the autopilot (`imported`, and not frozen by the autopilot: once the
|
|
299
|
+
* book grows, the plan made again counts every written chapter as imported, and the freeze record still tells which the autopilot approved). A review of the
|
|
300
|
+
* book leaves them out unless the author includes them: the autopilot never rewrites them by its own decision.
|
|
301
|
+
*/
|
|
302
|
+
export function authorChapters(state, snapshot) {
|
|
303
|
+
const frozenBy = new Map(snapshot.chapters.map((chapter) => [chapter.slug, chapter.frozen?.by]));
|
|
304
|
+
return new Set((state.plan?.chapters ?? []).filter((chapter) => frozenBy.get(chapter.slug) === "author" || (chapter.imported && frozenBy.get(chapter.slug) !== "autopilot")).map((chapter) => chapter.number));
|
|
305
|
+
}
|
|
306
|
+
/** A review of the book from what the author asked, checked against the book now. Throws a `RevisionCampaignError`. */
|
|
307
|
+
export function createReviewCampaign(input, state, snapshot, now, id = randomId("review")) {
|
|
308
|
+
const refuse = (problem) => {
|
|
309
|
+
throw new RevisionCampaignError("invalid_request", problem);
|
|
310
|
+
};
|
|
311
|
+
if (!input || typeof input !== "object")
|
|
312
|
+
refuse("A review is { targetScore, maxRounds?, readerRounds?, campaignMaxRounds?, budgetLimit?, budgetTokens?, include?, note? }.");
|
|
313
|
+
const whole = (value, min, max) => typeof value === "number" && Number.isSafeInteger(value) && value >= min && value <= max;
|
|
314
|
+
if (typeof input.targetScore !== "number" || !Number.isFinite(input.targetScore) || input.targetScore < 1 || input.targetScore > 10)
|
|
315
|
+
refuse("The target is a vote from 1 to 10.");
|
|
316
|
+
if (input.maxRounds !== undefined && !whole(input.maxRounds, 1, REVIEW_MAX_ROUNDS))
|
|
317
|
+
refuse(`The rounds of a chapter are a whole number from 1 to ${REVIEW_MAX_ROUNDS}.`);
|
|
318
|
+
if (input.readerRounds !== undefined && !whole(input.readerRounds, 0, REVIEW_MAX_ROUNDS))
|
|
319
|
+
refuse(`The readers' rounds are a whole number from 0 to ${REVIEW_MAX_ROUNDS}.`);
|
|
320
|
+
if (input.campaignMaxRounds !== undefined && !whole(input.campaignMaxRounds, 0, REVIEW_MAX_CAMPAIGN_ROUNDS))
|
|
321
|
+
refuse(`The rounds of the review are a whole number from 0 to ${REVIEW_MAX_CAMPAIGN_ROUNDS}.`);
|
|
322
|
+
if (input.budgetLimit !== undefined && (typeof input.budgetLimit !== "number" || !Number.isFinite(input.budgetLimit) || input.budgetLimit < 0 || input.budgetLimit > 1_000_000))
|
|
323
|
+
refuse("The money cap is an amount from 0 (none).");
|
|
324
|
+
if (input.budgetTokens !== undefined && !whole(input.budgetTokens, 0, Number.MAX_SAFE_INTEGER))
|
|
325
|
+
refuse("The token cap is a whole number from 0 (none).");
|
|
326
|
+
if (input.include !== undefined && (!Array.isArray(input.include) || input.include.length > MAX_CAMPAIGN_CHAPTERS || input.include.some((number) => !whole(number, 1, MAX_BOOK_CHAPTERS))))
|
|
327
|
+
refuse("The chapters to include are chapter numbers.");
|
|
328
|
+
if (input.note !== undefined && typeof input.note !== "string")
|
|
329
|
+
refuse("The note of a review is a text.");
|
|
330
|
+
if (!bookFinished(state))
|
|
331
|
+
throw new RevisionCampaignError("not_finished", "The book is not finished: a review of the whole book comes after its last chapter and the director's judgement of it.");
|
|
332
|
+
if (campaignGoesOn(state))
|
|
333
|
+
throw new RevisionCampaignError("campaign_active", "Chapters are being revised already: wait until they are done, or cancel what waits.");
|
|
334
|
+
const targetScore = Math.round(input.targetScore * 10) / 10;
|
|
335
|
+
const include = [...new Set(input.include ?? [])].sort((left, right) => left - right);
|
|
336
|
+
const authors = authorChapters(state, snapshot);
|
|
337
|
+
// A chapter changed since it was frozen waits for the decision about that change, included or not.
|
|
338
|
+
const { changedFrozen } = authorHeldChapters(snapshot);
|
|
339
|
+
const scope = state.plan.chapters.filter((chapter) => !changedFrozen.has(chapter.slug) && (!authors.has(chapter.number) || include.includes(chapter.number))).map((chapter) => chapter.number);
|
|
340
|
+
const votes = reviewVotes(state, scope, targetScore);
|
|
341
|
+
if (!votes.below)
|
|
342
|
+
throw new RevisionCampaignError("nothing_to_review", `Every chapter of the review has ${targetScore}/10 already: there is nothing under the target to review.`);
|
|
343
|
+
const note = input.note?.trim() ? clipText(input.note.trim(), CAMPAIGN_NOTE_CHARACTERS) : undefined;
|
|
344
|
+
return {
|
|
345
|
+
id,
|
|
346
|
+
reason: "review-target",
|
|
347
|
+
createdAt: now.toISOString(),
|
|
348
|
+
...(note ? { note } : {}),
|
|
349
|
+
chapters: votes.chapters.map((number) => ({ number, mode: "follow", status: "waiting" })),
|
|
350
|
+
review: {
|
|
351
|
+
targetScore,
|
|
352
|
+
...(input.maxRounds !== undefined ? { maxRounds: input.maxRounds } : {}),
|
|
353
|
+
...(input.readerRounds !== undefined ? { readerRounds: input.readerRounds } : {}),
|
|
354
|
+
...(include.length ? { include } : {}),
|
|
355
|
+
scope,
|
|
356
|
+
round: 1,
|
|
357
|
+
windowStart: 1,
|
|
358
|
+
phase: "chapters",
|
|
359
|
+
start: plainVotes(votes),
|
|
360
|
+
history: [],
|
|
361
|
+
stalled: 0,
|
|
362
|
+
},
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
/** A run starts: a campaign held for the author goes on, and what its reason counts since a run began starts again (pure). */
|
|
366
|
+
export function resumeCampaign(state, at) {
|
|
367
|
+
if (!state.campaign)
|
|
368
|
+
return state;
|
|
369
|
+
const campaign = structuredClone(state.campaign);
|
|
370
|
+
REVISION_REASON_HANDLERS[campaign.reason].resume?.(state, campaign, at);
|
|
371
|
+
delete campaign.held;
|
|
372
|
+
return { ...state, campaign };
|
|
373
|
+
}
|
|
374
|
+
/** A campaign from what the author asked, checked against what the book is now (`items`: `frozenWork`). Throws a `RevisionCampaignError`. */
|
|
375
|
+
export function createRevisionCampaign(input, items, now, id = randomId("campaign")) {
|
|
376
|
+
if (!input || typeof input !== "object")
|
|
377
|
+
throw new RevisionCampaignError("invalid_request", "A campaign is { reason, chapters: [{ number, mode }], note? }.");
|
|
378
|
+
if (!REVISION_REASONS.includes(input.reason))
|
|
379
|
+
throw new RevisionCampaignError("invalid_request", `The reason is one of: ${REVISION_REASONS.join(", ")}.`);
|
|
380
|
+
if (!Array.isArray(input.chapters) || !input.chapters.length || input.chapters.length > MAX_CAMPAIGN_CHAPTERS)
|
|
381
|
+
throw new RevisionCampaignError("invalid_request", `A campaign has from 1 to ${MAX_CAMPAIGN_CHAPTERS} chapters.`);
|
|
382
|
+
const seen = new Set();
|
|
383
|
+
for (const chapter of input.chapters) {
|
|
384
|
+
if (!chapter || !Number.isSafeInteger(chapter.number) || chapter.number < 1 || chapter.number > MAX_BOOK_CHAPTERS)
|
|
385
|
+
throw new RevisionCampaignError("invalid_request", "A chapter of a campaign has a number from 1.");
|
|
386
|
+
if (seen.has(chapter.number))
|
|
387
|
+
throw new RevisionCampaignError("invalid_request", `Chapter ${chapter.number} is named twice.`);
|
|
388
|
+
seen.add(chapter.number);
|
|
389
|
+
if (!REVISION_CHAPTER_MODES.includes(chapter.mode))
|
|
390
|
+
throw new RevisionCampaignError("invalid_request", `What to do with chapter ${chapter.number} is one of: ${REVISION_CHAPTER_MODES.join(", ")}.`);
|
|
391
|
+
if (chapter.instruction !== undefined && typeof chapter.instruction !== "string")
|
|
392
|
+
throw new RevisionCampaignError("invalid_request", `The instruction of chapter ${chapter.number} is a text.`);
|
|
393
|
+
if (chapter.fingerprint !== undefined && typeof chapter.fingerprint !== "string")
|
|
394
|
+
throw new RevisionCampaignError("invalid_request", `The fingerprint of chapter ${chapter.number} is a text.`);
|
|
395
|
+
}
|
|
396
|
+
if (input.note !== undefined && typeof input.note !== "string")
|
|
397
|
+
throw new RevisionCampaignError("invalid_request", "The note of a campaign is a text.");
|
|
398
|
+
const chapters = REVISION_REASON_HANDLERS[input.reason].check(input, items).sort((left, right) => left.number - right.number);
|
|
399
|
+
const note = input.note?.trim() ? clipText(input.note.trim(), CAMPAIGN_NOTE_CHARACTERS) : undefined;
|
|
400
|
+
return { id, reason: input.reason, createdAt: now.toISOString(), ...(note ? { note } : {}), chapters };
|
|
401
|
+
}
|
|
402
|
+
/** The state with a campaign recorded (pure): refused while another one goes on. */
|
|
403
|
+
export function recordRevisionCampaign(state, campaign, at, running) {
|
|
404
|
+
if (campaignGoesOn(state))
|
|
405
|
+
throw new RevisionCampaignError("campaign_active", "Chapters are being revised already: wait until they are done, or cancel what waits.");
|
|
406
|
+
const { campaign: _done, ...rest } = state;
|
|
407
|
+
return REVISION_REASON_HANDLERS[campaign.reason].record(rest, campaign, at, running);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* The state with the chapters of the campaign that wait cancelled (the one being worked finishes, and then the campaign ends: a campaign of rounds begins no other);
|
|
411
|
+
* the campaign goes once nothing of it is left to do. A limit it held the run for goes with it.
|
|
412
|
+
*/
|
|
413
|
+
export function cancelRevisionCampaign(state, at) {
|
|
414
|
+
const campaign = state.campaign;
|
|
415
|
+
if (!campaign)
|
|
416
|
+
return state;
|
|
417
|
+
const cancelled = campaign.chapters.filter((item) => item.status === "waiting");
|
|
418
|
+
const chapters = campaign.chapters.map((item) => (item.status === "waiting" ? { ...item, status: "cancelled", endedAt: at } : item));
|
|
419
|
+
const { held: _held, ...rest } = campaign;
|
|
420
|
+
const next = REVISION_REASON_HANDLERS[campaign.reason].cancel({ ...state, campaign: { ...rest, chapters, cancelledAt: at } }, cancelled, at);
|
|
421
|
+
const limit = next.limitReached?.kind === "review-rounds" ? (({ limitReached: _limit, ...others }) => others)(next) : next;
|
|
422
|
+
if (chapters.some((item) => item.status === "working"))
|
|
423
|
+
return limit;
|
|
424
|
+
const { campaign: _gone, ...without } = limit;
|
|
425
|
+
return without;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* What advancing the state does with the campaign (`advanceState` calls it, after the decisions about changes): the chapters kept by the author while a run
|
|
429
|
+
* went on, the end of the chapter being worked, and, when the planner may start one (`frozen` is given) and nothing else is in progress, the next chapter
|
|
430
|
+
* that waits, in the order of the book (unless the reason says to stop). Once nothing waits or is being worked, the campaign is done, said once, and goes.
|
|
431
|
+
* Mutates `state`; deterministic (every moment comes from `frozen.now`).
|
|
432
|
+
*/
|
|
433
|
+
export function advanceRevisionCampaign(state, report, language, frozen) {
|
|
434
|
+
const campaign = state.campaign;
|
|
435
|
+
const plan = state.plan;
|
|
436
|
+
if (!campaign || !plan || !frozen)
|
|
437
|
+
return;
|
|
438
|
+
const handler = REVISION_REASON_HANDLERS[campaign.reason];
|
|
439
|
+
const chapterOf = (number) => plan.chapters.find((chapter) => chapter.number === number);
|
|
440
|
+
const worked = () => campaign.chapters.filter((item) => item.mode === "follow");
|
|
441
|
+
const end = (item, status, why) => Object.assign(item, { status, endedAt: frozen.now, ...(why ? { why } : {}) });
|
|
442
|
+
// A campaign of rounds says a chapter once in each round.
|
|
443
|
+
const roundKey = () => (campaign.review ? `:${campaign.review.round}` : "");
|
|
444
|
+
for (const item of campaign.chapters) {
|
|
445
|
+
if (item.mode !== "keep" || item.status !== "waiting")
|
|
446
|
+
continue;
|
|
447
|
+
const chapter = chapterOf(item.number);
|
|
448
|
+
if (chapter)
|
|
449
|
+
handler.keep(state, chapter, item);
|
|
450
|
+
end(item, "done");
|
|
451
|
+
}
|
|
452
|
+
const working = campaign.chapters.find((item) => item.status === "working");
|
|
453
|
+
if (working) {
|
|
454
|
+
const chapter = chapterOf(working.number);
|
|
455
|
+
if (chapter && !handler.finished(state, chapter))
|
|
456
|
+
return;
|
|
457
|
+
end(working, chapter ? "done" : "skipped", chapter ? undefined : "not-in-plan");
|
|
458
|
+
const over = worked().filter((item) => item.status === "done" || item.status === "skipped").length;
|
|
459
|
+
if (chapter) {
|
|
460
|
+
const figures = handler.figures?.(chapter, campaign);
|
|
461
|
+
report({
|
|
462
|
+
key: `campaign-chapter:${campaign.id}:${working.number}${roundKey()}`,
|
|
463
|
+
tone: "ok",
|
|
464
|
+
code: handler.codes?.chapterDone ?? "campaignChapterDone",
|
|
465
|
+
chapterNumber: working.number,
|
|
466
|
+
title: handler.texts.chapterDone(working.number, over, worked().filter((item) => item.status !== "cancelled").length, language, { chapter, campaign }),
|
|
467
|
+
...(figures ? { figures } : {}),
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
const idle = !state.question && !state.revision && !state.review && !startedReview(state);
|
|
472
|
+
let stopped = null;
|
|
473
|
+
/** Begin the next chapter that waits, in the order of the book: `true` when one began. Not while the campaign waits for the author, or was cancelled. */
|
|
474
|
+
const startNext = () => {
|
|
475
|
+
if (campaign.held || campaign.cancelledAt)
|
|
476
|
+
return false;
|
|
477
|
+
for (const item of campaign.chapters) {
|
|
478
|
+
if (item.status !== "waiting" || item.mode !== "follow")
|
|
479
|
+
continue;
|
|
480
|
+
const chapter = chapterOf(item.number);
|
|
481
|
+
if (!chapter) {
|
|
482
|
+
end(item, "skipped", "not-in-plan");
|
|
483
|
+
report({ key: `campaign-skipped:${campaign.id}:${item.number}${roundKey()}`, tone: "info", code: handler.codes?.skipped ?? "campaignSkipped", chapterNumber: item.number, title: handler.texts.skipped(item.number, "not-in-plan", language) });
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
const started = handler.start(state, chapter, item, campaign, frozen);
|
|
487
|
+
if (started.outcome === "wait")
|
|
488
|
+
return false;
|
|
489
|
+
if (started.outcome === "skip") {
|
|
490
|
+
end(item, "skipped", started.why);
|
|
491
|
+
report({ key: `campaign-skipped:${campaign.id}:${item.number}${roundKey()}`, tone: "info", code: handler.codes?.skipped ?? "campaignSkipped", chapterNumber: item.number, title: handler.texts.skipped(item.number, started.why, language) });
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
Object.assign(item, { status: "working", startedAt: frozen.now });
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
return false;
|
|
498
|
+
};
|
|
499
|
+
if (idle) {
|
|
500
|
+
stopped = handler.stop?.(state, campaign, language) ?? null;
|
|
501
|
+
if (stopped) {
|
|
502
|
+
// The chapters that wait end as if the author cancelled them: what becomes of them is the reason's (`cancel`).
|
|
503
|
+
const left = campaign.chapters.filter((item) => item.status === "waiting");
|
|
504
|
+
for (const item of left)
|
|
505
|
+
end(item, "cancelled");
|
|
506
|
+
Object.assign(state, handler.cancel(state, left, frozen.now));
|
|
507
|
+
report({ key: `campaign-stopped:${campaign.id}`, tone: "warning", code: "campaignStopped", title: text(language, "The revision of the chosen chapters stopped before its end: the chapters that waited are left to you", "La revisione dei capitoli scelti si è fermata prima della fine: i capitoli che aspettavano restano a te"), detail: stopped });
|
|
508
|
+
}
|
|
509
|
+
else if (startNext()) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (campaign.chapters.some((item) => item.status === "waiting" || item.status === "working"))
|
|
514
|
+
return;
|
|
515
|
+
// A reason that goes on in rounds says what comes next, unless the author cancelled the campaign: then it ends with its chapter.
|
|
516
|
+
if (handler.afterChapters && !campaign.cancelledAt && !stopped) {
|
|
517
|
+
const next = handler.afterChapters(state, campaign, frozen, report, language);
|
|
518
|
+
if (next === "wait")
|
|
519
|
+
return;
|
|
520
|
+
if (next === "again") {
|
|
521
|
+
if (idle)
|
|
522
|
+
startNext();
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
delete state.campaign;
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
handler.complete?.(state, campaign);
|
|
529
|
+
const rewritten = worked().filter((item) => item.status === "done").length;
|
|
530
|
+
if (!stopped && !handler.afterChapters && (rewritten || worked().some((item) => item.status === "skipped")))
|
|
531
|
+
report({ key: `campaign-done:${campaign.id}`, tone: "ok", code: "campaignDone", title: handler.texts.done(rewritten, language) });
|
|
532
|
+
delete state.campaign;
|
|
533
|
+
}
|
|
534
|
+
/** The chapter the campaign works now, while it is not closed again: it comes before the plan. */
|
|
535
|
+
export function campaignChapter(state) {
|
|
536
|
+
const number = state.campaign?.chapters.find((item) => item.status === "working")?.number;
|
|
537
|
+
const chapter = number === undefined ? undefined : state.plan?.chapters.find((entry) => entry.number === number);
|
|
538
|
+
return chapter && chapter.status !== "done" ? chapter : undefined;
|
|
539
|
+
}
|
|
540
|
+
/** The campaigns' half of what the run merges when the author wrote the state during a step: the author's new campaign, and the chapters the author cancelled that had not begun. */
|
|
541
|
+
export function mergeCampaign(working, base, stored) {
|
|
542
|
+
if (JSON.stringify(base ?? null) === JSON.stringify(stored ?? null))
|
|
543
|
+
return working;
|
|
544
|
+
if (stored && stored.id !== working?.id)
|
|
545
|
+
return stored;
|
|
546
|
+
if (!stored) {
|
|
547
|
+
// Cancelled and taken away by the author: what this step began finishes, the rest is over.
|
|
548
|
+
if (!working)
|
|
549
|
+
return undefined;
|
|
550
|
+
const chapters = working.chapters.map((item) => (item.status === "waiting" ? { ...item, status: "cancelled" } : item));
|
|
551
|
+
return chapters.some((item) => item.status === "working") ? { ...working, chapters } : undefined;
|
|
552
|
+
}
|
|
553
|
+
if (!working)
|
|
554
|
+
return stored;
|
|
555
|
+
const chapters = working.chapters.map((item) => {
|
|
556
|
+
const theirs = stored.chapters.find((entry) => entry.number === item.number);
|
|
557
|
+
return item.status === "waiting" && theirs?.status === "cancelled" ? { ...item, status: "cancelled", ...(theirs.endedAt ? { endedAt: theirs.endedAt } : {}) } : item;
|
|
558
|
+
});
|
|
559
|
+
// The author cancelled it while this step ran: it ends with the chapter being worked.
|
|
560
|
+
return { ...working, chapters, ...(stored.cancelledAt && !working.cancelledAt ? { cancelledAt: stored.cancelledAt } : {}) };
|
|
561
|
+
}
|
|
562
|
+
//# sourceMappingURL=campaign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaign.js","sourceRoot":"","sources":["../../src/autopilot/campaign.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAA8D,MAAM,aAAa,CAAC;AAEpM,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC5I,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,GAYjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAwBtD,gGAAgG;AAChG,MAAM,CAAC,MAAM,6BAA6B,GAAyC,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,mBAAmB,CAAC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