narrarium-engine 0.1.11 → 0.1.12
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 +35 -14
- package/dist/autopilot/brief.d.ts +14 -0
- package/dist/autopilot/brief.d.ts.map +1 -0
- package/dist/autopilot/brief.js +28 -0
- package/dist/autopilot/brief.js.map +1 -0
- package/dist/autopilot/estimate-texts.d.ts +0 -1
- package/dist/autopilot/estimate-texts.d.ts.map +1 -1
- package/dist/autopilot/estimate-texts.js +0 -3
- package/dist/autopilot/estimate-texts.js.map +1 -1
- package/dist/autopilot/estimate.d.ts +3 -5
- package/dist/autopilot/estimate.d.ts.map +1 -1
- package/dist/autopilot/estimate.js +5 -7
- package/dist/autopilot/estimate.js.map +1 -1
- package/dist/autopilot/outline-compose.d.ts.map +1 -1
- package/dist/autopilot/outline-compose.js +5 -1
- package/dist/autopilot/outline-compose.js.map +1 -1
- package/dist/autopilot/planner.d.ts +20 -7
- package/dist/autopilot/planner.d.ts.map +1 -1
- package/dist/autopilot/planner.js +38 -16
- package/dist/autopilot/planner.js.map +1 -1
- package/dist/autopilot/presets.d.ts +17 -25
- package/dist/autopilot/presets.d.ts.map +1 -1
- package/dist/autopilot/presets.js +9 -39
- package/dist/autopilot/presets.js.map +1 -1
- package/dist/autopilot/runner.d.ts +5 -3
- package/dist/autopilot/runner.d.ts.map +1 -1
- package/dist/autopilot/runner.js +31 -19
- package/dist/autopilot/runner.js.map +1 -1
- package/dist/autopilot/session.d.ts +6 -1
- package/dist/autopilot/session.d.ts.map +1 -1
- package/dist/autopilot/session.js +22 -3
- package/dist/autopilot/session.js.map +1 -1
- package/dist/autopilot/state.d.ts +4 -0
- package/dist/autopilot/state.d.ts.map +1 -1
- package/dist/autopilot/state.js +7 -12
- package/dist/autopilot/state.js.map +1 -1
- package/dist/autopilot/tasks.d.ts.map +1 -1
- package/dist/autopilot/tasks.js +15 -11
- package/dist/autopilot/tasks.js.map +1 -1
- package/dist/autopilot/types.d.ts +4 -2
- package/dist/autopilot/types.d.ts.map +1 -1
- package/dist/autopilot/types.js.map +1 -1
- package/dist/book/outline-brief.d.ts +74 -0
- package/dist/book/outline-brief.d.ts.map +1 -0
- package/dist/book/outline-brief.js +161 -0
- package/dist/book/outline-brief.js.map +1 -0
- package/dist/book/outline.d.ts +13 -5
- package/dist/book/outline.d.ts.map +1 -1
- package/dist/book/outline.js +31 -24
- package/dist/book/outline.js.map +1 -1
- package/dist/book/paths.d.ts +5 -0
- package/dist/book/paths.d.ts.map +1 -1
- package/dist/book/paths.js +5 -0
- package/dist/book/paths.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/server/client.d.ts +6 -0
- package/dist/server/client.d.ts.map +1 -1
- package/dist/server/client.js +19 -5
- package/dist/server/client.js.map +1 -1
- package/dist/server/protocol.d.ts +10 -0
- package/dist/server/protocol.d.ts.map +1 -1
- package/dist/server/protocol.js +11 -0
- package/dist/server/protocol.js.map +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +8 -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
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ const session = new AutopilotSession({
|
|
|
48
48
|
|
|
49
49
|
session.subscribe((event) => console.log(event.type, event));
|
|
50
50
|
await session.start({
|
|
51
|
-
brief: { idea: "A harbor town built on glass hides a lie.",
|
|
51
|
+
brief: { idea: "A harbor town built on glass hides a lie.", wordsPerScene: 1400 }, // the chapters are the outline's entries
|
|
52
52
|
options: { pauseAfterPlan: true },
|
|
53
53
|
});
|
|
54
54
|
await session.waitForIdle();
|
|
@@ -211,13 +211,14 @@ A profile with warnings is not what the author wrote, so the engine never goes o
|
|
|
211
211
|
|
|
212
212
|
## Outline (Scaletta)
|
|
213
213
|
|
|
214
|
-
The outline is the author's chapter-by-chapter trace of the book:
|
|
214
|
+
The outline is the author's chapter-by-chapter trace of the book: the idea, promise or pitch of the book (its description) and, for every chapter, a hypothetical title, what happens in it and, when it is not the book's, the ghostwriter that writes it. It is a main part of the book, useful without the autopilot too, kept in files of the book, and the autopilot follows it as binding. It is not `plot.md`, which the autopilot generates from the chapters it closes.
|
|
215
215
|
|
|
216
216
|
### The files
|
|
217
217
|
|
|
218
218
|
| Path | Frontmatter | Body |
|
|
219
219
|
|---|---|---|
|
|
220
|
-
| `outline/book.md` | `type: outline`, `id: outline:book`, `title?` (a working title: the book's own stays in `book.md`), `origin?`, `digest?` | The
|
|
220
|
+
| `outline/book.md` | `type: outline`, `id: outline:book`, `title?` (a working title: the book's own stays in `book.md`), `origin?`, `digest?` | The idea, promise or pitch of the book (the description), free Markdown, at most 1 000 000 characters. It is the brief's idea too: stored here and nowhere else. |
|
|
221
|
+
| `outline/_brief.md` | `type: outline-brief`, `id: outline:brief`, `genre?`, `audience?`, `wordsPerScene` (a whole number from 200 to 8 000; 1 400 when absent) | The synopsis, free Markdown. An `idea` key found here is ignored and never written. It is the brief of the autopilot, not an entry: see *The brief*. |
|
|
221
222
|
| `outline/chapters/<NNN>.md` | `type: outline-chapter`, `id: outline-chapter:<NNN>`, `number`, `title?` (the hypothetical title), `ghostwriter?` (the slug of `ghostwriters/<slug>.md`; absent: the book's), `origin: author \| autopilot`, `digest?` | What happens in the chapter, plain text. |
|
|
222
223
|
|
|
223
224
|
One file per chapter: the outline has no maximum, and no file grows with the book. `<NNN>` has the zero-padding of the chapter folders (`formatOrdinal`): `outlineChapterPath(7)` is `outline/chapters/007.md`, `outlineChapterPath(1500)` is `outline/chapters/1500.md`, and `parseOutlineChapterPath(path)` reads the number back. The number of an entry is the one of its file's name; a frontmatter that says another is a warning, and the name wins. The keys the format does not know are kept whenever the engine rewrites a file. The core (`narrarium`) has the same paths (`OUTLINE_BOOK_FILE`, `OUTLINE_CHAPTERS_DIRECTORY`, `outlineChapterPath`, `parseOutlineChapterPath`), validates the files with `outlineBookSchema` and `outlineChapterSchema` (passthrough), searches them and renames references in them with the rest of the book (`CONTENT_GLOB`), and its doctor warns, never errs, about a number that is not the file's and a ghostwriter that does not exist.
|
|
@@ -272,13 +273,33 @@ An entry that cannot be read changes nothing until the author corrects it, and n
|
|
|
272
273
|
### What the autopilot does with it
|
|
273
274
|
|
|
274
275
|
- **What binds.** The outline binds through the entries of the author (every entry but the autopilot's intact ones) and the description of the author. A book whose outline has nothing of the author, none at all or only the autopilot's intact entries, is asked exactly what it was asked before the outline existed.
|
|
275
|
-
- **As many chapters as it has.** The book is
|
|
276
|
+
- **As many chapters as it has.** The book is `bookChapters(outline)` long: the number of its last chapter entry (the entries are the chapters; a number between two entries that has none is planned freely). An entry the author adds after the last chapter of a finished book extends it. With no chapter entry and no approved plan the run stops with «The outline has no chapters: write the chapters in the Scaletta, then resume.»
|
|
276
277
|
- **The plan follows it.** The request of every batch of the plan carries the description of the book (at most 3000 characters), the entries of the chapters it plans (whole, as far as their share of 24 000 characters allows) and, condensed like every list of chapters, the entries of the chapters not planned yet, with the rule: the same chapters, in the same order, with the same hypothetical titles (the model refines a title only where the entry has none: the engine keeps the entry's own) and the same events; enrich, never change. `brief.synopsis` stays the fallback: alone it binds as it always did; next to an outline it applies where the outline says nothing, and the outline wins. The concept is told that the outline binds it, and the director is told not to ask the plan to change it.
|
|
277
278
|
- **The ghostwriter of a chapter.** A chapter takes the ghostwriter of its entry (`PlannedChapter.ghostwriter`) and the `chapter.md` the plan creates says it, when it is not the book's: the chain scene, chapter, book is the one it always was. An entry that names a ghostwriter that does not exist is said (`outlineGhostwriter`, with `chapterNumber` and `ghostwriter`), and the book's writes the chapter; when the author creates it before the chapter starts, the chapter takes it.
|
|
278
279
|
- **The plan fills it.** After every plan, and every revision of it, the plan writes, in the same commit, the entries of the chapters it planned that have none: the title, and as text the summary of the plan followed by its key events as a list, with `origin: autopilot` and the `digest` of what it wrote; and `outline/book.md` when it is missing, with the logline of the concept (or the brief's idea). The chapters the author wrote get an entry only when they have none, with their summary. An entry of the author is never touched; an intact one of the autopilot follows the plan when the director has it revised. `options.fillOutline: false` writes nothing. Every chapter keeps the digest of its entry (`outlineDigest`).
|
|
279
280
|
- **The author changes it.** Before the scenes of a chapter with nothing written are planned, its entry is compared with `outlineDigest`. An entry the author changed (or wrote for a chapter that had none) has the chapter planned again (`replan`: its title, summary, purpose, events and ghostwriter follow the new entry, its scenes are planned again), with the insight `outlineChanged` ("You changed the outline of chapter 7: I am planning it again"), and no other chapter is touched. An entry the author deleted takes its chapter out of the plan, and out of the book when its folder is empty (`outlineRemoved`): the following chapters keep their numbers, and the chapter counts in `plan.removedChapters` so that the book is not extended to replace it. Deleting the whole `outline/` takes no chapter out. An entry that cannot be read changes nothing until it is corrected (`outlineWarnings`). The entry of a chapter already closed that the author changed is decided like a change of a frozen chapter (`options.frozenEdits`: asked by default, with the choices `rewrite-to-outline`, `keep-text` and `mark-reviewed`; see *Frozen chapters*); one of a chapter still being written is said once a run (`outlineChangedWhileWriting`), and decided once the chapter is closed; one that was deleted is said once a run (`outlineRemovedWritten`) and the chapter stays in the book.
|
|
280
281
|
- **What it costs.** The snapshot knows the files of the outline and their hashes from the list of the book (`snapshot.outline`, an `OutlineIndex`), without reading them; `OutlineReader` reads an entry only when a step needs it, through a cache of the run keyed by path and hash.
|
|
281
282
|
|
|
283
|
+
### The brief (`outline/_brief.md`)
|
|
284
|
+
|
|
285
|
+
The brief the autopilot starts from is kept in two files of the Scaletta, and each text has one home. The **idea** (the idea, promise or pitch of the book) is the description of the book: the body of `outline/book.md`, stored there and nowhere else. `outline/_brief.md` keeps `genre`, `audience`, `wordsPerScene` and the **synopsis** (its body). Two functions compose and split them:
|
|
286
|
+
|
|
287
|
+
- `readOutlineBrief(store, sources?)` → `{ brief: { idea, genre, audience, wordsPerScene, synopsis }, hash?, unreadable?, bookUnreadable?, frontmatter }`. `brief.idea` is the body of `outline/book.md`, or `""` when there is none or the autopilot wrote it (a logline of its own is not the author's idea). `hash` is the hash of `_brief.md` (absent when the file does not exist). `sources` says what is known already (`book`: the description already read, `null` for none; `brief: false`: the brief file is known not to exist), so that a host reads each file once.
|
|
288
|
+
- `writeOutlineBrief(store, fields, message?)` → `OutlineBrief` (the brief as saved). `fields` is any part of `{ idea, genre, audience, wordsPerScene, synopsis }`; the rest is kept. The idea goes to `outline/book.md` through the outline's own builder (`serializeOutlineBook`: the working title and the other keys of the file are kept; the author is the writer), the fields to `_brief.md`, in ONE commit, compare-and-swap on both files (a change made meanwhile is merged, never overwritten; five attempts). A file whose frontmatter cannot be read is never written over. `outlineBriefChanges(store, fields)` → `{ changes, brief }` is the same write, not committed: the start uses it.
|
|
289
|
+
- `parseOutlineBrief(content, hash?)` and `serializeOutlineBrief(fields, frontmatter?)` are the file of `_brief.md` alone: `OutlineBriefFields` is `{ genre, audience, wordsPerScene, synopsis }`, with no idea.
|
|
290
|
+
|
|
291
|
+
**The limits.** The idea is the description of the book, and it is never cut: an idea of more than `OUTLINE_BOOK_MAX_CHARS` (1 000 000 characters) is refused with `OutlineTextLimitError` (`code: "text_too_long"`, the length and the limit in the message) and nothing is written. The server answers a configure or start that carries it with 413 `text_too_long`; the MCP `edit_outline` schema refuses a `book` body over 400 000 characters (its text limit) before the engine is asked. A description over the limit that a file already holds is read whole, with a warning, and a title-only edit leaves it as it is. Chapter entries keep their own limit (`OUTLINE_ENTRY_MAX_CHARS`, 20 000, cut with a warning as before).
|
|
292
|
+
|
|
293
|
+
**Legacy.** A state saved with a brief idea, in a book whose `outline/book.md` has no author's description, gets that idea written into `book.md` once, in the start commit (with the state, in the same commit). A description the author wrote is never overwritten. The fields of a state move to `_brief.md` only when that file does not exist yet.
|
|
294
|
+
|
|
295
|
+
- **The name starts with an underscore, and it is no entry.** `OUTLINE_BRIEF_FILE` is `outline/_brief.md`. `outlineIndex` and `parseOutline` never read it as a chapter, so it has no number, is never counted, and is never a warning. `write_file` refuses the whole `outline/` folder, so the brief changes only through the brief's own routes; `edit_outline` writes only the chapter entries and `outline/book.md` (the description, which is also the idea), so it can neither delete, renumber nor move `_brief.md`.
|
|
296
|
+
- **The brief has no number of chapters.** The chapters are the chapter entries of the Scaletta: `bookChapters(outline)` is the number of the last entry (its number; the entries are the chapters). `targetChapters` and `scenesPerChapter` are not read any more.
|
|
297
|
+
- **The scenes are the planner's.** `scenesForChapter(text)` gives a chapter 2 scenes when its outline entry is up to 40 words, 3 up to 100 words, and 4 above (`SCENES_PER_CHAPTER` is 2 to 4). The text is the entry's body; a chapter without an entry is read from its summary, goal and key events. `wordsPerScene` is the target of every scene.
|
|
298
|
+
- **The run reads it at every start and configuration.** `AutopilotSession.start({ brief })` and `configure({ brief })` save a brief sent to the file first; the run then reads the file (`readBrief`). `state.brief` is the snapshot the run uses, and it is refreshed when the run starts or the author configures it. A book whose brief is only in its state (saved before the brief had a file) gets the file in the start commit, once.
|
|
299
|
+
- **No chapter entries, no run.** With no chapter entry and no approved plan, the planner stops: «The outline has no chapters: write the chapters in the Scaletta, then resume.» A plan that is already approved keeps going to the end of its own chapters.
|
|
300
|
+
- **Legacy states.** A state saved with `targetChapters` and `scenesPerChapter` in its brief still loads and runs: the two counts are not read. A plan of N chapters runs to the end of ITS plan. A completed book is not extended unless the author adds chapter entries to the Scaletta: the highest planned chapter number is compared with the last chapter entry, never the number of chapters planned (a book may go on from chapter 1 200, and no chapter past its last entry is ever planned).
|
|
301
|
+
- **Presets.** The brief has none: `autopilotPresetSkeleton(id)` gives the chapter entries a new book's outline starts with (see *Presets*).
|
|
302
|
+
|
|
282
303
|
## Frozen chapters
|
|
283
304
|
|
|
284
305
|
A chapter is **frozen** when the autopilot's director approves it, or when the author freezes it by hand: its `chapter.md` holds a record of the chapter as it was. A change of its text after that is never ignored: before every step the autopilot notices it and, unless the author chose otherwise, stops and asks what to do (as BookWriter's "Review from a saved change": nothing starts by itself).
|
|
@@ -389,10 +410,10 @@ const estimate = estimateAutopilotRun({
|
|
|
389
410
|
|
|
390
411
|
| Field | Meaning |
|
|
391
412
|
|---|---|
|
|
392
|
-
| `brief`, `options` | Read as the engine reads them (`normalizeBrief`, `normalizeOptions`): what is missing is the default, a number past the limits is the limit, anything that is not a value is ignored. Only `
|
|
413
|
+
| `brief` (`outline/_brief.md`, see *The brief*), `options` | Read as the engine reads them (`normalizeBrief`, `normalizeOptions`): what is missing is the default, a number past the limits is the limit, anything that is not a value is ignored. Only `wordsPerScene` (and the idea and the synopsis, for their words), the chapters of `outline` and the `scenesPerChapter` hint (2 to 4 for the planner; 3 when it is not told) and `readers`, `maxReaders`, `readersOnPlan`, `specialists` change the numbers. `pauseAfterPlan`, `pauseAfterEachChapter`, `chaptersPerRun`, the budgets, `fillOutline`, `syncAfterChapter` and `publishEvery` change nothing the models are asked: they are accepted and ignored. |
|
|
393
414
|
| `maxReviewRounds` | The most rounds of review a chapter gets, 1 to 3 (2 when it says nothing), as in the director's profile. |
|
|
394
415
|
| `models` | `{ [capability]: { model, maxInputTokens?, maxOutputTokens?, pricing?, tokensPerSecond?, supportsReasoning?, provider?, underlyingModel? } \| null }` for the six capabilities the autopilot uses: `autopilot`, `director`, `reader-evaluation`, `reader-evaluation-summary`, `review`, `simple-tasks` (`ESTIMATE_CAPABILITIES`). `estimateModelsFromConfig(config, speeds?)` builds it from an `AiRuntimeConfig` with the first candidate of `resolveAiCandidates`, and copies no key and no address. |
|
|
395
|
-
| `outline` | `{ entries, lastChapter, words }` of the author's entries
|
|
416
|
+
| `outline` | `{ entries, lastChapter, words }` of the author's entries: the chapters of the book are the outline's (`bookChapters`), the chapters already planned when it has none (`progress.planned`). |
|
|
396
417
|
| `progress` | `{ chaptersDone, planned, conceptDone, finalDone, withoutSummary, withoutSummaryWords }`: a book that is started counts only the rest. `estimateProgressFromState(state)` reads the first five from the state of the autopilot; for a book the autopilot has not started, `estimateProgressFromChapters(snapshot.chapters)` reads `chaptersDone` and `withoutSummary` from the chapters that have prose. `conceptDone` is, when it is not said, whether there is a chapter or a plan; a book whose story design the author wrote (`isThinDocument(body)` is false) has no concept step either, and the host says so. A chapter written halfway counts as whole. |
|
|
397
418
|
| `scenario` | `{ rounds, repairs, planRevisions }`, each a number or `{ min, max }`: what the reviews of the run will be, when the host knows. See *The interval*. |
|
|
398
419
|
| `context` | Sizes in words that the host has measured (`countWords` of the files): `designWords`, `worldWords`, `ghostwriterWords`, `directorWords` (the whole profile), `canonWords` (the manifest of the canon; `0` for a book with no canon), `secretsWords`, `rulesWords`, `notesWords` (the director's standing notes now), `styleWords` (the evaluation style as a chapter's review carries it, criteria and method: the review of the plan carries about half). Each defaults to `ESTIMATE_TYPICAL`. `estimateContextFromState(state)` gives the rules of the author and, once the plan is approved, the notes of the director. |
|
|
@@ -416,7 +437,7 @@ The estimate is an interval because the reviews are the model's: how many rounds
|
|
|
416
437
|
| | rounds `r` | scenes repaired in a chapter `p` | revisions of the plan `v` |
|
|
417
438
|
|---|---|---|---|
|
|
418
439
|
| `min` | 1 | 0 | 0 |
|
|
419
|
-
| `max` | the director's `maxReviewRounds` | `r ×
|
|
440
|
+
| `max` | the director's `maxReviewRounds` | `r × scenes` (the scenes of a chapter: the planner's, 2 to 4, see *The brief*) | 2 (the third review of the plan is an approval) |
|
|
420
441
|
|
|
421
442
|
`scenario` pins any of them; when only some are given the others keep their end (`repairs` goes from `rounds.min − 1` to `rounds.max × scenes`), and the rounds are clamped to 1 and the director's limit. A scenario that pins all three makes `min` and `max` the same number. The ends are bounds, not a "typical" run, and there is no third figure.
|
|
422
443
|
|
|
@@ -477,7 +498,6 @@ A reply is the words of the schema or of the scene at `tokensPerWord(language)`
|
|
|
477
498
|
| `noPrice` | warning | `capability`, `model` | The model has no price: the cost is `null`. |
|
|
478
499
|
| `noSpeed` | info | `capability`, `model` | The model has no speed: the minutes are `null`. |
|
|
479
500
|
| `reasoningModel` | info | `capability`, `model` | The model reasons (`supportsReasoning`, or by its name as the router knows it): its reasoning tokens are not counted. |
|
|
480
|
-
| `outlineLongerThanBrief` | info | `briefChapters`, `outlineChapters` | The outline asks for more chapters than the brief: the book has the outline's. |
|
|
481
501
|
|
|
482
502
|
### What it assumes, and what it leaves out
|
|
483
503
|
|
|
@@ -512,15 +532,15 @@ What the runs show (`ESTIMATE_REPORT=1 node --test test/estimate-run.test.mjs` p
|
|
|
512
532
|
|
|
513
533
|
### Presets
|
|
514
534
|
|
|
515
|
-
`AUTOPILOT_PRESETS` are the three
|
|
535
|
+
`AUTOPILOT_PRESETS` are the three starting points of a NEW book, from the shortest to the longest. They are not an autopilot setting: once the book exists its outline and its brief say the rest. `autopilotPresetSkeleton(id)` returns the skeleton of one: `chapters` (the chapter entries the new book's outline is created with), `wordsPerScene`, the review options (`readers`, `maxReaders`, `readersOnPlan`, `specialists`) and `maxReviewRounds`. It is `undefined` for any other id, the custom book included. The skeleton is frozen.
|
|
516
536
|
|
|
517
|
-
| `id` | Chapters
|
|
537
|
+
| `id` | Chapters | Words per scene | Readers | Plan readers | Specialists | Rounds |
|
|
518
538
|
|---|---|---|---|---|---|---|
|
|
519
|
-
| `story` | 4
|
|
520
|
-
| `novella` | 12
|
|
521
|
-
| `novel-draft` | 24
|
|
539
|
+
| `story` | 4 | 900 | 3 | no | yes | 2 |
|
|
540
|
+
| `novella` | 12 | 1 400 | 5 | yes | yes | 2 |
|
|
541
|
+
| `novel-draft` | 24 | 1 500 | 3 | yes | yes | 1 |
|
|
522
542
|
|
|
523
|
-
`novella` is what a new book starts with (`DEFAULT_BRIEF`, `DEFAULT_OPTIONS`).
|
|
543
|
+
`novella` is what a new book starts with (`DEFAULT_BRIEF`, `DEFAULT_OPTIONS`). The presets have no publish option: where a book is published is the author's choice, as it always was.
|
|
524
544
|
|
|
525
545
|
### Measured speed
|
|
526
546
|
|
|
@@ -873,6 +893,7 @@ A skipped file is not recorded as synced (a file that was never synced stays out
|
|
|
873
893
|
| `configureAutopilot(bookId, { options: { longRetry } })`, `startAutopilot(bookId, { options: { longRetry } })` | As always: the options go to the engine as they are. | As always. The engine reads them as it reads every option there: a value that is not a policy changes nothing. |
|
|
874
894
|
| `retryNow(bookId)` | `POST /api/v1/books/:id/autopilot/retry-now`, no body (or `{}`). | `200` the snapshot with `skipped` (`RetryNowResponse`): `true` when the run was waiting and the attempt starts now (the snapshot's `summary.retry` is gone), `false` when there was nothing to skip (no run, or a run that is not waiting: nothing happens). `400 invalid_request` for any other body; `503 maintenance` while the server is about to restart (unlike a pause, which is never refused: «Retry now» sets the run going again). |
|
|
875
895
|
|
|
896
|
+
- **The length of the book comes from its Scaletta.** A server that takes the chapters from the outline and the brief from `outline/_brief.md` announces `SERVER_FEATURE_AUTOPILOT_OUTLINE_BRIEF` (`"autopilot-outline-brief"`), and `serverHasOutlineBrief(infoOrFeatures)` reads it (never throws). An older server plans the default number of chapters and ignores the Scaletta, so `startAutopilot` and `configureAutopilot` refuse it before sending anything: a `ServerRequestError` with status 501 and code `feature_unavailable`, which says to update the server. The client asks the server's `info` once for both checks.
|
|
876
897
|
- **Resume after a restart.** A server that resumes a run by itself when it starts again announces `SERVER_FEATURE_AUTOPILOT_AUTO_RESUME` (`"autopilot-auto-resume"`), and `serverSupportsAutopilotAutoResume(infoOrFeatures)` reads it (it takes the info or the list of its features; never throws). Such a server takes `options.resumeAfterRestart` (`true` or `false`) in the options route, `configure` and `start`; it pauses every run with `session.stopForShutdown()` when it stops, and when it starts again it resumes, one book at a time, the runs that `session.restartResumeCause()` names (with `session.start({ afterRestart: true })`, through every check a start of the author has: the AI configuration, the number of runs, the owner's switch and caps), at most three times a day per book (see the server's README). **The client never sends `resumeAfterRestart` to a server that does not announce the feature** (`false` included), for the same reason as `longRetry`: `updateAutopilotOptions`, `configureAutopilot` and `startAutopilot` ask the server's `info()` first and refuse with `501 feature_unavailable` before anything is sent. A request without the setting asks nothing more.
|
|
877
898
|
|
|
878
899
|
- **Conflicts with GitHub.** When the server's commits and GitHub's changed the same files, the server's run stops with a `conflict` (`errorDetail.githubConflicts`: how many files), its sync answers `409 github_conflict` (with `conflicts` in the `details` of the `ServerRequestError`), and `lastSync.conflicts` says it in the summary of the book. The author chooses which version of each file to keep, the server's or GitHub's, through two calls of a server that announces `SERVER_FEATURE_GITHUB_CONFLICTS` (`"github-conflicts"`), which `serverSupportsGithubConflicts(infoOrFeatures)` reads (never throws). **The client refuses a server without the feature before sending anything**: it asks `info()` once (and again until the server says yes, so that an update is noticed) and throws a `ServerRequestError` with status `501` and code `feature_unavailable`, whose message says to update the server. A refusal of the server keeps what it said with it in `ServerRequestError.details` (the fields of the answer other than `code` and `message`). Every call also answers `401 unauthorized`, `403 scope`, `404 book_not_found` and `409 no_remote` (a book that is not on GitHub). The rules (which version a deleted file follows, the autopilot's own files that are never asked about, the names the server does not write, the push that GitHub refuses) are in the server's README, *Conflicts with GitHub*.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BookFileChange, BookStore } from "../book/store.js";
|
|
2
|
+
import type { AutopilotBrief, AutopilotState } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The brief a run starts from or a configuration reads: the idea from the description of the book (`outline/book.md`), the fields from
|
|
5
|
+
* `outline/_brief.md`. A book saved before the brief had these files moves what its state held into them, once: the idea when the author has
|
|
6
|
+
* written no description (a description that the author wrote is never overwritten), and the fields when `_brief.md` does not exist. The
|
|
7
|
+
* returned `changes` make that move, and the caller commits them with its own commit. A file whose frontmatter cannot be read stops the
|
|
8
|
+
* reading: the brief is never taken as the defaults over an author's text.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readBrief(store: BookStore, state?: Pick<AutopilotState, "brief"> | null): Promise<{
|
|
11
|
+
brief: AutopilotBrief;
|
|
12
|
+
changes: BookFileChange[];
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=brief.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief.d.ts","sourceRoot":"","sources":["../../src/autopilot/brief.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,CAY7J"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { outlineBriefChanges, readOutlineBrief } from "../book/outline-brief.js";
|
|
2
|
+
import { DEFAULT_BRIEF } from "./state.js";
|
|
3
|
+
/**
|
|
4
|
+
* The brief a run starts from or a configuration reads: the idea from the description of the book (`outline/book.md`), the fields from
|
|
5
|
+
* `outline/_brief.md`. A book saved before the brief had these files moves what its state held into them, once: the idea when the author has
|
|
6
|
+
* written no description (a description that the author wrote is never overwritten), and the fields when `_brief.md` does not exist. The
|
|
7
|
+
* returned `changes` make that move, and the caller commits them with its own commit. A file whose frontmatter cannot be read stops the
|
|
8
|
+
* reading: the brief is never taken as the defaults over an author's text.
|
|
9
|
+
*/
|
|
10
|
+
export async function readBrief(store, state) {
|
|
11
|
+
const reading = await readOutlineBrief(store);
|
|
12
|
+
if (reading.unreadable)
|
|
13
|
+
throw new Error("outline/_brief.md: its frontmatter is not valid YAML: correct the file before the autopilot reads its brief.");
|
|
14
|
+
if (reading.bookUnreadable)
|
|
15
|
+
throw new Error("outline/book.md: its frontmatter is not valid YAML: correct the file before the autopilot reads the idea of the book.");
|
|
16
|
+
const legacy = state?.brief ?? DEFAULT_BRIEF;
|
|
17
|
+
const moved = {};
|
|
18
|
+
if (!reading.brief.idea && legacy.idea)
|
|
19
|
+
moved.idea = legacy.idea;
|
|
20
|
+
const fieldsMoved = Boolean(legacy.synopsis || legacy.genre || legacy.audience || legacy.wordsPerScene !== DEFAULT_BRIEF.wordsPerScene);
|
|
21
|
+
if (!reading.hash && fieldsMoved)
|
|
22
|
+
Object.assign(moved, { genre: legacy.genre, audience: legacy.audience, wordsPerScene: legacy.wordsPerScene, synopsis: legacy.synopsis });
|
|
23
|
+
if (Object.keys(moved).length === 0)
|
|
24
|
+
return { brief: reading.brief, changes: [] };
|
|
25
|
+
const planned = await outlineBriefChanges(store, moved);
|
|
26
|
+
return { brief: planned.brief, changes: planned.changes };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=brief.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief.js","sourceRoot":"","sources":["../../src/autopilot/brief.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAEpG,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAgB,EAAE,KAA4C;IAC5F,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,OAAO,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,8GAA8G,CAAC,CAAC;IACxJ,IAAI,OAAO,CAAC,cAAc;QAAE,MAAM,IAAI,KAAK,CAAC,uHAAuH,CAAC,CAAC;IACrK,MAAM,MAAM,GAAG,KAAK,EAAE,KAAK,IAAI,aAAa,CAAC;IAC7C,MAAM,KAAK,GAA0B,EAAE,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI;QAAE,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACjE,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,aAAa,KAAK,aAAa,CAAC,aAAa,CAAC,CAAC;IACxI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,WAAW;QAAE,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3K,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAClF,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -10,7 +10,6 @@ export declare function estimateTexts(italian: boolean): {
|
|
|
10
10
|
noPrice: (id: EstimateCapability, model: string) => string;
|
|
11
11
|
noSpeed: (id: EstimateCapability, model: string) => string;
|
|
12
12
|
reasoningModel: (id: EstimateCapability, model: string) => string;
|
|
13
|
-
outlineLonger: (brief: number, outline: number) => string;
|
|
14
13
|
/** The assumptions, one sentence each, in the order of the pipeline. */
|
|
15
14
|
assumptions: (facts: AssumptionFacts) => string[];
|
|
16
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimate-texts.d.ts","sourceRoot":"","sources":["../../src/autopilot/estimate-texts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AA6C1E,mHAAmH;AACnH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAEnE;AAQ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,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -74,9 +74,6 @@ export function estimateTexts(italian) {
|
|
|
74
74
|
reasoningModel: (id, model) => (italian
|
|
75
75
|
? `«${capability(id)}»: ${model} ragiona prima di rispondere e spende token di ragionamento che non sono contati qui.`
|
|
76
76
|
: `«${capability(id)}»: ${model} reasons before it answers and spends reasoning tokens that are not counted here.`),
|
|
77
|
-
outlineLonger: (brief, outline) => (italian
|
|
78
|
-
? `La scaletta chiede ${count(outline)} capitoli e il brief ${count(brief)}: il libro ne ha ${count(outline)}, e la stima li conta tutti.`
|
|
79
|
-
: `The outline asks for ${count(outline)} chapters and the brief for ${count(brief)}: the book has ${count(outline)}, and the estimate counts them all.`),
|
|
80
77
|
/** The assumptions, one sentence each, in the order of the pipeline. */
|
|
81
78
|
assumptions: (facts) => {
|
|
82
79
|
const lines = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimate-texts.js","sourceRoot":"","sources":["../../src/autopilot/estimate-texts.ts"],"names":[],"mappings":"AAEA,mHAAmH;AACnH,MAAM,gBAAgB,GAA4D;IAChF,EAAE,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc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CAAC,CAAC,4IAA4I;gBAC9I,CAAC,CAAC,8IAA8I,CAAC,CAAC;YACpJ,KAAK,CAAC,IAAI,CAAC,OAAO;gBAChB,CAAC,CAAC,iLAAiL;gBACnL,CAAC,CAAC,6JAA6J,CAAC,CAAC;YACnK,KAAK,CAAC,IAAI,CAAC,OAAO;gBAChB,CAAC,CAAC,yGAAyG;gBAC3G,CAAC,CAAC,yGAAyG,CAAC,CAAC;YAC/G,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBACjB,KAAK,CAAC,IAAI,CAAC,OAAO;oBAChB,CAAC,CAAC,mJAAmJ;oBACrJ,CAAC,CAAC,iJAAiJ,CAAC,CAAC;YACzJ,CAAC;YACD,IAAI,KAAK,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;gBAC3B,KAAK,CAAC,IAAI,CAAC,OAAO;oBAChB,CAAC,CAAC,oBAAoB,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU;oBACzD,CAAC,CAAC,sBAAsB,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YAChE,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,OAAO;gBAChB,CAAC,CAAC,oMAAoM;gBACtM,CAAC,CAAC,uMAAuM,CAAC,CAAC;YAC7M,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -157,8 +157,10 @@ export interface EstimateOutline {
|
|
|
157
157
|
words?: number;
|
|
158
158
|
}
|
|
159
159
|
export interface EstimateInput {
|
|
160
|
-
/** The brief of the form: the
|
|
160
|
+
/** The brief of the form: the words of a scene, and the idea and the synopsis, which weigh in the prompts that carry them. The chapters are `outline`'s. */
|
|
161
161
|
brief?: Partial<AutopilotBrief>;
|
|
162
|
+
/** The scenes a chapter is expected to have (the planner's rule gives 2 to 4 for each chapter); the middle of the range when missing. */
|
|
163
|
+
scenesPerChapter?: number;
|
|
162
164
|
/** `readers`, `maxReaders`, `readersOnPlan` and `specialists` change the calls; the others (`pauseAfterPlan`, `chaptersPerRun`, the budgets…) do not. */
|
|
163
165
|
options?: Partial<AutopilotOptions>;
|
|
164
166
|
/** `maxReviewRounds` of the director's profile (1 to 3, 2 when it says nothing). */
|
|
@@ -237,10 +239,6 @@ export type EstimateWarning = (EstimateWarningBase & {
|
|
|
237
239
|
code: "reasoningModel";
|
|
238
240
|
capability: EstimateCapability;
|
|
239
241
|
model: string;
|
|
240
|
-
}) | (EstimateWarningBase & {
|
|
241
|
-
code: "outlineLongerThanBrief";
|
|
242
|
-
briefChapters: number;
|
|
243
|
-
outlineChapters: number;
|
|
244
242
|
});
|
|
245
243
|
export type EstimateWarningCode = EstimateWarning["code"];
|
|
246
244
|
export interface EstimateResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimate.d.ts","sourceRoot":"","sources":["../../src/autopilot/estimate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAqBvD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAOnF,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,gHAOvB,CAAC;AAEZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,uNAgBrB,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAoBpE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;IAC3B,yDAAyD;;IAEzD,sJAAsJ;;;;IAItJ,yIAAyI;;IAEzI,sJAAsJ;;IAEtJ,+JAA+J;;;;IAI/J,4LAA4L;;;IAG5L,2IAA2I;;;IAG3I,wCAAwC;;IAExC,sJAAsJ;;;;IAItJ;;;OAGG;;;;IAIH,qDAAqD;;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AAa,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;CAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAMrO;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,aAAa,GAAG,eAAe,GAAG,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,YAAY,CAAC,CAOrL"}
|
|
@@ -11,7 +11,7 @@ import { asInteger, asNumber, asRecord } from "../util/json.js";
|
|
|
11
11
|
import { OUTPUT_TOKENS_CEILING, countWords, isItalian, languageCode, scaleOutputTokens, tokensPerWord } from "../util/text.js";
|
|
12
12
|
import { sumCappedRamp, sumWindowedList, windowedList } from "./estimate-math.js";
|
|
13
13
|
import { estimateTexts } from "./estimate-texts.js";
|
|
14
|
-
import { PLAN_BATCH_CHAPTERS } from "./planner.js";
|
|
14
|
+
import { PLAN_BATCH_CHAPTERS, SCENES_PER_CHAPTER } from "./planner.js";
|
|
15
15
|
import { CHAPTER_REVIEW_TOOL, CHAPTER_SUMMARY_TOOL, CONCEPT_TOOL, CONSOLIDATION_TOOL, FINDINGS_TOOL, PLAN_REACTION_TOOL, PLAN_REVIEW_TOOL, PLAN_TOOL, SCENES_TOOL, SCENE_SUMMARY_TOOL, architectSystemPrompt, continuitySystemPrompt, specialistsSystemPrompt, writerSystemPrompt, } from "./prompts.js";
|
|
16
16
|
import { MAX_BOOK_CHAPTERS, MAX_DIRECTOR_NOTES, normalizeBrief, normalizeOptions } from "./state.js";
|
|
17
17
|
// What a run will cost before it starts. The estimate is arithmetic over the pipeline: it counts the calls the steps of the autopilot make (the formulas
|
|
@@ -379,13 +379,14 @@ export function estimateAutopilotRun(input) {
|
|
|
379
379
|
const ratio = tpw / LATIN_TOKENS_PER_WORD;
|
|
380
380
|
/** Tokens of `count` words of the book in a prompt. */
|
|
381
381
|
const w = (count) => count * INPUT_TOKENS_PER_WORD * ratio;
|
|
382
|
-
|
|
382
|
+
// The scenes of each chapter are the planner's (`scenesForChapter`): the host says how many it expects, else the middle of the range.
|
|
383
|
+
const scenes = whole(source.scenesPerChapter, Math.round((SCENES_PER_CHAPTER.min + SCENES_PER_CHAPTER.max) / 2), 1, 20);
|
|
383
384
|
const sceneWords = brief.wordsPerScene;
|
|
384
385
|
const chapterWords = scenes * sceneWords;
|
|
385
386
|
const maxRounds = whole(source.maxReviewRounds, 2, 1, MAX_ROUNDS);
|
|
386
|
-
// The book: the chapters the
|
|
387
|
+
// The book: the chapters of the outline (its chapter entries), or the chapters already planned when the outline has none.
|
|
387
388
|
const outlineChapters = outlineChaptersOf(outline);
|
|
388
|
-
const chapters = Math.min(MAX_BOOK_CHAPTERS, Math.max(
|
|
389
|
+
const chapters = Math.min(MAX_BOOK_CHAPTERS, Math.max(outlineChapters, whole(progress.planned, 0, 0, MAX_BOOK_CHAPTERS)));
|
|
389
390
|
const outlineEntries = whole(outline.entries, 0, 0, MAX_BOOK_CHAPTERS) || (outlineChapters > 0 ? outlineChapters : 0);
|
|
390
391
|
const outlineWords = outlineEntries > 0 ? knob(outline.words, outlineEntries * T.outlineEntryWords) : 0;
|
|
391
392
|
// Where it is.
|
|
@@ -742,9 +743,6 @@ export function estimateAutopilotRun(input) {
|
|
|
742
743
|
if (model.reasoning)
|
|
743
744
|
warnings.push({ code: "reasoningModel", severity: "info", capability, model: model.name, text: text.reasoningModel(capability, model.name) });
|
|
744
745
|
}
|
|
745
|
-
if (outlineChapters > brief.targetChapters) {
|
|
746
|
-
warnings.push({ code: "outlineLongerThanBrief", severity: "info", briefChapters: brief.targetChapters, outlineChapters, text: text.outlineLonger(brief.targetChapters, outlineChapters) });
|
|
747
|
-
}
|
|
748
746
|
const gravity = { error: 0, warning: 1, info: 2 };
|
|
749
747
|
warnings.sort((left, right) => gravity[left.severity] - gravity[right.severity]);
|
|
750
748
|
const sumKinds = (select) => ESTIMATE_CALL_KINDS.reduce((total, kind) => ({ min: total.min + select(steps[kind]).min, max: total.max + select(steps[kind]).max }), rangeOf(0, 0));
|