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/README.md
CHANGED
|
@@ -25,7 +25,7 @@ An AI is a wonderful storyteller, but a storyteller tends to make the world fit
|
|
|
25
25
|
- **Save**, as in a video game: at the end of every scene, to go back or start over as you choose.
|
|
26
26
|
- **Choose how you play**: difficulty, lethality, how much the master teaches the rules, its style, your lines and veils.
|
|
27
27
|
- **Play in your language**: the dashboard speaks 26, and any other is translated for you.
|
|
28
|
-
- **See where you are**: pictures of the places you reach, the quests you take and the people you meet. Painted ones, as the inn above, come from **Codex** signed in with your ChatGPT account, even when your master is Claude Code; Antigravity paints its own. Install Codex with `npm install -g @openai/codex` and sign in once with `codex login`. With Claude Code alone, the master draws
|
|
28
|
+
- **See where you are**: pictures of the places you reach, the quests you take and the people you meet. Painted ones, as the inn above, come from **Codex** signed in with your ChatGPT account, even when your master is Claude Code; Antigravity paints its own with a paid Google plan, and can paint for another master too. Install Codex with `npm install -g @openai/codex` and sign in once with `codex login`. With Claude Code alone, Claude draws simpler vector ones; in OpenCode, and in Antigravity when its tool fails, the master draws them itself, the same way.
|
|
29
29
|
|
|
30
30
|
## The game
|
|
31
31
|
|
|
@@ -43,11 +43,11 @@ A game comes as a game system, a package the master installs when you set up a c
|
|
|
43
43
|
|
|
44
44
|
## What you need
|
|
45
45
|
|
|
46
|
-
**Node.js 24** or newer, a web browser, and an AI agent to be the master: an AI app that can work with the files on your computer, such as Claude Code, Codex or
|
|
46
|
+
**Node.js 24** or newer, a web browser, and an AI agent to be the master: an AI app that can work with the files on your computer, such as Claude Code, Codex, Antigravity or OpenCode. A plain chat such as claude.ai or ChatGPT, or a phone app, is not enough: the master needs to reach the campaign's files on your computer.
|
|
47
47
|
|
|
48
|
-
RPG Engine is tied to no AI company: any agent that supports MCP tools can be the master, local ones included. We play and test it with **Claude Code**; **Codex** and **
|
|
48
|
+
RPG Engine is tied to no AI company: any agent that supports MCP tools can be the master, local ones included. We play and test it with **Claude Code**; **Codex**, **Antigravity** and **OpenCode** are connected and checked, from the terminal and from their desktop apps, but no whole campaign has been played with them yet: [what works in each](https://github.com/stefanocaronia/rpg-engine/blob/main/docs/hosts.md) is a table of its own; [the guide](https://github.com/stefanocaronia/rpg-engine/blob/main/src/dashboard/guide/en.md#24-connect-your-ai) says how to connect any other agent. Give the master the largest model you have: a small one is easier to talk into revealing secrets or bending the rules.
|
|
49
49
|
|
|
50
|
-
RPG Engine is free: the master runs on your agent's own plan (for Claude Code, a paid Claude plan; for Codex, a ChatGPT account; for Antigravity, a Google account), or on your computer with a local model. RPG Engine itself never
|
|
50
|
+
RPG Engine is free: the master runs on your agent's own plan (for Claude Code, a paid Claude plan; for Codex, a ChatGPT account; for Antigravity, a Google account; for OpenCode, the model you choose in it), or on your computer with a local model. RPG Engine itself never asks for an API key nor keeps one: where your agent lets you choose, sign it in with your account rather than with a key, which is paid by the call. You do not need to know how to program, and once your agent is installed, you are playing in a few minutes.
|
|
51
51
|
|
|
52
52
|
## Quick start
|
|
53
53
|
|
|
@@ -62,7 +62,7 @@ claude
|
|
|
62
62
|
|
|
63
63
|
If Windows answers that running scripts is disabled, write once `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`, answer yes and try again.
|
|
64
64
|
|
|
65
|
-
With Codex write `codex`, with Antigravity `agy`; with another agent, start it in that folder (the guide says how to connect it). When it asks whether you trust the folder, say yes; careful, in Claude Code the answer already selected is *No, exit*.
|
|
65
|
+
With Codex write `codex`, with Antigravity `agy`, with OpenCode `opencode`; with another agent, start it in that folder (the guide says how to connect it). Each of the four has a desktop app too: open the campaign folder in it. When it asks whether you trust the folder, say yes; careful, in Claude Code the answer already selected is *No, exit*. If you install an agent after you made the campaign, write `rpg init` in the campaign folder once, and open a new chat.
|
|
66
66
|
|
|
67
67
|
Then write *Hi! Let's start.* The master answers with the link to your dashboard: open it beside the chat. It asks how you want to play, a few questions at a time, then you make your character together, and the story begins.
|
|
68
68
|
|
|
@@ -2,6 +2,11 @@ import { type HostInstructions } from "./host-files.ts";
|
|
|
2
2
|
import { type CampaignSettings } from "./settings.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a campaign in `folder`: campaign.yaml, state.yaml, the sessions folder, the inbox for the player's pictures, the .mcp.json through which AI hosts such as Claude Code find the rpg tools,
|
|
5
|
-
* and the host files that send them to the start lines and give
|
|
5
|
+
* and the host files that send them to the start lines and give each AI app with subagents the character agent (D-97, D-242, D-490, D-580). `platform` is the operating system, as Node names it. Returns the campaign's full path.
|
|
6
6
|
*/
|
|
7
7
|
export declare function createCampaign(folder: string, settings: CampaignSettings, platform: string, instructions: HostInstructions): string;
|
|
8
|
+
/**
|
|
9
|
+
* Brings the files through which the AI hosts find the game up to date in a campaign that exists, as init does when given its folder again: the rpg server
|
|
10
|
+
* in .mcp.json when missing, and the host files. A broken settings file of a host, or a link among the folders written, stops it with how to fix it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function updateHostFiles(root: string, platform: string, instructions: HostInstructions): void;
|
|
@@ -3,12 +3,12 @@ import { join, resolve } from "node:path";
|
|
|
3
3
|
import { stringify } from "yaml";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { files } from "../core/store.js";
|
|
6
|
-
import { campaignFileName, findCampaign, inboxFolderName, sessionsFolderName } from "./find-campaign.js";
|
|
6
|
+
import { campaignFileName, findCampaign, inboxFolderName, refuseCampaignLinks, sessionsFolderName } from "./find-campaign.js";
|
|
7
7
|
import { hostFileChanges, rpgServer, writeHostFile } from "./host-files.js";
|
|
8
8
|
import { settingsSchema } from "./settings.js";
|
|
9
9
|
/**
|
|
10
10
|
* Creates a campaign in `folder`: campaign.yaml, state.yaml, the sessions folder, the inbox for the player's pictures, the .mcp.json through which AI hosts such as Claude Code find the rpg tools,
|
|
11
|
-
* and the host files that send them to the start lines and give
|
|
11
|
+
* and the host files that send them to the start lines and give each AI app with subagents the character agent (D-97, D-242, D-490, D-580). `platform` is the operating system, as Node names it. Returns the campaign's full path.
|
|
12
12
|
*/
|
|
13
13
|
export function createCampaign(folder, settings, platform, instructions) {
|
|
14
14
|
const root = resolve(folder);
|
|
@@ -17,7 +17,8 @@ export function createCampaign(folder, settings, platform, instructions) {
|
|
|
17
17
|
if (!parsed.success) {
|
|
18
18
|
throw new Error(`The campaign settings are not valid:\n${z.prettifyError(parsed.error)}`);
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
refuseCampaignLinks(root);
|
|
21
|
+
const mcpConfig = mcpConfigWithRpg(root, platform, "create the campaign again");
|
|
21
22
|
const hostFiles = hostFileChanges(root, instructions, platform);
|
|
22
23
|
files().makeFolder(join(root, sessionsFolderName));
|
|
23
24
|
files().makeFolder(join(root, inboxFolderName));
|
|
@@ -28,19 +29,46 @@ export function createCampaign(folder, settings, platform, instructions) {
|
|
|
28
29
|
hostFiles.forEach(writeHostFile);
|
|
29
30
|
return root;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Brings the files through which the AI hosts find the game up to date in a campaign that exists, as init does when given its folder again: the rpg server
|
|
34
|
+
* in .mcp.json when missing, and the host files. A broken settings file of a host, or a link among the folders written, stops it with how to fix it.
|
|
35
|
+
*/
|
|
36
|
+
export function updateHostFiles(root, platform, instructions) {
|
|
37
|
+
refuseCampaignLinks(root);
|
|
38
|
+
const again = "run rpg init in this folder again";
|
|
39
|
+
const before = mcpConfig(root, again);
|
|
40
|
+
const hostFiles = hostFileChanges(root, instructions, platform);
|
|
41
|
+
if (before.mcpServers?.rpg === undefined) {
|
|
42
|
+
files().write(join(root, ".mcp.json"), JSON.stringify(mcpConfigWithRpg(root, platform, again), null, 2) + "\n");
|
|
43
|
+
}
|
|
44
|
+
hostFiles.forEach(writeHostFile);
|
|
45
|
+
}
|
|
31
46
|
/** The folder's .mcp.json with the rpg server added; other servers already listed stay. On Windows a host must start rpg through cmd. */
|
|
32
|
-
function mcpConfigWithRpg(root, platform) {
|
|
47
|
+
function mcpConfigWithRpg(root, platform, again) {
|
|
48
|
+
const config = mcpConfig(root, again);
|
|
49
|
+
return { ...config, mcpServers: { ...config.mcpServers, rpg: rpgServer(platform) } };
|
|
50
|
+
}
|
|
51
|
+
/** The folder's .mcp.json, empty when there is none; refused, with how to fix it and what to do `again` after, when it holds no JSON object of servers. */
|
|
52
|
+
function mcpConfig(root, again) {
|
|
33
53
|
const path = join(root, ".mcp.json");
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
config = JSON.parse(files().text(path) ?? "");
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
throw new Error(`${path} is not valid JSON, so the rpg server cannot be added to it. Fix it or remove it by hand, then create the campaign again.`);
|
|
41
|
-
}
|
|
54
|
+
if (!files().exists(path)) {
|
|
55
|
+
return {};
|
|
42
56
|
}
|
|
43
|
-
|
|
57
|
+
let config;
|
|
58
|
+
try {
|
|
59
|
+
config = JSON.parse(files().text(path) ?? "");
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
throw new Error(`${path} is not valid JSON, so the rpg server cannot be added to it. Fix it or remove it by hand, then ${again}.`);
|
|
63
|
+
}
|
|
64
|
+
const servers = isObject(config) ? config.mcpServers : undefined;
|
|
65
|
+
if (!isObject(config) || (servers !== undefined && !isObject(servers))) {
|
|
66
|
+
throw new Error(`${path} is not a JSON object with its servers under mcpServers, so the rpg server cannot be added to it. Fix it or remove it by hand, then ${again}.`);
|
|
67
|
+
}
|
|
68
|
+
return config;
|
|
69
|
+
}
|
|
70
|
+
function isObject(value) {
|
|
71
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
44
72
|
}
|
|
45
73
|
/** A campaign cannot sit inside another one, nor hold one. */
|
|
46
74
|
function checkNoOtherCampaign(root) {
|
|
@@ -12,3 +12,8 @@ export declare const bookFolderName = "book";
|
|
|
12
12
|
export declare function findCampaign(folder: string): string | undefined;
|
|
13
13
|
/** Like findCampaign, but fails with a message that says how to get into a campaign. */
|
|
14
14
|
export declare function requireCampaign(folder: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Throws when a folder the engine writes in, or one in it two levels deep, three for the layers, is a link: a symbolic link or a junction; in the hosts' folders,
|
|
17
|
+
* only those where it writes. Before the hosts' files are written, as by init, and at each command.
|
|
18
|
+
*/
|
|
19
|
+
export declare function refuseCampaignLinks(root: string): void;
|
|
@@ -28,7 +28,7 @@ export function requireCampaign(folder) {
|
|
|
28
28
|
if (root === undefined) {
|
|
29
29
|
throw new Error(`There is no campaign here: no ${campaignFileName} in ${resolve(folder)} or in the folders above it. Create one with the init command, or work from inside a campaign folder.`);
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
refuseCampaignLinks(root);
|
|
32
32
|
// The session of the MCP server watches the campaign from the first call that finds it (D-193).
|
|
33
33
|
files().track(root);
|
|
34
34
|
return root;
|
|
@@ -37,9 +37,24 @@ export function requireCampaign(folder) {
|
|
|
37
37
|
const layersFolder = "layers";
|
|
38
38
|
// The folders the engine writes in: a link among them, a junction that came with a folder someone else made, would carry its writes outside the campaign. A file
|
|
39
39
|
// that is a link the store refuses as it writes it.
|
|
40
|
-
const writtenFolders = ["world", "images", "rules", sessionsFolderName, bookFolderName, ".saves", "exports", ".player", ".imports",
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const writtenFolders = ["world", "images", "rules", sessionsFolderName, bookFolderName, ".saves", "exports", ".player", ".imports", layersFolder];
|
|
41
|
+
// The hosts' folders, where the engine writes only its own files, beside the player's: these alone are looked at, never what the player keeps in them.
|
|
42
|
+
const hostFolders = [
|
|
43
|
+
".claude",
|
|
44
|
+
join(".claude", "agents"),
|
|
45
|
+
".codex",
|
|
46
|
+
join(".codex", "agents"),
|
|
47
|
+
".agents",
|
|
48
|
+
join(".agents", "agents"),
|
|
49
|
+
".opencode",
|
|
50
|
+
join(".opencode", "plugins"),
|
|
51
|
+
join(".opencode", "agents"),
|
|
52
|
+
];
|
|
53
|
+
/**
|
|
54
|
+
* Throws when a folder the engine writes in, or one in it two levels deep, three for the layers, is a link: a symbolic link or a junction; in the hosts' folders,
|
|
55
|
+
* only those where it writes. Before the hosts' files are written, as by init, and at each command.
|
|
56
|
+
*/
|
|
57
|
+
export function refuseCampaignLinks(root) {
|
|
43
58
|
const store = files();
|
|
44
59
|
const folders = writtenFolders.map((name) => join(root, name));
|
|
45
60
|
const inside = (folder) => [
|
|
@@ -49,7 +64,7 @@ function refuseLinksOut(root) {
|
|
|
49
64
|
const types = folders.flatMap(inside);
|
|
50
65
|
const deeper = types.flatMap(inside);
|
|
51
66
|
const layerTypes = deeper.filter((path) => isInside(join(root, layersFolder), path)).flatMap(inside);
|
|
52
|
-
const linked = [...folders, ...types, ...deeper, ...layerTypes].find((path) => store.isLink(path));
|
|
67
|
+
const linked = [...folders, ...types, ...deeper, ...layerTypes, ...hostFolders.map((name) => join(root, name))].find((path) => store.isLink(path));
|
|
53
68
|
if (linked !== undefined) {
|
|
54
69
|
throw new Error(`${linked} is a link to somewhere else, and what the engine writes there would leave the campaign: replace it with a real folder, with what it holds copied in.`);
|
|
55
70
|
}
|
|
@@ -19,7 +19,10 @@ export declare function rpgServer(platform: string): {
|
|
|
19
19
|
};
|
|
20
20
|
/** The host files of a campaign that are missing or out of date, with the engine's texts given; a broken settings file of a host stops it with how to fix it. */
|
|
21
21
|
export declare function hostFileChanges(root: string, instructions: HostInstructions, platform: string): HostFile[];
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Brings the host files of a campaign up to date, as the MCP server starts: a file that cannot be read or written stays as it is, and none is written while a
|
|
24
|
+
* folder they go in is a link, which the first command refuses with how to fix it.
|
|
25
|
+
*/
|
|
23
26
|
export declare function refreshHostFiles(root: string, instructions: HostInstructions, platform: string): void;
|
|
24
27
|
/**
|
|
25
28
|
* Writes the master's effort the player chose where each host reads it, as config sets it (D-462); with `cleared`, takes it away, and each app keeps its own.
|
|
@@ -27,8 +30,15 @@ export declare function refreshHostFiles(root: string, instructions: HostInstruc
|
|
|
27
30
|
*/
|
|
28
31
|
export declare function writeEffortFiles(root: string, platform: string, cleared?: boolean): string[];
|
|
29
32
|
/**
|
|
30
|
-
* Whether the campaign has the character agent
|
|
31
|
-
* the chat found the agent, as
|
|
33
|
+
* Whether the campaign has the character agent in each host that has agents (D-490, D-580): looked at as the MCP server starts, before it writes its host
|
|
34
|
+
* files, it says whether the chat found the agent, as the hosts read their agents only when a chat starts.
|
|
35
|
+
*/
|
|
36
|
+
export declare function hasCharacterAgent(root: string): Record<AgentHost, boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Brings up to date the engine's files outside any campaign, in the player's home: Antigravity's own servers, which its app reads for every folder (D-578),
|
|
39
|
+
* when Antigravity is installed. What could not be written, with how to fix it; undefined when all is in order.
|
|
32
40
|
*/
|
|
33
|
-
export declare function
|
|
41
|
+
export declare function refreshUserHostFiles(userHome: string, platform: string): string | undefined;
|
|
42
|
+
/** The hosts whose campaign has the character agent as one of its agents (D-490, D-580). */
|
|
43
|
+
export type AgentHost = "claudeCode" | "openCode" | "codex" | "antigravity";
|
|
34
44
|
export {};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
// What an AI host reads in a campaign besides .mcp.json: AGENTS.md, opening with the start lines (D-97); CLAUDE.md, which imports it; Claude Code's settings,
|
|
2
2
|
// with its auto memory off, so that the master keeps nothing outside the campaign (D-242), the rpg server approved with its tools allowed (D-412) and no tasks in
|
|
3
3
|
// the background, so that the character agent answers within the master's turn (D-490), and the doorbell of the player's sentences (D-495); Codex's, with
|
|
4
|
-
// the rpg server and its memories off (D-362);
|
|
5
|
-
// longer set up (D-493): a campaign's .gemini/ stays as it is.
|
|
4
|
+
// the rpg server and its memories off (D-362); the character agent, the agent the master calls to voice a character, in each host that has agents (D-490,
|
|
5
|
+
// D-580); Antigravity's and OpenCode's, each with the rpg server and the doorbell (D-578). Gemini CLI is no longer set up (D-493): a campaign's .gemini/ stays as it is.
|
|
6
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
6
7
|
import { join } from "node:path";
|
|
7
8
|
import { files } from "../core/store.js";
|
|
9
|
+
import { refuseCampaignLinks } from "./find-campaign.js";
|
|
8
10
|
import { efforts, readTextSetting } from "./settings.js";
|
|
9
11
|
/** The files of the AI hosts at the top of a campaign, which are not the game's: a save leaves them as they are (SAV-2), Gemini CLI's of an older campaign too. */
|
|
10
|
-
export const hostFileNames = ["AGENTS.md", "CLAUDE.md", "CLAUDE.local.md", "GEMINI.md"];
|
|
12
|
+
export const hostFileNames = ["AGENTS.md", "CLAUDE.md", "CLAUDE.local.md", "GEMINI.md", "opencode.json"];
|
|
11
13
|
/** Writes a host file, or takes it away when it has no text. */
|
|
12
14
|
export function writeHostFile(file) {
|
|
13
15
|
if (file.text === undefined) {
|
|
@@ -29,8 +31,17 @@ export function rpgServer(platform) {
|
|
|
29
31
|
export function hostFileChanges(root, instructions, platform) {
|
|
30
32
|
return hostFiles(root, instructions, platform).map((file) => file()).filter((file) => file !== undefined);
|
|
31
33
|
}
|
|
32
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Brings the host files of a campaign up to date, as the MCP server starts: a file that cannot be read or written stays as it is, and none is written while a
|
|
36
|
+
* folder they go in is a link, which the first command refuses with how to fix it.
|
|
37
|
+
*/
|
|
33
38
|
export function refreshHostFiles(root, instructions, platform) {
|
|
39
|
+
try {
|
|
40
|
+
refuseCampaignLinks(root);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
34
45
|
for (const change of hostFiles(root, instructions, platform)) {
|
|
35
46
|
try {
|
|
36
47
|
const file = change();
|
|
@@ -63,21 +74,23 @@ export function writeEffortFiles(root, platform, cleared = false) {
|
|
|
63
74
|
});
|
|
64
75
|
}
|
|
65
76
|
/**
|
|
66
|
-
* Whether the campaign has the character agent
|
|
67
|
-
* the chat found the agent, as
|
|
77
|
+
* Whether the campaign has the character agent in each host that has agents (D-490, D-580): looked at as the MCP server starts, before it writes its host
|
|
78
|
+
* files, it says whether the chat found the agent, as the hosts read their agents only when a chat starts.
|
|
68
79
|
*/
|
|
69
80
|
export function hasCharacterAgent(root) {
|
|
70
|
-
return files().fresh(characterAgentPath(root)) !== undefined;
|
|
81
|
+
return Object.fromEntries(agentHosts.map((host) => [host, files().fresh(characterAgentPath(root, host)) !== undefined]));
|
|
71
82
|
}
|
|
72
83
|
function hostFiles(root, instructions, platform) {
|
|
73
84
|
return [
|
|
74
85
|
() => agentsFile(root, instructions.start),
|
|
75
86
|
() => claudeFile(root),
|
|
76
87
|
() => claudeSettingsFile(root),
|
|
77
|
-
() => characterAgentFile(root, instructions.character),
|
|
88
|
+
...agentHosts.map((host) => () => characterAgentFile(root, host, instructions.character)),
|
|
78
89
|
() => codexConfigFile(root, platform),
|
|
79
90
|
() => antigravityServerFile(root, platform),
|
|
80
91
|
() => antigravityHooksFile(root),
|
|
92
|
+
() => openCodeConfigFile(root, platform),
|
|
93
|
+
() => openCodePluginFile(root),
|
|
81
94
|
];
|
|
82
95
|
}
|
|
83
96
|
/** Antigravity's servers for the campaign, in the format of .mcp.json: the rpg server added when missing; the player's own servers, and their rpg, stay. */
|
|
@@ -89,17 +102,89 @@ function antigravityServerFile(root, platform) {
|
|
|
89
102
|
return servers.rpg !== undefined ? undefined : { path, text: settingsText({ ...config, mcpServers: { ...servers, rpg: rpgServer(platform) } }) };
|
|
90
103
|
}
|
|
91
104
|
/**
|
|
92
|
-
* Antigravity's hooks for the campaign
|
|
93
|
-
* do (D-412), and asks for every other; the
|
|
105
|
+
* Antigravity's hooks for the campaign, under the key rpg, which is the engine's and is written again whenever it differs: before each tool, rpg --approve
|
|
106
|
+
* lets the rpg server's tools run without asking, as Claude Code's and Codex's settings do (D-412), and asks for every other; at the end of each turn, the
|
|
107
|
+
* doorbell (D-578). The player's own hooks stay beside them.
|
|
94
108
|
*/
|
|
95
109
|
function antigravityHooksFile(root) {
|
|
96
110
|
const path = join(root, ".agents", "hooks.json");
|
|
97
111
|
const text = files().fresh(path);
|
|
98
112
|
const hooks = text === undefined ? {} : jsonObject(path, text, "Antigravity cannot be set up for the game in it");
|
|
99
|
-
|
|
113
|
+
const rpg = { PreToolUse: [{ matcher: ".*", hooks: [approveHook] }], Stop: [antigravityBellHook] };
|
|
114
|
+
return JSON.stringify(hooks.rpg) === JSON.stringify(rpg) ? undefined : { path, text: settingsText({ ...hooks, rpg }) };
|
|
100
115
|
}
|
|
101
116
|
// Antigravity's hook that approves the rpg server's tools: it answers in about a second, as the hooks of a chat must.
|
|
102
117
|
const approveHook = { type: "command", command: "rpg --approve", timeout: 10 };
|
|
118
|
+
// Antigravity's Stop hook for the doorbell: it holds the turn's end until the player acts on the dashboard, writes in the chat or stops it; a day at most.
|
|
119
|
+
const antigravityBellHook = { type: "command", command: "rpg --listen antigravity", timeout: 86_400 };
|
|
120
|
+
/**
|
|
121
|
+
* OpenCode's settings for the campaign: the rpg server beside the player's own, in OpenCode's format, keeping what the player set on it, as its environment.
|
|
122
|
+
* Its tools need no permission: OpenCode's agent allows every tool unless told otherwise. The agent's own writing and editing of files is denied, and its
|
|
123
|
+
* shell asks, so that the master writes the campaign only through the rpg tools, as for Gemini CLI (D-362); a permission the player set stays theirs.
|
|
124
|
+
*/
|
|
125
|
+
function openCodeConfigFile(root, platform) {
|
|
126
|
+
const path = join(root, "opencode.json");
|
|
127
|
+
const text = files().fresh(path);
|
|
128
|
+
const config = text === undefined ? {} : jsonObject(path, text, "OpenCode cannot be set up for the game in it");
|
|
129
|
+
const mcp = isObject(config.mcp) ? config.mcp : {};
|
|
130
|
+
const servers = isObject(mcp.servers) ? mcp.servers : {};
|
|
131
|
+
const before = isObject(servers.rpg) ? servers.rpg : {};
|
|
132
|
+
const { command, args } = rpgServer(platform);
|
|
133
|
+
const rpg = { ...before, type: "local", command: [command, ...args] };
|
|
134
|
+
// OpenCode's tools that write or edit a file, a patch too, all ask for edit; its shell writes files as well, and asks the player each time.
|
|
135
|
+
const permission = config.permission === undefined ? openCodePermission : isObject(config.permission) ? { ...openCodePermission, ...config.permission } : config.permission;
|
|
136
|
+
const wanted = { ...config, permission, mcp: { ...mcp, servers: { ...servers, rpg } } };
|
|
137
|
+
return text !== undefined && JSON.stringify(wanted) === JSON.stringify(config) ? undefined : { path, text: settingsText(wanted) };
|
|
138
|
+
}
|
|
139
|
+
// What OpenCode's agent may do by itself in a campaign, where the player set nothing: no writing of files, and the shell only on the player's yes.
|
|
140
|
+
const openCodePermission = { edit: "deny", shell: "ask" };
|
|
141
|
+
/**
|
|
142
|
+
* The engine's plugin for OpenCode, which runs no hooks of its own: on OpenCode's events it runs the doorbell after each turn, and sends its line to the
|
|
143
|
+
* chat (D-578). Its source is in the package, under a name no host reads there; written again whenever it differs.
|
|
144
|
+
*/
|
|
145
|
+
function openCodePluginFile(root) {
|
|
146
|
+
const path = join(root, ".opencode", "plugins", "rpg.js");
|
|
147
|
+
openCodePlugin ??= readFileSync(new URL("../../plugins/opencode.js", import.meta.url), "utf8");
|
|
148
|
+
return files().fresh(path) === openCodePlugin ? undefined : { path, text: openCodePlugin };
|
|
149
|
+
}
|
|
150
|
+
let openCodePlugin;
|
|
151
|
+
/**
|
|
152
|
+
* Brings up to date the engine's files outside any campaign, in the player's home: Antigravity's own servers, which its app reads for every folder (D-578),
|
|
153
|
+
* when Antigravity is installed. What could not be written, with how to fix it; undefined when all is in order.
|
|
154
|
+
*/
|
|
155
|
+
export function refreshUserHostFiles(userHome, platform) {
|
|
156
|
+
try {
|
|
157
|
+
const file = antigravityInstalled(userHome, platform) ? antigravityAppFile(userHome, platform) : undefined;
|
|
158
|
+
if (file !== undefined) {
|
|
159
|
+
writeHostFile(file);
|
|
160
|
+
}
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
return error instanceof Error ? error.message : String(error);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/** Whether Antigravity is installed for the player: its app's folder or its command line's in the home, or its program. */
|
|
168
|
+
function antigravityInstalled(userHome, platform) {
|
|
169
|
+
const program = platform === "win32" ? join(userHome, "AppData", "Local", "agy", "bin", "agy.exe") : join(userHome, ".local", "bin", "agy");
|
|
170
|
+
return [join(userHome, ".gemini", "antigravity"), join(userHome, ".gemini", "antigravity-cli"), program].some((path) => existsSync(path));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Antigravity's own servers, which its app starts for every folder: the rpg server beside the player's, keeping what they set on it, as disabled tools or its
|
|
174
|
+
* environment; outside a campaign it routes each conversation to the campaign it plays (D-578). An empty file holds no servers.
|
|
175
|
+
*/
|
|
176
|
+
function antigravityAppFile(userHome, platform) {
|
|
177
|
+
const path = join(userHome, ".gemini", "config", "mcp_config.json");
|
|
178
|
+
if (existsSync(path) && !statSync(path).isFile()) {
|
|
179
|
+
throw new Error(`${path} is a folder, not Antigravity's settings, so its app cannot be set up for the game: take it away, then run rpg init in the campaign again.`);
|
|
180
|
+
}
|
|
181
|
+
const text = files().fresh(path);
|
|
182
|
+
const config = text === undefined || text.trim() === "" ? {} : jsonObject(path, text, "Antigravity's app cannot be set up for the game", "run rpg init in the campaign again");
|
|
183
|
+
const servers = isObject(config.mcpServers) ? config.mcpServers : {};
|
|
184
|
+
const before = isObject(servers.rpg) ? servers.rpg : {};
|
|
185
|
+
const wanted = settingsText({ ...config, mcpServers: { ...servers, rpg: { ...before, ...rpgServer(platform) } } });
|
|
186
|
+
return text === wanted ? undefined : { path, text: wanted };
|
|
187
|
+
}
|
|
103
188
|
/** The master's effort the player chose (D-462), for each host's file; undefined when unset, and what the files hold stays. */
|
|
104
189
|
function chosenEffort(root) {
|
|
105
190
|
const effort = readTextSetting(root, "effort");
|
|
@@ -117,32 +202,104 @@ function agentsFile(root, startLines) {
|
|
|
117
202
|
const updated = markedBlock.test(lines) ? lines.replace(markedBlock, () => block) : `${block}\n\n${lines}`;
|
|
118
203
|
return updated === lines ? undefined : { path, text: text.includes("\r\n") ? updated.replace(/\n/g, "\r\n") : updated };
|
|
119
204
|
}
|
|
120
|
-
|
|
121
|
-
|
|
205
|
+
// What every host's file of the character agent says of itself.
|
|
206
|
+
const agentHeader = "# Written by rpg, which writes it again as the game starts: a change made here does not last.";
|
|
207
|
+
const agentDescription = "Voices one character of the campaign at a key moment, knowing only what they know. Begin with their name, then the moment, as Voices says.";
|
|
208
|
+
/** Each host's file of the character agent: where it goes in a campaign, and its text with the agent's instructions. */
|
|
209
|
+
const characterAgents = {
|
|
210
|
+
// Claude Code's: it reads only its character's view, and not the campaign's CLAUDE.md, the master's instructions.
|
|
211
|
+
claudeCode: {
|
|
212
|
+
path: [".claude", "agents", "rpg-character.md"],
|
|
213
|
+
text: (instructions) => [
|
|
214
|
+
"---",
|
|
215
|
+
agentHeader,
|
|
216
|
+
"name: rpg-character",
|
|
217
|
+
`description: ${agentDescription}`,
|
|
218
|
+
"tools: mcp__rpg__view",
|
|
219
|
+
"model: inherit",
|
|
220
|
+
"omitClaudeMd: true",
|
|
221
|
+
"---",
|
|
222
|
+
"",
|
|
223
|
+
instructions,
|
|
224
|
+
"",
|
|
225
|
+
].join("\n"),
|
|
226
|
+
},
|
|
227
|
+
// OpenCode's: every tool denied but execute and the rpg server's view, which OpenCode's subagents reach through execute.
|
|
228
|
+
openCode: {
|
|
229
|
+
path: [".opencode", "agents", "rpg-character.md"],
|
|
230
|
+
text: (instructions) => {
|
|
231
|
+
const rule = (action, effect) => [` - action: "${action}"`, ' resource: "*"', ` effect: ${effect}`];
|
|
232
|
+
return [
|
|
233
|
+
"---",
|
|
234
|
+
agentHeader,
|
|
235
|
+
`description: ${agentDescription}`,
|
|
236
|
+
"mode: subagent",
|
|
237
|
+
"permissions:",
|
|
238
|
+
...rule("*", "deny"),
|
|
239
|
+
...rule("execute", "allow"),
|
|
240
|
+
...rule("rpg_view", "allow"),
|
|
241
|
+
"---",
|
|
242
|
+
"",
|
|
243
|
+
instructions,
|
|
244
|
+
"",
|
|
245
|
+
'Your tool: tools.rpg.view, called through execute, as await tools.rpg.view({ as: "your name" }).',
|
|
246
|
+
"",
|
|
247
|
+
].join("\n");
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
// Codex's role, without its shell, apps, plugins and skills; an unknown key drops the whole role, and the server lets it only look (D-580).
|
|
251
|
+
codex: {
|
|
252
|
+
path: [".codex", "agents", "rpg-character.toml"],
|
|
253
|
+
text: (instructions) => [
|
|
254
|
+
agentHeader,
|
|
255
|
+
'name = "rpg-character"',
|
|
256
|
+
`description = "${agentDescription}"`,
|
|
257
|
+
'developer_instructions = """',
|
|
258
|
+
instructions,
|
|
259
|
+
'"""',
|
|
260
|
+
"",
|
|
261
|
+
"[features]",
|
|
262
|
+
"shell_tool = false",
|
|
263
|
+
"apps = false",
|
|
264
|
+
"plugins = false",
|
|
265
|
+
"",
|
|
266
|
+
"[skills]",
|
|
267
|
+
"include_instructions = false",
|
|
268
|
+
"",
|
|
269
|
+
"[skills.bundled]",
|
|
270
|
+
"enabled = false",
|
|
271
|
+
"",
|
|
272
|
+
].join("\n"),
|
|
273
|
+
},
|
|
274
|
+
// Antigravity's subagent, which the player cannot pick as the main agent; the server lets it only look (D-580).
|
|
275
|
+
antigravity: {
|
|
276
|
+
path: [".agents", "agents", "rpg-character.md"],
|
|
277
|
+
text: (instructions) => [
|
|
278
|
+
"---",
|
|
279
|
+
agentHeader,
|
|
280
|
+
"name: rpg-character",
|
|
281
|
+
`description: ${agentDescription}`,
|
|
282
|
+
"mainAgent: false",
|
|
283
|
+
"subagent: true",
|
|
284
|
+
"model: inherit",
|
|
285
|
+
"---",
|
|
286
|
+
"",
|
|
287
|
+
instructions,
|
|
288
|
+
"",
|
|
289
|
+
].join("\n"),
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
const agentHosts = Object.keys(characterAgents);
|
|
293
|
+
function characterAgentPath(root, host) {
|
|
294
|
+
return join(root, ...characterAgents[host].path);
|
|
122
295
|
}
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*/
|
|
127
|
-
function characterAgentFile(root, instructions) {
|
|
128
|
-
const path = characterAgentPath(root);
|
|
129
|
-
// The player wants the master to voice every character.
|
|
296
|
+
/** The character agent in a host's format (D-490): the engine's, rewritten when it changed, and taken away when the player wants the master to voice every character. */
|
|
297
|
+
function characterAgentFile(root, host, instructions) {
|
|
298
|
+
const path = characterAgentPath(root, host);
|
|
130
299
|
if (readTextSetting(root, "voices") === "master") {
|
|
131
300
|
return files().fresh(path) === undefined ? undefined : { path };
|
|
132
301
|
}
|
|
133
|
-
const text = [
|
|
134
|
-
"---",
|
|
135
|
-
"# Written by rpg, which writes it again as the game starts: a change made here does not last.",
|
|
136
|
-
"name: rpg-character",
|
|
137
|
-
"description: Voices one character of the campaign at a key moment, knowing only what they know. Begin with their name, then the moment, as Voices says.",
|
|
138
|
-
"tools: mcp__rpg__view",
|
|
139
|
-
"model: inherit",
|
|
140
|
-
"omitClaudeMd: true",
|
|
141
|
-
"---",
|
|
142
|
-
"",
|
|
143
|
-
instructions,
|
|
144
|
-
"",
|
|
145
|
-
].join("\n");
|
|
302
|
+
const text = characterAgents[host].text(instructions);
|
|
146
303
|
return files().fresh(path)?.replace(/\r\n/g, "\n") === text ? undefined : { path, text };
|
|
147
304
|
}
|
|
148
305
|
/** CLAUDE.md, which Claude Code reads, importing AGENTS.md: added first to one that does not. */
|
|
@@ -229,8 +386,8 @@ function withTopKey(text, key, value) {
|
|
|
229
386
|
const joined = [head, rest.join("\n")].filter((part) => part.trim() !== "").join("\n\n");
|
|
230
387
|
return joined.trimEnd() === plain.trimEnd() ? text : joined;
|
|
231
388
|
}
|
|
232
|
-
/** A host's settings file read as a JSON object; refused, with how to fix it
|
|
233
|
-
function jsonObject(path, text, cannot) {
|
|
389
|
+
/** A host's settings file read as a JSON object; refused, with how to fix it and what to do `then`, when it is not one. */
|
|
390
|
+
function jsonObject(path, text, cannot, then = "try again") {
|
|
234
391
|
let settings;
|
|
235
392
|
try {
|
|
236
393
|
settings = JSON.parse(text.replace(/^\uFEFF/, ""));
|
|
@@ -239,7 +396,7 @@ function jsonObject(path, text, cannot) {
|
|
|
239
396
|
settings = undefined;
|
|
240
397
|
}
|
|
241
398
|
if (!isObject(settings)) {
|
|
242
|
-
throw new Error(`${path} is not valid JSON, so ${cannot}. Fix it or remove it by hand, then
|
|
399
|
+
throw new Error(`${path} is not valid JSON, so ${cannot}. Fix it or remove it by hand, then ${then}.`);
|
|
243
400
|
}
|
|
244
401
|
return settings;
|
|
245
402
|
}
|
package/dist/campaign/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { type ChoiceItem, type ChoiceSet, type PickRange, pickText, readChoices, readPick, writeChoices } from "./choices.ts";
|
|
2
|
-
export { createCampaign } from "./create-campaign.ts";
|
|
2
|
+
export { createCampaign, updateHostFiles } from "./create-campaign.ts";
|
|
3
3
|
export { bookFolderName, campaignFileName, findCampaign, houseRulesFolderName, inboxFolderName, requireCampaign, sessionsFolderName } from "./find-campaign.ts";
|
|
4
|
-
export { hasCharacterAgent, hostFileNames, refreshHostFiles, writeEffortFiles } from "./host-files.ts";
|
|
4
|
+
export { hasCharacterAgent, hostFileNames, refreshHostFiles, refreshUserHostFiles, writeEffortFiles } from "./host-files.ts";
|
|
5
5
|
export { lastChoices, rememberChoice, rememberedSettings } from "./last-choices.ts";
|
|
6
6
|
export { type CountedByGame, customLevel, customLevels, customSettings, difficulties, difficultyItems, itemMeaning, leveled, type LeveledSetting, rigorItems, rigors, startingLevels } from "./levels.ts";
|
|
7
7
|
export { portFileName, savedPort, savePort } from "./port.ts";
|
package/dist/campaign/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// The campaign: a folder with campaign.yaml, its settings, the present, the sessions and the files an AI host reads.
|
|
2
2
|
export { pickText, readChoices, readPick, writeChoices } from "./choices.js";
|
|
3
|
-
export { createCampaign } from "./create-campaign.js";
|
|
3
|
+
export { createCampaign, updateHostFiles } from "./create-campaign.js";
|
|
4
4
|
export { bookFolderName, campaignFileName, findCampaign, houseRulesFolderName, inboxFolderName, requireCampaign, sessionsFolderName } from "./find-campaign.js";
|
|
5
|
-
export { hasCharacterAgent, hostFileNames, refreshHostFiles, writeEffortFiles } from "./host-files.js";
|
|
5
|
+
export { hasCharacterAgent, hostFileNames, refreshHostFiles, refreshUserHostFiles, writeEffortFiles } from "./host-files.js";
|
|
6
6
|
export { lastChoices, rememberChoice, rememberedSettings } from "./last-choices.js";
|
|
7
7
|
export { customLevel, customLevels, customSettings, difficulties, difficultyItems, itemMeaning, leveled, rigorItems, rigors, startingLevels } from "./levels.js";
|
|
8
8
|
export { portFileName, savedPort, savePort } from "./port.js";
|
|
@@ -85,10 +85,10 @@ export { unitSystems };
|
|
|
85
85
|
/** Which pictures the engine has made, where it can (D-308, D-388, D-420): none, only those the player asks for, or one for each new place, quest and one met. */
|
|
86
86
|
export declare const pictureWays: readonly ["none", "on request", "new elements"];
|
|
87
87
|
/**
|
|
88
|
-
* Who makes the pictures (D-572): the chat in use by its own means, as when unset, Codex, the master with ElevenLabs's image tool, or
|
|
89
|
-
* names in the chat; any other value is that tool's name.
|
|
88
|
+
* Who makes the pictures (D-572): the chat in use by its own means, as when unset, Codex, Antigravity (T-251), the master with ElevenLabs's image tool, or
|
|
89
|
+
* another tool the player names in the chat; any other value is that tool's name.
|
|
90
90
|
*/
|
|
91
|
-
export declare const pictureMakers: readonly ["chat", "codex", "elevenlabs", "other"];
|
|
91
|
+
export declare const pictureMakers: readonly ["chat", "codex", "antigravity", "elevenlabs", "other"];
|
|
92
92
|
/** Who makes the pictures of the campaign of a folder, as its pictures-by setting says; undefined when unset, or with no campaign that reads. */
|
|
93
93
|
export declare function chosenPictureMaker(folder: string): string | undefined;
|
|
94
94
|
/** How much the master thinks before each answer, written for each AI app in the campaign's folder (D-462). */
|
|
@@ -280,14 +280,15 @@ export { unitSystems };
|
|
|
280
280
|
/** Which pictures the engine has made, where it can (D-308, D-388, D-420): none, only those the player asks for, or one for each new place, quest and one met. */
|
|
281
281
|
export const pictureWays = ["none", "on request", "new elements"];
|
|
282
282
|
/**
|
|
283
|
-
* Who makes the pictures (D-572): the chat in use by its own means, as when unset, Codex, the master with ElevenLabs's image tool, or
|
|
284
|
-
* names in the chat; any other value is that tool's name.
|
|
283
|
+
* Who makes the pictures (D-572): the chat in use by its own means, as when unset, Codex, Antigravity (T-251), the master with ElevenLabs's image tool, or
|
|
284
|
+
* another tool the player names in the chat; any other value is that tool's name.
|
|
285
285
|
*/
|
|
286
|
-
export const pictureMakers = ["chat", "codex", "elevenlabs", "other"];
|
|
286
|
+
export const pictureMakers = ["chat", "codex", "antigravity", "elevenlabs", "other"];
|
|
287
287
|
/** What each way of making the pictures means to the master, which config gives for the chosen one, and the player's change of it on the dashboard (D-572). */
|
|
288
288
|
const pictureMakerMeanings = {
|
|
289
289
|
chat: "you make them by this chat's own means, as image gives them",
|
|
290
290
|
codex: "Codex makes them on this computer; where it cannot, this chat does, and you hear why",
|
|
291
|
+
antigravity: "Antigravity paints them on this computer, started apart from its own chats, from the player's Google plan; where it cannot, this chat makes them",
|
|
291
292
|
elevenlabs: "you make them with ElevenLabs's image tool, from the brief image gives you",
|
|
292
293
|
other: "another image tool of yours, not named yet: ask the player which, then set its name with config pictures-by",
|
|
293
294
|
};
|
|
@@ -398,7 +399,7 @@ export const settingsSchema = z.object({
|
|
|
398
399
|
pictures: z.preprocess((value) => (value === "new places" || value === "new places and quests" ? "new elements" : value), z.enum(pictureWays)).optional().describe("the pictures of places, quests and those met the engine has made on this computer, which spend the player's plan, Codex's or Claude's: none, on request (those the player asks for) "
|
|
399
400
|
+ "or new elements (one for each new place and quest, and for each character and kind of creature the character meets)"),
|
|
400
401
|
"pictures-by": z.string().trim().min(1).optional().describe("who makes the pictures, the player's to choose: chat (the default: this chat by its own means), codex (Codex, from the player's ChatGPT plan, Plus or higher; "
|
|
401
|
-
+ "where it cannot, this chat makes them), elevenlabs (you, with ElevenLabs's image tool), other (another tool of yours the player names: ask which) or that tool's name"),
|
|
402
|
+
+ "where it cannot, this chat makes them), antigravity (Antigravity, from the player's Google plan, a paid one; where it cannot, this chat makes them), elevenlabs (you, with ElevenLabs's image tool), other (another tool of yours the player names: ask which) or that tool's name"),
|
|
402
403
|
effort: z.enum(efforts).optional().describe("how much the master thinks before each answer, the player's to choose: low, medium or high, written where Claude Code and Codex read it in the campaign's folder; "
|
|
403
404
|
+ "unset, each app keeps its own"),
|
|
404
405
|
lines: listSetting.describe("what never appears in the game"),
|