rpg-engine 0.21.0 → 0.23.1
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 +5 -0
- package/dist/campaign/create-campaign.js +40 -12
- package/dist/campaign/find-campaign.d.ts +5 -0
- package/dist/campaign/find-campaign.js +10 -5
- package/dist/campaign/host-files.d.ts +15 -4
- package/dist/campaign/host-files.js +134 -14
- package/dist/campaign/index.d.ts +4 -3
- package/dist/campaign/index.js +4 -3
- package/dist/campaign/port.d.ts +6 -0
- package/dist/campaign/port.js +24 -0
- package/dist/campaign/settings.d.ts +17 -0
- package/dist/campaign/settings.js +24 -1
- package/dist/cli/cli.js +33 -6
- package/dist/commands/config/config.js +15 -1
- package/dist/commands/config/dashboard.d.ts +4 -0
- package/dist/commands/config/dashboard.js +43 -7
- package/dist/commands/config/shown.js +4 -0
- package/dist/commands/config/words.d.ts +3 -1
- package/dist/commands/config/words.js +29 -2
- package/dist/commands/image.d.ts +3 -0
- package/dist/commands/image.js +31 -4
- package/dist/commands/import/import.d.ts +1 -1
- package/dist/commands/import/import.js +5 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +21 -3
- package/dist/commands/mode.d.ts +1 -1
- package/dist/commands/package/data.js +27 -0
- package/dist/commands/package/theme.js +2 -1
- package/dist/commands/scene/scene.js +6 -1
- package/dist/commands/shared/books/adventures.d.ts +1 -0
- package/dist/commands/shared/books/adventures.js +1 -1
- package/dist/commands/shared/campaign/git.d.ts +25 -0
- package/dist/commands/shared/campaign/git.js +104 -0
- package/dist/commands/shared/campaign/images.js +5 -3
- package/dist/commands/shared/campaign/saves.js +5 -1
- package/dist/commands/shared/characters/voices.d.ts +2 -2
- package/dist/commands/shared/characters/voices.js +8 -5
- package/dist/commands/shared/packages/catalog.js +24 -5
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +8 -4
- package/dist/core/context.d.ts +17 -6
- package/dist/core/context.js +2 -1
- package/dist/core/version.d.ts +2 -0
- package/dist/core/version.js +5 -0
- package/dist/dashboard/guide/ar.md +12 -7
- package/dist/dashboard/guide/cs.md +11 -6
- package/dist/dashboard/guide/da.md +11 -6
- package/dist/dashboard/guide/de.md +13 -8
- package/dist/dashboard/guide/el.md +11 -6
- package/dist/dashboard/guide/en.md +10 -5
- package/dist/dashboard/guide/es.md +11 -6
- package/dist/dashboard/guide/fi.md +11 -6
- package/dist/dashboard/guide/fr.md +12 -7
- package/dist/dashboard/guide/he.md +11 -6
- package/dist/dashboard/guide/hi.md +11 -6
- package/dist/dashboard/guide/hu.md +11 -6
- package/dist/dashboard/guide/is.md +11 -6
- package/dist/dashboard/guide/it.md +42 -37
- package/dist/dashboard/guide/ja.md +12 -7
- package/dist/dashboard/guide/ko.md +11 -6
- package/dist/dashboard/guide/nb.md +12 -7
- package/dist/dashboard/guide/nl.md +13 -8
- package/dist/dashboard/guide/pl.md +11 -6
- package/dist/dashboard/guide/pt.md +11 -6
- package/dist/dashboard/guide/ro.md +11 -6
- package/dist/dashboard/guide/ru.md +12 -7
- package/dist/dashboard/guide/sv.md +11 -6
- package/dist/dashboard/guide/tr.md +12 -7
- package/dist/dashboard/guide/uk.md +12 -7
- package/dist/dashboard/guide/zh.md +11 -6
- package/dist/dashboard/i18n/ar.json +30 -2
- package/dist/dashboard/i18n/cs.json +30 -2
- package/dist/dashboard/i18n/da.json +30 -2
- package/dist/dashboard/i18n/de.json +30 -2
- package/dist/dashboard/i18n/el.json +30 -2
- package/dist/dashboard/i18n/es.json +30 -2
- package/dist/dashboard/i18n/fi.json +30 -2
- package/dist/dashboard/i18n/fr.json +30 -2
- package/dist/dashboard/i18n/he.json +30 -2
- package/dist/dashboard/i18n/hi.json +30 -2
- package/dist/dashboard/i18n/hu.json +30 -2
- package/dist/dashboard/i18n/is.json +30 -2
- package/dist/dashboard/i18n/it.json +30 -2
- package/dist/dashboard/i18n/ja.json +30 -2
- package/dist/dashboard/i18n/ko.json +30 -2
- package/dist/dashboard/i18n/nb.json +30 -2
- package/dist/dashboard/i18n/nl.json +30 -2
- package/dist/dashboard/i18n/pl.json +30 -2
- package/dist/dashboard/i18n/pt.json +30 -2
- package/dist/dashboard/i18n/ro.json +30 -2
- package/dist/dashboard/i18n/ru.json +30 -2
- package/dist/dashboard/i18n/sv.json +30 -2
- package/dist/dashboard/i18n/tr.json +30 -2
- package/dist/dashboard/i18n/uk.json +30 -2
- package/dist/dashboard/i18n/zh.json +30 -2
- package/dist/dashboard/packages/installed.js +2 -2
- package/dist/dashboard/packages/packages.js +1 -1
- package/dist/dashboard/parts/labels.js +7 -0
- package/dist/dashboard/settings/settings.js +45 -9
- package/dist/dashboard/shell/notices.js +1 -1
- package/dist/dashboard/shell/system-style.js +89 -5
- package/dist/dashboard/shell/tooltip.js +5 -4
- package/dist/dashboard/style.css +245 -84
- package/dist/git/git.d.ts +12 -0
- package/dist/git/git.js +175 -0
- package/dist/git/ignore.d.ts +2 -0
- package/dist/git/ignore.js +16 -0
- package/dist/git/index.d.ts +2 -0
- package/dist/git/index.js +2 -0
- package/dist/helpers/briefs.d.ts +4 -0
- package/dist/helpers/briefs.js +13 -0
- package/dist/helpers/chosen.d.ts +8 -4
- package/dist/helpers/chosen.js +38 -14
- package/dist/helpers/index.d.ts +3 -2
- package/dist/helpers/index.js +5 -3
- package/dist/helpers/opencode.d.ts +13 -0
- package/dist/helpers/opencode.js +202 -0
- package/dist/importer/index.d.ts +1 -1
- package/dist/importer/index.js +1 -1
- package/dist/instructions/index.d.ts +2 -2
- package/dist/instructions/index.js +3 -3
- package/dist/languages/pack.js +2 -1
- package/dist/server/approver.d.ts +4 -2
- package/dist/server/approver.js +27 -7
- package/dist/server/bell/antigravity.d.ts +10 -0
- package/dist/server/bell/antigravity.js +95 -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 +149 -0
- package/dist/server/dashboard/files.d.ts +3 -2
- package/dist/server/dashboard/files.js +44 -15
- package/dist/server/dashboard/index.d.ts +25 -3
- package/dist/server/dashboard/index.js +58 -23
- package/dist/server/dashboard/news.d.ts +5 -2
- package/dist/server/dashboard/news.js +82 -14
- package/dist/server/dashboard/ports.d.ts +17 -2
- package/dist/server/dashboard/ports.js +60 -4
- package/dist/server/mcp.d.ts +6 -4
- package/dist/server/mcp.js +66 -18
- package/dist/server/player-acts.d.ts +21 -1
- package/dist/server/player-acts.js +38 -2
- 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/themes/css.d.ts +1 -1
- package/dist/themes/css.js +101 -2
- package/dist/themes/index.d.ts +1 -1
- package/dist/themes/index.js +1 -1
- package/dist/themes/theme.d.ts +34 -3
- package/dist/themes/theme.js +176 -19
- package/instructions/core.md +1 -0
- package/instructions/dashboard-guide.md +1 -1
- package/instructions/start.md +1 -1
- 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 -9
- package/dist/server/bell-listener.js +0 -83
|
@@ -25,7 +25,7 @@ import { houseRules, systemRuleBook } from "./rules.js";
|
|
|
25
25
|
// What the system's attribution adds when the adventure carries layers over its pages: an open licence asks to say that the material was changed (ADV-8).
|
|
26
26
|
const changesMade = "Changes were made: the files under layers/ modify pages the game system adapted from that material.";
|
|
27
27
|
// The mark of an install under way, with its title and the days it moves dates by: while it is there, installing the same adventure finishes it (ADV-5).
|
|
28
|
-
const installMarkName = ".adventure-install.yaml";
|
|
28
|
+
export const installMarkName = ".adventure-install.yaml";
|
|
29
29
|
/** The adventures the log says are installed and not taken out, in the order they came (ADV-6): they go back with a save. */
|
|
30
30
|
export function installedAdventures(root) {
|
|
31
31
|
return adventuresOfLog(readLog(root));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Context } from "../../../core/context.ts";
|
|
2
|
+
/** What went wrong the last time git ran for a campaign, which the dashboard tells the player until a commit and a push go right (D-576). */
|
|
3
|
+
export interface GitProblem {
|
|
4
|
+
act: "commit" | "push";
|
|
5
|
+
why: string;
|
|
6
|
+
}
|
|
7
|
+
/** Whether the campaign's folder is in a git repository: only then the settings of git count, and the dashboard shows them. */
|
|
8
|
+
export declare function isCampaignRepository(root: string): boolean;
|
|
9
|
+
/** Whether the campaign's repository holds more than the campaign, its .git in a folder above: a push sends the player's other commits too. */
|
|
10
|
+
export declare function isInLargerRepository(root: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Commits the campaign's changes with `message`, then pushes them, as its settings of git say (D-576); nothing where they are off or the folder is no
|
|
13
|
+
* repository. It never throws: what fails is kept for the dashboard. The commits of a campaign run one after the other.
|
|
14
|
+
*/
|
|
15
|
+
export declare function commitCampaign(root: string, message: string): Promise<void>;
|
|
16
|
+
/** The commits still running, by campaign, and whether each pushes: what the command line waits for before it ends, saying so (D-576). */
|
|
17
|
+
export declare function gitUnderWay(): {
|
|
18
|
+
root: string;
|
|
19
|
+
pushes: boolean;
|
|
20
|
+
done: Promise<void>;
|
|
21
|
+
}[];
|
|
22
|
+
/** The commit at the start of a session: what the last one left, with its chats copied first when they go into the repository. */
|
|
23
|
+
export declare function commitSessionStart(root: string, context: Context): Promise<void>;
|
|
24
|
+
/** What went wrong the last time git ran for the campaign; undefined when it went right, or has not run. */
|
|
25
|
+
export declare function gitProblem(root: string): GitProblem | undefined;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// The campaign in its git repository (D-576): a commit at the start of a session, at each save and at each end of a scene, then a push, as the settings say.
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { hostFileNames, inboxFolderName, portFileName, readSettings, sessionsFolderName } from "../../../campaign/index.js";
|
|
4
|
+
import { files } from "../../../core/store.js";
|
|
5
|
+
import { commitFolder, isRepository, push, repositoryRoot, withIgnoreBlock } from "../../../git/index.js";
|
|
6
|
+
import { importsFolderName } from "../../../importer/index.js";
|
|
7
|
+
import { installMarkName } from "../books/adventures.js";
|
|
8
|
+
import { copyChats } from "./chats.js";
|
|
9
|
+
import { exportsFolderName, savesFolderName } from "./saves.js";
|
|
10
|
+
/** Whether the campaign's folder is in a git repository: only then the settings of git count, and the dashboard shows them. */
|
|
11
|
+
export function isCampaignRepository(root) {
|
|
12
|
+
return isRepository(root);
|
|
13
|
+
}
|
|
14
|
+
/** Whether the campaign's repository holds more than the campaign, its .git in a folder above: a push sends the player's other commits too. */
|
|
15
|
+
export function isInLargerRepository(root) {
|
|
16
|
+
const found = repositoryRoot(root);
|
|
17
|
+
return found !== undefined && found !== resolve(root);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Commits the campaign's changes with `message`, then pushes them, as its settings of git say (D-576); nothing where they are off or the folder is no
|
|
21
|
+
* repository. It never throws: what fails is kept for the dashboard. The commits of a campaign run one after the other.
|
|
22
|
+
*/
|
|
23
|
+
export function commitCampaign(root, message) {
|
|
24
|
+
const next = (running.get(root) ?? Promise.resolve()).then(() => commitNow(root, message)).finally(() => {
|
|
25
|
+
if (running.get(root) === next) {
|
|
26
|
+
running.delete(root);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
running.set(root, next);
|
|
30
|
+
return next;
|
|
31
|
+
}
|
|
32
|
+
/** The commits still running, by campaign, and whether each pushes: what the command line waits for before it ends, saying so (D-576). */
|
|
33
|
+
export function gitUnderWay() {
|
|
34
|
+
return [...running].map(([root, done]) => ({ root, pushes: pushesTo(root), done }));
|
|
35
|
+
}
|
|
36
|
+
/** The commit at the start of a session: what the last one left, with its chats copied first when they go into the repository. */
|
|
37
|
+
export function commitSessionStart(root, context) {
|
|
38
|
+
try {
|
|
39
|
+
if (readSettings(root)["git-sessions"] === "in") {
|
|
40
|
+
copyChats(root, context);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// The commit goes on with the chats already copied.
|
|
45
|
+
}
|
|
46
|
+
return commitCampaign(root, `rpg: start of a session, ${context.now().toISOString().slice(0, 16).replace("T", " ")} UTC`);
|
|
47
|
+
}
|
|
48
|
+
/** What went wrong the last time git ran for the campaign; undefined when it went right, or has not run. */
|
|
49
|
+
export function gitProblem(root) {
|
|
50
|
+
return problems.get(root);
|
|
51
|
+
}
|
|
52
|
+
// The commits under way, by campaign, and what went wrong with the last.
|
|
53
|
+
const running = new Map();
|
|
54
|
+
const problems = new Map();
|
|
55
|
+
/** What the engine writes again whenever it likes, or the player keeps on this computer alone: never in the repository. */
|
|
56
|
+
function alwaysIgnored() {
|
|
57
|
+
// .gemini/ of the campaigns made before D-493, which it leaves on the disk.
|
|
58
|
+
return [".agents/", ".claude/", ".codex/", ".gemini/", ".opencode/", ".mcp.json", ...hostFileNames, `${inboxFolderName}/`, `${exportsFolderName}/`, `${importsFolderName}/`, installMarkName, `${savesFolderName}/*.txt`, portFileName];
|
|
59
|
+
}
|
|
60
|
+
function pushesTo(root) {
|
|
61
|
+
try {
|
|
62
|
+
return readSettings(root).git === "push";
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function commitNow(root, message) {
|
|
69
|
+
let settings;
|
|
70
|
+
try {
|
|
71
|
+
settings = readSettings(root);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if ((settings.git ?? "off") === "off" || !isRepository(root)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const chosen = [...(settings["git-saves"] === "in" ? [] : [`${savesFolderName}/`]), ...(settings["git-sessions"] === "in" ? [] : [`${sessionsFolderName}/`])];
|
|
80
|
+
const left = [...alwaysIgnored(), ...chosen];
|
|
81
|
+
let act = "commit";
|
|
82
|
+
try {
|
|
83
|
+
writeIgnore(root, left.map((path) => `/${path}`));
|
|
84
|
+
// What the .gitignore leaves out goes out of the repository too, had the player committed it before.
|
|
85
|
+
await commitFolder(root, message, left.map((path) => path.replace(/\/$/, "")));
|
|
86
|
+
if (settings.git === "push") {
|
|
87
|
+
act = "push";
|
|
88
|
+
await push(root);
|
|
89
|
+
}
|
|
90
|
+
problems.delete(root);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
problems.set(root, { act, why: error instanceof Error ? error.message : String(error) });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** Writes the engine's block of the campaign's .gitignore, when it changes. */
|
|
97
|
+
function writeIgnore(root, lines) {
|
|
98
|
+
const file = join(root, ".gitignore");
|
|
99
|
+
const text = files().text(file);
|
|
100
|
+
const written = withIgnoreBlock(text, lines);
|
|
101
|
+
if (written !== text) {
|
|
102
|
+
files().write(file, written);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -21,9 +21,11 @@ export function picturesNote(root, context, world, place) {
|
|
|
21
21
|
? `you can make the pictures of places, quests and those met with ${ready.tool}`
|
|
22
22
|
: ready.askTool === true
|
|
23
23
|
? "you can make the pictures of places, quests and those met with the image tool the player names"
|
|
24
|
-
: ready.
|
|
25
|
-
? "you can
|
|
26
|
-
:
|
|
24
|
+
: ready.draws === true
|
|
25
|
+
? "you can draw the pictures of places, quests and those met yourself, as simple vector pictures"
|
|
26
|
+
: ready.maker === "Antigravity"
|
|
27
|
+
? "you can make the pictures of places, quests and those met with your own image tool"
|
|
28
|
+
: `this computer can make the pictures of places, quests and those met with the player's ${ready.maker === "Claude" ? "Claude Code" : "Codex"}`}, which spends their plan: ask them once whether they want one for each new place, quest and one met, only those they ask for, or none; then config pictures (new elements, on request or none).`
|
|
27
29
|
: undefined;
|
|
28
30
|
}
|
|
29
31
|
if (setting !== "new elements" || place === undefined || place.type !== "place" || shownImage(root, context, world, place) !== undefined) {
|
|
@@ -10,6 +10,7 @@ import { packFiles, readSaves, saveFileName, unpackFiles } from "../../../saves/
|
|
|
10
10
|
import { formatGameDate } from "../../../time/index.js";
|
|
11
11
|
import { playerCharacter } from "../characters/knowledge.js";
|
|
12
12
|
import { newDatedLogEntry, readPresent } from "../time/time.js";
|
|
13
|
+
import { commitCampaign } from "./git.js";
|
|
13
14
|
import { campaignWorld } from "./world.js";
|
|
14
15
|
/** The folder of the saves, at the top of the campaign. */
|
|
15
16
|
export const savesFolderName = ".saves";
|
|
@@ -73,7 +74,9 @@ export function makeSave(root, context, label, why) {
|
|
|
73
74
|
held[logFileName] = joinBytes(held[logFileName], new TextEncoder().encode(logLine(entry)));
|
|
74
75
|
files().writeBytes(join(root, savesFolderName, file), packFiles(held));
|
|
75
76
|
appendLogEntry(root, entry);
|
|
76
|
-
|
|
77
|
+
const save = readSaves([file])[0];
|
|
78
|
+
void commitCampaign(root, `rpg: ${saveText(save)}`);
|
|
79
|
+
return save;
|
|
77
80
|
}
|
|
78
81
|
/**
|
|
79
82
|
* Gives the campaign back as a save holds it (SAV-5): its game files as they were, but campaign.yaml, its settings, as it is now (D-360), those made since
|
|
@@ -128,6 +131,7 @@ export function loadSave(root, context, save) {
|
|
|
128
131
|
}));
|
|
129
132
|
files().remove(join(folder, loadingMarkName));
|
|
130
133
|
files().writeBytes(join(folder, newChatMarkName), new TextEncoder().encode(saveText(save)));
|
|
134
|
+
void commitCampaign(root, `rpg: loaded ${saveText(save)}`);
|
|
131
135
|
return { removed: later, copy };
|
|
132
136
|
}
|
|
133
137
|
/** The save the game went back to, until the player confirms a new chat: the chat that went on before remembers what is gone (D-361, D-362). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from "../../../core/context.ts";
|
|
2
|
-
/** Whether the character agent voices the characters (D-490): in Claude Code, in a chat that has it, unless the master voices every character. */
|
|
2
|
+
/** Whether the character agent voices the characters (D-490): in Claude Code or OpenCode, 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 OpenCode's way of calling it there; 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
3
|
import { voicesInstructions } from "../../../instructions/index.js";
|
|
4
|
-
// The
|
|
4
|
+
// The names Claude Code and OpenCode give themselves to the MCP server: the hosts whose campaign has the character agent as an agent (D-490).
|
|
5
5
|
const claudeCode = "claude-code";
|
|
6
|
-
|
|
6
|
+
const openCode = "opencode";
|
|
7
|
+
/** Whether the character agent voices the characters (D-490): in Claude Code or OpenCode, in a chat that has it, unless the master voices every character. */
|
|
7
8
|
export function agentVoices(root, context) {
|
|
8
|
-
|
|
9
|
+
const host = context.host?.();
|
|
10
|
+
const has = host === claudeCode ? context.characterAgents?.claudeCode : host === openCode ? context.characterAgents?.openCode : false;
|
|
11
|
+
return has === true && readSettings(root).voices !== "master";
|
|
9
12
|
}
|
|
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. */
|
|
13
|
+
/** The part Voices, when and how to call the character agent, for a campaign in play, with OpenCode's way of calling it there; none where the agent does not voice the characters. */
|
|
11
14
|
export function voicesPart(root, context) {
|
|
12
|
-
return agentVoices(root, context) ? voicesInstructions(readSettings(root).voices ?? "auto") : "";
|
|
15
|
+
return agentVoices(root, context) ? voicesInstructions(readSettings(root).voices ?? "auto", context.host?.() === openCode) : "";
|
|
13
16
|
}
|
|
@@ -6,7 +6,7 @@ import { readManifest } from "../../../adventures/index.js";
|
|
|
6
6
|
import { ourSystems, readsApi } from "../../../core/packages/declarations.js";
|
|
7
7
|
import { files } from "../../../core/store.js";
|
|
8
8
|
import { comparableText } from "../../../core/text.js";
|
|
9
|
-
import { isNewerVersion } from "../../../core/version.js";
|
|
9
|
+
import { isNewerVersion, newerEngineAsked } from "../../../core/version.js";
|
|
10
10
|
import { installedExtensions, readExtension, shortName } from "../../../extensions/index.js";
|
|
11
11
|
import { installedLanguages } from "../../../languages/index.js";
|
|
12
12
|
import { isVerified } from "../../../packages/index.js";
|
|
@@ -158,7 +158,10 @@ function adventureEntry(repository, manifest, here) {
|
|
|
158
158
|
language: manifest.language,
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* A theme GitHub has, by the name, version and engine its theme.yaml gives; here only when it was installed from this repository. Its checks are made as it is
|
|
163
|
+
* installed.
|
|
164
|
+
*/
|
|
162
165
|
function themeEntry(repository, text, here) {
|
|
163
166
|
const read = parse(text);
|
|
164
167
|
if (typeof read?.name !== "string" || read.name.trim() === "") {
|
|
@@ -166,9 +169,9 @@ function themeEntry(repository, text, here) {
|
|
|
166
169
|
}
|
|
167
170
|
const name = read.name;
|
|
168
171
|
const found = here.themes.find((one) => isSameSource(unpackedSource(one.folder), repository.html_url));
|
|
169
|
-
return githubEntry("theme", repository, name, versionOf(read.version), found === undefined ? undefined : (found.theme?.version ?? ""));
|
|
172
|
+
return readableEntry(githubEntry("theme", repository, name, versionOf(read.version), found === undefined ? undefined : (found.theme?.version ?? "")), read.engine);
|
|
170
173
|
}
|
|
171
|
-
/** A language GitHub has, by the code, name and
|
|
174
|
+
/** A language GitHub has, by the code, name, version and engine its language.yaml gives: here only when it was installed from this repository, never npm's. */
|
|
172
175
|
function languageEntry(repository, text, here) {
|
|
173
176
|
const read = parse(text);
|
|
174
177
|
if (typeof read?.code !== "string" || typeof read.name !== "string") {
|
|
@@ -176,7 +179,23 @@ function languageEntry(repository, text, here) {
|
|
|
176
179
|
}
|
|
177
180
|
const code = read.code;
|
|
178
181
|
const installed = here.languages.find((one) => isSameSource(unpackedSource(one.folder), repository.html_url))?.version;
|
|
179
|
-
return { ...githubEntry("language", repository, read.name, versionOf(read.version), installed), language: code };
|
|
182
|
+
return readableEntry({ ...githubEntry("language", repository, read.name, versionOf(read.version), installed), language: code }, read.engine);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A theme or a language as this engine reads it, by the lowest rpg-engine its file asks (D-515 (2)): one that asks a newer engine is no update, and says the
|
|
186
|
+
* engine its version needs; not offered when it is not here, as npm's that no version of reads, since adding it would be refused.
|
|
187
|
+
*/
|
|
188
|
+
function readableEntry(entry, asked) {
|
|
189
|
+
const engine = newerEngineAsked(asked);
|
|
190
|
+
if (engine === undefined) {
|
|
191
|
+
return entry;
|
|
192
|
+
}
|
|
193
|
+
if (entry.installed === undefined) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
const { version, ...rest } = entry;
|
|
197
|
+
const newer = version !== undefined && (entry.installed === "" || isNewerVersion(version, entry.installed));
|
|
198
|
+
return { ...rest, ...(entry.installed === "" ? {} : { version: entry.installed }), update: false, ...(newer ? { newer: { version, engine } } : {}) };
|
|
180
199
|
}
|
|
181
200
|
/** What every package GitHub has gives: never verified, never code, added by its link; its version here, and whether GitHub's is newer: only when both are known. */
|
|
182
201
|
function githubEntry(kind, repository, title, version, installed) {
|
|
@@ -31,6 +31,7 @@ export declare const status: import("../core/registry.ts").Command<z.ZodObject<{
|
|
|
31
31
|
companions: Member[];
|
|
32
32
|
orders: string[];
|
|
33
33
|
dashboard: string | undefined;
|
|
34
|
+
dashboardHeld: boolean;
|
|
34
35
|
offerDashboard: boolean;
|
|
35
36
|
pictures: string | undefined;
|
|
36
37
|
importing: string;
|
package/dist/commands/status.js
CHANGED
|
@@ -161,6 +161,8 @@ export const status = defineCommand({
|
|
|
161
161
|
// The player's standing orders to the companions, in play, for those who come later too (D-563).
|
|
162
162
|
orders: mode === "play" ? settings.orders ?? [] : [],
|
|
163
163
|
dashboard: context.dashboard,
|
|
164
|
+
// What the player does on a page another chat serves reaches that chat, not this one (D-577).
|
|
165
|
+
dashboardHeld: context.dashboardHeld === true,
|
|
164
166
|
// The chat's first status opens with the dashboard, for the master to offer it in their first answer (D-353).
|
|
165
167
|
offerDashboard: offerDashboard(context),
|
|
166
168
|
// Whether to ask for the places' pictures, or to have this one made (D-308).
|
|
@@ -211,9 +213,11 @@ export const status = defineCommand({
|
|
|
211
213
|
format(result) {
|
|
212
214
|
const companion = (member) => `${member.name}${member.with === undefined ? whereabouts(member) : `, with ${member.with}`}${memberCounters(member)}`;
|
|
213
215
|
const state = [
|
|
214
|
-
result.
|
|
215
|
-
? `
|
|
216
|
-
:
|
|
216
|
+
result.dashboardHeld
|
|
217
|
+
? `The dashboard at ${result.dashboard ?? ""} is served by another chat of this campaign that is still open: what the player does on it reaches that chat, not you. Ask the player to close that chat; this one takes the page over within seconds.`
|
|
218
|
+
: result.offerDashboard && result.dashboard !== undefined
|
|
219
|
+
? `Offer the player their dashboard's link in your first answer: ${result.dashboard}.`
|
|
220
|
+
: "",
|
|
217
221
|
result.campaign.join(" · "),
|
|
218
222
|
...result.meanings,
|
|
219
223
|
result.note,
|
|
@@ -234,7 +238,7 @@ export const status = defineCommand({
|
|
|
234
238
|
result.orders.length === 0
|
|
235
239
|
? ""
|
|
236
240
|
: `Standing orders, the player's to the companions (they follow them as their pages allow, and break one only in the open): ${quotedOrders(result.orders)}.`,
|
|
237
|
-
result.dashboard === undefined || result.offerDashboard ? "" : `Dashboard: ${result.dashboard}.`,
|
|
241
|
+
result.dashboard === undefined || result.offerDashboard || result.dashboardHeld ? "" : `Dashboard: ${result.dashboard}.`,
|
|
238
242
|
result.pictures ?? "",
|
|
239
243
|
result.importing,
|
|
240
244
|
result.translation ?? "",
|
package/dist/core/context.d.ts
CHANGED
|
@@ -61,10 +61,15 @@ 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, as Claude Code's agent and as OpenCode's subagent (D-490): the chat of that host then gets Voices. */
|
|
65
|
+
characterAgents?: {
|
|
66
|
+
claudeCode?: boolean;
|
|
67
|
+
openCode?: boolean;
|
|
68
|
+
};
|
|
66
69
|
/** The link of the player's dashboard, when the MCP server serves one (D-270); status gives it. */
|
|
67
70
|
dashboard?: string;
|
|
71
|
+
/** Whether another chat of the campaign, still open, serves the dashboard at that link, which this chat takes over once it closes (D-577). */
|
|
72
|
+
dashboardHeld?: boolean;
|
|
68
73
|
/**
|
|
69
74
|
* What the player changed on the dashboard since the master's last call, taken for the head of the next call's answer, and given back when that answer
|
|
70
75
|
* never goes, as for a call the user stopped (D-341); the parts it tells count as told in `told`, the call's own.
|
|
@@ -77,7 +82,7 @@ export interface Context {
|
|
|
77
82
|
pictures?: PictureMaker;
|
|
78
83
|
/** Lines for the master's next call, as of a picture that came after its call answered (D-572); MCP only. */
|
|
79
84
|
later?: LaterLines;
|
|
80
|
-
/** 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. */
|
|
85
|
+
/** 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. */
|
|
81
86
|
writer?: TextWriter;
|
|
82
87
|
/** 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. */
|
|
83
88
|
texts?: SystemTexts;
|
|
@@ -96,6 +101,8 @@ export interface Context {
|
|
|
96
101
|
importRunner?: (root: string) => void;
|
|
97
102
|
/** The folder of this player's data on this computer, apart from any campaign: the page's words translated on the fly (D-406). */
|
|
98
103
|
home?: string;
|
|
104
|
+
/** 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. */
|
|
105
|
+
userHome?: string;
|
|
99
106
|
/** The folder of the dashboard's built page, whose i18n/ lists every phrase it has (D-423). */
|
|
100
107
|
pageFolder?: string;
|
|
101
108
|
/** 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. */
|
|
@@ -221,11 +228,12 @@ export type HelperLogin = {
|
|
|
221
228
|
};
|
|
222
229
|
/**
|
|
223
230
|
* 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
|
|
224
|
-
* ends (D-495); whether status has already had the master offer the dashboard, as its first does (D-353).
|
|
231
|
+
* begins and ends (D-495); whether status has already had the master offer the dashboard, as its first does (D-353).
|
|
225
232
|
*/
|
|
226
233
|
export interface ChatState {
|
|
227
234
|
calls: number;
|
|
228
235
|
thread?: string;
|
|
236
|
+
beforeCall?: () => void;
|
|
229
237
|
afterCall?: () => void;
|
|
230
238
|
dashboardOffered?: boolean;
|
|
231
239
|
}
|
|
@@ -246,7 +254,7 @@ export interface TextWriter {
|
|
|
246
254
|
export interface DocumentReader {
|
|
247
255
|
ready(): boolean;
|
|
248
256
|
/** The program that would read now, which the player is told the document goes to (D-493). */
|
|
249
|
-
program?(): "Claude Code" | "Codex" | undefined;
|
|
257
|
+
program?(): "Claude Code" | "Codex" | "OpenCode" | undefined;
|
|
250
258
|
/** 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`. */
|
|
251
259
|
read(folder: string, brief: string, writable: string[], signal?: AbortSignal): Promise<{
|
|
252
260
|
said: string;
|
|
@@ -257,13 +265,14 @@ export interface DocumentReader {
|
|
|
257
265
|
/**
|
|
258
266
|
* 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,
|
|
259
267
|
* 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
|
|
260
|
-
* ElevenLabs, or that the player is to name it (D-572).
|
|
268
|
+
* ElevenLabs, or that the player is to name it, or that the chat draws them itself as SVG code (D-572).
|
|
261
269
|
*/
|
|
262
270
|
export type PicturesReady = {
|
|
263
271
|
ready: true;
|
|
264
272
|
maker?: string;
|
|
265
273
|
tool?: string;
|
|
266
274
|
askTool?: true;
|
|
275
|
+
draws?: true;
|
|
267
276
|
instead?: PictureFallback;
|
|
268
277
|
} | {
|
|
269
278
|
ready: false;
|
|
@@ -404,3 +413,5 @@ export declare function defaultContext(folder?: string): Context;
|
|
|
404
413
|
export declare const engineSystemsFolder: string;
|
|
405
414
|
/** 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). */
|
|
406
415
|
export declare function packagesFolder(): string;
|
|
416
|
+
/** Where this player's data is kept on this computer (D-406): the folder the system gives a program's data. */
|
|
417
|
+
export declare function userDataFolder(): string;
|
package/dist/core/context.js
CHANGED
|
@@ -18,6 +18,7 @@ export function defaultContext(folder = process.cwd()) {
|
|
|
18
18
|
extensionFolders: [join(packagesFolder(), "node_modules")],
|
|
19
19
|
unpacked: join(packagesFolder(), "unpacked"),
|
|
20
20
|
home: userDataFolder(),
|
|
21
|
+
userHome: homedir(),
|
|
21
22
|
bookIndex: join(dirname(packagesFolder()), "library"),
|
|
22
23
|
// The built page is in dist/dashboard, two levels up from src/core/ and from dist/core/ alike.
|
|
23
24
|
pageFolder: fileURLToPath(new URL("../../dist/dashboard/", import.meta.url)),
|
|
@@ -36,7 +37,7 @@ export function packagesFolder() {
|
|
|
36
37
|
: join(process.env.XDG_DATA_HOME || join(home, ".local", "share"), "rpg-engine", "packages");
|
|
37
38
|
}
|
|
38
39
|
/** Where this player's data is kept on this computer (D-406): the folder the system gives a program's data. */
|
|
39
|
-
function userDataFolder() {
|
|
40
|
+
export function userDataFolder() {
|
|
40
41
|
const home = homedir();
|
|
41
42
|
if (process.platform === "win32") {
|
|
42
43
|
return join(process.env.APPDATA || join(home, "AppData", "Roaming"), "rpg-engine");
|
package/dist/core/version.d.ts
CHANGED
|
@@ -2,3 +2,5 @@
|
|
|
2
2
|
export declare function isNewerVersion(version: string, than: string): boolean;
|
|
3
3
|
/** Version of the installed rpg-engine package, read from its package.json. */
|
|
4
4
|
export declare function getVersion(): string;
|
|
5
|
+
/** The rpg-engine a package of data asks for, as its YAML writes it ("0.22"), when it is newer than this one; undefined when this one reads it. */
|
|
6
|
+
export declare function newerEngineAsked(asked: unknown): string | undefined;
|
package/dist/core/version.js
CHANGED
|
@@ -11,3 +11,8 @@ export function getVersion() {
|
|
|
11
11
|
const packageJson = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
|
|
12
12
|
return packageJson.version;
|
|
13
13
|
}
|
|
14
|
+
/** The rpg-engine a package of data asks for, as its YAML writes it ("0.22"), when it is newer than this one; undefined when this one reads it. */
|
|
15
|
+
export function newerEngineAsked(asked) {
|
|
16
|
+
const engine = typeof asked === "string" || typeof asked === "number" ? String(asked).trim() : "";
|
|
17
|
+
return engine !== "" && isNewerVersion(engine, getVersion()) ? engine : undefined;
|
|
18
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- Translated from en.md, paragraph by paragraph, by npm run translate: cdcc612c,e51b18d7,be38a186 f2f35057,51f49a5b 128c5761,5e6cbafc,48febcc7,f0f71376,b1381f21,cb3f91d5 5faea867,7780116a,afad321d,99406ef2,f831ecd8,b6a6bfff,b5544596,5c016bb1,3afa0abc,ef6b72c1,bc923cc3,07c079ea,
|
|
1
|
+
<!-- Translated from en.md, paragraph by paragraph, by npm run translate: cdcc612c,e51b18d7,be38a186 f2f35057,51f49a5b 128c5761,5e6cbafc,48febcc7,f0f71376,b1381f21,cb3f91d5 5faea867,7780116a,afad321d,99406ef2,f831ecd8,b6a6bfff,b5544596,5c016bb1,3afa0abc,ef6b72c1,bc923cc3,07c079ea,8b6ac2d5,7b9a0a41,086f7b8c,da6d0862,06d7d789,e6f82f9e,6def7d66,f27372ca,d904fdec,8da0dbd5,1c13fe15,de62cd09,1aa7894f,56b73d9b,d9fbeec2,74dc52f1,a2da9de6,cb3f91d5 09eaf555,63d0c1fb,27c765d2,46692547,1c335942,25f9bdf8,6bd01b74,b0846f60,602a5e46,6fee496f,71124663,4bed5644,c2bbeff9,12a7bf4b,15e36217,4b57013e,cb7d8189,b2a29c8a,056b4e29,2ef22287,d61653a8,9d7e522f,f4c26681,c6b050c9,6c58220c,5f7b18e6,6a64e757,ad3fa941,57283bd2,e9fa262a,44639926,6cb75000,86179abe,323d8fa3,f8d6b2fd,18bc17d2,3bbb14f4,774591fd,65ff2775,623c2986,0fac97e5,d3afc486,cb3f91d5 ec2eeb06,92e343cc,fa64227b,da0fad21,cb3f91d5 5dafa85b,c5ec9f44,2e849e73,35a85f2e,607c7f74,95ffeabc,7687ded0,4ee5ae41,fd2934d1,177ddff0,a78e1054,025009be,c8315e19,cb3f91d5 40941750,f3b2d1f6,cb3f91d5 30c03e82,209b159b,6ea1911c,b8e71497,32482cb4,65c75baa,cb3f91d5 eac34391,4497f74b,487e04c0,c6ebe0c0,cb3f91d5 2f86bef9,9402592c,cb3f91d5 519ce5ee,de58bc03,fd906c57,697b0622,180f77d8,e0f88bdb,1e0ccfed,05fde17f,5070d986,f83c9d82,5b0bb1d2,600db53a,6b115391,5db3836c,252805d8,df64a3bb,e9a3f2a9. Change the English, then run it again. -->
|
|
2
2
|
# RPG Engine: الدليل الكامل
|
|
3
3
|
|
|
4
4
|
يتيح لك **RPG Engine** لعب لعبة أدوار على الطاولة مع **ذكاء اصطناعي في دور مدير اللعبة**. تتحدث مع مدير اللعبة في **محادثة**. أما RPG Engine فيعمل خلف الكواليس: **يتذكر العالم**، و**يرمي النرد**، و**يمسك الحسابات**. بجانب المحادثة تُبقي صفحة مفتوحة في المتصفح، هي **لوحة التحكم**، وفيها ورقة شخصيتك والنرد والخرائط وسجلك.
|
|
@@ -64,12 +64,15 @@ rpg init "The Salt Isles"
|
|
|
64
64
|
|
|
65
65
|
### 2.4 ربط الذكاء الاصطناعي
|
|
66
66
|
|
|
67
|
-
يعمل مدير اللعبة داخل **وكيل ذكاء اصطناعي**. هو تطبيق ذكاء اصطناعي، في الطرفية أو على سطح المكتب، يستطيع العمل مع الملفات على حاسوبك، مثل Claude Code أو Codex أو Antigravity. الدردشة العادية مثل claude.ai أو ChatGPT، أو تطبيق الهاتف، لا تكفي. فمدير اللعبة يحتاج إلى الوصول إلى ملفات الحملة على حاسوبك. لكل وكيل خطته وتسجيل دخوله: Claude Code يحتاج إلى خطة Claude مدفوعة، وCodex إلى تسجيل دخول ChatGPT، وAntigravity إلى حساب Google، وخطته المجانية حصتها الأسبوعية صغيرة. تثبّت الوكيل مرة واحدة، من صفحته: [Claude Code](https://code.claude.com/docs/en/setup)، [Codex](https://developers.openai.com/codex)، [Antigravity](https://antigravity.google).
|
|
67
|
+
يعمل مدير اللعبة داخل **وكيل ذكاء اصطناعي**. هو تطبيق ذكاء اصطناعي، في الطرفية أو على سطح المكتب، يستطيع العمل مع الملفات على حاسوبك، مثل Claude Code أو Codex أو Antigravity أو OpenCode. الدردشة العادية مثل claude.ai أو ChatGPT، أو تطبيق الهاتف، لا تكفي. فمدير اللعبة يحتاج إلى الوصول إلى ملفات الحملة على حاسوبك. لكل وكيل خطته وتسجيل دخوله: Claude Code يحتاج إلى خطة Claude مدفوعة، وCodex إلى تسجيل دخول ChatGPT، وAntigravity إلى حساب Google، وخطته المجانية حصتها الأسبوعية صغيرة. أما OpenCode فيعمل مع النماذج التي تقدمها له، ومنها النماذج المحلية. تثبّت الوكيل مرة واحدة، من صفحته: [Claude Code](https://code.claude.com/docs/en/setup)، [Codex](https://developers.openai.com/codex)، [Antigravity](https://antigravity.google)، [OpenCode](https://opencode.ai).
|
|
68
68
|
|
|
69
69
|
- **Claude Code**: في مجلد الحملة اكتب `claude`. عندما يسأل هل تثق بالمجلد، اختر **Yes, I trust this folder**. انتبه: الجواب المحدد مسبقًا هو *No, exit*. في الحملة أيضًا خطّاف صغير، `rpg --listen`، لا يظهر في هذا السؤال. وهو يخبر مدير اللعبة فورًا حين تتصرف من لوحة المتابعة.
|
|
70
70
|
- **Codex**: في مجلد الحملة اكتب `codex`، ووافق عندما يسأل هل تثق بالمجلد. وفي تطبيقه المكتبي، تأكد من الإعدادات أن الذاكرة معطلة لدردشات اللعبة.
|
|
71
|
-
- **Antigravity**: في مجلد الحملة اكتب `agy`، ووافق إن سأل هل تثق بالمجلد. في الحملة
|
|
72
|
-
-
|
|
71
|
+
- **Antigravity**: في مجلد الحملة اكتب `agy`، ووافق إن سأل هل تثق بالمجلد. أو افتح مجلد الحملة من تطبيقه. وللتطبيق يضيف RPG Engine نفسه أيضًا إلى إعدادات Antigravity الخاصة، في الملف `.gemini/config/mcp_config.json` داخل مجلدك الشخصي. وهذه الإعدادات تسري على كل مجلد تفتحه، لا على مجلد الحملة وحده. أما خارج الحملة فلا يفعل شيئًا. في الحملة خطّافان صغيران: `rpg --approve` يتيح لمدير اللعبة استخدام أدوات RPG Engine دون أن يسألك في كل مرة، و`rpg --listen` يخبر مدير اللعبة فورًا حين تتصرف من لوحة المتابعة. ويرسم مدير اللعبة الصور في الدردشة نفسها. وإذا تعطلت أداة الصور لديه، رسم صورًا متجهية بسيطة، كما يفعل Claude. يحتفظ Antigravity بدردشاتك السابقة، ولا يمكن إيقاف ذاكرته. لذلك أُمر مدير اللعبة ألا يقرأها أبدًا. ما تكتبه يذهب إلى Google، وقد يقرؤه بشر. أبعد البيانات الشخصية عن اللعبة. RPG Engine ليس منتجًا من Google.
|
|
72
|
+
- **OpenCode**: في مجلد الحملة اكتب `opencode`. في الحملة إضافة صغيرة، `.opencode/plugins/rpg.js`، تخبر مدير اللعبة فورًا حين تتصرف من لوحة المتابعة. وفي الحملة يكتب مدير اللعبة الملفات عبر RPG Engine وحده: كتابة OpenCode الخاصة للملفات وتحريرها معطّلة هناك، ويسألك OpenCode قبل أن ينفّذ أي أمر. ويرسم مدير اللعبة الصور بنفسه، صورًا متجهية بسيطة، كما يفعل Claude. ويترجم OpenCode لديك، بالنموذج الذي اخترته فيه آخر مرة، لوحة المتابعة وقواعد اللعبة أيضًا، ويقرأ المستندات التي تستوردها، خارج الدردشة. وإن لم يكن لديه نموذج يستطيع استخدامه، فيتولى ذلك Codex أو Claude Code إن كانا لديك.
|
|
73
|
+
- **وكيل آخر**: شغّله في مجلد الحملة وأعطه خادم MCP بالأمر `rpg mcp`. RPG Engine خادم MCP قياسي، وأي وكيل يدعم MCP يمكن أن يكون مدير اللعبة، ومنه الوكلاء المحليون.
|
|
74
|
+
|
|
75
|
+
إذا قال مدير اللعبة إنه لا يجد أدوات RPG Engine، فاكتب `rpg init` في مجلد الحملة. في مجلد هو حملة أصلًا، لا يفعل هذا الأمر سوى تحديث هذه الملفات. ثم افتح دردشة جديدة.
|
|
73
76
|
|
|
74
77
|
نلعب ونختبر مع **Claude Code**. أما **Codex** و**Antigravity** فهما مربوطان ومفحوصان، لكن لم تُلعب معهما حملة كاملة بعد. تعطّل الحملة ذاكرة الوكيل الخاصة، فاللعبة تعيش في ملفاتها، وبذلك تعيدك العودة إلى نقطة حفظ إلى ما كانت عليه فعلًا.
|
|
75
78
|
|
|
@@ -183,6 +186,8 @@ rpg init "The Salt Isles"
|
|
|
183
186
|
|
|
184
187
|
بعد العودة، **افتح محادثة جديدة**: فالمحادثة القديمة تتذكر ما أُلغي. اكتب *تابع* في المحادثة الجديدة، ثم اضغط **فتحت محادثة جديدة** في نقاط الحفظ.
|
|
185
188
|
|
|
189
|
+
إذا كان مجلد الحملة مستودع git، ففي **الإعدادات** قسم **Git**، وكل ما فيه متوقف إلى أن تختار: إيداع (commit) عند بداية كل جلسة، وعند كل نقطة حفظ، وعند نهاية كل مشهد، ودفع (push) بعده إن شئت. الإيداع لقطة من الحملة في تلك اللحظة، والدفع يرسل اللقطات إلى المستودع على الإنترنت، في GitHub مثلًا، لتبقى نسخة منها خارج هذا الحاسوب. وتبقى نقاط الحفظ ومحادثاتك مع مدير اللعبة خارج المستودع ما لم تسمح بإدخالها. لا تُدخل المحادثات إلا إذا كان المستودع خاصًا.
|
|
190
|
+
|
|
186
191
|
### 3.9 الجلسات: التوقف والعودة
|
|
187
192
|
|
|
188
193
|
توقف متى شئت: *[لنتوقف هنا الليلة.]* كل شيء محفوظ أصلًا في الملفات. وللعودة، شغّل وكيلك في مجلد الحملة واكتب *تابع*: يعطيك مدير اللعبة ملخصًا قصيرًا ثم يواصل.
|
|
@@ -214,7 +219,7 @@ rpg init "The Salt Isles"
|
|
|
214
219
|
- **السجل**: المهمات، والقصة كتابًا، وخطها الزمني، ويوميات رفاقك، وملاحظاتك.
|
|
215
220
|
- **العالم**: خريطة العالم، وما تعرفه شخصيتك، والمستندات التي عُثر عليها، والتقويم.
|
|
216
221
|
- **صينية النرد**: اختر النرد والمُعدِّل، ثم ارمِ. زر ×2 يضاعف النرد ولا يضاعف المُعدِّل، كما في الضربة الحرجة.
|
|
217
|
-
- **نقاط الحفظ** و**المساعدة** و**الإعدادات** و**حول**: أيقونات في نهاية الصف. وتضم **الإعدادات** أيضًا تفضيلات الصفحة نفسها: السمة، وصوت النرد، ومجموعة النرد، و**أسلوب اللعبة**، أي ألوان الصفحة ووجوهها وصورها. وقد يكون أسلوب نظام اللعبة، أو سمة أضفتها من Packages › Add عبر الكتالوج، أو رابط GitHub، أو ملف .zip، أو مجلد، أو أسلوب الصفحة نفسها.
|
|
222
|
+
- **نقاط الحفظ** و**المساعدة** و**الإعدادات** و**حول**: أيقونات في نهاية الصف. وتضم **الإعدادات** أيضًا تفضيلات الصفحة نفسها: السمة، وصوت النرد، ومجموعة النرد، و**أسلوب اللعبة**، أي ألوان الصفحة ووجوهها وصورها. وقد يكون أسلوب نظام اللعبة، أو سمة أضفتها من Packages › Add عبر الكتالوج، أو رابط GitHub، أو ملف .zip، أو مجلد، أو أسلوب الصفحة نفسها. إن جعل ملف الأنماط الخاص بسمة ما الصفحة صعبة القراءة، فأوقف **نمط السمة الخاص** هناك: فالإعدادات تظهر دائمًا من دونه، على عنوان الصفحة مع `#/settings` في آخره.
|
|
218
223
|
|
|
219
224
|
حين يسألك مدير اللعبة شيئًا، يبقى شريطه في أعلى الصفحة، في أي قسم كنت.
|
|
220
225
|
|
|
@@ -308,7 +313,7 @@ rpg init "The Salt Isles"
|
|
|
308
313
|
|
|
309
314
|
### مشكلات
|
|
310
315
|
|
|
311
|
-
**لا تُفتح لوحة التحكم.** اسأل مدير اللعبة: `[OOC: ما رابط لوحة التحكم؟]`. لا تعمل إلا ما دامت محادثة
|
|
316
|
+
**لا تُفتح لوحة التحكم.** اسأل مدير اللعبة: `[OOC: ما رابط لوحة التحكم؟]`. لا تعمل إلا ما دامت محادثة من تلك الحملة مفتوحة: ففي Claude Code وCodex تبدأ مع فتح المحادثة، وفي Antigravity مع رسالتك الأولى. وفي تطبيق Claude، المحادثة التي تُترك في الخلفية مدة تنام، وتنام معها الصفحة: انقر على المحادثة تعد الصفحة على العنوان نفسه.
|
|
312
317
|
|
|
313
318
|
**يبدو أن مدير اللعبة لا يعرف اللعبة.** لم يحمّل وكيلك RPG Engine. تحقق من أنك شغّلته في مجلد الحملة وأنك وثقت به. في Claude Code، اكتب `/mcp` وأعد ربط `rpg`. في Codex، يجب أن يعرض الأمر `codex mcp list` في مجلد الحملة `rpg`. وإن لم يُعثر على `rpg --version`، ثبّت RPG Engine من جديد ([2.2](#22-install)).
|
|
314
319
|
|
|
@@ -322,4 +327,4 @@ rpg init "The Salt Isles"
|
|
|
322
327
|
|
|
323
328
|
**يفشل التثبيت، أو لا يبدأ `rpg`.** يجب أن يعرض `node --version` الإصدار 24 أو أحدث. إذا ظهر في Windows أن تشغيل السكربتات معطّل، فراجع [2.1](#21-what-you-need). في Windows، أبقِ RPG Engine وحملاتك بعيدًا عن المسارات التي تحتوي على `&`.
|
|
324
329
|
|
|
325
|
-
**تغيّر رابط لوحة التحكم.**
|
|
330
|
+
**تغيّر رابط لوحة التحكم.** لكل حملة عنوانها الخاص، وهو نفسه محادثة بعد محادثة. ولا يتغيّر إلا حين يكون برنامج آخر يستخدمه أصلًا: يعطيك مدير اللعبة الرابط الجديد، ويبقى بعد ذلك ثابتًا. والمحادثة الثانية من الحملة نفسها تُبقي الصفحة على العنوان نفسه، وتتولاها بعد أن تغلق الأولى.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- Translated from en.md, paragraph by paragraph, by npm run translate: cdcc612c,e51b18d7,be38a186 f2f35057,51f49a5b 128c5761,5e6cbafc,48febcc7,f0f71376,b1381f21,cb3f91d5 5faea867,7780116a,afad321d,99406ef2,f831ecd8,b6a6bfff,b5544596,5c016bb1,3afa0abc,ef6b72c1,bc923cc3,07c079ea,
|
|
1
|
+
<!-- Translated from en.md, paragraph by paragraph, by npm run translate: cdcc612c,e51b18d7,be38a186 f2f35057,51f49a5b 128c5761,5e6cbafc,48febcc7,f0f71376,b1381f21,cb3f91d5 5faea867,7780116a,afad321d,99406ef2,f831ecd8,b6a6bfff,b5544596,5c016bb1,3afa0abc,ef6b72c1,bc923cc3,07c079ea,8b6ac2d5,7b9a0a41,086f7b8c,da6d0862,06d7d789,e6f82f9e,6def7d66,f27372ca,d904fdec,8da0dbd5,1c13fe15,de62cd09,1aa7894f,56b73d9b,d9fbeec2,74dc52f1,a2da9de6,cb3f91d5 09eaf555,63d0c1fb,27c765d2,46692547,1c335942,25f9bdf8,6bd01b74,b0846f60,602a5e46,6fee496f,71124663,4bed5644,c2bbeff9,12a7bf4b,15e36217,4b57013e,cb7d8189,b2a29c8a,056b4e29,2ef22287,d61653a8,9d7e522f,f4c26681,c6b050c9,6c58220c,5f7b18e6,6a64e757,ad3fa941,57283bd2,e9fa262a,44639926,6cb75000,86179abe,323d8fa3,f8d6b2fd,18bc17d2,3bbb14f4,774591fd,65ff2775,623c2986,0fac97e5,d3afc486,cb3f91d5 ec2eeb06,92e343cc,fa64227b,da0fad21,cb3f91d5 5dafa85b,c5ec9f44,2e849e73,35a85f2e,607c7f74,95ffeabc,7687ded0,4ee5ae41,fd2934d1,177ddff0,a78e1054,025009be,c8315e19,cb3f91d5 40941750,f3b2d1f6,cb3f91d5 30c03e82,209b159b,6ea1911c,b8e71497,32482cb4,65c75baa,cb3f91d5 eac34391,4497f74b,487e04c0,c6ebe0c0,cb3f91d5 2f86bef9,9402592c,cb3f91d5 519ce5ee,de58bc03,fd906c57,697b0622,180f77d8,e0f88bdb,1e0ccfed,05fde17f,5070d986,f83c9d82,5b0bb1d2,600db53a,6b115391,5db3836c,252805d8,df64a3bb,e9a3f2a9. Change the English, then run it again. -->
|
|
2
2
|
# RPG Engine: kompletní průvodce
|
|
3
3
|
|
|
4
4
|
**RPG Engine** ti umožní hrát stolní hru na hrdiny s **AI jako Pánem jeskyně**. S Pánem jeskyně si povídáš v **chatu**. RPG Engine pracuje v pozadí: **pamatuje si svět**, **hází kostkami** a **vede účty**. Vedle chatu máš v prohlížeči otevřenou stránku, **dashboard**, s deníkem postavy, kostkami, mapami a kronikou.
|
|
@@ -64,13 +64,16 @@ Pán jeskyně kampaň za tebe vytvořit nemůže: před příkazem `init` nic ne
|
|
|
64
64
|
|
|
65
65
|
### 2.4 Připojení AI
|
|
66
66
|
|
|
67
|
-
Pán jeskyně běží v **AI agentovi**: je to AI aplikace, v terminálu nebo na ploše, která umí pracovat se soubory v tvém počítači, například Claude Code, Codex nebo
|
|
67
|
+
Pán jeskyně běží v **AI agentovi**: je to AI aplikace, v terminálu nebo na ploše, která umí pracovat se soubory v tvém počítači, například Claude Code, Codex, Antigravity nebo OpenCode. Obyčejný chat jako claude.ai nebo ChatGPT, případně aplikace v telefonu, nestačí: Pán jeskyně se musí dostat k souborům kampaně v tvém počítači. Každý agent potřebuje vlastní tarif a přihlášení: Claude Code placený tarif Claude, Codex přihlášení do ChatGPT, Antigravity účet Google, jehož bezplatný tarif má malou týdenní kvótu. OpenCode funguje s modely, které mu zadáš, včetně lokálních. Nainstaluješ ho jednou, z jeho vlastní stránky: [Claude Code](https://code.claude.com/docs/en/setup), [Codex](https://developers.openai.com/codex), [Antigravity](https://antigravity.google), [OpenCode](https://opencode.ai).
|
|
68
68
|
|
|
69
69
|
- **Claude Code**: ve složce kampaně napiš `claude`. Když se zeptá, jestli složce důvěřuješ, zvol **Yes, I trust this folder**. Pozor, předvolená odpověď je *No, exit*. Kampaň má také malý hook, `rpg --listen`, který otázka neukazuje: okamžitě sdělí Pánu jeskyně, když něco uděláš na dashboardu.
|
|
70
70
|
- **Codex**: ve složce kampaně napiš `codex` a na otázku, jestli složce důvěřuješ, odpověz ano. V jeho desktopové aplikaci zkontroluj v nastavení, že jsou paměti pro chaty hry vypnuté.
|
|
71
|
-
- **Antigravity**: ve složce kampaně napiš `agy` a pokud se zeptá, jestli složce důvěřuješ, odpověz ano. Kampaň má
|
|
71
|
+
- **Antigravity**: ve složce kampaně napiš `agy` a pokud se zeptá, jestli složce důvěřuješ, odpověz ano; nebo v jeho aplikaci otevři složku kampaně. Pro aplikaci se RPG Engine také sám přidá do vlastního nastavení Antigravity, `.gemini/config/mcp_config.json` ve tvé domovské složce, které platí pro každou složku, kterou otevřeš, nejen pro složku kampaně: mimo kampaň nedělá nic. Kampaň má dva malé hooky: `rpg --approve` dovolí Pánu jeskyně používat nástroje RPG Engine, aniž by se tě na to pokaždé ptal, a `rpg --listen` okamžitě sdělí Pánu jeskyně, když něco uděláš na dashboardu. Obrázky v chatu maluje Pán jeskyně sám. Když selže jeho nástroj na obrázky, nakreslí jednoduché vektorové obrázky, stejně jako Claude. Antigravity uchovává tvoje dřívější chaty a jeho paměť nejde vypnout: Pán jeskyně má pokyn, aby je nikdy nečetl. Co napíšeš, jde do Googlu, kde to mohou číst lidé: nevkládej do hry osobní údaje. RPG Engine není produkt Googlu.
|
|
72
|
+
- **OpenCode**: ve složce kampaně napiš `opencode`. Kampaň má malý plugin, `.opencode/plugins/rpg.js`, který okamžitě sdělí Pánu jeskyně, když něco uděláš na dashboardu. V kampani Pán jeskyně zapisuje soubory jen přes RPG Engine: vlastní zapisování a úpravy souborů v OpenCode jsou tam vypnuté a před spuštěním příkazu se tě zeptá. Obrázky kreslí Pán jeskyně sám, jako jednoduché vektorové obrázky, stejně jako Claude. Tvůj OpenCode s modelem, který jsi v něm naposledy zvolil(a), také mimo chat překládá dashboard a pravidla hry a čte dokumenty, které importuješ. Pokud nemá model, který může použít, udělá to Codex nebo Claude Code, pokud je máš.
|
|
72
73
|
- **Jiný agent**: spusť ho ve složce kampaně a připoj k němu server MCP `rpg mcp`. RPG Engine je standardní server MCP: Pánem jeskyně může být každý agent, který MCP podporuje, i lokální.
|
|
73
74
|
|
|
75
|
+
Pokud Pán jeskyně řekne, že nemůže najít nástroje RPG Engine, napiš ve složce kampaně `rpg init`: ve složce, která už je kampaní, pouze aktualizuje tyto soubory. Potom otevři nový chat.
|
|
76
|
+
|
|
74
77
|
Hrajeme a testujeme s **Claude Code**. **Codex** a **Antigravity** jsou připojené a ověřené, ale zatím se s nimi neodehrála celá kampaň. Kampaň vypíná vlastní paměť agenta: hra žije v jeho souborech, aby návrat k uložené hře opravdu vrátil zpět.
|
|
75
78
|
|
|
76
79
|
### 2.5 První chat
|
|
@@ -183,6 +186,8 @@ V každém režimu můžeš **začít znovu**, od začátku hry nebo od nultého
|
|
|
183
186
|
|
|
184
187
|
Po návratu zpět **otevři nový chat**: starý si pamatuje, co bylo zrušeno. V novém chatu napiš *pokračuj*, potom v Uložené hry stiskni **Nový chat otevřen**.
|
|
185
188
|
|
|
189
|
+
Pokud je složka kampaně repozitář gitu, **Nastavení** obsahuje sekci **Git**, kde je všechno vypnuté, dokud nezvolíš jinak: commit na začátku každého sezení, při každém uložení hry a na konci každé scény a po něm případně push. Commit je snímek kampaně v dané chvíli. Push pošle snímky do online repozitáře, třeba na GitHub, aby kopie existovala i mimo tento počítač. Uložené hry a tvoje chaty s Pánem jeskyně zůstávají mimo repozitář, dokud je do něj nepustíš. Chaty tam pusť, jen když je repozitář soukromý.
|
|
190
|
+
|
|
186
191
|
### 3.9 Sezení: přestávka a návrat
|
|
187
192
|
|
|
188
193
|
Přestaň, kdy chceš: *[Pro dnešek skončeme.]* Všechno je už uloženo v souborech. Až se budeš chtít vrátit, spusť svého agenta ve složce kampaně a napiš *pokračuj*: Pán jeskyně ti krátce shrne děj a jde se dál.
|
|
@@ -214,7 +219,7 @@ Stránka na tvém počítači, kterou otevřeš jen v prohlížeči na tomto po
|
|
|
214
219
|
- **Kronika**: úkoly, příběh jako kniha, jeho časová osa, deníky tvých společníků a tvé poznámky.
|
|
215
220
|
- **Svět**: mapa světa, co tvá postava ví, nalezené dokumenty a kalendář.
|
|
216
221
|
- **Podnos na kostky**: vyber kostky a opravu a hoď. ×2 zdvojnásobí kostky, nikdy ne opravu, jako při kritickém zásahu.
|
|
217
|
-
- **Uložené hry**, **Nápověda**, **Nastavení** a **O aplikaci**: ikony na konci řady. V **Nastavení** najdeš také vlastní předvolby stránky: motiv, zvuk kostek, sadu kostek a **Styl hry**, tedy barvy, podoby a obrázky stránky. Může to být styl herního systému, motiv
|
|
222
|
+
- **Uložené hry**, **Nápověda**, **Nastavení** a **O aplikaci**: ikony na konci řady. V **Nastavení** najdeš také vlastní předvolby stránky: motiv, zvuk kostek, sadu kostek a **Styl hry**, tedy barvy, podoby a obrázky stránky. Může to být styl herního systému, motiv přidaný v Packages › Add z katalogu, z odkazu na GitHub, ze souboru .zip nebo ze složky, anebo vlastní styl stránky. Pokud kvůli vlastnímu stylu motivu není stránka dobře čitelná, vypni tam **Vlastní styl motivu**. Nastavení se vždy zobrazí bez něj, na adrese stránky s `#/settings` na konci.
|
|
218
223
|
|
|
219
224
|
Když se tě Pán jeskyně na něco zeptá, jeho nápis zůstane nahoře, ať jsi v jakékoli části.
|
|
220
225
|
|
|
@@ -308,7 +313,7 @@ Každý příkaz, který Pán jeskyně používá, jde spustit i ve složce kamp
|
|
|
308
313
|
|
|
309
314
|
### Problémy
|
|
310
315
|
|
|
311
|
-
**Dashboard se neotevře.** Zeptej se Pána jeskyně: `[OOC: Jaký je odkaz na dashboard?]`. Funguje jen tehdy, když je v té kampani otevřený chat,
|
|
316
|
+
**Dashboard se neotevře.** Zeptej se Pána jeskyně: `[OOC: Jaký je odkaz na dashboard?]`. Funguje jen tehdy, když je v té kampani otevřený chat: v Claude Code a Codexu se spouští spolu s otevřením chatu, v Antigravity s tvou první zprávou. V aplikaci Claude chat, který chvíli zůstane na pozadí, usne a stránka s ním: klikni na chat a stránka se vrátí na stejné adrese.
|
|
312
317
|
|
|
313
318
|
**Pán jeskyně jako by hru neznal.** Tvůj agent nenačetl RPG Engine. Zkontroluj, že jsi ho spustil(a) ve složce kampaně a že jsi jí důvěřoval(a). V Claude Code napiš `/mcp` a znovu připoj `rpg`. V Codexu musí `codex mcp list` ve složce kampaně ukázat `rpg`. Pokud se `rpg --version` nenajde, nainstaluj RPG Engine znovu ([2.2](#22-install)).
|
|
314
319
|
|
|
@@ -322,4 +327,4 @@ Každý příkaz, který Pán jeskyně používá, jde spustit i ve složce kamp
|
|
|
322
327
|
|
|
323
328
|
**Instalace selže, nebo `rpg` nechce začít.** `node --version` musí hlásit 24 nebo novější. Pokud Windows odpoví, že spouštění skriptů je zakázané, viz [2.1](#21-what-you-need). Ve Windows nech RPG Engine a své kampaně mimo cesty, které obsahují `&`.
|
|
324
329
|
|
|
325
|
-
**Odkaz na dashboard se změnil.**
|
|
330
|
+
**Odkaz na dashboard se změnil.** Každá kampaň má vlastní adresu, chat za chatem stejnou. Změní se jen tehdy, když ji už používá jiný program: Pán jeskyně ti dá nový odkaz a od té chvíle zůstane. Druhý chat stejné kampaně drží stránku na stejné adrese a převezme ji, jakmile zavřeš první.
|