rpg-engine 0.22.0 → 0.24.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 +5 -5
- package/dist/campaign/create-campaign.d.ts +6 -1
- package/dist/campaign/create-campaign.js +41 -13
- package/dist/campaign/find-campaign.d.ts +5 -0
- package/dist/campaign/find-campaign.js +20 -5
- package/dist/campaign/host-files.d.ts +14 -4
- package/dist/campaign/host-files.js +193 -36
- package/dist/campaign/index.d.ts +2 -2
- package/dist/campaign/index.js +2 -2
- package/dist/campaign/settings.d.ts +3 -3
- package/dist/campaign/settings.js +5 -4
- package/dist/cli/cli.js +28 -7
- package/dist/commands/config/config.js +1 -1
- package/dist/commands/config/dashboard.js +28 -6
- package/dist/commands/config/words.js +2 -1
- package/dist/commands/image.d.ts +3 -0
- package/dist/commands/image.js +32 -5
- package/dist/commands/import/import.d.ts +3 -1
- package/dist/commands/import/import.js +16 -3
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +21 -3
- package/dist/commands/instructions.js +1 -1
- package/dist/commands/shared/campaign/git.js +1 -1
- package/dist/commands/shared/campaign/images.js +6 -3
- package/dist/commands/shared/campaign/mode.js +1 -1
- package/dist/commands/shared/characters/voices.d.ts +2 -2
- package/dist/commands/shared/characters/voices.js +9 -6
- package/dist/commands/shared/sheet/sheet.d.ts +2 -2
- package/dist/commands/shared/sheet/sheet.js +3 -3
- package/dist/core/context.d.ts +21 -6
- package/dist/core/context.js +2 -1
- package/dist/dashboard/acts/acts.js +39 -11
- package/dist/dashboard/acts/head.js +7 -0
- package/dist/dashboard/acts/names.js +4 -2
- package/dist/dashboard/acts/sending.js +23 -22
- package/dist/dashboard/acts/sheet.js +7 -149
- package/dist/dashboard/acts/strip.js +10 -14
- package/dist/dashboard/acts/talk.js +51 -0
- package/dist/dashboard/acts/thing.js +169 -0
- package/dist/dashboard/app.js +3 -3
- package/dist/dashboard/guide/ar.md +17 -14
- package/dist/dashboard/guide/cs.md +15 -12
- package/dist/dashboard/guide/da.md +15 -12
- package/dist/dashboard/guide/de.md +14 -11
- package/dist/dashboard/guide/el.md +14 -11
- package/dist/dashboard/guide/en.md +13 -10
- package/dist/dashboard/guide/es.md +14 -11
- package/dist/dashboard/guide/fi.md +14 -11
- package/dist/dashboard/guide/fr.md +14 -11
- package/dist/dashboard/guide/he.md +14 -11
- package/dist/dashboard/guide/hi.md +14 -11
- package/dist/dashboard/guide/hu.md +14 -11
- package/dist/dashboard/guide/is.md +14 -11
- package/dist/dashboard/guide/it.md +57 -54
- package/dist/dashboard/guide/ja.md +14 -11
- package/dist/dashboard/guide/ko.md +15 -12
- package/dist/dashboard/guide/nb.md +14 -11
- package/dist/dashboard/guide/nl.md +16 -13
- package/dist/dashboard/guide/pl.md +14 -11
- package/dist/dashboard/guide/pt.md +14 -11
- package/dist/dashboard/guide/ro.md +15 -12
- package/dist/dashboard/guide/ru.md +14 -11
- package/dist/dashboard/guide/sv.md +15 -12
- package/dist/dashboard/guide/tr.md +15 -12
- package/dist/dashboard/guide/uk.md +15 -12
- package/dist/dashboard/guide/zh.md +15 -12
- package/dist/dashboard/i18n/ar.json +28 -11
- package/dist/dashboard/i18n/cs.json +28 -11
- package/dist/dashboard/i18n/da.json +28 -11
- package/dist/dashboard/i18n/de.json +28 -11
- package/dist/dashboard/i18n/el.json +28 -11
- package/dist/dashboard/i18n/es.json +28 -11
- package/dist/dashboard/i18n/fi.json +28 -11
- package/dist/dashboard/i18n/fr.json +28 -11
- package/dist/dashboard/i18n/he.json +28 -11
- package/dist/dashboard/i18n/hi.json +28 -11
- package/dist/dashboard/i18n/hu.json +28 -11
- package/dist/dashboard/i18n/is.json +28 -11
- package/dist/dashboard/i18n/it.json +104 -87
- package/dist/dashboard/i18n/ja.json +28 -11
- package/dist/dashboard/i18n/ko.json +28 -11
- package/dist/dashboard/i18n/nb.json +28 -11
- package/dist/dashboard/i18n/nl.json +28 -11
- package/dist/dashboard/i18n/pl.json +28 -11
- package/dist/dashboard/i18n/pt.json +28 -11
- package/dist/dashboard/i18n/ro.json +28 -11
- package/dist/dashboard/i18n/ru.json +28 -11
- package/dist/dashboard/i18n/sv.json +28 -11
- package/dist/dashboard/i18n/tr.json +28 -11
- package/dist/dashboard/i18n/uk.json +28 -11
- package/dist/dashboard/i18n/zh.json +28 -11
- package/dist/dashboard/packages/packages.js +1 -1
- package/dist/dashboard/parts/icons.js +2 -0
- package/dist/dashboard/parts/labels.js +2 -1
- package/dist/dashboard/parts/layout.js +34 -0
- package/dist/dashboard/parts/widgets.js +6 -2
- package/dist/dashboard/settings/language-choice.js +1 -1
- package/dist/dashboard/settings/settings.js +73 -39
- package/dist/dashboard/settings/tabs.js +14 -0
- package/dist/dashboard/sheet/sheet.js +54 -33
- package/dist/dashboard/shell/notices.js +2 -2
- package/dist/dashboard/style.css +135 -52
- package/dist/helpers/antigravity.d.ts +47 -0
- package/dist/helpers/antigravity.js +434 -0
- package/dist/helpers/briefs.d.ts +4 -0
- package/dist/helpers/briefs.js +13 -0
- package/dist/helpers/chosen.d.ts +15 -7
- package/dist/helpers/chosen.js +96 -45
- package/dist/helpers/index.d.ts +4 -2
- package/dist/helpers/index.js +6 -3
- package/dist/helpers/opencode.d.ts +13 -0
- package/dist/helpers/opencode.js +295 -0
- package/dist/helpers/programs.d.ts +8 -0
- package/dist/helpers/programs.js +35 -2
- package/dist/helpers/stop.d.ts +2 -0
- package/dist/helpers/stop.js +20 -1
- package/dist/helpers/svg.d.ts +4 -1
- package/dist/helpers/svg.js +16 -4
- package/dist/instructions/index.d.ts +4 -2
- package/dist/instructions/index.js +6 -3
- package/dist/server/approver.d.ts +4 -2
- package/dist/server/approver.js +27 -7
- package/dist/server/bell/antigravity.d.ts +15 -0
- package/dist/server/bell/antigravity.js +113 -0
- package/dist/server/bell/index.d.ts +2 -0
- package/dist/server/bell/index.js +2 -0
- package/dist/server/bell/listener.d.ts +43 -0
- package/dist/server/bell/listener.js +154 -0
- package/dist/server/dashboard/index.d.ts +10 -1
- package/dist/server/dashboard/index.js +6 -1
- package/dist/server/dashboard/news.d.ts +3 -1
- package/dist/server/dashboard/news.js +64 -10
- package/dist/server/fence.d.ts +21 -0
- package/dist/server/fence.js +69 -0
- package/dist/server/mcp.d.ts +3 -2
- package/dist/server/mcp.js +37 -7
- package/dist/server/player-acts.d.ts +21 -1
- package/dist/server/player-acts.js +39 -3
- package/dist/server/route/front.d.ts +3 -0
- package/dist/server/route/front.js +97 -0
- package/dist/server/route/index.d.ts +3 -0
- package/dist/server/route/index.js +3 -0
- package/dist/server/route/notes.d.ts +8 -0
- package/dist/server/route/notes.js +50 -0
- package/dist/server/route/router.d.ts +31 -0
- package/dist/server/route/router.js +215 -0
- package/dist/server/subagent.d.ts +4 -0
- package/dist/server/subagent.js +30 -0
- package/instructions/start.md +1 -1
- package/instructions/voices-antigravity.md +1 -0
- package/instructions/voices-codex.md +1 -0
- package/instructions/voices-opencode.md +1 -0
- package/package.json +3 -2
- package/plugins/opencode.js +174 -0
- package/dist/server/bell-listener.d.ts +0 -10
- package/dist/server/bell-listener.js +0 -52
package/dist/cli/cli.js
CHANGED
|
@@ -2,25 +2,46 @@
|
|
|
2
2
|
import { runCommandLine } from "./command-line.js";
|
|
3
3
|
const args = process.argv.slice(2);
|
|
4
4
|
// "rpg mcp" turns the process into a server for an AI host; "rpg --read-library" reads the player's books apart, as rules starts it (LIB-3); "rpg --listen"
|
|
5
|
-
// is
|
|
6
|
-
// else is a command.
|
|
7
|
-
if (args.length === 1 && args[0] === "mcp") {
|
|
5
|
+
// is the doorbell for the player's sentences on the dashboard (D-495), Claude Code's, or with its host's name another's (D-578); "rpg --approve" is
|
|
6
|
+
// Antigravity's hook that lets the rpg tools run, "rpg --fence" the hook that fences Antigravity's importer; everything else is a command.
|
|
7
|
+
if (args.length === 1 && args[0] === "mcp" && process.env.RPG_HELPER === "1") {
|
|
8
|
+
// A run of the engine's helper gets no rpg server, not even one with no tools, which would empty its host's tool cache (D-579 (1)).
|
|
9
|
+
console.error("rpg mcp: not started, this is a run of RPG Engine's own helper (RPG_HELPER=1)");
|
|
10
|
+
process.exitCode = 0;
|
|
11
|
+
}
|
|
12
|
+
else if (args.length === 1 && args[0] === "mcp") {
|
|
8
13
|
// The server and its SDK load only here: every other command starts faster without them (D-194).
|
|
9
14
|
const { startMcpServer } = await import("../server/mcp.js");
|
|
10
|
-
await
|
|
15
|
+
const { serverInput } = await import("../server/route/index.js");
|
|
16
|
+
// Outside a campaign the router serves (D-578), through children, for Antigravity's app; in one, the server as always.
|
|
17
|
+
const input = serverInput();
|
|
18
|
+
if (input !== undefined) {
|
|
19
|
+
await startMcpServer(input);
|
|
20
|
+
}
|
|
11
21
|
}
|
|
12
22
|
else if (args[0] === "--read-library") {
|
|
13
23
|
const { readLibraryHere } = await import("../commands/shared/books/library-reader.js");
|
|
14
24
|
await readLibraryHere();
|
|
15
25
|
}
|
|
16
|
-
else if (args
|
|
17
|
-
const {
|
|
18
|
-
|
|
26
|
+
else if (args[0] === "--listen" && args.length <= 2) {
|
|
27
|
+
const { listen, listeningHosts } = await import("../server/bell/index.js");
|
|
28
|
+
const host = listeningHosts.find((one) => one === (args[1] ?? "claude"));
|
|
29
|
+
if (host === undefined) {
|
|
30
|
+
console.error(`rpg --listen does not know the host ${args[1]}: give one of ${listeningHosts.join(", ")}, or none for Claude Code.`);
|
|
31
|
+
process.exitCode = 1;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
await listen(host);
|
|
35
|
+
}
|
|
19
36
|
}
|
|
20
37
|
else if (args.length === 1 && args[0] === "--approve") {
|
|
21
38
|
const { approveHere } = await import("../server/approver.js");
|
|
22
39
|
await approveHere();
|
|
23
40
|
}
|
|
41
|
+
else if (args.length === 2 && args[0] === "--fence") {
|
|
42
|
+
const { fenceHere } = await import("../server/fence.js");
|
|
43
|
+
await fenceHere(args[1]);
|
|
44
|
+
}
|
|
24
45
|
else {
|
|
25
46
|
const { output, exitCode } = await runCommandLine(args);
|
|
26
47
|
if (exitCode === 0) {
|
|
@@ -218,7 +218,7 @@ function configure(input, context) {
|
|
|
218
218
|
// The character agent written or taken away at once, not when the server starts again (D-490).
|
|
219
219
|
if (input.setting?.trim() === "voices" && input.value !== undefined) {
|
|
220
220
|
refreshHostFiles(root, hostInstructions(), context.platform);
|
|
221
|
-
replaced = [...replaced, "
|
|
221
|
+
replaced = [...replaced, "An AI app with subagents finds the character agent, or finds it gone, from the next chat."];
|
|
222
222
|
}
|
|
223
223
|
// New months may leave the day the story starts on without its month (TIM-8): said at once, not at the next date.
|
|
224
224
|
if (input.setting?.trim() === "calendar" && input.value !== undefined) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The player's settings and the setup's questions as the dashboard shows them (D-341, D-370)
|
|
2
2
|
import { customLevel, customLevels, customSettings, lastChoices, listSettingNames, readOneSetting, readSettings, setupSettingNames } from "../../campaign/index.js";
|
|
3
3
|
import { comparableText } from "../../core/text.js";
|
|
4
|
-
import { claudeSays, codexClient, codexSays } from "../../helpers/index.js";
|
|
4
|
+
import { antigravityClient, antigravitySays, claudeSays, codexClient, codexSays } from "../../helpers/index.js";
|
|
5
5
|
import { readBetweenSessions } from "../../time/index.js";
|
|
6
6
|
import { gitProblem, isCampaignRepository, isInLargerRepository } from "../shared/campaign/git.js";
|
|
7
7
|
import { heldSystemSettings, isLeading, offeredValues, playedEngineSetting } from "../shared/campaign/offers.js";
|
|
@@ -162,12 +162,16 @@ function mentorQuestion(question, game) {
|
|
|
162
162
|
}
|
|
163
163
|
// The engine's own game system, free play, without rules of its own.
|
|
164
164
|
const freePlay = "free";
|
|
165
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* Who makes the pictures as the chat in use offers it (D-572, T-251): in Codex, Codex is the chat itself, as Antigravity in Antigravity, so it is not offered,
|
|
167
|
+
* and a campaign that chose it plays chat.
|
|
168
|
+
*/
|
|
166
169
|
function makersInChat(context, setting) {
|
|
167
|
-
|
|
170
|
+
const own = { [codexClient]: "codex", [antigravityClient]: "antigravity" }[context.host?.() ?? ""];
|
|
171
|
+
if (own === undefined) {
|
|
168
172
|
return setting;
|
|
169
173
|
}
|
|
170
|
-
return { ...setting, ...(setting.value ===
|
|
174
|
+
return { ...setting, ...(setting.value === own ? { value: "chat" } : {}), choices: setting.choices?.filter((choice) => choice.value !== own) };
|
|
171
175
|
}
|
|
172
176
|
/** A player's setting as the game offers it (DAT-16): none where it plays one value alone; only the values it offers, and no value written that it does not. */
|
|
173
177
|
function offeredSetting(root, context, setting) {
|
|
@@ -187,7 +191,11 @@ const madeBy = {
|
|
|
187
191
|
Codex: "Codex makes them on this computer, from your ChatGPT plan.",
|
|
188
192
|
Claude: "Claude draws them on this computer, as vector pictures, from your Claude plan.",
|
|
189
193
|
Antigravity: "Antigravity makes them in your chat, from your Google plan.",
|
|
194
|
+
// Antigravity's agy, started apart from the chat in use (T-251).
|
|
195
|
+
AntigravityApart: "Antigravity paints them on this computer, from your Google plan.",
|
|
190
196
|
};
|
|
197
|
+
// The chat in use draws them itself, as OpenCode (D-572).
|
|
198
|
+
const drawnInChat = "{maker} draws them in your chat, as simple vector pictures, from your plan.";
|
|
191
199
|
// The master makes them with an image tool of its own, as ElevenLabs's (D-572).
|
|
192
200
|
const madeWithTool = "The master makes them with {tool}.";
|
|
193
201
|
const toolAsked = "The master asks you in the chat which tool to use.";
|
|
@@ -197,7 +205,16 @@ const madeMeanwhile = "{by} makes them meanwhile.";
|
|
|
197
205
|
// Whoever makes them, the player may give a page a picture of their own (D-572 (3)).
|
|
198
206
|
const ownPicture = "You can also give a page you see a picture of your own: with its picture button, or dropped in the campaign's inbox folder for the master.";
|
|
199
207
|
/** Every note the pictures' setting may have, which the dashboard writes in its language (D-394). */
|
|
200
|
-
export const picturesNotes = [
|
|
208
|
+
export const picturesNotes = [
|
|
209
|
+
...Object.values(madeBy),
|
|
210
|
+
drawnInChat,
|
|
211
|
+
madeWithTool,
|
|
212
|
+
toolAsked,
|
|
213
|
+
refusedNote,
|
|
214
|
+
madeMeanwhile,
|
|
215
|
+
ownPicture,
|
|
216
|
+
...[...Object.values(codexSays), ...Object.values(claudeSays), ...Object.values(antigravitySays)].map(notReadyText),
|
|
217
|
+
];
|
|
201
218
|
/**
|
|
202
219
|
* Whether this computer makes pictures, and with whose plan, in the player's words (D-308, D-390); why not and how to have them; where the maker the player
|
|
203
220
|
* chose made none and the chat in use makes them, why (D-572); nothing where no maker is asked.
|
|
@@ -222,7 +239,12 @@ function picturesReadyNote(context) {
|
|
|
222
239
|
if (ready.askTool === true) {
|
|
223
240
|
return { note: { text: toolAsked } };
|
|
224
241
|
}
|
|
225
|
-
|
|
242
|
+
if (ready.draws === true) {
|
|
243
|
+
return { note: { text: drawnInChat, values: { maker: ready.maker ?? "" } } };
|
|
244
|
+
}
|
|
245
|
+
// Antigravity makes them in its own chat, and paints them apart from any other.
|
|
246
|
+
const antigravity = context.host?.() === antigravityClient ? "Antigravity" : "AntigravityApart";
|
|
247
|
+
return { note: { text: madeBy[ready.maker === "Claude" ? "Claude" : ready.maker === "Antigravity" ? antigravity : "Codex"] } };
|
|
226
248
|
}
|
|
227
249
|
/** The pictures' note with the line that the player may give a picture of their own after it. */
|
|
228
250
|
function withOwnPicture(note) {
|
|
@@ -153,8 +153,9 @@ export const playerWords = {
|
|
|
153
153
|
about: "who makes the pictures",
|
|
154
154
|
values: pictureMakers,
|
|
155
155
|
means: {
|
|
156
|
-
chat: "your AI app, by its own means: Claude draws them as vector pictures, Codex and Antigravity paint them, each from your plan",
|
|
156
|
+
chat: "your AI app, by its own means: Claude draws them as vector pictures, Codex and Antigravity paint them, OpenCode and the other apps draw simple vector pictures in the chat, each from your plan",
|
|
157
157
|
codex: "Codex paints them on this computer, from your ChatGPT plan (Plus or higher)",
|
|
158
|
+
antigravity: "Antigravity paints them on this computer, from your Google plan (a paid one: on the free plan its image tool fails)",
|
|
158
159
|
elevenlabs: "the master makes them with ElevenLabs, connected to your AI app, from your ElevenLabs plan",
|
|
159
160
|
other: "another image tool connected to your AI app: the master asks you which in the chat",
|
|
160
161
|
},
|
package/dist/commands/image.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ interface ImageResult {
|
|
|
19
19
|
tool?: string;
|
|
20
20
|
/** The player chose another image tool and has not named it yet: the master asks which (D-572). */
|
|
21
21
|
askTool?: true;
|
|
22
|
+
/** The brief is the SVG one: the chat draws the picture itself and gives it with svg (D-572). */
|
|
23
|
+
draw?: true;
|
|
22
24
|
/** Why the chat in use made it, or makes it, in place of the maker the player chose (D-572). */
|
|
23
25
|
instead?: string;
|
|
24
26
|
}
|
|
@@ -26,6 +28,7 @@ export declare const image: import("../core/registry.ts").Command<z.ZodObject<{
|
|
|
26
28
|
page: z.ZodString;
|
|
27
29
|
file: z.ZodOptional<z.ZodString>;
|
|
28
30
|
url: z.ZodOptional<z.ZodString>;
|
|
31
|
+
svg: z.ZodOptional<z.ZodString>;
|
|
29
32
|
describe: z.ZodOptional<z.ZodString>;
|
|
30
33
|
}, z.core.$strip>, ImageResult>;
|
|
31
34
|
/** 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. */
|
package/dist/commands/image.js
CHANGED
|
@@ -5,6 +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 { cleanSvg, svgIn } from "../helpers/index.js";
|
|
8
9
|
import { imageFileName, imageLink, imageOfBytes, imagesFolderName, largestImage, readImage } from "../images/index.js";
|
|
9
10
|
import { baseChain, findPage, isPartyMember, ownField, pageNamed, parsePageReference, writePage } from "../pages/index.js";
|
|
10
11
|
import { imageFile, ownImage } from "./shared/campaign/images.js";
|
|
@@ -17,7 +18,8 @@ export const image = defineCommand({
|
|
|
17
18
|
name: "image",
|
|
18
19
|
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
20
|
+ "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 one with your own tools: its file,
|
|
21
|
+
+ "Use it when the player gives you a picture, or after you made one with your own tools: its file, url with the https address your tool gives, which the engine downloads, "
|
|
22
|
+
+ "or svg with the code you drew. "
|
|
21
23
|
+ "The player may drop pictures in the campaign's inbox folder: ask what each is for, give it, then delete it from the inbox. "
|
|
22
24
|
+ "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: "
|
|
23
25
|
+ "for the player character or a companion only when the player asks; for a creature once for each kind, whose copies show it. "
|
|
@@ -28,6 +30,7 @@ export const image = defineCommand({
|
|
|
28
30
|
page: z.string().describe("the page that gets the picture"),
|
|
29
31
|
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"),
|
|
30
32
|
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"),
|
|
33
|
+
svg: z.string().optional().describe("instead of file, the picture's SVG code, from <svg to </svg>, as you drew it from the brief image gave you: the engine cleans it and keeps it"),
|
|
31
34
|
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; "
|
|
32
35
|
+ "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, "
|
|
33
36
|
+ "a disguise as the disguise; never what the character does not know. The picture is made where it can be, and comes by itself"),
|
|
@@ -44,6 +47,13 @@ export const image = defineCommand({
|
|
|
44
47
|
}
|
|
45
48
|
const url = input.url?.trim() ?? "";
|
|
46
49
|
const file = input.file?.trim() ?? "";
|
|
50
|
+
const svg = input.svg?.trim() ?? "";
|
|
51
|
+
if (svg !== "") {
|
|
52
|
+
if (file !== "" || url !== "" || (input.describe ?? "").trim() !== "") {
|
|
53
|
+
throw new Error("Give svg alone: it is the picture you drew, and file, url and describe are other ways to give one. Nothing changed.");
|
|
54
|
+
}
|
|
55
|
+
return drawnImage(root, context, world, page, svg);
|
|
56
|
+
}
|
|
47
57
|
if (input.describe !== undefined && input.describe.trim() !== "") {
|
|
48
58
|
if (file !== "" || url !== "") {
|
|
49
59
|
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.");
|
|
@@ -63,7 +73,7 @@ export const image = defineCommand({
|
|
|
63
73
|
},
|
|
64
74
|
format(result) {
|
|
65
75
|
if (result.paint !== undefined) {
|
|
66
|
-
const how = result.askTool === true ? askToolText(result.page) : paintText(result.page, result.tool);
|
|
76
|
+
const how = result.draw === true ? drawText(result.page) : result.askTool === true ? askToolText(result.page) : paintText(result.page, result.tool);
|
|
67
77
|
return `${result.instead === undefined ? "" : `${result.instead} `}${how}\n\n${result.paint}`;
|
|
68
78
|
}
|
|
69
79
|
if (result.making === true) {
|
|
@@ -99,6 +109,19 @@ async function downloadedImage(root, context, world, page, url) {
|
|
|
99
109
|
});
|
|
100
110
|
return placeImage(root, context, world, page, imageOfBytes(bytes, "What the address gave"));
|
|
101
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* The picture the chat drew as SVG code (D-572), as OpenCode's, whose own writing is denied in a campaign: cleaned as Claude's drawing is, then taken as a file
|
|
114
|
+
* is; refused with how to draw it again when nothing usable is left.
|
|
115
|
+
*/
|
|
116
|
+
function drawnImage(root, context, world, page, code) {
|
|
117
|
+
const drawn = svgIn(code);
|
|
118
|
+
const clean = drawn === undefined ? undefined : cleanSvg(drawn);
|
|
119
|
+
if (clean === undefined) {
|
|
120
|
+
throw new Error("svg takes the picture's SVG code, and this is none the engine can use, or nothing in it could be kept: give one <svg> root that closes, under 100 KB, with at least one shape "
|
|
121
|
+
+ "and only shapes, groups, gradients, masks and blur, no text, script, style or image; draw it again so, or go on without. Nothing changed.");
|
|
122
|
+
}
|
|
123
|
+
return placeImage(root, context, world, page, imageOfBytes(Buffer.from(clean), "The SVG"));
|
|
124
|
+
}
|
|
102
125
|
/** 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. */
|
|
103
126
|
export function placeImage(root, context, world, page, picture, from) {
|
|
104
127
|
if ("problem" in picture) {
|
|
@@ -166,7 +189,7 @@ function madePicture(root, context, world, page, seen) {
|
|
|
166
189
|
// The chat paints it itself, with its own tool or one it names.
|
|
167
190
|
if (paint !== undefined) {
|
|
168
191
|
const instead = ready.instead === undefined ? {} : { instead: insteadText(page.name, ready.instead, false) };
|
|
169
|
-
const tool = ready.askTool === true ? { askTool: true } : ready.tool === undefined ? {} : { tool: ready.tool };
|
|
192
|
+
const tool = ready.draws === true ? { draw: true } : ready.askTool === true ? { askTool: true } : ready.tool === undefined ? {} : { tool: ready.tool };
|
|
170
193
|
return { page: page.name, changed: false, paint, ...tool, ...instead };
|
|
171
194
|
}
|
|
172
195
|
const making = context.pictures.make(subject).then((made) => {
|
|
@@ -177,7 +200,7 @@ function madePicture(root, context, world, page, seen) {
|
|
|
177
200
|
try {
|
|
178
201
|
const world = campaignWorld(root, context);
|
|
179
202
|
const now = world.pages.find((candidate) => candidate.path === page.path) ?? page;
|
|
180
|
-
//
|
|
203
|
+
// The maker's own copy goes once copied, by its real format's extension: the picture is the campaign's.
|
|
181
204
|
return { ...setImage(root, context, world, now, made.file), from: undefined, ...(made.instead === undefined ? {} : { instead: insteadText(page.name, made.instead, true) }) };
|
|
182
205
|
}
|
|
183
206
|
finally {
|
|
@@ -204,7 +227,7 @@ function insteadText(name, instead, made) {
|
|
|
204
227
|
function paintText(page, tool) {
|
|
205
228
|
const give = giveText(page);
|
|
206
229
|
if (tool === undefined) {
|
|
207
|
-
return `Make ${page}'s picture yourself with your own image tool, from this brief, then ${give}; if your tool makes none, go on without.`;
|
|
230
|
+
return `Make ${page}'s picture yourself with your own image tool, from this brief, then ${give}; if your tool makes none, draw it as the brief's last line says, or go on without.`;
|
|
208
231
|
}
|
|
209
232
|
if (tool === "ElevenLabs") {
|
|
210
233
|
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: `
|
|
@@ -213,6 +236,10 @@ function paintText(page, tool) {
|
|
|
213
236
|
}
|
|
214
237
|
return `Make ${page}'s picture with ${tool}, from this brief, then ${give}; if it makes none, tell the player why and go on without.`;
|
|
215
238
|
}
|
|
239
|
+
/** How the master of a chat that draws itself makes a picture (D-572): as SVG code, from the brief, given back with svg. */
|
|
240
|
+
function drawText(page) {
|
|
241
|
+
return `Draw ${page}'s picture yourself as SVG code, from this brief, then give it with image, page ${page}, svg and the code; if you cannot, go on without.`;
|
|
242
|
+
}
|
|
216
243
|
/** 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. */
|
|
217
244
|
function askToolText(page) {
|
|
218
245
|
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 `
|
|
@@ -22,7 +22,9 @@ interface ImportResult {
|
|
|
22
22
|
/** How many of the document's pages were read from their pictures, as it started (LIB-4). */
|
|
23
23
|
recognized?: number;
|
|
24
24
|
/** Begun now by a helper, named when known: the player hears whose plan reads the document, and under whose terms (D-493). */
|
|
25
|
-
helper?: "Claude Code" | "Codex" | "a helper";
|
|
25
|
+
helper?: "Claude Code" | "Codex" | "OpenCode" | "Antigravity" | "a helper";
|
|
26
|
+
/** The model the helper reads with, where the player chose it in it, as in OpenCode, which may be paid by the call. */
|
|
27
|
+
helperModel?: string;
|
|
26
28
|
}
|
|
27
29
|
export declare const importCommand: import("../../core/registry.ts").Command<z.ZodObject<{
|
|
28
30
|
document: z.ZodOptional<z.ZodString>;
|
|
@@ -47,6 +47,8 @@ export const importCommand = defineCommand({
|
|
|
47
47
|
}
|
|
48
48
|
await stopRunner(open.folder);
|
|
49
49
|
await stopImport(open.folder);
|
|
50
|
+
// The runner killed left its helper's leftovers, which no finally of its took away.
|
|
51
|
+
context.reader?.clean?.();
|
|
50
52
|
dropImport(open.folder);
|
|
51
53
|
appendLogEntry(root, newDatedLogEntry(root, context, "import-cancelled", "hidden", { title: open.state.title }));
|
|
52
54
|
return { ...resultOf(root, open.folder, open.state), cancelled: true };
|
|
@@ -81,7 +83,7 @@ export const importCommand = defineCommand({
|
|
|
81
83
|
return resultOf(root, open.folder, readImportState(open.folder) ?? open.state);
|
|
82
84
|
},
|
|
83
85
|
// A document read from its pictures is told first, for the master to tell the player before anything else (LIB-4).
|
|
84
|
-
format: (result) => [recognizedText(result.recognized), helperText(result.helper), importText(result)].filter((part) => part !== "").join("\n\n"),
|
|
86
|
+
format: (result) => [recognizedText(result.recognized), helperText(result.helper, result.helperModel), importText(result)].filter((part) => part !== "").join("\n\n"),
|
|
85
87
|
});
|
|
86
88
|
/** The import under way as the dashboard tells it, if one is: from the document being opened to the world being written. */
|
|
87
89
|
export function importShown(root) {
|
|
@@ -221,11 +223,12 @@ async function startImport(root, context, document, title) {
|
|
|
221
223
|
}
|
|
222
224
|
// Asked before the reading, which a program that stops being ready would change.
|
|
223
225
|
const program = context.reader?.program?.() ?? "a helper";
|
|
226
|
+
const model = context.reader?.model?.();
|
|
224
227
|
const going = goOn(root, context, folder);
|
|
225
228
|
if (context.files === undefined) {
|
|
226
229
|
await going;
|
|
227
230
|
}
|
|
228
|
-
return { ...resultOf(root, folder, readImportState(folder) ?? state), pictures: text.pictures.length, ...recognized, helper: program };
|
|
231
|
+
return { ...resultOf(root, folder, readImportState(folder) ?? state), pictures: text.pictures.length, ...recognized, helper: program, ...(model === undefined ? {} : { helperModel: model }) };
|
|
229
232
|
}
|
|
230
233
|
/** Whether what was given as a document is an adventure made already: a folder with adventure.yaml, or a .zip that holds one, which package install reads and checks. */
|
|
231
234
|
function isAdventure(path, found) {
|
|
@@ -370,10 +373,20 @@ function recognizedText(recognized) {
|
|
|
370
373
|
+ "selected, reads better.";
|
|
371
374
|
}
|
|
372
375
|
/** Whose plan reads the document, and under whose terms it goes out (D-493): said once, as a helper begins it. */
|
|
373
|
-
function helperText(helper) {
|
|
376
|
+
function helperText(helper, model) {
|
|
374
377
|
if (helper === undefined) {
|
|
375
378
|
return "";
|
|
376
379
|
}
|
|
380
|
+
// OpenCode reads with the model the player chose in it, whose maker is the one the document goes to; named, as it may be paid by the call.
|
|
381
|
+
if (helper === "OpenCode") {
|
|
382
|
+
const which = model === undefined ? "with the model they last chose in it" : `with its model ${model}`;
|
|
383
|
+
return `Tell the player in a few words that their own OpenCode reads it, ${which} and on its plan or price, and that the whole document `
|
|
384
|
+
+ "goes to that model's provider, or stays on their computer with a local model, under the terms of their account, its choice on training included.";
|
|
385
|
+
}
|
|
386
|
+
if (helper === "Antigravity") {
|
|
387
|
+
return "Tell the player in a few words that their own Antigravity reads it, on their Google account's plan, whose quota it uses, and that the whole document "
|
|
388
|
+
+ "goes to Google under the terms of that account.";
|
|
389
|
+
}
|
|
377
390
|
const [program, company] = helper === "Codex" ? ["Codex", "OpenAI"] : helper === "Claude Code" ? ["Claude Code", "Anthropic"] : ["Claude Code or Codex", "Anthropic or OpenAI"];
|
|
378
391
|
return `Tell the player in a few words that their own ${program} reads it, on their plan and its limits, and that the whole document goes to ${company} `
|
|
379
392
|
+ "under the terms of their account, its choice on training included.";
|
package/dist/commands/init.d.ts
CHANGED
package/dist/commands/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { basename, resolve } from "node:path";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { createCampaign, difficulties, lethalities, rememberChoice } from "../campaign/index.js";
|
|
3
|
+
import { createCampaign, difficulties, findCampaign, lethalities, refreshUserHostFiles, rememberChoice, updateHostFiles } from "../campaign/index.js";
|
|
4
4
|
import { appendLogEntry, newLogEntry } from "../core/log.js";
|
|
5
5
|
import { defineCommand } from "../core/registry.js";
|
|
6
6
|
import { hostInstructions } from "../instructions/index.js";
|
|
@@ -11,6 +11,7 @@ export const init = defineCommand({
|
|
|
11
11
|
name: "init",
|
|
12
12
|
description: "Create a new campaign. "
|
|
13
13
|
+ "It writes the settings, the log, the world's folders, and the .mcp.json, AGENTS.md and CLAUDE.md through which an AI host finds these tools. "
|
|
14
|
+
+ "Given the folder of a campaign that exists, it only brings those files up to date. "
|
|
14
15
|
+ "Use it once, when the player starts a new campaign, with master true when you, the AI, create it: the answer then says what is still to agree with the player, to set with config. "
|
|
15
16
|
+ 'Example: name "The Salt Isles", language en.',
|
|
16
17
|
group: "campaign",
|
|
@@ -26,23 +27,40 @@ export const init = defineCommand({
|
|
|
26
27
|
}),
|
|
27
28
|
run(input, context) {
|
|
28
29
|
const folder = resolve(context.folder, input.folder ?? ".");
|
|
30
|
+
// A campaign that exists keeps its settings: only the files through which the hosts find it are brought up to date.
|
|
31
|
+
if (findCampaign(folder) === folder) {
|
|
32
|
+
updateHostFiles(folder, context.platform, hostInstructions());
|
|
33
|
+
return { root: folder, name: "", note: "", already: true, app: refreshUserFiles(context) };
|
|
34
|
+
}
|
|
29
35
|
// Only an installed system (D-167), as it is installed.
|
|
30
36
|
const system = input.system === undefined ? undefined : installedSystemName(input.system, context, "init");
|
|
31
37
|
const settings = { name: input.name ?? basename(folder), language: input.language, system, difficulty: input.difficulty, lethality: input.lethality };
|
|
32
38
|
const root = createCampaign(folder, settings, context.platform, hostInstructions());
|
|
33
39
|
createWorld(root);
|
|
34
40
|
appendLogEntry(root, newLogEntry(context, "campaign-created", "public", settings));
|
|
41
|
+
const app = refreshUserFiles(context);
|
|
35
42
|
// What the next campaign's setup suggests (T-134).
|
|
36
43
|
rememberChoice(context.home, root, "difficulty", settings.difficulty);
|
|
37
44
|
rememberChoice(context.home, root, "lethality", settings.lethality);
|
|
38
|
-
return { root, name: settings.name, note: input.master === true ? campaignNote(root, context) : "" };
|
|
45
|
+
return { root, name: settings.name, note: input.master === true ? campaignNote(root, context) : "", already: false, app };
|
|
39
46
|
},
|
|
40
47
|
// 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
48
|
format(result) {
|
|
49
|
+
// Antigravity's own settings, outside the campaign, said apart when they could not be written.
|
|
50
|
+
const app = result.app === undefined ? [] : [result.app];
|
|
51
|
+
if (result.already) {
|
|
52
|
+
// What could not be written is outside the folder: the line says only what is true.
|
|
53
|
+
return [`${result.root} is already a campaign: its files for Claude Code, Codex, Antigravity and OpenCode${app.length > 0 ? " in this folder" : ""} are up to date.`, ...app].join("\n");
|
|
54
|
+
}
|
|
42
55
|
return [
|
|
43
56
|
`Created the campaign "${result.name}" in ${result.root}.`,
|
|
44
|
-
"To play, open Claude Code, Codex or
|
|
57
|
+
"To play, open Claude Code, Codex, Antigravity or OpenCode in this folder and say hello: the master asks you the rest.",
|
|
58
|
+
...app,
|
|
45
59
|
...(result.note === "" ? [] : ["", `For the master: ${result.note}`]),
|
|
46
60
|
].join("\n");
|
|
47
61
|
},
|
|
48
62
|
});
|
|
63
|
+
/** The engine's files in the player's home, as Antigravity's app reads them (D-578), and what could not be written; none where the context has no home, as in the tests. */
|
|
64
|
+
function refreshUserFiles(context) {
|
|
65
|
+
return context.userHome === undefined ? undefined : refreshUserHostFiles(context.userHome, context.platform);
|
|
66
|
+
}
|
|
@@ -85,7 +85,7 @@ function partyText(folder, context) {
|
|
|
85
85
|
return "";
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
/** When and how to call the character agent (D-490): in play, in
|
|
88
|
+
/** When and how to call the character agent (D-490): in play, in an AI app with subagents, when the chat has it as an agent of the campaign; none elsewhere. */
|
|
89
89
|
function voicesText(folder, context) {
|
|
90
90
|
const root = findCampaign(folder);
|
|
91
91
|
try {
|
|
@@ -55,7 +55,7 @@ const problems = new Map();
|
|
|
55
55
|
/** What the engine writes again whenever it likes, or the player keeps on this computer alone: never in the repository. */
|
|
56
56
|
function alwaysIgnored() {
|
|
57
57
|
// .gemini/ of the campaigns made before D-493, which it leaves on the disk.
|
|
58
|
-
return [".agents/", ".claude/", ".codex/", ".gemini/", ".mcp.json", ...hostFileNames, `${inboxFolderName}/`, `${exportsFolderName}/`, `${importsFolderName}/`, installMarkName, `${savesFolderName}/*.txt`, portFileName];
|
|
58
|
+
return [".agents/", ".claude/", ".codex/", ".gemini/", ".opencode/", ".mcp.json", ...hostFileNames, `${inboxFolderName}/`, `${exportsFolderName}/`, `${importsFolderName}/`, installMarkName, `${savesFolderName}/*.txt`, portFileName];
|
|
59
59
|
}
|
|
60
60
|
function pushesTo(root) {
|
|
61
61
|
try {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { basename } from "node:path";
|
|
3
3
|
import { readSettings } from "../../../campaign/index.js";
|
|
4
4
|
import { files } from "../../../core/store.js";
|
|
5
|
+
import { antigravityClient } from "../../../helpers/index.js";
|
|
5
6
|
import { findImage, imageFileName } from "../../../images/index.js";
|
|
6
7
|
import { baseChain, isPartyMember, ownField } from "../../../pages/index.js";
|
|
7
8
|
import { systemContentFolders } from "../../../systems/index.js";
|
|
@@ -21,9 +22,11 @@ export function picturesNote(root, context, world, place) {
|
|
|
21
22
|
? `you can make the pictures of places, quests and those met with ${ready.tool}`
|
|
22
23
|
: ready.askTool === true
|
|
23
24
|
? "you can make the pictures of places, quests and those met with the image tool the player names"
|
|
24
|
-
: ready.
|
|
25
|
-
? "you can
|
|
26
|
-
:
|
|
25
|
+
: ready.draws === true
|
|
26
|
+
? "you can draw the pictures of places, quests and those met yourself, as simple vector pictures"
|
|
27
|
+
: ready.maker === "Antigravity" && context.host?.() === antigravityClient
|
|
28
|
+
? "you can make the pictures of places, quests and those met with your own image tool"
|
|
29
|
+
: `this computer can make the pictures of places, quests and those met with the player's ${ready.maker === "Claude" ? "Claude Code" : ready.maker === "Antigravity" ? "Antigravity" : "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).`
|
|
27
30
|
: undefined;
|
|
28
31
|
}
|
|
29
32
|
if (setting !== "new elements" || place === undefined || place.type !== "place" || shownImage(root, context, world, place) !== undefined) {
|
|
@@ -29,7 +29,7 @@ const settingLabels = {
|
|
|
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
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)",
|
|
32
|
+
"pictures-by": "pictures-by (who makes them: chat, your app by its own means; codex; antigravity; elevenlabs; other, a tool the player names, written by its name; suggest chat)",
|
|
33
33
|
lines: 'lines ("none" is an answer)',
|
|
34
34
|
veils: 'veils ("none" is an answer)',
|
|
35
35
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from "../../../core/context.ts";
|
|
2
|
-
/** Whether the character agent voices the characters (D-490): in
|
|
2
|
+
/** Whether the character agent voices the characters (D-490, D-580): in a host that has agents, in a chat that has it, unless the master voices every character. */
|
|
3
3
|
export declare function agentVoices(root: string, context: Context): boolean;
|
|
4
|
-
/** The part Voices, when and how to call the character agent, for a campaign in play; none where the agent does not voice the characters. */
|
|
4
|
+
/** The part Voices, when and how to call the character agent, for a campaign in play, with the host's own way of calling it; none where the agent does not voice the characters. */
|
|
5
5
|
export declare function voicesPart(root: string, context: Context): string;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
// Who voices the characters (D-490): the character agent, where the chat has it, or the master.
|
|
2
2
|
import { readSettings } from "../../../campaign/index.js";
|
|
3
|
+
import { antigravityClient, codexClient, openCodeClient } from "../../../helpers/index.js";
|
|
3
4
|
import { voicesInstructions } from "../../../instructions/index.js";
|
|
4
|
-
// The
|
|
5
|
-
const
|
|
6
|
-
/** Whether the character agent voices the characters (D-490): in
|
|
5
|
+
// The hosts whose campaign has the character agent as an agent (D-490, D-580), by the names they give themselves to the MCP server.
|
|
6
|
+
const agentHosts = { "claude-code": "claudeCode", [openCodeClient]: "openCode", [codexClient]: "codex", [antigravityClient]: "antigravity" };
|
|
7
|
+
/** Whether the character agent voices the characters (D-490, D-580): in a host that has agents, in a chat that has it, unless the master voices every character. */
|
|
7
8
|
export function agentVoices(root, context) {
|
|
8
|
-
|
|
9
|
+
const host = agentHosts[context.host?.() ?? ""];
|
|
10
|
+
return host !== undefined && context.characterAgents?.[host] === true && readSettings(root).voices !== "master";
|
|
9
11
|
}
|
|
10
|
-
/** The part Voices, when and how to call the character agent, for a campaign in play; none where the agent does not voice the characters. */
|
|
12
|
+
/** The part Voices, when and how to call the character agent, for a campaign in play, with the host's own way of calling it; none where the agent does not voice the characters. */
|
|
11
13
|
export function voicesPart(root, context) {
|
|
12
|
-
|
|
14
|
+
const host = agentHosts[context.host?.() ?? ""];
|
|
15
|
+
return host !== undefined && agentVoices(root, context) ? voicesInstructions(readSettings(root).voices ?? "auto", host) : "";
|
|
13
16
|
}
|
|
@@ -139,8 +139,8 @@ export declare function sheetHeadline(world: World, system: GameSystem | undefin
|
|
|
139
139
|
*/
|
|
140
140
|
export declare function statBlock(world: World, system: GameSystem | undefined, page: Page): SheetGroupData[];
|
|
141
141
|
/**
|
|
142
|
-
* What a thing's page says of it as data, for its card on the dashboard (D-573): the fields the system declares, of its own and of the
|
|
143
|
-
* as damage and weight; never the formulas it gives who holds it, as an attack, nor a bonus of 0. None for
|
|
142
|
+
* What a thing's or a topic's page says of it as data, for its card on the dashboard (D-573, D-581): the fields the system declares, of its own and of the
|
|
143
|
+
* pages it derives from, as damage and weight or a spell's range; never the formulas it gives who holds it, as an attack, nor a bonus of 0. None for any other page.
|
|
144
144
|
*/
|
|
145
145
|
export declare function thingBlock(world: World, system: GameSystem | undefined, page: Page): SheetGroupData[];
|
|
146
146
|
/** "Abilities: str 14 (+2) · dex 12 (+1)…": the sheet as the chat gives it, a line for each group. */
|
|
@@ -188,11 +188,11 @@ export function statBlock(world, system, page) {
|
|
|
188
188
|
return values.length === 0 ? [] : [{ name: creature.name, values }];
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
|
-
* What a thing's page says of it as data, for its card on the dashboard (D-573): the fields the system declares, of its own and of the
|
|
192
|
-
* as damage and weight; never the formulas it gives who holds it, as an attack, nor a bonus of 0. None for
|
|
191
|
+
* What a thing's or a topic's page says of it as data, for its card on the dashboard (D-573, D-581): the fields the system declares, of its own and of the
|
|
192
|
+
* pages it derives from, as damage and weight or a spell's range; never the formulas it gives who holds it, as an attack, nor a bonus of 0. None for any other page.
|
|
193
193
|
*/
|
|
194
194
|
export function thingBlock(world, system, page) {
|
|
195
|
-
if (system === undefined || page.type !== "item") {
|
|
195
|
+
if (system === undefined || (page.type !== "item" && page.type !== "topic")) {
|
|
196
196
|
return [];
|
|
197
197
|
}
|
|
198
198
|
const fields = effectiveFields(world, page);
|
package/dist/core/context.d.ts
CHANGED
|
@@ -61,8 +61,13 @@ export interface Context {
|
|
|
61
61
|
files?: FileStore;
|
|
62
62
|
/** The parts of the instructions already given in this chat, which the MCP server keeps until instructions starts over (D-97); without it, every call gives them. */
|
|
63
63
|
told?: Set<string>;
|
|
64
|
-
/** Whether the
|
|
65
|
-
|
|
64
|
+
/** Whether the campaign had the character agent as the MCP server started, in each host that has agents (D-490, D-580): the chat of that host then gets Voices. */
|
|
65
|
+
characterAgents?: {
|
|
66
|
+
claudeCode?: boolean;
|
|
67
|
+
openCode?: boolean;
|
|
68
|
+
codex?: boolean;
|
|
69
|
+
antigravity?: boolean;
|
|
70
|
+
};
|
|
66
71
|
/** The link of the player's dashboard, when the MCP server serves one (D-270); status gives it. */
|
|
67
72
|
dashboard?: string;
|
|
68
73
|
/** Whether another chat of the campaign, still open, serves the dashboard at that link, which this chat takes over once it closes (D-577). */
|
|
@@ -79,7 +84,7 @@ export interface Context {
|
|
|
79
84
|
pictures?: PictureMaker;
|
|
80
85
|
/** Lines for the master's next call, as of a picture that came after its call answered (D-572); MCP only. */
|
|
81
86
|
later?: LaterLines;
|
|
82
|
-
/** What writes text from a brief on this computer, outside the chat, as Codex or Claude Code with the player's login (D-406); missing where none can. */
|
|
87
|
+
/** What writes text from a brief on this computer, outside the chat, as Codex or Claude Code with the player's login, or OpenCode in its own chat (D-406); missing where none can. */
|
|
83
88
|
writer?: TextWriter;
|
|
84
89
|
/** A game system's pages translated on this computer as a player first reads them, where the system has no translation of its own (D-539); missing elsewhere. */
|
|
85
90
|
texts?: SystemTexts;
|
|
@@ -98,6 +103,8 @@ export interface Context {
|
|
|
98
103
|
importRunner?: (root: string) => void;
|
|
99
104
|
/** The folder of this player's data on this computer, apart from any campaign: the page's words translated on the fly (D-406). */
|
|
100
105
|
home?: string;
|
|
106
|
+
/** The user's own home on this computer, where an AI app keeps its settings for every folder, as Antigravity's (D-578); missing in tests. */
|
|
107
|
+
userHome?: string;
|
|
101
108
|
/** The folder of the dashboard's built page, whose i18n/ lists every phrase it has (D-423). */
|
|
102
109
|
pageFolder?: string;
|
|
103
110
|
/** Codex and Claude Code on this computer, installed and signed in with the player's yes (D-424); missing outside the MCP server, as in tests. */
|
|
@@ -223,11 +230,12 @@ export type HelperLogin = {
|
|
|
223
230
|
};
|
|
224
231
|
/**
|
|
225
232
|
* The chat of an MCP server, kept across its calls: the master's calls running now, the Codex thread of the last one, and what the dashboard does as each
|
|
226
|
-
* ends (D-495); whether status has already had the master offer the dashboard, as its first does (D-353).
|
|
233
|
+
* begins and ends (D-495); whether status has already had the master offer the dashboard, as its first does (D-353).
|
|
227
234
|
*/
|
|
228
235
|
export interface ChatState {
|
|
229
236
|
calls: number;
|
|
230
237
|
thread?: string;
|
|
238
|
+
beforeCall?: () => void;
|
|
231
239
|
afterCall?: () => void;
|
|
232
240
|
dashboardOffered?: boolean;
|
|
233
241
|
}
|
|
@@ -248,7 +256,11 @@ export interface TextWriter {
|
|
|
248
256
|
export interface DocumentReader {
|
|
249
257
|
ready(): boolean;
|
|
250
258
|
/** The program that would read now, which the player is told the document goes to (D-493). */
|
|
251
|
-
program?(): "Claude Code" | "Codex" | undefined;
|
|
259
|
+
program?(): "Claude Code" | "Codex" | "OpenCode" | "Antigravity" | undefined;
|
|
260
|
+
/** The model it reads with, where the player chose it in the program, as in OpenCode, which may be paid by the call. */
|
|
261
|
+
model?(): string | undefined;
|
|
262
|
+
/** Takes away what a run stopped from outside left, as the importer's own process killed by a cancel. */
|
|
263
|
+
clean?(): void;
|
|
252
264
|
/** One run: the brief on its input, reading only in `folder` and writing only in its `writable` subfolders; its last words, or why it stopped. Stopped by `signal`. */
|
|
253
265
|
read(folder: string, brief: string, writable: string[], signal?: AbortSignal): Promise<{
|
|
254
266
|
said: string;
|
|
@@ -259,13 +271,14 @@ export interface DocumentReader {
|
|
|
259
271
|
/**
|
|
260
272
|
* Whether pictures can be made here, or why not, in words the master can tell the player, and in the player's own with the steps to have them, one a line,
|
|
261
273
|
* numbered, with the commands between backticks (D-341). Ready, who makes them, as Codex, Claude or Antigravity, and the master's own image tool it names, as
|
|
262
|
-
* ElevenLabs, or that the player is to name it (D-572).
|
|
274
|
+
* ElevenLabs, or that the player is to name it, or that the chat draws them itself as SVG code (D-572).
|
|
263
275
|
*/
|
|
264
276
|
export type PicturesReady = {
|
|
265
277
|
ready: true;
|
|
266
278
|
maker?: string;
|
|
267
279
|
tool?: string;
|
|
268
280
|
askTool?: true;
|
|
281
|
+
draws?: true;
|
|
269
282
|
instead?: PictureFallback;
|
|
270
283
|
} | {
|
|
271
284
|
ready: false;
|
|
@@ -406,3 +419,5 @@ export declare function defaultContext(folder?: string): Context;
|
|
|
406
419
|
export declare const engineSystemsFolder: string;
|
|
407
420
|
/** Where the engine installs the packages, with npm, on this computer (D-436): the player's local data, beside the programs it installs (D-425). */
|
|
408
421
|
export declare function packagesFolder(): string;
|
|
422
|
+
/** Where this player's data is kept on this computer (D-406): the folder the system gives a program's data. */
|
|
423
|
+
export declare function userDataFolder(): string;
|