narrarium-engine 0.1.22 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +23 -6
  2. package/dist/autopilot/campaign.d.ts +72 -5
  3. package/dist/autopilot/campaign.d.ts.map +1 -1
  4. package/dist/autopilot/campaign.js +338 -36
  5. package/dist/autopilot/campaign.js.map +1 -1
  6. package/dist/autopilot/design.d.ts +77 -0
  7. package/dist/autopilot/design.d.ts.map +1 -0
  8. package/dist/autopilot/design.js +234 -0
  9. package/dist/autopilot/design.js.map +1 -0
  10. package/dist/autopilot/estimate-texts.d.ts +6 -0
  11. package/dist/autopilot/estimate-texts.d.ts.map +1 -1
  12. package/dist/autopilot/estimate-texts.js +20 -7
  13. package/dist/autopilot/estimate-texts.js.map +1 -1
  14. package/dist/autopilot/estimate.d.ts +36 -5
  15. package/dist/autopilot/estimate.d.ts.map +1 -1
  16. package/dist/autopilot/estimate.js +100 -35
  17. package/dist/autopilot/estimate.js.map +1 -1
  18. package/dist/autopilot/frozen.d.ts +8 -0
  19. package/dist/autopilot/frozen.d.ts.map +1 -1
  20. package/dist/autopilot/frozen.js +9 -1
  21. package/dist/autopilot/frozen.js.map +1 -1
  22. package/dist/autopilot/outline-check.d.ts +9 -0
  23. package/dist/autopilot/outline-check.d.ts.map +1 -1
  24. package/dist/autopilot/outline-check.js +16 -0
  25. package/dist/autopilot/outline-check.js.map +1 -1
  26. package/dist/autopilot/outline-compose.d.ts +3 -3
  27. package/dist/autopilot/outline-compose.d.ts.map +1 -1
  28. package/dist/autopilot/outline-compose.js +4 -4
  29. package/dist/autopilot/outline-compose.js.map +1 -1
  30. package/dist/autopilot/planner.d.ts +13 -11
  31. package/dist/autopilot/planner.d.ts.map +1 -1
  32. package/dist/autopilot/planner.js +105 -27
  33. package/dist/autopilot/planner.js.map +1 -1
  34. package/dist/autopilot/prompts.d.ts +18 -0
  35. package/dist/autopilot/prompts.d.ts.map +1 -1
  36. package/dist/autopilot/prompts.js +163 -0
  37. package/dist/autopilot/prompts.js.map +1 -1
  38. package/dist/autopilot/review-policy.d.ts +22 -0
  39. package/dist/autopilot/review-policy.d.ts.map +1 -0
  40. package/dist/autopilot/review-policy.js +56 -0
  41. package/dist/autopilot/review-policy.js.map +1 -0
  42. package/dist/autopilot/runner.d.ts.map +1 -1
  43. package/dist/autopilot/runner.js +39 -12
  44. package/dist/autopilot/runner.js.map +1 -1
  45. package/dist/autopilot/session.d.ts +9 -1
  46. package/dist/autopilot/session.d.ts.map +1 -1
  47. package/dist/autopilot/session.js +36 -2
  48. package/dist/autopilot/session.js.map +1 -1
  49. package/dist/autopilot/state.d.ts +19 -4
  50. package/dist/autopilot/state.d.ts.map +1 -1
  51. package/dist/autopilot/state.js +200 -8
  52. package/dist/autopilot/state.js.map +1 -1
  53. package/dist/autopilot/tasks.d.ts +3 -1
  54. package/dist/autopilot/tasks.d.ts.map +1 -1
  55. package/dist/autopilot/tasks.js +471 -78
  56. package/dist/autopilot/tasks.js.map +1 -1
  57. package/dist/autopilot/types.d.ts +252 -9
  58. package/dist/autopilot/types.d.ts.map +1 -1
  59. package/dist/autopilot/types.js +8 -1
  60. package/dist/autopilot/types.js.map +1 -1
  61. package/dist/book/design.d.ts +265 -0
  62. package/dist/book/design.d.ts.map +1 -0
  63. package/dist/book/design.js +632 -0
  64. package/dist/book/design.js.map +1 -0
  65. package/dist/book/outline.d.ts +20 -4
  66. package/dist/book/outline.d.ts.map +1 -1
  67. package/dist/book/outline.js +46 -9
  68. package/dist/book/outline.js.map +1 -1
  69. package/dist/director/opinion.d.ts +2 -0
  70. package/dist/director/opinion.d.ts.map +1 -1
  71. package/dist/director/opinion.js +4 -3
  72. package/dist/director/opinion.js.map +1 -1
  73. package/dist/index.d.ts +3 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +3 -0
  76. package/dist/index.js.map +1 -1
  77. package/dist/server/client.d.ts +10 -4
  78. package/dist/server/client.d.ts.map +1 -1
  79. package/dist/server/client.js +33 -12
  80. package/dist/server/client.js.map +1 -1
  81. package/dist/server/protocol.d.ts +35 -1
  82. package/dist/server/protocol.d.ts.map +1 -1
  83. package/dist/server/protocol.js +38 -0
  84. package/dist/server/protocol.js.map +1 -1
  85. package/dist/testing/index.d.ts +2 -0
  86. package/dist/testing/index.d.ts.map +1 -1
  87. package/dist/testing/index.js +67 -0
  88. package/dist/testing/index.js.map +1 -1
  89. package/dist/version.d.ts +1 -1
  90. package/dist/version.js +1 -1
  91. package/package.json +1 -1
package/README.md CHANGED
@@ -201,6 +201,10 @@ Its profile lives in `director.md` at the book root (persona, autonomy, strictne
201
201
 
202
202
  Values are read as the author wrote them: an autonomy whatever its case (`Full`, `ask on critical`), numbers with their decimals (`approval_score: 7.5`, a reader weight of `0.4`) and a decimal comma (`'9,5'`).
203
203
 
204
+ ### The review policy
205
+
206
+ `options.review` (`ReviewPolicy`, `normalizeReviewPolicy`) changes, for a run, the vote a chapter and the book must reach (`targetScore`, 1-10 to a tenth; the plan keeps the director's), the rounds of a chapter (`maxRounds`, 1-10), the first rounds the readers read in (`readerRounds`, 1-10; 1 by default) and the rounds a review of the book makes before it waits (`campaignMaxRounds`; 0 none). What it does not say is the profile's; `null` takes a value back. `reviewTarget`, `reviewMaxRounds` and `reviewReaderRounds` say what wins: the review of the book in progress, the policy, the profile. Without a policy every prompt is the one it always was. A chapter keeps its last `MAX_CHAPTER_ROUNDS` (30) rounds.
207
+
204
208
  ### Profiles that cannot be read
205
209
 
206
210
  `parseDirector`, `parseGhostwriter`, `parseReaderPersona` and `parseEvaluationStyle` never throw and never hide a problem: they return `warnings: string[]` (empty when the file is as it says), each naming the file. A warning is YAML that cannot be read (with its line), a value that is not understood (an autonomy nobody knows, a score that is not a number, a list that is not a list, a reader type that is none of `standard`, `genre`, `custom`, a switch that is neither yes nor no, a criterion of the evaluation style that cannot be read), and the profile then has the default for that value, as it always had. The defaults themselves carry `warnings: []`.
@@ -221,7 +225,7 @@ The outline (the Synopsis of the app, «Sinossi» in Italian; once called the Sc
221
225
  |---|---|---|
222
226
  | `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. |
223
227
  | `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*. |
224
- | `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. |
228
+ | `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?`, `design?` (see *Designing a book*) | What happens in the chapter, plain text. |
225
229
  | `outline/brainstorm.md` (`OUTLINE_BRAINSTORM_FILE`) | none | The notes of Brainstorming (the Copilot's mode on the Synopsis page of the app): the decisions the author saved from a brainstorm, one dated section after the other. Never an entry: `parseOutline` and `outlineIndex` skip it as they skip the brief, so it has no number and is never a warning, and no outline edit writes, moves or deletes it. |
226
230
  | `outline/changes.yml` (`OUTLINE_CHANGES_FILE`) | none (YAML) | The journal of the Synopsis (see below). Never an entry and not Markdown: `parseOutline`, `outlineIndex` and `CONTENT_GLOB` skip it. |
227
231
 
@@ -386,12 +390,25 @@ A decision that needs the model is recorded in `state.pendingReviews` and carrie
386
390
 
387
391
  Refusals are `RevisionCampaignError` (`REVISION_CAMPAIGN_ERROR_CODES`): `invalid_request`, `campaign_active`, `not_changed` (no such change now), `stale` (the chapter's `fingerprint` is not the change's).
388
392
 
389
- A reason is its handler, `REVISION_REASON_HANDLERS[reason]` (`RevisionReasonHandler`): `check`, `record`, `start`, `finished`, `keep`, `cancel`, `stop` (end before the next chapter: `campaignStopped`, the waiting chapters cancelled), `complete` and `texts`. A new reason is a word of `REVISION_REASONS`, its handler and a server feature.
393
+ A reason is its handler, `REVISION_REASON_HANDLERS[reason]` (`RevisionReasonHandler`): `check`, `record`, `start`, `finished`, `keep`, `cancel`, `stop` (end before the next chapter: `campaignStopped`, the waiting chapters cancelled), `complete` and `texts`; a reason that goes in rounds adds `afterChapters` (end, wait, or another round), `resume` (a start) and its insight `codes` and `figures`. A new reason is a word of `REVISION_REASONS`, its handler and a server feature (`CAMPAIGN_FEATURES`).
390
394
 
391
395
  - **`outline-change`** (the Synopsis applied to the book): the chapters are the written ones whose entry changed (`frozenStatus` kind `outline`). `follow` rewrites the chapter to its new entry (`beginOutlineRewrite`, as `rewrite-to-outline`, the author's words as the note) and checks **no** later chapter; `keep` keeps the text and the plan follows the entry; `later` (and a cancel) leaves a `DeferredChange` (`state.deferredChanges`): neither asked about nor decided by the autopilot while it stays as it is, still waiting for the author (`frozenStatus` says `deferred`). A chapter the author wrote is rewritten only because the author chose it.
392
396
 
397
+ - **`review-target`** (the finished book reviewed again to a target): `session.reviewBook({ targetScore, maxRounds?, readerRounds?, campaignMaxRounds?, budgetLimit?, budgetTokens?, include?, note? })` (`createReviewCampaign`; refused `not_finished`, `nothing_to_review`, `campaign_active`, `invalid_request`; `reviseChapters` refuses the reason). It may revise the autopilot's chapters, and the author's (frozen by the author, or imported and not frozen by the autopilot: `authorChapters`) only when included; one changed since it was frozen never. Each round reviews again, in the order of the book, the chapters whose vote (`chapterVote`) is under the target, at the review's target and rounds, then `final` judges the book (`reviewVotes`). It ends on the target (`reviewDone`), when no chapter is under it (`reviewStopped`, `chapters`), or after two rounds that raise neither the lowest vote nor the book's (`plateau`); after `options.review.campaignMaxRounds` rounds since the run began it is `held` (`reviewHeld`, `state.limitReached` `review-rounds`) and a start allows as many again. The caps it is given are the options' own. A chapter the author froze or changed meanwhile is left out (`reviewChapterSkipped`, why `author`). `state.reviews` (`ReviewRecord`) keeps how each ended; its insights carry `figures`.
398
+
393
399
  The personal server serves `POST` and `DELETE /api/v1/books/:id/autopilot/campaign` and announces `autopilot-outline-apply` (see *The personal server client*).
394
400
 
401
+ ## Designing a book
402
+
403
+ `start({ design: { chapters?, review? } })` (or `design: true`) is a **design run**: from the description of the book, the autopilot designs it and writes no prose. `state.design` (`AutopilotDesign`) keeps it until it ends; a start that says nothing goes on with it (a resume, a restart), `design: false` ends it (`outcome: "author"`) and the run goes on to write. It is refused (`AutopilotDesignError`) for a book without a description (`design_no_description`) or with chapters the autopilot wrote (`design_written`); `normalizeDesignStart` checks the request (`invalid_request`).
404
+
405
+ - **The steps are the autopilot's own.** The Synopsis gets an empty entry of the autopilot for each chapter it lacks (an empty `origin: autopilot` entry without a digest is a place the autopilot fills: `intact`). The concept also writes the relationships of the cast, the items that matter, `bible/themes.md` and `bible/world.md` (when missing) and what each secret changes. The plan designs `DESIGN_BATCH_CHAPTERS` (6) chapters a call with `chapter_design`: every chapter its summary and its `design`, every secret its ledger for those chapters. The readers react with `design_reaction` (a counter-proposal is required), the director reviews with `design_review` (a devil's advocate, and the `critical` inconsistencies).
406
+ - **The design of an entry** (`design:`, `OutlineChapterDesign`): `goal`, `pov`, `characters`, `setting`, `time`, `events`, `scenes`, `conflicts`, `emotions`, `reveals`, `withholds`, `clues`, `previous`, `next`, `ending`, `cliffhanger`, `notes`. Read softly (`readOutlineDesign`: a field of the wrong kind is a `design-invalid` warning and is left out; unknown keys are kept), written whole by the autopilot (`wholeDesignPatch`) and field by field by an edit (`OutlineEntryInput.design`, `OutlineDesignPatch`: `null` takes a field away). It is part of `outlineEntryDigest` only when it says something: an entry without one keeps its fingerprint. `outlineDesignGaps` lists the designs without a key field.
407
+ - **The ledger of a secret** (`readSecretLedger`, `secretLedgerFrontmatter`): `learned_by` (`{ character, chapter }`), `reader_knows`, `clues`, `red_herrings` (`{ chapter, note }`), `consequences`, chapters as numbers, beside `holders`, `known_from`, `reveal_in`. The design rewrites only the ledgers it wrote and nobody changed (`AutopilotDesign.ledgers`, `secretLedgerDigest`); the approval writes `reveal_in` and `known_from` as a plan's does.
408
+ - **The checks** (`designChecks`, `designFindingText`): a mystery without a reveal, a reveal out of the book or before `known_from`, a clue in or after the reveal, a reveal without a clue before it, a ledger chapter out of the book, a point of view that reveals what that character learns later, a character or a place the canon does not have. Findings, never blockers: an insight (`designChecks`) and the director's data.
409
+ - **The review and the stop.** The policy is the design's (`DesignStartInput.review`: `targetScore`, else the director's approval score; `maxRounds`, else 3; `readerRounds`, else 1). A score alone never approves: a `critical` inconsistency sends it back; one left after the last round is asked to the author once (`designEscalated`), then the design is approved with it as guidance. Two reviews that do not raise the vote end it (`plateau`). The approval (`designReady`, with `figures`) makes the folders of the chapters (their `chapter.md`, no scene), sets `endedAt` and `outcome`, and the run stops (`designReady`): a start then writes. While it goes on `options.pauseAfterPlan` is on (an engine that does not know designs stops at the plan) and is given back when it ends. The money and token caps stop it as any run.
410
+ - **Estimate**: `estimateAutopilotRun({ design: { maxRounds?, readerRounds? } })`. A personal server announces `autopilot-design` (`serverSupportsDesign`); the client refuses `design` to one that does not.
411
+
395
412
  ## Evaluation style
396
413
 
397
414
  `evaluation-guidelines.md`, the "Evaluation style" page of the web app, says how the author judges the book: `criteria`, a mapping of keys to `{ description }` (as the site writes it; a description written as text, a criterion left empty, and a list of `{ name, description }` are read as well), and a body with the critical method, the severity and the structure of a written evaluation. `parseEvaluationStyle(raw)` reads it as `{ title, criteria: [{ name, description }], body, path, warnings }` and `loadEvaluationStyle(store)` reads it from a book (`null` without the file). Like a profile it never throws and never drops a criterion in silence: YAML that cannot be read (with its line) and a criterion that cannot be read are warnings that name the file, and a file with warnings stops the run before it spends anything (`profileProblems`).
@@ -433,10 +450,10 @@ const estimate = estimateAutopilotRun({
433
450
  | Field | Meaning |
434
451
  |---|---|
435
452
  | `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. |
436
- | `maxReviewRounds` | The most rounds of review a chapter gets, 1 to 3 (2 when it says nothing), as in the director's profile. |
453
+ | `maxReviewRounds` | The most rounds of review a chapter gets, 1 to 3 (2 when it says nothing), as in the director's profile; `options.review.maxRounds` (1 to 10) wins, and `options.review.readerRounds` has the readers read in as many rounds. |
437
454
  | `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. |
438
455
  | `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`). |
439
- | `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. |
456
+ | `progress` | `{ chaptersDone, planned, conceptDone, finalDone, withoutSummary, withoutSummaryWords, reviewOnly }`: a book that is started counts only the rest (`reviewOnly`: the chapters left are only reviewed again, nothing is written). `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. |
440
457
  | `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*. |
441
458
  | `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. |
442
459
  | `readerPanelSize` | Readers in the panel (default: the enabled readers of the built-in panel, 8). The readers of a run are `min(maxReaders, readerPanelSize)`. |
@@ -750,7 +767,7 @@ The levels, and who sets them (the target, the integration, `automatic`), are th
750
767
 
751
768
  ### Costs and budgets
752
769
 
753
- `estimateCost` bills cached tokens like normal input unless the model has a `cachedPerMTok`. A reply carries `usageKnown` and `costKnown`: when the provider reports no tokens, `usage` is an estimate (`usageKnown: false`, `costKnown: false`); a model without a price has no `cost`. The autopilot counts those calls in `stats.usageUnknownCalls` and `stats.costUnknownCalls`, says once per run that the money budget (`options.budgetLimit`) cannot apply to a model without a price (`budgetNotApplicable`), and `options.budgetTokens` stops the run at a number of tokens instead (0 = off).
770
+ `estimateCost` bills cached tokens like normal input unless the model has a `cachedPerMTok`. A reply carries `usageKnown` and `costKnown`: when the provider reports no tokens, `usage` is an estimate (`usageKnown: false`, `costKnown: false`); a model without a price has no `cost`. The autopilot counts those calls in `stats.usageUnknownCalls` and `stats.costUnknownCalls`, says once per run that the money budget (`options.budgetLimit`) cannot apply to a model without a price (`budgetNotApplicable`), and `options.budgetTokens` stops the run at a number of tokens instead (0 = off). Both compare the book's totals (`stats`, of every run, set back only by a reset): the run stops before its next step (`budgetReached`, `tokenBudgetReached`) with `state.limitReached` (`{ kind, used, limit, currency? }`, in the summary too), and again at every start until the cap is raised.
754
771
 
755
772
  ### Retries
756
773
 
@@ -985,7 +1002,7 @@ A skipped file is not recorded as synced (a file that was never synced stays out
985
1002
  The `code` of a refusal of a rule is the `code` of the engine's `AutopilotRuleError` (`AUTOPILOT_RULE_ERROR_CODES`: `rule_empty`, `rule_too_long`, `rule_not_found`, `rule_changed`, `rule_duplicate`), which a server can answer as it is (`400` for the first, the third and the last, `404` for `rule_not_found`, `409` for `rule_changed`); `isAutopilotRuleErrorCode(error.code)` tells a refusal of a rule from the other codes of `ServerRequestError`. The client sends the text as it is given and an index as it is given (a number that names no rule is `404 rule_not_found`), and what it gets back is the error it always gives, with the status and the code of the server. The answer to a question of the director that is kept as a rule needs nothing new: `answer(bookId, { questionId, answer, asRule: true })` has always carried `asRule` (`QuestionAnswer`), and a note used once is still the default.
986
1003
 
987
1004
  - **Frozen chapters.** The changes of the frozen chapters and the decisions about them (see *Frozen chapters*) go through three routes, which the engine's session already serves (`session.frozenStatus`, `session.resolveFrozenChange`, `session.freezeChapter` and `unfreezeChapter`). A server that implements them announces `SERVER_FEATURE_AUTOPILOT_FROZEN` (`"autopilot-frozen"`) in the `features` of `GET /api/v1/info`, and `serverSupportsFrozenChapters(info)` reads it (never throws; an older server, or an odd answer, says no): an older server answers `404 not_found` to the routes. The question needs no new route: an answer is the `answer` of `POST …/autopilot/answer` (the `id` of a choice, or its label), which every server forwards. Every call also answers `401 unauthorized`, `403 scope` and `404 book_not_found`, and `503 maintenance` while the server is about to restart.
988
- - **Campaigns.** `reviseChapters(bookId, input)` and `cancelRevisionCampaign(bookId)` are `POST` and `DELETE …/autopilot/campaign` (the session's), answering `{ campaign, frozen }`, on a server that announces `autopilot-outline-apply` (`serverSupportsOutlineApply`; else `501 feature_unavailable` before sending). Refusals: `400 invalid_request` (an unknown key too), `409 campaign_active`, `not_changed`, `stale`; scope `run`.
1005
+ - **Campaigns.** `reviseChapters(bookId, input)` and `cancelRevisionCampaign(bookId)` are `POST` and `DELETE …/autopilot/campaign` (the session's), answering `{ campaign, frozen }`, on a server that announces the feature of the reason (`CAMPAIGN_FEATURES`: `autopilot-outline-apply`, `serverSupportsOutlineApply`; a cancel, any; else `501 feature_unavailable` before sending). Refusals: `400 invalid_request` (an unknown key too), `409 campaign_active`, `not_changed`, `stale`; scope `run`. `reviewBook(bookId, input)` is `POST …/autopilot/review` (`autopilot-review-book`, `serverSupportsReviewBook`), also refused `409 not_finished`, `nothing_to_review`. `options.review` in `configure` and `start` needs `autopilot-review-policy` (`serverSupportsReviewPolicy`), else `501 feature_unavailable`.
989
1006
 
990
1007
  | Client method | Request | Answer |
991
1008
  |---|---|---|
@@ -1,6 +1,7 @@
1
+ import type { BookSnapshot } from "../book/snapshot.js";
1
2
  import { type FrozenStatus, type FrozenWorkItem, type PlannerFrozen } from "./frozen.js";
2
3
  import type { PlanNote } from "./planner.js";
3
- import { type AutopilotState, type PlannedChapter, type RevisionCampaign, type RevisionCampaignChapter, type RevisionChapterMode, type RevisionReason } from "./types.js";
4
+ import { type AutopilotInsightFigures, type AutopilotMessageCode, type AutopilotState, type PlannedChapter, type ReviewVotes, type RevisionCampaign, type RevisionCampaignChapter, type RevisionChapterMode, type RevisionReason } from "./types.js";
4
5
  /**
5
6
  * Campaigns: «revise THESE chapters now, for THIS reason, in order, then go on with the plan», one mechanism for every reason (`RevisionReason`).
6
7
  *
@@ -20,12 +21,16 @@ import { type AutopilotState, type PlannedChapter, type RevisionCampaign, type R
20
21
  * that changes), `keep` keeps the text and the plan follows the entry, `later` leaves the change for the author (`DeferredChange`). A chapter the author
21
22
  * wrote is rewritten only because the author chose it here: the autopilot never does it on its own.
22
23
  */
23
- export type RevisionCampaignErrorCode = "invalid_request" | "campaign_active" | "not_changed" | "stale";
24
+ export type RevisionCampaignErrorCode = "invalid_request" | "campaign_active" | "not_changed" | "stale" | "not_finished" | "nothing_to_review";
24
25
  /** The codes of `RevisionCampaignError`, which the personal server answers with as they are. */
25
26
  export declare const REVISION_CAMPAIGN_ERROR_CODES: readonly RevisionCampaignErrorCode[];
26
27
  /** Whether a code is one of `RevisionCampaignError`'s. A host that sent a campaign reads the refusal of the server with it. */
27
28
  export declare function isRevisionCampaignErrorCode(code: unknown): code is RevisionCampaignErrorCode;
28
- /** 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 changed since the author saw it (`stale`). */
29
+ /**
30
+ * 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
31
+ * 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
32
+ * (`nothing_to_review`).
33
+ */
29
34
  export declare class RevisionCampaignError extends Error {
30
35
  readonly code: RevisionCampaignErrorCode;
31
36
  constructor(code: RevisionCampaignErrorCode, message: string);
@@ -55,6 +60,13 @@ export type CampaignStart = {
55
60
  } | {
56
61
  outcome: "wait";
57
62
  };
63
+ /** What a reason does once the chapters of its campaign are over: the campaign ends (`end`), waits (`wait`), or goes on with the chapters of another round (`again`). */
64
+ export type CampaignNext = "end" | "wait" | "again";
65
+ /** What the words of a chapter done know: the chapter as it is now, and the campaign. */
66
+ export interface CampaignChapterContext {
67
+ chapter: PlannedChapter;
68
+ campaign: RevisionCampaign;
69
+ }
58
70
  /** What a reason does with its chapters (see the module). The extension point of the campaigns: a reason is one entry of `REVISION_REASON_HANDLERS`. */
59
71
  export interface RevisionReasonHandler {
60
72
  /** The chapters as the campaign keeps them, checked against what the author decides about now (`items`, from `frozenWork`). Throws a `RevisionCampaignError`. */
@@ -73,19 +85,74 @@ export interface RevisionReasonHandler {
73
85
  stop?(state: AutopilotState, campaign: RevisionCampaign, language: string): string | null;
74
86
  /** After the last chapter (mutates). */
75
87
  complete?(state: AutopilotState, campaign: RevisionCampaign): void;
88
+ /**
89
+ * Once no chapter waits or is being worked (and the author did not cancel the campaign): what comes next (`CampaignNext`; without this hook the campaign ends,
90
+ * said with `texts.done`). A reason with this hook says how it ended itself. Mutates `state` and `campaign`; every moment comes from `frozen.now`.
91
+ */
92
+ afterChapters?(state: AutopilotState, campaign: RevisionCampaign, frozen: PlannerFrozen, report: (note: PlanNote) => void, language: string): CampaignNext;
93
+ /** A run starts: the campaign held for the author goes on, and what the reason counts since a run began starts again (mutates the campaign). */
94
+ resume?(state: AutopilotState, campaign: RevisionCampaign, at: string): void;
95
+ /** The codes of its insights about a chapter, when they are not the campaigns' (`campaignChapterDone`, `campaignSkipped`). */
96
+ codes?: {
97
+ chapterDone: AutopilotMessageCode;
98
+ skipped: AutopilotMessageCode;
99
+ };
100
+ /** The numbers of the insight about a chapter done. */
101
+ figures?(chapter: PlannedChapter, campaign: RevisionCampaign): AutopilotInsightFigures | undefined;
76
102
  texts: {
77
- chapterDone(number: number, done: number, total: number, language: string): string;
103
+ chapterDone(number: number, done: number, total: number, language: string, context?: CampaignChapterContext): string;
78
104
  skipped(number: number, why: NonNullable<RevisionCampaignChapter["why"]>, language: string): string;
79
105
  done(worked: number, language: string): string;
80
106
  };
81
107
  }
108
+ /** 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. */
109
+ export declare function chapterVote(chapter: Pick<PlannedChapter, "score" | "rounds">): number | null;
110
+ /**
111
+ * 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
112
+ * under it: it has never been judged), and the vote of the book (the director's last judgement of the whole book).
113
+ */
114
+ export declare function reviewVotes(state: Pick<AutopilotState, "plan" | "finalReview">, scope: readonly number[], target: number): ReviewVotes & {
115
+ chapters: number[];
116
+ };
82
117
  /** The handlers of the reasons: the extension point of the campaigns. */
83
118
  export declare const REVISION_REASON_HANDLERS: Readonly<Record<RevisionReason, RevisionReasonHandler>>;
119
+ /**
120
+ * What the author asks when the book is reviewed again (`AutopilotSession.reviewBook`): the target score (from 1 to 10), and what else the review is allowed:
121
+ * the rounds of review of a chapter (`maxRounds`, 1 to `REVIEW_MAX_ROUNDS`), the rounds the readers read again (`readerRounds`, 0 to `REVIEW_MAX_ROUNDS`: 0, they
122
+ * do not), the chapters of the author's to review too (`include`), and words for the director (`note`): these are the review's own. The caps are the options'
123
+ * own fields, which the review writes as the configuration would: the rounds of a review since a run began (`campaignMaxRounds`, `options.review`; 0: no limit),
124
+ * the money and token caps of the book (`budgetLimit`, `budgetTokens`; 0: none).
125
+ */
126
+ export interface ReviewBookInput {
127
+ targetScore: number;
128
+ maxRounds?: number;
129
+ readerRounds?: number;
130
+ campaignMaxRounds?: number;
131
+ budgetLimit?: number;
132
+ budgetTokens?: number;
133
+ include?: number[];
134
+ note?: string;
135
+ }
136
+ /** Whether the book is finished: an approved plan whose chapters are all closed, and the director's judgement of the whole book. */
137
+ export declare function bookFinished(state: Pick<AutopilotState, "plan" | "finalDone">): boolean;
138
+ /**
139
+ * 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
140
+ * 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
141
+ * book leaves them out unless the author includes them: the autopilot never rewrites them by its own decision.
142
+ */
143
+ export declare function authorChapters(state: Pick<AutopilotState, "plan">, snapshot: Pick<BookSnapshot, "chapters">): Set<number>;
144
+ /** A review of the book from what the author asked, checked against the book now. Throws a `RevisionCampaignError`. */
145
+ export declare function createReviewCampaign(input: ReviewBookInput, state: AutopilotState, snapshot: BookSnapshot, now: Date, id?: string): RevisionCampaign;
146
+ /** A run starts: a campaign held for the author goes on, and what its reason counts since a run began starts again (pure). */
147
+ export declare function resumeCampaign(state: AutopilotState, at: string): AutopilotState;
84
148
  /** A campaign from what the author asked, checked against what the book is now (`items`: `frozenWork`). Throws a `RevisionCampaignError`. */
85
149
  export declare function createRevisionCampaign(input: ReviseChaptersInput, items: readonly FrozenWorkItem[], now: Date, id?: string): RevisionCampaign;
86
150
  /** The state with a campaign recorded (pure): refused while another one goes on. */
87
151
  export declare function recordRevisionCampaign(state: AutopilotState, campaign: RevisionCampaign, at: string, running: boolean): AutopilotState;
88
- /** The state with the chapters of the campaign that wait cancelled (the one being worked finishes); the campaign goes once nothing of it is left to do. */
152
+ /**
153
+ * 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);
154
+ * the campaign goes once nothing of it is left to do. A limit it held the run for goes with it.
155
+ */
89
156
  export declare function cancelRevisionCampaign(state: AutopilotState, at: string): AutopilotState;
90
157
  /**
91
158
  * 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
@@ -1 +1 @@
1
- {"version":3,"file":"campaign.d.ts","sourceRoot":"","sources":["../../src/autopilot/campaign.ts"],"names":[],"mappings":"AACA,OAAO,EAAyF,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAChL,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,aAAa,GAAG,OAAO,CAAC;AAExG,gGAAgG;AAChG,eAAO,MAAM,6BAA6B,EAAE,SAAS,yBAAyB,EAAmE,CAAC;AAElJ,+HAA+H;AAC/H,wBAAgB,2BAA2B,CAAC,IAAI,E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