rpg-engine 0.23.1 → 0.24.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 +2 -2
- package/dist/campaign/create-campaign.d.ts +1 -1
- package/dist/campaign/create-campaign.js +1 -1
- package/dist/campaign/find-campaign.js +11 -1
- package/dist/campaign/host-files.d.ts +5 -6
- package/dist/campaign/host-files.js +100 -60
- package/dist/campaign/settings.d.ts +3 -3
- package/dist/campaign/settings.js +5 -4
- package/dist/cli/cli.js +11 -2
- package/dist/commands/config/config.js +1 -1
- package/dist/commands/config/dashboard.js +23 -6
- package/dist/commands/config/words.js +1 -0
- package/dist/commands/image.js +3 -3
- package/dist/commands/import/import.d.ts +3 -1
- package/dist/commands/import/import.js +13 -5
- package/dist/commands/instructions.js +1 -1
- package/dist/commands/shared/campaign/images.js +3 -2
- 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 -9
- 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 +8 -2
- 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 +14 -14
- package/dist/dashboard/guide/cs.md +12 -12
- package/dist/dashboard/guide/da.md +12 -12
- package/dist/dashboard/guide/de.md +11 -11
- package/dist/dashboard/guide/el.md +11 -11
- package/dist/dashboard/guide/en.md +10 -10
- package/dist/dashboard/guide/es.md +11 -11
- package/dist/dashboard/guide/fi.md +11 -11
- package/dist/dashboard/guide/fr.md +12 -12
- package/dist/dashboard/guide/he.md +11 -11
- package/dist/dashboard/guide/hi.md +12 -12
- package/dist/dashboard/guide/hu.md +11 -11
- package/dist/dashboard/guide/is.md +11 -11
- package/dist/dashboard/guide/it.md +38 -38
- package/dist/dashboard/guide/ja.md +12 -12
- package/dist/dashboard/guide/ko.md +12 -12
- package/dist/dashboard/guide/nb.md +11 -11
- package/dist/dashboard/guide/nl.md +11 -11
- package/dist/dashboard/guide/pl.md +11 -11
- package/dist/dashboard/guide/pt.md +11 -11
- package/dist/dashboard/guide/ro.md +12 -12
- package/dist/dashboard/guide/ru.md +12 -12
- package/dist/dashboard/guide/sv.md +13 -13
- package/dist/dashboard/guide/tr.md +13 -13
- package/dist/dashboard/guide/uk.md +11 -11
- package/dist/dashboard/guide/zh.md +12 -12
- package/dist/dashboard/i18n/ar.json +33 -18
- package/dist/dashboard/i18n/cs.json +33 -18
- package/dist/dashboard/i18n/da.json +33 -18
- package/dist/dashboard/i18n/de.json +33 -18
- package/dist/dashboard/i18n/el.json +33 -18
- package/dist/dashboard/i18n/es.json +33 -18
- package/dist/dashboard/i18n/fi.json +33 -18
- package/dist/dashboard/i18n/fr.json +33 -18
- package/dist/dashboard/i18n/he.json +33 -18
- package/dist/dashboard/i18n/hi.json +33 -18
- package/dist/dashboard/i18n/hu.json +33 -18
- package/dist/dashboard/i18n/is.json +33 -18
- package/dist/dashboard/i18n/it.json +113 -98
- package/dist/dashboard/i18n/ja.json +33 -18
- package/dist/dashboard/i18n/ko.json +33 -18
- package/dist/dashboard/i18n/nb.json +33 -18
- package/dist/dashboard/i18n/nl.json +33 -18
- package/dist/dashboard/i18n/pl.json +33 -18
- package/dist/dashboard/i18n/pt.json +33 -18
- package/dist/dashboard/i18n/ro.json +33 -18
- package/dist/dashboard/i18n/ru.json +33 -18
- package/dist/dashboard/i18n/sv.json +33 -18
- package/dist/dashboard/i18n/tr.json +33 -18
- package/dist/dashboard/i18n/uk.json +33 -18
- package/dist/dashboard/i18n/zh.json +33 -18
- package/dist/dashboard/packages/outcomes.js +1 -1
- package/dist/dashboard/packages/packages.js +1 -1
- package/dist/dashboard/parts/icons.js +2 -0
- package/dist/dashboard/parts/labels.js +1 -0
- 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 +65 -40
- 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/shell/pages.js +1 -1
- package/dist/dashboard/shell/top.js +1 -1
- package/dist/dashboard/style.css +122 -47
- package/dist/helpers/antigravity.d.ts +47 -0
- package/dist/helpers/antigravity.js +434 -0
- package/dist/helpers/chosen.d.ts +11 -7
- package/dist/helpers/chosen.js +64 -37
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +2 -1
- package/dist/helpers/opencode.js +117 -24
- 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/bell/antigravity.d.ts +7 -2
- package/dist/server/bell/antigravity.js +24 -6
- package/dist/server/bell/index.d.ts +1 -1
- package/dist/server/bell/index.js +1 -1
- package/dist/server/bell/listener.js +6 -1
- package/dist/server/fence.d.ts +21 -0
- package/dist/server/fence.js +69 -0
- package/dist/server/mcp.js +26 -0
- package/dist/server/player-acts.js +1 -1
- package/dist/server/subagent.d.ts +4 -0
- package/dist/server/subagent.js +30 -0
- package/instructions/voices-antigravity.md +1 -0
- package/instructions/voices-codex.md +1 -0
- package/instructions/voices-opencode.md +1 -1
- package/package.json +1 -1
package/dist/server/mcp.js
CHANGED
|
@@ -30,6 +30,7 @@ import { npmEngine, npmPackages } from "../packages/index.js";
|
|
|
30
30
|
import { loadSystemCode } from "../systems/index.js";
|
|
31
31
|
import { chatKeeper } from "./chats.js";
|
|
32
32
|
import { answers, campaignPageElsewhere, campaignPorts, dashboardAt, isCampaignPage, startDashboard } from "./dashboard/index.js";
|
|
33
|
+
import { fromSubagent, subagentRefusal } from "./subagent.js";
|
|
33
34
|
// While the player decides, the call reports progress this often, so that a host does not take it for a call that hangs.
|
|
34
35
|
const progressEvery = 20 * 1000;
|
|
35
36
|
// A form closed faster than anyone could read it was never shown: the host declares forms it does not show (ASK-6).
|
|
@@ -363,6 +364,13 @@ function inputIssue(tool, issue, given) {
|
|
|
363
364
|
return path === "" ? `${issue.message}.` : `${path}: ${issue.message}.`;
|
|
364
365
|
}
|
|
365
366
|
async function runTool(command, input, context, extra, prepare, installer, outside, examples) {
|
|
367
|
+
// A character's subagent only looks, and takes none of the master's lines (D-580).
|
|
368
|
+
if (fromSubagent(extra._meta)) {
|
|
369
|
+
// Only view, and only as a character: without `as` it would be the player's own view, which is not theirs.
|
|
370
|
+
const as = input?.as;
|
|
371
|
+
const looks = command.name === "view" && typeof as === "string" && as.trim() !== "";
|
|
372
|
+
return looks ? subagentView(command, input, context, extra, prepare, examples) : { content: [{ type: "text", text: subagentRefusal }], isError: true };
|
|
373
|
+
}
|
|
366
374
|
const keepAlive = command.needsPlayer || command.waitsForPlayer
|
|
367
375
|
? reportProgress(extra, () => (context.page?.asking?.() === true ? "waiting for the player's click on the dashboard" : "waiting for the player"))
|
|
368
376
|
: command.slow === true
|
|
@@ -443,6 +451,24 @@ async function runTool(command, input, context, extra, prepare, installer, outsi
|
|
|
443
451
|
}
|
|
444
452
|
}
|
|
445
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* A view of a character's subagent (D-580): it runs as any call, but takes none of the lines meant for the master, as what the player changed or what changed
|
|
456
|
+
* outside the chat, counts in none of the chat's calls, and tells the master's chat nothing.
|
|
457
|
+
*/
|
|
458
|
+
async function subagentView(command, input, context, extra, prepare, examples) {
|
|
459
|
+
try {
|
|
460
|
+
if (context.files instanceof SessionStore) {
|
|
461
|
+
await context.files.ready(false);
|
|
462
|
+
}
|
|
463
|
+
await prepare();
|
|
464
|
+
const checked = checkedInput(command, input, examples.shown);
|
|
465
|
+
const text = command.format(await command.run(checked, { ...context, told: new Set(context.told), signal: extra.signal }));
|
|
466
|
+
return { content: [{ type: "text", text }, masterOnly(context)] };
|
|
467
|
+
}
|
|
468
|
+
catch (error) {
|
|
469
|
+
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }, masterOnly(context)], isError: true };
|
|
470
|
+
}
|
|
471
|
+
}
|
|
446
472
|
/**
|
|
447
473
|
* The campaign's game system installed by itself when it is one of ours not on this computer (SYS-10, D-514 (3)): tried once for each system a campaign of
|
|
448
474
|
* the server's folder names, before a call; its line, that it was installed or why not, for the call that answers.
|
|
@@ -95,5 +95,5 @@ ${already}`;
|
|
|
95
95
|
}
|
|
96
96
|
/** What the master hears of a sentence: the player's words quoted, as their move in the story, which the master rules as any other (D-493 (1)). */
|
|
97
97
|
function actNews(text, quoted) {
|
|
98
|
-
return `The player acts on the dashboard, in their own words, as if said in chat:\n${quoted(text)}\nRule it as the player's move, and answer as to their words in chat.`;
|
|
98
|
+
return `The player acts on the dashboard, in their own words, as if said in chat:\n${quoted(text)}\nRule it as the player's move, and answer as to their words in chat. If you need what they left unsaid to rule it, ask them with buttons.`;
|
|
99
99
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The answer to a subagent's call of any tool but view. */
|
|
2
|
+
export declare const subagentRefusal = "You voice one character here: only view is yours, with as and your character's name. Answer with what you know.";
|
|
3
|
+
/** Whether a tool call comes from a subagent, by its metadata: Codex's turn with thread_source subagent, as an object or as JSON, or Antigravity's parent conversation. */
|
|
4
|
+
export declare function fromSubagent(meta: unknown): boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// The calls of the character agent where the host starts it as a subagent that has every rpg tool, as Codex and Antigravity do (D-580): it may only look.
|
|
2
|
+
/** The answer to a subagent's call of any tool but view. */
|
|
3
|
+
export const subagentRefusal = "You voice one character here: only view is yours, with as and your character's name. Answer with what you know.";
|
|
4
|
+
// The keys of the call's metadata by which Codex and Antigravity say who calls.
|
|
5
|
+
const codexTurnKey = "x-codex-turn-metadata";
|
|
6
|
+
const antigravityParentKey = "antigravity.google/parent_conversation_id";
|
|
7
|
+
/** Whether a tool call comes from a subagent, by its metadata: Codex's turn with thread_source subagent, as an object or as JSON, or Antigravity's parent conversation. */
|
|
8
|
+
export function fromSubagent(meta) {
|
|
9
|
+
if (!isObject(meta)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const parent = meta[antigravityParentKey];
|
|
13
|
+
return (typeof parent === "string" && parent !== "") || codexTurn(meta[codexTurnKey])?.thread_source === "subagent";
|
|
14
|
+
}
|
|
15
|
+
// Codex's turn metadata, which comes as an object or as a JSON string; undefined when it is neither.
|
|
16
|
+
function codexTurn(value) {
|
|
17
|
+
if (typeof value !== "string") {
|
|
18
|
+
return isObject(value) ? value : undefined;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(value);
|
|
22
|
+
return isObject(parsed) ? parsed : undefined;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function isObject(value) {
|
|
29
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Here the agent is the subagent rpg-character, started with invoke_subagent (TypeName rpg-character, Role the character's name, Prompt your words to them). Its answer is not yours to write: it comes by itself, later, as a message from the subagent. Once you started it, end your turn with one short line of the story and nothing else: what the player's character sees of them in the instant before they answer, a pause or a look, never their answer, and never a word about waiting, messages or agents. Narrate their answer only when that message has come.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Here the agent is the agent type rpg-character: start it with spawn_agent, with agent_type rpg-character, fork_turns none and your words to the character as the message, then call wait_agent until its answer comes, and narrate in the same turn, with not a word to the player in between.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Here the agent is the subagent rpg-character, started with the subagent tool,
|
|
1
|
+
Here the agent is the subagent rpg-character, started with the subagent tool (agent rpg-character, prompt your words to them). Its answer is not yours to write: it comes by itself, later, as a <subagent> message. Once you started it, end your turn with one short line of the story and nothing else: what the player's character sees of them in the instant before they answer, a pause or a look, never their answer, and never a word about waiting, messages or agents. Narrate their answer only when that message has come.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rpg-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "Play a tabletop role-playing game with an AI as your game master: the AI tells the story; RPG Engine remembers the world, rolls the dice and keeps the accounts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|