rpg-engine 0.9.1 → 0.11.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 +1 -1
- package/dist/adventures/placement.js +4 -0
- package/dist/adventures/source.js +6 -5
- package/dist/campaign/find-campaign.js +18 -0
- package/dist/campaign/host-files.js +8 -6
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +2 -0
- package/dist/campaign/settings.js +12 -5
- package/dist/commands/advance.js +1 -1
- package/dist/commands/ask.js +1 -1
- package/dist/commands/config.js +21 -32
- package/dist/commands/import/import.js +1 -1
- package/dist/commands/instructions.js +1 -1
- package/dist/commands/mode.js +1 -1
- package/dist/commands/mood.js +2 -3
- package/dist/commands/move.js +1 -1
- package/dist/commands/package.d.ts +3 -3
- package/dist/commands/package.js +74 -37
- package/dist/commands/reveal.js +1 -1
- package/dist/commands/roll/roll.js +6 -12
- package/dist/commands/rules.js +0 -1
- package/dist/commands/scene.js +6 -8
- package/dist/commands/shared/adventures.js +21 -12
- package/dist/commands/shared/images.js +3 -1
- package/dist/commands/shared/knowledge.d.ts +8 -0
- package/dist/commands/shared/knowledge.js +41 -18
- package/dist/commands/shared/library.js +13 -5
- package/dist/commands/shared/mode.d.ts +7 -4
- package/dist/commands/shared/mode.js +28 -15
- package/dist/commands/shared/packages/catalog.d.ts +2 -0
- package/dist/commands/shared/packages/catalog.js +1 -0
- package/dist/commands/shared/packages/code.js +13 -2
- package/dist/commands/shared/page-words.d.ts +2 -0
- package/dist/commands/shared/page-words.js +13 -0
- package/dist/commands/shared/sheet.d.ts +3 -2
- package/dist/commands/shared/sheet.js +8 -5
- package/dist/commands/show.js +1 -1
- package/dist/commands/status.js +9 -5
- package/dist/commands/view/place.d.ts +2 -0
- package/dist/commands/view/place.js +17 -5
- package/dist/commands/write/write.js +4 -3
- package/dist/core/archive-paths.js +1 -1
- package/dist/core/context.d.ts +2 -0
- package/dist/core/package-api.d.ts +1 -1
- package/dist/core/package-declarations.d.ts +3 -3
- package/dist/core/package-declarations.js +3 -3
- package/dist/core/refusal.d.ts +12 -0
- package/dist/core/refusal.js +17 -0
- package/dist/core/store.d.ts +4 -0
- package/dist/core/store.js +20 -1
- package/dist/dashboard/api.js +37 -81
- package/dist/dashboard/app.js +10 -3
- package/dist/dashboard/asked.js +6 -3
- package/dist/dashboard/assets/master.svg +1 -2
- package/dist/dashboard/card.js +1 -1
- package/dist/dashboard/dice/load.js +6 -1
- package/dist/dashboard/dice/throw.js +5 -1
- package/dist/dashboard/dice/tray.js +5 -1
- package/dist/dashboard/footer.js +2 -2
- package/dist/dashboard/game-words.js +32 -32
- package/dist/dashboard/guide/ar.md +17 -17
- package/dist/dashboard/guide/cs.md +17 -17
- package/dist/dashboard/guide/da.md +16 -16
- package/dist/dashboard/guide/de.md +15 -15
- package/dist/dashboard/guide/el.md +19 -19
- package/dist/dashboard/guide/en.md +4 -4
- package/dist/dashboard/guide/es.md +17 -17
- package/dist/dashboard/guide/fi.md +19 -19
- package/dist/dashboard/guide/fr.md +16 -16
- package/dist/dashboard/guide/he.md +16 -16
- package/dist/dashboard/guide/hi.md +20 -20
- package/dist/dashboard/guide/hu.md +18 -18
- package/dist/dashboard/guide/is.md +16 -16
- package/dist/dashboard/guide/it.md +7 -7
- package/dist/dashboard/guide/ja.md +17 -17
- package/dist/dashboard/guide/ko.md +22 -22
- package/dist/dashboard/guide/nb.md +17 -17
- package/dist/dashboard/guide/nl.md +19 -19
- package/dist/dashboard/guide/pl.md +18 -18
- package/dist/dashboard/guide/pt.md +13 -13
- package/dist/dashboard/guide/ro.md +19 -19
- package/dist/dashboard/guide/ru.md +17 -17
- package/dist/dashboard/guide/sv.md +16 -16
- package/dist/dashboard/guide/tr.md +21 -21
- package/dist/dashboard/guide/uk.md +16 -16
- package/dist/dashboard/guide/zh.md +20 -20
- package/dist/dashboard/help/blocks.js +6 -0
- package/dist/dashboard/help/help.js +15 -3
- package/dist/dashboard/help/markdown.js +2 -1
- package/dist/dashboard/i18n/ar.json +54 -1
- package/dist/dashboard/i18n/cs.json +54 -1
- package/dist/dashboard/i18n/da.json +54 -1
- package/dist/dashboard/i18n/de.json +54 -1
- package/dist/dashboard/i18n/el.json +54 -1
- package/dist/dashboard/i18n/es.json +54 -1
- package/dist/dashboard/i18n/fi.json +54 -1
- package/dist/dashboard/i18n/fr.json +54 -1
- package/dist/dashboard/i18n/he.json +54 -1
- package/dist/dashboard/i18n/hi.json +54 -1
- package/dist/dashboard/i18n/hu.json +54 -1
- package/dist/dashboard/i18n/is.json +54 -1
- package/dist/dashboard/i18n/it.json +57 -4
- package/dist/dashboard/i18n/ja.json +54 -1
- package/dist/dashboard/i18n/ko.json +54 -1
- package/dist/dashboard/i18n/nb.json +54 -1
- package/dist/dashboard/i18n/nl.json +54 -1
- package/dist/dashboard/i18n/pl.json +54 -1
- package/dist/dashboard/i18n/pt.json +54 -1
- package/dist/dashboard/i18n/ro.json +54 -1
- package/dist/dashboard/i18n/ru.json +54 -1
- package/dist/dashboard/i18n/sv.json +54 -1
- package/dist/dashboard/i18n/tr.json +54 -1
- package/dist/dashboard/i18n/uk.json +54 -1
- package/dist/dashboard/i18n/zh.json +54 -1
- package/dist/dashboard/icons.js +2 -2
- package/dist/dashboard/journal.js +9 -4
- package/dist/dashboard/labels.js +5 -4
- package/dist/dashboard/language-choice.js +3 -3
- package/dist/dashboard/markdown.js +11 -4
- package/dist/dashboard/notes.js +4 -2
- package/dist/dashboard/notices.js +2 -2
- package/dist/dashboard/packages/ask-card.js +1 -1
- package/dist/dashboard/packages/packages.js +14 -10
- package/dist/dashboard/packages/page-code.js +11 -3
- package/dist/dashboard/packages/widgets.js +5 -5
- package/dist/dashboard/pages.js +3 -3
- package/dist/dashboard/place/map-sheet.js +4 -3
- package/dist/dashboard/place/map-view.js +17 -5
- package/dist/dashboard/refusals.js +61 -0
- package/dist/dashboard/rolls.js +3 -3
- package/dist/dashboard/settings.js +19 -5
- package/dist/dashboard/sheet.js +26 -7
- package/dist/dashboard/status.js +19 -13
- package/dist/dashboard/style.css +113 -16
- package/dist/dashboard/text.js +6 -2
- package/dist/dashboard/top.js +7 -9
- package/dist/dashboard/turns.js +7 -2
- package/dist/dashboard/world/lore.js +16 -15
- package/dist/dashboard/world/map.js +43 -1
- package/dist/dashboard/world/world.js +50 -15
- package/dist/dice/index.d.ts +1 -1
- package/dist/dice/oracle.d.ts +5 -3
- package/dist/dice/oracle.js +7 -6
- package/dist/extensions/extension.js +4 -1
- package/dist/helpers/codex.js +1 -1
- package/dist/packages/npm.js +17 -4
- package/dist/packages/tarball.js +8 -4
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.js +1 -1
- package/dist/pages/markdown.d.ts +2 -0
- package/dist/pages/markdown.js +21 -0
- package/dist/pages/world.js +4 -0
- package/dist/server/dashboard/index.js +8 -4
- package/dist/server/dashboard/writes.js +22 -13
- package/dist/server/mcp.d.ts +3 -1
- package/dist/server/mcp.js +20 -5
- package/dist/systems/game-system.d.ts +2 -0
- package/dist/systems/game-system.js +2 -0
- package/dist/systems/system-code.js +5 -0
- package/instructions/adventure.md +1 -1
- package/instructions/combat.md +1 -1
- package/instructions/core.md +2 -2
- package/instructions/import.md +1 -0
- package/instructions/session-zero.md +1 -1
- package/instructions/session.md +1 -1
- package/instructions/setup.md +1 -1
- package/package.json +2 -2
- package/systems/free/instructions/outcomes-rolled.md +1 -1
- package/systems/free/instructions/outcomes-tossed.md +1 -1
- package/systems/free/instructions/play.md +1 -2
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ RPG Engine is an MCP server and a command line, `rpg`, made from the same comman
|
|
|
75
75
|
|
|
76
76
|
A campaign is a folder of markdown pages with `[[links]]`, the format of Obsidian, with its settings, its state, a log of every change and its saves. It holds the secrets of your story: you never need to open it.
|
|
77
77
|
|
|
78
|
-
RPG Engine stays in that folder: it reads and writes the game only there, and never touches your other files. Outside it, it keeps only a data folder of its own (the dashboard's translations, and Codex or Claude Code if you let it install them) and temporary folders while a picture is drawn. The master plays through RPG Engine's tools; anything else your agent wants to do on your computer, it asks you first.
|
|
78
|
+
RPG Engine stays in that folder: it reads and writes the game only there, and never touches your other files. Outside it, it keeps only a data folder of its own (the dashboard's translations, and Codex or Claude Code if you let it install them) and temporary folders while a picture is drawn. The master plays through RPG Engine's tools; anything else your agent wants to do on your computer, it asks you first. A game system or an extension is code, as any npm package is: one that is not ours runs on your computer with your permissions, and RPG Engine installs it only with your yes, in a form of your agent or a window of your computer. Say yes only to packages whose authors you trust.
|
|
79
79
|
|
|
80
80
|
For developers: [the architecture](https://github.com/stefanocaronia/rpg-engine/blob/main/docs/architecture.md), [the commands](https://github.com/stefanocaronia/rpg-engine/blob/main/docs/commands.md), [game systems](https://github.com/stefanocaronia/rpg-engine/blob/main/docs/game-systems.md), [extensions](https://github.com/stefanocaronia/rpg-engine/blob/main/docs/extensions.md) and [the guide for development agents](https://github.com/stefanocaronia/rpg-engine/blob/main/AGENTS.md).
|
|
81
81
|
|
|
@@ -5,6 +5,10 @@ export function adventureFolderName(title) {
|
|
|
5
5
|
if (name === "" || isReservedName(name)) {
|
|
6
6
|
throw new Error(`The title ${title} gives no name a folder can have: give the adventure another title. Nothing changed.`);
|
|
7
7
|
}
|
|
8
|
+
// As a page's name, so that the paths of its pages stay within what Windows writes.
|
|
9
|
+
if (name.length > 120) {
|
|
10
|
+
throw new Error(`The title ${title.slice(0, 40)}… is longer than 120 characters, too long for a folder's name: give the adventure a shorter title, as the title of its adventure.yaml. Nothing changed.`);
|
|
11
|
+
}
|
|
8
12
|
return name;
|
|
9
13
|
}
|
|
10
14
|
/** Where a file of the adventure goes in the campaign (ADV-3): pages under their type's folder, the rest under a folder of the adventure's own. */
|
|
@@ -2,6 +2,7 @@ import { unzipSync, zipSync } from "fflate";
|
|
|
2
2
|
import { relative, sep } from "node:path";
|
|
3
3
|
import { archivePathParts, refuseTwice } from "../core/archive-paths.js";
|
|
4
4
|
import { filesIn } from "../core/files.js";
|
|
5
|
+
import { Refusal } from "../core/refusal.js";
|
|
5
6
|
import { files } from "../core/store.js";
|
|
6
7
|
import { manifestFileName, readManifest, writeManifest } from "./manifest.js";
|
|
7
8
|
/** The folders an adventure has, as a campaign has them (D-372). */
|
|
@@ -34,7 +35,7 @@ export function readAdventureZip(bytes, label) {
|
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
catch (error) {
|
|
37
|
-
throw new
|
|
38
|
+
throw new Refusal(`${label} is not a .zip that reads: ${error instanceof Error ? error.message : String(error)}. Nothing changed.`, "archive-unread", { name: label });
|
|
38
39
|
}
|
|
39
40
|
const named = Object.entries(read).filter(([name]) => !/[\\/]$/.test(name)).map(([name, data]) => [utf8Name(label, name), data]);
|
|
40
41
|
return adventureOf(label, named);
|
|
@@ -66,7 +67,7 @@ function utf8Name(label, name) {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
if (/[\u0080-\u009f]/.test(name)) {
|
|
69
|
-
throw new
|
|
70
|
+
throw new Refusal(`${label} names a file with accents not written in UTF-8 (${name}): make the zip again with 7-Zip, or Compress-Archive in PowerShell. Nothing changed.`, "archive-accents", { name: label });
|
|
70
71
|
}
|
|
71
72
|
return name.normalize("NFC");
|
|
72
73
|
}
|
|
@@ -80,7 +81,7 @@ function adventureOf(label, entries) {
|
|
|
80
81
|
const inner = !atTop && tops.size === 1 ? checked.map(([parts, data]) => [parts.slice(1), data]).filter(([parts]) => parts.length > 0) : checked;
|
|
81
82
|
const manifest = inner.find(([parts]) => parts.length === 1 && parts[0].toLowerCase() === manifestFileName);
|
|
82
83
|
if (manifest === undefined) {
|
|
83
|
-
throw new
|
|
84
|
+
throw new Refusal(`${label} has no ${manifestFileName} at its top: it is not an adventure. A document or a folder of notes is imported by the master, who writes its pages. Nothing changed.`, "not-adventure", { name: label });
|
|
84
85
|
}
|
|
85
86
|
const held = {};
|
|
86
87
|
const ignored = new Set();
|
|
@@ -98,8 +99,8 @@ function adventureOf(label, entries) {
|
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
101
|
if (!allowed[folder].test(path)) {
|
|
101
|
-
throw new
|
|
102
|
-
+ "Take it out, or convert it, and give it again.");
|
|
102
|
+
throw new Refusal(`${label} holds ${path}, and ${folder}/ holds only ${folder === "images" ? "pictures in .png, .jpg, .webp or .svg" : "markdown files"}: it is refused whole. `
|
|
103
|
+
+ "Take it out, or convert it, and give it again.", "adventure-file", { name: label, file: path });
|
|
103
104
|
}
|
|
104
105
|
held[[folder, ...parts.slice(1)].join("/")] = data;
|
|
105
106
|
}
|
|
@@ -22,7 +22,25 @@ export function requireCampaign(folder) {
|
|
|
22
22
|
if (root === undefined) {
|
|
23
23
|
throw new Error(`There is no campaign here: no ${campaignFileName} in ${resolve(folder)} or in the folders above it. Create one with the init command, or work from inside a campaign folder.`);
|
|
24
24
|
}
|
|
25
|
+
refuseLinksOut(root);
|
|
25
26
|
// The session of the MCP server watches the campaign from the first call that finds it (D-193).
|
|
26
27
|
files().track(root);
|
|
27
28
|
return root;
|
|
28
29
|
}
|
|
30
|
+
// The folders the engine writes in: a link among them, a junction that came with a folder someone else made, would carry its writes outside the campaign. A file
|
|
31
|
+
// that is a link the store refuses as it writes it.
|
|
32
|
+
const writtenFolders = ["world", "images", "rules", "sessions", ".saves", "exports", ".player", ".imports", ".claude", ".codex"];
|
|
33
|
+
/** Throws when a folder the engine writes in, or one in it two levels deep, is a link: a symbolic link or a junction. */
|
|
34
|
+
function refuseLinksOut(root) {
|
|
35
|
+
const store = files();
|
|
36
|
+
const folders = writtenFolders.map((name) => join(root, name));
|
|
37
|
+
const inside = (folder) => [
|
|
38
|
+
...store.links(folder).map((name) => join(folder, name)),
|
|
39
|
+
...store.entries(folder).filter((entry) => entry.isFolder).map((entry) => join(folder, entry.name)),
|
|
40
|
+
];
|
|
41
|
+
const types = folders.flatMap(inside);
|
|
42
|
+
const linked = [...folders, ...types, ...types.flatMap(inside)].find((path) => store.isLink(path));
|
|
43
|
+
if (linked !== undefined) {
|
|
44
|
+
throw new Error(`${linked} is a link to somewhere else, and what the engine writes there would leave the campaign: replace it with a real folder, with what it holds copied in.`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -168,14 +168,16 @@ function claudeSettingsFile(root, effort = chosenEffort(root)) {
|
|
|
168
168
|
const bellHook = { type: "command", command: "rpg --listen", asyncRewake: true, timeout: 86_400 };
|
|
169
169
|
/**
|
|
170
170
|
* Codex's settings for the campaign, read when the player trusts the folder: the rpg server, its tools approved and its calls waiting for the player's click
|
|
171
|
-
* as long as the server does (D-412), with Codex's own home, where its queue takes the player's sentences (D-495),
|
|
172
|
-
* written is the player's, and stays. The effort the player chose (D-462) is a key
|
|
173
|
-
*
|
|
171
|
+
* as long as the server does (D-412), with Codex's own home, where its queue takes the player's sentences (D-495), its memories and the master's reasoning
|
|
172
|
+
* off; a table already written is the player's, and stays. The effort the player chose (D-462) is a key of the top, before the first table, where Codex
|
|
173
|
+
* reads it; under a table it would belong to that table, and be ignored.
|
|
174
174
|
*/
|
|
175
175
|
function codexConfigFile(root, platform, effort = chosenEffort(root)) {
|
|
176
176
|
const path = join(root, ".codex", "config.toml");
|
|
177
177
|
const before = files().fresh(path) ?? "";
|
|
178
|
-
|
|
178
|
+
// The master's reasoning stays out of the player's sight (T-176); a value of the player's own stays.
|
|
179
|
+
const hidden = /^\s*"?hide_agent_reasoning"?\s*=/m.test(before) ? before : withTopKey(before, "hide_agent_reasoning", "true");
|
|
180
|
+
const text = effort === undefined ? hidden : withTopKey(hidden, "model_reasoning_effort", effort === "app" ? undefined : JSON.stringify(effort));
|
|
179
181
|
const server = rpgServer(platform);
|
|
180
182
|
const tables = [
|
|
181
183
|
["mcp_servers.rpg", `command = ${JSON.stringify(server.command)}\nargs = [${server.args.map((arg) => JSON.stringify(arg)).join(", ")}]\ntool_timeout_sec = 1800\ndefault_tools_approval_mode = "approve"\nenv_vars = ["CODEX_HOME"]`],
|
|
@@ -187,7 +189,7 @@ function codexConfigFile(root, platform, effort = chosenEffort(root)) {
|
|
|
187
189
|
return missing.length === 0 && text === before ? undefined : { path, text: `${parts.join("\n\n")}\n` };
|
|
188
190
|
}
|
|
189
191
|
/**
|
|
190
|
-
* A TOML text with a key of its top set to a value, before the first table, in place of the one there, quoted or not; without a value, the key taken away.
|
|
192
|
+
* A TOML text with a key of its top set to a value written as TOML, before the first table, in place of the one there, quoted or not; without a value, the key taken away.
|
|
191
193
|
* As it is when nothing changes.
|
|
192
194
|
*/
|
|
193
195
|
function withTopKey(text, key, value) {
|
|
@@ -198,7 +200,7 @@ function withTopKey(text, key, value) {
|
|
|
198
200
|
const keyLine = new RegExp(`^\\s*"?${key}"?\\s*=`);
|
|
199
201
|
const top = (firstTable === -1 ? lines : lines.slice(0, firstTable)).filter((line) => !keyLine.test(line));
|
|
200
202
|
const rest = firstTable === -1 ? [] : lines.slice(firstTable);
|
|
201
|
-
const head = [...(value === undefined ? [] : [`${key} = ${
|
|
203
|
+
const head = [...(value === undefined ? [] : [`${key} = ${value}`]), ...top].join("\n").trimEnd();
|
|
202
204
|
const joined = [head, rest.join("\n")].filter((part) => part.trim() !== "").join("\n\n");
|
|
203
205
|
return joined.trimEnd() === plain.trimEnd() ? text : joined;
|
|
204
206
|
}
|
package/dist/campaign/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createCampaign } from "./create-campaign.ts";
|
|
2
2
|
export { campaignFileName, findCampaign, houseRulesFolderName, requireCampaign } from "./find-campaign.ts";
|
|
3
3
|
export { hasCharacterAgent, hostFileNames, refreshHostFiles, writeEffortFiles } from "./host-files.ts";
|
|
4
|
-
export { type CampaignSettings, changeExtensions, changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, checkSettingName, checkSettings, clearSetting, closedSettings, companionWays, type CountedByGame, diceWays, difficulties, efforts, entrySettingNames, lethalities, listSettingNames, mapSettingNames, masterRollWays, mentorWays, missingSettings, pictureWays, preparations, proseWays, readCampaignData, readListSetting, readOneSetting, readSettings, readTextSetting, rigors, saveModes, settingMeaning, type SettingName, settingNames, setupSettingNames, storyWays, styleTextLengths, unansweredSettings, unitSystems, voiceWays, } from "./settings.ts";
|
|
4
|
+
export { type CampaignSettings, changeExtensions, changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, checkSettingName, checkSettings, clearSetting, closedSettings, companionWays, type CountedByGame, diceWays, difficulties, efforts, entrySettingNames, lethalities, listSettingNames, mapSettingNames, masterRollWays, mentorWays, missingSettings, pictureWays, preparations, proseWays, readCampaignData, readListSetting, readOneSetting, readSettings, readTextSetting, rigors, saveModes, settingDescription, settingMeaning, type SettingName, settingNames, setupSettingNames, storyWays, styleTextLengths, unansweredSettings, unitSystems, voiceWays, } from "./settings.ts";
|
|
5
5
|
export { type CampaignState, changeState, changeStateAt, readState, readStateValues } from "./state.ts";
|
package/dist/campaign/index.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
export { createCampaign } from "./create-campaign.js";
|
|
3
3
|
export { campaignFileName, findCampaign, houseRulesFolderName, requireCampaign } from "./find-campaign.js";
|
|
4
4
|
export { hasCharacterAgent, hostFileNames, refreshHostFiles, writeEffortFiles } from "./host-files.js";
|
|
5
|
-
export { changeExtensions, changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, checkSettingName, checkSettings, clearSetting, closedSettings, companionWays, diceWays, difficulties, efforts, entrySettingNames, lethalities, listSettingNames, mapSettingNames, masterRollWays, mentorWays, missingSettings, pictureWays, preparations, proseWays, readCampaignData, readListSetting, readOneSetting, readSettings, readTextSetting, rigors, saveModes, settingMeaning, settingNames, setupSettingNames, storyWays, styleTextLengths, unansweredSettings, unitSystems, voiceWays, } from "./settings.js";
|
|
5
|
+
export { changeExtensions, changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, checkSettingName, checkSettings, clearSetting, closedSettings, companionWays, diceWays, difficulties, efforts, entrySettingNames, lethalities, listSettingNames, mapSettingNames, masterRollWays, mentorWays, missingSettings, pictureWays, preparations, proseWays, readCampaignData, readListSetting, readOneSetting, readSettings, readTextSetting, rigors, saveModes, settingDescription, settingMeaning, settingNames, setupSettingNames, storyWays, styleTextLengths, unansweredSettings, unitSystems, voiceWays, } from "./settings.js";
|
|
6
6
|
export { changeState, changeStateAt, readState, readStateValues } from "./state.js";
|
|
@@ -19,6 +19,8 @@ export interface CountedByGame {
|
|
|
19
19
|
* or a value it does not take.
|
|
20
20
|
*/
|
|
21
21
|
export declare function settingMeaning(name: string, value: unknown, counted?: CountedByGame): string | undefined;
|
|
22
|
+
/** What a setting of the engine that takes one of some values is, and those values, as config gives it for that setting alone; undefined for any other. */
|
|
23
|
+
export declare function settingDescription(name: string): string | undefined;
|
|
22
24
|
export type CampaignSettings = z.infer<typeof settingsSchema>;
|
|
23
25
|
export type SettingName = keyof typeof settingsSchema.shape;
|
|
24
26
|
export declare function readSettings(root: string): CampaignSettings;
|
|
@@ -19,15 +19,15 @@ export const rigors = ["smooth", "rules", "simulation"];
|
|
|
19
19
|
const difficultyMeanings = {
|
|
20
20
|
story: "fights low, yet each asks one choice that counts; the plain approach wins at a small cost, the risk falling on goals and allies; foes naive, ignoring the place, quick to flee; "
|
|
21
21
|
+ "clues obvious, four or more; resources plentiful; random encounters rare; threat clocks slow: one of them a step every other day; you may soften your own rolls; take-backs granted whenever asked",
|
|
22
|
-
easy: "fights low to moderate; the plain approach wins at a cost; foes with simple tactics, using the plainest feature of the place;
|
|
22
|
+
easy: "fights low to moderate; the plain approach wins at a cost; foes with simple tactics, using the plainest feature of the place; clues plain; resources generous; "
|
|
23
23
|
+ "random encounters rare; threat clocks slow: one of them a step every other day; small take-backs granted gladly",
|
|
24
|
-
normal: "fights moderate to high; two to four between full rests
|
|
25
|
-
+ "foes with sensible tactics, using the place, normal morale;
|
|
24
|
+
normal: "fights moderate to high; two to four between full rests; the plain approach wins at a real cost, a good choice cheaply; "
|
|
25
|
+
+ "foes with sensible tactics, using the place, normal morale; resources standard (treasure, supplies, prices); random encounters normal; "
|
|
26
26
|
+ "threat clocks at their pace: one of them a step each day; a take-back now and then, when little hangs on it",
|
|
27
|
-
hard: "fights high and beyond; the plain approach may lose, a good choice wins at a cost; foes smart (focus, control), taking the place first, tenacious;
|
|
27
|
+
hard: "fights high and beyond; the plain approach may lose, a good choice wins at a cost; foes smart (focus, control), taking the place first, tenacious; clues subtle; "
|
|
28
28
|
+ "resources scarce; random encounters frequent; threat clocks fast: each of them a step each day; take-backs rare",
|
|
29
29
|
brutal: "fights far beyond high; the plain approach loses, only good choices win; foes optimized (prepared ground, retreats, ambushes, finishing the fallen), fanatical; "
|
|
30
|
-
+ "
|
|
30
|
+
+ "clues subtle; resources very scarce; random encounters frequent; threat clocks fast: each of them a step each day; rests at their harshest; no take-backs",
|
|
31
31
|
};
|
|
32
32
|
/** What each rigor means in play (D-42, D-263): what the master counts, which status and config give for the chosen one. */
|
|
33
33
|
const rigorMeanings = {
|
|
@@ -47,6 +47,13 @@ export function settingMeaning(name, value, counted) {
|
|
|
47
47
|
const own = Object.hasOwn(meanings, name) ? meanings[name] : undefined;
|
|
48
48
|
return typeof value === "string" && own !== undefined && Object.hasOwn(own, value) ? own[value] : undefined;
|
|
49
49
|
}
|
|
50
|
+
/** What a setting of the engine that takes one of some values is, and those values, as config gives it for that setting alone; undefined for any other. */
|
|
51
|
+
export function settingDescription(name) {
|
|
52
|
+
const shape = settingsSchema.shape;
|
|
53
|
+
const field = Object.hasOwn(shape, name) ? shape[name] : undefined;
|
|
54
|
+
const inner = field instanceof z.ZodOptional ? field.unwrap() : field;
|
|
55
|
+
return inner instanceof z.ZodEnum ? field?.description : undefined;
|
|
56
|
+
}
|
|
50
57
|
export function readSettings(root) {
|
|
51
58
|
return validateSettings(readYamlValues(join(root, campaignFileName), settingsHold));
|
|
52
59
|
}
|
package/dist/commands/advance.js
CHANGED
|
@@ -12,7 +12,7 @@ import { newDatedLogEntry, presentDate } from "./shared/time.js";
|
|
|
12
12
|
import { campaignWorld } from "./shared/world.js";
|
|
13
13
|
export const advance = defineCommand({
|
|
14
14
|
name: "advance",
|
|
15
|
-
description: "Let time pass in the story
|
|
15
|
+
description: "Let time pass in the story: by a duration or to a later game date. "
|
|
16
16
|
+ "At the first scene, set the date the game starts on with to, at the scene's hour. Time never goes back. "
|
|
17
17
|
+ "It stops at the first planned event that comes due and says how to play it; on a new day, it lists the events' clocks to move. "
|
|
18
18
|
+ 'Example: by 8h, why "a night at the inn".',
|
package/dist/commands/ask.js
CHANGED
|
@@ -56,7 +56,7 @@ export const ask = defineCommand({
|
|
|
56
56
|
+ "For a roll: the question says what is at stake either way, in about 100 characters (apps may cut it); give the checks that fit, each with its dice, "
|
|
57
57
|
+ "naming the sheet's numbers by their fields as roll does: the engine works them out, and only then the player's sheet lights that row; the player may also change their mind. "
|
|
58
58
|
+ "In a fight, each roll the player's character makes is its own ask, in the order the game's rules give them. "
|
|
59
|
-
+ "For a choice the rules or the story force (a reaction, a fork): give the answers
|
|
59
|
+
+ "For a choice the rules or the story force (a reaction, a fork): give the answers; never to offer actions, which are the player's to say. "
|
|
60
60
|
+ "square, without options, once the player says their character moves on the map of its place but not to which square: the engine moves them to the square the player touches and gives you the way. "
|
|
61
61
|
+ "recipe, without options, when change with a rest's recipe says so: the player spends their character's dice one at a time, and you get what they gave. "
|
|
62
62
|
+ "toss, without options, for one to three coins the player tosses, as roll's toss: the engine tosses them at the click, logs them as the player's roll, and gives you the faces. "
|
package/dist/commands/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { parse, stringify } from "yaml";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, checkSettingName, clearSetting, companionWays, diceWays, difficulties, efforts, entrySettingNames, lethalities, listSettingNames, mapSettingNames, masterRollWays, mentorWays, pictureWays, preparations, proseWays, readCampaignData, readSettings, readTextSetting, refreshHostFiles, requireCampaign, rigors, saveModes, settingMeaning, settingNames, setupSettingNames, storyWays, styleTextLengths, unitSystems, voiceWays, writeEffortFiles, } from "../campaign/index.js";
|
|
4
|
+
import { changeListSetting, changeListSettingToNone, changeMapSetting, changeOtherSetting, changeSetting, checkSettingName, clearSetting, companionWays, diceWays, difficulties, efforts, entrySettingNames, lethalities, listSettingNames, mapSettingNames, masterRollWays, mentorWays, pictureWays, preparations, proseWays, readCampaignData, readSettings, readTextSetting, refreshHostFiles, requireCampaign, rigors, saveModes, settingDescription, settingMeaning, settingNames, setupSettingNames, storyWays, styleTextLengths, unitSystems, voiceWays, writeEffortFiles, } from "../campaign/index.js";
|
|
5
5
|
import { engineSystemsFolder } from "../core/context.js";
|
|
6
6
|
import { appendLogEntry } from "../core/log.js";
|
|
7
7
|
import { defineCommand } from "../core/registry.js";
|
|
@@ -32,33 +32,17 @@ const counterShape = 'bulwark-dice: {max: "4 * has(features, Bulwark)"}';
|
|
|
32
32
|
export const config = defineCommand({
|
|
33
33
|
name: "config",
|
|
34
34
|
description: "Show or change the campaign settings. "
|
|
35
|
-
+ "Without a setting it shows them all and which are missing; with a setting and a value it changes
|
|
36
|
-
+ "Use it
|
|
37
|
-
+ "system
|
|
38
|
-
+ "
|
|
39
|
-
+ "
|
|
40
|
-
+ "
|
|
41
|
-
+ "
|
|
42
|
-
+ "
|
|
43
|
-
+
|
|
44
|
-
+ "
|
|
45
|
-
+ "
|
|
46
|
-
+ "Without a written world: premise (the genre, the tone, a few elements of the world and what the player enjoys most in a game, such as fights, mysteries, talk or exploring, in the player's words) and preparation (on the fly or all at the start). "
|
|
47
|
-
+ "lines (what never appears in the game) and veils (what happens only off screen) change with add and remove, or value none when the player wants none; when the player signals stop, add that content to lines. "
|
|
48
|
-
+ "mentor, how much you teach the game, out of the story: off (the story alone, answering what the player asks between brackets), "
|
|
49
|
-
+ "hints (a tip before choices that matter and when a rule slips by), tutorial (each mechanic explained the first time, a roll's whole sum, a debrief after fights). "
|
|
50
|
-
+ "learned: the mechanics you explained, by their names in the system's language. "
|
|
51
|
-
+ "How you write and build what you invent, as the player asks: prose (plain, literary, pulp, wry), story (situations, arcs, episodes, mystery), author (one whose way of writing you take), "
|
|
52
|
-
+ "style (the player's own words on how you write); none takes away an author or a style. "
|
|
53
|
-
+ "table: what you promise the player about how you play, in the words you said. "
|
|
54
|
-
+ "precedents: each ruling you made without the text, the name of the rule in the system's language first, then what you said, such as 'Poisoned: …'. "
|
|
55
|
-
+ "library: the player's own books, folders or files by their full path, which rules searches after the system: added once to this computer, with the player's yes "
|
|
56
|
-
+ "in a window of their computer, then turned on in each campaign with add and off with remove; remove with computer takes one off this computer; "
|
|
57
|
-
+ "text, or PDFs whose text can be selected, read best: a scan is read from its pictures, on Windows only, slowly. "
|
|
58
|
-
+ 'coins, for a game with money whose system does not give them: each coin with its value in the smallest coin, other names after a slash, "rare" for a coin never given as change; totals count in the first. '
|
|
59
|
-
+ "widgets: where the dashboard shows the extensions' widgets, which the player arranges in its Settings, such as value 'weather.today: side' (top, side, scene, sheet, world, journal or off); remove gives one back its extension's place. "
|
|
60
|
-
+ "The game system may add settings of its own: config lists them with what each value means; ruleset, the version of its rules, is the player's: change it only when they ask. "
|
|
61
|
-
+ "fields, tables, computed, counters and recipes add to the game system what it lacks, or change it as a house rule: the value gives entries by name, written as in system.yaml, "
|
|
35
|
+
+ "Without a setting it shows them all and which are missing; with a setting alone, that one with what it is and its values; with a value it changes it. "
|
|
36
|
+
+ "Use it in the setup, for each setting status says is missing, and whenever the player changes one. "
|
|
37
|
+
+ "system is fixed once there is a player character. lines and veils change with add and remove, or value none when the player wants none. "
|
|
38
|
+
+ "effort and ruleset are the player's: change them only when they ask. "
|
|
39
|
+
+ "library: the player's own books, folders or files by their full path, added once to this computer with the player's yes in a window of their computer, "
|
|
40
|
+
+ "then turned on in each campaign with add and off with remove; remove with computer takes one off this computer. "
|
|
41
|
+
+ "precedents: each ruling you made without the text, the rule's name in the system's language first, such as 'Poisoned: …'. learned: the mechanics you explained, by name. "
|
|
42
|
+
+ "table: what you promised the player about how you play, in the words you said. "
|
|
43
|
+
+ 'coins, when the system gives none: each coin with its value in the smallest coin, other names after a slash, "rare" for one never given as change. '
|
|
44
|
+
+ "widgets: where the dashboard shows an extension's widget, such as value 'weather.today: side'; remove gives it back its place. "
|
|
45
|
+
+ "fields, tables, computed, counters and recipes add to the game system what it lacks, or change it as a house rule: entries by name, written as in system.yaml, "
|
|
62
46
|
+ "each replacing the system's one of that name (a recipe adds to the system's); remove takes their names. status-line adds fields to the player character's line. "
|
|
63
47
|
+ "A formula with commas goes in quotes; a use's max reads what gives it, so that only who has it has it. "
|
|
64
48
|
+ `Example: setting language, value it; or setting lines, add "spiders"; or setting counters, value '${counterExample}'.`,
|
|
@@ -313,6 +297,11 @@ function configure(input, context) {
|
|
|
313
297
|
if (input.setting?.trim() === "calendar" && input.value !== undefined) {
|
|
314
298
|
replaced = [...replaced, ...campaignCalendar(root, context).problems.map((problem) => `${problem.message.replace(/\.$/, "")}: ${problem.fix ?? "fix it"}.`)];
|
|
315
299
|
}
|
|
300
|
+
// A setting asked alone comes with what it is and its values, which the description leaves to it (T-64).
|
|
301
|
+
const about = input.setting !== undefined && input.value === undefined && !listChange ? settingDescription(checkSettingName(input.setting)) : undefined;
|
|
302
|
+
if (about !== undefined) {
|
|
303
|
+
replaced = [...replaced, `${checkSettingName(input.setting ?? "")}: ${about}.`];
|
|
304
|
+
}
|
|
316
305
|
const settings = readSettings(root);
|
|
317
306
|
// Listed all together, what the campaign adds to its system only when it adds something.
|
|
318
307
|
const added = (name) => campaignDataNames.includes(name);
|
|
@@ -332,7 +321,7 @@ function configure(input, context) {
|
|
|
332
321
|
...Object.fromEntries(listed.map((name) => [name, offeredShown(root, context, name, shownValue(root, context, settings, name))])),
|
|
333
322
|
...Object.fromEntries(system.map((setting) => [setting.name, systemShownValue(root, context, setting)])),
|
|
334
323
|
},
|
|
335
|
-
note: campaignNote(root, context),
|
|
324
|
+
note: campaignNote(root, context, true),
|
|
336
325
|
replaced,
|
|
337
326
|
part,
|
|
338
327
|
};
|
|
@@ -567,7 +556,7 @@ function systemSettingResult(root, context, setting, input) {
|
|
|
567
556
|
if (setting.name === rulesetSetting && before !== undefined && comparableText(before) !== comparableText(value.value)) {
|
|
568
557
|
return {
|
|
569
558
|
settings: { [setting.name]: systemShownValue(root, context, setting) },
|
|
570
|
-
note: campaignNote(root, context),
|
|
559
|
+
note: campaignNote(root, context, true),
|
|
571
560
|
replaced: [`From now on the campaign plays the rules ${value.value}, in place of ${before}: the pages already written stay as they are.`, ...unofferedLines(root, context)],
|
|
572
561
|
};
|
|
573
562
|
}
|
|
@@ -575,12 +564,12 @@ function systemSettingResult(root, context, setting, input) {
|
|
|
575
564
|
const part = context.actor === "player" || campaignMode(root, campaignWorld(root, context)) !== "play" ? undefined : valuePart(root, context, setting.name, value.value);
|
|
576
565
|
return {
|
|
577
566
|
settings: { [setting.name]: systemShownValue(root, context, setting) },
|
|
578
|
-
note: campaignNote(root, context),
|
|
567
|
+
note: campaignNote(root, context, true),
|
|
579
568
|
replaced: unofferedLines(root, context),
|
|
580
569
|
...(part === undefined ? {} : { part }),
|
|
581
570
|
};
|
|
582
571
|
}
|
|
583
|
-
return { settings: { [setting.name]: systemShownValue(root, context, setting) }, note: campaignNote(root, context), replaced: [] };
|
|
572
|
+
return { settings: { [setting.name]: systemShownValue(root, context, setting) }, note: campaignNote(root, context, true), replaced: [] };
|
|
584
573
|
}
|
|
585
574
|
/** An engine's setting as config shows it where the game offers only some of its values (DAT-16): the one it plays alone, or missing with those it offers. */
|
|
586
575
|
function offeredShown(root, context, name, shown) {
|
|
@@ -383,7 +383,7 @@ function chatPieceText(state, piece) {
|
|
|
383
383
|
`Importing ${state.title} here in the chat, piece ${piece.number} of ${state.pieces}: write its pages with write, and add what it adds to the pages you `
|
|
384
384
|
+ `wrote before, which find shows. A picture marked [picture: name] is the file "${piece.pictures}${sep}name": give it to its page with image. ${then}`,
|
|
385
385
|
piece.instructions,
|
|
386
|
-
piece.text
|
|
386
|
+
`Piece ${piece.number} of "${state.title}", the document's own text:\n${piece.text}`,
|
|
387
387
|
].filter((part) => part !== "").join("\n\n");
|
|
388
388
|
}
|
|
389
389
|
// How long an import that nothing runs may stay still before the dashboard says it waits: a runner just started takes a moment to claim it.
|
|
@@ -41,7 +41,7 @@ export const instructions = defineCommand({
|
|
|
41
41
|
// The dashboard, where the MCP server serves one, so that the master can tell the player how to use it (D-404).
|
|
42
42
|
context.dashboard === undefined ? "" : dashboardInstructions(context.dashboard),
|
|
43
43
|
// The opening of an evening, said to the player while the master read the game, reached them (playtest 15).
|
|
44
|
-
"Now read where the game stands, writing nothing
|
|
44
|
+
"Now read where the game stands, writing nothing.",
|
|
45
45
|
];
|
|
46
46
|
return { text: parts.filter((part) => part !== "").join("\n\n") };
|
|
47
47
|
},
|
package/dist/commands/mode.js
CHANGED
|
@@ -14,7 +14,7 @@ export const mode = defineCommand({
|
|
|
14
14
|
name: "mode",
|
|
15
15
|
description: "Move the campaign to another mode: setup (the settings, out of the game), session zero (the player character and the companions, made in play) or play. "
|
|
16
16
|
+ "It refuses while that mode's checklist is incomplete, saying what is missing; otherwise it gives the new mode's instructions. "
|
|
17
|
-
+ "
|
|
17
|
+
+ "Back to session zero to make a new player character. "
|
|
18
18
|
+ 'Example: to "session zero".',
|
|
19
19
|
group: "game",
|
|
20
20
|
positionals: ["to"],
|
package/dist/commands/mood.js
CHANGED
|
@@ -18,10 +18,9 @@ const moodAdvice = {
|
|
|
18
18
|
export const mood = defineCommand({
|
|
19
19
|
name: "mood",
|
|
20
20
|
description: "Set a mood: yours as the master, which the dashboard's robot shows, or a character's when it changes for a while: the party's show on their sheets, "
|
|
21
|
-
+ "anyone else's only you see, in status.
|
|
21
|
+
+ "anyone else's only you see, in status. "
|
|
22
22
|
+ "moment: a reaction to what the player has just seen happen, what a roll decides or a bold choice, a few times a session; the dashboard already reacts to the dice's highs and lows. "
|
|
23
|
-
+ "
|
|
24
|
-
+ "Mirror the player character's mood from how the player plays them, never decide it for them. neutral takes a mood away. "
|
|
23
|
+
+ "neutral takes a mood away. "
|
|
25
24
|
+ "Example: master worried; master surprised, moment; Lena afraid.",
|
|
26
25
|
group: "game",
|
|
27
26
|
positionals: ["who", "mood"],
|
package/dist/commands/move.js
CHANGED
|
@@ -18,7 +18,7 @@ import { newDatedLogEntry } from "./shared/time.js";
|
|
|
18
18
|
import { campaignSystem, campaignWorld, missingSystemHint } from "./shared/world.js";
|
|
19
19
|
export const move = defineCommand({
|
|
20
20
|
name: "move",
|
|
21
|
-
description: "Move characters, items or places into a place, a character's inventory or an item
|
|
21
|
+
description: "Move characters, items or places into a place, a character's inventory or an item. "
|
|
22
22
|
+ "Each ends up only there, wherever it was before, and conditions such as party in [[Ossario]] fire. Time does not pass: advance does that. "
|
|
23
23
|
+ "Pieces of a stack go with from and count. Example: page [Ettore, Lena], to Ossario; or page Torch, from Ettore, to Lena, count 3.",
|
|
24
24
|
group: "game",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type Context } from "../core/context.ts";
|
|
3
|
+
import { Refusal } from "../core/refusal.ts";
|
|
3
4
|
import { type Extension } from "../extensions/index.ts";
|
|
4
5
|
import { type AdventureExported, type AdventureInstalled } from "./shared/adventures.ts";
|
|
5
6
|
type PackageResult = {
|
|
@@ -74,9 +75,8 @@ type Installed = {
|
|
|
74
75
|
issues?: string;
|
|
75
76
|
};
|
|
76
77
|
/** The player's yes to a package not ours, not given (D-478): they said no or closed the question, or no window could be shown here. */
|
|
77
|
-
export declare class YesRefused extends
|
|
78
|
-
|
|
79
|
-
constructor(message: string, code: "declined" | "no-window");
|
|
78
|
+
export declare class YesRefused extends Refusal {
|
|
79
|
+
constructor(message: string, code: "declined" | "no-window", values?: Record<string, string>);
|
|
80
80
|
}
|
|
81
81
|
/** A game system on this computer (D-485): shipped with the engine, or a package npm installed; the campaign plays one, chosen in its setup. */
|
|
82
82
|
export interface InstalledSystem {
|