narrarium-engine 0.1.8 → 0.1.10
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 +409 -27
- package/dist/ai/budget.d.ts +18 -2
- package/dist/ai/budget.d.ts.map +1 -1
- package/dist/ai/budget.js +9 -2
- package/dist/ai/budget.js.map +1 -1
- package/dist/ai/catalog-fetch.d.ts.map +1 -1
- package/dist/ai/catalog-fetch.js +2 -1
- package/dist/ai/catalog-fetch.js.map +1 -1
- package/dist/ai/fetch-client.d.ts +13 -6
- package/dist/ai/fetch-client.d.ts.map +1 -1
- package/dist/ai/fetch-client.js +26 -3
- package/dist/ai/fetch-client.js.map +1 -1
- package/dist/ai/request.d.ts +1 -1
- package/dist/ai/request.d.ts.map +1 -1
- package/dist/ai/request.js +31 -5
- package/dist/ai/request.js.map +1 -1
- package/dist/ai/routing.d.ts.map +1 -1
- package/dist/ai/routing.js +1 -1
- package/dist/ai/routing.js.map +1 -1
- package/dist/ai/types.d.ts +29 -2
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/types.js +5 -2
- package/dist/ai/types.js.map +1 -1
- package/dist/autopilot/chapter-state.d.ts +19 -0
- package/dist/autopilot/chapter-state.d.ts.map +1 -0
- package/dist/autopilot/chapter-state.js +31 -0
- package/dist/autopilot/chapter-state.js.map +1 -0
- package/dist/autopilot/errors.d.ts +2 -1
- package/dist/autopilot/errors.d.ts.map +1 -1
- package/dist/autopilot/errors.js +17 -1
- package/dist/autopilot/errors.js.map +1 -1
- package/dist/autopilot/estimate-math.d.ts +19 -0
- package/dist/autopilot/estimate-math.d.ts.map +1 -0
- package/dist/autopilot/estimate-math.js +74 -0
- package/dist/autopilot/estimate-math.js.map +1 -0
- package/dist/autopilot/estimate-texts.d.ts +40 -0
- package/dist/autopilot/estimate-texts.d.ts.map +1 -0
- package/dist/autopilot/estimate-texts.js +130 -0
- package/dist/autopilot/estimate-texts.js.map +1 -0
- package/dist/autopilot/estimate.d.ts +303 -0
- package/dist/autopilot/estimate.d.ts.map +1 -0
- package/dist/autopilot/estimate.js +887 -0
- package/dist/autopilot/estimate.js.map +1 -0
- package/dist/autopilot/frozen.d.ts +166 -0
- package/dist/autopilot/frozen.d.ts.map +1 -0
- package/dist/autopilot/frozen.js +483 -0
- package/dist/autopilot/frozen.js.map +1 -0
- package/dist/autopilot/outline-change.d.ts +69 -0
- package/dist/autopilot/outline-change.d.ts.map +1 -0
- package/dist/autopilot/outline-change.js +42 -0
- package/dist/autopilot/outline-change.js.map +1 -0
- package/dist/autopilot/outline-check.d.ts +40 -0
- package/dist/autopilot/outline-check.d.ts.map +1 -0
- package/dist/autopilot/outline-check.js +84 -0
- package/dist/autopilot/outline-check.js.map +1 -0
- package/dist/autopilot/outline-compose.d.ts +203 -0
- package/dist/autopilot/outline-compose.d.ts.map +1 -0
- package/dist/autopilot/outline-compose.js +492 -0
- package/dist/autopilot/outline-compose.js.map +1 -0
- package/dist/autopilot/planner.d.ts +29 -1
- package/dist/autopilot/planner.d.ts.map +1 -1
- package/dist/autopilot/planner.js +78 -8
- package/dist/autopilot/planner.js.map +1 -1
- package/dist/autopilot/presets.d.ts +36 -0
- package/dist/autopilot/presets.d.ts.map +1 -0
- package/dist/autopilot/presets.js +54 -0
- package/dist/autopilot/presets.js.map +1 -0
- package/dist/autopilot/profile-check.d.ts +7 -4
- package/dist/autopilot/profile-check.d.ts.map +1 -1
- package/dist/autopilot/profile-check.js +9 -6
- package/dist/autopilot/profile-check.js.map +1 -1
- package/dist/autopilot/runner.d.ts +61 -7
- package/dist/autopilot/runner.d.ts.map +1 -1
- package/dist/autopilot/runner.js +313 -32
- package/dist/autopilot/runner.js.map +1 -1
- package/dist/autopilot/session.d.ts +50 -7
- package/dist/autopilot/session.d.ts.map +1 -1
- package/dist/autopilot/session.js +225 -10
- package/dist/autopilot/session.js.map +1 -1
- package/dist/autopilot/speed.d.ts +30 -0
- package/dist/autopilot/speed.d.ts.map +1 -0
- package/dist/autopilot/speed.js +71 -0
- package/dist/autopilot/speed.js.map +1 -0
- package/dist/autopilot/state.d.ts +21 -2
- package/dist/autopilot/state.d.ts.map +1 -1
- package/dist/autopilot/state.js +215 -3
- package/dist/autopilot/state.js.map +1 -1
- package/dist/autopilot/tasks.d.ts +14 -2
- package/dist/autopilot/tasks.d.ts.map +1 -1
- package/dist/autopilot/tasks.js +478 -34
- package/dist/autopilot/tasks.js.map +1 -1
- package/dist/autopilot/types.d.ts +238 -14
- package/dist/autopilot/types.d.ts.map +1 -1
- package/dist/autopilot/types.js +18 -2
- package/dist/autopilot/types.js.map +1 -1
- package/dist/book/context.d.ts +3 -0
- package/dist/book/context.d.ts.map +1 -1
- package/dist/book/context.js +7 -1
- package/dist/book/context.js.map +1 -1
- package/dist/book/freeze.d.ts +115 -0
- package/dist/book/freeze.d.ts.map +1 -0
- package/dist/book/freeze.js +286 -0
- package/dist/book/freeze.js.map +1 -0
- package/dist/book/outline.d.ts +245 -0
- package/dist/book/outline.d.ts.map +1 -0
- package/dist/book/outline.js +488 -0
- package/dist/book/outline.js.map +1 -0
- package/dist/book/paths.d.ts +18 -0
- package/dist/book/paths.d.ts.map +1 -1
- package/dist/book/paths.js +25 -0
- package/dist/book/paths.js.map +1 -1
- package/dist/book/snapshot.d.ts +25 -1
- package/dist/book/snapshot.d.ts.map +1 -1
- package/dist/book/snapshot.js +24 -4
- package/dist/book/snapshot.js.map +1 -1
- package/dist/director/opinion.d.ts +6 -0
- package/dist/director/opinion.d.ts.map +1 -1
- package/dist/director/opinion.js +4 -1
- package/dist/director/opinion.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/profiles/evaluation-style.d.ts +44 -0
- package/dist/profiles/evaluation-style.d.ts.map +1 -0
- package/dist/profiles/evaluation-style.js +152 -0
- package/dist/profiles/evaluation-style.js.map +1 -0
- package/dist/server/client.d.ts +92 -7
- package/dist/server/client.d.ts.map +1 -1
- package/dist/server/client.js +138 -11
- package/dist/server/client.js.map +1 -1
- package/dist/server/protocol.d.ts +226 -2
- package/dist/server/protocol.d.ts.map +1 -1
- package/dist/server/protocol.js +69 -0
- package/dist/server/protocol.js.map +1 -1
- package/dist/util/text.d.ts +6 -0
- package/dist/util/text.d.ts.map +1 -1
- package/dist/util/text.js +21 -0
- package/dist/util/text.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { inHands, isPlannedChapterWritten } from "./chapter-state.js";
|
|
2
|
+
import { FROZEN_EDITS_MODES } from "./types.js";
|
|
3
|
+
/** The outcomes in the order a host tells them: what asks, rewrites or reports first, then what waits, what plans again, what stays, and what does nothing. */
|
|
4
|
+
export const OUTLINE_CHANGE_OUTCOMES = ["ask", "auto", "notify", "later", "replan", "unplan", "stays", "none"];
|
|
5
|
+
/**
|
|
6
|
+
* What the autopilot does when the entry of chapter `number` changes (see `OutlineChangeOutcome`), given the state of its autopilot: `options.frozenEdits`, the
|
|
7
|
+
* chapter of the plan with that number, and the work it has in its hands. Pure; `null` for the state of a book that has no autopilot says `none`.
|
|
8
|
+
*/
|
|
9
|
+
export function changeOfWritten(state, number, options = {}) {
|
|
10
|
+
const chapter = state?.plan?.chapters.find((candidate) => candidate.number === number);
|
|
11
|
+
if (!state || !chapter)
|
|
12
|
+
return "none";
|
|
13
|
+
const written = isPlannedChapterWritten(chapter);
|
|
14
|
+
if (options.entry === "removed") {
|
|
15
|
+
if (options.outlineEmpty || !chapter.outlineDigest)
|
|
16
|
+
return "none";
|
|
17
|
+
return written ? "stays" : "unplan";
|
|
18
|
+
}
|
|
19
|
+
if (!written)
|
|
20
|
+
return "replan";
|
|
21
|
+
if (!chapter.outlineDigest)
|
|
22
|
+
return "none";
|
|
23
|
+
if (inHands({ revision: state.revision ?? null, pendingReviews: state.pendingReviews }, chapter))
|
|
24
|
+
return "later";
|
|
25
|
+
const mode = FROZEN_EDITS_MODES.find((candidate) => candidate === state.options?.frozenEdits) ?? "ask";
|
|
26
|
+
return mode === "auto" && chapter.imported === true ? "notify" : mode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The chapters whose entry a series changed or deleted, grouped by what the autopilot does about each (`changeOfWritten`), in the order of
|
|
30
|
+
* `OUTLINE_CHANGE_OUTCOMES`: a host says one sentence for each group. A chapter whose entry changed and another entry deleted in the same series is in two groups.
|
|
31
|
+
*/
|
|
32
|
+
export function groupOutlineChanges(state, changes, options = {}) {
|
|
33
|
+
const groups = new Map();
|
|
34
|
+
for (const change of changes) {
|
|
35
|
+
const outcome = changeOfWritten(state, change.number, { ...(change.entry ? { entry: change.entry } : {}), ...(options.outlineEmpty ? { outlineEmpty: true } : {}) });
|
|
36
|
+
const numbers = groups.get(outcome) ?? new Set();
|
|
37
|
+
numbers.add(change.number);
|
|
38
|
+
groups.set(outcome, numbers);
|
|
39
|
+
}
|
|
40
|
+
return OUTLINE_CHANGE_OUTCOMES.filter((outcome) => groups.has(outcome)).map((outcome) => ({ outcome, numbers: [...groups.get(outcome)].sort((left, right) => left - right) }));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=outline-change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline-change.js","sourceRoot":"","sources":["../../src/autopilot/outline-change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAkE,MAAM,YAAY,CAAC;AA4BhH,+JAA+J;AAC/J,MAAM,CAAC,MAAM,uBAAuB,GAAoC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAmBhJ;;;GAGG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,EAAqC,CAAC;IAC5D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrK,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAClL,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { OutlineReader } from "../book/outline.js";
|
|
2
|
+
import type { PlanNote } from "./planner.js";
|
|
3
|
+
import type { AutopilotState } from "./types.js";
|
|
4
|
+
export { isPlannedChapterWritten } from "./chapter-state.js";
|
|
5
|
+
/**
|
|
6
|
+
* The new outline entry of a chapter already closed (`done`), which the author changed since the plan followed it: the author decides
|
|
7
|
+
* what to do with it, as with a change of a frozen chapter (`frozenEdits`, see `autopilot/frozen.ts`).
|
|
8
|
+
*/
|
|
9
|
+
export interface OutlineWrittenChange {
|
|
10
|
+
number: number;
|
|
11
|
+
/** The digest of the new entry (`outlineEntryDigest`): what the plan keeps once the author decided. */
|
|
12
|
+
digest: string;
|
|
13
|
+
title: string;
|
|
14
|
+
body: string;
|
|
15
|
+
}
|
|
16
|
+
/** What the outline says of the plan before a step: see `outlinePlanStatus`. */
|
|
17
|
+
export interface OutlinePlanStatus {
|
|
18
|
+
/** The chapter about to be started whose entry changed (`changed`) or was deleted (`removed`) since the plan followed it. */
|
|
19
|
+
changed: Map<number, "changed" | "removed">;
|
|
20
|
+
/** The chapters already closed whose entry the author changed (not deleted, and readable): the author decides about each. */
|
|
21
|
+
written: Map<number, OutlineWrittenChange>;
|
|
22
|
+
/**
|
|
23
|
+
* What the author should know: the entry of a written chapter that was deleted, or that changed while the chapter is still being
|
|
24
|
+
* written, an entry that cannot be read. Each is said once a run.
|
|
25
|
+
*/
|
|
26
|
+
notes: PlanNote[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The outline against an approved plan, before a step. The chapter about to be started, with nothing written, is planned again
|
|
30
|
+
* when its entry no longer matches the digest the plan kept (`PlannedChapter.outlineDigest`: the author changed it, or wrote one
|
|
31
|
+
* for a chapter that had none), and leaves the plan when the entry it came from was deleted (never when the whole outline is gone:
|
|
32
|
+
* deleting `outline/` is not deleting every chapter). An entry the autopilot wrote and nobody touched is never followed by a chapter
|
|
33
|
+
* whose plan does not remember its entry (a state saved by an engine that did not know the outline). An entry that cannot be read
|
|
34
|
+
* changes nothing until the author corrects it. A chapter already closed whose entry changed is never touched here: it is in `written`,
|
|
35
|
+
* and the author decides about it (it is asked, reviewed or said, as `frozenEdits` says). One still being written is told once a run,
|
|
36
|
+
* and decided about once it is closed. Only the entries of the chapter about to be started and of the chapters written are read,
|
|
37
|
+
* through the run's cache.
|
|
38
|
+
*/
|
|
39
|
+
export declare function outlinePlanStatus(outline: OutlineReader, state: AutopilotState, language: string): Promise<OutlinePlanStatus>;
|
|
40
|
+
//# sourceMappingURL=outline-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline-check.d.ts","sourceRoot":"","sources":["../../src/autopilot/outline-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,uGAAuG;IACvG,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,6HAA6H;IAC7H,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;IAC5C,6HAA6H;IAC7H,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC3C;;;OAGG;IACH,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAyDnI"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { isItalian } from "../util/text.js";
|
|
2
|
+
import { isPlannedChapterWritten } from "./chapter-state.js";
|
|
3
|
+
// Whether a chapter counts as written is in `chapter-state.ts`, which has no import but types: the rule that tells the author what happens when an entry changes
|
|
4
|
+
// (`outline-change.ts`) needs it too, and must not carry the rest of this module with it. The export stays where it was.
|
|
5
|
+
export { isPlannedChapterWritten } from "./chapter-state.js";
|
|
6
|
+
function text(language, en, it) {
|
|
7
|
+
return isItalian(language) ? it : en;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The outline against an approved plan, before a step. The chapter about to be started, with nothing written, is planned again
|
|
11
|
+
* when its entry no longer matches the digest the plan kept (`PlannedChapter.outlineDigest`: the author changed it, or wrote one
|
|
12
|
+
* for a chapter that had none), and leaves the plan when the entry it came from was deleted (never when the whole outline is gone:
|
|
13
|
+
* deleting `outline/` is not deleting every chapter). An entry the autopilot wrote and nobody touched is never followed by a chapter
|
|
14
|
+
* whose plan does not remember its entry (a state saved by an engine that did not know the outline). An entry that cannot be read
|
|
15
|
+
* changes nothing until the author corrects it. A chapter already closed whose entry changed is never touched here: it is in `written`,
|
|
16
|
+
* and the author decides about it (it is asked, reviewed or said, as `frozenEdits` says). One still being written is told once a run,
|
|
17
|
+
* and decided about once it is closed. Only the entries of the chapter about to be started and of the chapters written are read,
|
|
18
|
+
* through the run's cache.
|
|
19
|
+
*/
|
|
20
|
+
export async function outlinePlanStatus(outline, state, language) {
|
|
21
|
+
const changed = new Map();
|
|
22
|
+
const written = new Map();
|
|
23
|
+
const notes = [];
|
|
24
|
+
const plan = state.plan;
|
|
25
|
+
if (!plan?.approved)
|
|
26
|
+
return { changed, written, notes };
|
|
27
|
+
const hasEntries = outline.index.chapters.length > 0;
|
|
28
|
+
const current = plan.chapters.find((chapter) => chapter.status !== "done");
|
|
29
|
+
if (current && !isPlannedChapterWritten(current)) {
|
|
30
|
+
const entry = await outline.chapter(current.number);
|
|
31
|
+
if (entry?.unreadable) {
|
|
32
|
+
notes.push({
|
|
33
|
+
key: `outline-unreadable:${current.number}:${entry.contentDigest}`,
|
|
34
|
+
tone: "warning",
|
|
35
|
+
code: "outlineWarnings",
|
|
36
|
+
chapterNumber: current.number,
|
|
37
|
+
title: text(language, `The outline of chapter ${current.number} cannot be read: the plan keeps what it had`, `La Scaletta del capitolo ${current.number} non si legge: il piano resta com'era`),
|
|
38
|
+
detail: outline.warnings().filter((warning) => warning.path === entry.path).map((warning) => warning.message).join("\n") || entry.path,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else if (entry && entry.contentDigest !== current.outlineDigest && !(entry.intact && !current.outlineDigest)) {
|
|
42
|
+
// An entry the autopilot wrote and nobody touched, for a chapter whose plan does not remember its entry (a state saved by an
|
|
43
|
+
// engine that did not know the outline), is the chapter's own: only an entry of the author is followed.
|
|
44
|
+
changed.set(current.number, "changed");
|
|
45
|
+
}
|
|
46
|
+
else if (!entry && current.outlineDigest && hasEntries)
|
|
47
|
+
changed.set(current.number, "removed");
|
|
48
|
+
}
|
|
49
|
+
for (const chapter of plan.chapters) {
|
|
50
|
+
if (!chapter.outlineDigest || !isPlannedChapterWritten(chapter))
|
|
51
|
+
continue;
|
|
52
|
+
const entry = await outline.chapter(chapter.number);
|
|
53
|
+
if (entry?.contentDigest === chapter.outlineDigest || (!entry && !hasEntries))
|
|
54
|
+
continue;
|
|
55
|
+
if (entry?.unreadable) {
|
|
56
|
+
notes.push({
|
|
57
|
+
key: `outline-unreadable:${chapter.number}:${entry.contentDigest}`,
|
|
58
|
+
tone: "warning",
|
|
59
|
+
code: "outlineWarnings",
|
|
60
|
+
chapterNumber: chapter.number,
|
|
61
|
+
title: text(language, `The outline of chapter ${chapter.number} cannot be read: nothing changes until you correct it`, `La Scaletta del capitolo ${chapter.number} non si legge: non cambia nulla finché non la correggi`),
|
|
62
|
+
detail: outline.warnings().filter((warning) => warning.path === entry.path).map((warning) => warning.message).join("\n") || entry.path,
|
|
63
|
+
});
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (entry && chapter.status === "done") {
|
|
67
|
+
written.set(chapter.number, { number: chapter.number, digest: entry.contentDigest, title: entry.title, body: entry.body });
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
notes.push({
|
|
71
|
+
key: `outline-written:${chapter.number}:${entry?.contentDigest ?? "removed"}`,
|
|
72
|
+
tone: "info",
|
|
73
|
+
// Two things, each with its code: the entry of a chapter still being written changed (it is decided once the chapter is closed), or the
|
|
74
|
+
// entry of a written chapter is gone (the chapter stays in the book). A closed chapter whose entry changed is in `written`.
|
|
75
|
+
code: entry ? "outlineChangedWhileWriting" : "outlineRemovedWritten",
|
|
76
|
+
chapterNumber: chapter.number,
|
|
77
|
+
title: entry
|
|
78
|
+
? text(language, `The outline of chapter ${chapter.number} changed while the chapter is being written: you will decide what to do once it is closed`, `La Scaletta del capitolo ${chapter.number} è cambiata mentre il capitolo è in scrittura: deciderai cosa fare quando sarà chiuso`)
|
|
79
|
+
: text(language, `Chapter ${chapter.number} is no longer in the outline, but it is already written: it stays in the book`, `Il capitolo ${chapter.number} non è più nella Scaletta, ma è già scritto: resta nel libro`),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return { changed, written, notes };
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=outline-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline-check.js","sourceRoot":"","sources":["../../src/autopilot/outline-check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAI7D,iKAAiK;AACjK,yHAAyH;AACzH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AA2B7D,SAAS,IAAI,CAAC,QAAgB,EAAE,EAAU,EAAE,EAAU;IACpD,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAsB,EAAE,KAAqB,EAAE,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AC;AACrC,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { type OutlineEdit, type OutlineIndex, type OutlineWarning } from "../book/outline.js";
|
|
2
|
+
import type { BookFileChange, BookFileContent } from "../book/store.js";
|
|
3
|
+
/**
|
|
4
|
+
* A series of edits of the outline (the Scaletta) as the files of one commit. One function for every host that makes the author's edits in a row: the web app's Outline
|
|
5
|
+
* page and Copilot, the personal server's MCP tool.
|
|
6
|
+
*
|
|
7
|
+
* The engine makes every edit (`outlineChanges`): the numbering, the format, the author as the writer of every entry it writes. What it leaves to its caller, and this
|
|
8
|
+
* does:
|
|
9
|
+
*
|
|
10
|
+
* - Several edits in a row. Each is made on the outline the one before left (a `number` is the number the chapter has at that point of the series), and the files are
|
|
11
|
+
* written once, with their final text; a file that comes back to what it was is left alone.
|
|
12
|
+
* - The identity of every entry, followed through the renumbering. A client reads an entry and gets the hash of its file; the text of that entry is replaced, or the entry
|
|
13
|
+
* removed, only if the hash is still the file's. In a series the entry is no longer where it was, so the hash that was read is checked against the entry it was of,
|
|
14
|
+
* wherever the edits before have put it (`OutlineSeriesEdit.expectedHash`).
|
|
15
|
+
* - Only the files that are needed. An outline has no maximum, and an insert at its head renames every entry: but an update of one entry reads one file. An entry is known
|
|
16
|
+
* by its path and hash (`OutlineIndex`, from the list of the book's files) and read only when an edit is about to rewrite it.
|
|
17
|
+
* - Limits a caller chooses: how many edits a series has, how many files it may change (checked as the series goes).
|
|
18
|
+
*
|
|
19
|
+
* Pure: nothing is written and no file is read but through `OutlineSource.read`. The files come out as `BookFileChange`s, each expecting the file as it was read, and a commit
|
|
20
|
+
* through a store refuses the lot if any of them changed since.
|
|
21
|
+
*/
|
|
22
|
+
/** Edits one series may make, unless the caller says another number. */
|
|
23
|
+
export declare const OUTLINE_COMPOSE_MAX_EDITS = 50;
|
|
24
|
+
/** Files one series may change, unless the caller says another number: an insert at the head of a long outline renames all of it, and that is for a place where the author sees it and can undo it. */
|
|
25
|
+
export declare const OUTLINE_COMPOSE_MAX_FILES = 1000;
|
|
26
|
+
/**
|
|
27
|
+
* An edit of a series: the engine's own (`OutlineEdit`), and for the ones that replace what someone read (`update`, `remove`, `book`) the hash of the file as it was
|
|
28
|
+
* read. For `update` and `remove` it is the hash of the entry as the series found it, wherever the edits before it have put the entry; for `book`, of `outline/book.md`.
|
|
29
|
+
* An entry that the series made has no hash.
|
|
30
|
+
*/
|
|
31
|
+
export type OutlineSeriesEdit = Exclude<OutlineEdit, {
|
|
32
|
+
kind: "remove" | "update" | "book";
|
|
33
|
+
}> | (Extract<OutlineEdit, {
|
|
34
|
+
kind: "remove" | "update" | "book";
|
|
35
|
+
}> & {
|
|
36
|
+
expectedHash?: string;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Whether an edit replaces what someone must have read: the text of an entry that exists, an entry that is deleted, the description of the book. The rule of a caller that
|
|
40
|
+
* never overwrites what changed meanwhile (`OutlineComposeOptions.requireHash`): a title or a ghostwriter changes no text, and a new entry has no file to compare.
|
|
41
|
+
*/
|
|
42
|
+
export declare function outlineEditNeedsHash(edit: OutlineSeriesEdit): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Where the entry numbered `number` is after `edit`, as the engine places the files; `null` when the edit deletes it. The one rule of the renumbering: the series follows
|
|
45
|
+
* the entries with it, and a page that keeps what the author typed in an entry that moved with it.
|
|
46
|
+
*/
|
|
47
|
+
export declare function remapOutlineNumber(edit: OutlineEdit, number: number): number | null;
|
|
48
|
+
/** Where the outline of a book is: its files known by name and hash, and the way to read one. */
|
|
49
|
+
export interface OutlineSource {
|
|
50
|
+
/** The entries and the description as the list of the book's files has them (`BookSnapshot.outline`, or `outlineIndex(files)`): paths and hashes, nothing read. */
|
|
51
|
+
index: OutlineIndex;
|
|
52
|
+
/**
|
|
53
|
+
* The paths of the book's files (any: the ones that are not the outline's are left out). The index has one file for a chapter; a second file for it, or a file named as no
|
|
54
|
+
* entry is named (`7.md`, `0007.md`), can only be seen from the list, and an outline that has one is read whole, and read again after each edit, as the engine reads it
|
|
55
|
+
* (what an edit frees is taken by the file that waited). Without the list the index is all there is.
|
|
56
|
+
*/
|
|
57
|
+
paths?: Iterable<string>;
|
|
58
|
+
/** `null` for a file that is gone (it changed since it was listed). */
|
|
59
|
+
read(path: string): Promise<BookFileContent | null>;
|
|
60
|
+
}
|
|
61
|
+
export interface OutlineComposeOptions {
|
|
62
|
+
/** The slugs of the book's ghostwriters (without them they are not checked). */
|
|
63
|
+
ghostwriters?: readonly string[];
|
|
64
|
+
/** Edits a series may have (default `OUTLINE_COMPOSE_MAX_EDITS`); `Infinity` for none. */
|
|
65
|
+
maxEdits?: number;
|
|
66
|
+
/** Files a series may change at any moment of it (default `OUTLINE_COMPOSE_MAX_FILES`); `Infinity` for none. */
|
|
67
|
+
maxFiles?: number;
|
|
68
|
+
/**
|
|
69
|
+
* An edit of a chapter that has no entry (`move`, `remove`): `throw` (the default) refuses the whole series, `warn` is the engine's own answer: that edit changes nothing
|
|
70
|
+
* and a `not-found` warning says so, and the others are made.
|
|
71
|
+
*/
|
|
72
|
+
missing?: "throw" | "warn";
|
|
73
|
+
/** Which edits must carry the hash of what they replace (`outlineEditNeedsHash` is the rule of a caller that never overwrites what changed meanwhile). None by default; a hash that is given is always checked. */
|
|
74
|
+
requireHash?: (edit: OutlineSeriesEdit) => boolean;
|
|
75
|
+
}
|
|
76
|
+
export type OutlineComposeErrorCode = "not_found" | "expected_hash_required" | "conflict" | "too_many_edits" | "too_many_files" | "invalid_edit";
|
|
77
|
+
/** Why an edit was a conflict: its entry is not the one that was read (`changed`), is gone (`removed`), was made by the series (`made-in-series`), or a file of the outline is gone (`gone`). */
|
|
78
|
+
export type OutlineConflictReason = "changed" | "removed" | "made-in-series" | "gone";
|
|
79
|
+
export interface OutlineComposeErrorDetails {
|
|
80
|
+
/** The edit, by its place in the series (from 0), and the edit itself. */
|
|
81
|
+
index?: number;
|
|
82
|
+
edit?: unknown;
|
|
83
|
+
/** The chapter (the number it has at that point of the series) or the description of the book that the error is about, and the file. */
|
|
84
|
+
number?: number;
|
|
85
|
+
path?: string;
|
|
86
|
+
subject?: "chapter" | "book";
|
|
87
|
+
reason?: OutlineConflictReason;
|
|
88
|
+
/** `too_many_edits` and `too_many_files`: how many there were (at least, for the files), and how many are allowed. */
|
|
89
|
+
count?: number;
|
|
90
|
+
limit?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A series that cannot be made: nothing was written, for nothing is written here. The `code` is one of `OutlineComposeErrorCode`, and the details say which edit and
|
|
94
|
+
* which file, so that a host words it in its own way (the message is English, and names no tool).
|
|
95
|
+
*/
|
|
96
|
+
export declare class OutlineComposeError extends Error implements OutlineComposeErrorDetails {
|
|
97
|
+
readonly code: OutlineComposeErrorCode;
|
|
98
|
+
readonly index?: number;
|
|
99
|
+
readonly edit?: unknown;
|
|
100
|
+
readonly number?: number;
|
|
101
|
+
readonly path?: string;
|
|
102
|
+
readonly subject?: "chapter" | "book";
|
|
103
|
+
readonly reason?: OutlineConflictReason;
|
|
104
|
+
readonly count?: number;
|
|
105
|
+
readonly limit?: number;
|
|
106
|
+
constructor(code: OutlineComposeErrorCode, message: string, details?: OutlineComposeErrorDetails);
|
|
107
|
+
}
|
|
108
|
+
/** What an edit of a series did, in the order of the series (`ComposedOutlineEdits.steps`), for a host that tells it in its words. */
|
|
109
|
+
export type OutlineSeriesStep = {
|
|
110
|
+
kind: "append";
|
|
111
|
+
number: number;
|
|
112
|
+
} | {
|
|
113
|
+
kind: "insert";
|
|
114
|
+
at: number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* `unchanged`: the entry is where it is asked to go. `missing`: the chapter has no entry (`missing: "warn"`): nothing was done. `origin`: the number the entry had when the
|
|
118
|
+
* series began (absent for an entry the series made, and for one that is not there), so that a host that names the entries names the right one though the numbers shift.
|
|
119
|
+
*/
|
|
120
|
+
| {
|
|
121
|
+
kind: "move";
|
|
122
|
+
from: number;
|
|
123
|
+
to: number;
|
|
124
|
+
unchanged: boolean;
|
|
125
|
+
origin?: number;
|
|
126
|
+
missing?: true;
|
|
127
|
+
} | {
|
|
128
|
+
kind: "remove";
|
|
129
|
+
number: number;
|
|
130
|
+
renumber: boolean;
|
|
131
|
+
origin?: number;
|
|
132
|
+
missing?: true;
|
|
133
|
+
}
|
|
134
|
+
/** `created`: the chapter had no entry. `fields`: what the edit set. */
|
|
135
|
+
| {
|
|
136
|
+
kind: "update";
|
|
137
|
+
number: number;
|
|
138
|
+
created: boolean;
|
|
139
|
+
fields: Array<"title" | "body" | "ghostwriter">;
|
|
140
|
+
origin?: number;
|
|
141
|
+
} | {
|
|
142
|
+
kind: "book";
|
|
143
|
+
created: boolean;
|
|
144
|
+
fields: Array<"title" | "body">;
|
|
145
|
+
};
|
|
146
|
+
/** Entries that moved together: `count` entries from chapter `from` are now from chapter `to`. */
|
|
147
|
+
export interface OutlineMovedRun {
|
|
148
|
+
from: number;
|
|
149
|
+
to: number;
|
|
150
|
+
count: number;
|
|
151
|
+
}
|
|
152
|
+
/** An entry the series did something to, with the hash its file had when the series began: the table a caller that checks hashes reads (the series itself checks the ones it is given). */
|
|
153
|
+
export interface OutlineIdentity {
|
|
154
|
+
/** The number the entry had when the series began, and the hash of its file then. */
|
|
155
|
+
number: number;
|
|
156
|
+
hash: string;
|
|
157
|
+
/** Where it is when the series is over; `null`: it was deleted. */
|
|
158
|
+
now: number | null;
|
|
159
|
+
/** An edit set its title, its text or its ghostwriter. */
|
|
160
|
+
updated: boolean;
|
|
161
|
+
}
|
|
162
|
+
export interface ComposedOutlineEdits {
|
|
163
|
+
/** The files of one commit, in order of path, each expecting the file as it was read (`null`: it did not exist). Empty when the series changes nothing. */
|
|
164
|
+
changes: BookFileChange[];
|
|
165
|
+
/** What the engine says, told once; of the gaps, only the one the outline ends with, and only when the series made or changed it. */
|
|
166
|
+
warnings: OutlineWarning[];
|
|
167
|
+
/** One for each edit, in order. */
|
|
168
|
+
steps: OutlineSeriesStep[];
|
|
169
|
+
/** The numbers, when the series is over, of the entries it made (they did not exist) and of the entries that existed and whose title, text or ghostwriter an edit set. */
|
|
170
|
+
created: number[];
|
|
171
|
+
updated: number[];
|
|
172
|
+
/** The numbers, when the series began, of the entries it deleted. */
|
|
173
|
+
removed: number[];
|
|
174
|
+
/** Entries that changed number. */
|
|
175
|
+
moved: OutlineMovedRun[];
|
|
176
|
+
/** The chapters whose entry says something else when the series is over than when it began (an entry that is new for the number counts), and the ones that have no entry now though they had one. */
|
|
177
|
+
changed: number[];
|
|
178
|
+
gone: number[];
|
|
179
|
+
/** How many entries the outline has when the series is over. */
|
|
180
|
+
chapters: number;
|
|
181
|
+
/** Each entry it made or changed, with the hash of its file now. */
|
|
182
|
+
entries: Array<{
|
|
183
|
+
number: number;
|
|
184
|
+
path: string;
|
|
185
|
+
hash: string;
|
|
186
|
+
}>;
|
|
187
|
+
/** The description of the book, when the series wrote it. */
|
|
188
|
+
book?: {
|
|
189
|
+
path: string;
|
|
190
|
+
hash: string;
|
|
191
|
+
created: boolean;
|
|
192
|
+
};
|
|
193
|
+
/** The entries the series moved, deleted or changed, with their hashes when it began. */
|
|
194
|
+
identities: OutlineIdentity[];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Make `edits` on the outline `source` describes, in order, and answer the files of one commit. Throws an `OutlineComposeError` for an edit that cannot be made
|
|
198
|
+
* (`not_found`, `invalid_edit`), one whose hash is missing where the caller's rule asks for one (`expected_hash_required`) or is not the entry's (`conflict`), a file that is
|
|
199
|
+
* gone when it is read (`conflict`), and a series that is too long or would change too many files (`too_many_edits`, `too_many_files`). Nothing was written then, for nothing
|
|
200
|
+
* is written here.
|
|
201
|
+
*/
|
|
202
|
+
export declare function composeOutlineEdits(source: OutlineSource, edits: readonly OutlineSeriesEdit[], options?: OutlineComposeOptions): Promise<ComposedOutlineEdits>;
|
|
203
|
+
//# sourceMappingURL=outline-compose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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