rpg-engine 0.19.1 → 0.20.0
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 +9 -6
- package/dist/campaign/create-campaign.js +2 -2
- package/dist/campaign/find-campaign.d.ts +4 -0
- package/dist/campaign/find-campaign.js +5 -1
- package/dist/campaign/host-files.js +22 -0
- package/dist/campaign/index.d.ts +2 -2
- package/dist/campaign/index.js +2 -2
- package/dist/campaign/last-choices.d.ts +10 -4
- package/dist/campaign/last-choices.js +43 -17
- package/dist/campaign/settings.d.ts +10 -2
- package/dist/campaign/settings.js +30 -6
- package/dist/chats/chat.d.ts +33 -0
- package/dist/chats/chat.js +50 -0
- package/dist/chats/claude-code.d.ts +5 -0
- package/dist/chats/claude-code.js +39 -0
- package/dist/chats/codex.d.ts +3 -0
- package/dist/chats/codex.js +42 -0
- package/dist/chats/index.d.ts +5 -0
- package/dist/chats/index.js +12 -0
- package/dist/chats/keep.d.ts +10 -0
- package/dist/chats/keep.js +50 -0
- package/dist/chats/read.d.ts +8 -0
- package/dist/chats/read.js +46 -0
- package/dist/cli/cli.js +6 -1
- package/dist/cli/command-line.js +3 -2
- package/dist/commands/book.d.ts +55 -0
- package/dist/commands/book.js +105 -0
- package/dist/commands/chats.d.ts +38 -0
- package/dist/commands/chats.js +93 -0
- package/dist/commands/config/config.js +1 -1
- package/dist/commands/config/dashboard.d.ts +8 -1
- package/dist/commands/config/dashboard.js +63 -15
- package/dist/commands/config/words.d.ts +1 -1
- package/dist/commands/config/words.js +17 -4
- package/dist/commands/find.js +1 -1
- package/dist/commands/image.d.ts +9 -0
- package/dist/commands/image.js +95 -18
- package/dist/commands/index.js +4 -0
- package/dist/commands/init.js +3 -3
- package/dist/commands/scene/close.d.ts +2 -0
- package/dist/commands/scene/close.js +13 -2
- package/dist/commands/scene/result.d.ts +2 -0
- package/dist/commands/scene/scene.d.ts +2 -0
- package/dist/commands/shared/campaign/book.d.ts +29 -0
- package/dist/commands/shared/campaign/book.js +95 -0
- package/dist/commands/shared/campaign/chats.d.ts +11 -0
- package/dist/commands/shared/campaign/chats.js +29 -0
- package/dist/commands/shared/campaign/images.js +7 -1
- package/dist/commands/shared/campaign/mode.js +3 -1
- package/dist/commands/shared/campaign/saves.js +13 -5
- package/dist/commands/shared/sheet/sheet.d.ts +7 -0
- package/dist/commands/shared/sheet/sheet.js +27 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +4 -0
- package/dist/commands/view/page.js +4 -3
- package/dist/commands/view/result.d.ts +2 -0
- package/dist/commands/view/view.d.ts +1 -0
- package/dist/commands/view/view.js +4 -0
- package/dist/core/consents.d.ts +2 -2
- package/dist/core/consents.js +3 -3
- package/dist/core/context.d.ts +38 -2
- package/dist/core/download.js +1 -1
- package/dist/dashboard/acts/names.js +10 -5
- package/dist/dashboard/acts/sending.js +5 -2
- package/dist/dashboard/acts/sheet.js +66 -15
- package/dist/dashboard/api.js +3 -3
- package/dist/dashboard/app.js +2 -2
- package/dist/dashboard/guide/ar.md +11 -10
- package/dist/dashboard/guide/cs.md +10 -9
- package/dist/dashboard/guide/da.md +12 -11
- package/dist/dashboard/guide/de.md +12 -11
- package/dist/dashboard/guide/el.md +12 -11
- package/dist/dashboard/guide/en.md +9 -8
- package/dist/dashboard/guide/es.md +10 -9
- package/dist/dashboard/guide/fi.md +10 -9
- package/dist/dashboard/guide/fr.md +16 -15
- package/dist/dashboard/guide/he.md +11 -10
- package/dist/dashboard/guide/hi.md +10 -9
- package/dist/dashboard/guide/hu.md +14 -13
- package/dist/dashboard/guide/is.md +10 -9
- package/dist/dashboard/guide/it.md +13 -12
- package/dist/dashboard/guide/ja.md +10 -9
- package/dist/dashboard/guide/ko.md +11 -10
- package/dist/dashboard/guide/nb.md +12 -11
- package/dist/dashboard/guide/nl.md +10 -9
- package/dist/dashboard/guide/pl.md +11 -10
- package/dist/dashboard/guide/pt.md +12 -11
- package/dist/dashboard/guide/ro.md +10 -9
- package/dist/dashboard/guide/ru.md +12 -11
- package/dist/dashboard/guide/sv.md +10 -9
- package/dist/dashboard/guide/tr.md +13 -12
- package/dist/dashboard/guide/uk.md +13 -12
- package/dist/dashboard/guide/zh.md +11 -10
- package/dist/dashboard/i18n/ar.json +31 -5
- package/dist/dashboard/i18n/cs.json +31 -5
- package/dist/dashboard/i18n/da.json +31 -5
- package/dist/dashboard/i18n/de.json +31 -5
- package/dist/dashboard/i18n/el.json +31 -5
- package/dist/dashboard/i18n/es.json +31 -5
- package/dist/dashboard/i18n/fi.json +31 -5
- package/dist/dashboard/i18n/fr.json +31 -5
- package/dist/dashboard/i18n/he.json +31 -5
- package/dist/dashboard/i18n/hi.json +31 -5
- package/dist/dashboard/i18n/hu.json +31 -5
- package/dist/dashboard/i18n/is.json +31 -5
- package/dist/dashboard/i18n/it.json +32 -6
- package/dist/dashboard/i18n/ja.json +31 -5
- package/dist/dashboard/i18n/ko.json +31 -5
- package/dist/dashboard/i18n/nb.json +31 -5
- package/dist/dashboard/i18n/nl.json +31 -5
- package/dist/dashboard/i18n/pl.json +31 -5
- package/dist/dashboard/i18n/pt.json +31 -5
- package/dist/dashboard/i18n/ro.json +31 -5
- package/dist/dashboard/i18n/ru.json +31 -5
- package/dist/dashboard/i18n/sv.json +31 -5
- package/dist/dashboard/i18n/tr.json +31 -5
- package/dist/dashboard/i18n/uk.json +31 -5
- package/dist/dashboard/i18n/zh.json +31 -5
- package/dist/dashboard/journal/book.js +106 -0
- package/dist/dashboard/journal/journal.js +9 -8
- package/dist/dashboard/parts/labels.js +6 -0
- package/dist/dashboard/parts/widgets.js +1 -1
- package/dist/dashboard/place/view.js +1 -1
- package/dist/dashboard/settings/settings.js +10 -4
- package/dist/dashboard/settings/setup.js +5 -3
- package/dist/dashboard/sheet/sheet.js +8 -5
- package/dist/dashboard/style.css +459 -96
- package/dist/dashboard/world/calendar.js +1 -1
- package/dist/dashboard/world/lore.js +1 -1
- package/dist/helpers/briefs.d.ts +5 -0
- package/dist/helpers/briefs.js +8 -0
- package/dist/helpers/chosen.d.ts +8 -2
- package/dist/helpers/chosen.js +110 -6
- package/dist/helpers/codex.js +2 -1
- package/dist/helpers/index.d.ts +2 -2
- package/dist/helpers/index.js +2 -2
- package/dist/images/images.d.ts +2 -0
- package/dist/images/images.js +16 -2
- package/dist/images/index.d.ts +1 -1
- package/dist/images/index.js +1 -1
- package/dist/server/approver.d.ts +6 -0
- package/dist/server/approver.js +28 -0
- package/dist/server/chats.d.ts +3 -0
- package/dist/server/chats.js +27 -0
- package/dist/server/dashboard/news.js +36 -5
- package/dist/server/mcp.js +37 -6
- package/dist/server/player-acts.d.ts +7 -2
- package/dist/server/player-acts.js +10 -3
- package/instructions/start.md +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// What each player setting and setup question is, in the player's words
|
|
2
|
-
import { characterWays, companionWays, customLevel, diceWays, difficulties, efforts, lengths, lethalities, listLimits, masterRollWays, mentorWays, pictureWays, preparations, proseWays, rigors, saveModes, storyWays, styleTextLengths, unitSystems, voiceWays, } from "../../campaign/index.js";
|
|
2
|
+
import { characterWays, companionWays, customLevel, diceWays, difficulties, efforts, lengths, lethalities, listLimits, masterRollWays, mentorWays, pictureMakers, pictureWays, preparations, proseWays, rigors, saveModes, storyWays, styleTextLengths, unitSystems, voiceWays, } from "../../campaign/index.js";
|
|
3
3
|
export const styleSettingNames = ["prose", "story", "author", "style"];
|
|
4
4
|
// The game time between sessions the dashboard offers (D-133): stopped, a day of the game for each real week, or as real time.
|
|
5
5
|
export const betweenSessionsWays = ["stops", "1d per 7d", "1d per 1d"];
|
|
@@ -23,6 +23,7 @@ export const playerSettingNames = [
|
|
|
23
23
|
"units",
|
|
24
24
|
"voices",
|
|
25
25
|
"pictures",
|
|
26
|
+
"pictures-by",
|
|
26
27
|
"effort",
|
|
27
28
|
"lines",
|
|
28
29
|
"veils",
|
|
@@ -48,7 +49,7 @@ export const playerWords = {
|
|
|
48
49
|
saves: {
|
|
49
50
|
about: "when the game may go back",
|
|
50
51
|
values: saveModes,
|
|
51
|
-
means: { permadeath: "never: what happens stays; only starting the campaign over", checkpoint: "
|
|
52
|
+
means: { permadeath: "never: what happens stays; only starting the campaign over", checkpoint: "only when all is lost: back to the end of the last scene", free: "back to any save, and a save whenever you ask" },
|
|
52
53
|
},
|
|
53
54
|
rigor: {
|
|
54
55
|
about: "how closely food, light, fatigue and the like follow the rules",
|
|
@@ -118,7 +119,7 @@ export const playerWords = {
|
|
|
118
119
|
most: styleTextLengths.style,
|
|
119
120
|
cleared: "their own words on how you write no longer hold",
|
|
120
121
|
},
|
|
121
|
-
dice: { about: "who rolls your character's dice", values: diceWays, means: { digital: "the
|
|
122
|
+
dice: { about: "who rolls your character's dice", values: diceWays, means: { digital: "rolled in the game, on the dashboard", physical: "you roll your own and tell the values" } },
|
|
122
123
|
"master-rolls": {
|
|
123
124
|
about: "the master's rolls for foes and the characters you meet; yours and your companions' are always in view",
|
|
124
125
|
values: masterRollWays,
|
|
@@ -142,13 +143,25 @@ export const playerWords = {
|
|
|
142
143
|
values: pictureWays,
|
|
143
144
|
means: { none: "no pictures", "on request": "those you ask for", "new elements": "one for each new place and quest, and for each one you meet" },
|
|
144
145
|
},
|
|
146
|
+
// Any other value names an image tool of the master's, which the page shows as written (D-572).
|
|
147
|
+
"pictures-by": {
|
|
148
|
+
about: "who makes the pictures",
|
|
149
|
+
values: pictureMakers,
|
|
150
|
+
means: {
|
|
151
|
+
chat: "your AI app, by its own means: Claude draws them as vector pictures, Codex and Antigravity paint them, each from your plan",
|
|
152
|
+
codex: "Codex paints them on this computer, from your ChatGPT plan (Plus or higher)",
|
|
153
|
+
elevenlabs: "the master makes them with ElevenLabs, connected to your AI app, from your ElevenLabs plan",
|
|
154
|
+
other: "another image tool connected to your AI app: the master asks you which in the chat",
|
|
155
|
+
},
|
|
156
|
+
unset: "chat",
|
|
157
|
+
},
|
|
145
158
|
effort: {
|
|
146
159
|
about: "how much the master thinks before each answer, from the next chat",
|
|
147
160
|
values: [...efforts, "app"],
|
|
148
161
|
means: { low: "quicker answers, a little less thought", medium: "the usual balance", high: "slower answers, more thought", app: "your AI app decides, as it does in any chat" },
|
|
149
162
|
unset: "app",
|
|
150
163
|
},
|
|
151
|
-
lines: { about: "what never
|
|
164
|
+
lines: { about: "what must never appear in the game" },
|
|
152
165
|
veils: { about: "what happens only off screen, without details" },
|
|
153
166
|
// The standing orders, always before the master: their longest item, which the page's field keeps to (D-563).
|
|
154
167
|
orders: {
|
package/dist/commands/find.js
CHANGED
|
@@ -37,7 +37,7 @@ export const find = defineCommand({
|
|
|
37
37
|
const found = [...lines, ...system];
|
|
38
38
|
const note = systemNote(result, lines.length > 0);
|
|
39
39
|
// A name said in play and never written is no page: the player who remembers it is right (D-266).
|
|
40
|
-
const unwritten = result.withText ? " What was said in play and never written is not in the files: if the player remembers it, write it." : "";
|
|
40
|
+
const unwritten = result.withText ? " What was said in play and never written is not in the files: chats finds it in the past chats; if the player remembers it, write it." : "";
|
|
41
41
|
const none = `${note === "" || result.withText ? "No page matches." : "No page of the campaign matches."}${unwritten}`;
|
|
42
42
|
return [found.length > 0 ? found.join("\n") : none, note, skippedPagesNote(result.problems)].filter((block) => block !== "").join("\n\n");
|
|
43
43
|
},
|
package/dist/commands/image.d.ts
CHANGED
|
@@ -10,10 +10,19 @@ interface ImageResult {
|
|
|
10
10
|
changed: boolean;
|
|
11
11
|
/** The picture is being made, and comes by itself (D-308). */
|
|
12
12
|
making?: boolean;
|
|
13
|
+
/** The brief of the picture the chat makes itself with its own tool, as Antigravity (D-390). */
|
|
14
|
+
paint?: string;
|
|
15
|
+
/** The master's own image tool that makes it from the brief, as ElevenLabs (D-572); none for the chat's own. */
|
|
16
|
+
tool?: string;
|
|
17
|
+
/** The player chose another image tool and has not named it yet: the master asks which (D-572). */
|
|
18
|
+
askTool?: true;
|
|
19
|
+
/** Why the chat in use made it, or makes it, in place of the maker the player chose (D-572). */
|
|
20
|
+
instead?: string;
|
|
13
21
|
}
|
|
14
22
|
export declare const image: import("../core/registry.ts").Command<z.ZodObject<{
|
|
15
23
|
page: z.ZodString;
|
|
16
24
|
file: z.ZodOptional<z.ZodString>;
|
|
25
|
+
url: z.ZodOptional<z.ZodString>;
|
|
17
26
|
describe: z.ZodOptional<z.ZodString>;
|
|
18
27
|
}, z.core.$strip>, ImageResult>;
|
|
19
28
|
export {};
|
package/dist/commands/image.js
CHANGED
|
@@ -5,7 +5,7 @@ import { appendLogEntry } from "../core/log.js";
|
|
|
5
5
|
import { defineCommand } from "../core/registry.js";
|
|
6
6
|
import { files, isInside } from "../core/store.js";
|
|
7
7
|
import { comparableText, withArticle } from "../core/text.js";
|
|
8
|
-
import { imageFileName, imageLink, imagesFolderName, readImage } from "../images/index.js";
|
|
8
|
+
import { imageFileName, imageLink, imageOfBytes, imagesFolderName, largestImage, readImage } from "../images/index.js";
|
|
9
9
|
import { baseChain, findPage, isPartyMember, ownField, pageNamed, parsePageReference, writePage } from "../pages/index.js";
|
|
10
10
|
import { imageFile, ownImage } from "./shared/campaign/images.js";
|
|
11
11
|
import { campaignSystem, campaignWorld } from "./shared/campaign/world.js";
|
|
@@ -17,7 +17,7 @@ export const image = defineCommand({
|
|
|
17
17
|
name: "image",
|
|
18
18
|
description: "Give a page its picture: a portrait for a character, an image for a creature, an item or a place, as the dashboard will show it in a round token. "
|
|
19
19
|
+ "It copies the file into the campaign and links it in the page's image field; a page without one shows the picture of the page it derives from, such as a wolf's icon. "
|
|
20
|
-
+ "Use it when the player gives you a picture, or after you made
|
|
20
|
+
+ "Use it when the player gives you a picture, or after you made one with your own tools: its file, or url with the https address your tool gives, which the engine downloads. "
|
|
21
21
|
+ "For a place, a quest, a character or a creature of the campaign, describe instead of file has the picture made on this computer, as the campaign's pictures setting allows: "
|
|
22
22
|
+ "for the player character or a companion only when the player asks; for a creature once for each kind, whose copies show it. "
|
|
23
23
|
+ "Example: page Ettore, file C:\\Users\\me\\Pictures\\ettore.png.",
|
|
@@ -25,7 +25,8 @@ export const image = defineCommand({
|
|
|
25
25
|
positionals: ["page", "file"],
|
|
26
26
|
input: z.object({
|
|
27
27
|
page: z.string().describe("the page that gets the picture"),
|
|
28
|
-
file: z.string().optional().describe("the picture's file, PNG, JPEG, WebP or SVG up to 5 MB: its full path or one from the folder the command runs in; leave it out to remove the page's own picture"),
|
|
28
|
+
file: z.string().optional().describe("the picture's file, PNG, JPEG, WebP or SVG up to 5 MB: its full path or one from the folder the command runs in; leave it and url out to remove the page's own picture"),
|
|
29
|
+
url: z.string().optional().describe("instead of file, the picture's https address, as an image tool gives it: the engine downloads it, the same formats up to 5 MB"),
|
|
29
30
|
describe: z.string().optional().describe("instead of file, in a few lines, never a victim or wounds: for a place, what the party sees arriving; for a quest, what the character knows of it; "
|
|
30
31
|
+ "for one of the party, their look, their people as this world has them and the rest as the player described it; for a character or a creature met, what the character sees of them, "
|
|
31
32
|
+ "a disguise as the disguise; never what the character does not know. The picture is made where it can be, and comes by itself"),
|
|
@@ -40,23 +41,36 @@ export const image = defineCommand({
|
|
|
40
41
|
if (page.system !== undefined) {
|
|
41
42
|
throw new Error(`${systemRefusal(page)} Nothing changed.`);
|
|
42
43
|
}
|
|
44
|
+
const url = input.url?.trim() ?? "";
|
|
45
|
+
const file = input.file?.trim() ?? "";
|
|
43
46
|
if (input.describe !== undefined && input.describe.trim() !== "") {
|
|
44
|
-
if (
|
|
45
|
-
throw new Error("Give file or describe,
|
|
47
|
+
if (file !== "" || url !== "") {
|
|
48
|
+
throw new Error("Give file, url or describe, one of them: file and url are a picture you have, describe has one made. Nothing changed.");
|
|
46
49
|
}
|
|
47
50
|
return madePicture(root, context, world, page, input.describe.trim());
|
|
48
51
|
}
|
|
49
|
-
if (
|
|
52
|
+
if (url !== "") {
|
|
53
|
+
if (file !== "") {
|
|
54
|
+
throw new Error("Give file or url, not both: file is a picture on this computer, url one on the web. Nothing changed.");
|
|
55
|
+
}
|
|
56
|
+
return downloadedImage(root, context, world, page, url);
|
|
57
|
+
}
|
|
58
|
+
if (file === "") {
|
|
50
59
|
return removeImage(root, context, world, page, imageFile(root, context, ownImage(page)));
|
|
51
60
|
}
|
|
52
|
-
return setImage(root, context, world, page, resolve(context.folder,
|
|
61
|
+
return setImage(root, context, world, page, resolve(context.folder, file));
|
|
53
62
|
},
|
|
54
63
|
format(result) {
|
|
64
|
+
if (result.paint !== undefined) {
|
|
65
|
+
const how = result.askTool === true ? askToolText(result.page) : paintText(result.page, result.tool);
|
|
66
|
+
return `${result.instead === undefined ? "" : `${result.instead} `}${how}\n\n${result.paint}`;
|
|
67
|
+
}
|
|
55
68
|
if (result.making === true) {
|
|
56
69
|
return `${result.page}'s picture is being made, in a minute or so: the player's dashboard shows it when it comes. Go on with the story.`;
|
|
57
70
|
}
|
|
58
71
|
if (result.image !== undefined) {
|
|
59
|
-
|
|
72
|
+
const now = `${result.page}'s picture is now ${result.image}${result.from === undefined ? "" : `, copied from ${result.from}`}.`;
|
|
73
|
+
return result.instead === undefined ? now : `${now} ${result.instead}`;
|
|
60
74
|
}
|
|
61
75
|
const shown = result.inheritedFrom === undefined ? "it has none now" : `it shows the picture of ${result.inheritedFrom}`;
|
|
62
76
|
return result.changed ? `${result.page} has no picture of its own any more: ${shown}.` : `${result.page} has no picture of its own: ${shown}.`;
|
|
@@ -64,20 +78,44 @@ export const image = defineCommand({
|
|
|
64
78
|
});
|
|
65
79
|
/** Copies a picture into the campaign's images folder and links it in the page; the page's old picture goes when nothing else links it. */
|
|
66
80
|
function setImage(root, context, world, page, from) {
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
return placeImage(root, context, world, page, readImage(from), from);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The picture at an https address, as an image tool gives it (T-222), downloaded by the engine where the master has no shell, then taken as a file is.
|
|
85
|
+
* The address itself is neither logged nor kept: a signed one is a key.
|
|
86
|
+
*/
|
|
87
|
+
async function downloadedImage(root, context, world, page, url) {
|
|
88
|
+
if (!/^https:\/\/[^\s/]+/i.test(url)) {
|
|
89
|
+
throw new Error("url takes the https address of the picture, as your image tool gives it, and that is not one: give the full https address, or the picture's file. Nothing changed.");
|
|
90
|
+
}
|
|
91
|
+
if (context.download === undefined) {
|
|
92
|
+
throw new Error("Here the engine cannot download: download the picture yourself and give it with file and its full path. Nothing changed.");
|
|
93
|
+
}
|
|
94
|
+
const signal = context.signal === undefined ? AbortSignal.timeout(longestDownload) : AbortSignal.any([context.signal, AbortSignal.timeout(longestDownload)]);
|
|
95
|
+
const bytes = await context.download(url, largestImage, signal).catch((error) => {
|
|
96
|
+
const why = error instanceof Error ? error.message : String(error);
|
|
97
|
+
throw new Error(`No picture came from the address: ${why} If it expired, as signed addresses do, ask your image tool for a new one. Nothing changed.`);
|
|
98
|
+
});
|
|
99
|
+
return placeImage(root, context, world, page, imageOfBytes(bytes, "What the address gave"));
|
|
100
|
+
}
|
|
101
|
+
/** Writes a picture into the campaign's images folder and links it in the page, logging it; `from` is the file it was read from, if any. */
|
|
102
|
+
function placeImage(root, context, world, page, picture, from) {
|
|
69
103
|
if ("problem" in picture) {
|
|
70
104
|
throw new Error(`${picture.problem} Nothing changed.`);
|
|
71
105
|
}
|
|
106
|
+
const old = imageFile(root, context, ownImage(page));
|
|
72
107
|
const target = join(root, imagesFolderName, `${page.name}.${picture.extension}`);
|
|
73
|
-
|
|
108
|
+
const copied = from !== undefined && resolve(target) !== from;
|
|
109
|
+
if (from === undefined || copied) {
|
|
74
110
|
files().writeBytes(target, picture.bytes);
|
|
75
111
|
}
|
|
76
112
|
writePage(world, page.name, undefined, { set: { image: imageLink(`${page.name}.${picture.extension}`) } });
|
|
77
113
|
removeUnused(root, world, page, old, target);
|
|
78
114
|
appendLogEntry(root, newDatedLogEntry(root, context, "image-set", "public", { page: page.name, image: shownPath(root, target) }));
|
|
79
|
-
return { page: page.name, image: shownPath(root, target), from:
|
|
115
|
+
return { page: page.name, image: shownPath(root, target), from: copied ? from : undefined, changed: true };
|
|
80
116
|
}
|
|
117
|
+
// How long a picture's download may take: a few megabytes come in seconds.
|
|
118
|
+
const longestDownload = 60 * 1000;
|
|
81
119
|
/** Why a page of the game system takes no picture, and how to give one: to a page of the campaign that derives from it, which a creature's scenes then bring in. */
|
|
82
120
|
function systemRefusal(page) {
|
|
83
121
|
const readOnly = `${page.name} is ${withArticle(page.type ?? "page")} of the game system ${page.system}: read-only.`;
|
|
@@ -102,8 +140,8 @@ function copyRefusal(root, world, name) {
|
|
|
102
140
|
/**
|
|
103
141
|
* A place's picture made from what the party sees, a quest's from what the character knows of it, the portrait of one of the party as the player described
|
|
104
142
|
* them, or the token of a character or a kind of creature met, from what the character sees (D-308, D-388, D-408, D-420, PIC-1–PIC-3), where the campaign's
|
|
105
|
-
* setting allows it and this computer can: in the MCP server it comes by itself while the story goes on
|
|
106
|
-
* is never tried again.
|
|
143
|
+
* setting allows it and this computer can: in the MCP server it comes by itself while the story goes on, and the master's next call says whether another
|
|
144
|
+
* maker drew it or none came (D-572); on the command line the command waits for it. A refusal is never tried again.
|
|
107
145
|
*/
|
|
108
146
|
function madePicture(root, context, world, page, seen) {
|
|
109
147
|
const kind = page.type === "place" || page.type === "quest" || page.type === "creature" ? page.type : page.type === "character" ? "portrait" : undefined;
|
|
@@ -120,7 +158,15 @@ function madePicture(root, context, world, page, seen) {
|
|
|
120
158
|
}
|
|
121
159
|
const unseen = [...readListSetting(root, "lines"), ...readListSetting(root, "veils")];
|
|
122
160
|
const { name, who } = kind === "place" || kind === "quest" ? { name: page.name } : isPartyMember(page) ? { name: page.name, who: portraitWho(root, context, world, page) } : metWho(root, world, page);
|
|
123
|
-
const
|
|
161
|
+
const subject = { kind, name, ...(who === undefined ? {} : { who }), seen, unseen };
|
|
162
|
+
const paint = context.pictures.brief?.(subject);
|
|
163
|
+
// The chat paints it itself, with its own tool or one it names.
|
|
164
|
+
if (paint !== undefined) {
|
|
165
|
+
const instead = ready.instead === undefined ? {} : { instead: insteadText(page.name, ready.instead, false) };
|
|
166
|
+
const tool = ready.askTool === true ? { askTool: true } : ready.tool === undefined ? {} : { tool: ready.tool };
|
|
167
|
+
return { page: page.name, changed: false, paint, ...tool, ...instead };
|
|
168
|
+
}
|
|
169
|
+
const making = context.pictures.make(subject).then((made) => {
|
|
124
170
|
if ("refused" in made) {
|
|
125
171
|
appendLogEntry(root, newDatedLogEntry(root, context, "image-refused", "hidden", { page: page.name, why: made.refused }));
|
|
126
172
|
throw new Error(`No picture of ${page.name}: ${made.refused}. Go on without, or give one with file.`);
|
|
@@ -129,7 +175,7 @@ function madePicture(root, context, world, page, seen) {
|
|
|
129
175
|
const world = campaignWorld(root, context);
|
|
130
176
|
const now = world.pages.find((candidate) => candidate.path === page.path) ?? page;
|
|
131
177
|
// Codex's own copy goes once copied: the picture is the campaign's.
|
|
132
|
-
return { ...setImage(root, context, world, now, made.file), from: undefined };
|
|
178
|
+
return { ...setImage(root, context, world, now, made.file), from: undefined, ...(made.instead === undefined ? {} : { instead: insteadText(page.name, made.instead, true) }) };
|
|
133
179
|
}
|
|
134
180
|
finally {
|
|
135
181
|
made.done();
|
|
@@ -138,10 +184,41 @@ function madePicture(root, context, world, page, seen) {
|
|
|
138
184
|
if (context.files === undefined) {
|
|
139
185
|
return making;
|
|
140
186
|
}
|
|
141
|
-
// The MCP server lives on: the picture comes by itself,
|
|
142
|
-
making.
|
|
187
|
+
// The MCP server lives on: the picture comes by itself, the dashboard shows it, and the master's next call hears what went otherwise.
|
|
188
|
+
void making.then((made) => {
|
|
189
|
+
if (made.instead !== undefined) {
|
|
190
|
+
context.later?.add(made.instead);
|
|
191
|
+
}
|
|
192
|
+
}, (error) => context.later?.add(error instanceof Error ? error.message : String(error)));
|
|
143
193
|
return { page: page.name, changed: false, making: true };
|
|
144
194
|
}
|
|
195
|
+
/** Why the chat in use made a picture, or makes it, in place of the maker the player chose, for the master (D-572). */
|
|
196
|
+
function insteadText(name, instead, made) {
|
|
197
|
+
const why = `${instead.maker} ${instead.refused === true ? "refused" : "could not make"} ${name}'s picture: ${instead.why.replace(/\.$/, "")}.`;
|
|
198
|
+
return made ? `${why} ${instead.by} made it instead.` : why;
|
|
199
|
+
}
|
|
200
|
+
/** How the master makes a picture from its brief: with their own image tool, with ElevenLabs's, or with the one the player named (D-390, D-572). */
|
|
201
|
+
function paintText(page, tool) {
|
|
202
|
+
const give = giveText(page);
|
|
203
|
+
if (tool === undefined) {
|
|
204
|
+
return `Make ${page}'s picture yourself with your own image tool, from this brief, then ${give}; if your tool makes none, go on without.`;
|
|
205
|
+
}
|
|
206
|
+
if (tool === "ElevenLabs") {
|
|
207
|
+
return `Make ${page}'s picture with your ElevenLabs image tool, from this brief: one picture (generations_count 1). Its view shows the player the progress, but the game needs the finished file: `
|
|
208
|
+
+ `ask for the generation again every 15 seconds or so until it is completed, then give its full-resolution address with image, page ${page}, url, or download it and give file. `
|
|
209
|
+
+ `If your ElevenLabs tools make no pictures, tell the player to add the full ElevenLabs connector, a custom connector at https://api.elevenlabs.io/v1/mcp; if it fails, tell them why and go on without.`;
|
|
210
|
+
}
|
|
211
|
+
return `Make ${page}'s picture with ${tool}, from this brief, then ${give}; if it makes none, tell the player why and go on without.`;
|
|
212
|
+
}
|
|
213
|
+
/** What the master does where the player chose another image tool without naming it (D-572): asks which, writes it, then makes the picture with it. */
|
|
214
|
+
function askToolText(page) {
|
|
215
|
+
return `The player chose another image tool for the pictures and has not named it: ask them which, set its name with config pictures-by, then make ${page}'s picture with it from this brief `
|
|
216
|
+
+ `and ${giveText(page)}; if they have none, go on without.`;
|
|
217
|
+
}
|
|
218
|
+
/** How the master gives the picture its tool made: its file, or the address the tool gives where they cannot download it (T-222). */
|
|
219
|
+
function giveText(page) {
|
|
220
|
+
return `give it with image, page ${page}, file and its full path, or url and its https address where the tool gives one you cannot download`;
|
|
221
|
+
}
|
|
145
222
|
/** What the game says one of the party is, for their portrait (D-408): what their page derives from, as their people, and the line under their name. */
|
|
146
223
|
function portraitWho(root, context, world, page) {
|
|
147
224
|
const said = [baseChain(world, page).map((base) => base.name).join(", "), sheetHeadline(world, campaignSystem(root, context), page) ?? ""].filter((part) => part !== "");
|
package/dist/commands/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { advance } from "./advance.js";
|
|
2
2
|
import { ask } from "./ask.js";
|
|
3
|
+
import { book } from "./book.js";
|
|
3
4
|
import { change } from "./change/change.js";
|
|
5
|
+
import { chats } from "./chats.js";
|
|
4
6
|
import { choices } from "./choices.js";
|
|
5
7
|
import { config } from "./config/config.js";
|
|
6
8
|
import { effect } from "./effect.js";
|
|
@@ -48,6 +50,8 @@ export const commands = [
|
|
|
48
50
|
show,
|
|
49
51
|
view,
|
|
50
52
|
find,
|
|
53
|
+
chats,
|
|
54
|
+
book,
|
|
51
55
|
rules,
|
|
52
56
|
roll,
|
|
53
57
|
ask,
|
package/dist/commands/init.js
CHANGED
|
@@ -33,15 +33,15 @@ export const init = defineCommand({
|
|
|
33
33
|
createWorld(root);
|
|
34
34
|
appendLogEntry(root, newLogEntry(context, "campaign-created", "public", settings));
|
|
35
35
|
// What the next campaign's setup suggests (T-134).
|
|
36
|
-
rememberChoice(context.home, "difficulty", settings.difficulty);
|
|
37
|
-
rememberChoice(context.home, "lethality", settings.lethality);
|
|
36
|
+
rememberChoice(context.home, root, "difficulty", settings.difficulty);
|
|
37
|
+
rememberChoice(context.home, root, "lethality", settings.lethality);
|
|
38
38
|
return { root, name: settings.name, note: input.master === true ? campaignNote(root, context) : "" };
|
|
39
39
|
},
|
|
40
40
|
// The player reads it, who made the campaign in a terminal: what to do next. What the master still agrees with them only when the master made it (T-185).
|
|
41
41
|
format(result) {
|
|
42
42
|
return [
|
|
43
43
|
`Created the campaign "${result.name}" in ${result.root}.`,
|
|
44
|
-
"To play, open Claude Code or
|
|
44
|
+
"To play, open Claude Code, Codex or Antigravity in this folder and say hello: the master asks you the rest.",
|
|
45
45
|
...(result.note === "" ? [] : ["", `For the master: ${result.note}`]),
|
|
46
46
|
].join("\n");
|
|
47
47
|
},
|
|
@@ -5,6 +5,7 @@ import { readCounter } from "../../counters/index.js";
|
|
|
5
5
|
import { findPage, isPartyMember, linksIn, pagesWithName, parsePageReference } from "../../pages/index.js";
|
|
6
6
|
import { sceneTypes } from "../../scene/index.js";
|
|
7
7
|
import { formatGameDate } from "../../time/index.js";
|
|
8
|
+
import { chapterCraft, sceneChapters } from "../shared/campaign/book.js";
|
|
8
9
|
import { firstInChat } from "../shared/campaign/parts.js";
|
|
9
10
|
import { isTickedOpenQuest, tickedQuestNote } from "../shared/campaign/quests.js";
|
|
10
11
|
import { isPlayerDead, makeSave, saveText } from "../shared/campaign/saves.js";
|
|
@@ -49,7 +50,7 @@ export function close(root, world, summary, context) {
|
|
|
49
50
|
if (current === undefined) {
|
|
50
51
|
const titled = rawTitleAndType(raw);
|
|
51
52
|
appendLogEntry(root, newDatedLogEntry(root, context, "scene-closed", "public", { ...titled, closed, summary: summary.trim() }));
|
|
52
|
-
return { action: "close", copies: [], unreadable: problem?.message, ended, endless: [], quests, ...endOfSceneSave(root, context, world, titled.title) };
|
|
53
|
+
return { action: "close", copies: [], unreadable: problem?.message, ended, endless: [], quests, ...bookChapter(root, context), ...endOfSceneSave(root, context, world, titled.title) };
|
|
53
54
|
}
|
|
54
55
|
logCopies(root, context, current.title, current.copies);
|
|
55
56
|
const left = current.left?.filter((name) => pagesWithName(world, name).length > 0);
|
|
@@ -72,9 +73,15 @@ export function close(root, world, summary, context) {
|
|
|
72
73
|
...(fallen === "" ? {} : { fallen }),
|
|
73
74
|
...(peakEnded(current.type) && firstInChat(context, "after-peak") ? { afterPeak } : {}),
|
|
74
75
|
quests,
|
|
76
|
+
...bookChapter(root, context),
|
|
75
77
|
...saved,
|
|
76
78
|
};
|
|
77
79
|
}
|
|
80
|
+
/** The chapter of the book the scene just closed is, for the master to write, with how to write it once in a chat (T-227). */
|
|
81
|
+
function bookChapter(root, context) {
|
|
82
|
+
const chapter = sceneChapters(root).at(-1)?.number;
|
|
83
|
+
return chapter === undefined ? {} : { chapter, ...(firstInChat(context, "book") ? { craft: chapterCraft } : {}) };
|
|
84
|
+
}
|
|
78
85
|
/**
|
|
79
86
|
* The save at the end of a scene, named by its title (D-55, SAV-3): none while the player character is dead, since going back is what one is for. A save that
|
|
80
87
|
* cannot be written never stops the close, which is already done: it says why.
|
|
@@ -165,7 +172,7 @@ export function closedText(result) {
|
|
|
165
172
|
const advance = "Advance any time it took that you have not advanced yet; write on their pages what it changed for good, such as a fire put out or a door broken.";
|
|
166
173
|
const endless = result.endless.length === 0 ? "" : `\nStill there, with no end: ${result.endless.join(" · ")}. End those the scene ended, with effect end.`;
|
|
167
174
|
const ended = `${result.ended.length === 0 ? "" : `\nEnded with the scene: ${result.ended.join(" · ")}.`}${endless}`;
|
|
168
|
-
const quests = result.quests.map((line) => `\n${line}`).join("")
|
|
175
|
+
const quests = `${result.quests.map((line) => `\n${line}`).join("")}${chapterLine(result.chapter, result.craft)}`;
|
|
169
176
|
if (result.unreadable !== undefined) {
|
|
170
177
|
return `The open scene could not be read (${result.unreadable}): closed it, without its copies. ${advance}${ended}${quests}${saved}`;
|
|
171
178
|
}
|
|
@@ -179,3 +186,7 @@ export function closedText(result) {
|
|
|
179
186
|
const peak = result.afterPeak === undefined ? "" : `\n${result.afterPeak}`;
|
|
180
187
|
return `Scene closed${rounds}: ${result.title}.${gone} ${advance}${ended}${left}${fallen}${rewards}${quests}${peak}${saved}`;
|
|
181
188
|
}
|
|
189
|
+
/** The book's chapter the scene leaves to write (T-227). */
|
|
190
|
+
function chapterLine(chapter, craft) {
|
|
191
|
+
return chapter === undefined ? "" : `\nChapter ${chapter} of the book waits for its prose: write it with book now, while the scene is fresh.${craft === undefined ? "" : ` ${craft}`}`;
|
|
192
|
+
}
|
|
@@ -69,6 +69,8 @@ export type SceneResult = ({
|
|
|
69
69
|
fallen?: string;
|
|
70
70
|
afterPeak?: string;
|
|
71
71
|
quests: string[];
|
|
72
|
+
chapter?: number;
|
|
73
|
+
craft?: string;
|
|
72
74
|
} & Saved);
|
|
73
75
|
/** The order of turns, where the scene has one, and whether the turn is the player's character's. */
|
|
74
76
|
export interface Turns {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A scene of the story as a chapter of the book: its number, as the journal counts them, its title and summary, its game date, when it ran in real time, and the log line that opened it. */
|
|
2
|
+
export interface SceneChapter {
|
|
3
|
+
number: number;
|
|
4
|
+
title: string;
|
|
5
|
+
summary?: string;
|
|
6
|
+
date?: string;
|
|
7
|
+
from: string;
|
|
8
|
+
/** When it closed; none while it is open. */
|
|
9
|
+
to?: string;
|
|
10
|
+
scene: string;
|
|
11
|
+
}
|
|
12
|
+
/** A chapter of the book as the player reads it. */
|
|
13
|
+
export interface BookChapter {
|
|
14
|
+
number: number;
|
|
15
|
+
title: string;
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
/** How the master writes a chapter (T-227): told once in a chat, by the first scene that closes or the first call of book. */
|
|
19
|
+
export declare const chapterCraft: string;
|
|
20
|
+
/** The scenes of the story in order, by the public lines of the log, as the journal numbers them: a scene closed with no line that opened it is one too. */
|
|
21
|
+
export declare function sceneChapters(root: string): SceneChapter[];
|
|
22
|
+
/** The chapters of the book whose scenes are in the story as it stands, in order. */
|
|
23
|
+
export declare function campaignBook(root: string): BookChapter[];
|
|
24
|
+
/** Writes a scene's chapter, in place of the one it had. */
|
|
25
|
+
export declare function writeChapter(root: string, scene: SceneChapter, title: string, text: string): void;
|
|
26
|
+
/** Takes a chapter out of the book; nothing when it has none. */
|
|
27
|
+
export declare function removeChapter(root: string, number: number): void;
|
|
28
|
+
/** What status says of a book left behind, by a chat closed or a computer turned off: the closed chapters still to write, once the book has begun (T-227). */
|
|
29
|
+
export declare function bookBehind(root: string): string | undefined;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// The campaign's story told as a book (T-227): a chapter of prose for each closed scene, written by the master into book/, out of the saves. A chapter belongs
|
|
2
|
+
// to its scene by the log line that opened it: one whose scene a load undid, or that a reset took away, is left out until the master writes it again.
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { parse, stringify } from "yaml";
|
|
5
|
+
import { bookFolderName } from "../../../campaign/index.js";
|
|
6
|
+
import { readLog } from "../../../core/log.js";
|
|
7
|
+
import { files } from "../../../core/store.js";
|
|
8
|
+
/** How the master writes a chapter (T-227): told once in a chat, by the first scene that closes or the first call of book. */
|
|
9
|
+
export const chapterCraft = "How to write a chapter: as a chapter of a novel, never a summary or a report. In the campaign's language, third person with an outside narrator, in the prose style the player chose: "
|
|
10
|
+
+ "its voice binds the book, its limits on length and its endings in play do not. Pick up where the last chapter left off (book with its number reads it back), without retelling it. "
|
|
11
|
+
+ "Tell it in scenes: places, gestures, silences, and people's words as dialogue where they mattered; summary only for roads and time passing. "
|
|
12
|
+
+ "The player character does and says only what the player played: their words may be put better, never a deed, a line or a choice of yours added. "
|
|
13
|
+
+ "Only what the player saw and learned: no secret, no hidden roll, nothing you planned, no conclusion they did not reach. No game words: no rolls, points, turns, nor a condition by its game name. "
|
|
14
|
+
+ "As long as the scene deserves, from about 500 words for a short one to 2000 for a great one; end on an image or a line, never on a question to the player. A chapter may take a title of its own. "
|
|
15
|
+
+ "Paragraphs apart by a blank line, *italics* where a voice or a thought needs them, *** alone on a line for a break within the chapter.";
|
|
16
|
+
/** The scenes of the story in order, by the public lines of the log, as the journal numbers them: a scene closed with no line that opened it is one too. */
|
|
17
|
+
export function sceneChapters(root) {
|
|
18
|
+
const chapters = [];
|
|
19
|
+
let open;
|
|
20
|
+
for (const entry of readLog(root).filter((line) => line.visibility === "public")) {
|
|
21
|
+
if (entry.type !== "scene-opened" && entry.type !== "scene-closed") {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const scene = entry.type === "scene-opened" ? undefined : open;
|
|
25
|
+
const chapter = scene ?? {
|
|
26
|
+
number: chapters.length + 1,
|
|
27
|
+
title: String(entry.data.title ?? ""),
|
|
28
|
+
...(entry.date === undefined ? {} : { date: entry.date }),
|
|
29
|
+
from: entry.at,
|
|
30
|
+
scene: entry.id,
|
|
31
|
+
};
|
|
32
|
+
if (scene === undefined) {
|
|
33
|
+
chapters.push(chapter);
|
|
34
|
+
}
|
|
35
|
+
if (entry.type === "scene-opened") {
|
|
36
|
+
open = chapter;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const summary = typeof entry.data.summary === "string" ? entry.data.summary.trim() : "";
|
|
40
|
+
Object.assign(chapter, { to: entry.at }, summary === "" ? {} : { summary });
|
|
41
|
+
open = undefined;
|
|
42
|
+
}
|
|
43
|
+
return chapters;
|
|
44
|
+
}
|
|
45
|
+
/** The chapters of the book whose scenes are in the story as it stands, in order. */
|
|
46
|
+
export function campaignBook(root) {
|
|
47
|
+
const scenes = new Map(sceneChapters(root).map((scene) => [scene.number, scene.scene]));
|
|
48
|
+
return writtenChapters(root)
|
|
49
|
+
.filter((chapter) => scenes.get(chapter.number) === chapter.scene)
|
|
50
|
+
.sort((one, other) => one.number - other.number)
|
|
51
|
+
.map(({ number, title, text }) => ({ number, title, text }));
|
|
52
|
+
}
|
|
53
|
+
/** Writes a scene's chapter, in place of the one it had. */
|
|
54
|
+
export function writeChapter(root, scene, title, text) {
|
|
55
|
+
const head = stringify({ chapter: scene.number, title, scene: scene.scene }, { lineWidth: 0 });
|
|
56
|
+
files().write(chapterPath(root, scene.number), `---\n${head}---\n\n${text}\n`);
|
|
57
|
+
}
|
|
58
|
+
/** Takes a chapter out of the book; nothing when it has none. */
|
|
59
|
+
export function removeChapter(root, number) {
|
|
60
|
+
const path = chapterPath(root, number);
|
|
61
|
+
if (files().exists(path)) {
|
|
62
|
+
files().remove(path);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function chapterPath(root, number) {
|
|
66
|
+
return join(root, bookFolderName, `${String(number).padStart(3, "0")}.md`);
|
|
67
|
+
}
|
|
68
|
+
/** The chapters written in the book folder, each with the scene it was written for; a file that does not read as one is left out. */
|
|
69
|
+
function writtenChapters(root) {
|
|
70
|
+
return files().files(join(root, bookFolderName), (name) => /^\d+\.md$/.test(name)).flatMap((path) => {
|
|
71
|
+
const read = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(files().text(path) ?? "");
|
|
72
|
+
try {
|
|
73
|
+
const head = read === null ? undefined : parse(read[1]);
|
|
74
|
+
if (read === null || head === null || head === undefined || typeof head.chapter !== "number" || typeof head.scene !== "string") {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
return [{ number: head.chapter, title: typeof head.title === "string" ? head.title : "", text: read[2].trim(), scene: head.scene }];
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/** What status says of a book left behind, by a chat closed or a computer turned off: the closed chapters still to write, once the book has begun (T-227). */
|
|
85
|
+
export function bookBehind(root) {
|
|
86
|
+
const written = campaignBook(root);
|
|
87
|
+
if (written.length === 0) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const missing = sceneChapters(root).filter((scene) => scene.to !== undefined && !written.some((chapter) => chapter.number === scene.number)).map((scene) => scene.number);
|
|
91
|
+
const list = missing.length > 10 ? `${missing.slice(0, 10).join(", ")}…` : missing.join(", ");
|
|
92
|
+
return missing.length === 0
|
|
93
|
+
? undefined
|
|
94
|
+
: `The book lacks ${missing.length === 1 ? "chapter" : "chapters"} ${list}, of scenes closed: write ${missing.length === 1 ? "it" : "them"} with book before the story goes on; book lists them with their chats.`;
|
|
95
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Chat, type UndoneStretch } from "../../../chats/index.ts";
|
|
2
|
+
import type { Context } from "../../../core/context.ts";
|
|
3
|
+
/**
|
|
4
|
+
* The stretches of real time the loads undid, by the log as it stands: each from when its save was made to when it was loaded. A load the save undid in
|
|
5
|
+
* its turn is no longer in the log, and the later load's stretch holds it. A load logged before its save's time was written starts at the line before it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function undoneStretches(root: string): UndoneStretch[];
|
|
8
|
+
/** Copies the campaign's chats from the hosts into its sessions folder, where the context knows the hosts' folders. */
|
|
9
|
+
export declare function copyChats(root: string, context: Context): void;
|
|
10
|
+
/** The campaign's chats as it keeps them, a few minutes behind the chat going on, which is the master's own. */
|
|
11
|
+
export declare function campaignChats(root: string): Chat[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// The campaign's chats as text (T-225): copied from the AI hosts into its sessions folder, with what a load undid marked, as the log says.
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { sessionsFolderName } from "../../../campaign/index.js";
|
|
4
|
+
import { keepChats, keptChats } from "../../../chats/index.js";
|
|
5
|
+
import { readLog } from "../../../core/log.js";
|
|
6
|
+
/**
|
|
7
|
+
* The stretches of real time the loads undid, by the log as it stands: each from when its save was made to when it was loaded. A load the save undid in
|
|
8
|
+
* its turn is no longer in the log, and the later load's stretch holds it. A load logged before its save's time was written starts at the line before it.
|
|
9
|
+
*/
|
|
10
|
+
export function undoneStretches(root) {
|
|
11
|
+
const log = readLog(root);
|
|
12
|
+
return log.flatMap((entry, index) => {
|
|
13
|
+
if (entry.type !== "save-loaded") {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const data = entry.data;
|
|
17
|
+
return [{ from: typeof data.made === "string" ? data.made : log[index - 1]?.at ?? entry.at, to: entry.at, save: Number(data.save) }];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** Copies the campaign's chats from the hosts into its sessions folder, where the context knows the hosts' folders. */
|
|
21
|
+
export function copyChats(root, context) {
|
|
22
|
+
if (context.chatFolders !== undefined) {
|
|
23
|
+
keepChats(root, join(root, sessionsFolderName), context.chatFolders, context.platform, undoneStretches(root));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** The campaign's chats as it keeps them, a few minutes behind the chat going on, which is the master's own. */
|
|
27
|
+
export function campaignChats(root) {
|
|
28
|
+
return keptChats(join(root, sessionsFolderName));
|
|
29
|
+
}
|
|
@@ -17,7 +17,13 @@ export function picturesNote(root, context, world, place) {
|
|
|
17
17
|
// Asked once in a chat, not at every status and scene (T-64).
|
|
18
18
|
const ready = context.told === undefined || firstInChat(context, "pictures-ask") ? context.pictures?.ready() : undefined;
|
|
19
19
|
return ready?.ready === true
|
|
20
|
-
? `Pictures:
|
|
20
|
+
? `Pictures: ${ready.tool !== undefined
|
|
21
|
+
? `you can make the pictures of places, quests and those met with ${ready.tool}`
|
|
22
|
+
: ready.askTool === true
|
|
23
|
+
? "you can make the pictures of places, quests and those met with the image tool the player names"
|
|
24
|
+
: ready.maker === "Antigravity"
|
|
25
|
+
? "you can make the pictures of places, quests and those met with your own image tool"
|
|
26
|
+
: `this computer can make the pictures of places, quests and those met with the player's ${ready.maker === "Claude" ? "Claude Code" : "Codex"}`}, which spends their plan: ask them once whether they want one for each new place, quest and one met, only those they ask for, or none; then config pictures (new elements, on request or none).`
|
|
21
27
|
: undefined;
|
|
22
28
|
}
|
|
23
29
|
if (setting !== "new elements" || place === undefined || place.type !== "place" || shownImage(root, context, world, place) !== undefined) {
|
|
@@ -28,6 +28,8 @@ const settingLabels = {
|
|
|
28
28
|
character: "character (made with the player; made by the master, from a few words; the player's own, one they bring)",
|
|
29
29
|
companions: `companions (${companionWays.join(", ")})`,
|
|
30
30
|
"calendar-start": "calendar-start (when the story starts: day 1 to count only the days, or a day of the world, such as 14 April 1491)",
|
|
31
|
+
pictures: "pictures (of places, quests and those met: none; on request; new elements, one for each)",
|
|
32
|
+
"pictures-by": "pictures-by (who makes them: chat, your app by its own means; codex; elevenlabs; other, a tool the player names, written by its name; suggest chat)",
|
|
31
33
|
lines: 'lines ("none" is an answer)',
|
|
32
34
|
veils: 'veils ("none" is an answer)',
|
|
33
35
|
};
|
|
@@ -144,7 +146,7 @@ function setupMissingNames(root, context, world) {
|
|
|
144
146
|
* the settings still missing, when the game offers them (T-134), said once with the whole checklist; empty when there are none.
|
|
145
147
|
*/
|
|
146
148
|
function lastChoicesNote(root, context, world) {
|
|
147
|
-
const last = lastChoices(context.home);
|
|
149
|
+
const last = lastChoices(context.home, root);
|
|
148
150
|
const chosen = setupMissingNames(root, context, world).flatMap((name) => {
|
|
149
151
|
const value = last[name];
|
|
150
152
|
const offered = offeredValues(root, context, name);
|