narrarium-engine 0.1.2 → 0.1.4

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 (144) hide show
  1. package/README.md +130 -10
  2. package/dist/ai/budget.d.ts +26 -0
  3. package/dist/ai/budget.d.ts.map +1 -0
  4. package/dist/ai/budget.js +35 -0
  5. package/dist/ai/budget.js.map +1 -0
  6. package/dist/ai/config.d.ts +26 -0
  7. package/dist/ai/config.d.ts.map +1 -1
  8. package/dist/ai/config.js +33 -2
  9. package/dist/ai/config.js.map +1 -1
  10. package/dist/ai/fetch-client.d.ts +80 -9
  11. package/dist/ai/fetch-client.d.ts.map +1 -1
  12. package/dist/ai/fetch-client.js +287 -114
  13. package/dist/ai/fetch-client.js.map +1 -1
  14. package/dist/ai/redact.d.ts +7 -0
  15. package/dist/ai/redact.d.ts.map +1 -0
  16. package/dist/ai/redact.js +34 -0
  17. package/dist/ai/redact.js.map +1 -0
  18. package/dist/ai/request.d.ts +34 -0
  19. package/dist/ai/request.d.ts.map +1 -0
  20. package/dist/ai/request.js +86 -0
  21. package/dist/ai/request.js.map +1 -0
  22. package/dist/ai/router.js +1 -1
  23. package/dist/ai/router.js.map +1 -1
  24. package/dist/ai/routing.d.ts +47 -0
  25. package/dist/ai/routing.d.ts.map +1 -0
  26. package/dist/ai/routing.js +83 -0
  27. package/dist/ai/routing.js.map +1 -0
  28. package/dist/ai/structured.d.ts +13 -4
  29. package/dist/ai/structured.d.ts.map +1 -1
  30. package/dist/ai/structured.js +58 -8
  31. package/dist/ai/structured.js.map +1 -1
  32. package/dist/ai/token-limit.d.ts +21 -2
  33. package/dist/ai/token-limit.d.ts.map +1 -1
  34. package/dist/ai/token-limit.js +48 -4
  35. package/dist/ai/token-limit.js.map +1 -1
  36. package/dist/ai/types.d.ts +40 -0
  37. package/dist/ai/types.d.ts.map +1 -1
  38. package/dist/ai/types.js +32 -0
  39. package/dist/ai/types.js.map +1 -1
  40. package/dist/autopilot/outline.d.ts +57 -0
  41. package/dist/autopilot/outline.d.ts.map +1 -0
  42. package/dist/autopilot/outline.js +175 -0
  43. package/dist/autopilot/outline.js.map +1 -0
  44. package/dist/autopilot/planner.d.ts +67 -2
  45. package/dist/autopilot/planner.d.ts.map +1 -1
  46. package/dist/autopilot/planner.js +259 -16
  47. package/dist/autopilot/planner.js.map +1 -1
  48. package/dist/autopilot/profile-check.d.ts +24 -0
  49. package/dist/autopilot/profile-check.d.ts.map +1 -0
  50. package/dist/autopilot/profile-check.js +38 -0
  51. package/dist/autopilot/profile-check.js.map +1 -0
  52. package/dist/autopilot/prompts.d.ts +1 -0
  53. package/dist/autopilot/prompts.d.ts.map +1 -1
  54. package/dist/autopilot/prompts.js +9 -0
  55. package/dist/autopilot/prompts.js.map +1 -1
  56. package/dist/autopilot/runner.d.ts +80 -8
  57. package/dist/autopilot/runner.d.ts.map +1 -1
  58. package/dist/autopilot/runner.js +435 -85
  59. package/dist/autopilot/runner.js.map +1 -1
  60. package/dist/autopilot/session.d.ts +44 -2
  61. package/dist/autopilot/session.d.ts.map +1 -1
  62. package/dist/autopilot/session.js +115 -18
  63. package/dist/autopilot/session.js.map +1 -1
  64. package/dist/autopilot/state.d.ts +16 -0
  65. package/dist/autopilot/state.d.ts.map +1 -1
  66. package/dist/autopilot/state.js +47 -9
  67. package/dist/autopilot/state.js.map +1 -1
  68. package/dist/autopilot/tasks.d.ts +2 -0
  69. package/dist/autopilot/tasks.d.ts.map +1 -1
  70. package/dist/autopilot/tasks.js +416 -141
  71. package/dist/autopilot/tasks.js.map +1 -1
  72. package/dist/autopilot/types.d.ts +25 -2
  73. package/dist/autopilot/types.d.ts.map +1 -1
  74. package/dist/book/context.d.ts +34 -5
  75. package/dist/book/context.d.ts.map +1 -1
  76. package/dist/book/context.js +172 -29
  77. package/dist/book/context.js.map +1 -1
  78. package/dist/book/paths.d.ts +14 -2
  79. package/dist/book/paths.d.ts.map +1 -1
  80. package/dist/book/paths.js +21 -4
  81. package/dist/book/paths.js.map +1 -1
  82. package/dist/book/snapshot.js +3 -3
  83. package/dist/book/snapshot.js.map +1 -1
  84. package/dist/book/store.d.ts +10 -0
  85. package/dist/book/store.d.ts.map +1 -1
  86. package/dist/book/store.js.map +1 -1
  87. package/dist/director/opinion.d.ts +10 -0
  88. package/dist/director/opinion.d.ts.map +1 -1
  89. package/dist/director/opinion.js +79 -18
  90. package/dist/director/opinion.js.map +1 -1
  91. package/dist/index.d.ts +5 -0
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +5 -0
  94. package/dist/index.js.map +1 -1
  95. package/dist/markdown/frontmatter.d.ts +22 -1
  96. package/dist/markdown/frontmatter.d.ts.map +1 -1
  97. package/dist/markdown/frontmatter.js +67 -11
  98. package/dist/markdown/frontmatter.js.map +1 -1
  99. package/dist/profiles/director.d.ts +15 -0
  100. package/dist/profiles/director.d.ts.map +1 -1
  101. package/dist/profiles/director.js +98 -37
  102. package/dist/profiles/director.js.map +1 -1
  103. package/dist/profiles/ghostwriter.d.ts +7 -0
  104. package/dist/profiles/ghostwriter.d.ts.map +1 -1
  105. package/dist/profiles/ghostwriter.js +54 -16
  106. package/dist/profiles/ghostwriter.js.map +1 -1
  107. package/dist/profiles/read.d.ts +33 -0
  108. package/dist/profiles/read.d.ts.map +1 -0
  109. package/dist/profiles/read.js +96 -0
  110. package/dist/profiles/read.js.map +1 -0
  111. package/dist/profiles/readers.d.ts +8 -0
  112. package/dist/profiles/readers.d.ts.map +1 -1
  113. package/dist/profiles/readers.js +84 -14
  114. package/dist/profiles/readers.js.map +1 -1
  115. package/dist/prompt/trust.d.ts +11 -0
  116. package/dist/prompt/trust.d.ts.map +1 -1
  117. package/dist/prompt/trust.js +26 -0
  118. package/dist/prompt/trust.js.map +1 -1
  119. package/dist/readers/evaluation.d.ts.map +1 -1
  120. package/dist/readers/evaluation.js +3 -2
  121. package/dist/readers/evaluation.js.map +1 -1
  122. package/dist/server/client.d.ts +38 -4
  123. package/dist/server/client.d.ts.map +1 -1
  124. package/dist/server/client.js +69 -9
  125. package/dist/server/client.js.map +1 -1
  126. package/dist/server/protocol.d.ts +25 -0
  127. package/dist/server/protocol.d.ts.map +1 -1
  128. package/dist/server/protocol.js +23 -2
  129. package/dist/server/protocol.js.map +1 -1
  130. package/dist/sync/files.d.ts +35 -1
  131. package/dist/sync/files.d.ts.map +1 -1
  132. package/dist/sync/files.js +160 -32
  133. package/dist/sync/files.js.map +1 -1
  134. package/dist/testing/index.d.ts +4 -0
  135. package/dist/testing/index.d.ts.map +1 -1
  136. package/dist/testing/index.js +30 -5
  137. package/dist/testing/index.js.map +1 -1
  138. package/dist/util/text.d.ts +71 -3
  139. package/dist/util/text.d.ts.map +1 -1
  140. package/dist/util/text.js +322 -11
  141. package/dist/util/text.js.map +1 -1
  142. package/dist/version.d.ts +1 -1
  143. package/dist/version.js +1 -1
  144. package/package.json +2 -2
@@ -0,0 +1,175 @@
1
+ /** Characters a list of chapters may take in a prompt, unless the caller asks for another budget. */
2
+ export const OUTLINE_MAX_CHARS = 24_000;
3
+ /** Chapters up to this far from the focus keep every detail. */
4
+ const NEAR_CHAPTERS = 30;
5
+ /** Chapters farther than this from the focus are collapsed into blocks. */
6
+ const FAR_CHAPTERS = 100;
7
+ /** The first and the last chapters of a list are never collapsed. */
8
+ const EDGE_CHAPTERS = 5;
9
+ /** Chapters per collapsed line; a block grows tenfold while the list still does not fit. */
10
+ const BLOCK_CHAPTERS = 10;
11
+ /**
12
+ * Tried in order until the list fits: everything; far chapters without reveals and scenes; far chapters with only a
13
+ * title; far chapters collapsed into blocks of ten. A list that still does not fit grows its blocks tenfold, then
14
+ * narrows the window around the focus, then the range kept line by line, so that no number of chapters can make it
15
+ * exceed its budget.
16
+ */
17
+ const LEVELS = [
18
+ { far: "full", near: Number.POSITIVE_INFINITY, mid: Number.POSITIVE_INFINITY, block: BLOCK_CHAPTERS },
19
+ { far: "summary", near: NEAR_CHAPTERS, mid: Number.POSITIVE_INFINITY, block: BLOCK_CHAPTERS },
20
+ { far: "title", near: NEAR_CHAPTERS, mid: Number.POSITIVE_INFINITY, block: BLOCK_CHAPTERS },
21
+ ...[NEAR_CHAPTERS, 20, 12, 6, 3, 1, 0].flatMap((near) => [BLOCK_CHAPTERS, 100, 1000, 10_000].map((block) => ({ far: "title", near, mid: FAR_CHAPTERS, block }))),
22
+ ...[50, 20, 10, 5, 0].map((mid) => ({ far: "title", near: 0, mid, block: 10_000 })),
23
+ ];
24
+ function condensedNote(around, collapsed) {
25
+ const subject = around === undefined ? "chapters show less detail" : `chapters far from chapter ${around} show less detail`;
26
+ return `condensed to fit: ${subject}${collapsed ? ", and runs of distant chapters share one line" : ""}`;
27
+ }
28
+ /** A prompt section: its label (saying that the list is condensed, when it is), then the list. */
29
+ export function listSection(label, list) {
30
+ return `${label}${list.note ? ` (${list.note})` : ""}:\n${list.text}`;
31
+ }
32
+ /**
33
+ * A list of chapters in at most `maxChars` characters. When the whole list fits it is returned as it is; otherwise the
34
+ * chapters far from `around` give up detail, level by level (see `LEVELS`). The first and the last five chapters and
35
+ * everything within 30 chapters of `around` stay on a line of their own, unless nothing else makes the list fit. A line
36
+ * is never cut: the output only depends on the input, and the input is never changed.
37
+ */
38
+ export function windowChapters(items, format, options = {}) {
39
+ return layoutChapters(items, format, options).text;
40
+ }
41
+ /** Like `windowChapters`, and says in words how the list was condensed, for the label of its section in a prompt. */
42
+ export function layoutChapters(items, format, options = {}) {
43
+ const total = items.length;
44
+ if (!total)
45
+ return { text: "", note: "" };
46
+ const maxChars = options.maxChars ?? OUTLINE_MAX_CHARS;
47
+ const around = Number.isFinite(options.around) ? options.around : undefined;
48
+ const drawn = items.map(() => ({}));
49
+ const draw = (index, detail) => (drawn[index][detail] ??= format.render(items[index], detail));
50
+ const distance = (index) => (around === undefined ? Number.POSITIVE_INFINITY : Math.abs(items[index].number - around));
51
+ const lay = (level) => {
52
+ const lines = [];
53
+ const groups = [];
54
+ let size = 0;
55
+ let run = [];
56
+ const add = (line) => {
57
+ size += line.length + (lines.length ? 1 : 0);
58
+ lines.push(line);
59
+ };
60
+ const flush = () => {
61
+ for (let start = 0; start < run.length;) {
62
+ const block = Math.floor((items[run[start]].number - 1) / level.block);
63
+ let end = start + 1;
64
+ while (end < run.length && Math.floor((items[run[end]].number - 1) / level.block) === block)
65
+ end += 1;
66
+ const members = run.slice(start, end);
67
+ if (members.length === 1)
68
+ add(draw(members[0], "title"));
69
+ else {
70
+ groups.push({ line: lines.length, members, nearest: members.reduce((nearest, index) => Math.min(nearest, distance(index)), Number.POSITIVE_INFINITY) });
71
+ add(format.collapse(members.map((index) => items[index]), false));
72
+ }
73
+ start = end;
74
+ }
75
+ run = [];
76
+ };
77
+ for (let index = 0; index < total; index += 1) {
78
+ const edge = index < EDGE_CHAPTERS || index >= total - EDGE_CHAPTERS;
79
+ const away = distance(index);
80
+ if (!edge && away > level.mid) {
81
+ run.push(index);
82
+ continue;
83
+ }
84
+ flush();
85
+ add(draw(index, away <= level.near ? "full" : level.far));
86
+ }
87
+ flush();
88
+ return { lines, groups, size };
89
+ };
90
+ let layout = lay(LEVELS[0]);
91
+ let note = "";
92
+ let cost = layout.size;
93
+ for (let level = 1; cost > maxChars && level < LEVELS.length; level += 1) {
94
+ layout = lay(LEVELS[level]);
95
+ note = condensedNote(around, layout.groups.length > 0);
96
+ cost = layout.size;
97
+ }
98
+ // What the budget has left lists the titles of the blocks, the nearest to the focus first, up to the first that does not fit.
99
+ let room = maxChars - cost;
100
+ for (const group of [...layout.groups].sort((left, right) => (left.nearest === right.nearest ? 0 : left.nearest - right.nearest) || left.line - right.line)) {
101
+ const titles = format.collapse(group.members.map((index) => items[index]), true);
102
+ const extra = titles.length - layout.lines[group.line].length;
103
+ if (extra > room)
104
+ break;
105
+ layout.lines[group.line] = titles;
106
+ room -= extra;
107
+ }
108
+ return { text: layout.lines.join("\n"), note };
109
+ }
110
+ function blockStatus(chapters) {
111
+ if (chapters.every((chapter) => chapter.imported))
112
+ return "already written by the author";
113
+ const done = chapters.filter((chapter) => chapter.status === "done").length;
114
+ if (done === chapters.length)
115
+ return "all approved";
116
+ return done === 0 ? "planned" : `${done} of ${chapters.length} approved`;
117
+ }
118
+ function collapseChapters(chapters, titles) {
119
+ const range = `Chapters ${chapters[0].number}-${chapters[chapters.length - 1].number}`;
120
+ return titles ? `${range}: ${chapters.map((chapter) => chapter.title).join("; ")}` : `${range} (${blockStatus(chapters)})`;
121
+ }
122
+ function outlineFormat(scenes) {
123
+ return {
124
+ render(chapter, detail) {
125
+ const lines = [`${chapter.number}. ${chapter.title}${chapter.imported ? " (already written by the author)" : ""}${chapter.status === "done" ? " [done]" : ""}`];
126
+ if (detail !== "title" && chapter.summary)
127
+ lines.push(` ${chapter.summary}`);
128
+ if (detail === "full") {
129
+ if (chapter.reveals.length)
130
+ lines.push(` Reveals: ${chapter.reveals.join("; ")}`);
131
+ if (scenes)
132
+ for (const scene of chapter.scenes)
133
+ lines.push(` - Scene ${scene.number}: ${scene.title}${scene.summary ? ` — ${scene.summary}` : scene.goal ? ` — ${scene.goal}` : ""}`);
134
+ }
135
+ return lines.join("\n");
136
+ },
137
+ collapse: collapseChapters,
138
+ };
139
+ }
140
+ const LINE_FORMAT = {
141
+ render: (chapter, detail) => `${chapter.number}. ${chapter.title}${detail !== "title" && chapter.summary ? ` — ${chapter.summary}` : ""}`,
142
+ collapse: collapseChapters,
143
+ };
144
+ /** Every chapter of the plan, in full. The outline of a small plan, see `outline` for any size. */
145
+ export function planOutline(plan, options = {}) {
146
+ if (!plan?.chapters.length)
147
+ return "No plan yet.";
148
+ const format = outlineFormat(options.scenes === true);
149
+ return plan.chapters
150
+ .filter((chapter) => options.upTo === undefined || chapter.number <= options.upTo)
151
+ .map((chapter) => format.render(chapter, "full"))
152
+ .join("\n");
153
+ }
154
+ /**
155
+ * The plan as an outline that never outgrows a prompt: identical to `planOutline` while it fits the budget, then
156
+ * condensed around `options.around` (see `windowChapters`).
157
+ */
158
+ export function outline(plan, options = {}) {
159
+ return outlineList(plan, options).text;
160
+ }
161
+ /** `outline`, with the note that says how it was condensed. */
162
+ export function outlineList(plan, options = {}) {
163
+ if (!plan?.chapters.length)
164
+ return { text: "No plan yet.", note: "" };
165
+ return layoutChapters(plan.chapters, outlineFormat(options.scenes === true), options);
166
+ }
167
+ /** One line per chapter (number, title, summary) with the same budget rules: the chapters before one, or the ones already written. */
168
+ export function chapterList(chapters, options = {}) {
169
+ return chapterLines(chapters, options).text;
170
+ }
171
+ /** `chapterList`, with the note that says how it was condensed. */
172
+ export function chapterLines(chapters, options = {}) {
173
+ return layoutChapters(chapters, LINE_FORMAT, options);
174
+ }
175
+ //# sourceMappingURL=outline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outline.js","sourceRoot":"","sources":["../../src/autopilot/outline.ts"],"names":[],"mappings":"AAEA,qGAAqG;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC,gEAAgE;AAChE,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,2EAA2E;AAC3E,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,qEAAqE;AACrE,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,4FAA4F;AAC5F,MAAM,cAAc,GAAG,EAAE,CAAC;AAiC1B;;;;;GAKG;AACH,MAAM,MAAM,GAAY;IACtB,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,iBAAiB,EAAE,GAAG,EAAE,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,cAAc,EAAE;IACrG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,cAAc,EAAE;IAC7F,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,cAAc,EAAE;IAC3F,GAAG,CAAC,aAAa,EAAE,EAAE,E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profiles/director.js";
3
- import type { AutopilotPhase, AutopilotState, AutopilotTaskKind, PlannedChapter, PlannedScene } from "./types.js";
3
+ import type { AutopilotPhase, AutopilotPlan, AutopilotState, AutopilotTaskKind, InsightTone, PlannedChapter, PlannedScene } from "./types.js";
4
4
  export interface PlannerReader {
5
5
  slug: string;
6
6
  name: string;
7
7
  }
8
+ /** Something advancing the state found in the author's files that the author should know about. */
9
+ export interface PlanNote {
10
+ /** The same for the same finding, so that a run can say it once however many steps it takes. */
11
+ key: string;
12
+ tone: InsightTone;
13
+ title: string;
14
+ detail?: string;
15
+ }
8
16
  export interface PlannerContext {
9
17
  snapshot: BookSnapshot;
10
18
  director: DirectorProfile;
@@ -13,6 +21,8 @@ export interface PlannerContext {
13
21
  language: string;
14
22
  /** The story design is still the empty scaffold. */
15
23
  storyDesignThin: boolean;
24
+ /** Told what the reconciliation of the plan with the files found: a chapter followed into its renamed folder, a folder the autopilot will not write in, a rewrite with nothing left to rewrite. */
25
+ report?: (note: PlanNote) => void;
16
26
  }
17
27
  export interface TaskDescriptor {
18
28
  kind: AutopilotTaskKind;
@@ -21,6 +31,8 @@ export interface TaskDescriptor {
21
31
  reason: string;
22
32
  next: string;
23
33
  chapterNumber?: number;
34
+ /** Folder of the chapter, for the one step that is about a chapter by its folder (`summarize-imported`): two folders can have one number. */
35
+ chapterSlug?: string;
24
36
  sceneNumber?: number;
25
37
  reader?: string;
26
38
  readerName?: string;
@@ -35,16 +47,69 @@ export type PlannedStep = {
35
47
  status: "paused" | "waiting-author" | "completed";
36
48
  message: string;
37
49
  };
38
- /** Plain-language "what / why / next" of every step, in the book language. */
50
+ /**
51
+ * Plain-language "what / why / next" of every step, in the book language. `from` and `to` (the chapters one batch of a
52
+ * long plan covers) make the title of the plan task say which chapters it plans; without them it says how many chapters
53
+ * the single batch of a short book plans.
54
+ */
39
55
  export declare function describeTask(kind: AutopilotTaskKind, language: string, params: {
40
56
  chapter?: PlannedChapter;
41
57
  scene?: PlannedScene;
42
58
  readerName?: string;
43
59
  round?: number;
44
60
  chapters?: number;
61
+ from?: number;
62
+ to?: number;
45
63
  }): Pick<TaskDescriptor, "title" | "reason" | "next">;
46
64
  /** Chapters already written by the author before the autopilot took over. */
47
65
  export declare function importedChapters(snapshot: BookSnapshot): PlannedChapter[];
66
+ /**
67
+ * The first chapter written by the author that has no summary yet: one a later chapter cannot be written after without a blind
68
+ * "story so far". The chapters of the plan that are imported when there is a plan, else every chapter of the book that has prose
69
+ * (nothing has been written by the autopilot before its plan is approved). A summary in the chapter's file counts, whatever the plan
70
+ * says; a folder without scenes has nothing to summarize.
71
+ */
72
+ export declare function nextImportedWithoutSummary(state: AutopilotState, snapshot: BookSnapshot): PlannedChapter | undefined;
73
+ /** Chapters planned by one AI call: a longer plan is made of several, so that no reply outgrows the model's output. */
74
+ export declare const PLAN_BATCH_CHAPTERS = 20;
75
+ /** The chapters the autopilot has to plan: `count` of them from `start`, after the chapters already written in the book. */
76
+ export interface PlanRange {
77
+ start: number;
78
+ count: number;
79
+ last: number;
80
+ }
81
+ /** A call of the plan task: the chapters `from` to `to`, out of a range that is `batched` when it takes more than one call. */
82
+ export interface PlanBatch {
83
+ from: number;
84
+ to: number;
85
+ range: PlanRange;
86
+ batched: boolean;
87
+ }
88
+ export declare function planRange(imported: ReadonlyArray<{
89
+ number: number;
90
+ }>, targetChapters: number): PlanRange;
91
+ /** The first chapter of every batch of the range. */
92
+ export declare function planBatchStarts(range: PlanRange): number[];
93
+ /** The first chapter of the batches a revision of this plan has still to regenerate: all of them when the plan does not say. */
94
+ export declare function revisionBatchStarts(plan: AutopilotPlan, range: PlanRange): number[];
95
+ /** The batches that hold the chapters a review names; all of them when a change names no chapter of the range. */
96
+ export declare function batchesNamed(range: PlanRange, chapterNumbers: number[]): number[];
97
+ /**
98
+ * The batch the plan task runs next, or `null` when there is nothing to plan: the first chapter of the range that is not in
99
+ * the plan yet, else the first batch a revision still has to regenerate. A range that fits one batch is always planned
100
+ * whole.
101
+ */
102
+ export declare function nextPlanBatch(plan: AutopilotPlan | null, range: PlanRange): PlanBatch | null;
103
+ /** The first chapter of the range that the chapters do not have. */
104
+ export declare function firstMissingChapter(chapters: ReadonlyArray<{
105
+ number: number;
106
+ }>, range: PlanRange): number | undefined;
107
+ /** The note `extendPlanIfNeeded` leaves when the author raises the number of chapters of a finished book. */
108
+ export declare function extensionNote(targetChapters: number): string;
109
+ /** Whether a revision note only asks for the book to be extended: planning the missing chapters is all it needs. */
110
+ export declare function isExtensionNote(note: string): boolean;
111
+ /** Where the file of a scene is, or would be: the path the plan knows, else the name the autopilot gives its scenes. */
112
+ export declare function sceneFile(chapter: PlannedChapter, scene: PlannedScene): string;
48
113
  /**
49
114
  * Deterministic, AI-free transitions: reconcile the plan with the files the author may have
50
115
  * changed, skip what is not needed, open review cycles and advance review rounds.
@@ -1 +1 @@
1
- {"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../src/autopilot/planner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAiB,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjI,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,eAAe,CAAC;IAC1B,iEAAiE;IACjE,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,cAAc,CAAC;IACtB,KAAK,EAAE,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